What I forgot:

With your current loop over all elements, you only get the element-wise flux over the boundary. For the total one, you need to initialize

PrimaryVariables flux(0.0);

before your loop over the elements ...

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