23 #include "PiecewiseLinear.h"
25 #include "libmesh/quadrature.h"
33 MooseEnum formulation(
34 "Nonlinear3D NonlinearRZ AxisymmetricRZ SphericalR Linear PlaneStrain NonlinearPlaneStrain");
35 MooseEnum compute_method(
"NoShearRetention ShearRetention");
37 InputParameters params = validParams<Material>();
38 params.addParam<std::string>(
39 "appended_property_name",
"",
"Name appended to material properties to make them unique");
40 params.addParam<Real>(
"bulk_modulus",
"The bulk modulus for the material.");
41 params.addParam<Real>(
"lambda",
"Lame's first parameter for the material.");
42 params.addParam<Real>(
"poissons_ratio",
"Poisson's ratio for the material.");
43 params.addParam<FunctionName>(
"poissons_ratio_function",
44 "Poisson's ratio as a function of temperature.");
45 params.addParam<Real>(
"shear_modulus",
"The shear modulus of the material.");
46 params.addParam<Real>(
"youngs_modulus",
"Young's modulus of the material.");
47 params.addParam<FunctionName>(
"youngs_modulus_function",
48 "Young's modulus as a function of temperature.");
49 params.addParam<Real>(
"thermal_expansion",
"The thermal expansion coefficient.");
50 params.addParam<FunctionName>(
"thermal_expansion_function",
51 "Thermal expansion coefficient as a function of temperature.");
52 params.addCoupledVar(
"temp",
"Coupled Temperature");
53 params.addParam<Real>(
54 "stress_free_temperature",
55 "The stress-free temperature. If not specified, the initial temperature is used.");
56 params.addParam<Real>(
"thermal_expansion_reference_temperature",
57 "Reference temperature for mean thermal expansion function.");
58 MooseEnum cte_function_type(
"instantaneous mean");
59 params.addParam<MooseEnum>(
"thermal_expansion_function_type",
61 "Type of thermal expansion function. Choices are: " +
62 cte_function_type.getRawNames());
63 params.addParam<std::vector<Real>>(
"initial_stress",
64 "The initial stress tensor (xx, yy, zz, xy, yz, zx)");
65 params.addParam<std::string>(
68 "The cracking release type. Choices are abrupt (default) and exponential.");
69 params.addParam<Real>(
"cracking_stress",
71 "The stress threshold beyond which cracking occurs. Must be positive.");
72 params.addParam<Real>(
73 "cracking_residual_stress",
75 "The fraction of the cracking stress allowed to be maintained following a crack.");
76 params.addParam<Real>(
"cracking_beta", 1.0,
"The coefficient used in the exponetional model.");
77 params.addParam<MooseEnum>(
78 "compute_method", compute_method,
"The method used in the stress calculation.");
79 params.addParam<FunctionName>(
80 "cracking_stress_function",
"",
"The cracking stress as a function of time and location");
81 params.addParam<std::vector<unsigned int>>(
82 "active_crack_planes",
"Planes on which cracks are allowed (0,1,2 -> x,z,theta in RZ)");
83 params.addParam<
unsigned int>(
84 "max_cracks", 3,
"The maximum number of cracks allowed at a material point.");
85 params.addParam<Real>(
"cracking_neg_fraction",
86 "The fraction of the cracking strain at which a "
87 "transitition begins during decreasing strain to "
88 "the original stiffness.");
89 params.addParam<MooseEnum>(
"formulation",
91 "Element formulation. Choices are: " + formulation.getRawNames());
92 params.addParam<std::string>(
"increment_calculation",
94 "The algorithm to use when computing the "
95 "incremental strain and rotation (RashidApprox or "
96 "Eigen). For use with Nonlinear3D/RZ formulation.");
97 params.addParam<
bool>(
"large_strain",
99 "Whether to include large strain terms in "
100 "AxisymmetricRZ, SphericalR, and PlaneStrain "
102 params.addParam<
bool>(
"compute_JIntegral",
false,
"Whether to compute the J Integral.");
103 params.addParam<
bool>(
104 "compute_InteractionIntegral",
false,
"Whether to compute the Interaction Integral.");
105 params.addCoupledVar(
"disp_r",
"The r displacement");
106 params.addCoupledVar(
"disp_x",
"The x displacement");
107 params.addCoupledVar(
"disp_y",
"The y displacement");
108 params.addCoupledVar(
"disp_z",
"The z displacement");
109 params.addCoupledVar(
"strain_zz",
"The zz strain");
110 params.addCoupledVar(
"scalar_strain_zz",
"The zz strain (scalar variable)");
111 params.addParam<std::vector<std::string>>(
112 "dep_matl_props",
"Names of material properties this material depends on.");
113 params.addParam<std::string>(
"constitutive_model",
"ConstitutiveModel to use (optional)");
114 params.addParam<
bool>(
"volumetric_locking_correction",
116 "Set to false to turn off volumetric locking correction");
123 getCrackingModel(
const std::string &
name)
126 std::transform(n.begin(), n.end(), n.begin(), ::tolower);
130 else if (n ==
"exponential")
132 else if (n ==
"power")
135 mooseError(
"Unknown cracking model");
141 : DerivativeMaterialInterface<Material>(parameters),
142 _appended_property_name(getParam<std::string>(
"appended_property_name")),
143 _bulk_modulus_set(parameters.isParamValid(
"bulk_modulus")),
144 _lambda_set(parameters.isParamValid(
"lambda")),
145 _poissons_ratio_set(parameters.isParamValid(
"poissons_ratio")),
146 _shear_modulus_set(parameters.isParamValid(
"shear_modulus")),
147 _youngs_modulus_set(parameters.isParamValid(
"youngs_modulus")),
148 _bulk_modulus(_bulk_modulus_set ? getParam<Real>(
"bulk_modulus") : -1),
149 _lambda(_lambda_set ? getParam<Real>(
"lambda") : -1),
150 _poissons_ratio(_poissons_ratio_set ? getParam<Real>(
"poissons_ratio") : -1),
151 _shear_modulus(_shear_modulus_set ? getParam<Real>(
"shear_modulus") : -1),
152 _youngs_modulus(_youngs_modulus_set ? getParam<Real>(
"youngs_modulus") : -1),
153 _youngs_modulus_function(
154 isParamValid(
"youngs_modulus_function") ? &getFunction(
"youngs_modulus_function") : NULL),
155 _poissons_ratio_function(
156 isParamValid(
"poissons_ratio_function") ? &getFunction(
"poissons_ratio_function") : NULL),
157 _cracking_release(getCrackingModel(getParam<std::string>(
"cracking_release"))),
159 parameters.isParamValid(
"cracking_stress")
160 ? (getParam<Real>(
"cracking_stress") > 0 ? getParam<Real>(
"cracking_stress") : -1)
162 _cracking_residual_stress(getParam<Real>(
"cracking_residual_stress")),
163 _cracking_beta(getParam<Real>(
"cracking_beta")),
164 _compute_method(getParam<MooseEnum>(
"compute_method")),
165 _cracking_stress_function(getParam<FunctionName>(
"cracking_stress_function") !=
""
166 ? &getFunction(
"cracking_stress_function")
169 _active_crack_planes(3, 1),
170 _max_cracks(getParam<unsigned int>(
"max_cracks")),
171 _cracking_neg_fraction(
172 isParamValid(
"cracking_neg_fraction") ? getParam<Real>(
"cracking_neg_fraction") : 0),
173 _has_temp(isCoupled(
"temp")),
174 _temperature(_has_temp ? coupledValue(
"temp") : _zero),
175 _temperature_old(_has_temp ? coupledValueOld(
"temp") : _zero),
176 _temp_grad(coupledGradient(
"temp")),
177 _alpha(parameters.isParamValid(
"thermal_expansion") ? getParam<Real>(
"thermal_expansion") : 0.),
178 _alpha_function(parameters.isParamValid(
"thermal_expansion_function")
179 ? &getFunction(
"thermal_expansion_function")
181 _piecewise_linear_alpha_function(NULL),
182 _has_stress_free_temp(false),
183 _stress_free_temp(0.0),
185 _volumetric_models(),
187 _stress(createProperty<
SymmTensor>(
"stress")),
188 _stress_old_prop(getPropertyOld<
SymmTensor>(
"stress")),
190 _total_strain(createProperty<
SymmTensor>(
"total_strain")),
191 _total_strain_old(getPropertyOld<
SymmTensor>(
"total_strain")),
192 _elastic_strain(createProperty<
SymmTensor>(
"elastic_strain")),
193 _elastic_strain_old(getPropertyOld<
SymmTensor>(
"elastic_strain")),
195 _crack_flags_old(NULL),
196 _crack_flags_local(),
198 _crack_count_old(NULL),
199 _crack_rotation(NULL),
200 _crack_rotation_old(NULL),
202 _crack_strain_old(NULL),
203 _crack_max_strain(NULL),
204 _crack_max_strain_old(NULL),
205 _principal_strain(3, 1),
209 _d_stress_dT(createProperty<
SymmTensor>(
"d_stress_dT")),
210 _total_strain_increment(0),
211 _mechanical_strain_increment(0),
212 _strain_increment(0),
213 _compute_JIntegral(getParam<bool>(
"compute_JIntegral")),
214 _compute_InteractionIntegral(getParam<bool>(
"compute_InteractionIntegral")),
217 _Eshelby_tensor(NULL),
218 _J_thermal_term_vec(NULL),
219 _current_instantaneous_thermal_expansion_coef(NULL),
220 _block_id(std::vector<SubdomainID>(blockIDs().begin(), blockIDs().end())),
221 _constitutive_active(false),
222 _step_zero(declareRestartableData<bool>(
"step_zero", true)),
223 _step_one(declareRestartableData<bool>(
"step_one", true)),
225 _local_elasticity_tensor(NULL)
227 bool same_coord_type =
true;
229 for (
unsigned int i = 1; i <
_block_id.size(); ++i)
231 (_subproblem.getCoordSystem(
_block_id[0]) == _subproblem.getCoordSystem(
_block_id[i]));
232 if (!same_coord_type)
233 mooseError(
"Material '",
235 "' was specified on multiple blocks that do not have the same coordinate system");
240 if (
_coord_type == Moose::COORD_RZ && _subproblem.getAxisymmetricRadialCoord() != 0)
242 "rz_coord_axis=Y is the only supported option for axisymmetric SolidMechanics models");
246 const std::vector<std::string> & dmp = getParam<std::vector<std::string>>(
"dep_matl_props");
248 for (std::set<std::string>::const_iterator i =
_dep_matl_props.begin();
253 getMaterialProperty<Real>(*i);
260 _crack_flags = &createProperty<RealVectorValue>(
"crack_flags");
264 _crack_count = &createProperty<RealVectorValue>(
"crack_count");
267 _crack_rotation = &createProperty<ColumnMajorMatrix>(
"crack_rotation");
271 _crack_strain = &createProperty<RealVectorValue>(
"crack_strain");
274 if (parameters.isParamValid(
"active_crack_planes"))
276 const std::vector<unsigned int> & planes =
277 getParam<std::vector<unsigned>>(
"active_crack_planes");
278 for (
unsigned i(0); i < 3; ++i)
281 for (
unsigned i(0); i < planes.size(); ++i)
284 mooseError(
"Active planes must be 0, 1, or 2");
288 if (_cracking_residual_stress < 0 || _cracking_residual_stress > 1)
290 mooseError(
"cracking_residual_stress must be between 0 and 1");
292 if (isParamValid(
"cracking_neg_fraction") &&
293 (_cracking_neg_fraction <= 0 || _cracking_neg_fraction > 1))
295 mooseError(
"cracking_neg_fraction must be > zero and <= 1");
299 if (parameters.isParamValid(
"stress_free_temperature"))
304 mooseError(
"Cannot specify stress_free_temperature without coupling to temperature");
307 if (parameters.isParamValid(
"thermal_expansion_function_type"))
310 mooseError(
"thermal_expansion_function_type can only be set when thermal_expansion_function "
312 MooseEnum tec = getParam<MooseEnum>(
"thermal_expansion_function_type");
315 else if (tec ==
"instantaneous")
318 mooseError(
"Invalid option for thermal_expansion_function_type");
323 if (parameters.isParamValid(
"thermal_expansion_reference_temperature"))
326 mooseError(
"thermal_expansion_reference_temperature can only be set when "
327 "thermal_expansion_function is used");
329 mooseError(
"thermal_expansion_reference_temperature can only be set when "
330 "thermal_expansion_function_type = mean");
331 _ref_temp = getParam<Real>(
"thermal_expansion_reference_temperature");
334 "Cannot specify thermal_expansion_reference_temperature without coupling to temperature");
339 if (!parameters.isParamValid(
"thermal_expansion_reference_temperature") ||
342 "Must specify both stress_free_temperature and thermal_expansion_reference_temperature "
343 "if thermal_expansion_function_type = mean");
346 if (parameters.isParamValid(
"thermal_expansion") &&
347 parameters.isParamValid(
"thermal_expansion_function"))
348 mooseError(
"Cannot specify both thermal_expansion and thermal_expansion_function");
352 _SED = &declareProperty<Real>(
"strain_energy_density");
353 _SED_old = &getMaterialPropertyOld<Real>(
"strain_energy_density");
357 &declareProperty<Real>(
"current_instantaneous_thermal_expansion_coef");
361 !hasMaterialProperty<Real>(
"current_instantaneous_thermal_expansion_coef"))
363 &declareProperty<Real>(
"current_instantaneous_thermal_expansion_coef");
382 if (num_elastic_constants != 2)
384 std::string err(
"Exactly two elastic constants must be defined for material '");
392 std::string err(
"Bulk modulus must be positive in material '");
399 std::string err(
"Poissons ratio must be greater than -1 and less than 0.5 in material '");
406 std::string err(
"Shear modulus must not be negative in material '");
413 std::string err(
"Youngs modulus must be positive in material '");
562 bool modified =
false;
565 const SubdomainID current_block = _current_elem->subdomain_id();
574 mooseError(
"ConstitutiveModel not available for block ", current_block);
595 Real inc_thermal_strain;
596 Real d_thermal_strain_d_temp;
606 Real delta_t = current_temp - old_temp;
621 Real numerator = alpha_current_temp * (current_temp -
_ref_temp) -
624 if (denominator < small)
625 mooseError(
"Denominator too small in thermal strain calculation");
626 inc_thermal_strain = numerator / denominator;
627 d_thermal_strain_d_temp = alpha_current_temp * (current_temp -
_ref_temp);
631 inc_thermal_strain = delta_t * 0.5 * (alpha_current_temp + alpha_old_temp);
632 d_thermal_strain_d_temp = alpha_current_temp;
637 inc_thermal_strain = delta_t * alpha;
638 d_thermal_strain_d_temp = alpha;
652 const SubdomainID current_block = _current_elem->subdomain_id();
653 const std::vector<MooseSharedPointer<VolumetricModel>> & vm(
_volumetric_models[current_block]);
654 for (
unsigned int i(0); i < vm.size(); ++i)
673 const Real T00 = R(0, 0) * T.
xx() + R(0, 1) * T.
xy() + R(0, 2) * T.
zx();
674 const Real T01 = R(0, 0) * T.
xy() + R(0, 1) * T.
yy() + R(0, 2) * T.
yz();
675 const Real T02 = R(0, 0) * T.
zx() + R(0, 1) * T.
yz() + R(0, 2) * T.
zz();
677 const Real T10 = R(1, 0) * T.
xx() + R(1, 1) * T.
xy() + R(1, 2) * T.
zx();
678 const Real T11 = R(1, 0) * T.
xy() + R(1, 1) * T.
yy() + R(1, 2) * T.
yz();
679 const Real T12 = R(1, 0) * T.
zx() + R(1, 1) * T.
yz() + R(1, 2) * T.
zz();
681 const Real T20 = R(2, 0) * T.
xx() + R(2, 1) * T.
xy() + R(2, 2) * T.
zx();
682 const Real T21 = R(2, 0) * T.
xy() + R(2, 1) * T.
yy() + R(2, 2) * T.
yz();
683 const Real T22 = R(2, 0) * T.
zx() + R(2, 1) * T.
yz() + R(2, 2) * T.
zz();
685 result.
xx(T00 * R(0, 0) + T01 * R(0, 1) + T02 * R(0, 2));
686 result.
yy(T10 * R(1, 0) + T11 * R(1, 1) + T12 * R(1, 2));
687 result.
zz(T20 * R(2, 0) + T21 * R(2, 1) + T22 * R(2, 2));
688 result.
xy(T00 * R(1, 0) + T01 * R(1, 1) + T02 * R(1, 2));
689 result.
yz(T10 * R(2, 0) + T11 * R(2, 1) + T12 * R(2, 2));
690 result.
zx(T00 * R(2, 0) + T01 * R(2, 1) + T02 * R(2, 2));
698 if (isParamValid(
"initial_stress"))
700 const std::vector<Real> & s = getParam<std::vector<Real>>(
"initial_stress");
703 mooseError(
"initial_stress must give six values");
705 _stress[_qp].fillFromInputVector(s);
720 (*_crack_rotation)[_qp].identity();
740 for (_qp = 0; _qp < _qrule->n_points(); ++_qp)
782 mooseAssert(
_SED,
"_SED not initialized");
783 mooseAssert(
_SED_old,
"_SED_old not initialized");
784 (*_SED)[_qp] = (*_SED_old)[_qp] +
794 mooseAssert(
_SED,
"_SED not initialized");
797 ColumnMajorMatrix stress_CMM;
798 stress_CMM(0, 0) =
_stress[_qp].xx();
799 stress_CMM(0, 1) =
_stress[_qp].xy();
800 stress_CMM(0, 2) =
_stress[_qp].xz();
801 stress_CMM(1, 0) =
_stress[_qp].xy();
802 stress_CMM(1, 1) =
_stress[_qp].yy();
803 stress_CMM(1, 2) =
_stress[_qp].yz();
804 stress_CMM(2, 0) =
_stress[_qp].xz();
805 stress_CMM(2, 1) =
_stress[_qp].yz();
806 stress_CMM(2, 2) =
_stress[_qp].zz();
812 ColumnMajorMatrix H(F);
815 ColumnMajorMatrix Finv;
817 ColumnMajorMatrix FinvT;
818 FinvT = Finv.transpose();
819 ColumnMajorMatrix HT;
823 ColumnMajorMatrix piola;
824 piola = stress_CMM * FinvT;
828 ColumnMajorMatrix HTP;
831 ColumnMajorMatrix WI;
835 (*_Eshelby_tensor)[_qp] = WI - HTP;
847 const SubdomainID current_block = _current_elem->subdomain_id();
856 mooseError(
"Logic error. No ConstitutiveModel for current_block=", current_block,
".");
896 const SubdomainID current_block = _current_elem->subdomain_id();
903 mooseError(
"ConstitutiveModel not available for block ", current_block);
906 changed |= cm->updateElasticityTensor(tensor);
914 mooseError(
"Cannot use Youngs modulus or Poissons ratio functions");
934 std::vector<SymmTensor *> t(3);
965 bool set_constitutive_active =
false;
966 for (
unsigned i(0); i <
_block_id.size(); ++i)
970 std::vector<MooseSharedPointer<MaterialBase>>
const * mats_p;
974 mats_p = &_fe_problem.getMaterialWarehouse()[Moose::FACE_MATERIAL_DATA].getActiveBlockObjects(
979 mats_p = &_fe_problem.getMaterialWarehouse().getActiveBlockObjects(
_block_id[i], _tid);
981 const std::vector<MooseSharedPointer<MaterialBase>> & mats = *mats_p;
983 for (
unsigned int j = 0; j < mats.size(); ++j)
985 MooseSharedPointer<VolumetricModel> vm =
986 MooseSharedNamespace::dynamic_pointer_cast<VolumetricModel>(mats[j]);
989 const std::vector<std::string> & dep_matl_props = vm->getDependentMaterialProperties();
990 for (
unsigned k = 0; k < dep_matl_props.size(); ++k)
992 if (
"" != dep_matl_props[k] &&
995 mooseError(
"A VolumetricModel depends on " + dep_matl_props[k] +
996 ", but that material property was not given in the dep_matl_props line.");
1003 for (std::map<SubdomainID, MooseSharedPointer<ConstitutiveModel>>::iterator iter =
1008 iter->second->initialSetup();
1014 std::string constitutive_model = getParam<std::string>(
"constitutive_model") + suffix;
1016 for (
unsigned int j = 0; j < mats.size(); ++j)
1018 MooseSharedPointer<ConstitutiveModel> cm =
1019 MooseSharedNamespace::dynamic_pointer_cast<ConstitutiveModel>(mats[j]);
1021 if (cm && cm->name() == constitutive_model)
1024 set_constitutive_active =
true;
1029 if (!set_constitutive_active)
1030 mooseError(
"Unable to find constitutive model " + constitutive_model);
1033 if (set_constitutive_active)
1040 Real dummy_temp = 0;
1050 bool cracking_locally_active(
false);
1054 (*_crack_rotation)[_qp] = (*_crack_rotation_old)[_qp];
1060 for (
unsigned int i(0); i < 3; ++i)
1084 const Real Ec = Eo * (*_crack_flags_old)[_qp](i);
1085 const Real a = (Ec - Eo) / (4 * etr);
1086 const Real b = (Ec + Eo) / 2;
1089 cracking_locally_active =
true;
1097 cracking_locally_active =
true;
1102 if (cracking_locally_active)
1111 ColumnMajorMatrix R_9x9(9, 9);
1134 tensor(0, 0) = sigma(0);
1138 tensor(1, 1) = sigma(1);
1142 tensor(2, 2) = sigma(2);
1164 (*_crack_rotation)[_qp] = (*_crack_rotation_old)[_qp];
1166 if (numKnownDirs == 0)
1168 ColumnMajorMatrix e_vec(3, 3);
1169 _elastic_strain[_qp].columnMajorMatrix().eigen(principal_strain, e_vec);
1172 (*_crack_rotation)[_qp] = e_vec;
1174 else if (numKnownDirs == 1)
1189 ColumnMajorMatrix e2x2(2, 2);
1190 e2x2(0, 0) = ePrime(0, 0);
1191 e2x2(1, 0) = ePrime(1, 0);
1192 e2x2(0, 1) = ePrime(0, 1);
1193 e2x2(1, 1) = ePrime(1, 1);
1196 ColumnMajorMatrix e_val2x1(2, 1);
1197 ColumnMajorMatrix e_vec2x2(2, 2);
1198 e2x2.eigen(e_val2x1, e_vec2x2);
1201 ColumnMajorMatrix e_vec(3, 3);
1202 e_vec(0, 0) = e_vec2x2(0, 0);
1203 e_vec(1, 0) = e_vec2x2(1, 0);
1205 e_vec(0, 1) = e_vec2x2(0, 1);
1206 e_vec(1, 1) = e_vec2x2(1, 1);
1211 (*_crack_rotation)[_qp] = (*_crack_rotation_old)[_qp] * e_vec;
1213 principal_strain(0, 0) = e_val2x1(0, 0);
1214 principal_strain(1, 0) = e_val2x1(1, 0);
1215 principal_strain(2, 0) = ePrime(2, 2);
1217 else if (numKnownDirs == 2 || numKnownDirs == 3)
1224 principal_strain(0, 0) = ePrime.
xx();
1225 principal_strain(1, 0) = ePrime.
yy();
1226 principal_strain(2, 0) = ePrime.
zz();
1230 mooseError(
"Invalid number of known crack directions");
1249 for (
unsigned i(0); i < 3; ++i)
1266 unsigned int num_cracks(0);
1267 for (
unsigned i(0); i < 3; ++i)
1277 bool new_crack(
false);
1278 bool cracked(
false);
1279 RealVectorValue sigma;
1280 for (
unsigned i(0); i < 3; ++i)
1282 sigma(i) = sigmaPrime(i, i);
1284 if (sigma(i) <= 1e-4)
1293 Real crackFactor(1);
1306 ++((*_crack_count)[_qp](i));
1322 (*_crack_flags)[_qp](i) *= 1. / 3.;
1357 (*_crack_flags)[_qp](i) = crackFactor;
1373 (*_crack_flags)[_qp](i) = crackFactor;
1388 const Real Ec = Eo * (*_crack_flags_old)[_qp](i);
1389 const Real a = (Ec - Eo) / (4 * etr);
1390 const Real b = (Ec + Eo) / 2;
1391 const Real c = (Ec - Eo) * etr / 4;
1398 (*_crack_rotation)[_qp] = (*_crack_rotation_old)[_qp];
1414 std::stringstream err;
1415 err <<
"Max strain less than crack strain: " << i <<
" " << sigma <<
", "
1416 << (*_crack_max_strain)[_qp](i) <<
", " << (*
_crack_strain)[_qp](i) <<
", "
1419 mooseError(err.str());
1428 flagVal = sigma * (*_crack_strain)[_qp](i) / (crackMaxStrain *
_cracking_stress);
1434 const Real tiny(1e-16);
1446 std::stringstream err;
1447 err <<
"Negative crack flag found: " << i <<
" " << flagVal <<
", "
1448 << (*_crack_max_strain)[_qp](i) <<
", " << (*
_crack_strain)[_qp](i) <<
", " << std::endl;
1449 mooseError(err.str());
1458 unsigned int retVal(0);
1459 for (
unsigned int i(0); i < 3 - fromElement; ++i)
1461 retVal += ((*_crack_flags_old)[_qp](i) < 1);
1463 return retVal + fromElement;
1469 std::string mat_name =
name();
1470 InputParameters parameters = emptyInputParameters();
1471 parameters += this->parameters();
1475 std::string formulation = getParam<MooseEnum>(
"formulation");
1476 std::transform(formulation.begin(), formulation.end(), formulation.begin(), ::tolower);
1477 if (formulation ==
"nonlinear3d")
1479 if (!isCoupled(
"disp_x") || !isCoupled(
"disp_y") || !isCoupled(
"disp_z"))
1480 mooseError(
"Nonlinear3D requires all three displacements");
1482 if (isCoupled(
"disp_r"))
1483 mooseError(
"Linear must not define disp_r");
1486 mooseError(
"Nonlinear3D formulation requested for coord_type = RZ problem");
1490 else if (formulation ==
"nonlinearrz")
1492 if (!isCoupled(
"disp_r") || !isCoupled(
"disp_z"))
1493 mooseError(
"NonlinearRZ must define disp_r and disp_z");
1497 else if (formulation ==
"axisymmetricrz")
1499 if (!isCoupled(
"disp_r") || !isCoupled(
"disp_z"))
1500 mooseError(
"AxisymmetricRZ must define disp_r and disp_z");
1503 else if (formulation ==
"sphericalr")
1505 if (!isCoupled(
"disp_r"))
1506 mooseError(
"SphericalR must define disp_r");
1509 else if (formulation ==
"planestrain")
1511 if (!isCoupled(
"disp_x") || !isCoupled(
"disp_y"))
1512 mooseError(
"PlaneStrain must define disp_x and disp_y");
1515 else if (formulation ==
"nonlinearplanestrain")
1517 if (!isCoupled(
"disp_x") || !isCoupled(
"disp_y"))
1518 mooseError(
"NonlinearPlaneStrain must define disp_x and disp_y");
1521 else if (formulation ==
"linear")
1523 if (isCoupled(
"disp_r"))
1524 mooseError(
"Linear must not define disp_r");
1526 mooseError(
"Linear formulation requested for coord_type = RZ problem");
1529 else if (formulation !=
"")
1530 mooseError(
"Unknown formulation: " + formulation);
1534 if (!isCoupled(
"disp_r") || !isCoupled(
"disp_z"))
1536 std::string err(
name());
1537 err +=
": RZ coord sys requires disp_r and disp_z for AxisymmetricRZ formulation";
1544 if (!isCoupled(
"disp_r"))
1546 std::string err(
name());
1547 err +=
": RSPHERICAL coord sys requires disp_r for SphericalR formulation";
1555 if (isCoupled(
"disp_x") && isCoupled(
"disp_y") && isCoupled(
"disp_z"))
1557 if (isCoupled(
"disp_r"))
1558 mooseError(
"Error with displacement specification in material " + mat_name);
1561 else if (isCoupled(
"disp_x") && isCoupled(
"disp_y"))
1563 if (isCoupled(
"disp_r"))
1564 mooseError(
"Error with displacement specification in material " + mat_name);
1567 else if (isCoupled(
"disp_r") && isCoupled(
"disp_z"))
1570 mooseError(
"RZ coord system not specified, but disp_r and disp_z are");
1573 else if (isCoupled(
"disp_r"))
1576 mooseError(
"RSPHERICAL coord system not specified, but disp_r is");
1579 else if (isCoupled(
"disp_x"))
1582 mooseError(
"Unable to determine formulation for material " + mat_name);
1585 mooseAssert(
element,
"No Element created for material " + mat_name);
1594 Factory & factory = _app.getFactory();
1595 InputParameters params = factory.getValidParams(cm_name);
1597 params.applyParameters(parameters());
1598 params.set<SubProblem *>(
"_subproblem") = &_subproblem;
1599 params.applySpecificParameters(parameters(), {
"_material_data_type",
"_neighbor"},
true);
1601 MooseSharedPointer<ConstitutiveModel> cm =
1608 for (
unsigned i(0); i <
_block_id.size(); ++i)
1617 for (_qp = 0; _qp < n_points; ++_qp)
1623 const SubdomainID current_block = _current_elem->subdomain_id();
1625 cm->initStatefulProperties(n_points);
1637 for (
unsigned int i = 0; i < LIBMESH_DIM; ++i)
1639 Real dthermstrain_dx =
1641 (*_J_thermal_term_vec)[_qp](i) = stress_trace * dthermstrain_dx;
1649 "_current_instantaneous_thermal_expansion_coef not initialized");
1651 (*_current_instantaneous_thermal_expansion_coef)[_qp] = 0.0;
1661 (*_current_instantaneous_thermal_expansion_coef)[_qp] = alpha;
1669 Real numerator = dalphabar_dT * (current_temp -
_ref_temp) + alphabar;
1671 if (denominator < small)
1672 mooseError(
"Denominator too small in thermal strain calculation");
1673 (*_current_instantaneous_thermal_expansion_coef)[_qp] = numerator / denominator;