LCOV - code coverage report
Current view: top level - src/actions - DomainIntegralAction.C (source / functions) Hit Total Coverage
Test: idaholab/moose tensor_mechanics: d6b47a Lines: 541 579 93.4 %
Date: 2024-02-27 11:53:14 Functions: 6 7 85.7 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //* This file is part of the MOOSE framework
       2             : //* https://www.mooseframework.org
       3             : //*
       4             : //* All rights reserved, see COPYRIGHT for full restrictions
       5             : //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
       6             : //*
       7             : //* Licensed under LGPL 2.1, please see LICENSE for details
       8             : //* https://www.gnu.org/licenses/lgpl-2.1.html
       9             : 
      10             : // MOOSE includes
      11             : #include "DomainIntegralAction.h"
      12             : #include "Factory.h"
      13             : #include "FEProblem.h"
      14             : #include "Parser.h"
      15             : #include "CrackFrontDefinition.h"
      16             : #include "MooseMesh.h"
      17             : #include "Conversion.h"
      18             : 
      19             : #include "libmesh/string_to_enum.h"
      20             : 
      21             : registerMooseAction("TensorMechanicsApp", DomainIntegralAction, "add_user_object");
      22             : 
      23             : registerMooseAction("TensorMechanicsApp", DomainIntegralAction, "add_aux_variable");
      24             : 
      25             : registerMooseAction("TensorMechanicsApp", DomainIntegralAction, "add_aux_kernel");
      26             : 
      27             : registerMooseAction("TensorMechanicsApp", DomainIntegralAction, "add_postprocessor");
      28             : 
      29             : registerMooseAction("TensorMechanicsApp", DomainIntegralAction, "add_material");
      30             : 
      31             : InputParameters
      32         946 : DomainIntegralAction::validParams()
      33             : {
      34         946 :   InputParameters params = Action::validParams();
      35         946 :   addCrackFrontDefinitionParams(params);
      36             :   MultiMooseEnum integral_vec(
      37             :       "JIntegral CIntegral KFromJIntegral InteractionIntegralKI InteractionIntegralKII "
      38        1892 :       "InteractionIntegralKIII InteractionIntegralT");
      39         946 :   params.addClassDescription(
      40             :       "Creates the MOOSE objects needed to compute fraction domain integrals");
      41        1892 :   params.addRequiredParam<MultiMooseEnum>("integrals",
      42             :                                           integral_vec,
      43         946 :                                           "Domain integrals to calculate.  Choices are: " +
      44         946 :                                               integral_vec.getRawNames());
      45        1892 :   params.addParam<std::vector<BoundaryName>>(
      46             :       "boundary", {}, "Boundary containing the crack front points");
      47        1892 :   params.addParam<std::vector<Point>>("crack_front_points", "Set of points to define crack front");
      48        1892 :   params.addParam<std::string>(
      49             :       "order", "FIRST", "Specifies the order of the FE shape function to use for q AuxVariables");
      50        1892 :   params.addParam<std::string>(
      51             :       "family", "LAGRANGE", "Specifies the family of FE shape functions to use for q AuxVariables");
      52        1892 :   params.addParam<std::vector<Real>>("radius_inner", "Inner radius for volume integral domain");
      53        1892 :   params.addParam<std::vector<Real>>("radius_outer", "Outer radius for volume integral domain");
      54        1892 :   params.addParam<unsigned int>("ring_first",
      55             :                                 "The first ring of elements for volume integral domain");
      56        1892 :   params.addParam<unsigned int>("ring_last",
      57             :                                 "The last ring of elements for volume integral domain");
      58        1892 :   params.addParam<std::vector<VariableName>>(
      59             :       "output_variable", "Variable values to be reported along the crack front");
      60        1892 :   params.addParam<Real>("poissons_ratio", "Poisson's ratio");
      61        1892 :   params.addParam<Real>("youngs_modulus", "Young's modulus");
      62        1892 :   params.addParam<std::vector<SubdomainName>>(
      63             :       "block", {}, "The block ids where integrals are defined");
      64        1892 :   params.addParam<std::vector<VariableName>>(
      65             :       "displacements",
      66             :       {},
      67             :       "The displacements appropriate for the simulation geometry and coordinate system");
      68        1892 :   params.addParam<VariableName>("temperature", "", "The temperature");
      69        1892 :   params.addParam<MaterialPropertyName>(
      70             :       "functionally_graded_youngs_modulus_crack_dir_gradient",
      71             :       "Gradient of the spatially varying Young's modulus provided in "
      72             :       "'functionally_graded_youngs_modulus' in the direction of crack extension.");
      73        1892 :   params.addParam<MaterialPropertyName>(
      74             :       "functionally_graded_youngs_modulus",
      75             :       "Spatially varying elasticity modulus variable. This input is required when "
      76             :       "using the functionally graded material capability.");
      77        1892 :   params.addCoupledVar("additional_eigenstrain_00",
      78             :                        "Optional additional eigenstrain variable that will be accounted for in the "
      79             :                        "interaction integral (component 00 or XX).");
      80        1892 :   params.addCoupledVar("additional_eigenstrain_01",
      81             :                        "Optional additional eigenstrain variable that will be accounted for in the "
      82             :                        "interaction integral (component 01 or XY).");
      83        1892 :   params.addCoupledVar("additional_eigenstrain_11",
      84             :                        "Optional additional eigenstrain variable that will be accounted for in the "
      85             :                        "interaction integral (component 11 or YY).");
      86        1892 :   params.addCoupledVar("additional_eigenstrain_22",
      87             :                        "Optional additional eigenstrain variable that will be accounted for in the "
      88             :                        "interaction integral (component 22 or ZZ).");
      89        1892 :   params.addCoupledVar("additional_eigenstrain_02",
      90             :                        "Optional additional eigenstrain variable that will be accounted for in the "
      91             :                        "interaction integral (component 02 or XZ).");
      92        1892 :   params.addCoupledVar("additional_eigenstrain_12",
      93             :                        "Optional additional eigenstrain variable that will be accounted for in the "
      94             :                        "interaction integral (component 12 or XZ).");
      95        1892 :   params.addParamNamesToGroup(
      96             :       "additional_eigenstrain_00 additional_eigenstrain_01 additional_eigenstrain_11 "
      97             :       "additional_eigenstrain_22 additional_eigenstrain_02 additional_eigenstrain_12",
      98             :       "Generic eigenstrains for the computation of the interaction integral.");
      99        1892 :   MooseEnum position_type("Angle Distance", "Distance");
     100        1892 :   params.addParam<MooseEnum>(
     101             :       "position_type",
     102             :       position_type,
     103         946 :       "The method used to calculate position along crack front.  Options are: " +
     104         946 :           position_type.getRawNames());
     105        1892 :   MooseEnum q_function_type("Geometry Topology", "Geometry");
     106        1892 :   params.addParam<MooseEnum>("q_function_type",
     107             :                              q_function_type,
     108         946 :                              "The method used to define the integration domain. Options are: " +
     109         946 :                                  q_function_type.getRawNames());
     110        1892 :   params.addParam<bool>(
     111             :       "equivalent_k",
     112        1892 :       false,
     113             :       "Calculate an equivalent K from KI, KII and KIII, assuming self-similar crack growth.");
     114        1892 :   params.addParam<bool>("output_q", true, "Output q");
     115        1892 :   params.addRequiredParam<bool>(
     116             :       "incremental", "Flag to indicate whether an incremental or total model is being used.");
     117        1892 :   params.addParam<std::vector<MaterialPropertyName>>(
     118             :       "eigenstrain_names", "List of eigenstrains applied in the strain calculation");
     119        2838 :   params.addDeprecatedParam<bool>("convert_J_to_K",
     120        1892 :                                   false,
     121             :                                   "Convert J-integral to stress intensity factor K.",
     122             :                                   "This input parameter is deprecated and will be removed soon. "
     123             :                                   "Use 'integrals = KFromJIntegral' to request output of the "
     124             :                                   "conversion from the J-integral to stress intensity factors");
     125        1892 :   params.addParam<std::vector<MaterialName>>(
     126             :       "inelastic_models",
     127             :       "The material objects to use to calculate the strain energy rate density.");
     128        1892 :   params.addParam<MaterialPropertyName>("eigenstrain_gradient",
     129             :                                         "Material defining gradient of eigenstrain tensor");
     130        1892 :   params.addParam<MaterialPropertyName>("body_force", "Material defining body force");
     131        1892 :   params.addParam<bool>("use_automatic_differentiation",
     132        1892 :                         false,
     133             :                         "Flag to use automatic differentiation (AD) objects when possible");
     134        1892 :   params.addParam<bool>(
     135             :       "used_by_xfem_to_grow_crack",
     136        1892 :       false,
     137             :       "Flag to trigger domainIntregal vector postprocessors to be executed on nonlinear.  This "
     138             :       "updates the values in the vector postprocessor which will allow the crack to grow in XFEM "
     139             :       "cutter objects that use the domainIntegral vector postprocssor values as a growth "
     140             :       "criterion.");
     141        1892 :   params.addParam<bool>("output_vpp",
     142        1892 :                         true,
     143             :                         "Flag to control the vector postprocessor outputs. Select false to "
     144             :                         "suppress the redundant csv files for each time step and ring");
     145         946 :   return params;
     146         946 : }
     147             : 
     148         946 : DomainIntegralAction::DomainIntegralAction(const InputParameters & params)
     149             :   : Action(params),
     150        1892 :     _boundary_names(getParam<std::vector<BoundaryName>>("boundary")),
     151        1892 :     _closed_loop(getParam<bool>("closed_loop")),
     152         946 :     _use_crack_front_points_provider(false),
     153        1892 :     _order(getParam<std::string>("order")),
     154        1892 :     _family(getParam<std::string>("family")),
     155        1892 :     _direction_method_moose_enum(getParam<MooseEnum>("crack_direction_method")),
     156        1892 :     _end_direction_method_moose_enum(getParam<MooseEnum>("crack_end_direction_method")),
     157        1892 :     _have_crack_direction_vector(isParamValid("crack_direction_vector")),
     158         759 :     _crack_direction_vector(
     159         946 :         _have_crack_direction_vector ? getParam<RealVectorValue>("crack_direction_vector") : 0.0),
     160        1892 :     _have_crack_direction_vector_end_1(isParamValid("crack_direction_vector_end_1")),
     161         133 :     _crack_direction_vector_end_1(_have_crack_direction_vector_end_1
     162         946 :                                       ? getParam<RealVectorValue>("crack_direction_vector_end_1")
     163             :                                       : 0.0),
     164        1892 :     _have_crack_direction_vector_end_2(isParamValid("crack_direction_vector_end_2")),
     165         133 :     _crack_direction_vector_end_2(_have_crack_direction_vector_end_2
     166         946 :                                       ? getParam<RealVectorValue>("crack_direction_vector_end_2")
     167             :                                       : 0.0),
     168        1892 :     _treat_as_2d(getParam<bool>("2d")),
     169        1892 :     _axis_2d(getParam<unsigned int>("axis_2d")),
     170        1892 :     _has_symmetry_plane(isParamValid("symmetry_plane")),
     171        1592 :     _symmetry_plane(_has_symmetry_plane ? getParam<unsigned int>("symmetry_plane")
     172             :                                         : std::numeric_limits<unsigned int>::max()),
     173        1892 :     _position_type(getParam<MooseEnum>("position_type")),
     174        1892 :     _q_function_type(getParam<MooseEnum>("q_function_type")),
     175        1892 :     _get_equivalent_k(getParam<bool>("equivalent_k")),
     176         946 :     _use_displaced_mesh(false),
     177        1892 :     _output_q(getParam<bool>("output_q")),
     178        1892 :     _incremental(getParam<bool>("incremental")),
     179        3784 :     _convert_J_to_K(isParamValid("convert_J_to_K") ? getParam<bool>("convert_J_to_K") : false),
     180         946 :     _fgm_crack(false),
     181        1892 :     _use_ad(getParam<bool>("use_automatic_differentiation")),
     182        6622 :     _used_by_xfem_to_grow_crack(getParam<bool>("used_by_xfem_to_grow_crack"))
     183             : {
     184             : 
     185        1892 :   if (isParamValid("functionally_graded_youngs_modulus_crack_dir_gradient") !=
     186        1892 :       isParamValid("functionally_graded_youngs_modulus"))
     187           1 :     paramError("functionally_graded_youngs_modulus_crack_dir_gradient",
     188             :                "You have selected to compute the interaction integral for a crack in FGM. That "
     189             :                "selection requires the user to provide a spatially varying elasticity modulus that "
     190             :                "defines the transition of material properties (i.e. "
     191             :                "'functionally_graded_youngs_modulus') and its "
     192             :                "spatial derivative in the crack direction (i.e. "
     193             :                "'functionally_graded_youngs_modulus_crack_dir_gradient').");
     194             : 
     195        2835 :   if (isParamValid("functionally_graded_youngs_modulus_crack_dir_gradient") &&
     196        1017 :       isParamValid("functionally_graded_youngs_modulus"))
     197             :   {
     198          36 :     _fgm_crack = true;
     199             :     _functionally_graded_youngs_modulus_crack_dir_gradient =
     200          36 :         getParam<MaterialPropertyName>("functionally_graded_youngs_modulus_crack_dir_gradient");
     201             :     _functionally_graded_youngs_modulus =
     202          72 :         getParam<MaterialPropertyName>("functionally_graded_youngs_modulus");
     203             :   }
     204             : 
     205         945 :   if (_q_function_type == GEOMETRY)
     206             :   {
     207        3348 :     if (isParamValid("radius_inner") && isParamValid("radius_outer"))
     208             :     {
     209        1674 :       _radius_inner = getParam<std::vector<Real>>("radius_inner");
     210        1674 :       _radius_outer = getParam<std::vector<Real>>("radius_outer");
     211             :     }
     212             :     else
     213           0 :       mooseError("DomainIntegral error: must set radius_inner and radius_outer.");
     214        3873 :     for (unsigned int i = 0; i < _radius_inner.size(); ++i)
     215        3036 :       _ring_vec.push_back(i + 1);
     216             :   }
     217         108 :   else if (_q_function_type == TOPOLOGY)
     218             :   {
     219         432 :     if (isParamValid("ring_first") && isParamValid("ring_last"))
     220             :     {
     221         216 :       _ring_first = getParam<unsigned int>("ring_first");
     222         216 :       _ring_last = getParam<unsigned int>("ring_last");
     223             :     }
     224             :     else
     225           0 :       mooseError(
     226             :           "DomainIntegral error: must set ring_first and ring_last if q_function_type = Topology.");
     227         468 :     for (unsigned int i = _ring_first; i <= _ring_last; ++i)
     228         360 :       _ring_vec.push_back(i);
     229             :   }
     230             :   else
     231           0 :     paramError("q_function_type", "DomainIntegral error: invalid q_function_type.");
     232             : 
     233        1890 :   if (isParamValid("crack_front_points"))
     234         252 :     _crack_front_points = getParam<std::vector<Point>>("crack_front_points");
     235             : 
     236        1890 :   if (isParamValid("crack_front_points_provider"))
     237             :   {
     238           0 :     if (!isParamValid("number_points_from_provider"))
     239           0 :       paramError("number_points_from_provider",
     240             :                  "DomainIntegral error: when crack_front_points_provider is used, "
     241             :                  "number_points_from_provider must be provided.");
     242           0 :     _use_crack_front_points_provider = true;
     243           0 :     _crack_front_points_provider = getParam<UserObjectName>("crack_front_points_provider");
     244             :   }
     245        1890 :   else if (isParamValid("number_points_from_provider"))
     246           0 :     paramError("crack_front_points_provider",
     247             :                "DomainIntegral error: number_points_from_provider is provided but "
     248             :                "crack_front_points_provider cannot be found.");
     249        1890 :   if (isParamValid("crack_mouth_boundary"))
     250         324 :     _crack_mouth_boundary_names = getParam<std::vector<BoundaryName>>("crack_mouth_boundary");
     251        1890 :   if (isParamValid("intersecting_boundary"))
     252         342 :     _intersecting_boundary_names = getParam<std::vector<BoundaryName>>("intersecting_boundary");
     253         945 :   if (_radius_inner.size() != _radius_outer.size())
     254           0 :     mooseError("Number of entries in 'radius_inner' and 'radius_outer' must match.");
     255             : 
     256             :   bool youngs_modulus_set(false);
     257             :   bool poissons_ratio_set(false);
     258             : 
     259             :   // All domain integral types block restrict the objects created by this action.
     260        1890 :   _blocks = getParam<std::vector<SubdomainName>>("block");
     261             : 
     262        1890 :   MultiMooseEnum integral_moose_enums = getParam<MultiMooseEnum>("integrals");
     263        2402 :   for (unsigned int i = 0; i < integral_moose_enums.size(); ++i)
     264             :   {
     265        4371 :     _displacements = getParam<std::vector<VariableName>>("displacements");
     266             : 
     267        1457 :     if (_displacements.size() < 2)
     268           0 :       paramError(
     269             :           "displacements",
     270             :           "DomainIntegral error: The size of the displacements vector should at least be 2.");
     271             : 
     272        4468 :     if (integral_moose_enums[i] != "JIntegral" && integral_moose_enums[i] != "CIntegral" &&
     273         759 :         integral_moose_enums[i] != "KFromJIntegral")
     274             :     {
     275             :       // Check that parameters required for interaction integrals are defined
     276        2964 :       if (!(isParamValid("poissons_ratio")) || !(isParamValid("youngs_modulus")))
     277           0 :         mooseError(
     278             :             "DomainIntegral error: must set Poisson's ratio and Young's modulus for integral: ",
     279           0 :             integral_moose_enums[i]);
     280             : 
     281        1482 :       _poissons_ratio = getParam<Real>("poissons_ratio");
     282             :       poissons_ratio_set = true;
     283        1482 :       _youngs_modulus = getParam<Real>("youngs_modulus");
     284             :       youngs_modulus_set = true;
     285             :     }
     286             : 
     287        1457 :     _integrals.insert(INTEGRAL(int(integral_moose_enums.get(i))));
     288             :   }
     289             : 
     290         945 :   if ((_integrals.count(J_INTEGRAL) != 0 && _integrals.count(C_INTEGRAL) != 0) ||
     291         945 :       (_integrals.count(J_INTEGRAL) != 0 && _integrals.count(K_FROM_J_INTEGRAL) != 0) ||
     292         945 :       (_integrals.count(C_INTEGRAL) != 0 && _integrals.count(K_FROM_J_INTEGRAL) != 0))
     293           0 :     paramError("integrals",
     294             :                "JIntegral, CIntegral, and KFromJIntegral options are mutually exclusive");
     295             : 
     296             :   // Acommodate deprecated parameter convert_J_to_K
     297         945 :   if (_convert_J_to_K && _integrals.count(K_FROM_J_INTEGRAL) != 0)
     298             :   {
     299           0 :     _integrals.insert(K_FROM_J_INTEGRAL);
     300           0 :     _integrals.erase(J_INTEGRAL);
     301             :   }
     302             : 
     303        1890 :   if (isParamValid("temperature"))
     304        1890 :     _temp = getParam<VariableName>("temperature");
     305             : 
     306        1272 :   if (_temp != "" && !isParamValid("eigenstrain_names"))
     307           0 :     paramError(
     308             :         "eigenstrain_names",
     309             :         "DomainIntegral error: must provide `eigenstrain_names` when temperature is coupled.");
     310             : 
     311         945 :   if (_get_equivalent_k && (_integrals.count(INTERACTION_INTEGRAL_KI) == 0 ||
     312         156 :                             _integrals.count(INTERACTION_INTEGRAL_KII) == 0 ||
     313         156 :                             _integrals.count(INTERACTION_INTEGRAL_KIII) == 0))
     314           0 :     paramError("integrals",
     315             :                "DomainIntegral error: must calculate KI, KII and KIII to get equivalent K.");
     316             : 
     317        1890 :   if (isParamValid("output_variable"))
     318             :   {
     319         324 :     _output_variables = getParam<std::vector<VariableName>>("output_variable");
     320         108 :     if (_crack_front_points.size() > 0)
     321           0 :       paramError("output_variables",
     322             :                  "'output_variables' not yet supported with 'crack_front_points'");
     323             :   }
     324             : 
     325         945 :   if (_integrals.count(K_FROM_J_INTEGRAL) != 0)
     326             :   {
     327          72 :     if (!isParamValid("youngs_modulus") || !isParamValid("poissons_ratio"))
     328           0 :       mooseError("DomainIntegral error: must set Young's modulus and Poisson's ratio "
     329             :                  "if K_FROM_J_INTEGRAL is selected.");
     330          18 :     if (!youngs_modulus_set)
     331           0 :       _youngs_modulus = getParam<Real>("youngs_modulus");
     332          18 :     if (!poissons_ratio_set)
     333           0 :       _poissons_ratio = getParam<Real>("poissons_ratio");
     334             :   }
     335             : 
     336         945 :   if (_integrals.count(J_INTEGRAL) != 0 || _integrals.count(C_INTEGRAL) != 0 ||
     337         247 :       _integrals.count(K_FROM_J_INTEGRAL) != 0)
     338             :   {
     339        1432 :     if (isParamValid("eigenstrain_gradient"))
     340           1 :       paramError("eigenstrain_gradient",
     341             :                  "'eigenstrain_gradient' cannot be specified when the computed integrals include "
     342             :                  "JIntegral, CIntegral, or KFromJIntegral");
     343        1430 :     if (isParamValid("body_force"))
     344           1 :       paramError("body_force",
     345             :                  "'body_force' cannot be specified when the computed integrals include JIntegral, "
     346             :                  "CIntegral, or KFromJIntegral");
     347             :   }
     348        1941 :   if (isParamValid("eigenstrain_gradient") && (_temp != "" || isParamValid("eigenstrain_names")))
     349           1 :     paramError("eigenstrain_gradient",
     350             :                "'eigenstrain_gradient' cannot be specified together with 'temperature' or "
     351             :                "'eigenstrain_names'. These are for separate, mutually exclusive systems for "
     352             :                "including the effect of eigenstrains");
     353         942 : }
     354             : 
     355        4680 : DomainIntegralAction::~DomainIntegralAction() {}
     356             : 
     357             : void
     358         942 : DomainIntegralAction::act()
     359             : {
     360         942 :   const std::string uo_name("crackFrontDefinition");
     361         942 :   const std::string ak_base_name("q");
     362         942 :   const std::string av_base_name("q");
     363         942 :   const unsigned int num_crack_front_points = calcNumCrackFrontPoints();
     364         942 :   const std::string aux_stress_base_name("aux_stress");
     365         942 :   const std::string aux_grad_disp_base_name("aux_grad_disp");
     366             : 
     367         942 :   std::string ad_prepend = "";
     368         942 :   if (_use_ad)
     369             :     ad_prepend = "AD";
     370             : 
     371         942 :   if (_current_task == "add_user_object")
     372             :   {
     373         157 :     const std::string uo_type_name("CrackFrontDefinition");
     374             : 
     375         157 :     InputParameters params = _factory.getValidParams(uo_type_name);
     376         157 :     if (_use_crack_front_points_provider && _used_by_xfem_to_grow_crack)
     377           0 :       params.set<ExecFlagEnum>("execute_on") = {EXEC_INITIAL, EXEC_TIMESTEP_END, EXEC_NONLINEAR};
     378             :     else
     379         628 :       params.set<ExecFlagEnum>("execute_on") = {EXEC_INITIAL, EXEC_TIMESTEP_END};
     380             : 
     381         157 :     params.set<MooseEnum>("crack_direction_method") = _direction_method_moose_enum;
     382         157 :     params.set<MooseEnum>("crack_end_direction_method") = _end_direction_method_moose_enum;
     383         157 :     if (_have_crack_direction_vector)
     384         126 :       params.set<RealVectorValue>("crack_direction_vector") = _crack_direction_vector;
     385         157 :     if (_have_crack_direction_vector_end_1)
     386          22 :       params.set<RealVectorValue>("crack_direction_vector_end_1") = _crack_direction_vector_end_1;
     387         157 :     if (_have_crack_direction_vector_end_2)
     388          22 :       params.set<RealVectorValue>("crack_direction_vector_end_2") = _crack_direction_vector_end_2;
     389         157 :     if (_crack_mouth_boundary_names.size() != 0)
     390          36 :       params.set<std::vector<BoundaryName>>("crack_mouth_boundary") = _crack_mouth_boundary_names;
     391         157 :     if (_intersecting_boundary_names.size() != 0)
     392          38 :       params.set<std::vector<BoundaryName>>("intersecting_boundary") = _intersecting_boundary_names;
     393         157 :     params.set<bool>("2d") = _treat_as_2d;
     394         157 :     params.set<unsigned int>("axis_2d") = _axis_2d;
     395         157 :     if (_has_symmetry_plane)
     396         107 :       params.set<unsigned int>("symmetry_plane") = _symmetry_plane;
     397         157 :     if (_boundary_names.size() != 0)
     398         286 :       params.set<std::vector<BoundaryName>>("boundary") = _boundary_names;
     399         157 :     if (_crack_front_points.size() != 0)
     400          28 :       params.set<std::vector<Point>>("crack_front_points") = _crack_front_points;
     401         157 :     if (_use_crack_front_points_provider)
     402           0 :       params.applyParameters(parameters(),
     403             :                              {"crack_front_points_provider, number_points_from_provider"});
     404         157 :     if (_closed_loop)
     405           0 :       params.set<bool>("closed_loop") = _closed_loop;
     406         157 :     params.set<bool>("use_displaced_mesh") = _use_displaced_mesh;
     407         157 :     if (_integrals.count(INTERACTION_INTEGRAL_T) != 0)
     408             :     {
     409          18 :       params.set<VariableName>("disp_x") = _displacements[0];
     410          18 :       params.set<VariableName>("disp_y") = _displacements[1];
     411           9 :       if (_displacements.size() == 3)
     412          12 :         params.set<VariableName>("disp_z") = _displacements[2];
     413           9 :       params.set<bool>("t_stress") = true;
     414             :     }
     415             : 
     416             :     unsigned int nrings = 0;
     417         157 :     if (_q_function_type == TOPOLOGY)
     418             :     {
     419          18 :       params.set<bool>("q_function_rings") = true;
     420          18 :       params.set<unsigned int>("last_ring") = _ring_last;
     421          18 :       params.set<unsigned int>("first_ring") = _ring_first;
     422          18 :       nrings = _ring_last - _ring_first + 1;
     423             :     }
     424         139 :     else if (_q_function_type == GEOMETRY)
     425             :     {
     426         139 :       params.set<std::vector<Real>>("j_integral_radius_inner") = _radius_inner;
     427         278 :       params.set<std::vector<Real>>("j_integral_radius_outer") = _radius_outer;
     428         139 :       nrings = _ring_vec.size();
     429             :     }
     430             : 
     431         157 :     params.set<unsigned int>("nrings") = nrings;
     432         157 :     params.set<MooseEnum>("q_function_type") = _q_function_type;
     433             : 
     434         157 :     _problem->addUserObject(uo_type_name, uo_name, params);
     435         157 :   }
     436         785 :   else if (_current_task == "add_aux_variable" && _output_q)
     437             :   {
     438         388 :     for (unsigned int ring_index = 0; ring_index < _ring_vec.size(); ++ring_index)
     439             :     {
     440             :       std::string aux_var_type;
     441         303 :       if (_family == "LAGRANGE")
     442             :         aux_var_type = "MooseVariable";
     443           0 :       else if (_family == "MONOMIAL")
     444             :         aux_var_type = "MooseVariableConstMonomial";
     445           0 :       else if (_family == "SCALAR")
     446             :         aux_var_type = "MooseVariableScalar";
     447             :       else
     448           0 :         mooseError("Unsupported finite element family in, " + name() +
     449             :                    ".  Please use LAGRANGE, MONOMIAL, or SCALAR");
     450             : 
     451         303 :       auto params = _factory.getValidParams(aux_var_type);
     452         303 :       params.set<MooseEnum>("order") = _order;
     453         303 :       params.set<MooseEnum>("family") = _family;
     454             : 
     455         303 :       if (_treat_as_2d && _use_crack_front_points_provider == false)
     456             :       {
     457         219 :         std::ostringstream av_name_stream;
     458         219 :         av_name_stream << av_base_name << "_" << _ring_vec[ring_index];
     459         219 :         _problem->addAuxVariable(aux_var_type, av_name_stream.str(), params);
     460         219 :       }
     461             :       else
     462             :       {
     463         528 :         for (unsigned int cfp_index = 0; cfp_index < num_crack_front_points; ++cfp_index)
     464             :         {
     465         444 :           std::ostringstream av_name_stream;
     466         444 :           av_name_stream << av_base_name << "_" << cfp_index + 1 << "_" << _ring_vec[ring_index];
     467         444 :           _problem->addAuxVariable(aux_var_type, av_name_stream.str(), params);
     468         444 :         }
     469             :       }
     470         303 :     }
     471             :   }
     472             : 
     473         700 :   else if (_current_task == "add_aux_kernel" && _output_q)
     474             :   {
     475             :     std::string ak_type_name;
     476             :     unsigned int nrings = 0;
     477          85 :     if (_q_function_type == GEOMETRY)
     478             :     {
     479             :       ak_type_name = "DomainIntegralQFunction";
     480          79 :       nrings = _ring_vec.size();
     481             :     }
     482           6 :     else if (_q_function_type == TOPOLOGY)
     483             :     {
     484             :       ak_type_name = "DomainIntegralTopologicalQFunction";
     485           6 :       nrings = _ring_last - _ring_first + 1;
     486             :     }
     487             : 
     488          85 :     InputParameters params = _factory.getValidParams(ak_type_name);
     489         340 :     params.set<ExecFlagEnum>("execute_on") = {EXEC_INITIAL, EXEC_TIMESTEP_END};
     490         170 :     params.set<UserObjectName>("crack_front_definition") = uo_name;
     491          85 :     params.set<bool>("use_displaced_mesh") = _use_displaced_mesh;
     492             : 
     493         388 :     for (unsigned int ring_index = 0; ring_index < nrings; ++ring_index)
     494             :     {
     495         303 :       if (_q_function_type == GEOMETRY)
     496             :       {
     497         282 :         params.set<Real>("j_integral_radius_inner") = _radius_inner[ring_index];
     498         282 :         params.set<Real>("j_integral_radius_outer") = _radius_outer[ring_index];
     499             :       }
     500          21 :       else if (_q_function_type == TOPOLOGY)
     501             :       {
     502          21 :         params.set<unsigned int>("ring_index") = _ring_first + ring_index;
     503             :       }
     504             : 
     505         303 :       if (_treat_as_2d && _use_crack_front_points_provider == false)
     506             :       {
     507         219 :         std::ostringstream ak_name_stream;
     508         219 :         ak_name_stream << ak_base_name << "_" << _ring_vec[ring_index];
     509         219 :         std::ostringstream av_name_stream;
     510         219 :         av_name_stream << av_base_name << "_" << _ring_vec[ring_index];
     511         438 :         params.set<AuxVariableName>("variable") = av_name_stream.str();
     512         219 :         _problem->addAuxKernel(ak_type_name, ak_name_stream.str(), params);
     513         219 :       }
     514             :       else
     515             :       {
     516         528 :         for (unsigned int cfp_index = 0; cfp_index < num_crack_front_points; ++cfp_index)
     517             :         {
     518         444 :           std::ostringstream ak_name_stream;
     519         444 :           ak_name_stream << ak_base_name << "_" << cfp_index + 1 << "_" << _ring_vec[ring_index];
     520         444 :           std::ostringstream av_name_stream;
     521         888 :           av_name_stream << av_base_name << "_" << cfp_index + 1 << "_" << _ring_vec[ring_index];
     522         888 :           params.set<AuxVariableName>("variable") = av_name_stream.str();
     523         444 :           params.set<unsigned int>("crack_front_point_index") = cfp_index;
     524         444 :           _problem->addAuxKernel(ak_type_name, ak_name_stream.str(), params);
     525         444 :         }
     526             :       }
     527             :     }
     528          85 :   }
     529             : 
     530         615 :   else if (_current_task == "add_postprocessor")
     531             :   {
     532         399 :     for (std::set<INTEGRAL>::iterator sit = _integrals.begin(); sit != _integrals.end(); ++sit)
     533             :     {
     534             :       std::string pp_base_name;
     535         242 :       switch (*sit)
     536             :       {
     537             :         case J_INTEGRAL:
     538             :           pp_base_name = "J";
     539             :           break;
     540             : 
     541             :         case C_INTEGRAL:
     542             :           pp_base_name = "C";
     543             :           break;
     544             : 
     545             :         case K_FROM_J_INTEGRAL:
     546             :           pp_base_name = "K";
     547             :           break;
     548             : 
     549             :         case INTERACTION_INTEGRAL_KI:
     550             :           pp_base_name = "II_KI";
     551             :           break;
     552             : 
     553             :         case INTERACTION_INTEGRAL_KII:
     554             :           pp_base_name = "II_KII";
     555             :           break;
     556             : 
     557             :         case INTERACTION_INTEGRAL_KIII:
     558             :           pp_base_name = "II_KIII";
     559             :           break;
     560             : 
     561             :         case INTERACTION_INTEGRAL_T:
     562             :           pp_base_name = "II_T";
     563             :           break;
     564             :       }
     565         242 :       const std::string pp_type_name("VectorPostprocessorComponent");
     566         484 :       InputParameters params = _factory.getValidParams(pp_type_name);
     567        1090 :       for (unsigned int ring_index = 0; ring_index < _ring_vec.size(); ++ring_index)
     568             :       {
     569         848 :         if (_treat_as_2d && _use_crack_front_points_provider == false)
     570             :         {
     571        1204 :           params.set<VectorPostprocessorName>("vectorpostprocessor") =
     572        1204 :               pp_base_name + "_2DVPP_" + Moose::stringify(_ring_vec[ring_index]);
     573        1204 :           std::string pp_name = pp_base_name + +"_" + Moose::stringify(_ring_vec[ring_index]);
     574         602 :           params.set<unsigned int>("index") = 0;
     575        1204 :           params.set<std::string>("vector_name") =
     576        1806 :               pp_base_name + "_" + Moose::stringify(_ring_vec[ring_index]);
     577         602 :           _problem->addPostprocessor(pp_type_name, pp_name, params);
     578         602 :         }
     579             :         else
     580             :         {
     581        1320 :           for (unsigned int cfp_index = 0; cfp_index < num_crack_front_points; ++cfp_index)
     582             :           {
     583        2148 :             params.set<VectorPostprocessorName>("vectorpostprocessor") =
     584        2148 :                 pp_base_name + "_" + Moose::stringify(_ring_vec[ring_index]);
     585        2148 :             std::string pp_name = pp_base_name + "_" + Moose::stringify(cfp_index + 1) + "_" +
     586        2148 :                                   Moose::stringify(_ring_vec[ring_index]);
     587        1074 :             params.set<unsigned int>("index") = cfp_index;
     588        2148 :             params.set<std::string>("vector_name") =
     589        3222 :                 pp_base_name + "_" + Moose::stringify(_ring_vec[ring_index]);
     590        1074 :             _problem->addPostprocessor(pp_type_name, pp_name, params);
     591             :           }
     592             :         }
     593             :       }
     594             :     }
     595             : 
     596         157 :     if (_get_equivalent_k)
     597             :     {
     598          26 :       std::string pp_base_name("Keq");
     599          26 :       const std::string pp_type_name("VectorPostprocessorComponent");
     600          26 :       InputParameters params = _factory.getValidParams(pp_type_name);
     601         114 :       for (unsigned int ring_index = 0; ring_index < _ring_vec.size(); ++ring_index)
     602             :       {
     603          88 :         if (_treat_as_2d && _use_crack_front_points_provider == false)
     604             :         {
     605         120 :           params.set<VectorPostprocessorName>("vectorpostprocessor") =
     606         120 :               pp_base_name + "_2DVPP_" + Moose::stringify(_ring_vec[ring_index]);
     607         120 :           std::string pp_name = pp_base_name + +"_" + Moose::stringify(_ring_vec[ring_index]);
     608          60 :           params.set<unsigned int>("index") = 0;
     609         120 :           params.set<std::string>("vector_name") =
     610         180 :               pp_base_name + "_" + Moose::stringify(_ring_vec[ring_index]);
     611          60 :           _problem->addPostprocessor(pp_type_name, pp_name, params);
     612          60 :         }
     613             :         else
     614             :         {
     615         112 :           for (unsigned int cfp_index = 0; cfp_index < num_crack_front_points; ++cfp_index)
     616             :           {
     617         168 :             params.set<VectorPostprocessorName>("vectorpostprocessor") =
     618         168 :                 pp_base_name + "_" + Moose::stringify(_ring_vec[ring_index]);
     619         168 :             std::string pp_name = pp_base_name + "_" + Moose::stringify(cfp_index + 1) + "_" +
     620         168 :                                   Moose::stringify(_ring_vec[ring_index]);
     621          84 :             params.set<unsigned int>("index") = cfp_index;
     622         168 :             params.set<std::string>("vector_name") =
     623         252 :                 pp_base_name + "_" + Moose::stringify(_ring_vec[ring_index]);
     624          84 :             _problem->addPostprocessor(pp_type_name, pp_name, params);
     625             :           }
     626             :         }
     627             :       }
     628          26 :     }
     629             : 
     630         175 :     for (unsigned int i = 0; i < _output_variables.size(); ++i)
     631             :     {
     632          18 :       const std::string ov_base_name(_output_variables[i]);
     633          18 :       const std::string pp_type_name("CrackFrontData");
     634          18 :       InputParameters params = _factory.getValidParams(pp_type_name);
     635          36 :       params.set<ExecFlagEnum>("execute_on") = EXEC_TIMESTEP_END;
     636          36 :       params.set<UserObjectName>("crack_front_definition") = uo_name;
     637          18 :       if (_treat_as_2d && _use_crack_front_points_provider == false)
     638             :       {
     639           0 :         std::ostringstream pp_name_stream;
     640           0 :         pp_name_stream << ov_base_name << "_crack";
     641           0 :         params.set<VariableName>("variable") = _output_variables[i];
     642           0 :         _problem->addPostprocessor(pp_type_name, pp_name_stream.str(), params);
     643           0 :       }
     644             :       else
     645             :       {
     646          72 :         for (unsigned int cfp_index = 0; cfp_index < num_crack_front_points; ++cfp_index)
     647             :         {
     648          54 :           std::ostringstream pp_name_stream;
     649          54 :           pp_name_stream << ov_base_name << "_crack_" << cfp_index + 1;
     650          54 :           params.set<VariableName>("variable") = _output_variables[i];
     651          54 :           params.set<unsigned int>("crack_front_point_index") = cfp_index;
     652          54 :           _problem->addPostprocessor(pp_type_name, pp_name_stream.str(), params);
     653          54 :         }
     654             :       }
     655          18 :     }
     656             :   }
     657             : 
     658         458 :   else if (_current_task == "add_vector_postprocessor")
     659             :   {
     660         157 :     if (_integrals.count(J_INTEGRAL) != 0 || _integrals.count(C_INTEGRAL) != 0 ||
     661         160 :         _integrals.count(K_FROM_J_INTEGRAL) != 0)
     662             :     {
     663             :       std::string vpp_base_name;
     664         119 :       std::string jintegral_selection = "JIntegral";
     665             : 
     666         119 :       if (_integrals.count(J_INTEGRAL) != 0)
     667             :       {
     668             :         vpp_base_name = "J";
     669             :         jintegral_selection = "JIntegral";
     670             :       }
     671           9 :       else if (_integrals.count(K_FROM_J_INTEGRAL) != 0)
     672             :       {
     673             :         vpp_base_name = "K";
     674             :         jintegral_selection = "KFromJIntegral";
     675             :       }
     676           6 :       else if (_integrals.count(C_INTEGRAL) != 0)
     677             :       {
     678             :         vpp_base_name = "C";
     679             :         jintegral_selection = "CIntegral";
     680             :       }
     681             : 
     682         119 :       if (_treat_as_2d && _use_crack_front_points_provider == false)
     683             :         vpp_base_name += "_2DVPP";
     684             : 
     685         119 :       const std::string vpp_type_name("JIntegral");
     686         119 :       InputParameters params = _factory.getValidParams(vpp_type_name);
     687         238 :       if (!getParam<bool>("output_vpp"))
     688          18 :         params.set<std::vector<OutputName>>("outputs") = {"none"};
     689             : 
     690         238 :       params.set<ExecFlagEnum>("execute_on") = EXEC_TIMESTEP_END;
     691         238 :       params.set<UserObjectName>("crack_front_definition") = uo_name;
     692         119 :       params.set<std::vector<SubdomainName>>("block") = {_blocks};
     693         119 :       params.set<MooseEnum>("position_type") = _position_type;
     694             : 
     695         119 :       if (_integrals.count(K_FROM_J_INTEGRAL) != 0)
     696             :       {
     697           3 :         params.set<Real>("youngs_modulus") = _youngs_modulus;
     698           3 :         params.set<Real>("poissons_ratio") = _poissons_ratio;
     699             :       }
     700             : 
     701         119 :       if (_has_symmetry_plane)
     702          95 :         params.set<unsigned int>("symmetry_plane") = _symmetry_plane;
     703             : 
     704             :       // Select the integral type to be computed in JIntegral vector postprocessor
     705         119 :       params.set<MooseEnum>("integral") = jintegral_selection;
     706             : 
     707         119 :       params.set<std::vector<VariableName>>("displacements") = _displacements;
     708         119 :       params.set<bool>("use_displaced_mesh") = _use_displaced_mesh;
     709         547 :       for (unsigned int ring_index = 0; ring_index < _ring_vec.size(); ++ring_index)
     710             :       {
     711         428 :         params.set<unsigned int>("ring_index") = _ring_vec[ring_index];
     712         856 :         params.set<MooseEnum>("q_function_type") = _q_function_type;
     713             : 
     714         856 :         std::string vpp_name = vpp_base_name + "_" + Moose::stringify(_ring_vec[ring_index]);
     715         428 :         _problem->addVectorPostprocessor(vpp_type_name, vpp_name, params);
     716             :       }
     717         119 :     }
     718             : 
     719         157 :     if (_integrals.count(INTERACTION_INTEGRAL_KI) != 0 ||
     720          95 :         _integrals.count(INTERACTION_INTEGRAL_KII) != 0 ||
     721          95 :         _integrals.count(INTERACTION_INTEGRAL_KIII) != 0 ||
     722          95 :         _integrals.count(INTERACTION_INTEGRAL_T) != 0)
     723             :     {
     724          62 :       if (_has_symmetry_plane && (_integrals.count(INTERACTION_INTEGRAL_KII) != 0 ||
     725          98 :                                   _integrals.count(INTERACTION_INTEGRAL_KIII) != 0))
     726           0 :         paramError("symmetry_plane",
     727             :                    "In DomainIntegral, symmetry_plane option cannot be used with mode-II or "
     728             :                    "mode-III interaction integral");
     729             : 
     730             :       std::string vpp_base_name;
     731          62 :       std::string vpp_type_name(ad_prepend + "InteractionIntegral");
     732             : 
     733          62 :       InputParameters params = _factory.getValidParams(vpp_type_name);
     734         124 :       if (!getParam<bool>("output_vpp"))
     735           0 :         params.set<std::vector<OutputName>>("outputs") = {"none"};
     736             : 
     737          62 :       if (_use_crack_front_points_provider && _used_by_xfem_to_grow_crack)
     738           0 :         params.set<ExecFlagEnum>("execute_on") = {EXEC_TIMESTEP_END, EXEC_NONLINEAR};
     739             :       else
     740         186 :         params.set<ExecFlagEnum>("execute_on") = {EXEC_TIMESTEP_END};
     741             : 
     742         133 :       if (isParamValid("additional_eigenstrain_00") && isParamValid("additional_eigenstrain_01") &&
     743          77 :           isParamValid("additional_eigenstrain_11") && isParamValid("additional_eigenstrain_22"))
     744             :       {
     745           6 :         params.set<CoupledName>("additional_eigenstrain_00") =
     746           6 :             getParam<CoupledName>("additional_eigenstrain_00");
     747           6 :         params.set<CoupledName>("additional_eigenstrain_01") =
     748           6 :             getParam<CoupledName>("additional_eigenstrain_01");
     749           6 :         params.set<CoupledName>("additional_eigenstrain_11") =
     750           6 :             getParam<CoupledName>("additional_eigenstrain_11");
     751           6 :         params.set<CoupledName>("additional_eigenstrain_22") =
     752           9 :             getParam<CoupledName>("additional_eigenstrain_22");
     753             :       }
     754             : 
     755         124 :       params.set<UserObjectName>("crack_front_definition") = uo_name;
     756          62 :       params.set<bool>("use_displaced_mesh") = _use_displaced_mesh;
     757          62 :       params.set<std::vector<SubdomainName>>("block") = {_blocks};
     758             : 
     759          62 :       if (_has_symmetry_plane)
     760          36 :         params.set<unsigned int>("symmetry_plane") = _symmetry_plane;
     761             : 
     762          62 :       if (_fgm_crack)
     763             :       {
     764           6 :         params.set<MaterialPropertyName>(
     765             :             "functionally_graded_youngs_modulus_crack_dir_gradient") = {
     766             :             _functionally_graded_youngs_modulus_crack_dir_gradient};
     767          12 :         params.set<MaterialPropertyName>("functionally_graded_youngs_modulus") = {
     768             :             _functionally_graded_youngs_modulus};
     769             :       }
     770             : 
     771          62 :       params.set<Real>("poissons_ratio") = _poissons_ratio;
     772          62 :       params.set<Real>("youngs_modulus") = _youngs_modulus;
     773          62 :       params.set<std::vector<VariableName>>("displacements") = _displacements;
     774          62 :       if (_temp != "")
     775          18 :         params.set<std::vector<VariableName>>("temperature") = {_temp};
     776             : 
     777         124 :       if (parameters().isParamValid("eigenstrain_gradient"))
     778           3 :         params.set<MaterialPropertyName>("eigenstrain_gradient") =
     779           6 :             parameters().get<MaterialPropertyName>("eigenstrain_gradient");
     780         124 :       if (parameters().isParamValid("body_force"))
     781           3 :         params.set<MaterialPropertyName>("body_force") =
     782           6 :             parameters().get<MaterialPropertyName>("body_force");
     783             : 
     784         209 :       for (std::set<INTEGRAL>::iterator sit = _integrals.begin(); sit != _integrals.end(); ++sit)
     785             :       {
     786         147 :         switch (*sit)
     787             :         {
     788          18 :           case J_INTEGRAL:
     789          18 :             continue;
     790             : 
     791           3 :           case C_INTEGRAL:
     792           3 :             continue;
     793             : 
     794           3 :           case K_FROM_J_INTEGRAL:
     795           3 :             continue;
     796             : 
     797             :           case INTERACTION_INTEGRAL_KI:
     798             :             vpp_base_name = "II_KI";
     799          62 :             params.set<Real>("K_factor") =
     800          62 :                 0.5 * _youngs_modulus / (1.0 - std::pow(_poissons_ratio, 2.0));
     801         124 :             params.set<MooseEnum>("sif_mode") = "KI";
     802          62 :             break;
     803             : 
     804             :           case INTERACTION_INTEGRAL_KII:
     805             :             vpp_base_name = "II_KII";
     806          26 :             params.set<Real>("K_factor") =
     807          26 :                 0.5 * _youngs_modulus / (1.0 - std::pow(_poissons_ratio, 2.0));
     808          52 :             params.set<MooseEnum>("sif_mode") = "KII";
     809          26 :             break;
     810             : 
     811             :           case INTERACTION_INTEGRAL_KIII:
     812             :             vpp_base_name = "II_KIII";
     813          26 :             params.set<Real>("K_factor") = 0.5 * _youngs_modulus / (1.0 + _poissons_ratio);
     814          52 :             params.set<MooseEnum>("sif_mode") = "KIII";
     815          26 :             break;
     816             : 
     817             :           case INTERACTION_INTEGRAL_T:
     818             :             vpp_base_name = "II_T";
     819           9 :             params.set<Real>("K_factor") = _youngs_modulus / (1 - std::pow(_poissons_ratio, 2));
     820          18 :             params.set<MooseEnum>("sif_mode") = "T";
     821           9 :             break;
     822             :         }
     823         123 :         if (_treat_as_2d && _use_crack_front_points_provider == false)
     824             :           vpp_base_name += "_2DVPP";
     825         543 :         for (unsigned int ring_index = 0; ring_index < _ring_vec.size(); ++ring_index)
     826             :         {
     827         420 :           params.set<unsigned int>("ring_index") = _ring_vec[ring_index];
     828         840 :           params.set<MooseEnum>("q_function_type") = _q_function_type;
     829             : 
     830         840 :           std::string vpp_name = vpp_base_name + "_" + Moose::stringify(_ring_vec[ring_index]);
     831         420 :           _problem->addVectorPostprocessor(vpp_type_name, vpp_name, params);
     832             :         }
     833             :       }
     834          62 :     }
     835             : 
     836         157 :     if (_get_equivalent_k)
     837             :     {
     838          26 :       std::string vpp_base_name("Keq");
     839          26 :       if (_treat_as_2d && _use_crack_front_points_provider == false)
     840             :         vpp_base_name += "_2DVPP";
     841          26 :       const std::string vpp_type_name("MixedModeEquivalentK");
     842          26 :       InputParameters params = _factory.getValidParams(vpp_type_name);
     843          26 :       params.set<ExecFlagEnum>("execute_on") = EXEC_TIMESTEP_END;
     844          26 :       params.set<Real>("poissons_ratio") = _poissons_ratio;
     845             : 
     846         114 :       for (unsigned int ring_index = 0; ring_index < _ring_vec.size(); ++ring_index)
     847             :       {
     848          88 :         std::string ki_name = "II_KI_";
     849          88 :         std::string kii_name = "II_KII_";
     850          88 :         std::string kiii_name = "II_KIII_";
     851          88 :         params.set<unsigned int>("ring_index") = _ring_vec[ring_index];
     852          88 :         if (_treat_as_2d && _use_crack_front_points_provider == false)
     853             :         {
     854         120 :           params.set<VectorPostprocessorName>("KI_vectorpostprocessor") =
     855         120 :               ki_name + "2DVPP_" + Moose::stringify(_ring_vec[ring_index]);
     856         120 :           params.set<VectorPostprocessorName>("KII_vectorpostprocessor") =
     857         120 :               kii_name + "2DVPP_" + Moose::stringify(_ring_vec[ring_index]);
     858         120 :           params.set<VectorPostprocessorName>("KIII_vectorpostprocessor") =
     859         120 :               kiii_name + "2DVPP_" + Moose::stringify(_ring_vec[ring_index]);
     860             :         }
     861             :         else
     862             :         {
     863          56 :           params.set<VectorPostprocessorName>("KI_vectorpostprocessor") =
     864          56 :               ki_name + Moose::stringify(_ring_vec[ring_index]);
     865          56 :           params.set<VectorPostprocessorName>("KII_vectorpostprocessor") =
     866          56 :               kii_name + Moose::stringify(_ring_vec[ring_index]);
     867          56 :           params.set<VectorPostprocessorName>("KIII_vectorpostprocessor") =
     868          56 :               kiii_name + Moose::stringify(_ring_vec[ring_index]);
     869             :         }
     870         176 :         params.set<std::string>("KI_vector_name") =
     871         264 :             ki_name + Moose::stringify(_ring_vec[ring_index]);
     872         176 :         params.set<std::string>("KII_vector_name") =
     873         264 :             kii_name + Moose::stringify(_ring_vec[ring_index]);
     874         176 :         params.set<std::string>("KIII_vector_name") =
     875         264 :             kiii_name + Moose::stringify(_ring_vec[ring_index]);
     876         176 :         std::string vpp_name = vpp_base_name + "_" + Moose::stringify(_ring_vec[ring_index]);
     877          88 :         _problem->addVectorPostprocessor(vpp_type_name, vpp_name, params);
     878             :       }
     879          26 :     }
     880             : 
     881         157 :     if (!_treat_as_2d || _use_crack_front_points_provider == true)
     882             :     {
     883          78 :       for (unsigned int i = 0; i < _output_variables.size(); ++i)
     884             :       {
     885          18 :         const std::string vpp_type_name("VectorOfPostprocessors");
     886          18 :         InputParameters params = _factory.getValidParams(vpp_type_name);
     887          18 :         params.set<ExecFlagEnum>("execute_on") = EXEC_TIMESTEP_END;
     888          18 :         std::ostringstream vpp_name_stream;
     889          18 :         vpp_name_stream << _output_variables[i] << "_crack";
     890             :         std::vector<PostprocessorName> postprocessor_names;
     891          72 :         for (unsigned int cfp_index = 0; cfp_index < num_crack_front_points; ++cfp_index)
     892             :         {
     893          54 :           std::ostringstream pp_name_stream;
     894         108 :           pp_name_stream << vpp_name_stream.str() << "_" << cfp_index + 1;
     895          54 :           postprocessor_names.push_back(pp_name_stream.str());
     896          54 :         }
     897          18 :         params.set<std::vector<PostprocessorName>>("postprocessors") = postprocessor_names;
     898          18 :         _problem->addVectorPostprocessor(vpp_type_name, vpp_name_stream.str(), params);
     899          18 :       }
     900             :     }
     901             :   }
     902             : 
     903         301 :   else if (_current_task == "add_material")
     904             :   {
     905         157 :     if (_temp != "")
     906             :     {
     907             :       std::string mater_name;
     908          18 :       const std::string mater_type_name("ThermalFractureIntegral");
     909             :       mater_name = "ThermalFractureIntegral";
     910             : 
     911          18 :       InputParameters params = _factory.getValidParams(mater_type_name);
     912          36 :       params.set<std::vector<MaterialPropertyName>>("eigenstrain_names") =
     913          54 :           getParam<std::vector<MaterialPropertyName>>("eigenstrain_names");
     914          54 :       params.set<std::vector<VariableName>>("temperature") = {_temp};
     915          18 :       params.set<std::vector<SubdomainName>>("block") = {_blocks};
     916          18 :       _problem->addMaterial(mater_type_name, mater_name, params);
     917          18 :     }
     918         471 :     MultiMooseEnum integral_moose_enums = getParam<MultiMooseEnum>("integrals");
     919             :     bool have_j_integral = false;
     920             :     bool have_c_integral = false;
     921             : 
     922         399 :     for (auto ime : integral_moose_enums)
     923             :     {
     924         497 :       if (ime == "JIntegral" || ime == "CIntegral" || ime == "KFromJIntegral" ||
     925         219 :           ime == "InteractionIntegralKI" || ime == "InteractionIntegralKII" ||
     926         286 :           ime == "InteractionIntegralKIII" || ime == "InteractionIntegralT")
     927             :         have_j_integral = true;
     928             : 
     929         242 :       if (ime == "CIntegral")
     930             :         have_c_integral = true;
     931             :     }
     932         157 :     if (have_j_integral)
     933             :     {
     934             :       std::string mater_name;
     935         157 :       const std::string mater_type_name(ad_prepend + "StrainEnergyDensity");
     936         157 :       mater_name = ad_prepend + "StrainEnergyDensity";
     937             : 
     938         157 :       InputParameters params = _factory.getValidParams(mater_type_name);
     939         314 :       _incremental = getParam<bool>("incremental");
     940         157 :       params.set<bool>("incremental") = _incremental;
     941         157 :       params.set<std::vector<SubdomainName>>("block") = {_blocks};
     942         157 :       _problem->addMaterial(mater_type_name, mater_name, params);
     943             : 
     944             :       {
     945             :         std::string mater_name;
     946         157 :         const std::string mater_type_name(ad_prepend + "EshelbyTensor");
     947         157 :         mater_name = ad_prepend + "EshelbyTensor";
     948             : 
     949         157 :         InputParameters params = _factory.getValidParams(mater_type_name);
     950         314 :         _displacements = getParam<std::vector<VariableName>>("displacements");
     951         157 :         params.set<std::vector<VariableName>>("displacements") = _displacements;
     952         157 :         params.set<std::vector<SubdomainName>>("block") = {_blocks};
     953             : 
     954         157 :         if (have_c_integral)
     955           6 :           params.set<bool>("compute_dissipation") = true;
     956             : 
     957         157 :         if (_temp != "")
     958          54 :           params.set<std::vector<VariableName>>("temperature") = {_temp};
     959             : 
     960         157 :         _problem->addMaterial(mater_type_name, mater_name, params);
     961         157 :       }
     962             :       // Strain energy rate density needed for C(t)/C* integral
     963         157 :       if (have_c_integral)
     964             :       {
     965             :         std::string mater_name;
     966           6 :         const std::string mater_type_name(ad_prepend + "StrainEnergyRateDensity");
     967           6 :         mater_name = ad_prepend + "StrainEnergyRateDensity";
     968             : 
     969           6 :         InputParameters params = _factory.getValidParams(mater_type_name);
     970           6 :         params.set<std::vector<SubdomainName>>("block") = {_blocks};
     971          12 :         params.set<std::vector<MaterialName>>("inelastic_models") =
     972          12 :             getParam<std::vector<MaterialName>>("inelastic_models");
     973             : 
     974           6 :         _problem->addMaterial(mater_type_name, mater_name, params);
     975           6 :       }
     976         157 :     }
     977         157 :   }
     978        1246 : }
     979             : 
     980             : unsigned int
     981         942 : DomainIntegralAction::calcNumCrackFrontPoints()
     982             : {
     983             :   unsigned int num_points = 0;
     984         942 :   if (_boundary_names.size() != 0)
     985             :   {
     986         858 :     std::vector<BoundaryID> bids = _mesh->getBoundaryIDs(_boundary_names, true);
     987             :     std::set<unsigned int> nodes;
     988             : 
     989         858 :     ConstBndNodeRange & bnd_nodes = *_mesh->getBoundaryNodeRange();
     990       92376 :     for (ConstBndNodeRange::const_iterator nd = bnd_nodes.begin(); nd != bnd_nodes.end(); ++nd)
     991             :     {
     992       91518 :       const BndNode * bnode = *nd;
     993       91518 :       BoundaryID boundary_id = bnode->_bnd_id;
     994             : 
     995      181224 :       for (unsigned int ibid = 0; ibid < bids.size(); ++ibid)
     996             :       {
     997       91518 :         if (boundary_id == bids[ibid])
     998             :         {
     999        1812 :           nodes.insert(bnode->_node->id());
    1000        1812 :           break;
    1001             :         }
    1002             :       }
    1003             :     }
    1004         858 :     num_points = nodes.size();
    1005             :   }
    1006          84 :   else if (_crack_front_points.size() != 0)
    1007          84 :     num_points = _crack_front_points.size();
    1008           0 :   else if (_use_crack_front_points_provider)
    1009           0 :     num_points = getParam<unsigned int>("number_points_from_provider");
    1010             :   else
    1011           0 :     mooseError("Must define either 'boundary' or 'crack_front_points'");
    1012         942 :   return num_points;
    1013             : }
    1014             : 
    1015             : void
    1016        2826 : DomainIntegralAction::addRelationshipManagers(Moose::RelationshipManagerType input_rm_type)
    1017             : {
    1018        2826 :   if (_integrals.count(INTERACTION_INTEGRAL_T) != 0)
    1019             :   {
    1020         162 :     InputParameters params = _factory.getValidParams("CrackFrontDefinition");
    1021         162 :     addRelationshipManagers(input_rm_type, params);
    1022         162 :   }
    1023        2826 : }

Generated by: LCOV version 1.14