www.mooseframework.org
PorousFlowTemperature.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 
10 #include "PorousFlowTemperature.h"
11 
13 
14 template <>
15 InputParameters
17 {
18  InputParameters params = validParams<PorousFlowMaterial>();
19  params.addCoupledVar("temperature", 20.0, "Fluid temperature variable");
20  params.addPrivateParam<std::string>("pf_material_type", "temperature");
21  params.addClassDescription("Material to provide temperature at the quadpoints or nodes and "
22  "derivatives of it with respect to the PorousFlow variables");
23  return params;
24 }
25 
26 PorousFlowTemperature::PorousFlowTemperature(const InputParameters & parameters)
27  : DerivativeMaterialInterface<PorousFlowMaterial>(parameters),
28 
29  _num_pf_vars(_dictator.numVariables()),
30  _temperature_var(_nodal_material ? coupledDofValues("temperature")
31  : coupledValue("temperature")),
32  _grad_temperature_var(_nodal_material ? nullptr : &coupledGradient("temperature")),
33  _temperature_is_PF(_dictator.isPorousFlowVariable(coupled("temperature"))),
34  _t_var_num(_temperature_is_PF ? _dictator.porousFlowVariableNum(coupled("temperature")) : 0),
35 
36  _temperature(_nodal_material ? declareProperty<Real>("PorousFlow_temperature_nodal")
37  : declareProperty<Real>("PorousFlow_temperature_qp")),
38  _dtemperature_dvar(
39  _nodal_material ? declareProperty<std::vector<Real>>("dPorousFlow_temperature_nodal_dvar")
40  : declareProperty<std::vector<Real>>("dPorousFlow_temperature_qp_dvar")),
41  _grad_temperature(_nodal_material
42  ? nullptr
43  : &declareProperty<RealGradient>("PorousFlow_grad_temperature_qp")),
44  _dgrad_temperature_dgradv(_nodal_material ? nullptr
45  : &declareProperty<std::vector<Real>>(
46  "dPorousFlow_grad_temperature_qp_dgradvar")),
47  _dgrad_temperature_dv(_nodal_material ? nullptr
48  : &declareProperty<std::vector<RealGradient>>(
49  "dPorousFlow_grad_temperature_qp_dvar"))
50 {
51 }
52 
53 void
55 {
57 }
58 
59 void
61 {
62  _temperature[_qp] = _temperature_var[_qp];
63  _dtemperature_dvar[_qp].assign(_num_pf_vars, 0.0);
65  // _temperature is a PorousFlow variable
66  _dtemperature_dvar[_qp][_t_var_num] = 1.0;
67 
68  if (!_nodal_material)
69  {
70  (*_grad_temperature)[_qp] = (*_grad_temperature_var)[_qp];
71  (*_dgrad_temperature_dgradv)[_qp].assign(_num_pf_vars, 0.0);
72  (*_dgrad_temperature_dv)[_qp].assign(_num_pf_vars, RealGradient());
74  (*_dgrad_temperature_dgradv)[_qp][_t_var_num] = 1.0;
75  }
76 }
validParams< PorousFlowTemperature >
InputParameters validParams< PorousFlowTemperature >()
Definition: PorousFlowTemperature.C:16
validParams< PorousFlowMaterial >
InputParameters validParams< PorousFlowMaterial >()
Definition: PorousFlowMaterial.C:16
libMesh::RealGradient
VectorValue< Real > RealGradient
Definition: GrainForceAndTorqueInterface.h:17
PorousFlowTemperature::_temperature_var
const VariableValue & _temperature_var
Variable value of temperature at quadpoints or nodes.
Definition: PorousFlowTemperature.h:36
PorousFlowTemperature::initQpStatefulProperties
virtual void initQpStatefulProperties() override
Definition: PorousFlowTemperature.C:54
PorousFlowTemperature.h
PorousFlowTemperature::PorousFlowTemperature
PorousFlowTemperature(const InputParameters &parameters)
Definition: PorousFlowTemperature.C:26
PorousFlowMaterial
PorousFlowMaterial is the base class for all PorousFlow Materials It allows users to specify that the...
Definition: PorousFlowMaterial.h:40
PorousFlowTemperature
Creates temperature Materials.
Definition: PorousFlowTemperature.h:23
registerMooseObject
registerMooseObject("PorousFlowApp", PorousFlowTemperature)
PorousFlowTemperature::_t_var_num
const unsigned int _t_var_num
The PorousFlow variable number of the temperature.
Definition: PorousFlowTemperature.h:45
PorousFlowTemperature::_temperature_is_PF
const bool _temperature_is_PF
Whether the temperature coupled variable is a PorousFlow variable.
Definition: PorousFlowTemperature.h:42
PorousFlowTemperature::computeQpProperties
virtual void computeQpProperties() override
Definition: PorousFlowTemperature.C:60
PorousFlowTemperature::_dtemperature_dvar
MaterialProperty< std::vector< Real > > & _dtemperature_dvar
d(computed temperature)/d(PorousFlow variable)
Definition: PorousFlowTemperature.h:51
PorousFlowTemperature::_temperature
MaterialProperty< Real > & _temperature
Computed temperature at quadpoints or nodes.
Definition: PorousFlowTemperature.h:48
PorousFlowTemperature::_num_pf_vars
const unsigned int _num_pf_vars
Number of PorousFlow variables.
Definition: PorousFlowTemperature.h:33