Skip to content

Commit

Permalink
included error_message_check in tests ref idaholab#184
Browse files Browse the repository at this point in the history
  • Loading branch information
vprithiv committed Feb 23, 2023
1 parent 626cd8b commit 50a3424
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 6 deletions.
1 change: 1 addition & 0 deletions include/materials/ComputeMultipleInelasticDamageStress.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class ComputeMultipleInelasticDamageStress : public ComputeMultipleInelasticStre
static InputParameters validParams();
ComputeMultipleInelasticDamageStress(const InputParameters & parameters);
virtual void initialSetup() override;

protected:
/// damage parameter for DamagePlasticityStressUpdate model
const MaterialProperty<Real> & _D;
Expand Down
4 changes: 2 additions & 2 deletions include/materials/DamagePlasticityStressUpdate.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class DamagePlasticityStressUpdate : public MultiParameterPlasticityStressUpdate
/**
* 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
* @return value of dfc
*/
Real dfc(const std::vector<Real> & intnl) const;

Expand All @@ -143,7 +143,7 @@ class DamagePlasticityStressUpdate : public MultiParameterPlasticityStressUpdate
* 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
* @return value of beta
*/
Real beta(const std::vector<Real> & intnl) const;

Expand Down
5 changes: 3 additions & 2 deletions src/materials/ComputeMultipleInelasticDamageStress.C
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,13 @@ ComputeMultipleInelasticDamageStress::ComputeMultipleInelasticDamageStress(
{
}

void
void
ComputeMultipleInelasticDamageStress::initialSetup()
{
ComputeMultipleInelasticStress::initialSetup();
if (_models.size() != 1)
paramError("ComputeMultipleInelasticDamageStress currently can only have one model specified in 'inelastic_models'");
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");
}
Expand Down
22 changes: 22 additions & 0 deletions test/tests/damage_plasticity_model/tests
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,28 @@
allow_test_objects = True
cli_args = 'Outputs/file_base=shear_test_out'
detail = ' in shear loading.'

[]
[error_message_check]
requirement = 'Blackbear shall produce an error message when input required for the inelastic_models are not properly set by user:'
[inelastic_models_name]
type = 'RunException'
input = 'uniaxial_test.i'
cli_args = "Materials/stress/inelastic_models='perfect_plasticity'"
expect_err = "Model perfect_plasticity is not a DamagePlasticityStressUpdate object"
allow_test_objects = True
detail = "When inelastic_models is not given as damage_plasticity_model"
[]
[]

[inelastic_models_size]
type = 'RunException'
input = 'uniaxial_test.i'
cli_args = "Materials/stress/inelastic_models='damage_plasticity_model perfect_plasticity'"
expect_err = "ComputeMultipleInelasticDamageStress currently can only have one model specified in 'inelastic_models'"
allow_test_objects = True
detail = "When inelastic_models has more than one model as input"
[]

[]
[]
2 changes: 0 additions & 2 deletions test/tests/damage_plasticity_model/uniaxial_test.i
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,6 @@
[]
[stress]
type = ComputeMultipleInelasticDamageStress
# 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 50a3424

Please sign in to comment.