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