www.mooseframework.org
PorousFlowAdvectiveFluxCalculatorSaturated.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 
14 template <>
15 InputParameters
17 {
18  InputParameters params = validParams<PorousFlowAdvectiveFluxCalculatorBase>();
19  params.addClassDescription(
20  "Computes the advective flux of fluid of given phase, assuming fully-saturated conditions. "
21  "Hence this UserObject is only relevant to single-phase situations. Explicitly, the "
22  "UserObject computes (density / viscosity) * (- permeability * (grad(P) - density * "
23  "gravity)), using the Kuzmin-Turek FEM-TVD multidimensional stabilization scheme");
24  params.addParam<bool>(
25  "multiply_by_density",
26  true,
27  "If true, then the advective flux will be multiplied by density, so it is a mass flux, which "
28  "is the most common way of using PorousFlow. If false, then the advective flux will be a "
29  "volume flux, which is common in poro-mechanics");
30  return params;
31 }
32 
34  const InputParameters & parameters)
36  _multiply_by_density(getParam<bool>("multiply_by_density")),
37  _fluid_density_node(_multiply_by_density ? &getMaterialProperty<std::vector<Real>>(
38  "PorousFlow_fluid_phase_density_nodal")
39  : nullptr),
40  _dfluid_density_node_dvar(_multiply_by_density
41  ? &getMaterialProperty<std::vector<std::vector<Real>>>(
42  "dPorousFlow_fluid_phase_density_nodal_dvar")
43  : nullptr),
44  _fluid_viscosity(getMaterialProperty<std::vector<Real>>("PorousFlow_viscosity_nodal")),
45  _dfluid_viscosity_dvar(
46  getMaterialProperty<std::vector<std::vector<Real>>>("dPorousFlow_viscosity_nodal_dvar"))
47 {
48 }
49 
50 Real
52 {
53  // The following is but one choice.
54  // If you change this, you will probably have to change
55  // - computeVelocity
56  // - the derivative in executeOnElement
57  // - computedU_dvar
60  return 1.0 / _fluid_viscosity[i][_phase];
61 }
62 
63 Real
65 {
66  Real du = -_dfluid_viscosity_dvar[i][_phase][pvar] / std::pow(_fluid_viscosity[i][_phase], 2);
68  du = du * (*_fluid_density_node)[i][_phase] +
69  (*_dfluid_density_node_dvar)[i][_phase][pvar] / _fluid_viscosity[i][_phase];
70  return du;
71 }
registerMooseObject("PorousFlowApp", PorousFlowAdvectiveFluxCalculatorSaturated)
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 > > & _fluid_viscosity
Viscosity of each component in each phase.
Base class to compute the advective flux of fluid in PorousFlow situations using the Kuzmin-Turek FEM...
const MaterialProperty< std::vector< Real > > *const _fluid_density_node
Fluid density for each phase (at the node)
const bool _multiply_by_density
Whether to multiply the flux by the fluid density.
virtual Real computeU(unsigned i) const override
Computes the value of u at the local node id of the current element (_current_elem) ...
PorousFlowAdvectiveFluxCalculatorSaturated(const InputParameters &parameters)
InputParameters validParams< PorousFlowAdvectiveFluxCalculatorBase >()
ExpressionBuilder::EBTerm pow(const ExpressionBuilder::EBTerm &left, T exponent)
virtual Real computedU_dvar(unsigned i, unsigned pvar) const override
Compute d(u)/d(porous_flow_variable)
Computes the advective flux of fluid of given phase, assuming fully-saturated conditions.
InputParameters validParams< PorousFlowAdvectiveFluxCalculatorSaturated >()