Extract data from Slide

1,351 views
Skip to first unread message

SkyW

unread,
Oct 19, 2008, 9:48:13 AM10/19/08
to FDS and Smokeview Discussions
Hi,

I have run some simulations where temperature and velocity slice files
where generated. Now I need to plot some Time versus Temperature
graphs. I'm just wondering if is there any way to generate a .csv
file, with time and temperature of selected x,y,z points, from the
slice files.
Regards
Alex

Kevin

unread,
Oct 19, 2008, 3:43:39 PM10/19/08
to FDS and Smokeview Discussions
Use a DEVC to extract a single value as a function of time.

SkyW

unread,
Oct 20, 2008, 3:18:55 AM10/20/08
to FDS and Smokeview Discussions
Hi Kevin,

I forgot to include DEVC in the fds file. Simulation took some time
and I really would like to avoid to repeat it .. since temperature
slice was taken and since Smokeview is able to show the temperature on
the screen ... I was just wondering if is there any way to extract
that information without having to re run simulations.

Regrads

Alex
> > Alex- Hide quoted text -
>
> - Show quoted text -

Hostikka Simo

unread,
Oct 20, 2008, 3:41:04 AM10/20/08
to fds...@googlegroups.com
If you have MATLAB (and know how to use it),
here is a script that reads slice file data into a 3-dimensional
array.

Simo
----------

function [T,Time]=slread(fname,Tstart,Tend,Tstep)
% SLREAD Reads a FDS slice file
% [T,Time]=slread(fname,Tstart,Tend [,Tstep]);
% Tstart is start time
% Tend is end time
% Tstep is time step of dumps
%
% T contains the data
% Time contains the time points
if (nargin<4),Tstep = Tend-Tstart;end
%
Time = 0;
%
if (filesep=='/')
fid = fopen(fname,'r','b');
else
fid = fopen(fname,'r','l');
end
r4b(fid);
Str1 = char([fread(fid,30,'schar')]');
r4b(fid);
r4b(fid);
Str2 = char([fread(fid,30,'schar')]');
r4b(fid);
r4b(fid);
Str3 = char([fread(fid,30,'schar')]');
r4b(fid);
%
r4b(fid);
Indx = [fread(fid,6,'int32')]';
r4b(fid);
%
% allocate T
%
Isize = Indx(2)-Indx(1)+1;
Jsize = Indx(4)-Indx(3)+1;
Ksize = Indx(6)-Indx(5)+1;
if (Isize == 1)
M = Jsize;
N = Ksize;
elseif (Jsize == 1)
M = Isize;
N = Ksize;
else
M = Isize;
N = Jsize;
end
%
Nrun = max(1,round((Tend-Tstart)/Tstep));
T(N,M,Nrun) = 0;
%
st = 1;
%
while Time < Tstart,
r4b(fid);
Time(st) = fread(fid,1,'float32');
r4b(fid);
%
r4b(fid);
T(:,:,st) = fread(fid,[M,N],'float32')';
r4b(fid);
%
end
%
while Time < Tend,
%
st = st + 1;
%
r4b(fid);
Time(st) = fread(fid,1,'float32');
r4b(fid);
%
r4b(fid);
T(:,:,st) = fread(fid,[M,N],'float32')';
r4b(fid);
%
end
%
%T = [T/st]';
%if st > 1,
% disp(['Number of averaging steps = ' num2str(st) '.'])
%end
%
fclose(fid);

function r4b(fid)
fread(fid,4,'int8');
---------

SkyW

unread,
Oct 20, 2008, 5:57:15 AM10/20/08
to FDS and Smokeview Discussions
Thanks Simo .... Now I know what I'm going to do tonight at hotel
room :)

Regards

Àlex
> > > - Show quoted text -- Hide quoted text -

Kevin

unread,
Oct 20, 2008, 8:15:36 AM10/20/08
to FDS and Smokeview Discussions
Also note that the format of the slice file is at the back of the
User's Guide. If you know Fortran, you can use the same WRITE
statements as READ statements.

Also, there are several third party tools around that claim to do
things like this. Check

http://fire.nist.gov/fds/thirdparty.html

Glenn Forney

unread,
Oct 20, 2008, 8:33:45 AM10/20/08
to fds...@googlegroups.com
Yet another solution.

Smokeview can create a data snapshot (comma delimited) of a single slice
file frame . To activate this option: 1. go to the File/Bounds dialog
box and open the Slice tab, 2. click on the "Output data to file"
checkbox. Once activated, click the "r" key and smokeview will not only
output an image file of the scene your are viewing but also output a
comma delimited file containing data in rows and columns corresponding
to data used to generated colors in the displayed slice file.

For your need, it would be difficult to assemble but if you rendered
frames for each time step the data you wanted would be distributed
throughout the files created.
--
Glenn Forney
National Institute of Standards and Technology
100 Bureau Drive, Stop 8663
Gaithersburg MD 20899-8663

Telephone: (301) 975 2313
FAX: (301) 975 4052

Pre-decisional and sensitive information. Not for attribution, distribution, or reproduction.


SkyW

unread,
Nov 29, 2008, 5:22:43 AM11/29/08
to FDS and Smokeview Discussions
Hi all,

First at all thanks all for your cooperation ... and apologies for not
comming back earlier. I've finally got time to check all your
suggestions (I'm 2 weeks at Helsinki and finally got enough time at
nights to work on it :) ).

I've run Simo MATLAB function and I've adapted to my purposes and it
works perfectly. Thanks god I don't have to re-run all simulations.

Once again .. thanks all.

Regards

Àlex
> > > On Oct 19, 9:48 am,SkyW<APalauBo...@gmail.com> wrote:
>
> > > > Hi,
>
> > > > I have run some simulations where temperature and velocity slice
> > > > files where generated. Now I need to plot some Time versus
> > > > Temperature graphs. I'm just wondering if is there any way to
> > > > generate a .csv file, with time and temperature of selected x,y,z
> > > > points, from the slice files.
> > > > Regards
> > > > Alex- Hide quoted text -
>
> > > - Show quoted text -- Hide quoted text -

Emad

unread,
Dec 19, 2015, 6:25:08 PM12/19/15
to FDS and Smokeview Discussions
hi all
i dont underestand how to use this code. i save this function and i dont know how to call it. could u plz explane more or attach m file that read the SLCS data?
thx

jgarcia177

unread,
Dec 20, 2015, 6:14:55 PM12/20/15
to FDS and Smokeview Discussions
Hi all,

I try to use this solution by Glenn Forney, but I don't
find  in the SMV User's guide howto do this  and
the type and extension of the output file.

Please, where can find more information and an example of this procedure?

hanks all.

Jorge Garcia
100

Glenn Forney

unread,
Dec 20, 2015, 7:48:50 PM12/20/15
to fds...@googlegroups.com
You are right.  The details for outputting slice file data to a data file are not in the Smokeview user's guide.  If they were, the details would look something  like:

1. Open File/Bounds dialog box (found by clicking on the Dialogs>Data bounds dialog box).  Then click on the Slice tab, 

2.  click the check box : "Output data to file" 

3.  Now whenever you click on the 'r' key smokeview will output a A. png file containing an image for the scene displayed by smokeview and 2. a .csv file containing slice file data for the current time step.




--
You received this message because you are subscribed to the Google Groups "FDS and Smokeview Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fds-smv+u...@googlegroups.com.
To post to this group, send email to fds...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fds-smv/9c895952-e558-4270-9178-6995ca0feba6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Glenn Forney

info

unread,
Jan 28, 2016, 6:58:05 AM1/28/16
to FDS and Smokeview Discussions
Hello to all.
Simo thank you for the very useful script!
I would like to ask you what is the meaning of these two code rows:

Nrun = max(1,round((Tend-Tstart)/Tstep)); 
T(N,M,Nrun) = 0; 

Do they assign T matrix dimensions? But it seems that in the following while cycles the T dimensions are re-assegned. Isn't it?

Thank you very much for your help

Simo

unread,
Jan 29, 2016, 1:39:15 AM1/29/16
to FDS and Smokeview Discussions
You are correct, those lines allocate the array T. This is good practice and speeds up the code if you work with large arrays.

Later, the values are assigned to the cells of the array, but the dimensions do not change.

info

unread,
Jan 29, 2016, 4:44:49 AM1/29/16
to FDS and Smokeview Discussions
Thank you Simo.
Ok, so it is a way to speed up the process, this is now clear to me. 
But perhaps I still don't understand how to use Tstep. I tried to recall 3 times the function, changing the value of Tstep, and the final dimension of T does not change. 

I used this script:
[T,Time]=slread('pSlice_0001_01.sf',0,100,1);
size(T)
disp('-----------------------------------')
[T,Time]=slread('pSlice_0001_01.sf',0,100,10);
size(T)
disp('-----------------------------------')
[T,Time]=slread('pSlice_0001_01.sf',0,100);
size(T)

And I get this result:
ans =

    12    21   999

-----------------------------------

ans =

    12    21   999

-----------------------------------

ans =

    12    21   999

Thank you for your help

Il giorno domenica 19 ottobre 2008 15:48:13 UTC+2, SkyW ha scritto:

info

unread,
Feb 4, 2016, 4:53:23 AM2/4/16
to FDS and Smokeview Discussions
Hi all,
can someone please help me understand which is the intended use of Tstep in slread.m?
I think it would be very useful if it can set the time period over which slice values are averaged. 
Thank you

Simo

unread,
Feb 4, 2016, 8:10:37 AM2/4/16
to FDS and Smokeview Discussions
It looks to me that Tstep is only used to speed up the function by indicating the expected size of T array. It does not affect the result in any way.

info

unread,
Feb 4, 2016, 8:21:12 AM2/4/16
to FDS and Smokeview Discussions

Ok. This is what I thought when I read the function, but since Tstep is a variable that has to be assigned calling the function, I was not sure my interpretation was right.

VIGNESHWARAN NARAYANAN

unread,
Oct 6, 2018, 1:59:59 AM10/6/18
to FDS and Smokeview Discussions
Hello Dr. Simo,

Thanks for the MATLAB script. I am new to the use of MATLAB. Can you please mention the variables that need be changed based on the particular case. It would be great if you can add more information within the script.

Rgds
Vig 

Randy McDermott

unread,
Oct 6, 2018, 5:26:41 AM10/6/18
to FDS and Smokeview Discussions
fname in slread is the file name of a slice file, which has the extension .sf (look in your working directory).  Of course, you need to have a &SLCF line in your input file before FDS will write out a slice.  Past that, once you get handy with Matlab, slread does not need much more documentation.  I suggest you start on the Matlab site and work through their tutorials.

--
You received this message because you are subscribed to the Google Groups "FDS and Smokeview Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fds-smv+u...@googlegroups.com.
To post to this group, send email to fds...@googlegroups.com.

cmarco15

unread,
Dec 19, 2020, 6:57:36 AM12/19/20
to FDS and Smokeview Discussions
Hi to all,
it is so interesting !!
I am looking for this ...! But if need to extract heat flux or smoke layer heigth ?? Can I do the same procedure?

Thank you so much

Randy McDermott

unread,
Dec 19, 2020, 8:28:34 AM12/19/20
to fds...@googlegroups.com
Works for any quantity that is appropriate for slice output.  This is shown for each quantity in the user guide.

--
You received this message because you are subscribed to the Google Groups "FDS and Smokeview Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fds-smv+u...@googlegroups.com.
--
Sent from my iPhone

dr_jfloyd

unread,
Dec 19, 2020, 10:00:37 AM12/19/20
to FDS and Smokeview Discussions
If you have a slice file of TEMPERATURE and you use slread or fds2sascii to get the 2D array of temperatures, then yes you can take a vertical column of temperature and apply the same equations given the FDS manuals to determine the layer temperatures and heights.

Heat flux is not something you can get from slice file data. 
Reply all
Reply to author
Forward
0 new messages