17 #include "libmesh/quadrature.h" 26 "relperm_UO",
"List of names of user objects that define relative permeability");
29 "List of name of user objects that define effective saturation as a function of " 32 "density_UO",
"List of names of user objects that define the fluid density");
34 "richardsVarNames_UO",
"The UserObject that holds the list of Richards variable names.");
41 _num_p(_richards_name_UO.num_v()),
42 _pvar(_richards_name_UO.richards_var_num(_var.number())),
44 getParam<
std::vector<UserObjectName>>(
"density_UO")[_pvar])),
46 getUserObjectByName<
RichardsSeff>(getParam<
std::vector<UserObjectName>>(
"seff_UO")[_pvar])),
48 getParam<
std::vector<UserObjectName>>(
"relperm_UO")[_pvar])),
49 _viscosity(getMaterialProperty<
std::vector<
Real>>(
"viscosity")),
60 for (
unsigned int pnum = 0; pnum <
_num_p; ++pnum)
73 std::vector<Real> dseff_dp;
79 for (
unsigned int nodenum = 0; nodenum <
_num_nodes; ++nodenum)
95 for (
unsigned int ph = 0; ph <
_num_p; ++ph)
119 upwind(
false,
true, jvar);
189 bool reached_steady =
true;
190 for (
unsigned int nodenum = 0; nodenum <
_num_nodes; ++nodenum)
194 reached_steady =
false;
201 Real total_mass_out = 0;
206 std::vector<Real> dtotal_mass_out;
207 std::vector<Real> dtotal_in;
212 for (
unsigned int nodenum = 0; nodenum <
_num_nodes; ++nodenum)
214 dtotal_mass_out[nodenum] = 0;
215 dtotal_in[nodenum] = 0;
220 for (
unsigned int nodenum = 0; nodenum <
_num_nodes; ++nodenum)
222 if (
_local_re(nodenum) >= 0 || reached_steady)
247 for (
unsigned int nodenum = 0; nodenum <
_num_nodes; ++nodenum)
253 _local_ke(nodenum,
_j) *= total_mass_out / total_in;
255 _local_re(nodenum) * (dtotal_mass_out[
_j] / total_in -
256 dtotal_in[
_j] * total_mass_out / total_in / total_in);
258 _local_re(nodenum) *= total_mass_out / total_in;
266 for (
unsigned int i = 0; i <
_save_in.size(); i++)
277 for (
unsigned int i = 0; i < rows; i++)
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...
static InputParameters validParams()
unsigned int _num_p
number of richards variables
void accumulateTaggedLocalResidual()
virtual Real drelperm(Real seff) const =0
derivative of relative permeability wrt effective saturation This must be over-ridden in your derived...
std::vector< MooseVariableFEBase *> _save_in
virtual Real ddensity(Real p) const =0
derivative of fluid density wrt porepressure This must be over-ridden in derived classes to provide a...
const MooseArray< Real > & _JxW
unsigned int number() const
const MaterialProperty< std::vector< std::vector< RealVectorValue > > > & _dflux_no_mob_dv
d(_flux_no_mob)/d(variable)
Base class for effective saturation as a function of porepressure(s) The functions seff...
static InputParameters validParams()
Base class for Richards relative permeability classes that provide relative permeability as a functio...
const VariablePhiGradient & _grad_phi
std::vector< const VariableValue * > _ps_at_nodes
Holds the values of pressures at all the nodes of the element Eg: _ps_at_nodes[_pvar] is a pointer to...
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 ...
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...
static const std::string density
virtual Real computeQpResidual() override
Note that this is not the complete residual for the quadpoint In computeResidual we sum over the quad...
bool not_richards_var(unsigned int moose_var_num) const
returns true if moose_var_num is not a richards var
This holds maps between pressure_var or pressure_var, sat_var used in RichardsMaterial and kernels...
registerMooseObject("RichardsApp", RichardsFullyUpwindFlux)
DenseMatrix< Number > _local_ke
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...
TensorValue< Real > RealTensorValue
const VariableTestValue & _test
const RichardsRelPerm & _relperm_UO
user object defining the relative permeability
std::vector< MooseVariableFEBase *> _diag_save_in
void upwind(bool compute_res, bool compute_jac, unsigned int jvar)
Do the upwinding for both the residual and jacobian I've put both calculations in the same code to tr...
const QBase *const & _qrule
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 ...
virtual Real relperm(Real seff) const =0
relative permeability as a function of effective saturation This must be over-ridden in your derived ...
void accumulateTaggedLocalMatrix()
const MaterialProperty< std::vector< RealVectorValue > > & _flux_no_mob
permeability*(grad(pressure) - density*gravity) (a vector of these in the multiphase case) ...
const RichardsSeff & _seff_UO
user object defining the effective saturation
RichardsFullyUpwindFlux(const InputParameters ¶meters)
const MooseArray< Real > & _coord
unsigned int _pvar
the index of this variable in the list of Richards variables held by _richards_name_UO.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void prepareNodalValues()
calculates the nodal values of mobility, and derivatives thereof
unsigned int richards_var_num(unsigned int moose_var_num) const
the richards variable number
const VariableTestGradient & _grad_test
DenseVector< Number > _local_re
const MaterialProperty< std::vector< std::vector< RealTensorValue > > > & _dflux_no_mob_dgradv
d(_flux_no_mob)/d(grad(variable))
Real computeQpJac(unsigned int dvar)
the derivative of the flux without the upstream mobility terms
unsigned int _num_nodes
number of nodes in this element
const RichardsVarNames & _richards_name_UO
holds info regarding the names of the Richards variables and methods for extracting values of these v...
const MaterialProperty< std::vector< Real > > & _viscosity
viscosities
Base class for fluid density as a function of porepressure The functions density, ddensity and d2dens...
This is a fully upwinded version of RichardsFlux.
void prepareVectorTag(Assembly &assembly, unsigned int ivar)
virtual void computeResidual() override
This simply calls upwind.
void prepareMatrixTag(Assembly &assembly, unsigned int ivar, unsigned int jvar)
const RichardsDensity & _density_UO
user object defining the density
const VariablePhiValue & _phi
std::vector< Real > _mobility
nodal values of mobility = density*relperm/viscosity These are multiplied by _flux_no_mob to give the...
virtual void computeOffDiagJacobian(unsigned int jvar) override
this simply calls upwind