https://mooseframework.inl.gov
Loading...
Searching...
No Matches
IntegratedBCBase.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 "IntegratedBCBase.h"
11#include "Assembly.h"
12
15{
18
19 params.addParam<std::vector<AuxVariableName>>(
20 "save_in",
21 {},
22 "The name of auxiliary variables to save this BC's residual contributions to. "
23 "Everything about that variable must match everything about this variable (the "
24 "type, what blocks it's on, etc.)");
25 params.addParam<std::vector<AuxVariableName>>(
26 "diag_save_in",
27 {},
28 "The name of auxiliary variables to save this BC's diagonal jacobian "
29 "contributions to. Everything about that variable must match everything "
30 "about this variable (the type, what blocks it's on, etc.)");
31
32 params.addParamNamesToGroup("diag_save_in save_in", "Advanced");
33
34 params.addParam<bool>(
35 "skip_execution_outside_variable_domain",
36 false,
37 "Whether to skip execution of this boundary condition when the variable it "
38 "applies to is not defined on the boundary. This can facilitate setups with "
39 "moving variable domains and fixed boundaries. Note that the FEProblem boundary-restricted "
40 "integrity checks will also need to be turned off if using this option");
41 params.addParamNamesToGroup("skip_execution_outside_variable_domain", "Advanced");
42
43 // Integrated BCs always rely on Boundary MaterialData
44 params.set<Moose::MaterialDataType>("_material_data_type") = Moose::BOUNDARY_MATERIAL_DATA;
45
46 return params;
47}
48
50 : BoundaryCondition(parameters, false), // False is because this is NOT nodal
52 MaterialPropertyInterface(this, Moose::EMPTY_BLOCK_IDS, boundaryIDs()),
53 _current_elem(_assembly.elem()),
54 _current_elem_volume(_assembly.elemVolume()),
55 _current_side(_assembly.side()),
56 _current_side_elem(_assembly.sideElem()),
57 _current_side_volume(_assembly.sideElemVolume()),
58 _current_boundary_id(_assembly.currentBoundaryID()),
59 _qrule(_assembly.qRuleFace()),
60 _q_point(_assembly.qPointsFace()),
61 _JxW(_assembly.JxWFace()),
62 _coord(_assembly.coordTransformation()),
63 _save_in_strings(parameters.get<std::vector<AuxVariableName>>("save_in")),
64 _diag_save_in_strings(parameters.get<std::vector<AuxVariableName>>("diag_save_in")),
65 _skip_execution_outside_variable_domain(
66 getParam<bool>("skip_execution_outside_variable_domain"))
67{
68}
69
70void
71IntegratedBCBase::prepareShapes(const unsigned int var_num)
72{
74}
75
76bool
78{
79#ifdef DEBUG
80 const bool check_subdomain = true;
81#else
82 const bool check_subdomain = false;
83#endif
84 if (_skip_execution_outside_variable_domain || check_subdomain)
85 {
86 mooseAssert(_current_elem, "Should have a current element");
87 const auto block_id = _current_elem->subdomain_id();
88#ifdef DEBUG
89 if (!_skip_execution_outside_variable_domain && !variable().hasBlocks(block_id))
90 mooseError("This boundary condition is being executed outside the domain of "
91 "definition of its variable, on subdomain: ",
92 block_id);
93#endif
94 if (!variable().hasBlocks(block_id))
95 return false;
96 }
97 return true;
98}
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Definition MooseError.h:311
Base class for creating new types of boundary conditions.
static InputParameters validParams()
Intermediate base class that ties together all the interfaces for getting MooseVariableFEBases with t...
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
void addParamNamesToGroup(const std::string &space_delim_names, const std::string group_name)
This method takes a space delimited list of parameter names and adds them to the specified group name...
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an optional parameter and a documentation string to the InputParameters object.
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
static InputParameters validParams()
IntegratedBCBase(const InputParameters &parameters)
void prepareShapes(unsigned int var_num) override final
Prepare shape functions.
const Elem *const & _current_elem
current element
virtual bool shouldApply() const override
Hook for turning the boundary condition on and off.
const bool _skip_execution_outside_variable_domain
Whether to allow skipping the execution of the boundary condition outside of its domain of definition...
An interface for accessing Materials.
static InputParameters validParams()
THREAD_ID _tid
The thread ID for this kernel.
virtual const MooseVariableBase & variable() const =0
Returns the variable that this object operates on.
SubProblem & _subproblem
Reference to this kernel's SubProblem.
virtual void prepareFaceShapes(unsigned int var, const THREAD_ID tid)=0
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...
MaterialDataType
MaterialData types.
Definition MooseTypes.h:746
@ BOUNDARY_MATERIAL_DATA
Definition MooseTypes.h:748