https://mooseframework.inl.gov
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
PressureActionBase Class Reference

Pressure boundary condition action template. More...

#include <PressureAction.h>

Inheritance diagram for PressureActionBase:
[legend]

Public Types

typedef DataFileName DataFileParameterType
 

Public Member Functions

 PressureActionBase (const InputParameters &params, const std::string &non_ad_pressure_bc_type, const std::string &ad_pressure_bc_type)
 
virtual void act () override
 
void timedAct ()
 
virtual void addRelationshipManagers (Moose::RelationshipManagerType when_type)
 
MooseObjectName uniqueActionName () const
 
const std::string & specificTaskName () const
 
const std::set< std::string > & getAllTasks () const
 
void appendTask (const std::string &task)
 
MooseAppgetMooseApp () const
 
const std::string & type () const
 
virtual const std::string & name () const
 
std::string typeAndName () const
 
std::string errorPrefix (const std::string &error_type) const
 
void callMooseError (std::string msg, const bool with_prefix) const
 
MooseObjectParameterName uniqueParameterName (const std::string &parameter_name) const
 
const InputParametersparameters () const
 
MooseObjectName uniqueName () const
 
const T & getParam (const std::string &name) const
 
std::vector< std::pair< T1, T2 > > getParam (const std::string &param1, const std::string &param2) const
 
const T * queryParam (const std::string &name) const
 
const T & getRenamedParam (const std::string &old_name, const std::string &new_name) const
 
getCheckedPointerParam (const std::string &name, const std::string &error_string="") const
 
bool isParamValid (const std::string &name) const
 
bool isParamSetByUser (const std::string &nm) const
 
void paramError (const std::string &param, Args... args) const
 
void paramWarning (const std::string &param, Args... args) const
 
void paramInfo (const std::string &param, Args... args) const
 
void connectControllableParams (const std::string &parameter, const std::string &object_type, const std::string &object_name, const std::string &object_parameter) const
 
void mooseError (Args &&... args) const
 
void mooseErrorNonPrefixed (Args &&... args) const
 
void mooseDocumentedError (const std::string &repo_name, const unsigned int issue_num, Args &&... args) const
 
void mooseWarning (Args &&... args) const
 
void mooseWarningNonPrefixed (Args &&... args) const
 
void mooseDeprecated (Args &&... args) const
 
void mooseInfo (Args &&... args) const
 
std::string getDataFileName (const std::string &param) const
 
std::string getDataFileNameByName (const std::string &relative_path) const
 
std::string getDataFilePath (const std::string &relative_path) const
 
PerfGraphperfGraph ()
 
const Parallel::Communicator & comm () const
 
processor_id_type n_processors () const
 
processor_id_type processor_id () const
 

Static Public Member Functions

template<class T >
static InputParameters validParams ()
 

Public Attributes

const ConsoleStream _console
 

Static Public Attributes

static constexpr auto SYSTEM
 
static constexpr auto NAME
 

Protected Member Functions

bool addRelationshipManagers (Moose::RelationshipManagerType when_type, const InputParameters &moose_object_pars)
 
void associateWithParameter (const std::string &param_name, InputParameters &params) const
 
void associateWithParameter (const InputParameters &from_params, const std::string &param_name, InputParameters &params) const
 
const T & getMeshProperty (const std::string &data_name, const std::string &prefix)
 
const T & getMeshProperty (const std::string &data_name)
 
bool hasMeshProperty (const std::string &data_name, const std::string &prefix) const
 
bool hasMeshProperty (const std::string &data_name, const std::string &prefix) const
 
bool hasMeshProperty (const std::string &data_name) const
 
bool hasMeshProperty (const std::string &data_name) const
 
std::string meshPropertyName (const std::string &data_name) const
 
PerfID registerTimedSection (const std::string &section_name, const unsigned int level) const
 
PerfID registerTimedSection (const std::string &section_name, const unsigned int level, const std::string &live_message, const bool print_dots=true) const
 
std::string timedSectionName (const std::string &section_name) const
 

Static Protected Member Functions

static std::string meshPropertyName (const std::string &data_name, const std::string &prefix)
 

Protected Attributes

const std::string _non_ad_pressure_bc_type
 
const std::string _ad_pressure_bc_type
 
const bool _use_ad
 Flag to use automatic differentiation. More...
 
const std::vector< std::vector< AuxVariableName > > _save_in_vars
 
const std::vector< bool > _has_save_in_vars
 
std::string _registered_identifier
 
std::string _specific_task_name
 
std::set< std::string > _all_tasks
 
ActionWarehouse_awh
 
const std::string & _current_task
 
std::shared_ptr< MooseMesh > & _mesh
 
std::shared_ptr< MooseMesh > & _displaced_mesh
 
std::shared_ptr< FEProblemBase > & _problem
 
PerfID _act_timer
 
MooseApp_app
 
const std::string _type
 
const std::string _name
 
const InputParameters_pars
 
Factory_factory
 
ActionFactory_action_factory
 
MooseApp_pg_moose_app
 
const std::string _prefix
 
const Parallel::Communicator & _communicator
 

Detailed Description

Pressure boundary condition action template.

The type T is used to get the valid parameters through T::actionParams(). The two strings passed into the constructor are the registred type names of teh MOOSE BC objects without and with automatic differentiation.

Definition at line 47 of file PressureAction.h.

Constructor & Destructor Documentation

◆ PressureActionBase()

PressureActionBase::PressureActionBase ( const InputParameters params,
const std::string &  non_ad_pressure_bc_type,
const std::string &  ad_pressure_bc_type 
)

Definition at line 15 of file PressureAction.C.

18  : Action(params),
19  _non_ad_pressure_bc_type(non_ad_pressure_bc_type),
20  _ad_pressure_bc_type(ad_pressure_bc_type),
21  _use_ad(getParam<bool>("use_automatic_differentiation")),
22  _save_in_vars({getParam<std::vector<AuxVariableName>>("save_in_disp_x"),
23  getParam<std::vector<AuxVariableName>>("save_in_disp_y"),
24  getParam<std::vector<AuxVariableName>>("save_in_disp_z")}),
25  _has_save_in_vars({params.isParamValid("save_in_disp_x"),
26  params.isParamValid("save_in_disp_y"),
27  params.isParamValid("save_in_disp_z")})
28 {
29 }
Action(const InputParameters &parameters)
const std::vector< std::vector< AuxVariableName > > _save_in_vars
const std::vector< bool > _has_save_in_vars
const T & getParam(const std::string &name) const
const bool _use_ad
Flag to use automatic differentiation.
const std::string _ad_pressure_bc_type
const std::string _non_ad_pressure_bc_type
bool isParamValid(const std::string &name) const

Member Function Documentation

◆ act()

void PressureActionBase::act ( )
overridevirtual

Implements Action.

Definition at line 32 of file PressureAction.C.

33 {
34  const auto bc_type = _use_ad ? _ad_pressure_bc_type : _non_ad_pressure_bc_type;
35 
36  std::vector<VariableName> displacements = getParam<std::vector<VariableName>>("displacements");
37  // Create pressure BCs
38  for (unsigned int i = 0; i < displacements.size(); ++i)
39  {
40  // Create unique kernel name for each of the components
41  std::string bc_name = bc_type + "_" + _name + "_" + Moose::stringify(i);
42 
43  InputParameters params = _factory.getValidParams(bc_type);
44  params.applyParameters(parameters());
45 
46  params.set<NonlinearVariableName>("variable") = displacements[i];
47  if (_has_save_in_vars[i])
48  params.set<std::vector<AuxVariableName>>("save_in") = _save_in_vars[i];
49 
50  _problem->addBoundaryCondition(bc_type, bc_name, params);
51 
52  // The three BCs can no longer be controlled independently.
53  // We agreed on PR#29603 that this was not a problem
54  if (isParamValid("enable"))
55  connectControllableParams("enable", bc_type, bc_name, "enable");
56  }
57 }
const std::vector< std::vector< AuxVariableName > > _save_in_vars
T & set(const std::string &name, bool quiet_mode=false)
InputParameters getValidParams(const std::string &name) const
void applyParameters(const InputParameters &common, const std::vector< std::string > &exclude={}, const bool allow_private=false)
bool isParamValid(const std::string &name) const
Factory & _factory
const std::vector< bool > _has_save_in_vars
const bool _use_ad
Flag to use automatic differentiation.
void connectControllableParams(const std::string &parameter, const std::string &object_type, const std::string &object_name, const std::string &object_parameter) const
std::string stringify(const T &t)
const std::string _name
const std::string _ad_pressure_bc_type
std::shared_ptr< FEProblemBase > & _problem
const InputParameters & parameters() const
const std::string _non_ad_pressure_bc_type

◆ validParams()

template<class T >
InputParameters PressureActionBase::validParams ( )
static

Definition at line 72 of file PressureAction.h.

73 {
75  params += T::actionParams();
76 
77  params.addParam<std::vector<BoundaryName>>(
78  "boundary", "The list of boundaries (ids or names) from the mesh where this object applies");
79 
80  params.addClassDescription("Set up Pressure boundary conditions");
81  params.addParam<bool>("use_automatic_differentiation",
82  false,
83  "Flag to use automatic differentiation (AD) objects when possible");
84 
85  // To make controlling the Pressure BCs easier
86  params.addParam<bool>(
87  "enable",
88  true,
89  "Set the enabled status of the BCs created by the Pressure action (defaults to true).");
90  params.declareControllable("enable");
91 
92  // Residual output
93  params.addParam<std::vector<AuxVariableName>>(
94  "save_in_disp_x", {}, "The save_in variables for x displacement");
95  params.addParam<std::vector<AuxVariableName>>(
96  "save_in_disp_y", {}, "The save_in variables for y displacement");
97  params.addParam<std::vector<AuxVariableName>>(
98  "save_in_disp_z", {}, "The save_in variables for z displacement");
99  params.addParam<std::vector<TagName>>("extra_vector_tags",
100  "The extra tags for the vectors this Kernel should fill");
101  params.addParam<std::vector<TagName>>(
102  "absolute_value_vector_tags",
103  "The tags for the vectors this residual object should fill with the "
104  "absolute value of the residual contribution");
105 
106  params.addParam<bool>(
107  "use_displaced_mesh",
108  "Whether or not this object should use the displaced mesh for computation. Note that in "
109  "the case this is true but no displacements are provided in the Mesh block the undisplaced "
110  "mesh will still be used. For small strain formulations pressure should be applied to the "
111  "undisplaced mesh to obtain agreement with analytical benchmark solutions.");
112 
113  params.addParamNamesToGroup(
114  "save_in_disp_x save_in_disp_y save_in_disp_z extra_vector_tags absolute_value_vector_tags",
115  "Residual output");
116  return params;
117 }
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
static InputParameters validParams()
void addClassDescription(const std::string &doc_string)
void declareControllable(const std::string &name, std::set< ExecFlagType > execute_flags={})
void addParamNamesToGroup(const std::string &space_delim_names, const std::string group_name)

Member Data Documentation

◆ _ad_pressure_bc_type

const std::string PressureActionBase::_ad_pressure_bc_type
protected

Definition at line 61 of file PressureAction.h.

Referenced by act().

◆ _has_save_in_vars

const std::vector<bool> PressureActionBase::_has_save_in_vars
protected

Definition at line 67 of file PressureAction.h.

Referenced by act().

◆ _non_ad_pressure_bc_type

const std::string PressureActionBase::_non_ad_pressure_bc_type
protected

Definition at line 60 of file PressureAction.h.

Referenced by act().

◆ _save_in_vars

const std::vector<std::vector<AuxVariableName> > PressureActionBase::_save_in_vars
protected

Definition at line 66 of file PressureAction.h.

Referenced by act().

◆ _use_ad

const bool PressureActionBase::_use_ad
protected

Flag to use automatic differentiation.

Definition at line 64 of file PressureAction.h.

Referenced by act().


The documentation for this class was generated from the following files: