https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
17template <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
28template <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
49template <bool is_ad>
52{
53 return _grad_test[_i][_qp] * (_la[_qp] * _grad_t[_qp]);
54}
55
56template <bool is_ad>
57Real
59{
60 if constexpr (!is_ad)
61 return computeQpOffDiagJacobian(_var.number());
62 return 0.0;
63}
64
65template <bool is_ad>
66Real
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
registerMooseObject("PorousFlowApp", PorousFlowHeatConduction)
static InputParameters validParams()
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
This holds maps between the nonlinear variables used in a PorousFlow simulation and the variable numb...
Kernel = grad(test) * thermal_conductivity * grad(temperature)
PorousFlowHeatConductionTempl(const InputParameters &parameters)
virtual Real computeQpOffDiagJacobian(unsigned int jvar) override
virtual Real computeQpJacobian() override
virtual GenericReal< is_ad > computeQpResidual() override