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.addParam<std::vector<UserObjectName>>(
"relperm_UO",
36 "List of names of user objects that "
37 "define relative permeability. Only "
38 "needed if fully_upwind is used");
39 params.addParam<std::vector<UserObjectName>>(
41 "List of name of user objects that define effective saturation as a function of "
42 "pressure list. Only needed if fully_upwind is used");
43 params.addParam<std::vector<UserObjectName>>(
"density_UO",
44 "List of names of user objects that "
45 "define the fluid density. Only "
46 "needed if fully_upwind is used");
47 params.addRequiredParam<std::vector<Real>>(
48 "pressures",
"Tuple of pressure values. Must be monotonically increasing.");
49 params.addRequiredParam<std::vector<Real>>(
51 "Tuple of flux values (measured in kg.m^-2.s^-1 for use_mobility=false, and "
52 "in Pa.s^-1 if use_mobility=true). This flux is OUT of the medium: hence "
53 "positive values of flux means this will be a SINK, while negative values "
54 "indicate this flux will be a SOURCE. A piecewise-linear fit is performed to "
55 "the (pressure,bare_fluxes) pairs to obtain the flux at any arbitrary "
56 "pressure, and the first or last bare_flux values are used if the quad-point "
57 "pressure falls outside this range.");
58 params.addParam<FunctionName>(
"multiplying_fcn",
60 "If this function is provided, the flux "
61 "will be multiplied by this function. "
62 "This is useful for spatially or "
63 "temporally varying sinks");
64 params.addRequiredParam<UserObjectName>(
65 "richardsVarNames_UO",
"The UserObject that holds the list of Richards variable names.");
66 params.addParam<
bool>(
"fully_upwind",
false,
"Use full upwinding");
67 params.addParam<PostprocessorName>(
70 "An area postprocessor. If given, the bare_fluxes will be divided by this "
71 "quantity. This means the bare fluxes are measured in kg.s^-1. This is "
72 "useful for the case when you wish to provide the *total* flux, and let MOOSE "
73 "proportion it uniformly across the boundary. In that case you would have "
74 "use_mobility=false=use_relperm, and only one bare flux should be specified");
79 : IntegratedBC(parameters),
80 _use_mobility(getParam<bool>(
"use_mobility")),
81 _use_relperm(getParam<bool>(
"use_relperm")),
82 _fully_upwind(getParam<bool>(
"fully_upwind")),
84 _sink_func(getParam<std::vector<Real>>(
"pressures"),
85 getParam<std::vector<Real>>(
"bare_fluxes")),
87 _m_func(getFunction(
"multiplying_fcn")),
90 _num_p(_richards_name_UO.num_v()),
91 _pvar(_richards_name_UO.richards_var_num(_var.number())),
96 getParam<std::vector<UserObjectName>>(
"density_UO")[_pvar])
98 _seff_UO(_fully_upwind ? &getUserObjectByName<
RichardsSeff>(
99 getParam<std::vector<UserObjectName>>(
"seff_UO")[_pvar])
102 getParam<std::vector<UserObjectName>>(
"relperm_UO")[_pvar])
105 _area_pp(getPostprocessorValue(
"area_pp")),
109 _dnodal_density_dv(0),
111 _dnodal_relperm_dv(0),
113 _pp(getMaterialProperty<std::vector<Real>>(
"porepressure")),
114 _dpp_dv(getMaterialProperty<std::vector<std::vector<Real>>>(
"dporepressure_dv")),
116 _viscosity(getMaterialProperty<std::vector<Real>>(
"viscosity")),
117 _permeability(getMaterialProperty<RealTensorValue>(
"permeability")),
119 _dseff_dv(getMaterialProperty<std::vector<std::vector<Real>>>(
"ds_eff_dv")),
121 _rel_perm(getMaterialProperty<std::vector<Real>>(
"rel_perm")),
122 _drel_perm_dv(getMaterialProperty<std::vector<std::vector<Real>>>(
"drel_perm_dv")),
124 _density(getMaterialProperty<std::vector<Real>>(
"density")),
125 _ddensity_dv(getMaterialProperty<std::vector<std::vector<Real>>>(
"ddensity_dv"))
128 for (
unsigned int pnum = 0; pnum <
_num_p; ++pnum)
141 std::vector<Real> dseff_dp;
149 for (
unsigned int nodenum = 0; nodenum <
_num_nodes; ++nodenum)
156 for (
unsigned int ph = 0; ph <
_num_p; ++ph)
170 for (
unsigned int ph = 0; ph <
_num_p; ++ph)
180 IntegratedBC::computeResidual();
215 flux *=
_m_func.value(_t, _q_point[_qp]);
220 mooseError(
"RichardsPiecewiseLinearSink: flux is nonzero, but area is zero!\n");
234 IntegratedBC::computeJacobian();
248 IntegratedBC::computeJacobianBlock(jvar);
280 deriv = mob * deriv + mobp * flux;
299 deriv = mob * deriv + mobp * flux;
306 deriv *=
_m_func.value(_t, _q_point[_qp]);
311 mooseError(
"RichardsPiecewiseLinearSink: deriv is nonzero, but area is zero!\n");
317 return _test[_i][_qp] * deriv * phi;
std::vector< std::vector< Real > > _dnodal_density_dv
d(_nodal_density)/d(variable_ph) (variable_ph is the variable for phase=ph) These are used in the jac...
unsigned int _pvar
the moose internal variable number corresponding to the porepressure of this sink flux
const MaterialProperty< std::vector< Real > > & _density
fluid density (only the _pvar component is used)
unsigned int richards_var_num(unsigned int moose_var_num) const
the richards variable number
Base class for Richards relative permeability classes that provide relative permeability as a functio...
virtual Real relperm(Real seff) const =0
relative permeability as a function of effective saturation This must be over-ridden in your derived ...
const RichardsSeff * _seff_UO
user object defining the effective saturation. Only used if _fully_upwind = true
virtual void dseff(std::vector< const VariableValue * > p, unsigned int qp, std::vector< Real > &result) const =0
derivative(s) of effective saturation as a function of porepressure(s) at given quadpoint of the elem...
This holds maps between pressure_var or pressure_var, sat_var used in RichardsMaterial and kernels,...
Base class for effective saturation as a function of porepressure(s) The functions seff,...
virtual Real computeQpOffDiagJacobian(unsigned int jvar) override
const PostprocessorValue & _area_pp
area postprocessor. if given then all bare_fluxes are divided by this quantity
const MaterialProperty< std::vector< std::vector< Real > > > & _dpp_dv
d(porepressure_i)/d(variable_j)
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
const MaterialProperty< std::vector< Real > > & _pp
porepressure values (only the _pvar component is used)
std::vector< std::vector< Real > > _dnodal_relperm_dv
d(_nodal_relperm)/d(variable_ph) (variable_ph is the variable for phase=ph) These are used in the jac...
virtual Real computeQpResidual() override
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_p
number of richards variables
const MaterialProperty< std::vector< Real > > & _viscosity
viscosity (only the _pvar component is used)
Real jac(unsigned int wrt_num)
derivative of residual wrt the wrt_num Richards variable
unsigned int _num_nodes
number of nodes in this element. Only used if _fully_upwind = true
virtual Real computeQpJacobian() override
const VariableValue * nodal_var(unsigned int richards_var_num) const
The nodal variable values for the given richards_var_num To extract a the value of pressure variable ...
LinearInterpolation _sink_func
piecewise-linear function of porepressure (this defines the strength of the sink)
const MaterialProperty< std::vector< std::vector< Real > > > & _drel_perm_dv
d(relperm_i)/d(variable_j)
std::vector< Real > _nodal_density
nodal values of fluid density These are used if _fully_upwind = true
virtual void computeResidual() override
bool _use_relperm
whether to multiply the sink flux by relative permeability
const RichardsDensity * _density_UO
user object defining the density. Only used if _fully_upwind = true
registerMooseObject("RichardsApp", RichardsPiecewiseLinearSink)
InputParameters validParams< RichardsPiecewiseLinearSink >()
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 drelperm(Real seff) const =0
derivative of relative permeability wrt effective saturation This must be over-ridden in your derived...
std::vector< Real > _nodal_relperm
nodal values of relative permeability These are used if _fully_upwind = true
const Function & _m_func
sink flux gets multiplied by this function
std::vector< const VariableValue * > _ps_at_nodes
Holds the values of pressures at all the nodes of the element Only used if _fully_upwind = true Eg: _...
const MaterialProperty< RealTensorValue > & _permeability
permeability
virtual void computeJacobianBlock(MooseVariableFEBase &jvar) override
const MaterialProperty< std::vector< Real > > & _rel_perm
relative permeability (only the _pvar component is used)
Applies a flux sink to a boundary The sink is a piecewise linear function of porepressure (the "varia...
virtual void computeJacobian() override
const MaterialProperty< std::vector< std::vector< Real > > > & _ddensity_dv
d(density_i)/d(variable_j)
virtual Real seff(std::vector< const VariableValue * > p, unsigned int qp) const =0
effective saturation as a function of porepressure(s) at given quadpoint of the element
bool not_richards_var(unsigned int moose_var_num) const
returns true if moose_var_num is not a richards var
const RichardsRelPerm * _relperm_UO
user object defining the relative permeability. Only used if _fully_upwind = true
bool _fully_upwind
whether to use full upwinding
const RichardsVarNames & _richards_name_UO
holds info about the names and values of richards variable in the simulation
RichardsPiecewiseLinearSink(const InputParameters ¶meters)