www.mooseframework.org
PorousFlowAdvectiveFlux.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
7 
9 
10 template <>
11 InputParameters
13 {
14  InputParameters params = validParams<PorousFlowDarcyBase>();
15  params.addParam<unsigned int>(
16  "fluid_component", 0, "The index corresponding to the fluid component for this kernel");
17  params.addClassDescription(
18  "Fully-upwinded advective flux of the component given by fluid_component");
19  return params;
20 }
21 
22 PorousFlowAdvectiveFlux::PorousFlowAdvectiveFlux(const InputParameters & parameters)
23  : PorousFlowDarcyBase(parameters),
24  _mass_fractions(
25  getMaterialProperty<std::vector<std::vector<Real>>>("PorousFlow_mass_frac_nodal")),
26  _dmass_fractions_dvar(getMaterialProperty<std::vector<std::vector<std::vector<Real>>>>(
27  "dPorousFlow_mass_frac_nodal_dvar")),
28  _relative_permeability(
29  getMaterialProperty<std::vector<Real>>("PorousFlow_relative_permeability_nodal")),
30  _drelative_permeability_dvar(getMaterialProperty<std::vector<std::vector<Real>>>(
31  "dPorousFlow_relative_permeability_nodal_dvar")),
32  _fluid_component(getParam<unsigned int>("fluid_component"))
33 {
34 }
35 
36 Real
37 PorousFlowAdvectiveFlux::mobility(unsigned nodenum, unsigned phase) const
38 {
39  return _mass_fractions[nodenum][phase][_fluid_component] * _fluid_density_node[nodenum][phase] *
40  _relative_permeability[nodenum][phase] / _fluid_viscosity[nodenum][phase];
41 }
42 
43 Real
44 PorousFlowAdvectiveFlux::dmobility(unsigned nodenum, unsigned phase, unsigned pvar) const
45 {
46  Real dm = _dmass_fractions_dvar[nodenum][phase][_fluid_component][pvar] *
47  _fluid_density_node[nodenum][phase] * _relative_permeability[nodenum][phase] /
48  _fluid_viscosity[nodenum][phase];
49  dm += _mass_fractions[nodenum][phase][_fluid_component] *
50  _dfluid_density_node_dvar[nodenum][phase][pvar] * _relative_permeability[nodenum][phase] /
51  _fluid_viscosity[nodenum][phase];
52  dm += _mass_fractions[nodenum][phase][_fluid_component] * _fluid_density_node[nodenum][phase] *
53  _drelative_permeability_dvar[nodenum][phase][pvar] / _fluid_viscosity[nodenum][phase];
54  dm -= _mass_fractions[nodenum][phase][_fluid_component] * _fluid_density_node[nodenum][phase] *
55  _relative_permeability[nodenum][phase] * _dfluid_viscosity_dvar[nodenum][phase][pvar] /
56  std::pow(_fluid_viscosity[nodenum][phase], 2);
57  return dm;
58 }
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 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.
virtual Real dmobility(unsigned nodenum, unsigned phase, unsigned pvar) const override
The derivative of mobility with respect to PorousFlow variable pvar.
InputParameters validParams< 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.
InputParameters validParams< PorousFlowDarcyBase >()
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.
const MaterialProperty< std::vector< std::vector< Real > > > & _mass_fractions
Mass fraction of each component in each phase.
PorousFlowAdvectiveFlux(const InputParameters &parameters)
virtual Real mobility(unsigned nodenum, unsigned phase) const override
The mobility of the fluid.
ExpressionBuilder::EBTerm pow(const ExpressionBuilder::EBTerm &left, T exponent)
const MaterialProperty< std::vector< std::vector< Real > > > & _drelative_permeability_dvar
Derivative of relative permeability of each phase wrt PorousFlow variables.
const MaterialProperty< std::vector< Real > > & _fluid_density_node
Fluid density for each phase (at the node)