www.mooseframework.org
PorousFlowAdvectiveFlux.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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.addClassDescription(
21  "Fully-upwinded advective flux of the component given by fluid_component");
22  return params;
23 }
24 
26  : PorousFlowDarcyBase(parameters),
27  _mass_fractions(
28  getMaterialProperty<std::vector<std::vector<Real>>>("PorousFlow_mass_frac_nodal")),
29  _dmass_fractions_dvar(getMaterialProperty<std::vector<std::vector<std::vector<Real>>>>(
30  "dPorousFlow_mass_frac_nodal_dvar")),
31  _relative_permeability(
32  getMaterialProperty<std::vector<Real>>("PorousFlow_relative_permeability_nodal")),
33  _drelative_permeability_dvar(getMaterialProperty<std::vector<std::vector<Real>>>(
34  "dPorousFlow_relative_permeability_nodal_dvar")),
35  _fluid_component(getParam<unsigned int>("fluid_component"))
36 {
38  paramError(
39  "fluid_component",
40  "The Dictator proclaims that the maximum fluid component index in this simulation is ",
42  " whereas you have used ",
44  ". Remember that indexing starts at 0. The Dictator does not take such mistakes lightly.");
45 }
46 
47 Real
48 PorousFlowAdvectiveFlux::mobility(unsigned nodenum, unsigned phase) const
49 {
50  return _mass_fractions[nodenum][phase][_fluid_component] * _fluid_density_node[nodenum][phase] *
51  _relative_permeability[nodenum][phase] / _fluid_viscosity[nodenum][phase];
52 }
53 
54 Real
55 PorousFlowAdvectiveFlux::dmobility(unsigned nodenum, unsigned phase, unsigned pvar) const
56 {
57  Real dm = _dmass_fractions_dvar[nodenum][phase][_fluid_component][pvar] *
58  _fluid_density_node[nodenum][phase] * _relative_permeability[nodenum][phase] /
59  _fluid_viscosity[nodenum][phase];
60  dm += _mass_fractions[nodenum][phase][_fluid_component] *
61  _dfluid_density_node_dvar[nodenum][phase][pvar] * _relative_permeability[nodenum][phase] /
62  _fluid_viscosity[nodenum][phase];
63  dm += _mass_fractions[nodenum][phase][_fluid_component] * _fluid_density_node[nodenum][phase] *
64  _drelative_permeability_dvar[nodenum][phase][pvar] / _fluid_viscosity[nodenum][phase];
65  dm -= _mass_fractions[nodenum][phase][_fluid_component] * _fluid_density_node[nodenum][phase] *
66  _relative_permeability[nodenum][phase] * _dfluid_viscosity_dvar[nodenum][phase][pvar] /
67  std::pow(_fluid_viscosity[nodenum][phase], 2);
68  return dm;
69 }
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) ...
static InputParameters validParams()
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
const unsigned int _fluid_component
Index of the fluid component that this kernel acts on.
const MaterialProperty< std::vector< Real > > & _fluid_viscosity
Viscosity of each component in each phase.
Darcy advective flux.
unsigned int numComponents() const
The number of fluid components.
registerMooseObject("PorousFlowApp", PorousFlowAdvectiveFlux)
const MaterialProperty< std::vector< std::vector< Real > > > & _dfluid_viscosity_dvar
Derivative of the fluid viscosity for each phase wrt PorousFlow variables.
const MaterialProperty< std::vector< Real > > & _relative_permeability
Relative permeability of each phase.
static InputParameters validParams()
const PorousFlowDictator & _dictator
PorousFlowDictator UserObject.
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.
virtual Real dmobility(unsigned nodenum, unsigned phase, unsigned pvar) const override
The derivative of mobility with respect to PorousFlow variable pvar.
const MaterialProperty< std::vector< std::vector< Real > > > & _mass_fractions
Mass fraction of each component in each phase.
void paramError(const std::string &param, Args... args) const
PorousFlowAdvectiveFlux(const InputParameters &parameters)
Convective flux of component k in fluid phase alpha.
const MaterialProperty< std::vector< std::vector< Real > > > & _drelative_permeability_dvar
Derivative of relative permeability of each phase wrt PorousFlow variables.
virtual Real mobility(unsigned nodenum, unsigned phase) const override
The mobility of the fluid.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void addClassDescription(const std::string &doc_string)
MooseUnits pow(const MooseUnits &, int)
void ErrorVector unsigned int
const MaterialProperty< std::vector< Real > > & _fluid_density_node
Fluid density for each phase (at the node)