11 #include "NonlinearSystemBase.h"
13 #include "FEProblemBase.h"
14 #include "MooseObjectAction.h"
24 InputParameters params = validParams<Action>();
25 params.addClassDescription(
"Class for setting up the Kernel, ScalarKernel, and UserObject for "
26 "peridynamic generalized plane strain model");
28 params.addRequiredParam<std::vector<VariableName>>(
29 "displacements",
"Nonlinear variable name for the displacements");
30 params.addRequiredParam<VariableName>(
"scalar_out_of_plane_strain",
31 "Scalar variable for strain in the out-of-plane direction");
32 params.addParam<VariableName>(
"temperature",
"Nonlinear variable for the temperature");
33 MooseEnum formulation_option(
"ORDINARY_STATE NONORDINARY_STATE",
"NONORDINARY_STATE");
34 params.addParam<MooseEnum>(
"formulation",
36 "Available peridynamic formulation options: " +
37 formulation_option.getRawNames());
38 MooseEnum strain_type(
"SMALL FINITE",
"SMALL");
39 params.addParam<MooseEnum>(
"strain", strain_type,
"Strain formulation");
40 params.addParam<VariableName>(
"out_of_plane_stress_variable",
41 "Name of out-of-plane stress auxiliary variable");
42 params.addParam<FunctionName>(
43 "out_of_plane_pressure",
45 "Function used to prescribe pressure in the out-of-plane direction");
46 params.addParam<Real>(
"factor", 1.0,
"Scale factor applied to prescribed out-of-plane pressure");
47 params.addParam<
bool>(
"full_jacobian",
49 "Parameter to set whether to use the nonlocal full Jacobian formulation "
50 "for the scalar components");
51 params.addParam<std::vector<SubdomainName>>(
"block",
52 "List of ids of the blocks (subdomains) that the "
53 "GeneralizedPlaneStrainActionPD will be applied "
55 params.addParam<std::vector<MaterialPropertyName>>(
56 "eigenstrain_names",
"List of eigenstrains to be applied in this strain calculation");
63 _displacements(getParam<std::vector<VariableName>>(
"displacements")),
64 _ndisp(_displacements.size()),
65 _formulation(getParam<MooseEnum>(
"formulation")),
66 _scalar_out_of_plane_strain(getParam<VariableName>(
"scalar_out_of_plane_strain"))
70 mooseError(
"GeneralizedPlaneStrainPD only works for two dimensional case!");
73 if (
_formulation ==
"NONORDINARY_STATE" && isParamValid(
"out_of_plane_stress_variable"))
74 mooseWarning(
"Variable out_of_plane_stress_variable will not be used in NONORDINARY_STATE "
75 "formulation option!");
76 if (
_formulation ==
"ORDINARY_STATE" && !isParamValid(
"out_of_plane_stress_variable"))
77 mooseError(
"Variable out_of_plane_stress_variable must be provided for ORDINARY_STATE "
78 "formulation option!");
84 if (_current_task ==
"add_kernel")
88 k_type =
"GeneralizedPlaneStrainOffDiagOSPD";
90 k_type =
"GeneralizedPlaneStrainOffDiagNOSPD";
95 "Unsupported peridynamic formulation. Choose from: ORDINARY_STATE or NONORDINARY_STATE");
97 InputParameters params = _factory.getValidParams(k_type);
99 params.applyParameters(parameters(),
100 {
"displacements",
"temperature",
"scalar_out_of_plane_strain"});
102 params.set<std::vector<VariableName>>(
"displacements") =
_displacements;
103 params.set<std::vector<VariableName>>(
"scalar_out_of_plane_strain") = {
107 for (
unsigned int i = 0; i <
_ndisp; ++i)
109 std::string k_name =
name() +
"_GeneralizedPlaneStrainPDOffDiag_disp_" + Moose::stringify(i);
110 params.set<NonlinearVariableName>(
"variable") =
_displacements[i];
112 _problem->addKernel(k_type, k_name, params);
117 if (isParamValid(
"temperature"))
119 VariableName temp = getParam<VariableName>(
"temperature");
120 if (_problem->getNonlinearSystemBase().hasVariable(temp))
122 params.set<std::vector<VariableName>>(
"temperature") = {temp};
124 std::string k_name =
name() +
"_GeneralizedPlaneStrainPDOffDiag_temp";
125 params.set<NonlinearVariableName>(
"variable") = temp;
128 params.set<std::vector<MaterialPropertyName>>(
"eigenstrain_names") =
129 getParam<std::vector<MaterialPropertyName>>(
"eigenstrain_names");
131 _problem->addKernel(k_type, k_name, params);
135 else if (_current_task ==
"add_user_object")
139 uo_type =
"GeneralizedPlaneStrainUserObjectOSPD";
141 uo_type =
"GeneralizedPlaneStrainUserObjectNOSPD";
145 "Unsupported peridynamic formulation. Choose from: ORDINARY_STATE or NONORDINARY_STATE");
147 InputParameters params = _factory.getValidParams(uo_type);
149 std::string uo_name =
name() +
"_GeneralizedPlaneStrainPDUserObject";
151 params.applyParameters(parameters(), {
"out_of_plane_stress_variable"});
154 params.set<std::vector<VariableName>>(
"out_of_plane_stress_variable") = {
155 getParam<VariableName>(
"out_of_plane_stress_variable")};
157 _problem->addUserObject(uo_type, uo_name, params);
159 else if (_current_task ==
"add_scalar_kernel")
161 std::string sk_type(
"GeneralizedPlaneStrainPD");
162 InputParameters params = _factory.getValidParams(sk_type);
164 std::string sk_name =
name() +
"_GeneralizedPlaneStrainPD";
169 params.set<UserObjectName>(
"generalized_plane_strain_uo") =
170 name() +
"_GeneralizedPlaneStrainPDUserObject";
172 _problem->addScalarKernel(sk_type, sk_name, params);
175 mooseError(
"Task error in GeneralizedPlaneStrainActionPD");