Commit aa625037 authored by Antoine Jacquey's avatar Antoine Jacquey

Modified LynxADMaterialBase members.

parent 95945136
......@@ -26,7 +26,8 @@
using LynxADDeformationBase<compute_stage>::_spin_increment; \
using LynxADDeformationBase<compute_stage>::_thermal_exp; \
using LynxADDeformationBase<compute_stage>::_stress; \
using LynxADDeformationBase<compute_stage>::_inelastic_heat
using LynxADDeformationBase<compute_stage>::_inelastic_heat; \
using LynxADDeformationBase<compute_stage>::spinRotation
template <ComputeStage>
class LynxADDeformationBase;
......
......@@ -23,7 +23,8 @@
using LynxADDensityBase<compute_stage>::_rho_f; \
using LynxADDensityBase<compute_stage>::_rho_s; \
using LynxADDensityBase<compute_stage>::_rho_b; \
using LynxADDensityBase<compute_stage>::_reference_rho_b
using LynxADDensityBase<compute_stage>::_reference_rho_b; \
using LynxADDensityBase<compute_stage>::computeQpGravity
template <ComputeStage>
class LynxADDensityBase;
......
......@@ -20,7 +20,9 @@
using LynxADMaterialBase<compute_stage>::_has_compositional_phases; \
using LynxADMaterialBase<compute_stage>::_n_composition; \
using LynxADMaterialBase<compute_stage>::_average_type; \
using LynxADMaterialBase<compute_stage>::_compositional_phases
using LynxADMaterialBase<compute_stage>::_compositional_phases; \
using LynxADMaterialBase<compute_stage>::getLynxParam; \
using LynxADMaterialBase<compute_stage>::averageProperty
template <ComputeStage>
class LynxADMaterialBase;
......
This diff is collapsed.
......@@ -16,12 +16,14 @@
defineADValidParams(LynxADDensityBase,
LynxADMaterialBase,
params.addClassDescription("Base class for calculating densities and gravity.");
params.addCoupledVar("porosity","The porosity auxiliary variable.");
params.addParam<bool>("has_gravity", false, "Model with gravity on?");
params.addParam<Real>("gravity_acceleration", 9.81, "The magnitude of the gravity acceleration.");
params.addParam<std::vector<Real>>("fluid_density", "The fluid density.");
params.addParam<std::vector<Real>>("solid_density", "The solid density."););
params.addClassDescription("Base class for calculating densities and gravity.");
params.addCoupledVar("porosity", "The porosity auxiliary variable.");
params.addParam<bool>("has_gravity", false, "Model with gravity on?");
params.addParam<Real>("gravity_acceleration",
9.81,
"The magnitude of the gravity acceleration.");
params.addParam<std::vector<Real>>("fluid_density", "The fluid density.");
params.addParam<std::vector<Real>>("solid_density", "The solid density."););
template <ComputeStage compute_stage>
LynxADDensityBase<compute_stage>::LynxADDensityBase(const InputParameters & parameters)
......@@ -29,9 +31,9 @@ LynxADDensityBase<compute_stage>::LynxADDensityBase(const InputParameters & para
_porosity(isCoupled("porosity") ? adCoupledValue("porosity") : adZeroValue()),
_has_gravity(getParam<bool>("has_gravity")),
_g(_has_gravity ? getParam<Real>("gravity_acceleration") : 0.0),
_fluid_density(isParamValid("fluid_density") ? this->getLynxParam("fluid_density")
_fluid_density(isParamValid("fluid_density") ? getLynxParam("fluid_density")
: std::vector<Real>(_n_composition, 0.0)),
_solid_density(isParamValid("solid_density") ? this->getLynxParam("solid_density")
_solid_density(isParamValid("solid_density") ? getLynxParam("solid_density")
: std::vector<Real>(_n_composition, 0.0)),
_gravity(declareADProperty<RealVectorValue>("gravity_vector")),
_rho_f(declareADProperty<Real>("fluid_density")),
......
......@@ -30,9 +30,9 @@ template <ComputeStage compute_stage>
void
LynxADDensityConstant<compute_stage>::computeQpProperties()
{
this->computeQpGravity();
_rho_f[_qp] = this->averageProperty(_fluid_density);
_rho_s[_qp] = this->averageProperty(_solid_density);
computeQpGravity();
_rho_f[_qp] = averageProperty(_fluid_density);
_rho_s[_qp] = averageProperty(_solid_density);
_rho_b[_qp] = _porosity[_qp] * _rho_f[_qp] + (1.0 - _porosity[_qp]) * _rho_s[_qp];
_reference_rho_b[_qp] = _rho_b[_qp];
}
......
......@@ -18,21 +18,22 @@ registerADMooseObject("LynxApp", LynxADDensityThermal);
defineADValidParams(
LynxADDensityThermal,
LynxADDensityBase,
params.addClassDescription("Material calculating densities as a simple linear function of temperature.");
params.addRequiredCoupledVar("temperature", "The temperature variable.");
params.addParam<std::vector<Real>>("beta_fluid", "The fluid thermal expansion coefficient.");
params.addParam<std::vector<Real>>("beta_solid", "The solid thermal expansion coefficient.");
params.addParam<Real>("reference_temperature", 0.0, "The reference temperature.");
params.addParam<FunctionName>("reference_temperature_fct",
"The reference temperature given by a function."););
params.addClassDescription(
"Material calculating densities as a simple linear function of temperature.");
params.addRequiredCoupledVar("temperature", "The temperature variable.");
params.addParam<std::vector<Real>>("beta_fluid", "The fluid thermal expansion coefficient.");
params.addParam<std::vector<Real>>("beta_solid", "The solid thermal expansion coefficient.");
params.addParam<Real>("reference_temperature", 0.0, "The reference temperature.");
params.addParam<FunctionName>("reference_temperature_fct",
"The reference temperature given by a function."););
template <ComputeStage compute_stage>
LynxADDensityThermal<compute_stage>::LynxADDensityThermal(const InputParameters & parameters)
: LynxADDensityBase<compute_stage>(parameters),
_temp(adCoupledValue("temperature")),
_beta_fluid(isParamValid("beta_fluid") ? this->getLynxParam("beta_fluid")
_beta_fluid(isParamValid("beta_fluid") ? getLynxParam("beta_fluid")
: std::vector<Real>(_n_composition, 0.0)),
_beta_solid(isParamValid("beta_solid") ? this->getLynxParam("beta_solid")
_beta_solid(isParamValid("beta_solid") ? getLynxParam("beta_solid")
: std::vector<Real>(_n_composition, 0.0)),
_temp_ref(getParam<Real>("reference_temperature")),
_temp_ref_fct(isParamValid("reference_temperature_fct")
......@@ -45,16 +46,16 @@ template <ComputeStage compute_stage>
void
LynxADDensityThermal<compute_stage>::computeQpProperties()
{
this->computeQpGravity();
computeQpGravity();
Real temp_ref = _temp_ref;
if (_temp_ref_fct)
temp_ref = _temp_ref_fct->value(_t, _q_point[_qp]);
_rho_f[_qp] = this->averageProperty(_fluid_density) *
(1.0 - this->averageProperty(_beta_fluid) * (_temp[_qp] - temp_ref));
_rho_s[_qp] = this->averageProperty(_solid_density) *
(1.0 - this->averageProperty(_beta_solid) * (_temp[_qp] - temp_ref));
_rho_f[_qp] = averageProperty(_fluid_density) *
(1.0 - averageProperty(_beta_fluid) * (_temp[_qp] - temp_ref));
_rho_s[_qp] = averageProperty(_solid_density) *
(1.0 - averageProperty(_beta_solid) * (_temp[_qp] - temp_ref));
_rho_b[_qp] = _porosity[_qp] * _rho_f[_qp] + (1.0 - _porosity[_qp]) * _rho_s[_qp];
_reference_rho_b[_qp] = _rho_b[_qp];
}
......
......@@ -42,8 +42,8 @@ LynxADElasticDeformation<compute_stage>::LynxADElasticDeformation(
const InputParameters & parameters)
: LynxADDeformationBase<compute_stage>(parameters),
// Elastic moduli parameters
_bulk_modulus(this->getLynxParam("bulk_modulus")),
_shear_modulus(this->getLynxParam("shear_modulus")),
_bulk_modulus(getLynxParam("bulk_modulus")),
_shear_modulus(getLynxParam("shear_modulus")),
// Creep and platic models
_has_creep(isParamValid("creep_model")),
_has_plastic(isParamValid("plastic_model")),
......@@ -103,8 +103,8 @@ LynxADElasticDeformation<compute_stage>::initializeQpDeformation()
{
// Initialize elastic properties
_elastic_strain_incr[_qp] = _strain_increment[_qp];
_K[_qp] = this->averageProperty(_bulk_modulus);
_G[_qp] = this->averageProperty(_shear_modulus);
_K[_qp] = averageProperty(_bulk_modulus);
_G[_qp] = averageProperty(_shear_modulus);
}
template <ComputeStage compute_stage>
......@@ -152,7 +152,7 @@ template <ComputeStage compute_stage>
ADRankTwoTensor
LynxADElasticDeformation<compute_stage>::deviatoricDeformation(const ADReal & /*pressure*/)
{
ADRankTwoTensor stress_dev = this->spinRotation(_stress_old[_qp].deviatoric());
ADRankTwoTensor stress_dev = spinRotation(_stress_old[_qp].deviatoric());
stress_dev += 2.0 * _G[_qp] * _elastic_strain_incr[_qp].deviatoric();
......
......@@ -27,13 +27,13 @@ defineADValidParams(
template <ComputeStage compute_stage>
LynxADHydroConstant<compute_stage>::LynxADHydroConstant(const InputParameters & parameters)
: LynxADHydroBase<compute_stage>(parameters),
_perm(this->getLynxParam("permeability")),
_fluid_viscosity(this->getLynxParam("fluid_viscosity"))
_perm(getLynxParam("permeability")),
_fluid_viscosity(getLynxParam("fluid_viscosity"))
{
if (isParamValid("fluid_modulus"))
{
_fluid_compr = std::vector<Real>(_n_composition, 0.0);
std::vector<Real> fluid_modulus = this->getLynxParam("fluid_modulus");
std::vector<Real> fluid_modulus = getLynxParam("fluid_modulus");
for (unsigned int i = 0; i < _n_composition; ++i)
if (fluid_modulus[i] != 0.0)
_fluid_compr[i] = 1.0 / fluid_modulus[i];
......@@ -44,7 +44,7 @@ LynxADHydroConstant<compute_stage>::LynxADHydroConstant(const InputParameters &
if (isParamValid("solid_modulus"))
{
_solid_compr = std::vector<Real>(_n_composition, 0.0);
std::vector<Real> solid_modulus = this->getLynxParam("solid_modulus");
std::vector<Real> solid_modulus = getLynxParam("solid_modulus");
for (unsigned int i = 0; i < _n_composition; ++i)
if (solid_modulus[i] != 0.0)
_solid_compr[i] = 1.0 / solid_modulus[i];
......@@ -57,30 +57,28 @@ template <ComputeStage compute_stage>
void
LynxADHydroConstant<compute_stage>::computeQpFluidCompressibility()
{
_C_f[_qp] = this->averageProperty(_fluid_compr);
_C_f[_qp] = averageProperty(_fluid_compr);
}
template <ComputeStage compute_stage>
void
LynxADHydroConstant<compute_stage>::computeQpSolidCompressibility()
{
_C_s[_qp] = this->averageProperty(_solid_compr);
_C_s[_qp] = averageProperty(_solid_compr);
}
template <ComputeStage compute_stage>
void
LynxADHydroConstant<compute_stage>::computeQpPermeability()
{
_k[_qp] = this->averageProperty(_perm);
_k[_qp] = averageProperty(_perm);
}
template <ComputeStage compute_stage>
void
LynxADHydroConstant<compute_stage>::computeQpFluidViscosity()
{
_eta_f[_qp] = this->averageProperty(_fluid_viscosity);
_eta_f[_qp] = averageProperty(_fluid_viscosity);
}
adBaseClass(LynxADHydroConstant);
\ No newline at end of file
This diff is collapsed.
......@@ -18,7 +18,8 @@ registerADMooseObject("LynxApp", LynxADStokeDeformation);
defineADValidParams(
LynxADStokeDeformation,
LynxADDeformationBase,
params.addClassDescription("Class calculating strain and stress for a viscous (Stoke) rheology.");
params.addClassDescription(
"Class calculating strain and stress for a viscous (Stoke) rheology.");
params.addCoupledVar("dynamic_pressure", "The dynamic pressure variable.");
// Stoke parameters
params.addParam<std::vector<Real>>("A_diffusion",
......@@ -50,41 +51,41 @@ defineADValidParams(
template <ComputeStage compute_stage>
LynxADStokeDeformation<compute_stage>::LynxADStokeDeformation(const InputParameters & parameters)
: LynxADDeformationBase<compute_stage>(parameters),
_pdyn(isCoupled("dynamic_pressure")? adCoupledValue("dynamic_pressure") : adZeroValue()),
_pdyn(isCoupled("dynamic_pressure") ? adCoupledValue("dynamic_pressure") : adZeroValue()),
_temp(_coupled_temp ? adCoupledValue("temperature") : adZeroValue()),
// Stoke parameters
_has_diffusion_creep(isParamValid("A_diffusion")),
_A_diffusion(_has_diffusion_creep ? this->getLynxParam("A_diffusion")
_A_diffusion(_has_diffusion_creep ? getLynxParam("A_diffusion")
: std::vector<Real>(_n_composition, 0.0)),
_E_diffusion((_has_diffusion_creep && isParamValid("E_diffusion"))
? this->getLynxParam("E_diffusion")
? getLynxParam("E_diffusion")
: std::vector<Real>(_n_composition, 0.0)),
_V_diffusion((_has_diffusion_creep && isParamValid("V_diffusion"))
? this->getLynxParam("V_diffusion")
? getLynxParam("V_diffusion")
: std::vector<Real>(_n_composition, 0.0)),
_has_dislocation_creep(isParamValid("A_dislocation")),
_A_dislocation(_has_dislocation_creep ? this->getLynxParam("A_dislocation")
_A_dislocation(_has_dislocation_creep ? getLynxParam("A_dislocation")
: std::vector<Real>(_n_composition, 0.0)),
_n_dislocation((_has_dislocation_creep && isParamValid("n_dislocation"))
? this->getLynxParam("n_dislocation")
? getLynxParam("n_dislocation")
: std::vector<Real>(_n_composition, 1.0)),
_E_dislocation((_has_dislocation_creep && isParamValid("E_dislocation"))
? this->getLynxParam("E_dislocation")
? getLynxParam("E_dislocation")
: std::vector<Real>(_n_composition, 0.0)),
_V_dislocation((_has_dislocation_creep && isParamValid("V_dislocation"))
? this->getLynxParam("V_dislocation")
? getLynxParam("V_dislocation")
: std::vector<Real>(_n_composition, 0.0)),
_gas_constant(getParam<Real>("gas_constant")),
_has_background_strain_rate(isParamValid("background_strain_rate")),
_has_initial_viscosity(_has_background_strain_rate ? false
: isParamValid("_has_initial_viscosity")),
_initial_viscosity(_has_initial_viscosity ? this->getLynxParam("initial_viscosity")
_initial_viscosity(_has_initial_viscosity ? getLynxParam("initial_viscosity")
: std::vector<Real>(_n_composition, 0.0)),
_background_strain_rate(_has_background_strain_rate ? getParam<Real>("background_strain_rate")
: 0.0),
_eta_min(isParamValid("eta_min") ? this->getLynxParam("eta_min")
_eta_min(isParamValid("eta_min") ? getLynxParam("eta_min")
: std::vector<Real>(_n_composition, 0.0)),
_eta_max(isParamValid("eta_max") ? this->getLynxParam("eta_max")
_eta_max(isParamValid("eta_max") ? getLynxParam("eta_max")
: std::vector<Real>(_n_composition, 1.0e+99)),
// Stoke properties
_eta_eff(declareADProperty<Real>("effective_viscosity"))
......@@ -105,14 +106,14 @@ template <ComputeStage compute_stage>
void
LynxADStokeDeformation<compute_stage>::initializeQpDeformation()
{
_A_diff = this->averageProperty(_A_diffusion);
_E_diff = this->averageProperty(_E_diffusion);
_V_diff = this->averageProperty(_V_diffusion);
_A_disl = this->averageProperty(_A_dislocation);
_n_disl = this->averageProperty(_n_dislocation);
_E_disl = this->averageProperty(_E_dislocation);
_V_disl = this->averageProperty(_V_dislocation);
_A_diff = averageProperty(_A_diffusion);
_E_diff = averageProperty(_E_diffusion);
_V_diff = averageProperty(_V_diffusion);
_A_disl = averageProperty(_A_dislocation);
_n_disl = averageProperty(_n_dislocation);
_E_disl = averageProperty(_E_dislocation);
_V_disl = averageProperty(_V_dislocation);
}
template <ComputeStage compute_stage>
......@@ -139,8 +140,8 @@ LynxADStokeDeformation<compute_stage>::computeQpEffectiveViscosity(const ADReal
ADReal strain_rate_II = std::sqrt(0.5) * _strain_increment[_qp].deviatoric().L2norm() / _dt;
if (_t_step <= 1 && strain_rate_II == 0.0 && _has_initial_viscosity)
return std::min(std::max(this->averageProperty(_initial_viscosity), this->averageProperty(_eta_min)),
this->averageProperty(_eta_max));
return std::min(std::max(averageProperty(_initial_viscosity), averageProperty(_eta_min)),
averageProperty(_eta_max));
strain_rate_II = (_has_background_strain_rate && _t_step <= 1 && strain_rate_II == 0.0)
? _background_strain_rate
......@@ -153,7 +154,7 @@ LynxADStokeDeformation<compute_stage>::computeQpEffectiveViscosity(const ADReal
_A_diff *= std::exp(-(_E_diff + pressure * _V_diff) / RT);
_A_disl *= std::exp(-(_E_disl + pressure * _V_disl) / RT);
}
if (_has_diffusion_creep)
one_on_eta_diff = computeQpOneOnDiffViscosity(_A_diff);
if (_has_dislocation_creep)
......@@ -161,7 +162,7 @@ LynxADStokeDeformation<compute_stage>::computeQpEffectiveViscosity(const ADReal
ADReal eta = 1.0 / (one_on_eta_diff + one_on_eta_disl);
return std::min(std::max(eta, this->averageProperty(_eta_min)), this->averageProperty(_eta_max));
return std::min(std::max(eta, averageProperty(_eta_min)), averageProperty(_eta_max));
}
template <ComputeStage compute_stage>
......@@ -173,8 +174,9 @@ LynxADStokeDeformation<compute_stage>::computeQpOneOnDiffViscosity(const ADReal
template <ComputeStage compute_stage>
ADReal
LynxADStokeDeformation<compute_stage>::computeQpOneOnDislViscosity(
const ADReal A, const ADReal n, const ADReal eII)
LynxADStokeDeformation<compute_stage>::computeQpOneOnDislViscosity(const ADReal A,
const ADReal n,
const ADReal eII)
{
if ((eII == 0.0) && (n == 1.0))
return 2.0;
......
......@@ -27,7 +27,7 @@ LynxADThermalBase<compute_stage>::LynxADThermalBase(const InputParameters & para
// _coupled_porosity(isCoupled("porosity")),
_porosity(isCoupled("porosity") ? adCoupledValue("porosity") : adZeroValue()),
_heat_source(isParamValid("radiogenic_heat_production")
? this->getLynxParam("radiogenic_heat_production")
? getLynxParam("radiogenic_heat_production")
: std::vector<Real>(_n_composition, 0.0)),
_coupled_dens(hasMaterialProperty<Real>("solid_density")),
_rho_f(_coupled_dens ? &getADMaterialProperty<Real>("fluid_density") : nullptr),
......@@ -94,7 +94,7 @@ LynxADThermalBase<compute_stage>::computeQpThermalSource()
{
// In this material, we compute only radiogenic heat production
// In LynxElasticRheology, we compute shear heating and adiabatic heating
_radiogenic_heat[_qp] = this->averageProperty(_heat_source);
_radiogenic_heat[_qp] = averageProperty(_heat_source);
}
template <ComputeStage compute_stage>
......
......@@ -34,18 +34,18 @@ template <ComputeStage compute_stage>
LynxADThermalConstant<compute_stage>::LynxADThermalConstant(const InputParameters & parameters)
: LynxADThermalBase<compute_stage>(parameters),
_fluid_thermal_cond(isParamValid("fluid_thermal_conductivity")
? this->getLynxParam("fluid_thermal_conductivity")
? getLynxParam("fluid_thermal_conductivity")
: std::vector<Real>(_n_composition, 0.0)),
_solid_thermal_cond(this->getLynxParam("solid_thermal_conductivity")),
_fluid_heat_cap(isParamValid("fluid_heat_capacity") ? this->getLynxParam("fluid_heat_capacity")
_solid_thermal_cond(getLynxParam("solid_thermal_conductivity")),
_fluid_heat_cap(isParamValid("fluid_heat_capacity") ? getLynxParam("fluid_heat_capacity")
: std::vector<Real>(_n_composition, 0.0)),
_solid_heat_cap(isParamValid("solid_heat_capacity") ? this->getLynxParam("solid_heat_capacity")
_solid_heat_cap(isParamValid("solid_heat_capacity") ? getLynxParam("solid_heat_capacity")
: std::vector<Real>(_n_composition, 0.0)),
_fluid_thermal_exp(isParamValid("fluid_thermal_expansion")
? this->getLynxParam("fluid_thermal_expansion")
? getLynxParam("fluid_thermal_expansion")
: std::vector<Real>(_n_composition, 0.0)),
_solid_thermal_exp(isParamValid("solid_thermal_expansion")
? this->getLynxParam("solid_thermal_expansion")
? getLynxParam("solid_thermal_expansion")
: std::vector<Real>(_n_composition, 0.0))
{
}
......@@ -54,24 +54,24 @@ template <ComputeStage compute_stage>
void
LynxADThermalConstant<compute_stage>::computeQpHeatCap()
{
_c_f[_qp] = this->averageProperty(_fluid_heat_cap);
_c_s[_qp] = this->averageProperty(_solid_heat_cap);
_c_f[_qp] = averageProperty(_fluid_heat_cap);
_c_s[_qp] = averageProperty(_solid_heat_cap);
}
template <ComputeStage compute_stage>
void
LynxADThermalConstant<compute_stage>::computeQpThermalCond()
{
_lambda_f[_qp] = this->averageProperty(_fluid_thermal_cond);
_lambda_s[_qp] = this->averageProperty(_solid_thermal_cond);
_lambda_f[_qp] = averageProperty(_fluid_thermal_cond);
_lambda_s[_qp] = averageProperty(_solid_thermal_cond);
}
template <ComputeStage compute_stage>
void
LynxADThermalConstant<compute_stage>::computeQpThermalExp()
{
_beta_f[_qp] = this->averageProperty(_fluid_thermal_exp);
_beta_s[_qp] = this->averageProperty(_solid_thermal_exp);
_beta_f[_qp] = averageProperty(_fluid_thermal_exp);
_beta_s[_qp] = averageProperty(_solid_thermal_exp);
}
adBaseClass(LynxADThermalConstant);
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment