Go to the documentation of this file.
13 #include "MooseVariable.h"
24 InputParameters params = validParams<IntegratedBC>();
25 params.addRequiredParam<
bool>(
27 "If true, then fluxes are multiplied by (density*permeability_nn/viscosity), "
28 "where the '_nn' indicates the component normal to the boundary. In this "
29 "case bare_flux is measured in Pa.s^-1. This can be used in conjunction "
31 params.addRequiredParam<
bool>(
"use_relperm",
32 "If true, then fluxes are multiplied by relative "
33 "permeability. This can be used in conjunction "
35 params.addRequiredParam<std::vector<Real>>(
36 "pressures",
"Tuple of pressure values. Must be monotonically increasing.");
37 params.addRequiredParam<std::vector<Real>>(
39 "Tuple of flux values (measured in kg.m^-2.s^-1 for use_mobility=false, and "
40 "in Pa.s^-1 if use_mobility=true). This flux is OUT of the medium: hence "
41 "positive values of flux means this will be a SINK, while negative values "
42 "indicate this flux will be a SOURCE. A piecewise-linear fit is performed to "
43 "the (pressure,bare_fluxes) pairs to obtain the flux at any arbitrary "
44 "pressure, and the first or last bare_flux values are used if the quad-point "
45 "pressure falls outside this range.");
46 params.addParam<FunctionName>(
"multiplying_fcn",
48 "If this function is provided, the flux "
49 "will be multiplied by this function. "
50 "This is useful for spatially or "
51 "temporally varying sinks");
52 params.addRequiredParam<UserObjectName>(
54 "A RichardsDensity UserObject that defines the fluid density as a function of pressure.");
55 params.addRequiredParam<UserObjectName>(
57 "A RichardsRelPerm UserObject (eg RichardsRelPermPower) that defines the "
58 "fluid relative permeability as a function of the saturation Variable.");
59 params.addRequiredCoupledVar(
"other_var",
60 "The other variable in the 2-phase system. If "
61 "Variable=porepressure, the other_var=saturation, and "
63 params.addRequiredParam<
bool>(
"var_is_porepressure",
64 "This flag is needed to correctly calculate the Jacobian entries. "
65 "If set to true, this Sink will extract fluid from the phase with "
66 "porepressure as its Variable (usually the liquid phase). If set "
67 "to false, this Sink will extract fluid from the phase with "
68 "saturation as its variable (usually the gas phase)");
69 params.addRequiredParam<Real>(
"fluid_viscosity",
"The fluid dynamic viscosity");
70 params.addClassDescription(
"Sink of fluid, controlled by (pressure, bare_fluxes) interpolation. "
71 "This is for use in Q2P models");
76 : IntegratedBC(parameters),
77 _use_mobility(getParam<bool>(
"use_mobility")),
78 _use_relperm(getParam<bool>(
"use_relperm")),
79 _sink_func(getParam<std::vector<Real>>(
"pressures"),
80 getParam<std::vector<Real>>(
"bare_fluxes")),
81 _m_func(getFunction(
"multiplying_fcn")),
84 _other_var_nodal(coupledDofValues(
"other_var")),
85 _other_var_num(coupled(
"other_var")),
86 _var_is_pp(getParam<bool>(
"var_is_porepressure")),
87 _viscosity(getParam<Real>(
"fluid_viscosity")),
88 _permeability(getMaterialProperty<RealTensorValue>(
"permeability")),
93 _dnodal_density_dp(0),
109 for (
unsigned int nodenum = 0; nodenum <
_num_nodes; ++nodenum)
111 _pp[nodenum] = _var.dofValues()[nodenum];
117 for (
unsigned int nodenum = 0; nodenum <
_num_nodes; ++nodenum)
120 _sat[nodenum] = _var.dofValues()[nodenum];
129 for (
unsigned int nodenum = 0; nodenum <
_num_nodes; ++nodenum)
140 for (
unsigned int nodenum = 0; nodenum <
_num_nodes; ++nodenum)
152 IntegratedBC::computeResidual();
172 flux *=
_m_func.value(_t, _q_point[_qp]);
181 IntegratedBC::computeJacobian();
187 return jac(_var.number());
194 IntegratedBC::computeJacobianBlock(jvar);
224 if (wrt_num == _var.number())
234 if (wrt_num == _var.number())
236 deriv = mob * deriv + mobp * flux;
264 deriv = mob * deriv + mobp * flux;
271 if (wrt_num == _var.number())
278 deriv *=
_m_func.value(_t, _q_point[_qp]);
280 return _test[_i][_qp] * deriv * phi;
const MaterialProperty< RealTensorValue > & _permeability
permeability
std::vector< Real > _nodal_relperm
nodal values of relative permeability
Base class for Richards relative permeability classes that provide relative permeability as a functio...
virtual Real computeQpJacobian() override
virtual Real relperm(Real seff) const =0
relative permeability as a function of effective saturation This must be over-ridden in your derived ...
Applies a fully-upwinded flux sink to a boundary The sink is a piecewise linear function of porepress...
std::vector< Real > _pp
nodal values of porepressure
const VariableValue & _other_var_nodal
the other variable in the 2-phase system (this is saturation if Variable=porepressure,...
std::vector< Real > _dnodal_relperm_ds
d(_nodal_relperm)/d(saturation)
bool _use_mobility
whether to multiply the sink flux by permeability*density/viscosity
void prepareNodalValues()
calculates the nodal values of pressure, mobility, and derivatives thereof
Q2PPiecewiseLinearSink(const InputParameters ¶meters)
const RichardsRelPerm & _relperm
fluid relative permeability
virtual Real density(Real p) const =0
fluid density as a function of porepressure This must be over-ridden in derived classes to provide an...
unsigned int _num_nodes
number of nodes in this element.
const RichardsDensity & _density
fluid density
std::vector< Real > _sat
nodal values of saturation
virtual void computeResidual() override
virtual void computeJacobianBlock(MooseVariableFEBase &jvar) override
InputParameters validParams< Q2PPiecewiseLinearSink >()
bool _var_is_pp
whether the Variable for this BC is porepressure or not
bool _use_relperm
whether to multiply the sink flux by relative permeability
Real jac(unsigned int wrt_num)
derivative of residual wrt the wrt_num variable
Base class for fluid density as a function of porepressure The functions density, ddensity and d2dens...
virtual Real ddensity(Real p) const =0
derivative of fluid density wrt porepressure This must be over-ridden in derived classes to provide a...
virtual Real computeQpOffDiagJacobian(unsigned int jvar) override
registerMooseObject("RichardsApp", Q2PPiecewiseLinearSink)
virtual Real drelperm(Real seff) const =0
derivative of relative permeability wrt effective saturation This must be over-ridden in your derived...
const Function & _m_func
sink flux gets multiplied by this function
unsigned int _other_var_num
the variable number of the other variable
std::vector< Real > _nodal_density
nodal values of fluid density
std::vector< Real > _dnodal_density_dp
d(_nodal_density)/d(porepressure)
virtual void computeJacobian() override
virtual Real computeQpResidual() override
LinearInterpolation _sink_func
piecewise-linear function of porepressure (this defines the strength of the sink)