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

#include <GeneralizedPlaneStrainAction.h>

Inheritance diagram for GeneralizedPlaneStrainAction:
[legend]

Public Member Functions

 GeneralizedPlaneStrainAction (const InputParameters &params)
 
void act () override
 

Protected Attributes

std::vector< NonlinearVariableName > _displacements
 
unsigned int _ndisp
 
const unsigned int _out_of_plane_direction
 

Detailed Description

Definition at line 20 of file GeneralizedPlaneStrainAction.h.

Constructor & Destructor Documentation

◆ GeneralizedPlaneStrainAction()

GeneralizedPlaneStrainAction::GeneralizedPlaneStrainAction ( const InputParameters &  params)

Definition at line 56 of file GeneralizedPlaneStrainAction.C.

57  : Action(params),
58  _displacements(getParam<std::vector<NonlinearVariableName>>("displacements")),
59  _ndisp(_displacements.size()),
60  _out_of_plane_direction(getParam<MooseEnum>("out_of_plane_direction"))
61 {
62 }
std::vector< NonlinearVariableName > _displacements

Member Function Documentation

◆ act()

void GeneralizedPlaneStrainAction::act ( )
override

Definition at line 65 of file GeneralizedPlaneStrainAction.C.

66 {
67  // user object name
68  const std::string uo_name = _name + "_GeneralizedPlaneStrainUserObject";
69 
70  //
71  // Add off diagonal Jacobian kernels
72  //
73  if (_current_task == "add_kernel")
74  {
75  std::string k_type = "GeneralizedPlaneStrainOffDiag";
76  InputParameters params = _factory.getValidParams(k_type);
77 
78  params.applyParameters(parameters(), {"scalar_out_of_plane_strain"});
79  params.set<std::vector<VariableName>>("scalar_out_of_plane_strain") = {
80  getParam<NonlinearVariableName>("scalar_out_of_plane_strain")};
81 
82  // add off-diagonal jacobian kernels for the displacements
83  for (unsigned int i = 0; i < _ndisp; ++i)
84  {
85  if (_out_of_plane_direction == i)
86  continue;
87 
88  std::string k_name = _name + "GeneralizedPlaneStrainOffDiag_disp" + Moose::stringify(i);
89  params.set<NonlinearVariableName>("variable") = _displacements[i];
90 
91  _problem->addKernel(k_type, k_name, params);
92  }
93 
94  // add temperature kernel only if temperature is a nonlinear variable (and not an auxvariable)
95  if (isParamValid("temperature"))
96  {
97  NonlinearVariableName temp = getParam<NonlinearVariableName>("temperature");
98  if (_problem->getNonlinearSystemBase().hasVariable(temp))
99  {
100  params.set<NonlinearVariableName>("temperature") = temp;
101 
102  std::string k_name = _name + "_GeneralizedPlaneStrainOffDiag_temp";
103  params.set<NonlinearVariableName>("variable") = temp;
104 
105  _problem->addKernel(k_type, k_name, params);
106  }
107  }
108  }
109 
110  //
111  // Add user object
112  //
113  else if (_current_task == "add_user_object")
114  {
115  std::string uo_type = "GeneralizedPlaneStrainUserObject";
116  InputParameters params = _factory.getValidParams(uo_type);
117 
118  params.applyParameters(parameters());
119  params.set<ExecFlagEnum>("execute_on") = EXEC_LINEAR;
120 
121  _problem->addUserObject(uo_type, uo_name, params);
122  }
123 
124  //
125  // Add scalar kernel
126  //
127  else if (_current_task == "add_scalar_kernel")
128  {
129  std::string sk_type = "GeneralizedPlaneStrain";
130  InputParameters params = _factory.getValidParams(sk_type);
131 
132  params.set<NonlinearVariableName>("variable") =
133  getParam<NonlinearVariableName>("scalar_out_of_plane_strain");
134 
135  // set the UserObjectName from previously added UserObject
136  params.set<UserObjectName>("generalized_plane_strain") = uo_name;
137 
138  _problem->addScalarKernel(sk_type, _name + "_GeneralizedPlaneStrain", params);
139  }
140 }
std::vector< NonlinearVariableName > _displacements

Member Data Documentation

◆ _displacements

std::vector<NonlinearVariableName> GeneralizedPlaneStrainAction::_displacements
protected

Definition at line 28 of file GeneralizedPlaneStrainAction.h.

Referenced by act().

◆ _ndisp

unsigned int GeneralizedPlaneStrainAction::_ndisp
protected

Definition at line 29 of file GeneralizedPlaneStrainAction.h.

Referenced by act().

◆ _out_of_plane_direction

const unsigned int GeneralizedPlaneStrainAction::_out_of_plane_direction
protected

Definition at line 30 of file GeneralizedPlaneStrainAction.h.

Referenced by act().


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