godisreal / test-crowd-dynamics

Testing Result of Crowd Evacuation Behavior by Using FDS+Evac
4 stars 2 forks source link

Visualize 3D Smoke for EVACUATION_MC_MODE=.TRUE. #6

Open godisreal opened 5 years ago

godisreal commented 5 years ago

The probelm refers to multiple evacuation runs for the same fire/smoke scenario. When users give EVACUATION_MC_MODE=.TRUE., FED file is directly read in, not recalculated, but it turns out that 3D smoke cannot be shown in smokeview. There is no load/unload->3Dsmoke. Current solution is given as below. However, it is not a convenient method.

https://groups.google.com/forum/?fromgroups#!searchin/fds-smv/FDS$2BEVAC$3A$20Smokeview$20visualization/fds-smv/EQqIu2mDYzs/WmZinTftrP4J

It seems that no fire/smoke data will be changed when EVACUATION_MC_MODE=.TRUE. So why 3D smoke cannot be visualize directly?

godisreal commented 5 years ago

Original Question by Michele: FDS+EVAC permits to calculate the fire scenario only once and then perform various evacuation scenarios (assuming that the geometry does not change).
This is done by eliminating the ampersand from fire mesh line once the fire scenario has been already calculated, and FDS reads the values saved in CHID_evac.fed file. But when performing the different evacuation simulations, smokeview does not show the fire characteristics anymore. Is there a way to see them again without re-performing the fire scenario?

Answer by Timo Yes, there is a way to use the smoke data, when doing an evacuation calculation without the fire meshes. You need to edit the "CHID.smv" file. Open it in some text editor (like Emacs, Vi, WordPad,...) and search for string "EVA5". Change the file names there. An example:

1) fire+evacuation run, CHID=testrun1

2) just evacuation run (no fire meshes), CHID=testrun2

3) If you want to see testrun2 agents with some, open testrun1.smv and search for "EVA5". Below is a smv file for a case, where we have one fire mesh + two main evacuation meshes:

EVA5 2 1.0000 testrun1_0002.prt5 1 1 EVA5 3 1.0000 testrun1_0003.prt5 1 1

And below is the same one, but with no fire meshes:

EVA5 1 1.0000 testrun2_0001.prt5 1 1 EVA5 2 1.0000 testrun2_0002.prt5 1 1

4) Change the "testrun1.smv" file:

EVA5 2 1.0000 testrun2_0001.prt5 1 1 EVA5 3 1.0000 testrun2_0002.prt5 1 1

NOTE: Now we have "EVA5 2" and "testrun2_0001.prt5" so the "running mesh number" is changed in two places: After the "EVA5" keyword and at the file name ("nnnn").

Well, there is also easier way, you could just copy the "testrun2_nnnn.prt5" files to names "testrun1_mmmm.prt5" files, where mmmm = nnnn + number of the fire meshes, probably. Check always the CHID.smv file for the names. The numbers "nnnn" and "mmmm" might be something else than mmmm = nnnn + number of fire meshes. I do not know. I always have first all the fire mesh lines in the CHID.fds file, and then the evacuation lines. This way makes things clear, if you have some error/warning messages saying that something is wrong in a mesh number X. I now directly if it is an evacuation mesh or a fire mesh.

godisreal commented 5 years ago

Below is the Fortran code about how I_EVAC is specified in evac.f90. However, it does not help to solve the problem. I just paste the code here for quick reference.

Code from line 989 in evac.f90


    ! I_EVAC: 'binary' index:
    ! xxxxx = (0,1)*16 + (0,1)*8 + (0,1)*4 + (0,1)*2 + (0,1)
    ! 0. bit (xxxx1): save flow fields (xxxx0) do not save
    ! 1. bit (xxx1x): save soot + fed  (xxx0x) do not save
    ! 2. bit (xx1xx): read flow fields (xx0xx) do not read
    ! 3. bit (x1xxx): read soot + fed  (x0xxx) do not read
    ! 4. bit (1xxxx): fire calculation (0xxxx) no fire calculation
    ! These are just initialization. Later it is checked if files exists.
    ! If EFF/FED file does not exists, then it is calculated (and saved).
    I_EVAC = 16*0 + 8*0 + 4*0 + 2*0 + 1*0 ! do not save soot,fed files
    IF (.NOT. ALL(EVACUATION_ONLY) ) THEN
       ! Note: If EVACUATION_DRILL=true there are no fire meshes
       ! Note: If NO_EVACUATION=true there are no evacuation meshes
       ! There are fire grids ==> save fed and evac flow fields
       ! Simple chemistry need always REAC line, non-simple chemistry does not need this
       I_EVAC = 16*1 + 8*0 + 4*0 + 2*1 + 1*1
    ELSE
       ! There are no fire meshes
       IF (EVACUATION_MC_MODE) THEN
          ! MC-mode: Try to read EFF file if exists on the hard disk
          IF (EVACUATION_DRILL) THEN
             ! There are no fire grids ==> try to read evac flow fields if MC mode
             I_EVAC = 16*0 + 8*0 + 4*1 + 2*0 + 1*0
          ELSE
             ! There are no fire grids ==> try to read fed and evac flow fields if MC mode
             I_EVAC = 16*0 + 8*1 + 4*1 + 2*0 + 1*0
          END IF
       ELSE
          IF (EVACUATION_DRILL) THEN
             ! There are no fire grids ==> recalculate evac flow fields if not MC mode
             I_EVAC = 16*0 + 8*0 + 4*0 + 2*0 + 1*1
          ELSE
             ! There are no fire grids ==> try to read fed and recalculate evac flow fields if not MC mode
             I_EVAC = 16*0 + 8*1 + 4*0 + 2*0 + 1*1
          END IF
       END IF
    END IF
    !
godisreal commented 5 years ago

About dump.f90: The general idea is given as below.

If there are existing fire output files (including .smv file) 
    Do not update any fire output in EVACUATION_MC_Mode
else
    Create fire output file and .smv file in EVACUATION_MC_Mode for visualization in smokeview
godisreal commented 5 years ago

Add a judgement L_FIRE_CAL = BTEST(I_EVAC,4)

In dump.f90

SUBROUTINE DUMP_HRR(T,DT)

! Record HRR, etc, in the file CHID_hrr.csv

REAL(EB), INTENT(IN) :: T,DT
REAL(FB) :: STIME
INTEGER :: NM,I,N_ZONE_TMP
REAL(EB) :: Q_DOT_TOTAL(N_Q_DOT),M_DOT_TOTAL(2)
REAL(EB), DIMENSION(:), ALLOCATABLE ::  P_ZONE_P

STIME = T_BEGIN + (T-T_BEGIN)*TIME_SHRINK_FACTOR
Q_DOT_TOTAL = 0._EB
M_DOT_TOTAL = 0._EB

DO NM=1,NMESHES
   Q_DOT_TOTAL(:) = Q_DOT_TOTAL(:) + Q_DOT_SUM(:,NM)/MAX(DT,T-T_LAST_DUMP_HRR)
   M_DOT_TOTAL(1) = M_DOT_TOTAL(1) + M_DOT_SUM(1,NM)/MAX(DT,T-T_LAST_DUMP_HRR)
   M_DOT_TOTAL(2) = M_DOT_TOTAL(2) + M_DOT_SUM(2,NM)/MAX(DT,T-T_LAST_DUMP_HRR)
ENDDO

N_ZONE_TMP = 0
IF (N_ZONE>0) THEN
   ALLOCATE(P_ZONE_P(N_ZONE))
   DO I=1,N_ZONE
      IF (.NOT.P_ZONE(I)%EVACUATION) THEN
         N_ZONE_TMP = N_ZONE_TMP + 1
         P_ZONE_P(N_ZONE_TMP) = MESHES(1)%PBAR(1,I) - P_INF
      ENDIF
   ENDDO
ENDIF

WRITE(TCFORM,'(A,I4.4,5A)') "(",12+N_ZONE_TMP,"(",FMT_R,",','),",FMT_R,")"
IF (N_ZONE_TMP>0) THEN
   WRITE(LU_HRR,TCFORM) STIME,0.001_EB*Q_DOT_TOTAL(1:N_Q_DOT),0.001_EB*SUM(Q_DOT_TOTAL(1:N_Q_DOT-1)),&
                        M_DOT_TOTAL(1:2),(P_ZONE_P(I),I=1,N_ZONE_TMP)
ELSE
   WRITE(LU_HRR,TCFORM) STIME,0.001_EB*Q_DOT_TOTAL(1:N_Q_DOT),0.001_EB*SUM(Q_DOT_TOTAL(1:N_Q_DOT-1)),&
                        M_DOT_TOTAL(1:2)
ENDIF

IF (N_ZONE>0) DEALLOCATE(P_ZONE_P)

END SUBROUTINE DUMP_HRR

In main.f90

! Dump out HRR info  after first "gathering" data to node 0

DISP = DISPLS(MYID)+1
CNT  = COUNTS(MYID)

IF_DUMP_HRR: IF (T>=HRR_CLOCK) THEN
   IF (N_MPI_PROCESSES>1) THEN
      REAL_BUFFER_11 = Q_DOT_SUM
      CALL MPI_GATHERV(REAL_BUFFER_11(1,DISP),COUNTS_Q_DOT(MYID),MPI_DOUBLE_PRECISION, &
                       Q_DOT_SUM,COUNTS_Q_DOT,DISPLS_Q_DOT,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,IERR)
      REAL_BUFFER_12 = M_DOT_SUM
      CALL MPI_GATHERV(REAL_BUFFER_12(1,DISP),COUNTS_M_DOT(MYID),MPI_DOUBLE_PRECISION, &
                       M_DOT_SUM,COUNTS_M_DOT,DISPLS_M_DOT,MPI_DOUBLE_PRECISION,0,MPI_COMM_WORLD,IERR)
   ENDIF
   IF (MYID==0) CALL DUMP_HRR(T,DT)
   HRR_CLOCK = HRR_CLOCK + DT_HRR
   Q_DOT_SUM = 0._EB
   M_DOT_SUM = 0._EB
   T_LAST_DUMP_HRR = T
ENDIF IF_DUMP_HRR
godisreal commented 3 years ago

The goal is obtained in fds6_dump205.exe.
By using fds6_dump205 users are able to visualize 3D smoke in multiple evac run (EVACUATION_MC_MODE=.TRUE.).