www.mooseframework.org
PorousFlowTemperature.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
7 
9 
10 template <>
11 InputParameters
13 {
14  InputParameters params = validParams<PorousFlowMaterial>();
15  params.addCoupledVar("temperature", 20.0, "Fluid temperature variable");
16  params.addClassDescription("Material to provide temperature at the quadpoints or nodes and "
17  "derivatives of it with respect to the PorousFlow variables");
18  return params;
19 }
20 
21 PorousFlowTemperature::PorousFlowTemperature(const InputParameters & parameters)
22  : DerivativeMaterialInterface<PorousFlowMaterial>(parameters),
23 
24  _num_pf_vars(_dictator.numVariables()),
25  _temperature_var(_nodal_material ? coupledNodalValue("temperature")
26  : coupledValue("temperature")),
27  _grad_temperature_var(_nodal_material ? nullptr : &coupledGradient("temperature")),
28  _temperature_is_PF(_dictator.isPorousFlowVariable(coupled("temperature"))),
29  _t_var_num(_temperature_is_PF ? _dictator.porousFlowVariableNum(coupled("temperature")) : 0),
30 
31  _temperature(_nodal_material ? declareProperty<Real>("PorousFlow_temperature_nodal")
32  : declareProperty<Real>("PorousFlow_temperature_qp")),
33  _dtemperature_dvar(
34  _nodal_material ? declareProperty<std::vector<Real>>("dPorousFlow_temperature_nodal_dvar")
35  : declareProperty<std::vector<Real>>("dPorousFlow_temperature_qp_dvar")),
36  _grad_temperature(_nodal_material
37  ? nullptr
38  : &declareProperty<RealGradient>("PorousFlow_grad_temperature_qp")),
39  _dgrad_temperature_dgradv(_nodal_material ? nullptr
40  : &declareProperty<std::vector<Real>>(
41  "dPorousFlow_grad_temperature_qp_dgradvar")),
42  _dgrad_temperature_dv(_nodal_material ? nullptr
43  : &declareProperty<std::vector<RealGradient>>(
44  "dPorousFlow_grad_temperature_qp_dvar"))
45 {
46 }
47 
48 void
50 {
51  _temperature[_qp] = _temperature_var[_qp];
52 }
53 
54 void
56 {
57  _temperature[_qp] = _temperature_var[_qp];
58  _dtemperature_dvar[_qp].assign(_num_pf_vars, 0.0);
60  // _temperature is a PorousFlow variable
61  _dtemperature_dvar[_qp][_t_var_num] = 1.0;
62 
63  if (!_nodal_material)
64  {
65  (*_grad_temperature)[_qp] = (*_grad_temperature_var)[_qp];
66  (*_dgrad_temperature_dgradv)[_qp].assign(_num_pf_vars, 0.0);
67  (*_dgrad_temperature_dv)[_qp].assign(_num_pf_vars, RealGradient());
69  (*_dgrad_temperature_dgradv)[_qp][_t_var_num] = 1.0;
70  }
71 }
virtual void initQpStatefulProperties() override
PorousFlowTemperature(const InputParameters &parameters)
const bool _temperature_is_PF
Whether the temperature coupled variable is a PorousFlow variable.
const unsigned int _num_pf_vars
Number of PorousFlow variables.
MaterialProperty< std::vector< Real > > & _dtemperature_dvar
d(computed temperature)/d(PorousFlow variable)
MaterialProperty< Real > & _temperature
Computed temperature at quadpoints or nodes.
virtual void computeQpProperties() override
InputParameters validParams< PorousFlowMaterial >()
InputParameters validParams< PorousFlowTemperature >()
const VariableValue & _temperature_var
Variable value of temperature at quadpoints or nodes.
const unsigned int _t_var_num
the PorousFlow variable number of the temperature