https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
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.");
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
34void
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
74Real
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
86Real
88{
89 mooseError("We should never call this function!");
90}
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Definition MooseError.h:311
registerMooseObject("MooseApp", SideFVFluxBCIntegral)
virtual const std::set< BoundaryID > & boundaryIDs() const
Return the boundary IDs for this object.
TheWarehouse & theWarehouse() const
This data structure is used to store geometric and variable related metadata about each cell face in ...
Definition FaceInfo.h:38
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
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...
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.
const std::string & name() const
Get the name of the class.
Definition MooseBase.h:103
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 ...
Definition MooseBase.h:457
This postprocessor computes the side integral of different finite volume flux boundary conditions.
virtual Real computeQpIntegral() override
virtual void initialSetup() override
Gets called at the beginning of the simulation before this object is asked to do its job.
std::vector< FVFluxBC * > _bc_objects
Pointers to the boundary conditions which will be integrated.
const std::vector< std::string > _bc_names
The names of the boundary conditions that we would like to integrate.
static InputParameters validParams()
SideFVFluxBCIntegral(const InputParameters &parameters)
virtual Real computeFaceInfoIntegral(const FaceInfo *fi) override
This postprocessor computes a surface integral of the specified variable on a sideset on the boundary...
bool _qp_integration
Whether to integrate over quadrature points or FaceInfos.
static InputParameters validParams()
virtual void initialSetup() override
Gets called at the beginning of the simulation before this object is asked to do its job.
QueryCache & condition(Args &&... args)
Adds a new condition to the query.
Query query()
query creates and returns an initialized a query object for querying objects from the warehouse.
FEProblemBase & _fe_problem
Reference to the FEProblemBase for this user object.
const THREAD_ID _tid
Thread ID of this postprocessor.
auto raw_value(const Eigen::Map< T > &in)