22 "Creates density material property. This class is deprecated, and its functionality"
23 "is replaced by StrainAdjustedDensity for cases when the density should be adjusted"
24 "to account for material deformation. If it is not desired to adjust the density for"
25 "deformation, a variety of general-purpose Materials, such as GenericConstantMaterial"
26 "or ParsedMaterial can be used to define the density. A StrainAdjustedDensity can also "
27 "be used with '0 0 0' for the displacements.");
31 "The displacements appropriate for the simulation geometry and coordinate system");
33 params.
addParam<std::string>(
"base_name",
34 "Optional parameter that allows the user to define "
35 "multiple material systems on the same block, "
36 "e.g. for multiple phases");
45 _is_coupled(isCoupled(
"displacements")),
46 _coord_system(getBlockCoordSystem()),
47 _disp_r(_is_coupled ? this->template coupledGenericValue<is_ad>(
"displacements", 0)
48 : genericZeroValue<is_ad>()),
49 _base_name(isParamValid(
"base_name") ? getParam<
std::string>(
"base_name") +
"_" :
""),
50 _initial_density(getParam<Real>(
"density")),
51 _grad_disp(_is_coupled ? this->template coupledGenericGradients<is_ad>(
"displacements")
53 _density(declareGenericProperty<Real, is_ad>(_base_name +
"density"))
55 if (getParam<bool>(
"use_displaced_mesh"))
57 "Density needs to act on an undisplaced mesh. Use of a displaced mesh leads to "
58 "incorrect gradient values");
66 "The system uses a displaced problem but 'displacements' are not provided in Density.");
69 _grad_disp.resize(3, &genericZeroGradient<is_ad>());
76 _density[_qp] = _initial_density;
94 const auto Axx = (*_grad_disp[0])[_qp](0) + 1.0;
95 const auto & Axy = (*_grad_disp[0])[_qp](1);
96 const auto & Axz = (*_grad_disp[0])[_qp](2);
97 const auto & Ayx = (*_grad_disp[1])[_qp](0);
98 auto Ayy = (*_grad_disp[1])[_qp](1) + 1.0;
99 const auto & Ayz = (*_grad_disp[1])[_qp](2);
100 const auto & Azx = (*_grad_disp[2])[_qp](0);
101 const auto & Azy = (*_grad_disp[2])[_qp](1);
102 auto Azz = (*_grad_disp[2])[_qp](2) + 1.0;
104 switch (_coord_system)
107 Azz = (*_grad_disp[2])[_qp](2) + 1.0;
111 if (_q_point[_qp](0) != 0.0)
112 Azz = _disp_r[_qp] / _q_point[_qp](0) + 1.0;
116 if (_q_point[_qp](0) != 0.0)
117 Ayy = Azz = _disp_r[_qp] / _q_point[_qp](0) + 1.0;
121 const auto detF = Axx * Ayy * Azz + Axy * Ayz * Azx + Axz * Ayx * Azy - Azx * Ayy * Axz -
122 Azy * Ayz * Axx - Azz * Ayx * Axy;
126 _density[_qp] = density;
registerMooseObjectDeprecated("MiscApp", Density, "12/31/2025 24:00")
Moose::GenericType< VariableGradient, is_ad > GenericVariableGradient
Moose::GenericType< Real, is_ad > GenericReal
unsigned int coupledComponents(const std::string &var_name) const
Compute density, which may changed based on a deforming mesh.
DensityTempl(const InputParameters ¶ms)
static InputParameters validParams()
std::vector< const GenericVariableGradient< is_ad > * > _grad_disp
virtual void initQpStatefulProperties() override
virtual void computeQpProperties() override
virtual std::shared_ptr< const DisplacedProblem > getDisplacedProblem() const
FEProblemBase & _fe_problem
static InputParameters validParams()
void paramError(const std::string ¶m, Args... args) const