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

Action that sets up pressure boundary condition on displacement variables. More...

#include <CoupledPressureAction.h>

Inheritance diagram for CoupledPressureAction:
[legend]

Public Member Functions

 CoupledPressureAction (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

Action that sets up pressure boundary condition on displacement variables.

Definition at line 23 of file CoupledPressureAction.h.

Constructor & Destructor Documentation

◆ CoupledPressureAction()

CoupledPressureAction::CoupledPressureAction ( const InputParameters &  params)

Definition at line 46 of file CoupledPressureAction.C.

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

Member Function Documentation

◆ act()

void CoupledPressureAction::act ( )
overridevirtual

Definition at line 58 of file CoupledPressureAction.C.

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

Definition at line 32 of file CoupledPressureAction.h.

Referenced by act(), and CoupledPressureAction().

◆ _save_in_vars

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

Definition at line 31 of file CoupledPressureAction.h.

Referenced by act(), and CoupledPressureAction().


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