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
 

Detailed Description

Definition at line 17 of file GeneralizedPlaneStrainAction.h.

Constructor & Destructor Documentation

GeneralizedPlaneStrainAction::GeneralizedPlaneStrainAction ( const InputParameters &  params)

Definition at line 44 of file GeneralizedPlaneStrainAction.C.

45  : Action(params),
46  _displacements(getParam<std::vector<NonlinearVariableName>>("displacements")),
47  _ndisp(_displacements.size())
48 {
49  if (_ndisp > 2)
50  mooseError("GeneralizedPlaneStrain only works for 1D axisymmetric or 2D generalized plane "
51  "strain cases!");
52 }
std::vector< NonlinearVariableName > _displacements

Member Function Documentation

void GeneralizedPlaneStrainAction::act ( )
override

Definition at line 55 of file GeneralizedPlaneStrainAction.C.

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

Member Data Documentation

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

Definition at line 25 of file GeneralizedPlaneStrainAction.h.

Referenced by act().

unsigned int GeneralizedPlaneStrainAction::_ndisp
protected

Definition at line 26 of file GeneralizedPlaneStrainAction.h.

Referenced by act(), and GeneralizedPlaneStrainAction().


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