105 const std::string uo_name =
_name +
"_GeneralizedPlaneStrainUserObject";
109 std::set<SubdomainID> block_ids;
111 for (
const auto & block : getParam<std::vector<SubdomainName>>(
"block"))
113 const auto id =
_mesh->getSubdomainID(block);
115 paramError(
"block",
"Subdomain '", block,
"' was not found in the mesh");
116 block_ids.insert(
id);
119 const auto & subdomains = block_ids.empty() ?
_problem->mesh().meshSubdomains() : block_ids;
120 if (subdomains.empty())
121 mooseError(
"No subdomains found for the generalized plane strain action");
123 const auto coord_system =
_problem->getCoordSystem(*subdomains.begin());
124 for (
const auto subdomain : subdomains)
125 if (
_problem->getCoordSystem(subdomain) != coord_system)
127 "Generalized plane strain requires all selected subdomains to use the same "
128 "coordinate system");
134 "One radial displacement is required for 1D axisymmetric generalized plane "
140 if (
_ndisp != required_displacements)
142 required_displacements,
143 " displacement variables are required when the out-of-plane direction is ",
144 getParam<MooseEnum>(
"out_of_plane_direction"));
148 "Generalized plane strain supports only Cartesian and axisymmetric coordinate "
152 const auto & first_in_plane_variable =
_problem->getVariable(
153 0,
_displacements[first_in_plane_disp], Moose::VarKindType::VAR_SOLVER);
154 const auto solver_sys_num = first_in_plane_variable.sys().number();
155 if (!
_problem->isSolverSystemNonlinear(solver_sys_num))
156 paramError(
"displacements",
"The in-plane displacements must be nonlinear variables");
158 for (
unsigned int i = 0; i <
_ndisp; ++i)
162 .number() != solver_sys_num)
164 "All in-plane displacements must belong to the same nonlinear system");
166 auto & nonlinear_system =
_problem->getNonlinearSystemBase(solver_sys_num);
167 const auto & scalar_variable = getParam<VariableName>(
"scalar_out_of_plane_strain");
168 if (nonlinear_system.hasScalarVariable(scalar_variable))
170 if (
_problem->hasScalarVariable(scalar_variable))
174 "' already exists but is not a nonlinear scalar variable in system '",
175 nonlinear_system.name(),
177 if (
_problem->hasVariable(scalar_variable))
181 "' already exists as a field variable; a scalar variable is required");
186 params.
set<SolverSystemName>(
"solver_sys") = nonlinear_system.name();
187 _problem->addVariable(
"MooseVariableScalar", scalar_variable, params);
197 const std::string k_type =
"ADGeneralizedPlaneStrain";
201 params.
set<std::vector<VariableName>>(
"scalar_out_of_plane_strain") = {
202 getParam<VariableName>(
"scalar_out_of_plane_strain")};
210 "Cannot specify both 'out_of_plane_pressure_function' and "
211 "'out_of_plane_pressure'");
212 params.
set<FunctionName>(
"out_of_plane_pressure_function") =
213 getParam<FunctionName>(
"out_of_plane_pressure");
218 paramError(
"pressure_factor",
"Cannot specify both 'pressure_factor' and 'factor'");
219 params.
set<Real>(
"pressure_factor") = getParam<Real>(
"factor");
223 params.
set<NonlinearVariableName>(
"variable") =
_displacements[first_in_plane_disp];
224 _problem->addKernel(k_type,
_name +
"_ADGeneralizedPlaneStrain", params);
228 std::string k_type =
"GeneralizedPlaneStrainOffDiag";
232 params.
set<std::vector<VariableName>>(
"scalar_out_of_plane_strain") = {
233 getParam<VariableName>(
"scalar_out_of_plane_strain")};
236 for (
unsigned int i = 0; i <
_ndisp; ++i)
244 _problem->addKernel(k_type, k_name, params);
250 auto temp = getParam<std::vector<VariableName>>(
"temperature");
252 mooseError(
"Only one variable may be specified in 'temperature'");
253 if (
_problem->getNonlinearSystemBase(0).hasVariable(temp[0]))
255 std::string k_name =
_name +
"_GeneralizedPlaneStrainOffDiag_temp";
256 params.
set<NonlinearVariableName>(
"variable") = temp[0];
258 _problem->addKernel(k_type, k_name, params);
273 std::string uo_type =
"GeneralizedPlaneStrainUserObject";
282 {
"out_of_plane_pressure",
"out_of_plane_pressure_function",
"factor",
"pressure_factor"});
284 params.
set<FunctionName>(
"out_of_plane_pressure") =
285 getParam<FunctionName>(
"out_of_plane_pressure");
287 params.
set<FunctionName>(
"out_of_plane_pressure_function") =
288 getParam<FunctionName>(
"out_of_plane_pressure_function");
290 params.
set<Real>(
"factor") = getParam<Real>(
"factor");
292 params.
set<Real>(
"pressure_factor") = getParam<Real>(
"pressure_factor");
294 _problem->addUserObject(uo_type, uo_name, params);
307 std::string sk_type =
"GeneralizedPlaneStrain";
310 params.
set<NonlinearVariableName>(
"variable") =
311 getParam<VariableName>(
"scalar_out_of_plane_strain");
314 params.
set<UserObjectName>(
"generalized_plane_strain") = uo_name;
317 params.
set<std::vector<TagName>>(
"extra_vector_tags") =
318 getParam<std::vector<TagName>>(
"extra_vector_tags");
320 params.
set<std::vector<TagName>>(
"absolute_value_vector_tags") =
321 getParam<std::vector<TagName>>(
"absolute_value_vector_tags");
323 _problem->addScalarKernel(sk_type,
_name +
"_GeneralizedPlaneStrain", params);