145 _boundary_names(getParam<
std::vector<BoundaryName>>(
"boundary")),
146 _closed_loop(getParam<bool>(
"closed_loop")),
147 _use_crack_front_points_provider(false),
148 _order(getParam<
std::string>(
"order")),
149 _family(getParam<
std::string>(
"family")),
150 _direction_method_moose_enum(getParam<
MooseEnum>(
"crack_direction_method")),
151 _end_direction_method_moose_enum(getParam<
MooseEnum>(
"crack_end_direction_method")),
152 _have_crack_direction_vector(isParamValid(
"crack_direction_vector")),
153 _crack_direction_vector(
154 _have_crack_direction_vector ? getParam<RealVectorValue>(
"crack_direction_vector") : 0.0),
155 _have_crack_direction_vector_end_1(isParamValid(
"crack_direction_vector_end_1")),
156 _crack_direction_vector_end_1(_have_crack_direction_vector_end_1
157 ? getParam<RealVectorValue>(
"crack_direction_vector_end_1")
159 _have_crack_direction_vector_end_2(isParamValid(
"crack_direction_vector_end_2")),
160 _crack_direction_vector_end_2(_have_crack_direction_vector_end_2
161 ? getParam<RealVectorValue>(
"crack_direction_vector_end_2")
163 _treat_as_2d(getParam<bool>(
"2d")),
164 _axis_2d(getParam<unsigned
int>(
"axis_2d")),
165 _has_symmetry_plane(isParamValid(
"symmetry_plane")),
166 _symmetry_plane(_has_symmetry_plane ? getParam<unsigned
int>(
"symmetry_plane")
167 :
std::numeric_limits<unsigned
int>::max()),
168 _position_type(getParam<
MooseEnum>(
"position_type")),
169 _q_function_type(getParam<
MooseEnum>(
"q_function_type")),
170 _get_equivalent_k(getParam<bool>(
"equivalent_k")),
171 _use_displaced_mesh(false),
172 _output_q(getParam<bool>(
"output_q")),
173 _incremental(getParam<bool>(
"incremental")),
174 _convert_J_to_K(isParamValid(
"convert_J_to_K") ? getParam<bool>(
"convert_J_to_K") : false),
176 _use_ad(getParam<bool>(
"use_automatic_differentiation"))
179 if (
isParamValid(
"functionally_graded_youngs_modulus_crack_dir_gradient") !=
181 paramError(
"functionally_graded_youngs_modulus_crack_dir_gradient",
182 "You have selected to compute the interaction integral for a crack in FGM. That "
183 "selection requires the user to provide a spatially varying elasticity modulus that "
184 "defines the transition of material properties (i.e. "
185 "'functionally_graded_youngs_modulus') and its "
186 "spatial derivative in the crack direction (i.e. "
187 "'functionally_graded_youngs_modulus_crack_dir_gradient').");
189 if (
isParamValid(
"functionally_graded_youngs_modulus_crack_dir_gradient") &&
194 getParam<MaterialPropertyName>(
"functionally_graded_youngs_modulus_crack_dir_gradient");
196 getParam<MaterialPropertyName>(
"functionally_graded_youngs_modulus");
207 mooseError(
"DomainIntegral error: must set radius_inner and radius_outer.");
215 _ring_first = getParam<unsigned int>(
"ring_first");
216 _ring_last = getParam<unsigned int>(
"ring_last");
220 "DomainIntegral error: must set ring_first and ring_last if q_function_type = Topology.");
225 paramError(
"q_function_type",
"DomainIntegral error: invalid q_function_type.");
237 "DomainIntegral error: number_points_from_provider is provided but "
238 "crack_front_points_provider cannot be found.");
244 mooseError(
"Number of entries in 'radius_inner' and 'radius_outer' must match.");
246 bool youngs_modulus_set(
false);
247 bool poissons_ratio_set(
false);
250 _blocks = getParam<std::vector<SubdomainName>>(
"block");
252 MultiMooseEnum integral_moose_enums = getParam<MultiMooseEnum>(
"integrals");
253 for (
unsigned int i = 0; i < integral_moose_enums.size(); ++i)
255 _displacements = getParam<std::vector<VariableName>>(
"displacements");
260 "DomainIntegral error: The size of the displacements vector should at least be 2.");
262 if (integral_moose_enums[i] !=
"JIntegral" && integral_moose_enums[i] !=
"CIntegral" &&
263 integral_moose_enums[i] !=
"KFromJIntegral")
268 "DomainIntegral error: must set Poisson's ratio and Young's modulus for integral: ",
269 integral_moose_enums[i]);
272 poissons_ratio_set =
true;
274 youngs_modulus_set =
true;
284 "JIntegral, CIntegral, and KFromJIntegral options are mutually exclusive");
294 _temp = getParam<VariableName>(
"temperature");
299 "DomainIntegral error: must provide `eigenstrain_names` when temperature is coupled.");
305 "DomainIntegral error: must calculate KI, KII and KIII to get equivalent K.");
312 "'output_variables' not yet supported with 'crack_front_points'");
318 mooseError(
"DomainIntegral error: must set Young's modulus and Poisson's ratio "
319 "if K_FROM_J_INTEGRAL is selected.");
320 if (!youngs_modulus_set)
322 if (!poissons_ratio_set)
331 "'eigenstrain_gradient' cannot be specified when the computed integrals include "
332 "JIntegral, CIntegral, or KFromJIntegral");
335 "'body_force' cannot be specified when the computed integrals include JIntegral, "
336 "CIntegral, or KFromJIntegral");
340 "'eigenstrain_gradient' cannot be specified together with 'temperature' or "
341 "'eigenstrain_names'. These are for separate, mutually exclusive systems for "
342 "including the effect of eigenstrains");
350 const std::string uo_name(
"crackFrontDefinition");
351 const std::string ak_base_name(
"q");
352 const std::string av_base_name(
"q");
354 const std::string aux_stress_base_name(
"aux_stress");
355 const std::string aux_grad_disp_base_name(
"aux_grad_disp");
360 std::string ad_prepend =
"";
366 const std::string uo_type_name(
"CrackFrontDefinition");
370 params.
set<
int>(
"execution_order_group") = -1;
400 params.
set<
unsigned int>(
"number_points_from_provider") =
401 getParam<unsigned int>(
"number_points_from_provider");
412 params.
set<
bool>(
"t_stress") =
true;
415 unsigned int nrings = 0;
418 params.
set<
bool>(
"q_function_rings") =
true;
430 params.
set<
unsigned int>(
"nrings") = nrings;
433 _problem->addUserObject(uo_type_name, uo_name, params);
437 if (
isParamValid(
"number_points_from_provider") && num_crack_front_points == 0)
440 "Requesting AuxVariable output of q functions but the number of crack fronts for "
441 "output is zero. AuxVariable output for XFEM cutter objects requires "
442 "number_points_from_provider to be set.");
445 for (
unsigned int ring_index = 0; ring_index <
_ring_vec.size(); ++ring_index)
447 std::string aux_var_type;
449 aux_var_type =
"MooseVariable";
450 else if (
_family ==
"MONOMIAL")
451 aux_var_type =
"MooseVariableConstMonomial";
453 aux_var_type =
"MooseVariableScalar";
456 ". Please use LAGRANGE, MONOMIAL, or SCALAR");
464 std::ostringstream av_name_stream;
465 av_name_stream << av_base_name <<
"_" <<
_ring_vec[ring_index];
466 _problem->addAuxVariable(aux_var_type, av_name_stream.str(), params);
470 for (
unsigned int cfp_index = 0; cfp_index < num_crack_front_points; ++cfp_index)
472 std::ostringstream av_name_stream;
473 av_name_stream << av_base_name <<
"_" << cfp_index + 1 <<
"_" <<
_ring_vec[ring_index];
474 _problem->addAuxVariable(aux_var_type, av_name_stream.str(), params);
482 std::string ak_type_name;
483 unsigned int nrings = 0;
486 ak_type_name =
"DomainIntegralQFunction";
491 ak_type_name =
"DomainIntegralTopologicalQFunction";
497 params.
set<UserObjectName>(
"crack_front_definition") = uo_name;
500 for (
unsigned int ring_index = 0; ring_index < nrings; ++ring_index)
509 params.
set<
unsigned int>(
"ring_index") =
_ring_first + ring_index;
514 std::ostringstream ak_name_stream;
515 ak_name_stream << ak_base_name <<
"_" <<
_ring_vec[ring_index];
516 std::ostringstream av_name_stream;
517 av_name_stream << av_base_name <<
"_" <<
_ring_vec[ring_index];
518 params.
set<AuxVariableName>(
"variable") = av_name_stream.str();
519 _problem->addAuxKernel(ak_type_name, ak_name_stream.str(), params);
523 for (
unsigned int cfp_index = 0; cfp_index < num_crack_front_points; ++cfp_index)
525 std::ostringstream ak_name_stream;
526 ak_name_stream << ak_base_name <<
"_" << cfp_index + 1 <<
"_" <<
_ring_vec[ring_index];
527 std::ostringstream av_name_stream;
528 av_name_stream << av_base_name <<
"_" << cfp_index + 1 <<
"_" <<
_ring_vec[ring_index];
529 params.
set<AuxVariableName>(
"variable") = av_name_stream.str();
530 params.
set<
unsigned int>(
"crack_front_point_index") = cfp_index;
531 _problem->addAuxKernel(ak_type_name, ak_name_stream.str(), params);
545 getParam<UserObjectName>(
"crack_front_points_provider"));
546 if (crack_front_points_provider->usesMesh())
549 if (xfem_cutter_points != num_crack_front_points)
551 "This must match the number of points provided by the XFEM mesh cutter "
553 "\n number_points_from_provider:",
554 num_crack_front_points,
555 "\n XFEM Crack Front Points: ",
561 std::string pp_base_name;
577 pp_base_name =
"II_KI";
581 pp_base_name =
"II_KII";
585 pp_base_name =
"II_KIII";
589 pp_base_name =
"II_T";
592 const std::string pp_type_name(
"VectorPostprocessorComponent");
594 for (
unsigned int ring_index = 0; ring_index <
_ring_vec.size(); ++ring_index)
598 params.
set<VectorPostprocessorName>(
"vectorpostprocessor") =
601 params.
set<
unsigned int>(
"index") = 0;
602 params.
set<std::string>(
"vector_name") =
604 _problem->addPostprocessor(pp_type_name, pp_name, params);
608 for (
unsigned int cfp_index = 0; cfp_index < num_crack_front_points; ++cfp_index)
610 params.
set<VectorPostprocessorName>(
"vectorpostprocessor") =
612 std::string pp_name = pp_base_name +
"_" +
Moose::stringify(cfp_index + 1) +
"_" +
614 params.
set<
unsigned int>(
"index") = cfp_index;
615 params.
set<std::string>(
"vector_name") =
617 _problem->addPostprocessor(pp_type_name, pp_name, params);
625 std::string pp_base_name(
"Keq");
626 const std::string pp_type_name(
"VectorPostprocessorComponent");
628 for (
unsigned int ring_index = 0; ring_index <
_ring_vec.size(); ++ring_index)
632 params.
set<VectorPostprocessorName>(
"vectorpostprocessor") =
635 params.
set<
unsigned int>(
"index") = 0;
636 params.
set<std::string>(
"vector_name") =
638 _problem->addPostprocessor(pp_type_name, pp_name, params);
642 for (
unsigned int cfp_index = 0; cfp_index < num_crack_front_points; ++cfp_index)
644 params.
set<VectorPostprocessorName>(
"vectorpostprocessor") =
646 std::string pp_name = pp_base_name +
"_" +
Moose::stringify(cfp_index + 1) +
"_" +
648 params.
set<
unsigned int>(
"index") = cfp_index;
649 params.
set<std::string>(
"vector_name") =
651 _problem->addPostprocessor(pp_type_name, pp_name, params);
660 const std::string pp_type_name(
"CrackFrontData");
663 params.
set<UserObjectName>(
"crack_front_definition") = uo_name;
666 std::ostringstream pp_name_stream;
667 pp_name_stream << ov_base_name <<
"_crack";
669 _problem->addPostprocessor(pp_type_name, pp_name_stream.str(), params);
673 for (
unsigned int cfp_index = 0; cfp_index < num_crack_front_points; ++cfp_index)
675 std::ostringstream pp_name_stream;
676 pp_name_stream << ov_base_name <<
"_crack_" << cfp_index + 1;
678 params.
set<
unsigned int>(
"crack_front_point_index") = cfp_index;
679 _problem->addPostprocessor(pp_type_name, pp_name_stream.str(), params);
690 std::string vpp_base_name;
691 std::string jintegral_selection =
"JIntegral";
696 jintegral_selection =
"JIntegral";
701 jintegral_selection =
"KFromJIntegral";
706 jintegral_selection =
"CIntegral";
710 vpp_base_name +=
"_2DVPP";
712 const std::string vpp_type_name(
"JIntegral");
714 if (!getParam<bool>(
"output_vpp"))
715 params.
set<std::vector<OutputName>>(
"outputs") = {
"none"};
718 params.
set<UserObjectName>(
"crack_front_definition") = uo_name;
719 params.
set<std::vector<SubdomainName>>(
"block") = {
_blocks};
732 params.
set<
MooseEnum>(
"integral") = jintegral_selection;
736 for (
unsigned int ring_index = 0; ring_index <
_ring_vec.size(); ++ring_index)
738 params.
set<
unsigned int>(
"ring_index") =
_ring_vec[ring_index];
742 _problem->addVectorPostprocessor(vpp_type_name, vpp_name, params);
754 "In DomainIntegral, symmetry_plane option cannot be used with mode-II or "
755 "mode-III interaction integral");
757 std::string vpp_base_name;
758 std::string vpp_type_name(ad_prepend +
"InteractionIntegral");
761 if (!getParam<bool>(
"output_vpp"))
762 params.
set<std::vector<OutputName>>(
"outputs") = {
"none"};
773 getParam<CoupledName>(
"additional_eigenstrain_00");
775 getParam<CoupledName>(
"additional_eigenstrain_01");
777 getParam<CoupledName>(
"additional_eigenstrain_11");
779 getParam<CoupledName>(
"additional_eigenstrain_22");
782 params.
set<UserObjectName>(
"crack_front_definition") = uo_name;
784 params.
set<std::vector<SubdomainName>>(
"block") = {
_blocks};
791 params.
set<MaterialPropertyName>(
792 "functionally_graded_youngs_modulus_crack_dir_gradient") = {
794 params.
set<MaterialPropertyName>(
"functionally_graded_youngs_modulus") = {
802 params.
set<std::vector<VariableName>>(
"temperature") = {
_temp};
805 params.
set<MaterialPropertyName>(
"eigenstrain_gradient") =
806 parameters().
get<MaterialPropertyName>(
"eigenstrain_gradient");
808 params.
set<MaterialPropertyName>(
"body_force") =
825 vpp_base_name =
"II_KI";
826 params.
set<Real>(
"K_factor") =
832 vpp_base_name =
"II_KII";
833 params.
set<Real>(
"K_factor") =
839 vpp_base_name =
"II_KIII";
845 vpp_base_name =
"II_T";
851 vpp_base_name +=
"_2DVPP";
852 for (
unsigned int ring_index = 0; ring_index <
_ring_vec.size(); ++ring_index)
854 params.
set<
unsigned int>(
"ring_index") =
_ring_vec[ring_index];
858 _problem->addVectorPostprocessor(vpp_type_name, vpp_name, params);
865 std::string vpp_base_name(
"Keq");
867 vpp_base_name +=
"_2DVPP";
868 const std::string vpp_type_name(
"MixedModeEquivalentK");
873 for (
unsigned int ring_index = 0; ring_index <
_ring_vec.size(); ++ring_index)
875 std::string ki_name =
"II_KI_";
876 std::string kii_name =
"II_KII_";
877 std::string kiii_name =
"II_KIII_";
878 params.
set<
unsigned int>(
"ring_index") =
_ring_vec[ring_index];
881 params.
set<VectorPostprocessorName>(
"KI_vectorpostprocessor") =
883 params.
set<VectorPostprocessorName>(
"KII_vectorpostprocessor") =
885 params.
set<VectorPostprocessorName>(
"KIII_vectorpostprocessor") =
890 params.
set<VectorPostprocessorName>(
"KI_vectorpostprocessor") =
892 params.
set<VectorPostprocessorName>(
"KII_vectorpostprocessor") =
894 params.
set<VectorPostprocessorName>(
"KIII_vectorpostprocessor") =
897 params.
set<std::string>(
"KI_vector_name") =
899 params.
set<std::string>(
"KII_vector_name") =
901 params.
set<std::string>(
"KIII_vector_name") =
904 _problem->addVectorPostprocessor(vpp_type_name, vpp_name, params);
912 const std::string vpp_type_name(
"VectorOfPostprocessors");
915 std::ostringstream vpp_name_stream;
917 std::vector<PostprocessorName> postprocessor_names;
918 for (
unsigned int cfp_index = 0; cfp_index < num_crack_front_points; ++cfp_index)
920 std::ostringstream pp_name_stream;
921 pp_name_stream << vpp_name_stream.str() <<
"_" << cfp_index + 1;
922 postprocessor_names.push_back(pp_name_stream.str());
924 params.
set<std::vector<PostprocessorName>>(
"postprocessors") = postprocessor_names;
925 _problem->addVectorPostprocessor(vpp_type_name, vpp_name_stream.str(), params);
934 std::string mater_name;
935 const std::string mater_type_name(
"ThermalFractureIntegral");
936 mater_name =
"ThermalFractureIntegral";
939 params.
set<std::vector<MaterialPropertyName>>(
"eigenstrain_names") =
940 getParam<std::vector<MaterialPropertyName>>(
"eigenstrain_names");
941 params.
set<std::vector<VariableName>>(
"temperature") = {
_temp};
942 params.
set<std::vector<SubdomainName>>(
"block") = {
_blocks};
943 _problem->addMaterial(mater_type_name, mater_name, params);
945 MultiMooseEnum integral_moose_enums = getParam<MultiMooseEnum>(
"integrals");
946 bool have_j_integral =
false;
947 bool have_c_integral =
false;
949 for (
auto ime : integral_moose_enums)
951 if (ime ==
"JIntegral" || ime ==
"CIntegral" || ime ==
"KFromJIntegral" ||
952 ime ==
"InteractionIntegralKI" || ime ==
"InteractionIntegralKII" ||
953 ime ==
"InteractionIntegralKIII" || ime ==
"InteractionIntegralT")
954 have_j_integral =
true;
956 if (ime ==
"CIntegral")
957 have_c_integral =
true;
961 std::string mater_name;
962 const std::string mater_type_name(ad_prepend +
"StrainEnergyDensity");
963 mater_name = ad_prepend +
"StrainEnergyDensity";
968 params.
set<std::vector<SubdomainName>>(
"block") = {
_blocks};
969 _problem->addMaterial(mater_type_name, mater_name, params);
972 std::string mater_name;
973 const std::string mater_type_name(ad_prepend +
"EshelbyTensor");
974 mater_name = ad_prepend +
"EshelbyTensor";
977 _displacements = getParam<std::vector<VariableName>>(
"displacements");
979 params.
set<std::vector<SubdomainName>>(
"block") = {
_blocks};
982 params.
set<
bool>(
"compute_dissipation") =
true;
985 params.
set<std::vector<VariableName>>(
"temperature") = {
_temp};
987 _problem->addMaterial(mater_type_name, mater_name, params);
992 std::string mater_name;
993 const std::string mater_type_name(ad_prepend +
"StrainEnergyRateDensity");
994 mater_name = ad_prepend +
"StrainEnergyRateDensity";
997 params.
set<std::vector<SubdomainName>>(
"block") = {
_blocks};
998 params.
set<std::vector<MaterialName>>(
"inelastic_models") =
999 getParam<std::vector<MaterialName>>(
"inelastic_models");
1001 _problem->addMaterial(mater_type_name, mater_name, params);