https://mooseframework.inl.gov
RichardsPiecewiseLinearSinkFlux.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 
10 // This post processor returns the mass due to a flux from the boundary of a volume.
11 //
13 #include "Function.h"
14 
16 
19 {
21  params.addRequiredParam<bool>(
22  "use_mobility",
23  "If true, then fluxes are multiplied by (density*permeability_nn/viscosity), "
24  "where the '_nn' indicates the component normal to the boundary. In this "
25  "case bare_flux is measured in Pa.s^-1. This can be used in conjunction "
26  "with use_relperm.");
27  params.addRequiredParam<bool>("use_relperm",
28  "If true, then fluxes are multiplied by relative "
29  "permeability. This can be used in conjunction "
30  "with use_mobility");
31  params.addRequiredParam<std::vector<Real>>(
32  "pressures", "Tuple of pressure values. Must be monotonically increasing.");
33  params.addRequiredParam<std::vector<Real>>(
34  "bare_fluxes",
35  "Tuple of flux values (measured in kg.m^-2.s^-1 for use_mobility=false, and "
36  "in Pa.s^-1 if use_mobility=true). This flux is OUT of the medium: hence "
37  "positive values of flux means this will be a SINK, while negative values "
38  "indicate this flux will be a SOURCE. A piecewise-linear fit is performed to "
39  "the (pressure,bare_fluxes) pairs to obtain the flux at any arbitrary "
40  "pressure, and the first or last bare_flux values are used if the quad-point "
41  "pressure falls outside this range.");
42  params.addRequiredParam<UserObjectName>(
43  "richardsVarNames_UO", "The UserObject that holds the list of Richards variable names.");
44  params.addParam<FunctionName>("multiplying_fcn",
45  1.0,
46  "The flux will be multiplied by this spatially-and-temporally "
47  "varying function. This is useful if the boundary is a moving "
48  "boundary controlled by RichardsExcav.");
49  params.addClassDescription("Records the fluid flow into a sink (positive values indicate fluid "
50  "is flowing from porespace into the sink).");
51  return params;
52 }
53 
56  _sink_func(getParam<std::vector<Real>>("pressures"),
57  getParam<std::vector<Real>>("bare_fluxes")),
58 
59  _use_mobility(getParam<bool>("use_mobility")),
60  _use_relperm(getParam<bool>("use_relperm")),
61 
62  _m_func(getFunction("multiplying_fcn")),
63 
64  _richards_name_UO(getUserObject<RichardsVarNames>("richardsVarNames_UO")),
65  _pvar(_richards_name_UO.richards_var_num(coupled("variable"))),
66 
67  _pp(getMaterialProperty<std::vector<Real>>("porepressure")),
68 
69  _viscosity(getMaterialProperty<std::vector<Real>>("viscosity")),
70  _permeability(getMaterialProperty<RealTensorValue>("permeability")),
71  _rel_perm(getMaterialProperty<std::vector<Real>>("rel_perm")),
72  _density(getMaterialProperty<std::vector<Real>>("density"))
73 {
74 }
75 
76 Real
78 {
79  Real flux = _sink_func.sample(_pp[_qp][_pvar]);
80 
81  flux *= _m_func.value(_t, _q_point[_qp]);
82 
83  if (_use_mobility)
84  {
86  flux *= _density[_qp][_pvar] * k / _viscosity[_qp][_pvar];
87  }
88  if (_use_relperm)
89  flux *= _rel_perm[_qp][_pvar];
90 
91  return flux * _dt;
92 }
const MaterialProperty< std::vector< Real > > & _density
fluid density
LinearInterpolation _sink_func
the sink function, which is a piecewise linear function of porepressure values
const MaterialProperty< std::vector< Real > > & _pp
porepressure values (only the _pvar component is used)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
registerMooseObject("RichardsApp", RichardsPiecewiseLinearSinkFlux)
static InputParameters validParams()
T sample(const T &x) const
const MooseArray< Point > & _q_point
This holds maps between pressure_var or pressure_var, sat_var used in RichardsMaterial and kernels...
bool _use_mobility
whether to include density*permeability_nn/viscosity in the flux
void addRequiredParam(const std::string &name, const std::string &doc_string)
const MaterialProperty< RealTensorValue > & _permeability
medium permeability
TensorValue< Real > RealTensorValue
unsigned int _pvar
the index into _richards_name_UO corresponding to this Postprocessor&#39;s variable eg, if the richards names are &#39;pwater pgas poil pplasma&#39; and the variable of this Postprocessor is pgas, then _pvar=1
const MaterialProperty< std::vector< Real > > & _rel_perm
fluid relative permeability
bool _use_relperm
whether to include relative permeability in the flux
This postprocessor computes the fluid flux to a RichardsPiecewiseLinearSink.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const MooseArray< Point > & _normals
void addClassDescription(const std::string &doc_string)
RichardsPiecewiseLinearSinkFlux(const InputParameters &parameters)
virtual Real value(Real t, const Point &p) const
const MaterialProperty< std::vector< Real > > & _viscosity
fluid viscosity
static const std::string k
Definition: NS.h:130
const Function & _m_func
the multiplier function