28#ifndef DUMUX_DISCRETIZATION_BOX_DARCYS_LAW_HH
29#define DUMUX_DISCRETIZATION_BOX_DARCYS_LAW_HH
39template<
class TypeTag, DiscretizationMethod discMethod>
40class DarcysLawImplementation;
43template<
class Scalar,
class Gr
idGeometry>
50template<
class TypeTag>
52:
public BoxDarcysLaw<GetPropType<TypeTag, Properties::Scalar>, GetPropType<TypeTag, Properties::GridGeometry>>
61template<
class Scalar,
class Gr
idGeometry>
64 using FVElementGeometry =
typename GridGeometry::LocalView;
65 using SubControlVolumeFace =
typename FVElementGeometry::SubControlVolumeFace;
66 using GridView =
typename GridGeometry::GridView;
67 using Element =
typename GridView::template Codim<0>::Entity;
69 enum { dim = GridView::dimension};
70 enum { dimWorld = GridView::dimensionworld};
74 template<
class Problem,
class ElementVolumeVariables,
class ElementFluxVarsCache>
75 static Scalar
flux(
const Problem& problem,
76 const Element& element,
77 const FVElementGeometry& fvGeometry,
78 const ElementVolumeVariables& elemVolVars,
79 const SubControlVolumeFace& scvf,
81 const ElementFluxVarsCache& elemFluxVarCache)
83 const auto& fluxVarCache = elemFluxVarCache[scvf];
84 const auto& insideScv = fvGeometry.scv(scvf.insideScvIdx());
85 const auto& outsideScv = fvGeometry.scv(scvf.outsideScvIdx());
86 const auto& insideVolVars = elemVolVars[insideScv];
87 const auto& outsideVolVars = elemVolVars[outsideScv];
89 auto insideK = insideVolVars.permeability();
90 auto outsideK = outsideVolVars.permeability();
93 insideK *= insideVolVars.extrusionFactor();
94 outsideK *= outsideVolVars.extrusionFactor();
96 const auto K = problem.spatialParams().harmonicMean(insideK, outsideK, scvf.unitOuterNormal());
97 static const bool enableGravity = getParamFromGroup<bool>(problem.paramGroup(),
"Problem.EnableGravity");
99 const auto& shapeValues = fluxVarCache.shapeValues();
102 Dune::FieldVector<Scalar, dimWorld> gradP(0.0);
104 for (
auto&& scv : scvs(fvGeometry))
106 const auto& volVars = elemVolVars[scv];
109 rho += volVars.density(phaseIdx)*shapeValues[scv.indexInElement()][0];
112 gradP.axpy(volVars.pressure(phaseIdx), fluxVarCache.gradN(scv.indexInElement()));
116 gradP.axpy(-rho, problem.spatialParams().gravity(scvf.center()));
119 return -1.0*
vtmv(scvf.unitOuterNormal(), K, gradP)*scvf.area();
123 template<
class Problem,
class ElementVolumeVariables,
class FluxVarCache>
125 const Element& element,
126 const FVElementGeometry& fvGeometry,
127 const ElementVolumeVariables& elemVolVars,
128 const SubControlVolumeFace& scvf,
129 const FluxVarCache& fluxVarCache)
131 const auto& insideScv = fvGeometry.scv(scvf.insideScvIdx());
132 const auto& outsideScv = fvGeometry.scv(scvf.outsideScvIdx());
133 const auto& insideVolVars = elemVolVars[insideScv];
134 const auto& outsideVolVars = elemVolVars[outsideScv];
136 auto insideK = insideVolVars.permeability();
137 auto outsideK = outsideVolVars.permeability();
140 insideK *= insideVolVars.extrusionFactor();
141 outsideK *= outsideVolVars.extrusionFactor();
143 const auto K = problem.spatialParams().harmonicMean(insideK, outsideK, scvf.unitOuterNormal());
145 std::vector<Scalar> ti(fvGeometry.numScv());
146 for (
const auto& scv : scvs(fvGeometry))
147 ti[scv.indexInElement()] =
148 -1.0*scvf.area()*
vtmv(scvf.unitOuterNormal(), K, fluxVarCache.gradN(scv.indexInElement()));
Define some often used mathematical functions.
The infrastructure to retrieve run-time parameters from Dune::ParameterTrees.
The available discretization methods in Dumux.
DiscretizationMethod
The available discretization methods in Dumux.
Definition: method.hh:37
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:840
forward declaration of the method-specific implementation
Definition: flux/darcyslaw.hh:38
Darcy's law for the box scheme.
Definition: flux/box/darcyslaw.hh:63
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/box/darcyslaw.hh:124
static Scalar flux(const Problem &problem, const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const SubControlVolumeFace &scvf, const int phaseIdx, const ElementFluxVarsCache &elemFluxVarCache)
Definition: flux/box/darcyslaw.hh:75
Declares all properties used in Dumux.