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 12 of file PressureAction.h.

Constructor & Destructor Documentation

PressureAction::PressureAction ( const InputParameters &  params)

Definition at line 43 of file PressureAction.C.

43  : Action(params)
44 {
45  _save_in_vars.push_back(getParam<std::vector<AuxVariableName>>("save_in_disp_x"));
46  _save_in_vars.push_back(getParam<std::vector<AuxVariableName>>("save_in_disp_y"));
47  _save_in_vars.push_back(getParam<std::vector<AuxVariableName>>("save_in_disp_z"));
48 
49  _has_save_in_vars.push_back(params.isParamValid("save_in_disp_x"));
50  _has_save_in_vars.push_back(params.isParamValid("save_in_disp_y"));
51  _has_save_in_vars.push_back(params.isParamValid("save_in_disp_z"));
52 }
std::vector< bool > _has_save_in_vars
std::vector< std::vector< AuxVariableName > > _save_in_vars

Member Function Documentation

void PressureAction::act ( )
overridevirtual

Definition at line 55 of file PressureAction.C.

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

Member Data Documentation

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

Definition at line 21 of file PressureAction.h.

Referenced by act(), and PressureAction().

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

Definition at line 20 of file PressureAction.h.

Referenced by act(), and PressureAction().


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