Dear DuMuX experts,

Please advise how can I implement a global conservation error check, that is, 
evaluate the residual ( mass(t^{n+1}) - mass(t^n) ) / dt + sum of fluxes over 
the domain boundaries.


So far I can evaluate the mass in the domain by looping through the elements as 
in void getVolumes of 
https://git.iws.uni-stuttgart.de/andrian/rate-sens-nofrac/blob/master/src/rate_problem.hh.


I tried to use the following to access the fluxes in rate_problem.hh (inspired 
from porousmediumflow/velocityoutput.hh and 
porousmediumflow/nonequilibrium/gridvariables.hh):


            // the upwind term to be used for the volume flux evaluation
            auto upwindTermN = [](const auto& volVars) { return 
volVars.mobility(nPhaseIdx); };
            auto upwindTermW = [](const auto& volVars) { return 
volVars.mobility(wPhaseIdx); };

            auto elemFluxVarsCache = 
localView(gridVariables.gridFluxVarsCache());
            elemFluxVarsCache.bind(element, fvGeometry, elemVolVars);

            for (auto&& scvf : scvfs(fvGeometry)) {

                if (scvf.boundary()) {

                    //auto bcTypes = problemBoundaryTypes(element, scvf);
                    //if (bcTypes.hasOnlyDirichlet())
                    {

                        FluxVariables fluxVars;
                        fluxVars.init(*this, element, fvGeometry, elemVolVars, 
scvf, elemFluxVarsCache);

                        Scalar extrusionFactor = 
problem_.extrusionFactor(element, fvGeometry.scv(scvf.insideScvIdx()), 
elementSolution(element, sol_, fvGridGeometry_));
                        FO += fluxVars.advectiveFlux(nPhaseIdx, upwindTermN);// 
/ extrusionFactor;
                        FW += fluxVars.advectiveFlux(wPhaseIdx, upwindTermW);// 
/ extrusionFactor;
                    }
                }
            }


However, I get compilation error at elemFluxVarsCache.bind(element, fvGeometry, 
elemVolVars) saying that Assertion `it != indices.end() && "Could not find the 
scv/scvf! Make sure to properly bind this class!"' failed.


Your feedback is greatly appreciated.


Many thanks,

Nikolai



PS: please disregard my previous mail with the same subject..
_______________________________________________
Dumux mailing list
[email protected]
https://listserv.uni-stuttgart.de/mailman/listinfo/dumux

Reply via email to