Hi Gergő,

since you are using the box method, a call to evalFluxes() and evalStorage()
will result in the local residuum being calculated for all of the elements sub-controlvolumes (scvs). However, you are only interested in the fluxes of those scvs that lie directly on your boundary of interest.

This means you must check in your loop

// Loop over subcontrol volumes
for (int i = 0; i < fvGeometry.numScv; i++) {
....
}

whether the scv is on the boundary or not. You get the global position of the vertex associated to the scv by

 fvGeometry.subContVol[scvIdx].global

So your loop could look something like

// Loop over subcontrol volumes
for (int i = 0; i < fvGeometry.numScv; i++) {

    if(fvGeometry.subContVol[i].global[0] < this->bBoxMin()[0])
    {
        flux += this->localResidual().residual(i);
    }
}

Hope this helps.

Best regards
Kilian

On 04/20/2017 04:12 PM, Gergely Schmidt wrote:
Hello Kilian, many thanks for your reply! I am using the box method and mass fractions and haven’t set a ReplaceComponentIdx, so the flux vector should contain the mass flux of my two components. Here is my code again, since the formatting was weird last time:

void massFlow(){
ElementVolumeVariables elemVolVars;
FVElementGeometry fvGeometry;
// Loop over elements
for (const auto& element : elements(this->problem_().gridView())) {
if (element.partitionType() != Dune::InteriorEntity)
continue;
const GlobalPosition &globalPos = element->geometry().center();
// ignore cells which are not on the left boundary
if (0.51*this->problem_().discretisationSize().first < globalPos[0])
continue;

fvGeometry.update(this->gridView_(), element);
elemVolVars.update(this->problem_(), element, fvGeometry,false);

this->localResidual().evalFluxes(element, elemVolVars);
this->localResidual().evalStorage(element);

PrimaryVariables flux(0.0);
// Loop over subcontrol volumes
for (int i = 0; i < fvGeometry.numScv; i++) {
// residual = 0 => boundary_flux = - (storage + inner_flux + sources)
flux += this->localResidual().residual(i);
}
// print mass flux in console
std::cout << "globalPos: " << globalPos << ", flux: " << flux << std::endl;
}
}

What do I need to modify?

Best regards,
Gergő



_______________________________________________
Dumux mailing list
[email protected]
https://listserv.uni-stuttgart.de/mailman/listinfo/dumux

--
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Kilian Weishaupt M.Sc.
Institut für Wasser- und Umweltsystemmodellierung (IWS)
Lehrstuhl für Hydromechanik und Hydrosystemmodellierung
Universität Stuttgart, Pfaffenwaldring 61, 70569 Stuttgart
Email: [email protected]
Telefon: 0049 711 685-60461 ** fax: 0049-711-685-60430
http://www.hydrosys.uni-stuttgart.de
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

_______________________________________________
Dumux mailing list
[email protected]
https://listserv.uni-stuttgart.de/mailman/listinfo/dumux

Reply via email to