24#ifndef DUMUX_DISCRETIZATION_BOX_FACET_COUPLING_DARCYS_LAW_HH
25#define DUMUX_DISCRETIZATION_BOX_FACET_COUPLING_DARCYS_LAW_HH
30#include <dune/common/exceptions.hh>
31#include <dune/common/fvector.hh>
32#include <dune/common/float_cmp.hh>
48template<
class Scalar,
class Gr
idGeometry>
53 using FVElementGeometry =
typename GridGeometry::LocalView;
54 using SubControlVolume =
typename FVElementGeometry::SubControlVolume;
55 using SubControlVolumeFace =
typename FVElementGeometry::SubControlVolumeFace;
56 using GridView =
typename GridGeometry::GridView;
57 using Element =
typename GridView::template Codim<0>::Entity;
58 using CoordScalar =
typename GridView::ctype;
59 using GlobalPosition =
typename Element::Geometry::GlobalCoordinate;
61 static constexpr int dim = GridView::dimension;
62 static constexpr int dimWorld = GridView::dimensionworld;
66 template<
class Problem,
class ElementVolumeVariables,
class ElementFluxVarsCache>
67 static Scalar
flux(
const Problem& problem,
68 const Element& element,
69 const FVElementGeometry& fvGeometry,
70 const ElementVolumeVariables& elemVolVars,
71 const SubControlVolumeFace& scvf,
73 const ElementFluxVarsCache& elemFluxVarCache)
76 if (!scvf.interiorBoundary())
79 static const Scalar xi = getParamFromGroup<Scalar>(problem.paramGroup(),
"FacetCoupling.Xi", 1.0);
80 if ( !Dune::FloatCmp::eq(xi, 1.0, 1e-6) )
81 DUNE_THROW(Dune::NotImplemented,
"Xi != 1.0 cannot be used with the Box-Facet-Coupling scheme");
84 const auto& fluxVarCache = elemFluxVarCache[scvf];
85 const auto& shapeValues = fluxVarCache.shapeValues();
86 const auto& insideScv = fvGeometry.scv(scvf.insideScvIdx());
87 const auto& insideVolVars = elemVolVars[insideScv];
90 const auto bcTypes = problem.interiorBoundaryTypes(element, scvf);
92 static const bool enableGravity = getParamFromGroup<bool>(problem.paramGroup(),
"Problem.EnableGravity");
95 if (bcTypes.hasOnlyNeumann())
100 for (
const auto& scv : scvs(fvGeometry))
102 const auto& volVars = elemVolVars[scv];
103 p += volVars.pressure(phaseIdx)*shapeValues[scv.indexInElement()][0];
104 rho += volVars.density(phaseIdx)*shapeValues[scv.indexInElement()][0];
108 const auto& facetVolVars = problem.couplingManager().getLowDimVolVars(element, scvf);
114 const auto a = facetVolVars.extrusionFactor();
115 auto gradP = scvf.unitOuterNormal();
116 gradP *= dim == dimWorld ? 0.5*a : 0.5*sqrt(a);
117 gradP /= gradP.two_norm2();
118 gradP *= (facetVolVars.pressure(phaseIdx) - p);
120 gradP.axpy(-rho, problem.spatialParams().gravity(scvf.center()));
123 return -1.0*scvf.area()
124 *insideVolVars.extrusionFactor()
125 *
vtmv(scvf.unitOuterNormal(), facetVolVars.permeability(), gradP);
129 else if (bcTypes.hasOnlyDirichlet())
132 std::vector<Scalar> pressures(element.subEntities(dim));
133 for (
const auto& scv : scvs(fvGeometry))
134 pressures[scv.localDofIndex()] = elemVolVars[scv].pressure(phaseIdx);
137 for (
const auto& scvfJ : scvfs(fvGeometry))
138 if (scvfJ.interiorBoundary() && scvfJ.facetIndexInElement() == scvf.facetIndexInElement())
139 pressures[ fvGeometry.scv(scvfJ.insideScvIdx()).localDofIndex() ]
140 = problem.couplingManager().getLowDimVolVars(element, scvfJ).pressure(phaseIdx);
144 Dune::FieldVector<Scalar, dimWorld> gradP(0.0);
145 for (
const auto& scv : scvs(fvGeometry))
147 rho += elemVolVars[scv].density(phaseIdx)*shapeValues[scv.indexInElement()][0];
148 gradP.axpy(pressures[scv.localDofIndex()], fluxVarCache.gradN(scv.indexInElement()));
152 gradP.axpy(-rho, problem.spatialParams().gravity(scvf.center()));
155 return -1.0*scvf.area()
156 *insideVolVars.extrusionFactor()
157 *
vtmv(scvf.unitOuterNormal(), insideVolVars.permeability(), gradP);
162 DUNE_THROW(Dune::NotImplemented,
"Mixed boundary types are not supported");
166 template<
class Problem,
class ElementVolumeVariables,
class FluxVarCache>
168 const Element& element,
169 const FVElementGeometry& fvGeometry,
170 const ElementVolumeVariables& elemVolVars,
171 const SubControlVolumeFace& scvf,
172 const FluxVarCache& fluxVarCache)
174 DUNE_THROW(Dune::NotImplemented,
"transmissibilty computation for BoxFacetCouplingDarcysLaw");
The infrastructure to retrieve run-time parameters from Dune::ParameterTrees.
The available discretization methods in Dumux.
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
Darcy's law for the box scheme.
Definition: flux/box/darcyslaw.hh:63
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
Darcy's law for the box scheme in the context of coupled models where coupling occurs across the face...
Definition: multidomain/facet/box/darcyslaw.hh:50
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: multidomain/facet/box/darcyslaw.hh:67
static std::vector< Scalar > calculateTransmissibilities(const Problem &problem, const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const SubControlVolumeFace &scvf, const FluxVarCache &fluxVarCache)
Definition: multidomain/facet/box/darcyslaw.hh:167
Declares all properties used in Dumux.
Specialization of Darcy's Law for the box method.