FireDynamics / fdsreader

Python reader for FDS data
GNU General Public License v3.0
44 stars 18 forks source link

Slicefiles in certain geometrys get split when using to_global #66

Closed annatroff closed 10 months ago

annatroff commented 10 months ago

Hi, When multiple meshes with the same cell size but different room measurements are stacked ontop of eachother, we noticed a problem using to_global. The meshes are connected and aligned so that the nodal points connect.
For slices on the x and y axis to_global returns a tuple of numpy.arrays. Depending on the geometry each numpy.array contains the data for different meshes. In some arrays there is data for multiple meshes and in some just for one mesh. It would be nice, to have the data for all meshes in one array to display it in one illustration.

Image 1: Geometry in smokeview splitting_slicefile_s0000

Image 2: Slicefile on y-axis in smokeview splitting_slicefile_0004

Image 3: Illustration of the two arrays from to_global (y-axis) auswertung_fdsreader2

Haukiy commented 10 months ago

I believe the output arises due to the non-uniform domain structure of your setup (a small room leading to a larger room and then back to a small room). The to_global function creates a numpy ndarray from all sub-slices (see slice.py) However, as observed in Image 2, there are no slices on the left and right sides of your smaller "rooms".

Did you design this arrangement for performance optimization? If you aim to reduce computational costs and avoid extending your domain, you can "stitch" your arrays together. For the gaps on the left and right, you can fill them with default ambient values, such as setting the temperature to 20°C.

JanVogelsang commented 10 months ago

This should usually not be the case, to_global should return a single array with empty (default) values at the corners (in your example). There are certain cases where a tuple is returned for cell-centered slices, but this shouldn't be the case in your example from what I can remember (it's been a while that I implemented the function).

Could you send me the fds-case as well as the script you used for plotting so that I can investigate this (potential) issue?

annatroff commented 10 months ago

Thank you a lot for the fast responses. This is an simplified example. We had this problem with buildings where we modelled an atrium.

FDS-Inputfile: splitting_slicefile.txt

Script for plotting: plot_splitting_slicefile.txt

How do I "stich" my arrays back together without risking to overwrite part of the data? I can't use numpy.stack either because not all meshes are seperated right?

Haukiy commented 10 months ago

Whether or not it's an issue, for now I've attached a script that fills the missing parts with a default value and merges them. The resulting figure:

merged_sliceTEMPERATURE_t40

FILE

Edit: default_value = np.nan, you get empty "side areas" (and vmin=np.nanmin(glued_array))

JanVogelsang commented 10 months ago

I managed to find the bug. It was actually quite a simple one, I was comparing two scalars (floats) using the python built-in equality operator (==) instead of doing a proper float comparison. After fixing the bug, only a single, global slice is returned (see image below).
Please try out version 1.9.12 and tell me if that solves the issue. Feel free to reopen the issue if this didn't fully fix your problem.

global slice

annatroff commented 10 months ago

I tried it just now and it worked without problems. Thank you a lot for fixing my problem.