https://mooseframework.inl.gov
PorousFlowHeatConduction.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 
12 #include "MooseVariable.h"
13 
16 
17 template <bool is_ad>
20 {
22  params.addRequiredParam<UserObjectName>(
23  "PorousFlowDictator", "The UserObject that holds the list of PorousFlow variable names");
24  params.addClassDescription("Heat conduction in the Porous Flow module");
25  return params;
26 }
27 
28 template <bool is_ad>
30  const InputParameters & parameters)
31  : GenericKernel<is_ad>(parameters),
32  _dictator(this->template getUserObject<PorousFlowDictator>("PorousFlowDictator")),
33  _la(this->template getGenericMaterialProperty<RealTensorValue, is_ad>(
34  "PorousFlow_thermal_conductivity_qp")),
35  _dla_dvar(is_ad ? nullptr
36  : &this->template getMaterialProperty<std::vector<RealTensorValue>>(
37  "dPorousFlow_thermal_conductivity_qp_dvar")),
38  _grad_t(this->template getGenericMaterialProperty<RealGradient, is_ad>(
39  "PorousFlow_grad_temperature_qp")),
40  _dgrad_t_dvar(is_ad ? nullptr
41  : &this->template getMaterialProperty<std::vector<RealGradient>>(
42  "dPorousFlow_grad_temperature_qp_dvar")),
43  _dgrad_t_dgradvar(is_ad ? nullptr
44  : &this->template getMaterialProperty<std::vector<Real>>(
45  "dPorousFlow_grad_temperature_qp_dgradvar"))
46 {
47 }
48 
49 template <bool is_ad>
52 {
53  return _grad_test[_i][_qp] * (_la[_qp] * _grad_t[_qp]);
54 }
55 
56 template <bool is_ad>
57 Real
59 {
60  if constexpr (!is_ad)
61  return computeQpOffDiagJacobian(_var.number());
62  return 0.0;
63 }
64 
65 template <bool is_ad>
66 Real
68 {
69  if constexpr (!is_ad)
70  {
71  if (_dictator.notPorousFlowVariable(jvar))
72  return 0.0;
73  const unsigned int pvar = _dictator.porousFlowVariableNum(jvar);
74  return _grad_test[_i][_qp] *
75  (((*_dla_dvar)[_qp][pvar] * _grad_t[_qp] + _la[_qp] * (*_dgrad_t_dvar)[_qp][pvar]) *
76  _phi[_j][_qp] +
77  _la[_qp] * (*_dgrad_t_dgradvar)[_qp][pvar] * _grad_phi[_j][_qp]);
78  }
79  else
80  libmesh_ignore(jvar);
81  return 0.0;
82 }
83 
Moose::GenericType< Real, is_ad > GenericReal
static InputParameters validParams()
PorousFlowHeatConductionTempl(const InputParameters &parameters)
void addRequiredParam(const std::string &name, const std::string &doc_string)
TensorValue< Real > RealTensorValue
void libmesh_ignore(const Args &...)
Kernel = grad(test) * thermal_conductivity * grad(temperature)
static InputParameters validParams()
virtual Real computeQpJacobian() override
virtual GenericReal< is_ad > computeQpResidual() override
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
This holds maps between the nonlinear variables used in a PorousFlow simulation and the variable numb...
virtual Real computeQpOffDiagJacobian(unsigned int jvar) override
registerMooseObject("PorousFlowApp", PorousFlowHeatConduction)
void addClassDescription(const std::string &doc_string)