69 static Scalar
flux(
const Problem& problem,
70 const Element& element,
71 const FVElementGeometry& fvGeometry,
72 const ElementVolumeVariables& elemVolVars,
73 const SubControlVolumeFace& scvf,
75 const ElementFluxVarsCache& elemFluxVarCache)
78 if (!scvf.interiorBoundary())
82 if ( !Dune::FloatCmp::eq(xi, 1.0, 1e-6) )
83 DUNE_THROW(Dune::NotImplemented,
"Xi != 1.0 cannot be used with the Box-Facet-Coupling scheme");
86 const auto& fluxVarCache = elemFluxVarCache[scvf];
87 const auto& shapeValues = fluxVarCache.shapeValues();
88 const auto& insideScv = fvGeometry.scv(scvf.insideScvIdx());
89 const auto& insideVolVars = elemVolVars[insideScv];
92 const auto bcTypes = problem.interiorBoundaryTypes(element, scvf);
97 if (bcTypes.hasOnlyNeumann())
102 for (
const auto& scv : scvs(fvGeometry))
104 const auto& volVars = elemVolVars[scv];
105 p += volVars.pressure(phaseIdx)*shapeValues[scv.indexInElement()][0];
106 rho += volVars.density(phaseIdx)*shapeValues[scv.indexInElement()][0];
110 const auto& facetVolVars = problem.couplingManager().getLowDimVolVars(element, scvf);
116 const auto a = facetVolVars.extrusionFactor();
117 auto gradP = scvf.unitOuterNormal();
118 gradP *= dim == dimWorld ? 0.5*a : 0.5*sqrt(a);
119 gradP /= gradP.two_norm2();
120 gradP *= (facetVolVars.pressure(phaseIdx) - p);
122 gradP.axpy(-rho, problem.spatialParams().gravity(scvf.center()));
125 return -1.0*Extrusion::area(scvf)
126 *insideVolVars.extrusionFactor()
127 *
vtmv(scvf.unitOuterNormal(), facetVolVars.permeability(), gradP);
131 else if (bcTypes.hasOnlyDirichlet())
134 std::vector<Scalar> pressures(element.subEntities(dim));
135 for (
const auto& scv : scvs(fvGeometry))
136 pressures[scv.localDofIndex()] = elemVolVars[scv].pressure(phaseIdx);
139 for (
const auto& scvfJ : scvfs(fvGeometry))
140 if (scvfJ.interiorBoundary() && scvfJ.facetIndexInElement() == scvf.facetIndexInElement())
141 pressures[ fvGeometry.scv(scvfJ.insideScvIdx()).localDofIndex() ]
142 = problem.couplingManager().getLowDimVolVars(element, scvfJ).pressure(phaseIdx);
146 Dune::FieldVector<Scalar, dimWorld> gradP(0.0);
147 for (
const auto& scv : scvs(fvGeometry))
149 rho += elemVolVars[scv].density(phaseIdx)*shapeValues[scv.indexInElement()][0];
150 gradP.axpy(pressures[scv.localDofIndex()], fluxVarCache.gradN(scv.indexInElement()));
154 gradP.axpy(-rho, problem.spatialParams().gravity(scvf.center()));
157 return -1.0*Extrusion::area(scvf)
158 *insideVolVars.extrusionFactor()
159 *
vtmv(scvf.unitOuterNormal(), insideVolVars.permeability(), gradP);
164 DUNE_THROW(Dune::NotImplemented,
"Mixed boundary types are not supported");