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 "SideFVFluxBCIntegral.h" 11 : #include "FVFluxBC.h" 12 : 13 : #include "metaphysicl/raw_type.h" 14 : 15 : registerMooseObject("MooseApp", SideFVFluxBCIntegral); 16 : 17 : InputParameters 18 14299 : SideFVFluxBCIntegral::validParams() 19 : { 20 14299 : InputParameters params = SideIntegralPostprocessor::validParams(); 21 14299 : params.addRequiredParam<std::vector<std::string>>( 22 : "fvbcs", "List of boundary conditions whose contribution we want to integrate."); 23 14299 : params.addClassDescription( 24 : "Computes the side integral of different finite volume flux boundary conditions."); 25 14299 : return params; 26 0 : } 27 : 28 18 : SideFVFluxBCIntegral::SideFVFluxBCIntegral(const InputParameters & parameters) 29 18 : : SideIntegralPostprocessor(parameters), _bc_names(getParam<std::vector<std::string>>("fvbcs")) 30 : { 31 18 : _qp_integration = false; 32 18 : } 33 : 34 : void 35 17 : SideFVFluxBCIntegral::initialSetup() 36 : { 37 17 : SideIntegralPostprocessor::initialSetup(); 38 : 39 : // BCs are constructed after the postprocessors so we shall do this 40 : // in the initialization step. 41 17 : auto base_query = _fe_problem.theWarehouse() 42 34 : .query() 43 17 : .condition<AttribSystem>("FVFluxBC") 44 17 : .condition<AttribThread>(_tid); 45 : 46 : // Fetch the mentioned boundary conditions 47 17 : _bc_objects.clear(); 48 30 : for (const auto & name : _bc_names) 49 : { 50 17 : std::vector<FVFluxBC *> flux_bcs; 51 17 : base_query.condition<AttribName>(name).queryInto(flux_bcs); 52 17 : if (flux_bcs.size() == 0) 53 4 : paramError("fvbcs", 54 : "The given FVFluxBC with name '", 55 : name, 56 : "' was not found! This can be due to the boundary condition not existing in the " 57 : "'FVBCs' block or the boundary condition not inheriting from FVFluxBC."); 58 : 59 : // We expect the code to error at an earlier stage if there are more than one 60 : // BCs with the same name 61 13 : _bc_objects.push_back(flux_bcs[0]); 62 13 : } 63 : 64 : // Check if the boundary restriction of the objects is the same. 65 26 : for (const auto bc_ptr : _bc_objects) 66 : // Comparing ordered sets 67 13 : if (this->boundaryIDs() != bc_ptr->boundaryIDs()) 68 0 : paramError("fvbcs", 69 : "The given boundary condition with name ", 70 0 : bc_ptr->name(), 71 : " does not have the same boundary restriction as this postprocessor!"); 72 13 : } 73 : 74 : Real 75 24 : SideFVFluxBCIntegral::computeFaceInfoIntegral(const FaceInfo * const fi) 76 : { 77 24 : Real flux_value = 0.0; 78 48 : for (auto bc_ptr : _bc_objects) 79 : { 80 24 : bc_ptr->updateCurrentFace(*fi); 81 24 : flux_value += MetaPhysicL::raw_value(bc_ptr->computeQpResidual()); 82 : } 83 24 : return flux_value; 84 : } 85 : 86 : Real 87 0 : SideFVFluxBCIntegral::computeQpIntegral() 88 : { 89 0 : mooseError("We should never call this function!"); 90 : }