www.mooseframework.org
RichardsPiecewiseLinearSinkFlux.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 
8 // This post processor returns the mass due to a flux from the boundary of a volume.
9 //
11 #include "Function.h"
12 
13 template <>
14 InputParameters
16 {
17  InputParameters params = validParams<SideIntegralVariablePostprocessor>();
18  params.addRequiredParam<bool>(
19  "use_mobility",
20  "If true, then fluxes are multiplied by (density*permeability_nn/viscosity), "
21  "where the '_nn' indicates the component normal to the boundary. In this "
22  "case bare_flux is measured in Pa.s^-1. This can be used in conjunction "
23  "with use_relperm.");
24  params.addRequiredParam<bool>("use_relperm",
25  "If true, then fluxes are multiplied by relative "
26  "permeability. This can be used in conjunction "
27  "with use_mobility");
28  params.addRequiredParam<std::vector<Real>>(
29  "pressures", "Tuple of pressure values. Must be monotonically increasing.");
30  params.addRequiredParam<std::vector<Real>>(
31  "bare_fluxes",
32  "Tuple of flux values (measured in kg.m^-2.s^-1 for use_mobility=false, and "
33  "in Pa.s^-1 if use_mobility=true). This flux is OUT of the medium: hence "
34  "positive values of flux means this will be a SINK, while negative values "
35  "indicate this flux will be a SOURCE. A piecewise-linear fit is performed to "
36  "the (pressure,bare_fluxes) pairs to obtain the flux at any arbitrary "
37  "pressure, and the first or last bare_flux values are used if the quad-point "
38  "pressure falls outside this range.");
39  params.addRequiredParam<UserObjectName>(
40  "richardsVarNames_UO", "The UserObject that holds the list of Richards variable names.");
41  params.addParam<FunctionName>("multiplying_fcn",
42  1.0,
43  "The flux will be multiplied by this spatially-and-temporally "
44  "varying function. This is useful if the boundary is a moving "
45  "boundary controlled by RichardsExcav.");
46  params.addClassDescription("Records the fluid flow into a sink (positive values indicate fluid "
47  "is flowing from porespace into the sink).");
48  return params;
49 }
50 
52  : SideIntegralVariablePostprocessor(parameters),
53  _sink_func(getParam<std::vector<Real>>("pressures"),
54  getParam<std::vector<Real>>("bare_fluxes")),
55 
56  _use_mobility(getParam<bool>("use_mobility")),
57  _use_relperm(getParam<bool>("use_relperm")),
58 
59  _m_func(getFunction("multiplying_fcn")),
60 
61  _richards_name_UO(getUserObject<RichardsVarNames>("richardsVarNames_UO")),
62  _pvar(_richards_name_UO.richards_var_num(coupled("variable"))),
63 
64  _pp(getMaterialProperty<std::vector<Real>>("porepressure")),
65 
66  _viscosity(getMaterialProperty<std::vector<Real>>("viscosity")),
67  _permeability(getMaterialProperty<RealTensorValue>("permeability")),
68  _rel_perm(getMaterialProperty<std::vector<Real>>("rel_perm")),
69  _density(getMaterialProperty<std::vector<Real>>("density"))
70 {
71 }
72 
73 Real
75 {
76  Real flux = _sink_func.sample(_pp[_qp][_pvar]);
77 
78  flux *= _m_func.value(_t, _q_point[_qp]);
79 
80  if (_use_mobility)
81  {
82  Real k = (_permeability[_qp] * _normals[_qp]) * _normals[_qp];
83  flux *= _density[_qp][_pvar] * k / _viscosity[_qp][_pvar];
84  }
85  if (_use_relperm)
86  flux *= _rel_perm[_qp][_pvar];
87 
88  return flux * _dt;
89 }
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)
InputParameters validParams< RichardsPiecewiseLinearSinkFlux >()
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
const MaterialProperty< RealTensorValue > & _permeability
medium permeability
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
Function & _m_func
the multiplier function
RichardsPiecewiseLinearSinkFlux(const InputParameters &parameters)
const MaterialProperty< std::vector< Real > > & _viscosity
fluid viscosity