diff --git a/modules/peridynamics/doc/content/modules/peridynamics/DeformationGradients.md b/modules/peridynamics/doc/content/modules/peridynamics/DeformationGradients.md index d15a7922d8ad..d5680ab4750e 100644 --- a/modules/peridynamics/doc/content/modules/peridynamics/DeformationGradients.md +++ b/modules/peridynamics/doc/content/modules/peridynamics/DeformationGradients.md @@ -2,7 +2,7 @@ The deformation gradient is a fundamental measure of deformation in continuum mechanics. It maps line segments in a reference configuration into line segments (consisting of the same material points) in a deformed configuration. -It peridynamics theory, equivalent deformation gradients can be formulated using the weighted least squares numerical technique, given the fact that it is usually too many line segments connected at each individual material point. Base on the concept of weighted least squares technique, two types of deformation gradient can be formulated in a discretized peridynamics domain. +In peridynamic theory, equivalent deformation gradients can be formulated using the weighted least squares numerical technique, given the fact that it is usually too many line segments connected at each individual material point. Based on the concept of weighted least squares technique, two types of deformation gradient can be formulated in a discretized peridynamics domain. ## Deformation gradient in Continuum Mechanics @@ -28,7 +28,7 @@ Substituting above Taylor expansion into previous equation and assuming that $|d d\mathbf{x} \approx \frac{\partial \chi}{\partial \mathbf{X}}(\mathbf{X}) \cdot d\mathbf{X} \equiv \mathbf{F}(\mathbf{X}) \cdot d\mathbf{X} \end{equation} -The expression tends to exact as the differential $d\mathbf{X}$ goes to zero. +The expression tends to the exact solution as the differential $d\mathbf{X}$ goes to zero. The deformation gradient thus characterizes the deformation in the neighborhood of material point $\mathbf{X}$, mapping infinitesimal line segment $d\mathbf{X}$ emanating from $\mathbf{X}$ in the reference configuration to the infinitesimal line segment $d\mathbf{x}$ emanating from $\mathbf{x}$ in the deformed configuration. diff --git a/modules/peridynamics/include/auxkernels/BondStatusPD.h b/modules/peridynamics/include/auxkernels/BondStatusPD.h index 590219ca39d3..41d17b02b209 100644 --- a/modules/peridynamics/include/auxkernels/BondStatusPD.h +++ b/modules/peridynamics/include/auxkernels/BondStatusPD.h @@ -32,8 +32,15 @@ class BondStatusPD : public AuxKernelBasePD protected: virtual Real computeValue() override; - /// Option of which failure criterion to be used, with critical_stretch as default - MooseEnum _failure_criterion; + /// Enum class used to control which failure criterion to use + enum class FailureCriterion + { + CriticalStretch, + MaximumTensileStress + }; + + /// Enum used to control which failure criterion to use + const FailureCriterion _failure_criterion; /// Bond_status variable const MooseVariableFEBase & _bond_status_var; @@ -41,7 +48,10 @@ class BondStatusPD : public AuxKernelBasePD /// Critical AuxVariable const VariableValue & _critical_val; + /// Material property containing the mechanical stretch const MaterialProperty & _mechanical_stretch; + + /// Material property containing the stress const MaterialProperty * _stress; }; diff --git a/modules/peridynamics/include/auxkernels/MaxPrincipalStressNOSPD.h b/modules/peridynamics/include/auxkernels/MaxPrincipalStressNOSPD.h index 804963b33666..3b74aeb45899 100644 --- a/modules/peridynamics/include/auxkernels/MaxPrincipalStressNOSPD.h +++ b/modules/peridynamics/include/auxkernels/MaxPrincipalStressNOSPD.h @@ -29,9 +29,10 @@ class MaxPrincipalStressNOSPD : public AuxKernelBasePD protected: Real computeValue() override; - /// Bond_status variable + /// bond_status variable const MooseVariableFEBase & _bond_status_var; + /// Stress material property const MaterialProperty & _stress; }; diff --git a/modules/peridynamics/src/actions/GeneralizedPlaneStrainActionPD.C b/modules/peridynamics/src/actions/GeneralizedPlaneStrainActionPD.C index dc30f843d963..222aaf965161 100644 --- a/modules/peridynamics/src/actions/GeneralizedPlaneStrainActionPD.C +++ b/modules/peridynamics/src/actions/GeneralizedPlaneStrainActionPD.C @@ -43,12 +43,12 @@ validParams() params.addParam("factor", 1.0, "Scale factor applied to prescribed out-of-plane pressure"); params.addParam("full_jacobian", false, - "Parameter to set whether to use the nonlocal full jacobian formulation " - "for the scalar components or not"); + "Parameter to set whether to use the nonlocal full Jacobian formulation " + "for the scalar components"); params.addParam( "use_displaced_mesh", false, - "Parameter to set whether to use the displaced mesh for computation or not"); + "Parameter to set whether to use the displaced mesh for computation"); params.addParam>("block", "List of ids of the blocks (subdomains) that the " "GeneralizedPlaneStrainActionPD will be applied " @@ -85,18 +85,13 @@ GeneralizedPlaneStrainActionPD::act() if (_current_task == "add_kernel") { std::string k_type; - switch (_formulation) - { - case 0: + if (_formulation == "OrdinaryState") k_type = "GeneralizedPlaneStrainOffDiagOSPD"; // Based on ordinary state-based model - break; - case 1: - k_type = "GeneralizedPlaneStrainOffDiagNOSPD"; // Based on bond-associated non-rodinary - // state-based model - break; - default: - mooseError("Unsupported PD formulation. Choose from: OrdinaryState or NonOrdinaryState"); - } + else if (_formulation == "NonOrdinaryState") + k_type = "GeneralizedPlaneStrainOffDiagNOSPD"; // Based on bond-associated non-ordinary + // state-based model + else + paramError("formulation", "Unsupported peridynamic formulation. Choose from: OrdinaryState or NonOrdinaryState"); InputParameters params = _factory.getValidParams(k_type); @@ -144,17 +139,12 @@ GeneralizedPlaneStrainActionPD::act() else if (_current_task == "add_user_object") { std::string uo_type; - switch (_formulation) - { - case 0: - uo_type = "GeneralizedPlaneStrainUserObjectOSPD"; - break; - case 1: - uo_type = "GeneralizedPlaneStrainUserObjectNOSPD"; - break; - default: - mooseError("Unsupported PD formulation. Choose from: OrdinaryState or NonOrdinaryState"); - } + if (_formulation == "OrdinaryState") + uo_type = "GeneralizedPlaneStrainUserObjectOSPD"; + else if (_formulation == "NonOrdinaryState") + uo_type = "GeneralizedPlaneStrainUserObjectNOSPD"; + else + paramError("formulation", "Unsupported peridynamic formulation. Choose from: OrdinaryState or NonOrdinaryState"); InputParameters params = _factory.getValidParams(uo_type); diff --git a/modules/peridynamics/src/actions/MechanicsActionPD.C b/modules/peridynamics/src/actions/MechanicsActionPD.C index 00a7968a29ac..284be9eb2daa 100644 --- a/modules/peridynamics/src/actions/MechanicsActionPD.C +++ b/modules/peridynamics/src/actions/MechanicsActionPD.C @@ -128,8 +128,8 @@ MechanicsActionPD::act() else if (_current_task == "add_user_object") { // add ghosting UO - std::string uo_type = "GhostElemPD"; - std::string uo_name = "GhostElemPD"; + const std::string uo_type = "GhostElemPD"; + const std::string uo_name = "GhostElemPD"; InputParameters params = _factory.getValidParams(uo_type); params.set("use_displaced_mesh") = getParam("use_displaced_mesh"); @@ -138,12 +138,12 @@ MechanicsActionPD::act() } else if (_current_task == "add_kernel") { - std::string kernel_type = getKernelType(); + const std::string kernel_type = getKernelType(); InputParameters params = getKernelParameters(kernel_type); for (unsigned int i = 0; i < _ndisp; ++i) { - std::string kernel_name = "Peridynamics_" + Moose::stringify(i); + const std::string kernel_name = "Peridynamics_" + Moose::stringify(i); params.set("component") = i; params.set("variable") = _displacements[i]; @@ -165,38 +165,26 @@ MechanicsActionPD::getKernelType() { std::string type; - switch (_formulation) + if (_formulation == "Bond") + type = "MechanicsBPD"; + else if (_formulation == "OrdinaryState") + type = "MechanicsOSPD"; + else if (_formulation == "NonOrdinaryState") { - case 0: // bond based PD formulation - type = "MechanicsBPD"; - break; - - case 1: // ordinary state based PD formulation - type = "MechanicsOSPD"; - break; - - case 2: // non-ordinary state based PD formulation - switch (_stabilization) - { - case 0: // fictitious force-stabilized - type = "ForceStabilizedSmallStrainMechanicsNOSPD"; - break; - - case 1: // self-stabilized - if (_finite_strain_formulation) - type = "FiniteStrainMechanicsNOSPD"; - else - type = "SmallStrainMechanicsNOSPD"; - break; - - default: - mooseError("Unknown PD stabilization scheme. Choose from: Force Self"); - } - break; - - default: - mooseError("Unsupported PD formulation. Choose from: Bond OrdinaryState NonOrdinaryState"); + if (_stabilization == "Force") + type = "ForceStabilizedSmallStrainMechanicsNOSPD"; + else if (_stabilization == "Self") + { + if (_finite_strain_formulation) + type = "FiniteStrainMechanicsNOSPD"; + else + type = "SmallStrainMechanicsNOSPD"; + } + else + paramError("stabilization", "Unknown PD stabilization scheme. Choose from: Force Self"); } + else + paramError("formulation", "Unsupported peridynamic formulation. Choose from: Bond OrdinaryState NonOrdinaryState"); return type; } diff --git a/modules/peridynamics/src/auxkernels/BondStatusPD.C b/modules/peridynamics/src/auxkernels/BondStatusPD.C index 7be1c3afb6f9..a8a15b83ab70 100644 --- a/modules/peridynamics/src/auxkernels/BondStatusPD.C +++ b/modules/peridynamics/src/auxkernels/BondStatusPD.C @@ -20,7 +20,7 @@ validParams() params.addClassDescription("Class for updating the bond status based on different failure " "criteria: critical stretch and " "maximum principal stress"); - MooseEnum FailureCriteriaType("Critical_Stretch Maximum_Tensile_Stress", "Critical_Stretch"); + MooseEnum FailureCriteriaType("CriticalStretch MaximumTensileStress", "CriticalStretch"); params.addParam( "failure_criterion", FailureCriteriaType, "Which failure criterion to be used"); params.addRequiredCoupledVar("critical_variable", "Name of critical AuxVariable"); @@ -31,7 +31,7 @@ validParams() BondStatusPD::BondStatusPD(const InputParameters & parameters) : AuxKernelBasePD(parameters), - _failure_criterion(getParam("failure_criterion")), + _failure_criterion(getParam("failure_criterion").getEnum()), _bond_status_var(_subproblem.getVariable(_tid, "bond_status")), _critical_val(coupledValue("critical_variable")), _mechanical_stretch(getMaterialProperty("mechanical_stretch")), @@ -39,10 +39,10 @@ BondStatusPD::BondStatusPD(const InputParameters & parameters) { switch (_failure_criterion) { - case 0: + case FailureCriterion::CriticalStretch: break; - case 1: + case FailureCriterion::MaximumTensileStress: { if (hasMaterialProperty("stress")) _stress = &getMaterialProperty("stress"); @@ -53,8 +53,8 @@ BondStatusPD::BondStatusPD(const InputParameters & parameters) } default: - mooseError("Unsupported PD failure criterion. Choose from: Critical_Stretch and " - "Maximum_Principal_Stress"); + paramError("failure_criterion", "Unsupported PD failure criterion. Choose from: CriticalStretch and " + "MaximumPrincipalStress"); } } @@ -65,11 +65,11 @@ BondStatusPD::computeValue() switch (_failure_criterion) { - case 0: + case FailureCriterion::CriticalStretch: val = _mechanical_stretch[0]; break; - case 1: + case FailureCriterion::MaximumTensileStress: { RankTwoTensor avg_stress = 0.5 * ((*_stress)[0] + (*_stress)[1]); std::vector eigvals(LIBMESH_DIM, 0.0); @@ -82,8 +82,8 @@ BondStatusPD::computeValue() } default: - mooseError("Unsupported PD failure criterion. Choose from: Critical_Stretch and " - "Maximum_Principal_Stress"); + paramError("failure_criterion", "Unsupported PD failure criterion. Choose from: CriticalStretch and " + "MaximumPrincipalStress"); } if (_bond_status_var.getElementalValue(_current_elem) > 0.5 && val < _critical_val[0]) diff --git a/modules/peridynamics/src/auxkernels/MechanicalStretchPD.C b/modules/peridynamics/src/auxkernels/MechanicalStretchPD.C index 1440e2f59992..9991b42cd1f4 100644 --- a/modules/peridynamics/src/auxkernels/MechanicalStretchPD.C +++ b/modules/peridynamics/src/auxkernels/MechanicalStretchPD.C @@ -16,7 +16,7 @@ InputParameters validParams() { InputParameters params = validParams(); - params.addClassDescription("Class for outputing bond mechanical stretch value"); + params.addClassDescription("Class for outputing bond mechanical stretch"); params.set("execute_on") = EXEC_TIMESTEP_END; return params;