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())
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);
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");