firemodels / fds

Fire Dynamics Simulator
https://pages.nist.gov/fds-smv/
Other
674 stars 626 forks source link

human velocity #1450

Closed gforney closed 9 years ago

gforney commented 9 years ago
Please complete the following lines...

Application Version:5.5.3
SVN Revision Number:7031
Compile Date:1st Sep 2011
Operating System: Windows XP

Describe details of the issue below:
What lines should be added in the input file,if I want to obtain human velocity values
in the CHID_devc.csv file.

Original issue reported on code.google.com by liujingminn@hotmail.com on 2011-09-01 07:14:22

gforney commented 9 years ago
(No text was entered with this change)

Original issue reported on code.google.com by mcgratta on 2011-09-01 11:58:19

gforney commented 9 years ago
Well, there is no way to get agent velocities to the
CHID_devc.csv file. The spreadsheet evacuation output
is in the file CHID_evac.csv. But there are not the
agent velocities. Agent velocities are stored in the
prt5-files, see the FDS users guide for the file format
and write your own piece of program code that can read
that file format

Put OUTPUT_SPEED=.TRUE. to (some) PERS namelist, so
you get speed information to the prt5 files of the
main evacuation meshes. You can color the agents
according to their speed in Smokeview, if you are
using some avatar that support coloring (like
human_altered_with_data, disk, ellipsoid).

If you want to know the (random, statistical distributions)
unimpeded walking velocities of the agents, then see
the text file CHID_evac.out. At the start of this file,
you see the (x,y,x), Tpre, Tdet, v0, and similar information
for the generated agents. And each agent that is generated
at ENTR are also printed in that file.

So, the file format for the prt5 files (of the main 
evacuation meshes, where the agents are) is:

The "evac.f90" in the source code has "DUMP_EVAC" subroutine:

  SUBROUTINE DUMP_EVAC(T,NM)

   some text clipped....

    REAL(FB), ALLOCATABLE, DIMENSION(:,:) :: QP, AP

   some text clipped....

    ! Write the current time to the prt5 file, then start looping through the particle
classes
    WRITE(LU_PART(NM)) REAL(T,FB)

   some text clipped....

             CASE(242)  ! SPEED, Human speed
                QP(NPP,NN) = REAL(SQRT(HR%U**2 + HR%V**2),FB)

   some text clipped....

       ! Dump human data into the .prt5 file
       !
       WRITE(LU_PART(NM)) NPLIM
       WRITE(LU_PART(NM)) (XP(I),I=1,NPLIM),(YP(I),I=1,NPLIM),(ZP(I),I=1,NPLIM), &
            (AP(I,1),I=1,NPLIM),(AP(I,2),I=1,NPLIM),(AP(I,3),I=1,NPLIM),(AP(I,4),I=1,NPLIM)
       WRITE(LU_PART(NM)) (TA(I),I=1,NPLIM)
       IF (EVAC_N_QUANTITIES > 0) THEN
          WRITE(LU_PART(NM)) ((QP(I,NN),I=1,NPLIM),NN=1,EVAC_N_QUANTITIES)
       END IF

So, the NPLIM tells how many agents there are for this read statement.

And the header for the prt5 files is written in "part.f90":

      OPEN(LU_PART(NM),FILE=FN_PART(NM),FORM='UNFORMATTED',STATUS='REPLACE')
      WRITE(LU_PART(NM)) ONE_INTEGER                ! The number ONE, to indicate file
Endian-ness
      WRITE(LU_PART(NM)) NINT(VERSION_NUMBER*100.)  ! FDS version number
      EVAC_ONLY2: IF (EVACUATION_ONLY(NM)) THEN
         WRITE(LU_PART(NM)) N_EVAC
         DO N=1,N_EVAC
            WRITE(LU_PART(NM)) EVAC_N_QUANTITIES,ZERO_INTEGER  ! ZERO_INTEGER is a
place holder for future INTEGER quantities
            DO NN=1,EVAC_N_QUANTITIES
               WRITE(LU_PART(NM)) OUTPUT_QUANTITY(EVAC_QUANTITIES_INDEX(NN))%NAME
               WRITE(LU_PART(NM)) OUTPUT_QUANTITY(EVAC_QUANTITIES_INDEX(NN))%UNITS
            ENDDO
         ENDDO
      ELSE

The number of the additional evacuation quantities is EVAC_N_QUANTITIES
and you can see the quantities in the .smv file. Below is an example,
where OUTPUT_SPEED=.TRUE. is the only "OUPTUT_XXX" type thing on
the PERS namelists:

CLASS_OF_HUMANS
 Human
      0.15294      0.25098      0.54510
  2
 HUMAN_COLOR
 color

 HUMAN_SPEED
 speed
 m/s

The "2" just above "HUMAN_COLOR" is the EVAC_N_QUANTITIES.
If you have COLOR_METHOD= 0 or some other positive value,
see the manual, then the color information is written
to the prt5 file. Default is COLOR_METHOD=-1, no color
information is written to the file and you do not have
the "HUMAN_COLOR" and EVAC_N_QUANTITIES is one less.

TimoK

Original issue reported on code.google.com by tkorhon1 on 2011-09-05 15:30:56

gforney commented 9 years ago
Well, I'll close this issue. The agent velocities will
not be in the .csv file. This file format is not good
for a data that should be written for each agent. The
data that this issue is asking for is already in the
prt5 files. There are some instructions above how to
get this data there and there has been also discussions
on the discussion forum. So, the answer is out there.

One needs to write a small Fortran/C++/some other
language programme that reads the file format and
then writes the data like the user wants.

TimoK

Original issue reported on code.google.com by tkorhon1 on 2011-12-21 10:15:13

gforney commented 9 years ago
Hallo Timo,
thanks for your efforts. Based on you comments I wrote a Fortran-Code to get out the
prt5-file the trajectories of the particles. 

Please feel free to give your feedback or hints to enhance it. There are some information
in the prt5-file that I ignore. But maybe they could also be useful.

Best,
Mohcine 

Original issue reported on code.google.com by m.chraibi on 2012-10-02 16:22:11

gforney commented 9 years ago
PS: Here is the attached file.

Original issue reported on code.google.com by m.chraibi on 2012-10-02 16:25:37


gforney commented 9 years ago
Nice to hear that you managed to read the prt5 files.
There are also information on the body size (and coloring)
in the prt5 files. And for the body angle.

TimoK

Original issue reported on code.google.com by tkorhon1 on 2012-10-22 13:06:56

gforney commented 9 years ago
Hi Timo,
body size, angle and colors may be good for visualisation issues. Can you please give
more hints on the code line where those infos are written in the prt5?

Original issue reported on code.google.com by m.chraibi on 2012-10-22 14:09:48

gforney commented 9 years ago
The prt5 files for the main evacuation meshes, where the
agents are, are written mostly in the Fortran file evac.f90.
The data is written in SUBROUTINE DUMP_EVAC(T,NM) starting
at the line 13888 (svn 12885 revision). The dump_evac 
subroutine (nor the evacuation-prt5 format) has not been
changed for some time, so any evac.f90 revision will do.

Some arrays in the subroutine:

       ! body angle, semi major axis, semi minor axis
       ALLOCATE(AP(NPLIM,4),STAT=IZERO)

And some for the color of the agents and is some user
inputs like OUTPUT_SPEED is wanted, one needs a temporaty
array for these. The default for colors is:
          COLOR_METHOD       = -1 ! Default is standard human colors in Smokeview
So, by default EVAC_N_QUANTITIES = 0.

      IF (EVAC_N_QUANTITIES > 0) THEN
          ALLOCATE(QP(NPLIM,EVAC_N_QUANTITIES),STAT=IZERO)
          CALL ChkMemErr('DUMP_EVAC','QP',IZERO)
      END IF

And the additional information that is printed is below:

          AP(NPP,1) = 180.0_FB*REAL(HR%Angle/Pi,FB)
          AP(NPP,2) =   2.0_FB*REAL(HR%Radius,FB)
          AP(NPP,3) =   2.0_FB*REAL(HR%r_torso,FB)
          ! Height of a human scaled by radius, default male 1.80 m
          AP(NPP,4) =  1.80_FB*REAL(HR%Radius/0.27_EB,FB)

So, AP(:,1) is the body angle (degrees), AP(:,2) semi-major axis
of the agent (the social force radius, i.e., the circle where the
body ellipse just fits inside), AP(:,3)  semi-minor axis of the
agent ellipse (the radius of the body torso circle), AP(:,4) the
height of the agent (a standard male, radius 27 cm, is 180 cm tall
and the others are scaled accordingly).

The loop  DO NN=1,EVAC_N_QUANTITIES lists the additional output
quantities, if the user input says so.

And below are the lines that are dumped at each output dump
time step, the arrays xp, yp, zp contain (x,y,z) data, of course:

       WRITE(LU_PART(NM)) NPLIM
       WRITE(LU_PART(NM)) (XP(I),I=1,NPLIM),(YP(I),I=1,NPLIM),(ZP(I),I=1,NPLIM), &
            (AP(I,1),I=1,NPLIM),(AP(I,2),I=1,NPLIM),(AP(I,3),I=1,NPLIM),(AP(I,4),I=1,NPLIM)
       WRITE(LU_PART(NM)) (TA(I),I=1,NPLIM)
       IF (EVAC_N_QUANTITIES > 0) THEN
          WRITE(LU_PART(NM)) ((QP(I,NN),I=1,NPLIM),NN=1,EVAC_N_QUANTITIES)
       END IF

The header of the file is written in the dump.f90. The header should
be more or less the same as for the fire prt5 files, that is also
written to the FDS user documentation.

Hope that this helps so that you. Well, below the lines from
the dump.f90:

      OPEN(LU_PART(NM),FILE=FN_PART(NM),FORM='UNFORMATTED',STATUS='REPLACE')
      WRITE(LU_PART(NM)) ONE_INTEGER                ! The number ONE, to indicate file
Endian-ness
      WRITE(LU_PART(NM)) NINT(VERSION_NUMBER*100.)  ! FDS version number
      EVAC_ONLY2: IF (EVACUATION_ONLY(NM)) THEN
         WRITE(LU_PART(NM)) N_EVAC
         DO N=1,N_EVAC
            WRITE(LU_PART(NM)) EVAC_N_QUANTITIES,ZERO_INTEGER  ! ZERO_INTEGER is a
place holder for future INTEGER quantities
            DO NN=1,EVAC_N_QUANTITIES
               WRITE(LU_PART(NM)) OUTPUT_QUANTITY(EVAC_QUANTITIES_INDEX(NN))%NAME
               WRITE(LU_PART(NM)) OUTPUT_QUANTITY(EVAC_QUANTITIES_INDEX(NN))%UNITS
            ENDDO
         ENDDO
      ELSE
         WRITE(LU_PART(NM)) N_LAGRANGIAN_CLASSES
         DO N=1,N_LAGRANGIAN_CLASSES
            LPC => LAGRANGIAN_PARTICLE_CLASS(N)
            WRITE(LU_PART(NM)) LPC%N_QUANTITIES,ZERO_INTEGER  ! ZERO_INTEGER is a place
holder for future INTEGER quantities
            DO NN=1,LPC%N_QUANTITIES
               WRITE(LU_PART(NM)) LPC%SMOKEVIEW_LABEL(NN)(1:30)
               WRITE(LU_PART(NM)) OUTPUT_QUANTITY(LPC%QUANTITIES_INDEX(NN))%UNITS
            ENDDO
         ENDDO
      ENDIF EVAC_ONLY2

Well, the N_EVAC is the number of different avatar types. By default,
you have just one avatar type so N_EVAC=1. But if you want, for example,
the evacuees and firemen having different avatars, like firemen having
some gear, then N_EVAC > 1. The N_EVAC loop is also in the dump_evac
subroutine. So N_EVAC is similar to N_LAGRANGIAN_CLASSES, which is
used for the fire mesh particles.

TimoK

Original issue reported on code.google.com by tkorhon1 on 2012-10-24 08:47:20

gforney commented 9 years ago
Hi Timo,
well it seems that we need again that parser. I've got a ptr5-file from FDS 6.1 and
the parser "thinks" that NPLIM is 0. Here are the header data extracted:
 #  ONE_INTEGER =  1
 #  VERSION_NUMBER = 6.00
 #  N_EVAC =  1
 #  EVAC_N_QUANTITIES =  1
 #  NAME  =  PARTICLE DIAMETER             
 #  UNITS = mu-m                          
 #  MAX PEDESTRIANS =            0
 Got NPLIM =    0
STOP 0

I think that the problem I have right now is in the else of IF (EVACUATION_ONLY(NM))

How can I know, given a ptr5-file, if EVACUATION_ONLY(NM) is true or false?

Original issue reported on code.google.com by m.chraibi on 2014-06-06 12:15:32

gforney commented 9 years ago
It seems that the amount of information written in the above IF is the same as in ELSE
I just had a closer code to the fds-code and found out that in dump.f90 the trajectories
are written: 
WRITE(LU_PART(NM)) STIME
WRITE(LU_PART(NM)) NPLIM
WRITE(LU_PART(NM)) (XP(I),I=1,NPLIM),(YP(I),I=1,NPLIM),(ZP(I),I=1,NPLIM)
WRITE(LU_PART(NM)) (TA(I),I=1,NPLIM)
WRITE(LU_PART(NM)) ((QP(I,NN),I=1,NPLIM),NN=1,LPC%N_QUANTITIES) 

BUT in evac.f90 the same happens: 
 WRITE(LU_PART(NM)) REAL(T,FB) 
 WRITE(LU_PART(NM)) NPLIM   
 WRITE(LU_PART(NM)) (XP(I),I=1,NPLIM),(YP(I),I=1,NPLIM),(ZP(I),I=1,NPLIM), & 
 (AP(I,1),I=1,NPLIM),(AP(I,2),I=1,NPLIM),(AP(I,3),I=1,NPLIM),(AP(I,4),I=1,NPLIM) 
  WRITE(LU_PART(NM)) (TA(I),I=1,NPLIM) 
 WRITE(LU_PART(NM)) ((QP(I,NN),I=1,NPLIM),NN=1,EVAC_N_QUANTITIES)

I' m a bit confused: Why do you right +- the same information at two different places
in the same file?

Thanks for any help. 

Original issue reported on code.google.com by m.chraibi on 2014-06-06 15:19:57

gforney commented 9 years ago
The human data is written to the prt5-files in the evac.f90.
The dump.f90 subroutine DUMP_PART is just used for the
other (fire related) lagrangian particles, there is
a "IF (EVACUATION_ONLY(NM)) RETURN" at the beginning of
this subroutine. So, dump.f90 does not write any t,x,y,z,...
information for the evacuation meshes. Just the file header
is written in the dump.f90 for the evacuation mesh prt5-files.

In FDS6 there are two evacuation meshes per "one floor". The
user defined mesh (the "main evacuation mesh"), which has 
EVACUATION_GRID(NM)=.true. inside the source code. The other
is a visibility mesh, where EVACUATION_GRID(NM)=.false. and this
visibility mesh is generated automatically (no user input for this).

Just the EVACUATION_GRID(NM)=.true. meshes write .prt5 files.

      OPEN(LU_PART(NM),FILE=FN_PART(NM),FORM='UNFORMATTED',STATUS='REPLACE')
      WRITE(LU_PART(NM)) ONE_INTEGER                ! The number ONE, to indicate file
Endian-ness
      WRITE(LU_PART(NM)) NINT(VERSION_NUMBER*100.)  ! FDS version number
      EVAC_ONLY2: IF (EVACUATION_ONLY(NM)) THEN
         WRITE(LU_PART(NM)) N_EVAC
         DO N=1,N_EVAC
            WRITE(LU_PART(NM)) EVAC_N_QUANTITIES,ZERO_INTEGER  ! ZERO_INTEGER is a
place holder for future INTEGER quantities
            DO NN=1,EVAC_N_QUANTITIES
               WRITE(LU_PART(NM)) OUTPUT_QUANTITY(EVAC_QUANTITIES_INDEX(NN))%NAME(1:30)
               WRITE(LU_PART(NM)) OUTPUT_QUANTITY(EVAC_QUANTITIES_INDEX(NN))%UNITS(1:30)
            ENDDO
         ENDDO
      ELSE
         WRITE(LU_PART(NM)) N_LAGRANGIAN_CLASSES
         DO N=1,N_LAGRANGIAN_CLASSES
            LPC => LAGRANGIAN_PARTICLE_CLASS(N)
            WRITE(LU_PART(NM)) LPC%N_QUANTITIES,ZERO_INTEGER  ! ZERO_INTEGER is a place
holder for future INTEGER quantities
            DO NN=1,LPC%N_QUANTITIES
               WRITE(LU_PART(NM)) LPC%SMOKEVIEW_LABEL(NN)(1:30)
               WRITE(LU_PART(NM)) OUTPUT_QUANTITY(LPC%QUANTITIES_INDEX(NN))%UNITS(1:30)
            ENDDO
         ENDDO
      ENDIF EVAC_ONLY2

So, the header seems to be the same as in FDS5 for the evacuation mesh prt5
files.

SUBROUTINE DUMP_PART(T,NM)

! Dump Lagrangian particle data to CHID.prt5

USE MEMORY_FUNCTIONS, ONLY: CHKMEMERR 

INTEGER, INTENT(IN)  :: NM
REAL(EB), INTENT(IN) :: T
REAL(EB) :: STIME
INTEGER  :: NPP,NPLIM,I,N,NN,IZERO
REAL(EB), ALLOCATABLE, DIMENSION(:) :: XP,YP,ZP
REAL(EB), ALLOCATABLE, DIMENSION(:,:) :: QP
INTEGER, ALLOCATABLE, DIMENSION(:) :: TA

IF (EVACUATION_ONLY(NM)) RETURN
CALL POINT_TO_MESH(NM)

! Write the current time to the prt5 file, then start looping through the particle
classes

And so on.

TimoK

Original issue reported on code.google.com by tkorhon1 on 2014-06-09 12:24:47

gforney commented 9 years ago
Thanks Timo,

I checked the function in smokeview that reads a prt5-file. I'm now pretty sure, that
the parser is doing the right things. Here is the last version https://github.com/chraibi/ptr5parser

The file that I had was for an FDS-simulation without any pedestrians. So not a surprise
to have NPED=0. :-)

Best,

Original issue reported on code.google.com by m.chraibi on 2014-06-16 20:28:42

gforney commented 9 years ago
Thanks for the link to the parser!

TimoK

Original issue reported on code.google.com by tkorhon1 on 2014-06-17 09:27:10