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 "QuasiStaticSolidMechanicsPhysicsBase.h" 13 : #include "libmesh/point.h" 14 : 15 : class QuasiStaticSolidMechanicsPhysics : public QuasiStaticSolidMechanicsPhysicsBase 16 : { 17 : public: 18 : static InputParameters validParams(); 19 : 20 : QuasiStaticSolidMechanicsPhysics(const InputParameters & params); 21 : 22 : virtual void act(); 23 : 24 : protected: 25 : void actSubdomainChecks(); 26 : void actOutputGeneration(); 27 : void actEigenstrainNames(); 28 : void actOutputMatProp(); 29 : void actGatherActionParameters(); 30 : void verifyOrderAndFamilyOutputs(); 31 : void actLagrangianKernelStrain(); 32 : void actStressDivergenceTensorsStrain(); 33 : 34 : virtual std::string getKernelType(); 35 : virtual InputParameters getKernelParameters(std::string type); 36 : 37 : /** 38 : * Helper function to decode `generate_outputs` options using a "table" of 39 : * scalar output quantities and a "setup" lambda that performs the input parameter 40 : * setup for the output material object. 41 : */ 42 : template <typename T, typename T2> 43 : bool setupOutput(std::string out, T table, T2 setup); 44 : 45 : ///@{ displacement variables 46 : std::vector<VariableName> _displacements; 47 : 48 : /// Number of displacement variables 49 : unsigned int _ndisp; 50 : 51 : /// Coupled displacement variables 52 : std::vector<VariableName> _coupled_displacements; 53 : ///@} 54 : 55 : ///@{ residual debugging 56 : std::vector<AuxVariableName> _save_in; 57 : std::vector<AuxVariableName> _diag_save_in; 58 : ///@} 59 : 60 : Moose::CoordinateSystemType _coord_system; 61 : 62 : /// if this vector is not empty the variables, kernels and materials are restricted to these subdomains 63 : std::vector<SubdomainName> _subdomain_names; 64 : 65 : /// set generated from the passed in vector of subdomain names 66 : std::set<SubdomainID> _subdomain_ids; 67 : 68 : /// set generated from the combined block restrictions of all SolidMechanics/Master action blocks 69 : std::set<SubdomainID> _subdomain_id_union; 70 : 71 : /// strain formulation 72 : enum class Strain 73 : { 74 : Small, 75 : Finite 76 : } _strain; 77 : 78 : /// strain formulation 79 : enum class StrainAndIncrement 80 : { 81 : SmallTotal, 82 : FiniteTotal, 83 : SmallIncremental, 84 : FiniteIncremental 85 : } _strain_and_increment; 86 : 87 : /// use an out of plane stress/strain formulation 88 : enum class PlanarFormulation 89 : { 90 : None, 91 : WeakPlaneStress, 92 : PlaneStrain, 93 : GeneralizedPlaneStrain, 94 : } _planar_formulation; 95 : 96 : enum class OutOfPlaneDirection 97 : { 98 : x, 99 : y, 100 : z 101 : }; 102 : 103 : const OutOfPlaneDirection _out_of_plane_direction; 104 : 105 : /// base name for the current master action block 106 : const std::string _base_name; 107 : 108 : /// use displaced mesh (true unless _strain is SMALL) 109 : bool _use_displaced_mesh; 110 : 111 : /// output materials to generate scalar stress/strain tensor quantities 112 : std::vector<std::string> _generate_output; 113 : MultiMooseEnum _material_output_order; 114 : MultiMooseEnum _material_output_family; 115 : 116 : /// booleans used to determine if cylindrical axis points are passed 117 : bool _cylindrical_axis_point1_valid; 118 : bool _cylindrical_axis_point2_valid; 119 : bool _direction_valid; 120 : bool _verbose; 121 : 122 : /// points used to determine axis of rotation for cylindrical stress/strain quantities 123 : Point _cylindrical_axis_point1; 124 : Point _cylindrical_axis_point2; 125 : Point _direction; 126 : 127 : /// booleans used to determine if spherical center point is passed 128 : bool _spherical_center_point_valid; 129 : 130 : /// center point for spherical stress/strain quantities 131 : Point _spherical_center_point; 132 : 133 : /// automatically gather names of eigenstrain tensors provided by simulation objects 134 : const bool _auto_eigenstrain; 135 : 136 : std::vector<MaterialPropertyName> _eigenstrain_names; 137 : 138 : /// New or old kernel system 139 : const bool _lagrangian_kernels; 140 : 141 : /// Simplified flag for small/large deformations, Lagrangian kernel system 142 : const bool _lk_large_kinematics; 143 : 144 : /// New kernel system kinematics types 145 : enum class LKFormulation 146 : { 147 : Total, 148 : Updated 149 : }; 150 : const LKFormulation _lk_formulation; 151 : 152 : /// Simplified volumetric locking correction flag for new kernels 153 : bool _lk_locking; 154 : 155 : /// Flag indicating if the homogenization system is present for new kernels 156 : bool _lk_homogenization; 157 : 158 : // Helper to translate into MOOSE talk 159 : static const std::map<unsigned int, std::string> _order_mapper; 160 : // Name of the homogenization scalar variable 161 : const std::string _hname = "hvar"; 162 : // Name of the integrator 163 : const std::string _integrator_name = "integrator"; 164 : // Name of the homogenization strain 165 : const std::string _homogenization_strain_name = "homogenization_gradient"; 166 : // Other homogenization info 167 : MultiMooseEnum _constraint_types; 168 : std::vector<FunctionName> _targets; 169 : }; 170 : 171 : template <typename T, typename T2> 172 : bool 173 3488 : QuasiStaticSolidMechanicsPhysics::setupOutput(std::string out, T table, T2 setup) 174 : { 175 21092 : for (const auto & t1 : table) 176 : { 177 : // find the officially supported properties 178 109022 : for (const auto & t2 : t1.second.second) 179 182824 : if (t1.first + '_' + t2 == out) 180 : { 181 : const auto it = _rank_two_cartesian_component_table.find(t2); 182 1630 : if (it != _rank_two_cartesian_component_table.end()) 183 : { 184 3260 : setup(it->second, t1.second.first); 185 : return true; 186 : } 187 : else 188 0 : mooseError("Internal error. The permitted tensor shortcuts must be keys in the " 189 : "'_rank_two_cartesian_component_table'."); 190 : } 191 : 192 : // check for custom properties 193 17610 : auto prefix = t1.first + '_'; 194 17610 : if (out.substr(0, prefix.length()) == prefix) 195 : { 196 12 : setup(out.substr(prefix.length()), t1.second.first); 197 : return true; 198 : } 199 : } 200 : 201 : return false; 202 : }