fluiddyn / fluidfoam

OpenFoam postprocessing python tool
GNU General Public License v3.0
158 stars 50 forks source link

handling multiple regions #50

Closed fab6 closed 1 year ago

fab6 commented 1 year ago

Hi, It would be great, if multi-region cases can be handled in fluidfoam as well. E.g. I would like to read scalar values from the different regions for the multiRegionHeater case, which has 5 regions (with non-moving fixed mesh)? Thank you in advance! Fab

CyrilleBonamy commented 1 year ago

Hi I developed very quickly the support for regions/sets. Can you test with the fluidfoam of my fork : https://github.com/CyrilleBonamy/fluidfoam/ ? If you have difficulties to install fluidfoam from my fork, don't hesitate to contact me :-)

Example to use (to read pressure field and associated mesh) :

p = fluidfoam.readfield(path='.', region="bottomWater", name="p", time_name="50")
x, y, z = fluidfoam.readmesh(path='.', region="bottomWater")
fab6 commented 1 year ago

Hi, thanks, it works almost for my case: image Temperature is read from the regions, though its looking for a sets field, which is not always available.

I used a slight adjustment

import fluidfoam 
T = fluidfoam.readfield(path='../', region="rightRoom", name="T", time_name="50")
print(T)
print(T.max())
T = fluidfoam.readfield(path='../', region="rightWall", name="T", time_name="50")
print(T)
print(T.max())
x, y, z = fluidfoam.readmesh(path='../', region="rightWall")
x, y, z = fluidfoam.readmesh(path='../', region="rightRoom")

Thank you very much!

CyrilleBonamy commented 1 year ago

I am not sure I understand your point about the "sets" field not always being available. Do you have an exemple of such case ?

fab6 commented 1 year ago

From my understanding of this error message, fluidfoam is trying to read the sets folder in polyMesh. In the tutorial this is not deleted, e.g. see here image but this actually not needed for the simulation. This is why, it is not available in my case.

Sorry, forgot to mention... I just sent the case via email. Thank you very much!

CyrilleBonamy commented 1 year ago

Done #51 :-) Enjoy

fab6 commented 1 year ago

Thank you!