13 #include "libmesh/quadrature.h" 27 params.
addParam<
Real>(
"thermal_conductivity",
"The thermal conductivity value");
28 params.
addParam<FunctionName>(
"thermal_conductivity_temperature_function",
30 "Thermal conductivity as a function of temperature.");
32 "Minimum allowable value for temperature for evaluating properties " 33 "when provided by functions");
35 params.
addParam<
Real>(
"specific_heat",
"The specific heat value");
37 "specific_heat_temperature_function",
"",
"Specific heat as a function of temperature.");
46 _has_temp(isCoupled(
"temp")),
47 _temperature(_has_temp ? coupledGenericValue<is_ad>(
"temp") : genericZeroValue<is_ad>()),
48 _my_thermal_conductivity(
49 isParamValid(
"thermal_conductivity") ? getParam<
Real>(
"thermal_conductivity") : 0),
50 _my_specific_heat(isParamValid(
"specific_heat") ? getParam<
Real>(
"specific_heat") : 0),
52 _thermal_conductivity(declareGenericProperty<
Real, is_ad>(
"thermal_conductivity")),
53 _thermal_conductivity_dT(declareProperty<
Real>(
"thermal_conductivity_dT")),
54 _thermal_conductivity_temperature_function(
55 getParam<FunctionName>(
"thermal_conductivity_temperature_function") !=
"" 56 ? &getFunction(
"thermal_conductivity_temperature_function")
59 _specific_heat(declareGenericProperty<
Real, is_ad>(
"specific_heat")),
60 _specific_heat_temperature_function(
61 getParam<FunctionName>(
"specific_heat_temperature_function") !=
"" 62 ? &getFunction(
"specific_heat_temperature_function")
64 _specific_heat_dT(is_ad && !_specific_heat_temperature_function
66 : &declareGenericProperty<
Real, is_ad>(
"specific_heat_dT")),
67 _min_T(isParamValid(
"min_T") ? &getParam<
Real>(
"min_T") : nullptr)
70 paramError(
"thermal_conductivity_temperature_function",
71 "Must couple with temperature if using thermal conductivity function");
75 "Cannot define both thermal conductivity and thermal conductivity temperature function");
78 paramError(
"specific_heat_temperature_function",
79 "Must couple with temperature if using specific heat function");
82 mooseError(
"Cannot define both specific heat and specific heat temperature function");
89 auto qp_temperature = _temperature[_qp];
91 if (_has_temp && _min_T)
93 if (_temperature[_qp] < *_min_T)
95 flagSolutionWarning(
"Temperature below specified minimum (" + std::to_string(*_min_T) +
96 "). min_T will be used instead.");
97 qp_temperature = *_min_T;
101 if (_thermal_conductivity_temperature_function)
103 _thermal_conductivity[_qp] = _thermal_conductivity_temperature_function->value(qp_temperature);
104 _thermal_conductivity_dT[_qp] = _thermal_conductivity_temperature_function->timeDerivative(
109 _thermal_conductivity[_qp] = _my_thermal_conductivity;
110 _thermal_conductivity_dT[_qp] = 0;
113 if (_specific_heat_temperature_function)
115 _specific_heat[_qp] = _specific_heat_temperature_function->value(qp_temperature);
116 if (_specific_heat_dT)
117 (*_specific_heat_dT)[_qp] = _specific_heat_temperature_function->timeDerivative(
121 _specific_heat[_qp] = _my_specific_heat;
void paramError(const std::string ¶m, Args... args) const
registerMooseObject("HeatTransferApp", HeatConductionMaterial)
HeatConductionMaterialTempl(const InputParameters ¶meters)
const Function *const _thermal_conductivity_temperature_function
const Function *const _specific_heat_temperature_function
static InputParameters validParams()
Simple material with properties set as constants or by functions.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void mooseError(Args &&... args) const
bool isParamValid(const std::string &name) const
virtual void computeQpProperties() override
static InputParameters validParams()