Go to the documentation of this file.
11 #include "RotationMatrix.h"
20 params.addRequiredParam<UserObjectName>(
21 "richardsVarNames_UO",
"The UserObject that holds the list of Richards variable names.");
22 params.addParam<std::vector<UserObjectName>>(
"relperm_UO",
23 "List of names of user objects that "
24 "define relative permeability. Only "
25 "needed if fully_upwind is used");
26 params.addParam<std::vector<UserObjectName>>(
28 "List of name of user objects that define effective saturation as a function of "
29 "pressure list. Only needed if fully_upwind is used");
30 params.addParam<std::vector<UserObjectName>>(
"density_UO",
31 "List of names of user objects that "
32 "define the fluid density. Only "
33 "needed if fully_upwind is used");
34 params.addParam<
bool>(
"fully_upwind",
false,
"Fully upwind the flux");
35 params.addClassDescription(
"Approximates a borehole in the mesh with given bottomhole pressure, "
36 "and radii using a number of point sinks whose positions are read "
43 _fully_upwind(getParam<bool>(
"fully_upwind")),
45 _num_p(_richards_name_UO.num_v()),
46 _pvar(_richards_name_UO.richards_var_num(_var.number())),
50 _density_UO(_fully_upwind
52 getParam<std::vector<UserObjectName>>(
"density_UO")[_pvar])
54 _seff_UO(_fully_upwind
56 getParam<std::vector<UserObjectName>>(
"seff_UO")[_pvar])
58 _relperm_UO(_fully_upwind
60 getParam<std::vector<UserObjectName>>(
"relperm_UO")[_pvar])
66 _pp(getMaterialProperty<std::vector<Real>>(
"porepressure")),
67 _dpp_dv(getMaterialProperty<std::vector<std::vector<Real>>>(
"dporepressure_dv")),
68 _viscosity(getMaterialProperty<std::vector<Real>>(
"viscosity")),
69 _permeability(getMaterialProperty<RealTensorValue>(
"permeability")),
70 _dseff_dv(getMaterialProperty<std::vector<std::vector<Real>>>(
"ds_eff_dv")),
71 _rel_perm(getMaterialProperty<std::vector<Real>>(
"rel_perm")),
72 _drel_perm_dv(getMaterialProperty<std::vector<std::vector<Real>>>(
"drel_perm_dv")),
73 _density(getMaterialProperty<std::vector<Real>>(
"density")),
74 _ddensity_dv(getMaterialProperty<std::vector<std::vector<Real>>>(
"ddensity_dv"))
77 for (
unsigned int pnum = 0; pnum <
_num_p; ++pnum)
82 const std::vector<MooseVariableFEBase *> & coupled_vars =
_richards_name_UO.getCoupledMooseVars();
83 for (
unsigned int i = 0; i < coupled_vars.size(); i++)
84 addMooseVariableDependency(coupled_vars[i]);
98 std::vector<Real> dseff_dp;
104 for (
unsigned int nodenum = 0; nodenum <
_num_nodes; ++nodenum)
121 for (
unsigned int ph = 0; ph <
_num_p; ++ph)
132 DiracKernel::computeResidual();
138 const Real character =
_character.value(_t, _q_point[_qp]);
139 if (character == 0.0)
142 const Real bh_pressure =
162 const unsigned current_dirac_ptid = currentPointCachedID();
171 if (current_dirac_ptid > 0)
179 _rs[current_dirac_ptid]);
180 if ((character < 0.0 && pp < bh_pressure) || (character > 0.0 && pp > bh_pressure))
182 outflow += _test[_i][_qp] * std::abs(character) * wc * mob * (pp - bh_pressure);
185 if (current_dirac_ptid + 1 <
_zs.size() ||
_zs.size() == 1)
192 _rs[current_dirac_ptid]);
193 if ((character < 0.0 && pp < bh_pressure) || (character > 0.0 && pp > bh_pressure))
195 outflow += _test[_i][_qp] * std::abs(character) * wc * mob * (pp - bh_pressure);
208 DiracKernel::computeJacobian();
214 const Real character =
_character.value(_t, _q_point[_qp]);
215 if (character == 0.0)
232 const Real character =
_character.value(_t, _q_point[_qp]);
233 if (character == 0.0)
236 const Real bh_pressure =
263 (
_pvar == wrt_num ? 1 : 0);
270 const unsigned current_dirac_ptid = currentPointCachedID();
279 if (current_dirac_ptid > 0)
286 _rs[current_dirac_ptid]);
287 if ((character < 0.0 && pp < bh_pressure) || (character > 0.0 && pp > bh_pressure))
289 outflowp += _test[_i][_qp] * std::abs(character) * wc *
290 (mob * phi * dpp_dv + dmob_dv * phi * (pp - bh_pressure));
293 if (current_dirac_ptid <
_zs.size() - 1 ||
_zs.size() == 1)
300 _rs[current_dirac_ptid]);
301 if ((character < 0.0 && pp < bh_pressure) || (character > 0.0 && pp > bh_pressure))
303 outflowp += _test[_i][_qp] * std::abs(character) * wc *
304 (mob * phi * dpp_dv + dmob_dv * phi * (pp - bh_pressure));
Approximates a borehole by a sequence of Dirac Points.
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: _...
std::vector< Real > _zs
z points of borehole
virtual void computeResidual()
Computes the residual.
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...
const MaterialProperty< std::vector< Real > > & _pp
fluid porepressure (or porepressures in case of multiphase)
const MaterialProperty< std::vector< std::vector< Real > > > & _dpp_dv
d(porepressure_i)/d(variable_j)
std::vector< Real > _rs
radii of the borehole
virtual Real relperm(Real seff) const =0
relative permeability as a function of effective saturation This must be over-ridden in your derived ...
const unsigned int _num_p
number of richards variables
const Real _p_bot
bottomhole pressure of borehole
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,...
const MaterialProperty< RealTensorValue > & _permeability
material permeability
Base class for effective saturation as a function of porepressure(s) The functions seff,...
const MaterialProperty< std::vector< std::vector< Real > > > & _drel_perm_dv
d(relperm_i)/d(variable_j)
virtual void computeJacobian()
Computes the Jacobian.
Real wellConstant(const RealTensorValue &perm, const RealTensorValue &rot, const Real &half_len, const Elem *ele, const Real &rad)
Calculates Peaceman's form of the borehole well constant Z Chen, Y Zhang, Well flow models for variou...
RichardsBorehole(const InputParameters ¶meters)
Creates a new RichardsBorehole This sets all the variables, but also reads the file containing the li...
const MaterialProperty< std::vector< Real > > & _density
fluid density
const RichardsDensity * _density_UO
user object defining the density. Only used if _fully_upwind = true
std::vector< RealTensorValue > _rot_matrix
rotation matrix used in well_constant calculation
const unsigned int _pvar
The moose internal variable number of the richards variable of this Dirac Kernel.
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...
std::vector< std::vector< Real > > _dmobility_dv
d(_mobility)/d(variable_ph) (variable_ph is the variable for phase=ph) These are used in the jacobian...
Point _bottom_point
the bottom point of the borehole (where bottom_pressure is defined)
InputParameters validParams< PeacemanBorehole >()
const std::string density
virtual Real computeQpJacobian()
Computes the diagonal part of the jacobian.
const RichardsVarNames & _richards_name_UO
Defines the richards variables in the simulation.
Approximates a borehole by a sequence of Dirac Points.
registerMooseObject("RichardsApp", RichardsBorehole)
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 ...
virtual Real computeQpResidual()
Computes the Qp residual.
const RichardsSeff * _seff_UO
user object defining the effective saturation. Only used if _fully_upwind = true
std::vector< Real > _mobility
nodal values of mobility = density*relperm/viscosity These are used if _fully_upwind = true
std::vector< Real > _half_seg_len
0.5*(length of polyline segments between points)
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
const MaterialProperty< std::vector< std::vector< Real > > > & _ddensity_dv
d(density_i)/d(variable_j)
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...
void add(Real contrib)
adds contrib to _total
const bool _fully_upwind
Whether to use full upwinding.
RichardsSumQuantity & _total_outflow_mass
This is used to hold the total fluid flowing into the borehole Hence, it is positive for production w...
const RichardsRelPerm * _relperm_UO
user object defining the relative permeability. Only used if _fully_upwind = true
Real jac(unsigned int wrt_num)
Calculates Jacobian.
const MaterialProperty< std::vector< Real > > & _viscosity
fluid viscosity
InputParameters validParams< RichardsBorehole >()
const Function & _character
If positive then the borehole acts as a sink (producion well) for porepressure > borehole pressure,...
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
Computes the off-diagonal part of the jacobian Note: at March2014 this is never called since moose do...
const MaterialProperty< std::vector< Real > > & _rel_perm
relative permeability
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
const RealVectorValue _unit_weight
unit weight of fluid in borehole (for calculating bottomhole pressure at each Dirac Point)
bool not_richards_var(unsigned int moose_var_num) const
returns true if moose_var_num is not a richards var
unsigned int _num_nodes
number of nodes in this element. Only used if _fully_upwind = true