Loading [MathJax]/jax/input/TeX/config.js
https://mooseframework.inl.gov
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
SideFVFluxBCIntegral.C
Go to the documentation of this file.
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 
16 
19 {
21  params.addRequiredParam<std::vector<std::string>>(
22  "fvbcs", "List of boundary conditions whose contribution we want to integrate.");
23  params.addClassDescription(
24  "Computes the side integral of different finite volume flux boundary conditions.");
25  return params;
26 }
27 
29  : SideIntegralPostprocessor(parameters), _bc_names(getParam<std::vector<std::string>>("fvbcs"))
30 {
31  _qp_integration = false;
32 }
33 
34 void
36 {
38 
39  // BCs are constructed after the postprocessors so we shall do this
40  // in the initialization step.
41  auto base_query = _fe_problem.theWarehouse()
42  .query()
43  .condition<AttribSystem>("FVFluxBC")
44  .condition<AttribThread>(_tid);
45 
46  // Fetch the mentioned boundary conditions
47  _bc_objects.clear();
48  for (const auto & name : _bc_names)
49  {
50  std::vector<FVFluxBC *> flux_bcs;
51  base_query.condition<AttribName>(name).queryInto(flux_bcs);
52  if (flux_bcs.size() == 0)
53  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  _bc_objects.push_back(flux_bcs[0]);
62  }
63 
64  // Check if the boundary restriction of the objects is the same.
65  for (const auto bc_ptr : _bc_objects)
66  // Comparing ordered sets
67  if (this->boundaryIDs() != bc_ptr->boundaryIDs())
68  paramError("fvbcs",
69  "The given boundary condition with name ",
70  bc_ptr->name(),
71  " does not have the same boundary restriction as this postprocessor!");
72 }
73 
74 Real
76 {
77  Real flux_value = 0.0;
78  for (auto bc_ptr : _bc_objects)
79  {
80  bc_ptr->updateCurrentFace(*fi);
81  flux_value += MetaPhysicL::raw_value(bc_ptr->computeQpResidual());
82  }
83  return flux_value;
84 }
85 
86 Real
88 {
89  mooseError("We should never call this function!");
90 }
bool _qp_integration
Whether to integrate over quadrature points or FaceInfos.
virtual Real computeFaceInfoIntegral(const FaceInfo *fi) override
const std::vector< std::string > _bc_names
The names of the boundary conditions that we would like to integrate.
static InputParameters validParams()
auto raw_value(const Eigen::Map< T > &in)
Definition: EigenADReal.h:73
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
virtual const std::string & name() const
Get the name of the class.
Definition: MooseBase.h:57
void addRequiredParam(const std::string &name, const std::string &doc_string)
This method adds a parameter and documentation string to the InputParameters object that will be extr...
This data structure is used to store geometric and variable related metadata about each cell face in ...
Definition: FaceInfo.h:36
registerMooseObject("MooseApp", SideFVFluxBCIntegral)
TheWarehouse & theWarehouse() const
static InputParameters validParams()
SideFVFluxBCIntegral(const InputParameters &parameters)
This postprocessor computes a surface integral of the specified variable on a sideset on the boundary...
void paramError(const std::string &param, Args... args) const
Emits an error prefixed with the file and line number of the given param (from the input file) along ...
virtual void initialSetup() override
Gets called at the beginning of the simulation before this object is asked to do its job...
virtual void initialSetup() override
Gets called at the beginning of the simulation before this object is asked to do its job...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
FEProblemBase & _fe_problem
Reference to the FEProblemBase for this user object.
Definition: UserObject.h:209
Query query()
query creates and returns an initialized a query object for querying objects from the warehouse...
Definition: TheWarehouse.h:466
This postprocessor computes the side integral of different finite volume flux boundary conditions...
const THREAD_ID _tid
Thread ID of this postprocessor.
Definition: UserObject.h:216
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type.
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump...
QueryCache & condition(Args &&... args)
Adds a new condition to the query.
Definition: TheWarehouse.h:284
virtual Real computeQpIntegral() override
virtual const std::set< BoundaryID > & boundaryIDs() const
Return the boundary IDs for this object.
std::vector< FVFluxBC * > _bc_objects
Pointers to the boundary conditions which will be integrated.