https://mooseframework.inl.gov
Loading...
Searching...
No Matches
PorousFlowTemperature.C
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
11
14
15template <bool is_ad>
18{
20 params.addCoupledVar("temperature",
21 293.0,
22 "Fluid temperature variable. Note, the default is suitable if your "
23 "simulation is using Kelvin units, but probably not for Celsius");
24 params.addPrivateParam<std::string>("pf_material_type", "temperature");
25 params.addClassDescription("Material to provide temperature at the quadpoints or nodes and "
26 "derivatives of it with respect to the PorousFlow variables");
27 return params;
28}
29
30template <bool is_ad>
32 : PorousFlowMaterial(parameters),
33
34 _num_pf_vars(_dictator.numVariables()),
35 _is_temp_nodal(isCoupled("temperature") ? getFieldVar("temperature", 0)->isNodal() : false),
36 _temperature_var(_nodal_material && _is_temp_nodal
37 ? coupledGenericDofValue<is_ad>("temperature")
38 : coupledGenericValue<is_ad>("temperature")),
39 _grad_temperature_var(_nodal_material ? nullptr
40 : &coupledGenericGradient<is_ad>("temperature")),
41 _temperature_is_PF(_dictator.isPorousFlowVariable(coupled("temperature"))),
42 _t_var_num(_temperature_is_PF ? _dictator.porousFlowVariableNum(coupled("temperature")) : 0),
43
44 _temperature(_nodal_material
45 ? declareGenericProperty<Real, is_ad>("PorousFlow_temperature_nodal")
46 : declareGenericProperty<Real, is_ad>("PorousFlow_temperature_qp")),
47 _dtemperature_dvar(
48 is_ad ? nullptr
49 : _nodal_material
50 ? &declareProperty<std::vector<Real>>("dPorousFlow_temperature_nodal_dvar")
51 : &declareProperty<std::vector<Real>>("dPorousFlow_temperature_qp_dvar")),
52 _grad_temperature((_nodal_material) ? nullptr
53 : &declareGenericProperty<RealGradient, is_ad>(
54 "PorousFlow_grad_temperature_qp")),
55 _dgrad_temperature_dgradv(
56 (_nodal_material || is_ad)
57 ? nullptr
58 : &declareProperty<std::vector<Real>>("dPorousFlow_grad_temperature_qp_dgradvar")),
59 _dgrad_temperature_dv((_nodal_material || is_ad) ? nullptr
60 : &declareProperty<std::vector<RealGradient>>(
61 "dPorousFlow_grad_temperature_qp_dvar"))
62{
63}
64
65template <bool is_ad>
66void
71
72template <bool is_ad>
73void
75{
76 _temperature[_qp] = _temperature_var[_qp];
77
78 if (!_nodal_material)
79 (*_grad_temperature)[_qp] = (*_grad_temperature_var)[_qp];
80
81 if (!is_ad)
82 {
83 (*_dtemperature_dvar)[_qp].assign(_num_pf_vars, 0.0);
84 if (_temperature_is_PF)
85 // _temperature is a PorousFlow variable
86 (*_dtemperature_dvar)[_qp][_t_var_num] = 1.0;
87
88 if (!_nodal_material)
89 {
90 (*_dgrad_temperature_dgradv)[_qp].assign(_num_pf_vars, 0.0);
91 (*_dgrad_temperature_dv)[_qp].assign(_num_pf_vars, RealGradient());
92 if (_temperature_is_PF)
93 (*_dgrad_temperature_dgradv)[_qp][_t_var_num] = 1.0;
94 }
95 }
96}
97
registerMooseObject("PorousFlowApp", PorousFlowTemperature)
void addPrivateParam(const std::string &name, const T &value)
void addClassDescription(const std::string &doc_string)
void addCoupledVar(const std::string &name, const std::string &doc_string)
PorousFlowMaterial is the base class for all PorousFlow Materials It allows users to specify that the...
static InputParameters validParams()
Creates temperature Materials.
virtual void initQpStatefulProperties() override
virtual void computeQpProperties() override
PorousFlowTemperatureTempl(const InputParameters &parameters)
static InputParameters validParams()