26 "If true, then fluxes are multiplied by (density*permeability_nn/viscosity), " 27 "where the '_nn' indicates the component normal to the boundary. In this " 28 "case bare_flux is measured in Pa.s^-1. This can be used in conjunction " 31 "If true, then fluxes are multiplied by relative " 32 "permeability. This can be used in conjunction " 34 params.
addParam<std::vector<UserObjectName>>(
"relperm_UO",
35 "List of names of user objects that " 36 "define relative permeability. Only " 37 "needed if fully_upwind is used");
38 params.
addParam<std::vector<UserObjectName>>(
40 "List of name of user objects that define effective saturation as a function of " 41 "pressure list. Only needed if fully_upwind is used");
42 params.
addParam<std::vector<UserObjectName>>(
"density_UO",
43 "List of names of user objects that " 44 "define the fluid density. Only " 45 "needed if fully_upwind is used");
47 "pressures",
"Tuple of pressure values. Must be monotonically increasing.");
50 "Tuple of flux values (measured in kg.m^-2.s^-1 for use_mobility=false, and " 51 "in Pa.s^-1 if use_mobility=true). This flux is OUT of the medium: hence " 52 "positive values of flux means this will be a SINK, while negative values " 53 "indicate this flux will be a SOURCE. A piecewise-linear fit is performed to " 54 "the (pressure,bare_fluxes) pairs to obtain the flux at any arbitrary " 55 "pressure, and the first or last bare_flux values are used if the quad-point " 56 "pressure falls outside this range.");
57 params.
addParam<FunctionName>(
"multiplying_fcn",
59 "If this function is provided, the flux " 60 "will be multiplied by this function. " 61 "This is useful for spatially or " 62 "temporally varying sinks");
64 "richardsVarNames_UO",
"The UserObject that holds the list of Richards variable names.");
65 params.
addParam<
bool>(
"fully_upwind",
false,
"Use full upwinding");
69 "An area postprocessor. If given, the bare_fluxes will be divided by this " 70 "quantity. This means the bare fluxes are measured in kg.s^-1. This is " 71 "useful for the case when you wish to provide the *total* flux, and let MOOSE " 72 "proportion it uniformly across the boundary. In that case you would have " 73 "use_mobility=false=use_relperm, and only one bare flux should be specified");
79 _use_mobility(getParam<bool>(
"use_mobility")),
80 _use_relperm(getParam<bool>(
"use_relperm")),
81 _fully_upwind(getParam<bool>(
"fully_upwind")),
83 _sink_func(getParam<
std::vector<
Real>>(
"pressures"),
84 getParam<
std::vector<
Real>>(
"bare_fluxes")),
86 _m_func(getFunction(
"multiplying_fcn")),
89 _num_p(_richards_name_UO.num_v()),
90 _pvar(_richards_name_UO.richards_var_num(_var.number())),
95 getParam<
std::vector<UserObjectName>>(
"density_UO")[_pvar])
97 _seff_UO(_fully_upwind ? &getUserObjectByName<
RichardsSeff>(
98 getParam<
std::vector<UserObjectName>>(
"seff_UO")[_pvar])
101 getParam<
std::vector<UserObjectName>>(
"relperm_UO")[_pvar])
104 _area_pp(getPostprocessorValue(
"area_pp")),
108 _dnodal_density_dv(0),
110 _dnodal_relperm_dv(0),
112 _pp(getMaterialProperty<
std::vector<
Real>>(
"porepressure")),
113 _dpp_dv(getMaterialProperty<
std::vector<
std::vector<
Real>>>(
"dporepressure_dv")),
115 _viscosity(getMaterialProperty<
std::vector<
Real>>(
"viscosity")),
118 _dseff_dv(getMaterialProperty<
std::vector<
std::vector<
Real>>>(
"ds_eff_dv")),
120 _rel_perm(getMaterialProperty<
std::vector<
Real>>(
"rel_perm")),
121 _drel_perm_dv(getMaterialProperty<
std::vector<
std::vector<
Real>>>(
"drel_perm_dv")),
123 _density(getMaterialProperty<
std::vector<
Real>>(
"density")),
124 _ddensity_dv(getMaterialProperty<
std::vector<
std::vector<
Real>>>(
"ddensity_dv"))
127 for (
unsigned int pnum = 0; pnum <
_num_p; ++pnum)
140 std::vector<Real> dseff_dp;
148 for (
unsigned int nodenum = 0; nodenum <
_num_nodes; ++nodenum)
155 for (
unsigned int ph = 0; ph <
_num_p; ++ph)
169 for (
unsigned int ph = 0; ph <
_num_p; ++ph)
219 mooseError(
"RichardsPiecewiseLinearSink: flux is nonzero, but area is zero!\n");
310 mooseError(
"RichardsPiecewiseLinearSink: deriv is nonzero, but area is zero!\n");
const VariableTestValue & _test
const MaterialProperty< std::vector< Real > > & _rel_perm
relative permeability (only the _pvar component is used)
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...
virtual Real computeQpResidual() override
virtual Real computeQpJacobian() override
const RichardsDensity *const _density_UO
user object defining the density. Only used if _fully_upwind = true
virtual void computeOffDiagJacobian(unsigned int jvar) override
LinearInterpolation _sink_func
piecewise-linear function of porepressure (this defines the strength of the sink) ...
const MaterialProperty< std::vector< Real > > & _viscosity
viscosity (only the _pvar component is used)
virtual Real drelperm(Real seff) const =0
derivative of relative permeability wrt effective saturation This must be over-ridden in your derived...
RichardsPiecewiseLinearSink(const InputParameters ¶meters)
const MooseArray< Point > & _normals
virtual Real ddensity(Real p) const =0
derivative of fluid density wrt porepressure This must be over-ridden in derived classes to provide a...
bool _use_relperm
whether to multiply the sink flux by relative permeability
const RichardsSeff *const _seff_UO
user object defining the effective saturation. Only used if _fully_upwind = true
bool _use_mobility
whether to multiply the sink flux by permeability*density/viscosity
Base class for effective saturation as a function of porepressure(s) The functions seff...
Base class for Richards relative permeability classes that provide relative permeability as a functio...
std::vector< Real > _nodal_density
nodal values of fluid density These are used if _fully_upwind = true
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 ...
const MaterialProperty< std::vector< Real > > & _density
fluid density (only the _pvar component is used)
virtual Real computeQpOffDiagJacobian(unsigned int jvar) override
static InputParameters validParams()
bool not_richards_var(unsigned int moose_var_num) const
returns true if moose_var_num is not a richards var
T sample(const T &x) const
std::vector< Real > _nodal_relperm
nodal values of relative permeability These are used if _fully_upwind = true
This holds maps between pressure_var or pressure_var, sat_var used in RichardsMaterial and kernels...
const VariablePhiValue & _phi
const RichardsRelPerm *const _relperm_UO
user object defining the relative permeability. Only used if _fully_upwind = true ...
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...
virtual void computeJacobian() 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...
const MooseArray< Point > & _q_point
TensorValue< Real > RealTensorValue
const RichardsVarNames & _richards_name_UO
holds info about the names and values of richards variable in the simulation
T sampleDerivative(const T &x) const
Real deriv(unsigned n, unsigned alpha, unsigned beta, Real x)
const PostprocessorValue & _area_pp
area postprocessor. if given then all bare_fluxes are divided by this quantity
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 ...
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< std::vector< std::vector< Real > > > & _drel_perm_dv
d(relperm_i)/d(variable_j)
virtual Real relperm(Real seff) const =0
relative permeability as a function of effective saturation This must be over-ridden in your derived ...
unsigned int _pvar
the moose internal variable number corresponding to the porepressure of this sink flux ...
const Function & _m_func
sink flux gets multiplied by this function
registerMooseObject("RichardsApp", RichardsPiecewiseLinearSink)
Applies a flux sink to a boundary The sink is a piecewise linear function of porepressure (the "varia...
bool _fully_upwind
whether to use full upwinding
virtual void computeOffDiagJacobian(unsigned int jvar) override
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const MaterialProperty< std::vector< Real > > & _pp
porepressure values (only the _pvar component is used)
const MaterialProperty< std::vector< std::vector< Real > > > & _dpp_dv
d(porepressure_i)/d(variable_j)
unsigned int _num_nodes
number of nodes in this element. Only used if _fully_upwind = true
unsigned int richards_var_num(unsigned int moose_var_num) const
the richards variable number
virtual void computeJacobian() override
virtual void computeResidual() override
static InputParameters validParams()
void mooseError(Args &&... args) const
unsigned int _num_p
number of richards variables
Base class for fluid density as a function of porepressure The functions density, ddensity and d2dens...
void prepareNodalValues()
calculates the nodal values of pressure, mobility, and derivatives thereof
virtual void computeResidual() override
virtual Real value(Real t, const Point &p) const
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...
Real jac(unsigned int wrt_num)
derivative of residual wrt the wrt_num Richards variable
const MaterialProperty< RealTensorValue > & _permeability
permeability
static const std::string k
const MaterialProperty< std::vector< std::vector< Real > > > & _ddensity_dv
d(density_i)/d(variable_j)