From 626cd8b4b857ee57d9a0c536d9d0461c4334edd0 Mon Sep 17 00:00:00 2001 From: Prithivirajan Veerappan Date: Mon, 6 Feb 2023 18:22:25 -0700 Subject: [PATCH] Doxygen comments & dynamic_cast ref #184 --- .../ComputeMultipleInelasticDamageStress.h | 2 +- .../materials/DamagePlasticityStressUpdate.h | 97 +++++++++++-------- .../ComputeMultipleInelasticDamageStress.C | 11 +++ .../damage_plasticity_model/uniaxial_test.i | 10 +- 4 files changed, 80 insertions(+), 40 deletions(-) diff --git a/include/materials/ComputeMultipleInelasticDamageStress.h b/include/materials/ComputeMultipleInelasticDamageStress.h index dae6d1c7..a450a7ea 100644 --- a/include/materials/ComputeMultipleInelasticDamageStress.h +++ b/include/materials/ComputeMultipleInelasticDamageStress.h @@ -24,7 +24,7 @@ class ComputeMultipleInelasticDamageStress : public ComputeMultipleInelasticStre public: static InputParameters validParams(); ComputeMultipleInelasticDamageStress(const InputParameters & parameters); - + virtual void initialSetup() override; protected: /// damage parameter for DamagePlasticityStressUpdate model const MaterialProperty & _D; diff --git a/include/materials/DamagePlasticityStressUpdate.h b/include/materials/DamagePlasticityStressUpdate.h index 04d64252..92f5435c 100644 --- a/include/materials/DamagePlasticityStressUpdate.h +++ b/include/materials/DamagePlasticityStressUpdate.h @@ -71,9 +71,10 @@ class DamagePlasticityStressUpdate : public MultiParameterPlasticityStressUpdate const Real _fc0; ///@} - /// Intermediate variable calcualted using user parameter tip_smoother + /// Intermediate variable calculated using user parameter tip_smoother const Real _small_smoother2; + /// Square root of 3 const Real _sqrt3; /// Whether to provide an estimate of the returned stress, based on perfect plasticity @@ -97,11 +98,11 @@ class DamagePlasticityStressUpdate : public MultiParameterPlasticityStressUpdate MaterialProperty & _cD; ///damage variable MaterialProperty & _D; - ///minimum plastic strain + ///minimum Eigen value of plastic strain MaterialProperty & _min_ep; - ///mid value of plastic strain + ///middle Eigen value of plastic strain MaterialProperty & _mid_ep; - ///maximum plastic strain + ///maximum Eigen value of plastic strain MaterialProperty & _max_ep; ///damaged minimum principal stress MaterialProperty & _sigma0; @@ -109,62 +110,81 @@ class DamagePlasticityStressUpdate : public MultiParameterPlasticityStressUpdate MaterialProperty & _sigma1; ///damaged maximum principal stress MaterialProperty & _sigma2; - - Real ft(const std::vector & intnl) const; /** * Obtain the tensile strength * @param intnl (Array containing damage states in tension and compression, respectively) + * @return value of ft (tensile strength) */ - Real dft(const std::vector & intnl) const; + Real ft(const std::vector & intnl) const; + /** * Obtain the partial derivative of the tensile strength to the damage state * @param intnl (Array containing damage states in tension and compression, respectively) + * @return value of dft (partial derivative of the tensile strength to the damage state) */ - Real fc(const std::vector & intnl) const; + Real dft(const std::vector & intnl) const; + /** * Obtain the conpressive strength * @param intnl (Array containing damage states in tension and compression, respectively) + * @return value of fc (conpressive strength) */ - Real dfc(const std::vector & intnl) const; + Real fc(const std::vector & intnl) const; + /** * Obtain the partial derivative of the compressive strength to the damage state * @param intnl (Array containing damage states in tension and compression, respectively) + * @return value of dfc */ - Real beta(const std::vector & intnl) const; + Real dfc(const std::vector & intnl) const; + /** * beta is a dimensionless constant, which is a component of the yield function * It is defined in terms of tensile strength, compressive strength, and another * dimensionless constant alpha (See Eqn. 37 in Lee (1998)) * @param intnl (Array containing damage states in tension and compression, respectively) + * @return value of beta */ - Real dbeta0(const std::vector & intnl) const; + Real beta(const std::vector & intnl) const; + /** * dbeta0 is a derivative of beta wrt. tensile strength (ft) * @param intnl (Array containing damage states in tension and compression, respectively) + * @return value of dbeta0 */ - Real dbeta1(const std::vector & intnl) const; + Real dbeta0(const std::vector & intnl) const; + /** * dbeta1 is a derivative of beta wrt. compressive strength (fc) * @param intnl (Array containing damage states in tension and compression, respectively) + * @return value of dbeta1 */ - void weighfac(const std::vector & stress_params, Real & wf) const; + Real dbeta1(const std::vector & intnl) const; + /** * weighfac is the weight factor, defined interms of the ratio of sum of principal stresses * to the sum of absolute value of the principal stresses * @param stress_params is the array of principal stresses + * @return wf */ - void dweighfac(const std::vector & stress_params, Real & wf, std::vector & dwf) const; + void weighfac(const std::vector & stress_params, Real & wf) const; + /** * dweighfac is the derivative of the weight factor * @param stress_params is the array of principal stresses + * @param wf is the weight factor + * @return dwf */ - Real damageVar(const std::vector & stress_params, const std::vector & intnl) const; + void dweighfac(const std::vector & stress_params, Real & wf, std::vector & dwf) const; + /** * damageVar is the degradation damage variable as defined in Eqn. 43 in Lee (1998) * @param stress_params is the array of principal stresses * @param intnl (Array containing damage states in tension and compression, respectively) - * @param r + * @return value of damageVar */ + Real damageVar(const std::vector & stress_params, const std::vector & intnl) const; + void computeStressParams(const RankTwoTensor & stress, std::vector & stress_params) const override; @@ -196,74 +216,75 @@ class DamagePlasticityStressUpdate : public MultiParameterPlasticityStressUpdate const std::vector & intnl, std::vector & all_q) const override; + /** + * This function calculates the flow potential + * @param stress_params is the array of principal stresses + * @param intnl (Array containing damage states in tension and compression, respectively) + * @return r (flowpotential) + */ virtual void flowPotential(const std::vector & stress_params, const std::vector & intnl, std::vector & r) const; + /** - * This function calculates the flow potential + * This function calculates the derivative of the flow potential with the stress * @param stress_params is the array of principal stresses * @param intnl (Array containing damage states in tension and compression, respectively) - * @param r is the flowpotential + * @return dr_dstress (dflowpotential_dstress) */ - virtual void dflowPotential_dstress(const std::vector & stress_params, const std::vector & intnl, std::vector> & dr_dstress) const; /** - * This function calculates the derivative of the flow potential with the stress + * This function calculates the derivative of the flow potential with the damage states * @param stress_params is the array of principal stresses * @param intnl (Array containing damage states in tension and compression, respectively) - * @param dr_dstress is the dflowpotential + * @return dr_dintnl (dflowPotential_dintnl) */ virtual void dflowPotential_dintnl(const std::vector & stress_params, const std::vector & intnl, std::vector> & dr_dintnl) const; /** - * This function calculates the derivative of the flow potential with the damage states + * This function calculates the hardening potential * @param stress_params is the array of principal stresses * @param intnl (Array containing damage states in tension and compression, respectively) - * @param dr_dintnl is the dflowPotential_dintnl + * @return h (hardening Potential) */ virtual void hardPotential(const std::vector & stress_params, const std::vector & intnl, std::vector & h) const; /** - * This function calculates the hardening potential + * This function calculates the derivative of the hardening potential with the stress * @param stress_params is the array of principal stresses * @param intnl (Array containing damage states in tension and compression, respectively) - * @param h is the hardPotential + * @return dh_dsig (dhardPotential_dstress) */ virtual void dhardPotential_dstress(const std::vector & stress_params, const std::vector & intnl, std::vector> & dh_dsig) const; /** - * This function calculates the derivative of the hardening potential with the stress + * This function calculates the derivative of the hardening potential with the damage states * @param stress_params is the array of principal stresses * @param intnl (Array containing damage states in tension and compression, respectively) - * @param dh_dsig is the dhardPotential_dstress + * @return dh_dintnl (dhardPotential_dintnl) */ virtual void dhardPotential_dintnl(const std::vector & stress_params, const std::vector & intnl, std::vector> & dh_dintnl) const; /** - * This function calculates the derivative of the hardening potential with the damage states + * This function updates the damage states * @param stress_params is the array of principal stresses - * @param intnl (Array containing damage states in tension and compression, respectively) - * @param dh_dintnl is the dhardPotential_dintnl + * @param trial_stress_params is the trial values of the principal stresses + * @param intnl_old (Array containing previous step's damage states in tension and compression, + * respectively) + * @return no particular return values, updates internal variables */ void initialiseVarsV(const std::vector & trial_stress_params, const std::vector & intnl_old, std::vector & stress_params, Real & gaE, std::vector & intnl) const; - /** - * This function updates the damage states - * @param stress_params is the array of principal stresses - * @param trial_stress_params is the trial values of the principal stresses - * @param intnl_old (Array containing previous step's damage states in tension and compression, - * respectively) - * @param dh_dintnl is the dhardPotential_dintnl - */ + void setIntnlValuesV(const std::vector & trial_stress_params, const std::vector & current_stress_params, const std::vector & intnl_old, diff --git a/src/materials/ComputeMultipleInelasticDamageStress.C b/src/materials/ComputeMultipleInelasticDamageStress.C index 08b68099..55b712b2 100644 --- a/src/materials/ComputeMultipleInelasticDamageStress.C +++ b/src/materials/ComputeMultipleInelasticDamageStress.C @@ -14,6 +14,7 @@ #include "ComputeMultipleInelasticDamageStress.h" #include "StressUpdateBase.h" +#include "DamagePlasticityStressUpdate.h" registerMooseObject("BlackBearApp", ComputeMultipleInelasticDamageStress); @@ -34,6 +35,16 @@ ComputeMultipleInelasticDamageStress::ComputeMultipleInelasticDamageStress( { } +void +ComputeMultipleInelasticDamageStress::initialSetup() +{ + ComputeMultipleInelasticStress::initialSetup(); + if (_models.size() != 1) + paramError("ComputeMultipleInelasticDamageStress currently can only have one model specified in 'inelastic_models'"); + if (!dynamic_cast(_models[0])) + paramError("Model " + _models[0]->name() + " is not a DamagePlasticityStressUpdate object"); +} + void ComputeMultipleInelasticDamageStress::computeQpJacobianMult() { diff --git a/test/tests/damage_plasticity_model/uniaxial_test.i b/test/tests/damage_plasticity_model/uniaxial_test.i index 0950fc63..7540c93f 100644 --- a/test/tests/damage_plasticity_model/uniaxial_test.i +++ b/test/tests/damage_plasticity_model/uniaxial_test.i @@ -214,9 +214,17 @@ tip_smoother = 1.E-6 smoothing_tol = 1.E-3 [] + [perfect_plasticity] + type = IsotropicPlasticityStressUpdate + yield_stress = 10 + hardening_constant = 0 + base_name = perfect + [] [stress] type = ComputeMultipleInelasticDamageStress - inelastic_models = damage_plasticity_model +# The following line is for error testing +# inelastic_models = 'damage_plasticity_model perfect_plasticity' + inelastic_models = 'damage_plasticity_model' perform_finite_strain_rotations = false [] []