https://mooseframework.inl.gov
PorousFlowFullySaturatedAdvectiveFlux.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 
13 
16 {
18  params.addParam<unsigned int>(
19  "fluid_component", 0, "The index corresponding to the fluid component for this kernel");
20  params.addParam<bool>("multiply_by_density",
21  true,
22  "If true, then this Kernel is the fluid mass "
23  "flux. If false, then this Kernel is the "
24  "fluid volume flux (which is common in "
25  "poro-mechanics)");
26  params.addClassDescription("Fully-upwinded advective flux of the fluid component given by "
27  "fluid_component, in a single-phase fluid");
28  return params;
29 }
30 
32  const InputParameters & parameters)
33  : PorousFlowDarcyBase(parameters),
34  _mass_fractions(
35  getMaterialProperty<std::vector<std::vector<Real>>>("PorousFlow_mass_frac_nodal")),
36  _dmass_fractions_dvar(getMaterialProperty<std::vector<std::vector<std::vector<Real>>>>(
37  "dPorousFlow_mass_frac_nodal_dvar")),
38  _fluid_component(getParam<unsigned int>("fluid_component")),
39  _multiply_by_density(getParam<bool>("multiply_by_density"))
40 {
41  if (_dictator.numPhases() != 1)
42  mooseError(
43  "PorousFlowFullySaturatedAdvectiveFlux should not be used for multi-phase scenarios as "
44  "it does not include relative-permeability effects");
45 }
46 
47 Real
48 PorousFlowFullySaturatedAdvectiveFlux::mobility(unsigned nodenum, unsigned phase) const
49 {
50  if (_multiply_by_density == false)
51  return _mass_fractions[nodenum][phase][_fluid_component] / _fluid_viscosity[nodenum][phase];
52  return _mass_fractions[nodenum][phase][_fluid_component] * _fluid_density_node[nodenum][phase] /
53  _fluid_viscosity[nodenum][phase];
54 }
55 
56 Real
58  unsigned phase,
59  unsigned pvar) const
60 {
61  if (_multiply_by_density == false)
62  return _dmass_fractions_dvar[nodenum][phase][_fluid_component][pvar] /
63  _fluid_viscosity[nodenum][phase] -
64  _mass_fractions[nodenum][phase][_fluid_component] *
65  _dfluid_viscosity_dvar[nodenum][phase][pvar] /
66  Utility::pow<2>(_fluid_viscosity[nodenum][phase]);
67  Real dm = _dmass_fractions_dvar[nodenum][phase][_fluid_component][pvar] *
68  _fluid_density_node[nodenum][phase] / _fluid_viscosity[nodenum][phase];
69  dm += _mass_fractions[nodenum][phase][_fluid_component] *
70  _dfluid_density_node_dvar[nodenum][phase][pvar] / _fluid_viscosity[nodenum][phase];
71  dm -= _mass_fractions[nodenum][phase][_fluid_component] * _fluid_density_node[nodenum][phase] *
72  _dfluid_viscosity_dvar[nodenum][phase][pvar] /
73  Utility::pow<2>(_fluid_viscosity[nodenum][phase]);
74  return dm;
75 }
const MaterialProperty< std::vector< std::vector< Real > > > & _dfluid_density_node_dvar
Derivative of the fluid density for each phase wrt PorousFlow variables (at the node) ...
const bool _multiply_by_density
Whether the flux is multiplied by density (so it will be a mass flux) or not (it will be a volume flu...
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
const MaterialProperty< std::vector< Real > > & _fluid_viscosity
Viscosity of each component in each phase.
Darcy advective flux.
PetscErrorCode PetscOptionItems *PetscErrorCode DM dm
const unsigned int _fluid_component
Index of the fluid component that this kernel acts on.
const MaterialProperty< std::vector< std::vector< Real > > > & _dfluid_viscosity_dvar
Derivative of the fluid viscosity for each phase wrt PorousFlow variables.
static InputParameters validParams()
const PorousFlowDictator & _dictator
PorousFlowDictator UserObject.
unsigned int numPhases() const
The number of fluid phases.
const MaterialProperty< std::vector< std::vector< Real > > > & _mass_fractions
Mass fraction of each component in each phase.
registerMooseObject("PorousFlowApp", PorousFlowFullySaturatedAdvectiveFlux)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void mooseError(Args &&... args) const
void addClassDescription(const std::string &doc_string)
virtual Real mobility(unsigned nodenum, unsigned phase) const override
The mobility of the fluid.
Convective flux of component k in a single-phase fluid A fully-updwinded version is implemented...
void ErrorVector unsigned int
const MaterialProperty< std::vector< Real > > & _fluid_density_node
Fluid density for each phase (at the node)
const MaterialProperty< std::vector< std::vector< std::vector< Real > > > > & _dmass_fractions_dvar
Derivative of the mass fraction of each component in each phase wrt PorousFlow variables.
PorousFlowFullySaturatedAdvectiveFlux(const InputParameters &parameters)
virtual Real dmobility(unsigned nodenum, unsigned phase, unsigned pvar) const override
The derivative of mobility with respect to PorousFlow variable pvar.