FireDynamics / fdsreader

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

Slice data structure #62

Closed wowwwt closed 1 year ago

wowwwt commented 1 year ago

Dear all, I had a question when I was extracting slice data. As a beginner, I would like to ask you for advice . When I am printing slice data, the result is shown in the figure below. Combined with [slcf_example_global], I know that the data contains time, coordinates and simulation results. Then how do I know the data represented by different indexes? In addition, what should I do if I want to correspond the simulation result data according to time and coordinates for a 2D slice(that is, output four columns of data, namely time, coordinate 1, coordinate 2 and result)? Oh, btw, it should be my operation problem. The final data doesn't seem to be completely displayed.... 54}$LNL@~03Z3G_8T0L}MFR

wowwwt commented 1 year ago

I have been able to display all the data in the txt file, but I really don't know what these data(data structure) respectively are....

dushyant-fire commented 1 year ago

When you extracted the data, it will be a 3D numpy array. 1st dimension is time, 2nd and 3rd dimensions are populated with values of the corresponding slice at X/Y coordinates. You can see in your posted image that the values at the first time stamp (perhaps t=0s) are 20 C at all locations.

If you want to get corresponding coordinates, you would need to call the method get_coordinates(). For example, for a SliceCollection on the sim obtained as sim.slices,

SliceVar =  sim.slices[0] # SliceVar is the first slice from the SliceCollection (all slices in the simulation)
print(SliceVar.get_coordinates())

will return a dict of {'x':[...], 'y':[....], 'z':[....]}. Then you can extract relevant coordinate values for the slice.

Similarly, SliceVar.times will return an array of all times at which slice data is available.

Thanks to the fdsreader team, they have good documentation and recommend looking at that here. Also recommend looking at this figure.

wowwwt commented 1 year ago

As a beginner, thank you very much for your patient reply. Please give me some time to try...

JanVogelsang commented 1 year ago

Thanks a lot for your comprehensive answer @dushyant-fire @wowwwt Please note that the figure is just intended to give a general overview of all available data structures and does not list all available properties of each class. For a complete list, take a look at the documentation. If anything is unclear, please let us know, so we can improve that part of the documentation.

Keep in mind that slices lie on any of the X/Y, X/Z, or Y/Z planes, therefore the values you printed are not necessarily the values at the X/Y coordinates, but could also be values at e.g. X/Z coordinates. When you print the coordinates of a slice (i.e., slc.get_coordinates()), you will find that one of the dimensions will only contain a single value (in case of 2D slices at least).

JanVogelsang commented 1 year ago

@wowwwt I will close this issue for now. Feel free to reopen it if you have any further questions.