28 params.
addClassDescription(
"Action to create an instance of the cohesive zone model kernel for " 29 "each displacement component");
31 "boundary",
"The list of boundary IDs from the mesh where the cohesive zone will be applied");
37 _displacements(getParam<
std::vector<VariableName>>(
"displacements")),
38 _ndisp(_displacements.size()),
39 _use_AD(getParam<bool>(
"use_automatic_differentiation")),
40 _base_name(isParamValid(
"base_name") && !getParam<
std::string>(
"base_name").empty()
41 ? getParam<
std::string>(
"base_name")
43 _boundary(getParam<
std::vector<BoundaryName>>(
"boundary")),
45 _save_in_primary(getParam<
std::vector<AuxVariableName>>(
"save_in_primary")),
46 _diag_save_in_primary(getParam<
std::vector<AuxVariableName>>(
"diag_save_in_primary")),
47 _save_in_secondary(getParam<
std::vector<AuxVariableName>>(
"save_in_secondary")),
48 _diag_save_in_secondary(getParam<
std::vector<AuxVariableName>>(
"diag_save_in_secondary")),
49 _material_output_order(getParam<
MultiMooseEnum>(
"material_output_order")),
50 _material_output_family(getParam<
MultiMooseEnum>(
"material_output_family")),
51 _verbose(getParam<bool>(
"verbose"))
56 mooseError(
"the CZM Action requires 1, 2 or 3 displacement variables.");
63 _use_AD ?
"ADCZMInterfaceKernelSmallStrain" :
"CZMInterfaceKernelSmallStrain";
65 :
"CZMComputeDisplacementJumpSmallStrain";
67 _use_AD ?
"ADCZMComputeGlobalTractionSmallStrain" :
"CZMComputeGlobalTractionSmallStrain";
73 _use_AD ?
"ADCZMInterfaceKernelTotalLagrangian" :
"CZMInterfaceKernelTotalLagrangian";
75 :
"CZMComputeDisplacementJumpTotalLagrangian";
77 :
"CZMComputeGlobalTractionTotalLagrangian";
81 mooseError(
"CohesiveZoneAction Error: Invalid kinematic parameter. Allowed values are: " 82 "SmallStrain or TotalLagrangian");
87 "Number of save_in_primary variables should equal to the number of displacement variables ",
91 "Number of diag_save_in_primary variables should equal to the number of displacement " 95 mooseError(
"Number of save_in_secondary variables should equal to the number of displacement " 101 "Number of diag_save_in_secondary variables should equal to the number of displacement " 106 for (
const auto &
out : getParam<MultiMooseEnum>(
"generate_output"))
108 std::string lower(
out);
109 std::transform(lower.begin(), lower.end(), lower.begin(), ::tolower);
120 for (
unsigned int i = 0; i <
_ndisp; ++i)
127 paramsk.
set<
unsigned int>(
"component") = i;
131 paramsk.
set<std::vector<BoundaryName>>(
"boundary") =
_boundary;
134 std::string save_in_side;
135 std::vector<AuxVariableName> save_in_var_names;
139 paramsk.
set<std::vector<AuxVariableName>>(
"save_in") = save_in_var_names;
146 paramsk.
set<std::vector<AuxVariableName>>(
"diag_save_in") = save_in_var_names;
159 paramsm.
set<std::vector<BoundaryName>>(
"boundary") =
_boundary;
168 paramsm.
set<std::vector<BoundaryName>>(
"boundary") =
_boundary;
180 paramError(
"displacements",
"Number of displacements must match problem dimension.");
202 std::string & save_in_side,
203 const std::vector<AuxVariableName> & var_name_primary,
204 const std::vector<AuxVariableName> & var_name_secondary,
207 save_in_names.clear();
208 save_in_side.clear();
209 if (var_name_primary.size() ==
_ndisp)
211 save_in_names.push_back(var_name_primary[i]);
213 if (var_name_secondary.size() ==
_ndisp)
216 if (var_name_secondary.size() ==
_ndisp)
218 save_in_names.push_back(var_name_secondary[i]);
231 "The number of orders assigned to material outputs must be: 0 to be assigned " 232 "CONSTANT; 1 to assign all outputs the same value, or the same size as the number " 233 "of generate outputs listed.");
238 "The number of families assigned to material outputs must be: 0 to be assigned " 239 "MONOMIAL; 1 to assign all outputs the same value, or the same size as the number " 240 "of generate outputs listed.");
252 Moose::out << COLOR_CYAN <<
"*** Automatic applied material output orders ***" 267 Moose::out << COLOR_CYAN <<
"*** Automatic applied material output families ***" 282 unsigned int index = 0;
288 std::string
type = (order ==
"CONSTANT" && family ==
"MONOMIAL")
289 ?
"MooseVariableConstMonomial" 295 params.set<
MooseEnum>(
"family") = family;
296 if (family ==
"MONOMIAL")
308 const std::string material_output_aux_name =
_use_AD ?
"ADMaterialRealAux" :
"MaterialRealAux";
310 unsigned int index = 0;
319 params.
set<std::vector<BoundaryName>>(
"boundary") =
_boundary;
320 params.
set<
bool>(
"check_boundary_restricted") =
false;
343 for (
unsigned int a = 0;
a < 3; ++
a)
346 auto type = _use_AD ?
"ADCZMRealVectorCartesianComponent" 347 :
"CZMRealVectorCartesianComponent";
348 params = _factory.getValidParams(type);
349 params.set<std::string>(
"real_vector_value") = vq.second;
350 params.set<unsigned int>(
"index") = a;
351 params.set<std::vector<BoundaryName>>(
"boundary") = _boundary;
352 params.set<MaterialPropertyName>(
"property_name") = addBaseName(out);
353 params.set<std::string>(
"base_name") = _base_name;
354 _problem->addInterfaceMaterial(type, addBaseName(out) +
'_' + name(), params);
364 [&](std::string prop_name, std::string direction)
366 auto type =
_use_AD ?
"ADCZMRealVectorScalar" :
"CZMRealVectorScalar";
368 params.
set<std::string>(
"real_vector_value") = prop_name;
371 params.
set<std::vector<BoundaryName>>(
"boundary") =
_boundary;
378 mooseError(
"CZM Master: unable to add output Material");
391 for (
const auto & action : actions)
394 const auto added_size = action->_boundary.size();
397 if (size_after != size_before + added_size)
398 mooseError(
"The boundary restrictions in the CohesiveZoneAction actions must be " 402 for (
const auto & action : actions)
409 mooseError(
"All blocks of the CohesiveZoneAction should have the same strain formulation");
std::string _equilibrium_traction_calculator_name
std::vector< AuxVariableName > _save_in_secondary
static InputParameters validParams()
const std::string & _name
void paramError(const std::string ¶m, Args... args) const
MultiMooseEnum _material_output_family
void chekMultipleActionParameters()
method checking multiple CohesiveZoneAction block inputs
registerMooseAction("SolidMechanicsApp", CohesiveZoneAction, "add_interface_kernel")
static const std::vector< char > _component_table
void setAdditionalValue(const std::string &names)
std::vector< AuxVariableName > _diag_save_in_primary
std::vector< AuxVariableName > _save_in_primary
residual debugging
InputParameters getValidParams(const std::string &name) const
void addRequiredCZMInterfaceMaterials()
adds the required interface materials based on the selected strain formulation
unsigned int size() const
std::string _disp_jump_provider_name
std::vector< AuxVariableName > _diag_save_in_secondary
const ExecFlagType EXEC_TIMESTEP_END
std::vector< std::string > _generate_output
output materials to generate scalar traction/jump vector quantities
void prepareSaveInInputs(std::vector< AuxVariableName > &, std::string &, const std::vector< AuxVariableName > &, const std::vector< AuxVariableName > &, const int &) const
method to prepare save_in and diag_save_in inputs for the interface kernel
const std::string _base_name
Base name of the material system.
MultiMooseEnum _material_output_order
const bool _verbose
display info
static const std::map< std::string, std::string > _real_vector_cartesian_component_table
table data for output generation
static InputParameters validParams()
const std::string & name() const
void addRequiredCZMInterfaceKernels()
adds the required interfacekernels based on the selected strain formulation
std::vector< VariableName > _displacements
the disaplcements varaible names
const std::string & type() const
const std::string & _current_task
const unsigned int _ndisp
number of displacement components
std::string stringify(const T &t)
std::set< Strain > _strain_formulation_union
set generated from the combined boundary restrictions of all CohesiveZoneAction action blocks ...
void actOutputGeneration()
std::string addBaseName(const std::string &name) const
simple method for adding the base name to a variable
std::shared_ptr< MooseMesh > & _mesh
virtual void addRelationshipManagers(Moose::RelationshipManagerType input_rm_type) override
std::set< BoundaryName > _boundary_name_union
set generated from the combined boundary restrictions of all CohesiveZoneAction action blocks ...
void verifyOrderAndFamilyOutputs()
verifies order and family of output variables
void mooseError(Args &&... args) const
std::shared_ptr< FEProblemBase > & _problem
CohesiveZoneAction(const InputParameters ¶ms)
std::string _czm_kernel_name
kernel's and materials's names
std::vector< const T *> getActions()
const bool _use_AD
whether to use AD kernels and materials
enum CohesiveZoneAction::Strain _strain
const std::vector< BoundaryName > _boundary
Base name of the material system.
static const std::map< std::string, std::pair< std::string, std::vector< std::string > > > _vector_direction_table
bool setupOutput(std::string out, T table, T2 setup)