Skip to content

Commit

Permalink
Doxygen comments & dynamic_cast ref idaholab#184
Browse files Browse the repository at this point in the history
  • Loading branch information
vprithiv committed Feb 14, 2023
1 parent 7c51277 commit 53fae22
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 40 deletions.
2 changes: 1 addition & 1 deletion include/materials/ComputeMultipleInelasticDamageStress.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<Real> & _D;
Expand Down
97 changes: 59 additions & 38 deletions include/materials/DamagePlasticityStressUpdate.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -97,74 +98,93 @@ class DamagePlasticityStressUpdate : public MultiParameterPlasticityStressUpdate
MaterialProperty<Real> & _cD;
///damage variable
MaterialProperty<Real> & _D;
///minimum plastic strain
///minimum Eigen value of plastic strain
MaterialProperty<Real> & _min_ep;
///mid value of plastic strain
///middle Eigen value of plastic strain
MaterialProperty<Real> & _mid_ep;
///maximum plastic strain
///maximum Eigen value of plastic strain
MaterialProperty<Real> & _max_ep;
///damaged minimum principal stress
MaterialProperty<Real> & _sigma0;
///damaged mid value of principal stress
MaterialProperty<Real> & _sigma1;
///damaged maximum principal stress
MaterialProperty<Real> & _sigma2;

Real ft(const std::vector<Real> & 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<Real> & intnl) const;
Real ft(const std::vector<Real> & 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<Real> & intnl) const;
Real dft(const std::vector<Real> & 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<Real> & intnl) const;
Real fc(const std::vector<Real> & 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<Real> & intnl) const;
Real dfc(const std::vector<Real> & 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<Real> & intnl) const;
Real beta(const std::vector<Real> & 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<Real> & intnl) const;
Real dbeta0(const std::vector<Real> & 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<Real> & stress_params, Real & wf) const;
Real dbeta1(const std::vector<Real> & 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<Real> & stress_params, Real & wf, std::vector<Real> & dwf) const;
void weighfac(const std::vector<Real> & 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<Real> & stress_params, const std::vector<Real> & intnl) const;
void dweighfac(const std::vector<Real> & stress_params, Real & wf, std::vector<Real> & 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<Real> & stress_params, const std::vector<Real> & intnl) const;

void computeStressParams(const RankTwoTensor & stress,
std::vector<Real> & stress_params) const override;

Expand Down Expand Up @@ -196,74 +216,75 @@ class DamagePlasticityStressUpdate : public MultiParameterPlasticityStressUpdate
const std::vector<Real> & intnl,
std::vector<yieldAndFlow> & 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<Real> & stress_params,
const std::vector<Real> & intnl,
std::vector<Real> & 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<Real> & stress_params,
const std::vector<Real> & intnl,
std::vector<std::vector<Real>> & 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<Real> & stress_params,
const std::vector<Real> & intnl,
std::vector<std::vector<Real>> & 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<Real> & stress_params,
const std::vector<Real> & intnl,
std::vector<Real> & 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<Real> & stress_params,
const std::vector<Real> & intnl,
std::vector<std::vector<Real>> & 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<Real> & stress_params,
const std::vector<Real> & intnl,
std::vector<std::vector<Real>> & 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<Real> & trial_stress_params,
const std::vector<Real> & intnl_old,
std::vector<Real> & stress_params,
Real & gaE,
std::vector<Real> & 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<Real> & trial_stress_params,
const std::vector<Real> & current_stress_params,
const std::vector<Real> & intnl_old,
Expand Down
11 changes: 11 additions & 0 deletions src/materials/ComputeMultipleInelasticDamageStress.C
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#include "ComputeMultipleInelasticDamageStress.h"
#include "StressUpdateBase.h"
#include "DamagePlasticityStressUpdate.h"

registerMooseObject("BlackBearApp", ComputeMultipleInelasticDamageStress);

Expand All @@ -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<DamagePlasticityStressUpdate *>(_models[0]))
paramError("Model " + _models[0]->name() + " is not a DamagePlasticityStressUpdate object");
}

void
ComputeMultipleInelasticDamageStress::computeQpJacobianMult()
{
Expand Down
10 changes: 9 additions & 1 deletion test/tests/damage_plasticity_model/uniaxial_test.i
Original file line number Diff line number Diff line change
Expand Up @@ -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
[]
[]
Expand Down

0 comments on commit 53fae22

Please sign in to comment.