diff --git a/modules/tensor_mechanics/include/materials/StrainEnergyDensity.h b/modules/tensor_mechanics/include/materials/StrainEnergyDensity.h index 31af75e8fdec..127eda1ac024 100644 --- a/modules/tensor_mechanics/include/materials/StrainEnergyDensity.h +++ b/modules/tensor_mechanics/include/materials/StrainEnergyDensity.h @@ -34,6 +34,9 @@ class StrainEnergyDensityTempl : public DerivativeMaterialInterface /// Base name of the material system const std::string _base_name; + /// stress name, for different stresses on the same material system + const std::string _stress_name; + /// The strain energy density material property MaterialProperty & _strain_energy_density; const MaterialProperty & _strain_energy_density_old; diff --git a/modules/tensor_mechanics/src/materials/StrainEnergyDensity.C b/modules/tensor_mechanics/src/materials/StrainEnergyDensity.C index 24d174ae4bfc..584e83e755d1 100644 --- a/modules/tensor_mechanics/src/materials/StrainEnergyDensity.C +++ b/modules/tensor_mechanics/src/materials/StrainEnergyDensity.C @@ -26,6 +26,13 @@ StrainEnergyDensityTempl::validParams() "Optional parameter that allows the user to define " "multiple mechanics material systems on the same " "block, i.e. for multiple phases"); + params.addParam("stress_name", + "stress", + "Optional parameter that allows the user to use " + "different stresses on the same material system. " + "For example, when we have a degraded_stress and an intact_stress, " + "we want to compute the degraded strain energy density and " + "the intact strain energy density."); params.addParam( "incremental", "Optional flag for error checking if an incremental or total model should be used."); @@ -36,10 +43,11 @@ template StrainEnergyDensityTempl::StrainEnergyDensityTempl(const InputParameters & parameters) : DerivativeMaterialInterface(parameters), _base_name(isParamValid("base_name") ? getParam("base_name") + "_" : ""), + _stress_name(getParam("stress_name")), _strain_energy_density(declareProperty(_base_name + "strain_energy_density")), _strain_energy_density_old(getMaterialPropertyOld(_base_name + "strain_energy_density")), - _stress(getGenericMaterialProperty(_base_name + "stress")), - _stress_old(getMaterialPropertyOld(_base_name + "stress")), + _stress(getGenericMaterialProperty(_base_name + _stress_name)), + _stress_old(getMaterialPropertyOld(_base_name + _stress_name)), _mechanical_strain( getGenericMaterialProperty(_base_name + "mechanical_strain")), _strain_increment( diff --git a/modules/tensor_mechanics/test/tests/strain_energy_density/gold/tot_model_stress_name_out.csv b/modules/tensor_mechanics/test/tests/strain_energy_density/gold/tot_model_stress_name_out.csv new file mode 100644 index 000000000000..18591a52e5e3 --- /dev/null +++ b/modules/tensor_mechanics/test/tests/strain_energy_density/gold/tot_model_stress_name_out.csv @@ -0,0 +1,3 @@ +time,epxx,epyy,epzz,sigxx,sigyy,sigzz,test_SED +0,0,0,0,0,0,0,0 +1,-1.2999983100025e-06,3.0333293900057e-06,0,-3.8440362004621e-12,99.999870000185,29.999961000054,-6.4999915499772e-05 diff --git a/modules/tensor_mechanics/test/tests/strain_energy_density/tests b/modules/tensor_mechanics/test/tests/strain_energy_density/tests index d16cc3fdf80b..4d79d70395e2 100644 --- a/modules/tensor_mechanics/test/tests/strain_energy_density/tests +++ b/modules/tensor_mechanics/test/tests/strain_energy_density/tests @@ -91,4 +91,14 @@ requirement = 'The system shall be capable of calculating strain energy rate density when using ' 'hand-coded Jacobian and weak plane stress.' [] + [tot_elas_stress_name] + type = 'CSVDiff' + issues = '#25202' + input = 'tot_model_stress_name.i' + csvdiff = 'tot_model_stress_name_out.csv' + rel_err = 1e-6 + design = 'StrainEnergyDensity.md' + requirement = 'The system shall be capable of calculating strain energy density for materials with ' + 'a user-specified stress by name and small strain.' + [] [] diff --git a/modules/tensor_mechanics/test/tests/strain_energy_density/tot_model_stress_name.i b/modules/tensor_mechanics/test/tests/strain_energy_density/tot_model_stress_name.i new file mode 100644 index 000000000000..0078f1d0f186 --- /dev/null +++ b/modules/tensor_mechanics/test/tests/strain_energy_density/tot_model_stress_name.i @@ -0,0 +1,153 @@ +# Single element test to check the strain energy density calculation + +[GlobalParams] + displacements = 'disp_x disp_y' + volumetric_locking_correction = true +[] + +[Mesh] + type = GeneratedMesh + dim = 2 + nx = 1 + ny = 1 + xmin = 0 + xmax = 1 + ymin = 0 + ymax = 2 +[] + +[AuxVariables] + [SED] + order = CONSTANT + family = MONOMIAL + [] +[] + +[Functions] + [rampConstantUp] + type = PiecewiseLinear + x = '0. 1.' + y = '0. 1.' + scale_factor = -100 + [] +[] + +[Modules/TensorMechanics/Master] + [master] + strain = SMALL + add_variables = true + incremental = false + generate_output = 'stress_xx stress_yy stress_zz vonmises_stress strain_xx strain_yy strain_zz' + planar_formulation = PLANE_STRAIN + [] +[] + +[AuxKernels] + [SED] + type = MaterialRealAux + variable = SED + property = strain_energy_density + execute_on = timestep_end + [] +[] + +[BCs] + [no_x] + type = DirichletBC + variable = disp_x + boundary = 'left' + value = 0.0 + [] + [no_y] + type = DirichletBC + variable = disp_y + boundary = 'bottom' + value = 0.0 + [] + [Pressure] + [top] + boundary = 'top' + function = rampConstantUp + [] + [] +[] + +[Materials] + [elasticity_tensor] + type = ComputeIsotropicElasticityTensor + youngs_modulus = 30e+6 + poissons_ratio = 0.3 + [] + [elastic_stress] + type = ComputeLinearElasticStress + [] + [tensor] + type = GenericConstantRankTwoTensor + tensor_name = test_stress + tensor_values = '100 0 0 100 0 0 0 0 0' + [] + [strain_energy_density] + type = StrainEnergyDensity + incremental = false + stress_name = 'test_stress' + [] +[] + +[Executioner] + type = Transient + + petsc_options_iname = '-ksp_gmres_restart -pc_type -pc_hypre_type -pc_hypre_boomeramg_max_iter' + petsc_options_value = '201 hypre boomeramg 4' + + line_search = 'none' + + l_max_its = 50 + nl_max_its = 20 + nl_abs_tol = 3e-7 + nl_rel_tol = 1e-12 + l_tol = 1e-2 + + start_time = 0.0 + dt = 1 + + end_time = 1 + num_steps = 1 +[] + +[Postprocessors] + [epxx] + type = ElementalVariableValue + variable = strain_xx + elementid = 0 + [] + [epyy] + type = ElementalVariableValue + variable = strain_yy + elementid = 0 + [] + [epzz] + type = ElementalVariableValue + variable = strain_zz + elementid = 0 + [] + [sigxx] + type = ElementAverageValue + variable = stress_xx + [] + [sigyy] + type = ElementAverageValue + variable = stress_yy + [] + [sigzz] + type = ElementAverageValue + variable = stress_zz + [] + [test_SED] + type = ElementAverageValue + variable = SED + [] +[] + +[Outputs] + csv = true +[]