FireDynamics / fdsreader

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

slc.to_global error: ValueError: negative dimensions are not allowed #51

Closed angzzz closed 1 year ago

angzzz commented 1 year ago

Hi, I'm not much of a programmer and want to use the fdsreader to export slice files. A mistake was made. I don't know what's wrong. Could someone help me, please. Traceback (most recent call last): File "C:\Users\11734\AppData\Roaming\Python\Python39\site-packages\IPython\core\interactiveshell.py", line 3457, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "<ipython-input-5-264501c9f462>", line 1, in <module> data = slc.to_global(masked=True, fill=np.nan) File "C:\Anaconda3\envs\pytorch\lib\site-packages\fdsreader\slcf\slice.py", line 531, in to_global grid = np.full((self.n_t, steps['x'], steps['y'], steps['z']), np.nan) File "C:\Users\11734\AppData\Roaming\Python\Python39\site-packages\numpy\core\numeric.py", line 343, in full a = empty(shape, dtype, order) ValueError: negative dimensions are not allowed

JanVogelsang commented 1 year ago

Hi, I am certain we will find a solution to your problem. Could you please show me the python script you ran until the error occurred or the commands you entered into your interactive python console?

angzzz commented 1 year ago

Thank you for your reply. And these are my codes.

`from matplotlib import cm, pyplot as plt import numpy as np import fdsreader as fds

sim = fds.Simulation("C:\Loc_101_A_a-HRR_5_9")

Examples of data that can be easily accessed

print('slices', sim.slices)

Slice([2D] quantity=Quantity('TEMPERATURE'), cell_centered=False, extent=Extent([0.00, 48.00] x [0.00, 19.20] x [0.40, 0.40]), extent_dirs=('x', 'y'), orientation=3),

Slice([2D] quantity=Quantity('TEMPERATURE'), cell_centered=False, extent=Extent([0.00, 48.00] x [0.00, 19.20] x [3.20, 3.20]), extent_dirs=('x', 'y'), orientation=3),

Slice([2D] quantity=Quantity('TEMPERATURE'), cell_centered=False, extent=Extent([0.00, 48.00] x [0.00, 19.20] x [2.00, 2.00]), extent_dirs=('x', 'y'), orientation=3),

Slice([2D] quantity=Quantity('TEMPERATURE'), cell_centered=False, extent=Extent([0.00, 48.00] x [0.00, 19.20] x [1.60, 1.60]), extent_dirs=('x', 'y'), orientation=3)])

Get the slice

slc = sim.slices[4]

data= slc.to_global(masked=True, fill=np.nan)

data, coordinates = slc.to_global(masked=True, fill=np.nan, return_coordinates=True)`

data, coordinates = slc.to_global(masked=True, fill=np.nan, return_coordinates=True) The last line of code reports the error

And my numpy version == 1.21.4

lu-kas commented 1 year ago

If I see it correctly, you try to access the fifth (index 4) slice: slc = sim.slices[4] Yet, if I'm not wrong, there are only four slices. Could you give it a try and access e.g. the first one slc = sim.slices[0] ?

angzzz commented 1 year ago

If I see it correctly, you try to access the fifth (index 4) slice: slc = sim.slices[4] Yet, if I'm not wrong, there are only four slices. Could you give it a try and access e.g. the first one slc = sim.slices[0] ?

Thank you for your reply. As you said I tried to access the first sliceslc = sim.slices[0]. But it still reports the same error just like slc = sim.slices[4] . Do you have any other solutions, thank you.

lu-kas commented 1 year ago

Could you share the FDS or SMV file?

angzzz commented 1 year ago

Loc_101_A_a-HRR_5_9.zip The relevant documents are as follows. You can try exporting slices. Thanks again.

JanVogelsang commented 1 year ago

Unfortunately, I can't open the file. When trying to download the file, it simply tells me 'Not found'. Can you verify the upload actually succeeded, and if not try to upload it again or use another way to provide the zip-file?

lu-kas commented 1 year ago

You could also paste the content of the FDS file within tripple `.

angzzz commented 1 year ago

Loc_101_A_a-HRR_5_9.txt Sorry, I don't know what is tripple. But I pasted the fds contents into the txt file.

lu-kas commented 1 year ago

Thanks, this worked.

Btw, this is what I meant: https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks

lu-kas commented 1 year ago

Ok, somehow the masking does not work. So, if you do not explicitly need it, please use

data, coordinates = slc.to_global(return_coordinates=True)

Does this work?

lu-kas commented 1 year ago

For further documentation, this is the error message, if masking is turned on:

image
angzzz commented 1 year ago

Unfortunately, it doesn't work. And it it still reports the same error. 7c884d228ada693ec69cd6918a40ed1 AND thank you for github docs about 'create code blocks'. 19A69682

lu-kas commented 1 year ago

Which version of numpy do you use?

angzzz commented 1 year ago

My numpy ==1.21.4 823f5a937e8d55ba6e774151a65650f I try to run the example which is you provided' fds_multimesh'. And it also reports the same error. Maybe my packages are inconformity the requirements docs of version. I'm going to keep trying. THANKS!

lu-kas commented 1 year ago

Another question. Which version of FDS do you use?

angzzz commented 1 year ago

FDS6. Maybe this error is due to my failure to install several packages such as 'mkL-fft' successfully. And I haven't installed it yet. That's my fault.

lu-kas commented 1 year ago

Please be more specific with the FDS version. The mentioned package should have no impact.

angzzz commented 1 year ago

FDS6.7.9

angzzz commented 1 year ago

Actually I also run files in PyroSim.

lu-kas commented 1 year ago

Last try, could you please send me your smv file?

angzzz commented 1 year ago

Here is my .smv file. https://github.com/angzzz/fds_files Could you send me the file that you can run without problems? I would like to try it out. Thank you so much!

angzzz commented 1 year ago

Github limits the size of upload files. Would you mind giving me your email address?? I will send you the all relevant documents by email. Thanks.

lu-kas commented 1 year ago

You are running a three years old version of FDS, the smv file indicates, that it is not 6.7.9 as you stated above:

TITLE

FDSVERSION
FDS6.7.1-0-g14cc738-HEAD

ENDF
 Loc_101_A_a-HRR_5_9.end

INPF
 C:\zzz\pyrosim\demo\Loc_101_A_a-HRR_5_9\Loc_101_A_a-HRR_5_9.fds

REVISION
Revisio                                                                                                                                                                                                                                                        

Please update to the recent FDS version and rerun your case. I assume, that since three years things have changed in the output format.

I will close the issue. If you still see problems with the newest version of FDS, please reopen it. Good luck.

angzzz commented 1 year ago

Thank you so much!