https://mooseframework.inl.gov
PorousFlowHeatAdvection.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 
15 template <bool is_ad>
18 {
20  params.addClassDescription("Fully-upwinded heat flux, advected by the fluid");
21  return params;
22 }
23 
24 template <bool is_ad>
26  const InputParameters & parameters)
27  : PorousFlowDarcyBaseTempl<is_ad>(parameters),
28  _enthalpy(this->template getGenericMaterialProperty<std::vector<Real>, is_ad>(
29  "PorousFlow_fluid_phase_enthalpy_nodal")),
30  _denthalpy_dvar(is_ad ? nullptr
31  : &this->template getMaterialProperty<std::vector<std::vector<Real>>>(
32  "dPorousFlow_fluid_phase_enthalpy_nodal_dvar")),
33  _relative_permeability(this->template getGenericMaterialProperty<std::vector<Real>, is_ad>(
34  "PorousFlow_relative_permeability_nodal")),
35  _drelative_permeability_dvar(
36  is_ad ? nullptr
37  : &this->template getMaterialProperty<std::vector<std::vector<Real>>>(
38  "dPorousFlow_relative_permeability_nodal_dvar"))
39 {
40 }
41 
42 template <bool is_ad>
44 PorousFlowHeatAdvectionTempl<is_ad>::mobility(unsigned nodenum, unsigned phase) const
45 {
46  return _enthalpy[nodenum][phase] * _fluid_density_node[nodenum][phase] *
47  _relative_permeability[nodenum][phase] / _fluid_viscosity[nodenum][phase];
48 }
49 
50 template <bool is_ad>
51 Real
53  unsigned phase,
54  unsigned pvar) const
55 {
56  if constexpr (!is_ad)
57  {
58  Real dm = (*_denthalpy_dvar)[nodenum][phase][pvar] * _fluid_density_node[nodenum][phase] *
59  _relative_permeability[nodenum][phase] / _fluid_viscosity[nodenum][phase];
60  dm += _enthalpy[nodenum][phase] * (*_dfluid_density_node_dvar)[nodenum][phase][pvar] *
61  _relative_permeability[nodenum][phase] / _fluid_viscosity[nodenum][phase];
62  dm += _enthalpy[nodenum][phase] * _fluid_density_node[nodenum][phase] *
63  (*_drelative_permeability_dvar)[nodenum][phase][pvar] / _fluid_viscosity[nodenum][phase];
64  dm -= _enthalpy[nodenum][phase] * _fluid_density_node[nodenum][phase] *
65  _relative_permeability[nodenum][phase] * (*_dfluid_viscosity_dvar)[nodenum][phase][pvar] /
66  std::pow(_fluid_viscosity[nodenum][phase], 2);
67  return dm;
68  }
69  else
70  libmesh_ignore(nodenum, phase, pvar);
71  return 0.0;
72 }
73 
Moose::GenericType< Real, is_ad > GenericReal
static InputParameters validParams()
PetscErrorCode PetscOptionItems *PetscErrorCode DM dm
Darcy advective flux.
void libmesh_ignore(const Args &...)
registerMooseObject("PorousFlowApp", PorousFlowHeatAdvection)
static InputParameters validParams()
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
PorousFlowHeatAdvectionTempl(const InputParameters &parameters)
virtual GenericReal< is_ad > mobility(unsigned nodenum, unsigned phase) const override
The mobility of the fluid.
virtual Real dmobility(unsigned nodenum, unsigned phase, unsigned pvar) const override
The derivative of mobility with respect to PorousFlow variable pvar – non-AD path only...
Advection of heat via flux of component k in fluid phase alpha.
void addClassDescription(const std::string &doc_string)
MooseUnits pow(const MooseUnits &, int)