16#ifndef DUMUX_DISCRETIZATION_CVFE_DARCYS_LAW_HH
17#define DUMUX_DISCRETIZATION_CVFE_DARCYS_LAW_HH
37template<
class Scalar,
class Gr
idGeometry,
class GravityTermDensity = PhaseDensityInGravityTerm>
40 using FVElementGeometry =
typename GridGeometry::LocalView;
41 using SubControlVolumeFace =
typename FVElementGeometry::SubControlVolumeFace;
43 using GridView =
typename GridGeometry::GridView;
44 using Element =
typename GridView::template Codim<0>::Entity;
46 static constexpr int dim = GridView::dimension;
47 static constexpr int dimWorld = GridView::dimensionworld;
61 template<
class Problem,
class ElementVolumeVariables,
class ElementFluxVarsCache>
62 static Scalar
flux(
const Problem& problem,
63 const Element& element,
64 const FVElementGeometry& fvGeometry,
65 const ElementVolumeVariables& elemVolVars,
66 const SubControlVolumeFace& scvf,
68 const ElementFluxVarsCache& elemFluxVarCache)
70 const auto& fluxVarCache = elemFluxVarCache[scvf];
71 const auto& insideScv = fvGeometry.scv(scvf.insideScvIdx());
72 const auto& outsideScv = fvGeometry.scv(scvf.outsideScvIdx());
73 const auto& insideVolVars = elemVolVars[insideScv];
74 const auto& outsideVolVars = elemVolVars[outsideScv];
76 auto insideK = insideVolVars.permeability();
77 auto outsideK = outsideVolVars.permeability();
80 insideK *= insideVolVars.extrusionFactor();
81 outsideK *= outsideVolVars.extrusionFactor();
84 const auto gradPotential =
potentialGradient(problem, fvGeometry, elemVolVars, scvf, phaseIdx, fluxVarCache);
87 return -1.0*
vtmv(scvf.unitOuterNormal(), K, gradPotential)*Extrusion::area(fvGeometry, scvf);
94 template<
class Problem,
class ElementVolumeVariables,
class FluxVarCache>
96 const FVElementGeometry& fvGeometry,
97 const ElementVolumeVariables& elemVolVars,
98 const SubControlVolumeFace& scvf,
100 const FluxVarCache& fluxVarCache)
104 const auto& shapeValues = fluxVarCache.shapeValues();
106 Dune::FieldVector<Scalar, dimWorld> gradP(0.0);
108 for (
auto&& scv :
scvs(fvGeometry))
110 const auto& volVars = elemVolVars[scv];
113 rho += GravityTermDensity::density(problem, volVars, phaseIdx)*shapeValues[scv.indexInElement()][0];
116 gradP.axpy(volVars.pressure(phaseIdx), fluxVarCache.gradN(scv.indexInElement()));
120 gradP.axpy(-rho, problem.spatialParams().gravity(scvf.center()));
126 template<
class Problem,
class ElementVolumeVariables,
class FluxVarCache>
128 const Element& element,
129 const FVElementGeometry& fvGeometry,
130 const ElementVolumeVariables& elemVolVars,
131 const SubControlVolumeFace& scvf,
132 const FluxVarCache& fluxVarCache)
134 const auto& insideScv = fvGeometry.scv(scvf.insideScvIdx());
135 const auto& outsideScv = fvGeometry.scv(scvf.outsideScvIdx());
136 const auto& insideVolVars = elemVolVars[insideScv];
137 const auto& outsideVolVars = elemVolVars[outsideScv];
139 auto insideK = insideVolVars.permeability();
140 auto outsideK = outsideVolVars.permeability();
143 insideK *= insideVolVars.extrusionFactor();
144 outsideK *= outsideVolVars.extrusionFactor();
148 std::vector<Scalar> ti(fvGeometry.numScv());
149 for (
const auto& scv :
scvs(fvGeometry))
150 ti[scv.indexInElement()] =
151 -1.0*Extrusion::area(fvGeometry, scvf)*
vtmv(scvf.unitOuterNormal(), K, fluxVarCache.gradN(scv.indexInElement()));
158template<
class TypeTag,
class DiscretizationMethod>
159class DarcysLawImplementation;
165template<
class TypeTag,
class DM>
167:
public CVFEDarcysLaw<GetPropType<TypeTag, Properties::Scalar>, GetPropType<TypeTag, Properties::GridGeometry>>
Darcy's law for control-volume finite element schemes.
Definition flux/cvfe/darcyslaw.hh:39
static Scalar flux(const Problem &problem, const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const SubControlVolumeFace &scvf, const int phaseIdx, const ElementFluxVarsCache &elemFluxVarCache)
Returns the advective flux of a fluid phase across the given sub-control volume face.
Definition flux/cvfe/darcyslaw.hh:62
static std::vector< Scalar > calculateTransmissibilities(const Problem &problem, const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const SubControlVolumeFace &scvf, const FluxVarCache &fluxVarCache)
Definition flux/cvfe/darcyslaw.hh:127
static Dune::FieldVector< Scalar, dimWorld > potentialGradient(const Problem &problem, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const SubControlVolumeFace &scvf, const int phaseIdx, const FluxVarCache &fluxVarCache)
Returns of a fluid phase at the integration point of the given sub-control volume face.
Definition flux/cvfe/darcyslaw.hh:95
forward declaration of the method-specific implementation
Definition flux/ccmpfa/darcyslaw.hh:27
Defines all properties used in Dumux.
Helper classes to compute the integration elements.
A free function to average a Tensor at an interface.
The density in the gravity term of Darcy's law.
Dune::DenseMatrix< MAT >::value_type vtmv(const Dune::DenseVector< V1 > &v1, const Dune::DenseMatrix< MAT > &M, const Dune::DenseVector< V2 > &v2)
Evaluates the scalar product of a vector v2, projected by a matrix M, with a vector v1.
Definition math.hh:880
T getParamFromGroup(Args &&... args)
A free function to get a parameter from the parameter tree singleton with a model group.
Definition parameters.hh:165
Define some often used mathematical functions.
The available discretization methods in Dumux.
Definition interpolate.hh:27
std::ranges::range auto scvs(const FVElementGeometry &fvGeometry, const LocalDof &localDof)
Definition localdof.hh:82
Scalar faceTensorAverage(const Scalar T1, const Scalar T2, const Dune::FieldVector< Scalar, dim > &normal)
Average of a discontinuous scalar field at discontinuity interface (for compatibility reasons with th...
Definition facetensoraverage.hh:29
typename Extrusion< T >::type Extrusion_t
Convenience alias for obtaining the extrusion type.
Definition extrusion.hh:257
The infrastructure to retrieve run-time parameters from Dune::ParameterTrees.