Line data Source code
1 : //* This file is part of the MOOSE framework 2 : //* https://mooseframework.inl.gov 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 : #pragma once 11 : 12 : #include "CohesiveZoneActionBase.h" 13 : 14 : class CohesiveZoneAction : public CohesiveZoneActionBase 15 : { 16 : public: 17 : static InputParameters validParams(); 18 : CohesiveZoneAction(const InputParameters & params); 19 : 20 : /// Method adding the proper relationship manager 21 : using Action::addRelationshipManagers; 22 : virtual void addRelationshipManagers(Moose::RelationshipManagerType input_rm_type) override; 23 : 24 : void act() override; 25 : 26 : protected: 27 : void actOutputGeneration(); 28 : void actOutputMatProp(); 29 : 30 : /// adds the required interfacekernels based on the selected strain formulation 31 : void addRequiredCZMInterfaceKernels(); 32 : 33 : /// adds the required interface materials based on the selected strain formulation 34 : void addRequiredCZMInterfaceMaterials(); 35 : 36 : /// verifies order and family of output variables 37 : void verifyOrderAndFamilyOutputs(); 38 : 39 : /// method to prepare save_in and diag_save_in inputs for the interface kernel 40 : void prepareSaveInInputs(std::vector<AuxVariableName> & /*save_in_names*/, 41 : std::string & /*save_in_side*/, 42 : const std::vector<AuxVariableName> & /*var_name_master*/, 43 : const std::vector<AuxVariableName> & /*var_name_slave*/, 44 : const int & /*i*/) const; 45 : 46 : /// method checking multiple CohesiveZoneAction block inputs 47 : void chekMultipleActionParameters(); 48 : 49 : template <typename T, typename T2> 50 : bool setupOutput(std::string out, T table, T2 setup); 51 : 52 : /// the disaplcements varaible names 53 : std::vector<VariableName> _displacements; 54 : 55 : /// number of displacement components 56 : const unsigned int _ndisp; 57 : 58 : /// whether to use AD kernels and materials 59 : const bool _use_AD; 60 : 61 : /// Base name of the material system 62 : const std::string _base_name; 63 : 64 : /// Base name of the material system 65 : const std::vector<BoundaryName> _boundary; 66 : 67 : /// strain formulation 68 : enum class Strain 69 : { 70 : Small, 71 : Finite 72 : } _strain; 73 : 74 : ///@{ residual debugging 75 : std::vector<AuxVariableName> _save_in_master; 76 : std::vector<AuxVariableName> _diag_save_in_master; 77 : std::vector<AuxVariableName> _save_in_slave; 78 : std::vector<AuxVariableName> _diag_save_in_slave; 79 : ///@} 80 : 81 : /// kernel's and materials's names 82 : ///@{ 83 : std::string _czm_kernel_name; 84 : std::string _disp_jump_provider_name; 85 : std::string _equilibrium_traction_calculator_name; 86 : ///@} 87 : 88 : /// output materials to generate scalar traction/jump vector quantities 89 : std::vector<std::string> _generate_output; 90 : MultiMooseEnum _material_output_order; 91 : MultiMooseEnum _material_output_family; 92 : 93 : /// set generated from the combined boundary restrictions of all CohesiveZoneAction action blocks 94 : std::set<BoundaryName> _boundary_name_union; 95 : 96 : /// set generated from the combined boundary restrictions of all CohesiveZoneAction action blocks 97 : std::set<Strain> _strain_formulation_union; 98 : 99 : /// display info 100 : const bool _verbose; 101 : 102 : /// simple method for adding the base name to a variable 103 6984 : std::string addBaseName(const std::string & name) const 104 : { 105 8280 : return _base_name.empty() ? name : _base_name + "_" + name; 106 : } 107 : }; 108 : 109 : template <typename T, typename T2> 110 : bool 111 456 : CohesiveZoneAction::setupOutput(std::string out, T table, T2 setup) 112 : { 113 684 : for (const auto & t1 : table) 114 : { 115 : // find the officially supported properties 116 1368 : for (const auto & t2 : t1.second.second) 117 2280 : if (t1.first + '_' + t2 == out) 118 : { 119 : const auto it = _real_vector_cartesian_component_table.find(t2); 120 456 : if (it != _real_vector_cartesian_component_table.end()) 121 : { 122 912 : setup(it->second, t1.second.first); 123 : return true; 124 : } 125 : else 126 0 : mooseError("Internal error. The permitted vector shortcuts must be keys in the " 127 : "'_real_vector_cartesian_component_table'."); 128 : } 129 : 130 : // check for custom properties 131 228 : auto prefix = t1.first + '_'; 132 228 : if (out.substr(0, prefix.length()) == prefix) 133 : { 134 0 : setup(out.substr(prefix.length()), t1.second.first); 135 : return true; 136 : } 137 : } 138 : 139 : return false; 140 : }