Slice file format specification

599 views
Skip to first unread message

Andreas

unread,
Mar 13, 2015, 4:36:24 AM3/13/15
to fds...@googlegroups.com

Hi everybody,

We would like to read data directly out of the .sf file. I found that the user guide says something in chapter 20.6. about the structure of these files. Unfortunately this doesn't help my colleague who is scripting the program. He asks if there is documentation about the format specification?

Thanks a lot!
Andreas

Mohamed Assal

unread,
Mar 13, 2015, 5:31:35 AM3/13/15
to fds...@googlegroups.com
Hello Andreas,

If i understand well your question you need to extract data from Slice.

if yes!

Here i'm joining Simo's Matlab Code that reads slice file data into a
3-dimensional array


fonction [T, Time] = slread (fname, Tstart, Tend, Tstep)
% SLREAD lit un fichier de tranche FDS
% [T, Time] = slread (fname, Tstart, Plutôt [, Tstep]);
% Tstart est l'heure de début
% Plutôt est temps de la fin
% Tstep est pas de temps de décharges
%
% T contient les données
% Durée contient les points dans le temps
if (nargin <4), Tstep = Tend-Tstart; fin
%
Time = 0;
%
if (filesep == '/')
= fid fopen (fname, «r», «b»);
autre
= fid fopen (fname, «r», «l»);
fin
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);
%
% Allouer 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;
autre
M = iSize;
N = Jsize;
fin
%
Nrun = max (1, rond ((Tend-Tstart) / Tstep));
T (N, M, Nrun) = 0;
%
st = 1;
%
tandis que Time <Tstart,
R4b (FID);
Temps (st) = fread (FID, 1, 'Float32');
R4b (FID);
%
R4b (FID);
T (:,:, st) = fread (FID, [M, N], 'float32') ';
R4b (FID);
%
fin
%
tandis que Time <Plutôt,
%
st = st + 1;
%
R4b (FID);
Temps (st) = fread (FID, 1, 'Float32');
R4b (FID);
%
R4b (FID);
T (:,:, st) = fread (FID, [M, N], 'float32') ';
R4b (FID);
%
fin
%
% T = [T / st] »;
% Si st> 1,
% Disp (['nombre d'étapes de calcul de la moyenne =' num2str (er) '.'])
% Fin
%
fclose (FID);

fonction R4b (FID)
fread (FID, 4, 'int8');


Cheers Mohammed

2015-03-13 9:36 UTC+01:00, Andreas <ott.a...@me.com>:
> --
> 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/7ef08166-e6e3-4108-9fdf-269c0e3204ee%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

GF

unread,
Mar 13, 2015, 9:42:19 AM3/13/15
to fds...@googlegroups.com
The following write statements are listed chapter 20.6 (I added comments following '!' ).  

In addition to the length info for variables, FORTRAN outputs 4 bytes at the beginning and and end of each write . This is important.  You need to account for this when you read in the data.  So the first 3 write statements output 68 bytes each, the next write outputs 32 bytes (4+6*4+4), the next write outputs 12 bytes (4 + 4 + 4) and the last outputs 8 + 4*(I2-I1+1)*(J2-J1+1)*(K2-K1+1) bytes

You can look in dump.f90 to see exactly how FDS outputs the data.




WRITE(LUSF) QUANTITY          ! character of length LABEL_LENGTH=60
WRITE(LUSF) SHORT_NAME   ! character of length 60
WRITE(LUSF) UNITS                 ! character of length 60
WRITE(LUSF) I1,I2,J1,J2,K1,K2  ! 4 byte integers 
WRITE(LUSF) TIME                   !  4 byte reals
WRITE(LUSF) (((QQ(I,J,K),I=I1,I2),J=J1,J2),K=K1,K2) ! 4 byte reals
.
.
WRITE(LUSF) TIME
WRITE(LUSF) (((QQ(I,J,K),I=I1,I2),J=J1,J2),K=K1,K2)
> Hi everybody,
>
> We would like to read data directly out of the .sf file. I found that the
> user guide says something in chapter 20.6. about the structure of these
> files. Unfortunately this doesn't help my colleague who is scripting the
> program. He asks if there is documentation about the format specification?
>
> Thanks a lot!
> Andreas
>
> --
> 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

GF

unread,
Mar 13, 2015, 9:46:25 AM3/13/15
to fds...@googlegroups.com
correction: the label lengths (first 3 writes) are 30 not 60 bytes.

Dave Sheppard

unread,
Mar 14, 2015, 5:54:44 AM3/14/15
to fds...@googlegroups.com
When I need to read the fds output files directly, I write a short fortran program to covert to a text file. This is fairly painfull each time because I don't use fortran.

I would prefer to use C. If anyone has gone through the trouble of writing a C script that reads the fds output files, I would love to see it.

Andrew Louie

unread,
Mar 16, 2015, 12:17:33 PM3/16/15
to fds...@googlegroups.com
See the attached c file.

takes slice file name as an argument

prints data to the console



On Sat, Mar 14, 2015 at 5:54 AM, Dave Sheppard <drdtsh...@gmail.com> wrote:
> When I need to read the fds output files directly, I write a short fortran program to covert to a text file. This is fairly painfull each time because I don't use fortran.
>
> I would prefer to use C. If anyone has gone through the trouble of writing a C script that reads the fds output files, I would love to see it.
>
> --
> 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/7dd5c9c6-5331-4aa1-b2d9-1afdb1950504%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
-Andrew Louie :wq
slcf_read.c

Andreas

unread,
Mar 26, 2015, 2:50:22 AM3/26/15
to fds...@googlegroups.com
Thank you everybody for your support on this! I might come back if any further questions come up.
Reply all
Reply to author
Forward
0 new messages