41    flux(
const Problem& problem,
 
   42         const Element& element,
 
   43         const FVElementGeometry& fvGeometry,
 
   44         const ElementVolumeVariables& elemVolVars,
 
   45         const typename FVElementGeometry::SubControlVolumeFace& scvf,
 
   47         const ElementFluxVariablesCache& elemFluxVarsCache)
 
   49        Dune::FieldVector<Scalar, numComponents> componentFlux(0.0);
 
   52        const auto& insideVolVars = elemVolVars[scvf.insideScvIdx()];
 
   53        const auto& outsideVolVars = elemVolVars[scvf.outsideScvIdx()];
 
   55        const auto& fluxVarsCache = elemFluxVarsCache[scvf];
 
   58        const Scalar throatLength = fluxVarsCache.throatLength();
 
   59        const Scalar phaseCrossSectionalArea = fluxVarsCache.throatCrossSectionalArea(phaseIdx);
 
   61        for (
int compIdx = 0; compIdx < numComponents; compIdx++)
 
   63            if(compIdx == phaseIdx)
 
   66            auto insideDiffCoeff = getDiffusionCoefficient_(phaseIdx, compIdx, insideVolVars);
 
   67            auto outsideDiffCoeff = getDiffusionCoefficient_(phaseIdx, compIdx, outsideVolVars);
 
   70            insideDiffCoeff *= insideVolVars.extrusionFactor();
 
   71            outsideDiffCoeff *= outsideVolVars.extrusionFactor();
 
   74            const auto diffCoeff = 
harmonicMean(insideDiffCoeff, outsideDiffCoeff);
 
   76            const Scalar insideMoleFraction = 
massOrMoleFraction(insideVolVars, referenceSystem, phaseIdx, compIdx);
 
   77            const Scalar outsideMoleFraction = 
massOrMoleFraction(outsideVolVars, referenceSystem, phaseIdx, compIdx);
 
   79            componentFlux[compIdx] = density * (insideMoleFraction - outsideMoleFraction) / throatLength * diffCoeff * phaseCrossSectionalArea;
 
   80            componentFlux[phaseIdx] -= componentFlux[compIdx];