12 #include "Conversion.h"
13 #include "FEProblem.h"
14 #include "MooseMesh.h"
15 #include "NonlinearSystemBase.h"
29 params.addClassDescription(
"Set up the GeneralizedPlaneStrain environment");
30 params.addRequiredParam<std::vector<VariableName>>(
"displacements",
"The displacement variables");
31 params.addRequiredParam<VariableName>(
"scalar_out_of_plane_strain",
32 "Scalar variable for the out-of-plane strain (in "
33 "y direction for 1D Axisymmetric or in z "
34 "direction for 2D Cartesian problems)");
35 params.addParam<VariableName>(
"temperature",
"The temperature variable");
36 MooseEnum outOfPlaneDirection(
"x y z",
"z");
37 params.addParam<MooseEnum>(
38 "out_of_plane_direction", outOfPlaneDirection,
"The direction of the out-of-plane strain.");
39 params.addParam<FunctionName>(
"out_of_plane_pressure",
41 "Function used to prescribe pressure "
42 "in the out-of-plane direction (y "
43 "for 1D Axisymmetric or z for 2D "
44 "Cartesian problems)");
45 params.addParam<Real>(
"factor", 1.0,
"Scale factor applied to prescribed pressure");
46 params.addParam<
bool>(
"use_displaced_mesh",
false,
"Whether to use displaced mesh");
47 params.addParam<std::string>(
"base_name",
"Material property base name");
48 params.addParam<std::vector<SubdomainName>>(
"block",
49 "The list of ids of the blocks (subdomain) "
50 "that the GeneralizedPlaneStrain kernels "
51 "will be applied to");
52 params.addParam<std::vector<TagName>>(
54 "The tag names for extra vectors that residual data should be saved into");
61 _displacements(getParam<std::vector<VariableName>>(
"displacements")),
62 _ndisp(_displacements.size()),
63 _out_of_plane_direction(getParam<MooseEnum>(
"out_of_plane_direction"))
71 const std::string uo_name = _name +
"_GeneralizedPlaneStrainUserObject";
76 if (_current_task ==
"add_kernel")
78 std::string k_type =
"GeneralizedPlaneStrainOffDiag";
79 InputParameters params = _factory.getValidParams(k_type);
81 params.applyParameters(parameters(), {
"scalar_out_of_plane_strain"});
82 params.set<std::vector<VariableName>>(
"scalar_out_of_plane_strain") = {
83 getParam<VariableName>(
"scalar_out_of_plane_strain")};
86 for (
unsigned int i = 0; i <
_ndisp; ++i)
91 std::string k_name = _name +
"GeneralizedPlaneStrainOffDiag_disp" + Moose::stringify(i);
94 _problem->addKernel(k_type, k_name, params);
98 if (isParamValid(
"temperature"))
100 VariableName temp = getParam<VariableName>(
"temperature");
101 if (_problem->getNonlinearSystemBase().hasVariable(temp))
103 params.set<VariableName>(
"temperature") = temp;
105 std::string k_name = _name +
"_GeneralizedPlaneStrainOffDiag_temp";
106 params.set<NonlinearVariableName>(
"variable") = temp;
108 _problem->addKernel(k_type, k_name, params);
116 else if (_current_task ==
"add_user_object")
118 std::string uo_type =
"GeneralizedPlaneStrainUserObject";
119 InputParameters params = _factory.getValidParams(uo_type);
121 params.applyParameters(parameters());
122 params.set<ExecFlagEnum>(
"execute_on") = EXEC_LINEAR;
124 _problem->addUserObject(uo_type, uo_name, params);
130 else if (_current_task ==
"add_scalar_kernel")
132 std::string sk_type =
"GeneralizedPlaneStrain";
133 InputParameters params = _factory.getValidParams(sk_type);
135 params.set<NonlinearVariableName>(
"variable") =
136 getParam<VariableName>(
"scalar_out_of_plane_strain");
139 params.set<UserObjectName>(
"generalized_plane_strain") = uo_name;
141 if (isParamValid(
"extra_vector_tags"))
142 params.set<std::vector<TagName>>(
"extra_vector_tags") =
143 getParam<std::vector<TagName>>(
"extra_vector_tags");
145 _problem->addScalarKernel(sk_type, _name +
"_GeneralizedPlaneStrain", params);