17 #include "libmesh/quadrature.h" 30 "A RichardsDensity UserObject that defines the fluid density as a function of pressure.");
34 "A RichardsRelPerm UserObject (eg RichardsRelPermPower) that defines the " 35 "fluid relative permeability as a function of the saturation variable");
37 params.
addClassDescription(
"Flux according to Darcy-Richards flow. The Variable for this Kernel " 38 "should be the porepressure.");
45 _sat(coupledDofValues(
"saturation_variable")),
46 _sat_var(coupled(
"saturation_variable")),
48 _viscosity(getParam<
Real>(
"fluid_viscosity")),
72 for (
unsigned int nodenum = 0; nodenum <
_num_nodes; ++nodenum)
110 upwind(
false,
true, jvar);
183 bool reached_steady =
true;
184 for (
unsigned int nodenum = 0; nodenum <
_num_nodes; ++nodenum)
188 reached_steady =
false;
192 reached_steady =
false;
196 Real total_mass_out = 0;
201 std::vector<Real> dtotal_mass_out;
202 std::vector<Real> dtotal_in;
210 for (
unsigned int nodenum = 0; nodenum <
_num_nodes; ++nodenum)
212 if (
_local_re(nodenum) >= 0 || reached_steady)
242 for (
unsigned int nodenum = 0; nodenum <
_num_nodes; ++nodenum)
248 _local_ke(nodenum,
_j) *= total_mass_out / total_in;
250 _local_re(nodenum) * (dtotal_mass_out[
_j] / total_in -
251 dtotal_in[
_j] * total_mass_out / total_in / total_in);
253 _local_re(nodenum) *= total_mass_out / total_in;
261 for (
unsigned int i = 0; i <
_save_in.size(); i++)
272 for (
unsigned int i = 0; i < rows; i++)
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 VariableGradient & _grad_u
static InputParameters validParams()
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
const RichardsDensity & _density
fluid density
unsigned int number() const
Real _viscosity
fluid viscosity
Base class for Richards relative permeability classes that provide relative permeability as a functio...
const VariablePhiGradient & _grad_phi
Real computeQpJac(unsigned int dvar)
the derivative of the flux without the upstream mobility terms
const VariableValue & _sat
saturation at the nodes
unsigned int _sat_var
variable number of the saturation variable
static const std::string density
This is a fully upwinded flux Kernel The Variable of this Kernel should be the porepressure.
Q2PPorepressureFlux(const InputParameters ¶meters)
const MaterialProperty< RealTensorValue > & _permeability
permeability
virtual void computeOffDiagJacobian(unsigned int jvar) override
this simply calls upwind
const RichardsRelPerm & _relperm
fluid relative permeability
std::vector< Real > _dmobility_ds
d(_mobility)/d(saturation) These are used in the jacobian calculations
DenseMatrix< Number > _local_ke
static InputParameters validParams()
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
std::vector< MooseVariableFEBase *> _diag_save_in
const QBase *const & _qrule
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()
virtual void computeResidual() override
This simply calls upwind.
const MooseArray< Real > & _coord
unsigned int _num_nodes
number of nodes in the element
virtual void computeJacobian() override
this simply calls upwind
virtual Real computeQpResidual() override
Note that this is not the complete residual for the quadpoint In computeResidual we sum over the quad...
void prepareNodalValues()
calculates the nodal values of mobility, and derivatives thereof
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const VariableTestGradient & _grad_test
const DoFValue & dofValues() const override
DenseVector< Number > _local_re
registerMooseObject("RichardsApp", Q2PPorepressureFlux)
std::vector< Real > _dmobility_dp
d(_mobility)/d(porepressure) These are used in the jacobian calculations
Base class for fluid density as a function of porepressure The functions density, ddensity and d2dens...
void prepareVectorTag(Assembly &assembly, unsigned int ivar)
void prepareMatrixTag(Assembly &assembly, unsigned int ivar, unsigned int jvar)
const VariablePhiValue & _phi
std::vector< Real > _mobility
nodal values of mobility = density*relperm/viscosity These are multiplied by _flux_no_mob to give the...
const MaterialProperty< RealVectorValue > & _gravity
gravity