13 #include "libmesh/quadrature.h" 26 params.
addParam<
Real>(
"thermal_conductivity",
"The thermal conductivity value");
27 params.
addParam<FunctionName>(
"thermal_conductivity_temperature_function",
29 "Thermal conductivity as a function of temperature.");
31 "Minimum allowable value for temperature for evaluating properties " 32 "when provided by functions");
34 params.
addParam<
Real>(
"specific_heat",
"The specific heat value");
36 "specific_heat_temperature_function",
"",
"Specific heat as a function of temperature.");
45 _has_temp(isCoupled(
"temp")),
46 _temperature(_has_temp ? coupledGenericValue<is_ad>(
"temp") : genericZeroValue<is_ad>()),
47 _my_thermal_conductivity(
48 isParamValid(
"thermal_conductivity") ? getParam<
Real>(
"thermal_conductivity") : 0),
49 _my_specific_heat(isParamValid(
"specific_heat") ? getParam<
Real>(
"specific_heat") : 0),
51 _thermal_conductivity(declareGenericProperty<
Real, is_ad>(
"thermal_conductivity")),
52 _thermal_conductivity_dT(declareProperty<
Real>(
"thermal_conductivity_dT")),
53 _thermal_conductivity_temperature_function(
54 getParam<FunctionName>(
"thermal_conductivity_temperature_function") !=
"" 55 ? &getFunction(
"thermal_conductivity_temperature_function")
58 _specific_heat(declareGenericProperty<
Real, is_ad>(
"specific_heat")),
59 _specific_heat_temperature_function(
60 getParam<FunctionName>(
"specific_heat_temperature_function") !=
"" 61 ? &getFunction(
"specific_heat_temperature_function")
63 _specific_heat_dT(is_ad && !_specific_heat_temperature_function
65 : &declareGenericProperty<
Real, is_ad>(
"specific_heat_dT")),
66 _min_T(isParamValid(
"min_T") ? &getParam<
Real>(
"min_T") : nullptr)
69 paramError(
"thermal_conductivity_temperature_function",
70 "Must couple with temperature if using thermal conductivity function");
74 "Cannot define both thermal conductivity and thermal conductivity temperature function");
77 paramError(
"specific_heat_temperature_function",
78 "Must couple with temperature if using specific heat function");
81 mooseError(
"Cannot define both specific heat and specific heat temperature function");
88 auto qp_temperature = _temperature[_qp];
90 if (_has_temp && _min_T)
92 if (_temperature[_qp] < *_min_T)
94 flagSolutionWarning(
"Temperature below specified minimum (" + std::to_string(*_min_T) +
95 "). min_T will be used instead.");
96 qp_temperature = *_min_T;
100 if (_thermal_conductivity_temperature_function)
102 _thermal_conductivity[_qp] = _thermal_conductivity_temperature_function->value(qp_temperature);
103 _thermal_conductivity_dT[_qp] = _thermal_conductivity_temperature_function->timeDerivative(
108 _thermal_conductivity[_qp] = _my_thermal_conductivity;
109 _thermal_conductivity_dT[_qp] = 0;
112 if (_specific_heat_temperature_function)
114 _specific_heat[_qp] = _specific_heat_temperature_function->value(qp_temperature);
115 if (_specific_heat_dT)
116 (*_specific_heat_dT)[_qp] = _specific_heat_temperature_function->timeDerivative(
120 _specific_heat[_qp] = _my_specific_heat;
registerMooseObject("HeatTransferApp", HeatConductionMaterial)
HeatConductionMaterialTempl(const InputParameters ¶meters)
const Function *const _thermal_conductivity_temperature_function
const Function *const _specific_heat_temperature_function
bool isParamValid(const std::string &name) const
static InputParameters validParams()
Simple material with properties set as constants or by functions.
void paramError(const std::string ¶m, Args... args) const
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void mooseError(Args &&... args) const
virtual void computeQpProperties() override
static InputParameters validParams()