www.mooseframework.org
Public Member Functions | Protected Attributes | List of all members
PressureAction Class Reference

#include <PressureAction.h>

Inheritance diagram for PressureAction:
[legend]

Public Member Functions

 PressureAction (const InputParameters &params)
 
virtual void act () override
 

Protected Attributes

std::vector< std::vector< AuxVariableName > > _save_in_vars
 
std::vector< bool > _has_save_in_vars
 

Detailed Description

Definition at line 15 of file PressureAction.h.

Constructor & Destructor Documentation

◆ PressureAction()

PressureAction::PressureAction ( const InputParameters &  params)

Definition at line 48 of file PressureAction.C.

48  : Action(params)
49 {
50  _save_in_vars.push_back(getParam<std::vector<AuxVariableName>>("save_in_disp_x"));
51  _save_in_vars.push_back(getParam<std::vector<AuxVariableName>>("save_in_disp_y"));
52  _save_in_vars.push_back(getParam<std::vector<AuxVariableName>>("save_in_disp_z"));
53 
54  _has_save_in_vars.push_back(params.isParamValid("save_in_disp_x"));
55  _has_save_in_vars.push_back(params.isParamValid("save_in_disp_y"));
56  _has_save_in_vars.push_back(params.isParamValid("save_in_disp_z"));
57 }
std::vector< bool > _has_save_in_vars
std::vector< std::vector< AuxVariableName > > _save_in_vars

Member Function Documentation

◆ act()

void PressureAction::act ( )
overridevirtual

Definition at line 60 of file PressureAction.C.

61 {
62  const std::string kernel_name = "Pressure";
63 
64  std::vector<NonlinearVariableName> displacements;
65  if (isParamValid("displacements"))
66  displacements = getParam<std::vector<NonlinearVariableName>>("displacements");
67  else
68  {
69  // Legacy parameter scheme for displacements
70  if (!isParamValid("disp_x"))
71  mooseError("Specify displacement variables using the `displacements` parameter.");
72  displacements.push_back(getParam<NonlinearVariableName>("disp_x"));
73 
74  if (isParamValid("disp_y"))
75  {
76  displacements.push_back(getParam<NonlinearVariableName>("disp_y"));
77  if (isParamValid("disp_z"))
78  displacements.push_back(getParam<NonlinearVariableName>("disp_z"));
79  }
80  }
81 
82  // Create pressure BCs
83  for (unsigned int i = 0; i < displacements.size(); ++i)
84  {
85  // Create unique kernel name for each of the components
86  std::string unique_kernel_name = kernel_name + "_" + _name + "_" + Moose::stringify(i);
87 
88  InputParameters params = _factory.getValidParams(kernel_name);
89  params.applyParameters(parameters());
90  params.set<bool>("use_displaced_mesh") = true;
91  params.set<unsigned int>("component") = i;
92  params.set<NonlinearVariableName>("variable") = displacements[i];
93 
94  if (_has_save_in_vars[i])
95  params.set<std::vector<AuxVariableName>>("save_in") = _save_in_vars[i];
96 
97  _problem->addBoundaryCondition(kernel_name, unique_kernel_name, params);
98  }
99 }
std::vector< bool > _has_save_in_vars
std::vector< std::vector< AuxVariableName > > _save_in_vars

Member Data Documentation

◆ _has_save_in_vars

std::vector<bool> PressureAction::_has_save_in_vars
protected

Definition at line 24 of file PressureAction.h.

Referenced by act(), and PressureAction().

◆ _save_in_vars

std::vector<std::vector<AuxVariableName> > PressureAction::_save_in_vars
protected

Definition at line 23 of file PressureAction.h.

Referenced by act(), and PressureAction().


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