Line data Source code
1 : //* This file is part of the MOOSE framework 2 : //* https://mooseframework.inl.gov 3 : //* 4 : //* All rights reserved, see COPYRIGHT for full restrictions 5 : //* https://github.com/idaholab/moose/blob/master/COPYRIGHT 6 : //* 7 : //* Licensed under LGPL 2.1, please see LICENSE for details 8 : //* https://www.gnu.org/licenses/lgpl-2.1.html 9 : 10 : #include "ExposedSideAverageValue.h" 11 : #include "SelfShadowSideUserObject.h" 12 : 13 : registerMooseObject("HeatTransferApp", ExposedSideAverageValue); 14 : 15 : InputParameters 16 103 : ExposedSideAverageValue::validParams() 17 : { 18 103 : InputParameters params = SideAverageValue::validParams(); 19 103 : params.addClassDescription("Computes the average value of a variable on the " 20 : "exposed portion of a sideset. Note that this cannot be used on the " 21 : "centerline of an axisymmetric model."); 22 206 : params.addRequiredParam<UserObjectName>("self_shadow_uo", 23 : "SelfShadowSideUserObject that calculates the " 24 : "illumination state of element sides in a side set"); 25 103 : return params; 26 0 : } 27 : 28 56 : ExposedSideAverageValue::ExposedSideAverageValue(const InputParameters & parameters) 29 : : SideAverageValue(parameters), 30 56 : _self_shadow(getUserObject<SelfShadowSideUserObject>("self_shadow_uo")) 31 : { 32 112 : if (_self_shadow.useDisplacedMesh() != getParam<bool>("use_displaced_mesh")) 33 0 : paramError("use_displaced_mesh", 34 : "The SelfShadowSideUserObject should operate on the same mesh (displaced or " 35 : "undisplaced) as this PostProcessor."); 36 56 : } 37 : 38 : Real 39 7536 : ExposedSideAverageValue::computeQpIntegral() 40 : { 41 7536 : const SelfShadowSideUserObject::SideIDType id(_current_elem->id(), _current_side); 42 7536 : const unsigned int illumination = _self_shadow.illumination(id); 43 : // tests if the bit at position _qp is set 44 7536 : if (illumination & (1 << _qp)) 45 3191 : return SideAverageValue::computeQpIntegral(); 46 : else 47 : return 0.0; 48 : } 49 : 50 : Real 51 2928 : ExposedSideAverageValue::volume() 52 : { 53 : Real curr_exposed_side_volume = 0.0; 54 2928 : const SelfShadowSideUserObject::SideIDType id(_current_elem->id(), _current_side); 55 2928 : const unsigned int illumination = _self_shadow.illumination(id); 56 10464 : for (const unsigned int qp : make_range(_qrule->n_points())) 57 : { 58 : // tests if the bit at position _qp is set 59 7536 : if (illumination & (1 << qp)) 60 3191 : curr_exposed_side_volume += _JxW[qp] * _coord[qp]; 61 : } 62 2928 : return curr_exposed_side_volume; 63 : }