Update:

I just ran the code and got a read error so maybe something is still wrong with 
the code but I think that I go into the right direction.

Georg

Von: Dumux [mailto:[email protected]] Im Auftrag von 
[email protected]
Gesendet: Dienstag, 15. März 2016 15:06
An: [email protected]
Betreff: [DuMuX] flux calculation with compute flux

Hello Dumux,

I tried to calculate the fluxes over a certain part of the boundary of the 
model domain. For this purpose I used an ElementIterator to iterate over the 
elements of the grid. In each element I iterate over the intersections and in 
each intersection over the vertices. With information from the 
IntersectionIterator and the vertex index I can get the boundary face index and 
the boundary face position. I test whether I am at the desired location on the 
grid and then calculate the local residual of the corresponding element. This 
works just fine.
The idea was to use the computeFlux-function of the local residual afterwards 
with the corresponding boundary face index and onBoundary=true to get the flux 
over the boundary. However, this will not work because the fluidState is not 
defined when the local fluxVariables are constructed and this will cause 
Valgrind to complain.
To me it came as a surprise that it is not possible to use the 
computeFlux-function outside the localresidual since this is quite an important 
quantity to access when traversing the grid. I see that several people have 
tried just the same approach but commented the code afterwards, probably for 
the reasons mentioned above. The workaround which was used instead is to 
locally construct the fluxVariables of the element and then do just the same 
flux calculation as in the localresidual. This way, one is forced to copy code 
and have code which does exactly the same in two different locations. I think 
this should be improved and the fluxes over the interfaces should be readily 
available when iterating over the grid.
The solution to this problem would be to add a second computeFlux-function to 
the local residual. This function would get all the parameters needed for the 
flux calculation without the need to touch the private functions of the local 
residual. This would be a public version of computeFlux (the current 
computeFlux function is private in nature since it can't be called outside the 
local residual without causing problems and maybe should be set private for 
consistency).
I believe the problem is the same for all (implicit) models. I attached my code 
which is specific to my multidomain/fuel cell model. The first function is 
called in the multidomain problem. The computeFlux-Function is part of the 
localresidual.
These are just some ideas. Please let me know what you think.

Best regards

Georg Futter

--------------------------
German Aerospace Center (DLR)
Institute of Engineering Thermodynamics | Computational Electrochemistry | 
Pfaffenwaldring 38-40 | 70569 Stuttgart

Dipl.-Ing. Georg Futter | Ph.D. student
Telefon 0711/6862-8135 | [email protected]<mailto:[email protected]>
www.DLR.de<http://www.dlr.de/>


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

Reply via email to