https://mooseframework.inl.gov
Loading...
Searching...
No Matches
PorousFlowFullySaturatedUpwindHeatAdvection.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
15template <bool is_ad>
18{
20 params.addClassDescription("Heat advection by a fluid. The fluid is assumed to have a single "
21 "phase, and the advection is fully upwinded");
22 return params;
23}
24
25template <bool is_ad>
28 : PorousFlowDarcyBaseTempl<is_ad>(parameters),
29 _enthalpy(this->template getGenericMaterialProperty<std::vector<Real>, is_ad>(
30 "PorousFlow_fluid_phase_enthalpy_nodal")),
31 _denthalpy_dvar(is_ad ? nullptr
32 : &this->template getMaterialProperty<std::vector<std::vector<Real>>>(
33 "dPorousFlow_fluid_phase_enthalpy_nodal_dvar"))
34{
35 if (_dictator.numPhases() != 1)
36 mooseError("PorousFlowFullySaturatedUpwindHeatAdvection should not be used for multi-phase "
37 "scenarios as it does not include relative-permeability effects");
38}
39
40template <bool is_ad>
43 unsigned phase) const
44{
45 return _enthalpy[nodenum][phase] * _fluid_density_node[nodenum][phase] /
46 _fluid_viscosity[nodenum][phase];
47}
48
49template <bool is_ad>
50Real
52 unsigned phase,
53 unsigned pvar) const
54{
55 if constexpr (!is_ad)
56 {
57 Real dm = (*_denthalpy_dvar)[nodenum][phase][pvar] * _fluid_density_node[nodenum][phase] /
58 _fluid_viscosity[nodenum][phase];
59 dm += _enthalpy[nodenum][phase] * (*_dfluid_density_node_dvar)[nodenum][phase][pvar] /
60 _fluid_viscosity[nodenum][phase];
61 dm -= _enthalpy[nodenum][phase] * _fluid_density_node[nodenum][phase] *
62 (*_dfluid_viscosity_dvar)[nodenum][phase][pvar] /
63 Utility::pow<2>(_fluid_viscosity[nodenum][phase]);
64 return dm;
65 }
66 else
67 libmesh_ignore(nodenum, phase, pvar);
68 return 0.0;
69}
70
Moose::GenericType< Real, is_ad > GenericReal
PetscErrorCode PetscOptionItems *PetscErrorCode DM dm
registerMooseObject("PorousFlowApp", PorousFlowFullySaturatedUpwindHeatAdvection)
void addClassDescription(const std::string &doc_string)
void mooseError(Args &&... args) const
Darcy advective flux.
const PorousFlowDictator & _dictator
PorousFlowDictator UserObject.
static InputParameters validParams()
unsigned int numPhases() const
The number of fluid phases.
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.
virtual GenericReal< is_ad > mobility(unsigned nodenum, unsigned phase) const override
The mobility of the fluid.