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 (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); };
if (time > 0) {
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(problem_, element, fvGeometry,
elemVolVars, scvf, elemFluxVarsCache);
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,
volVars.mobility(nPhaseIdx));// / extrusionFactor;
//FW += fluxVars.advectiveFlux(wPhaseIdx,
volVars.mobility(wPhaseIdx));// / extrusionFactor;
FO += fluxVars.advectiveFlux(nPhaseIdx, upwindTermN);//
/ extrusionFactor;
FW += fluxVars.advectiveFlux(wPhaseIdx, upwindTermW);//
/ extrusionFactor;
}
}
}
_______________________________________________
Dumux mailing list
[email protected]
https://listserv.uni-stuttgart.de/mailman/listinfo/dumux