-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathevac.f90
15651 lines (14882 loc) · 691 KB
/
evac.f90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
!
! This module contains the FDS+Evac human movement algorithm and
! related subprograms. Some of the types are defined in the
! type.f90 module file. The statistic (cumulative distributions) are in
! the ieva.f90, which includes a module dcdflib.f by netlib (http://www.netlib.org/).
! The DCDFLIB has been written in the public domain. Some of the DCDFLIB code has
! appeared in an ACM publication and it is subject to their algorithms policy,
! see the comments at the start of the DCDFLIB in ieva.f90.
!
! Author: Timo Korhonen, VTT Technical Research Centre of Finland, 2007-2010
!
!!!!!!!!!!!!!!
!
MODULE EVAC
!
USE PRECISION_PARAMETERS
USE MESH_VARIABLES
USE GLOBAL_CONSTANTS
USE TRAN
USE TYPES
USE STAT
USE COMP_FUNCTIONS
USE MATH_FUNCTIONS
USE MEMORY_FUNCTIONS
USE MESH_POINTERS
USE PHYSICAL_FUNCTIONS, ONLY : GET_MASS_FRACTION, FED
USE DCDFLIB, ONLY : DCDFLIB_Gamma => Gamma
USE DEVICE_VARIABLES
USE CONTROL_VARIABLES
!
IMPLICIT NONE
!
CHARACTER(255), PARAMETER :: evacid='$Id: evac.f90 9718 2011-12-30 17:49:06Z drjfloyd $'
CHARACTER(255), PARAMETER :: evacrev='$Revision: 9718 $'
CHARACTER(255), PARAMETER :: evacdate='$Date: 2011-12-30 09:49:06 -0800 (Fri, 30 Dec 2011) $'
!
PRIVATE
! Public subprograms (called from the main program or read or dump)
PUBLIC EVACUATE_HUMANS, INITIALIZE_EVACUATION, INIT_EVAC_GROUPS
PUBLIC READ_EVAC, DUMP_EVAC, DUMP_EVAC_CSV, PREPARE_TO_EVACUATE, CLEAN_AFTER_EVACUATE
PUBLIC EVAC_MESH_EXCHANGE, INITIALIZE_EVAC_DUMPS, GET_REV_EVAC
! Public variables (needed in the main program or dump):
PUBLIC N_DOORS, N_EXITS, N_ENTRYS, N_SSTANDS, EVAC_DOORS, EVAC_EXITS, EVAC_ENTRYS, EVAC_SSTANDS, &
EVAC_EXIT_TYPE, EVAC_DOOR_TYPE, EVAC_ENTR_TYPE, EVAC_SSTAND_TYPE, NPC_EVAC, N_HOLES, &
EVACUATION_TYPE, EVAC_HOLE_TYPE, EVAC_EVACS, EVAC_HOLES, N_CO_EXITS, N_DOOR_MESHES, N_STRS
PUBLIC EVAC_EMESH_EXITS_TYPE, EMESH_EXITS, EMESH_ID, EMESH_IJK, EMESH_XB, EMESH_NM, EMESH_NFIELDS, &
EMESH_INDEX, EVAC_FDS6, HUMAN_SMOKE_HEIGHT, EVAC_DELTA_SEE, EVAC_EMESH_STAIRS_TYPE, EMESH_STAIRS
!
CHARACTER(255):: EVAC_VERSION = '2.4.1'
CHARACTER(255) :: EVAC_COMPILE_DATE
INTEGER :: EVAC_MODULE_REV
!
! This is a group of persons, who are initialized together, i.e., they have same mass, speed,
! etc distributions and they are all put in the given rectangle.
! (&EVAC lines)
TYPE EVACUATION_TYPE
REAL(EB) :: X1=0._EB,X2=0._EB,Y1=0._EB,Y2=0._EB,Z1=0._EB,Z2=0._EB,T_START=0._EB, Angle=0._EB
REAL(EB) :: Tpre_mean=0._EB, Tpre_para=0._EB, Tpre_para2=0._EB, Tpre_low=0._EB, Tpre_high=0._EB
REAL(EB) :: Tdet_mean=0._EB, Tdet_para=0._EB, Tdet_para2=0._EB, Tdet_low=0._EB, Tdet_high=0._EB
REAL(EB) :: TIME_FALL_DOWN=0._EB, TARGET_X=0._EB, TARGET_Y=0._EB, DELTA_X=0._EB, DELTA_Y=0._EB
CHARACTER(60) :: CLASS_NAME='null', ID='null', AVATAR_TYPE_NAME='null'
CHARACTER(30) :: GRID_NAME='null', PROP_ID='null'
LOGICAL :: EVACFILE=.FALSE., After_Tpre=.FALSE., No_Persons=.FALSE., SHOW=.TRUE.
INTEGER :: N_INITIAL=0,SAMPLING=0, IPC=0, IMESH=0, AVATAR_TYPE_INDEX=0
INTEGER :: I_PRE_DIST=0, I_DET_DIST=0, GUARD_MEN=0
INTEGER :: GN_MIN=0, GN_MAX=0
INTEGER :: N_VENT_FFIELDS=0, Avatar_Color_Index=0, I_AGENT_TYPE=2
INTEGER, DIMENSION(3) :: RGB=-1, AVATAR_RGB=-1
INTEGER, POINTER, DIMENSION(:) :: I_DOOR_NODES =>NULL()
INTEGER, POINTER, DIMENSION(:) :: I_VENT_FFIELDS =>NULL()
REAL(EB), POINTER, DIMENSION(:) :: P_VENT_FFIELDS =>NULL()
END TYPE EVACUATION_TYPE
!
! An evacuation hole, i.e., a rectangle where humans should not be put.
! This makes the &EVAC lines easier to define.
! (&EVHO lines)
TYPE EVAC_HOLE_TYPE
REAL(EB) :: X1=0._EB,X2=0._EB,Y1=0._EB,Y2=0._EB,Z1=0._EB,Z2=0._EB, TIME_FALL_DOWN=-1.0_EB
CHARACTER(60) :: ID='null', PERS_ID='null', EVAC_ID='null'
CHARACTER(30) :: GRID_NAME='null'
INTEGER, DIMENSION(3) :: RGB=-1
LOGICAL :: SHOW=.TRUE.
INTEGER :: IMESH=0
END TYPE EVAC_HOLE_TYPE
!
! A spectator stand. IOR: which x,y line is the bottom line of the stand.
! ior=+1 x=x2, ior=-1 x=x1, ior=+2 y=y2, ior=-2 y=y1
! H is the height of the stand, S is the length along the incline.
! (&EVSS lines)
TYPE EVAC_SSTAND_TYPE
REAL(EB) :: X1=0._EB,X2=0._EB,Y1=0._EB,Y2=0._EB,Z1=0._EB,Z2=0._EB, H=0._EB, H0=0._EB, S=0._EB
REAL(EB) :: Esc_SpeedUp=0._EB, Esc_SpeedDn=0._EB
REAL(EB) :: FAC_V0_UP=1._EB, FAC_V0_DOWN=1._EB, FAC_V0_HORI=1._EB
REAL(EB) :: cos_x=1._EB, cos_y=1._EB, sin_x=0._EB, sin_y=0._EB
CHARACTER(60) :: ID='null'
CHARACTER(30) :: GRID_NAME='null'
CHARACTER(30) :: VENT_FFIELD='null'
INTEGER, DIMENSION(3) :: RGB=-1
INTEGER :: IMESH=0, IOR=0, I_VENT_FFIELD=0
REAL(EB) :: UBAR0=0._EB, VBAR0=0._EB
LOGICAL :: Use_v0=.FALSE., SHOW=.TRUE., COUNT_ONLY=.FALSE.
REAL(EB), DIMENSION(3) :: ORIENTATION=0.0_EB
END TYPE EVAC_SSTAND_TYPE
!
! Humans belong to some small group (1 to about 5 persons). This type
! collects the common properties of the group.
TYPE GROUP_TYPE
REAL(EB) :: GROUP_X=0._EB, GROUP_Y=0._EB, MAX_DIST_CENTER=0._EB, LIMIT_COMP=0._EB
REAL(EB) :: GROUP_EFF=0._EB, RADIUS_COMPLETE_0=0._EB, RADIUS_COMPLETE_1=0._EB
REAL(EB) :: Speed=0._EB, IntDose=0._EB, Tpre=0._EB, Tdoor=0._EB, Tdet=0._EB
INTEGER :: GROUP_SIZE=0, GROUP_ID=0, COMPLETE=0, IEL=0, Avatar_Color_Index=0
INTEGER, DIMENSION(3) :: AVATAR_RGB=-1
INTEGER, POINTER, DIMENSION(:) :: GROUP_I_FFIELDS =>NULL()
END TYPE GROUP_TYPE
TYPE KNOWN_DOOR_TYPE
INTEGER :: N_nodes=0, I_Target=0
INTEGER, POINTER, DIMENSION(:) :: I_nodes =>NULL()
END TYPE KNOWN_DOOR_TYPE
!
! This defines a class of persons, e.g. soccer fan.
! (&PERS lines)
TYPE EVAC_PERS_TYPE
REAL(EB) :: D_mean=0._EB, D_para=0._EB, D_para2=0._EB, D_low=0._EB, D_high=0._EB
REAL(EB) :: V_mean=0._EB, V_para=0._EB, V_para2=0._EB, V_low=0._EB, V_high=0._EB
REAL(EB) :: Tau_mean=0._EB, Tau_para=0._EB, Tau_para2=0._EB, Tau_low=0._EB, Tau_high=0._EB
REAL(EB) :: Tpre_mean=0._EB, Tpre_para=0._EB, Tpre_para2=0._EB, Tpre_low=0._EB, Tpre_high=0._EB
REAL(EB) :: Tdet_mean=0._EB, Tdet_para=0._EB, Tdet_para2=0._EB, Tdet_low=0._EB, Tdet_high=0._EB
REAL(EB) :: A=0._EB,B=0._EB,Lambda=0._EB,C_Young=0._EB,Gamma=0._EB,Kappa=0._EB
REAL(EB) :: r_torso=0._EB,r_shoulder=0._EB,d_shoulder=0._EB,m_iner=0._EB, Tau_iner=0._EB
REAL(EB) :: FAC_V0_UP=-1._EB, FAC_V0_DOWN=-1._EB, FAC_V0_HORI=-1._EB
CHARACTER(60) :: ID='null'
INTEGER :: I_DIA_DIST=0, I_VEL_DIST=0, I_PRE_DIST=0, I_DET_DIST=0, I_TAU_DIST=0
INTEGER :: Avatar_Color_Index=0
INTEGER, DIMENSION(3) :: RGB=-1, AVATAR_RGB=-1
END TYPE EVAC_PERS_TYPE
!
! Exit door type: this just count the number of persons
! T_first: first person's exit time (saved for output)
! CHECK_FLOW: If true then the flow can not exceed Flow_max
! (&EXIT lines)
TYPE EVAC_EXIT_TYPE
REAL(EB) :: T_first=0._EB, T_last=0._EB, Flow_max=0._EB, Width=0._EB, Height=2.0_EB
REAL(EB) :: X1=0._EB, X2=0._EB, Y1=0._EB, Y2=0._EB, Z1=0._EB, Z2=0._EB, &
X=0._EB, Y=0._EB, Z=0._EB, Xsmoke=0._EB, Ysmoke=0._EB, Zsmoke=0._EB, &
TIME_OPEN=0._EB, TIME_CLOSE=0._EB, R_NTARGET=0._EB, XYZ_Z=0._EB
INTEGER :: IOR=0, ICOUNT=0, IMESH=0, INODE=0, IMODE=1
INTEGER, DIMENSION(50) :: NTARGET=0
REAL(EB) :: FED_CO_CO2_O2=0._EB, SOOT_DENS=0._EB, TMP_G=0._EB, RADFLUX=0._EB
INTEGER :: II=0, JJ=0, KK=0, FED_MESH=0
LOGICAL :: CHECK_FLOW=.FALSE., COUNT_ONLY=.FALSE., SHOW=.TRUE., COUNT_DENSITY=.FALSE.
LOGICAL :: LOCKED_WHEN_CLOSED=.FALSE., TARGET_WHEN_CLOSED=.FALSE., WAIT_AT_XYZ=.TRUE.
INTEGER :: STR_INDX=0, STR_SUB_INDX=0
CHARACTER(60) :: ID='null', PERS_ID='null', EVAC_ID='null'
CHARACTER(60) :: TO_NODE='null'
CHARACTER(30) :: GRID_NAME='null'
CHARACTER(30) :: VENT_FFIELD='null'
INTEGER :: I_VENT_FFIELD=0, Avatar_Color_Index=0, I_EMESH_EXITS=0
INTEGER, DIMENSION(3) :: RGB=-1
REAL(EB), DIMENSION(3) :: ORIENTATION=0.0_EB
END TYPE EVAC_EXIT_TYPE
!
! Like exit, but door will always put the persons to some
! other node. (Thus no count_only option.)
! (&DOOR lines)
TYPE EVAC_DOOR_TYPE
REAL(EB) :: T_first=0._EB, T_last=0._EB, Flow_max=0._EB, Width=0._EB, Height=2.0_EB
REAL(EB) :: X1=0._EB, X2=0._EB, Y1=0._EB, Y2=0._EB, Z1=0._EB, Z2=0._EB, &
X=0._EB, Y=0._EB, Z=0._EB, Xsmoke=0._EB, Ysmoke=0._EB, Zsmoke=0._EB, &
TIME_OPEN=0._EB, TIME_CLOSE=0._EB, R_NTARGET=0._EB, XYZ_Z=0._EB
INTEGER :: IOR=0, ICOUNT=0, INODE=0, INODE2=0, IMESH=0, IMESH2=0, IMODE=1, ICORR_TO=0
INTEGER, DIMENSION(50) :: NTARGET=0
INTEGER :: STR_INDX=0, STR_SUB_INDX=0
REAL(EB) :: FED_CO_CO2_O2=0._EB, SOOT_DENS=0._EB, TMP_G=0._EB, RADFLUX=0._EB
INTEGER :: II=0, JJ=0, KK=0, FED_MESH=0
LOGICAL :: CHECK_FLOW=.FALSE., EXIT_SIGN=.FALSE., KEEP_XY=.FALSE., SHOW=.TRUE.
LOGICAL :: LOCKED_WHEN_CLOSED=.FALSE., TARGET_WHEN_CLOSED=.FALSE., WAIT_AT_XYZ=.TRUE.
CHARACTER(60) :: ID='null'
CHARACTER(60) :: TO_NODE='null'
CHARACTER(30) :: GRID_NAME='null'
CHARACTER(30) :: VENT_FFIELD='null'
INTEGER :: I_VENT_FFIELD=0, Avatar_Color_Index=0, I_EMESH_EXITS=0
INTEGER, DIMENSION(3) :: RGB=-1
REAL(EB), DIMENSION(3) :: ORIENTATION=0.0_EB
END TYPE EVAC_DOOR_TYPE
!
! Like door, but corr will model stairs (or corridors).
! The parameters, like velocity as function of density etc.
! define if it is corridor or stairway
! (&CORR lines)
TYPE EVAC_CORR_TYPE
REAL(EB) :: T_first=0._EB, T_last=0._EB, Flow_max=0._EB, Width1=0._EB, Width2=0._EB
REAL(EB) :: X1=0._EB,X2=0._EB,Y1=0._EB,Y2=0._EB,Z1=0._EB,Z2=0._EB, Width=0._EB
REAL(EB) :: Eff_Width=0._EB, Eff_Length=0._EB, Eff_Area=0._EB, Fac_Speed=0._EB
REAL(EB) :: Travel_Time=0._EB, Time_Wait_To_Fill=0._EB, Time_Last_In=0._EB, Time_Stop=0._EB, Time_Start=0._EB
INTEGER :: Elevator_Mode=1
! Note: Corridor may have 2 different points, where smoke etc. data is saved.
REAL(EB), DIMENSION(2) :: FED_CO_CO2_O2=0._EB, SOOT_DENS=0._EB, TMP_G=0._EB, RADFLUX=0._EB
INTEGER :: FED_MESH=0, FED_MESH2=0
INTEGER, DIMENSION(2) :: II=0, JJ=0, KK=0
INTEGER :: IOR=0, ICOUNT=0, INODE=0, INODE2=0, IMESH=0, IMESH2=0, IDOOR_FROM=0
INTEGER :: MAX_HUMANS_INSIDE=0, n_inside=0
LOGICAL :: CHECK_FLOW=.FALSE., ELEVATOR=.FALSE.
INTEGER, DIMENSION(3) :: RGB=-1
CHARACTER(60) :: ID='null'
CHARACTER(60) :: TO_NODE='null'
CHARACTER(30) :: GRID_NAME='null'
TYPE (CORR_LL_TYPE), POINTER :: First =>NULL()
END TYPE EVAC_CORR_TYPE
!
! STRS is a construct to build a staircase. STRS consists of stairs and landings.
TYPE EVAC_STRS_TYPE
REAL(EB) :: XB(6)
REAL(EB), POINTER, DIMENSION(:,:) :: XB_NODE =>NULL(), XB_CORE =>NULL()
REAL(EB) :: FAC_V0_HORI=1._EB, FAC_V0_DOWN=1._EB, FAC_V0_UP=1._EB
INTEGER :: ICOUNT=0, INODE=0, INODE2=0, IMESH=0, IMESH2=0, N_CORES = 0
INTEGER :: N_LANDINGS, N_NODES, N_NODES_OUT, N_NODES_IN
INTEGER, POINTER, DIMENSION(:) :: NODE_IOR =>NULL(), NODE_TYPE =>NULL(), NODES_IN =>NULL()
INTEGER, POINTER, DIMENSION(:) :: NODES_OUT =>NULL(), I_CORE =>NULL()
CHARACTER(60) :: ID
CHARACTER(30) :: MESH_ID
LOGICAL RIGHT_HANDED
END TYPE EVAC_STRS_TYPE
!
! This produces more humans on the floor specified by the coordinates.
! Person types ('soccer_fan' etc) are also defined here for these persons.
! (&ENTR lines)
TYPE EVAC_ENTR_TYPE
REAL(EB) :: T_first=0._EB, T_last=0._EB, Flow=0._EB, Width=0._EB, T_Start=0._EB, T_Stop=0._EB
REAL(EB) :: X1=0._EB,X2=0._EB,Y1=0._EB,Y2=0._EB,Z1=0._EB,Z2=0._EB, Height=2.0_EB, Z=0.0_EB
INTEGER :: IOR=0, ICOUNT=0, IPC=0, IMESH=0, INODE=0, IMODE=-1, &
TO_INODE=0, N_Initial=0, Max_Humans=-1, &
STR_INDX=0, STR_SUB_INDX=0, AVATAR_TYPE_INDEX=0
CHARACTER(60) :: CLASS_NAME='null', ID='null', AVATAR_TYPE_NAME='null'
CHARACTER(60) :: TO_NODE='null'
CHARACTER(30) :: GRID_NAME='null', Max_Humans_Ramp, PROP_ID='null'
LOGICAL :: After_Tpre=.FALSE., No_Persons=.FALSE., SHOW=.TRUE.
INTEGER :: N_VENT_FFIELDS=0, Avatar_Color_Index=0, I_AGENT_TYPE=2
INTEGER, POINTER, DIMENSION(:) :: I_DOOR_NODES =>NULL()
INTEGER, POINTER, DIMENSION(:) :: I_VENT_FFIELDS =>NULL()
REAL(EB), POINTER, DIMENSION(:) :: P_VENT_FFIELDS =>NULL()
INTEGER, DIMENSION(3) :: RGB=-1, AVATAR_RGB=-1
REAL(EB), DIMENSION(3) :: ORIENTATION=0.0_EB
END TYPE EVAC_ENTR_TYPE
!
TYPE EVAC_NODE_TYPE
INTEGER :: Node_Index=0, IMESH=0
CHARACTER(60) :: ID='null', Node_Type='null'
CHARACTER(30) :: GRID_NAME='null'
END TYPE EVAC_NODE_TYPE
!
! Linked list, needed for the corridors
TYPE CORR_LL_TYPE
TYPE (HUMAN_TYPE) :: HUMAN
REAL(EB) :: T_in=0._EB, T_out=0._EB
LOGICAL :: From1_To2=.FALSE.
INTEGER :: Index=0
TYPE (CORR_LL_TYPE), POINTER :: Next =>NULL()
END TYPE CORR_LL_TYPE
!
! Save device data for the evacuation calculation
TYPE EVAC_DEVC_TYPE
REAL(EB) :: T_Change=0._EB
LOGICAL :: CURRENT=.FALSE., PRIOR=.FALSE., USE_NOW=.FALSE.
INTEGER :: I_Devc=0, I_Devc_Evac=0, I_Type=0
CHARACTER(30) :: DEVC_ID='null'
END TYPE EVAC_DEVC_TYPE
!
! The EDEV namelists, which contain information how the agents
! act to the device and/or control information.
TYPE EVAC_EDEV_TYPE
CHARACTER(60) :: ID='null', PERS_ID='null', EVAC_ID='null'
CHARACTER(30) :: MESH_ID='null'
CHARACTER(30), POINTER, DIMENSION(:) :: INPUT_ID =>NULL()
INTEGER, POINTER, DIMENSION(:) :: INPUT_DEVC_INDEX =>NULL()
INTEGER :: I_PRE_DIST=0, IMESH=0, N_INPUTS=0
REAL(EB) :: Tpre_mean=0._EB, Tpre_para=0._EB, Tpre_para2=0._EB, Tpre_low=0._EB, Tpre_high=0._EB
REAL(EB) :: TIME_DELAY=0._EB, PROB=0._EB
LOGICAL :: GLOBAL=.TRUE.
END TYPE EVAC_EDEV_TYPE
!
!
! Next holds door information for groups
TYPE (KNOWN_DOOR_TYPE), DIMENSION(:), ALLOCATABLE, TARGET :: Group_Known_Doors
! Next holds door information for lonely humans (group_id=0)
TYPE (KNOWN_DOOR_TYPE), DIMENSION(:), ALLOCATABLE, TARGET :: Human_Known_Doors
INTEGER :: ilh, ilh_dim
! Holds the list of the different human groups, i33 is a running index
! for the groups, i33_dim is last index, i.e., the dimension of the array.
TYPE (GROUP_TYPE), DIMENSION(:), ALLOCATABLE, TARGET :: Group_List
INTEGER :: i33, i33_dim
! Holds the information of the nodes
TYPE (EVAC_NODE_TYPE), DIMENSION(:), ALLOCATABLE, TARGET :: Evac_Node_List
! Holds the information of the EVAC-lines.
TYPE (EVACUATION_TYPE), DIMENSION(:), ALLOCATABLE, TARGET :: EVAC_EVACS
! Holds the information of the EVHO-lines.
TYPE (EVAC_HOLE_TYPE), DIMENSION(:), ALLOCATABLE, TARGET :: EVAC_HOLES
! Holds the information of the EVSS-lines.
TYPE (EVAC_SSTAND_TYPE), DIMENSION(:), ALLOCATABLE, TARGET :: EVAC_SSTANDS
! Holds the information of the EXIT-lines.
TYPE (EVAC_EXIT_TYPE), DIMENSION(:), ALLOCATABLE, TARGET :: EVAC_EXITS
! Holds the information of the DOOR-lines.
TYPE (EVAC_DOOR_TYPE), DIMENSION(:), ALLOCATABLE, TARGET :: EVAC_DOORS
! Holds the information of the ENTR-lines.
TYPE (EVAC_ENTR_TYPE), DIMENSION(:), ALLOCATABLE, TARGET :: EVAC_ENTRYS
! Holds the information of the CORR-lines.
TYPE (EVAC_CORR_TYPE), DIMENSION(:), ALLOCATABLE, TARGET :: EVAC_CORRS
! Holds the information on the STRS-lines.
TYPE (EVAC_STRS_TYPE), DIMENSION(:), ALLOCATABLE, TARGET :: EVAC_STRS
! Holds the information of the PERS-lines.
TYPE (EVAC_PERS_TYPE), DIMENSION(:), ALLOCATABLE, TARGET :: EVAC_PERSON_CLASSES
! Holds the information of the EDEV-lines.
TYPE (EVAC_EDEV_TYPE), DIMENSION(:), ALLOCATABLE, TARGET :: EVAC_EDEV
! Holds the information of the devices used in the evacuation calculation.
TYPE (EVAC_DEVC_TYPE), DIMENSION(:), ALLOCATABLE, TARGET :: EVAC_DEVICES
!
! Next are needed for the Gaussian random numbers
INTEGER GaussFlag
REAL(EB) GaussSet1, GaussSet2
INTEGER GTrunFlag
REAL(EB) GTrunSet1, GTrunSet2
!
INTEGER :: NPC_EVAC, NPC_PERS, N_EXITS, N_DOORS, N_ENTRYS, &
N_CORRS, N_EGRIDS, N_NODES, N_HOLES, N_SSTANDS, N_STRS, N_CO_EXITS, N_DEVC_EVAC, N_EDEV, N_DOOR_MESHES
INTEGER :: NPPS
INTEGER :: ILABEL_last, I_FED_FILE_FORMAT=-3
! I_FED_FILE_FORMAT: -1 Mesh, Corr, Door, and Exit data on the FED file
! I_FED_FILE_FORMAT: -2 Mesh and Corr data on the FED file
! I_FED_FILE_FORMAT: -3 Mesh, Corr, and Devc data on the FED file
CHARACTER(100) :: MESSAGE
REAL(FB) :: EVAC_Z_MIN, EVAC_Z_MAX
! Main evacuation mesh information that is read before READ_MESH in read.f90.
! These are needed to automate the generation of the additional door flow meshes.
!
! Type for exit+door information needed in READ_MESH to define the additional door flow meshes.
TYPE EVAC_EMESH_EXITS_TYPE
REAL(EB), DIMENSION(6) :: XB=0.0_EB
REAL(EB), POINTER, DIMENSION(:,:) :: U_EVAC =>NULL(), V_EVAC =>NULL()
INTEGER :: EMESH=0, NEXIT=0, IOR=0, IMESH=0, I_OBST=0, I_VENT=0, MAINMESH=0, I_DOORS_EMESH=0
INTEGER :: IBAR=0, JBAR=0, KBAR=0
INTEGER, DIMENSION(3) :: RGB=-1
LOGICAL :: IS_EXIT=.FALSE., DEFINE_MESH=.TRUE.
CHARACTER(30) :: ID='null'
END TYPE EVAC_EMESH_EXITS_TYPE
! Type for strs information needed in READ_MESH to define the main evacuation meshes for stairs.
TYPE EVAC_EMESH_STAIRS_TYPE
REAL(EB), DIMENSION(6) :: XB=0.0_EB, XB_CORE=0.0_EB
REAL(EB) :: EVAC_Z_OFFSET
INTEGER :: EMESH=0, NSTRS=0, IMESH=0, N_CORES=0, N_LANDINGS=0, IBAR=0, JBAR=0, KBAR=0, I_OBST=0, I_HOLE=0
INTEGER, DIMENSION(3) :: RGB=-1
LOGICAL :: DEFINE_MESH=.TRUE.
CHARACTER(30) :: ID='null'
END TYPE EVAC_EMESH_STAIRS_TYPE
CHARACTER(30), DIMENSION(:), ALLOCATABLE :: EMESH_ID
INTEGER, DIMENSION(:), ALLOCATABLE :: EMESH_NM
INTEGER, DIMENSION(:), ALLOCATABLE :: EMESH_NFIELDS
INTEGER, DIMENSION(:,:), ALLOCATABLE :: EMESH_IJK
REAL(EB), DIMENSION(:,:), ALLOCATABLE :: EMESH_XB
INTEGER, DIMENSION(:), ALLOCATABLE :: EMESH_INDEX
! Holds the VENT information of the EXIT/DOOR lines for READ_MESH etc.
TYPE (EVAC_EMESH_EXITS_TYPE), DIMENSION(:), ALLOCATABLE, TARGET :: EMESH_EXITS
TYPE (EVAC_EMESH_STAIRS_TYPE), DIMENSION(:), ALLOCATABLE, TARGET :: EMESH_STAIRS
!
REAL(EB), DIMENSION(:,:), ALLOCATABLE :: TT_Evac, FF_Evac
INTEGER, DIMENSION(:), ALLOCATABLE :: NTT_Evac
!
!
LOGICAL :: NOT_RANDOM, EVAC_FDS6=.TRUE., L_FALLING_MODEL=.FALSE.
INTEGER :: I_FRIC_SW, COLOR_METHOD, COLOR_METHOD_TMP, I_AVATAR_COLOR, MAX_HUMANS_DIM
REAL(EB) :: EVAC_MASS_EXTINCTION_COEFF
REAL(EB) :: FAC_A_WALL, FAC_B_WALL, LAMBDA_WALL, &
NOISEME, NOISETH, NOISECM, RADIUS_COMPLETE_0, &
RADIUS_COMPLETE_1, GROUP_EFF, FED_DOOR_CRIT, &
TDET_SMOKE_DENS, DENS_INIT, EVAC_DT_MAX, GROUP_DENS, &
FC_DAMPING, EVAC_DT_MIN, V_MAX, V_ANGULAR_MAX, V_ANGULAR, &
SMOKE_MIN_SPEED, SMOKE_MIN_SPEED_VISIBILITY, TAU_CHANGE_DOOR, &
HUMAN_SMOKE_HEIGHT, TAU_CHANGE_V0, THETA_SECTOR, CONST_DF, FAC_DF, &
CONST_CF, FAC_CF, FAC_1_WALL, FAC_2_WALL, FAC_V0_DIR, FAC_V0_NOCF, FAC_NOCF, &
CF_MIN_A, CF_FAC_A_WALL, CF_MIN_TAU, CF_MIN_TAU_INER, CF_FAC_TAUS, FAC_DOOR_QUEUE, FAC_DOOR_ALPHA,&
FAC_DOOR_WAIT, CF_MIN_B, FAC_DOOR_OLD, FAC_DOOR_OLD2, R_HERDING, W0_HERDING, WR_HERDING, I_HERDING_TYPE, &
DOT_HERDING, EVAC_DELTA_SEE, C_HAWK, R_HAWK_DOVE, A_HAWK_T_FACTOR, HERDING_TAU_FACTOR, &
ALPHA_HAWK, DELTA_HAWK, EPSILON_HAWK, THETA_HAWK, A_HAWK_T_START, T_STOP_HD_GAME, &
F_MIN_FALL, F_MAX_FALL, D_OVERLAP_FALL, TAU_FALL_DOWN, A_FAC_FALLEN, TIME_FALL_DOWN, PROB_FALL_DOWN, &
T_ASET_HAWK, T_0_HAWK, T_ASET_TFAC_HAWK
INTEGER, DIMENSION(3) :: DEAD_RGB
!
REAL(EB), DIMENSION(:), ALLOCATABLE :: Tsteps
!
REAL(EB), DIMENSION(:), ALLOCATABLE :: K_ave_Door
REAL(EB), DIMENSION(:), ALLOCATABLE :: FED_max_Door
LOGICAL, DIMENSION(:), ALLOCATABLE :: Is_Known_Door, Is_Visible_Door
LOGICAL, DIMENSION(:,:), ALLOCATABLE :: Is_BeeLine_Door, Is_BeeLineXB_Door
INTEGER, DIMENSION(:), ALLOCATABLE :: Color_Tmp
!
INTEGER :: n_dead=0, icyc_old=0, n_change_doors=0, n_change_trials=0
REAL(EB) :: fed_max_alive, fed_max
INTEGER, DIMENSION(:,:), ALLOCATABLE :: N_HawkDoveCount
!
! Stairs constants
INTEGER :: STRS_LANDING_TYPE=1, STRS_STAIR_TYPE=2
! Human constants
INTEGER :: HUMAN_SAME_MESH_TARGET=-2,HUMAN_IMPOSSIBLE_TARGET=-1, &
HUMAN_NO_TARGET=0,&
HUMAN_TARGET_UNSPECIFIED = 1, &
HUMAN_ANOTHER_MESH_TARGET=2,&
HUMAN_CORRIDOR_TARGET=3,&
HUMAN_STRS_TARGET=4, &
HUMAN_EXIT_TARGET=5
! hr%ior = 0: not entering a door
! 1: moving but target not specified
! 2: put to an another mesh (target is door/entry)
! 3: target is corridor (remove from floor)
! 4: not used (floor node...)
! 5: target is exit (remove from floor)
! -1: can not move to the target node
! -2: move to door/entry on the same floor
CONTAINS
!
SUBROUTINE READ_EVAC(IMODE)
USE OUTPUT_DATA, ONLY: COLOR2RGB
IMPLICIT NONE
!
! IMODE = 1:
! Read some evacuation input from the main evacuation meshes:
! Read the ijk and XB info of the main evacuation meshes.
! Read the door/exit information and check which main evacuation mesh.
! Calculate the number of additional door flow meshes and give names to them (doormesh_ID), where
! ID is the ID of the door. Make the 'outflow' VENTs also (xb, ior, mesh_id, mesh_#). The
! additional door flow meshes are numbered starting from the last mesh read in.
!
! IMODE = 2:
! Read the evacuation input.
!
! Passed variables
INTEGER, INTENT(IN) :: IMODE
!
! Local variables
INTEGER :: NUMBER_INITIAL_PERSONS, SAMPLING_FACTOR, IPC, n_tmp, GN_MIN, GN_MAX, N_RAMP_INI
REAL(EB) :: DTSAM
LOGICAL :: EVACFILE, DEFINE_MESH
REAL(EB) :: DUMMY
REAL(EB) :: XB(6), XB1(6), XB2(6)
REAL(EB), DIMENSION(3) :: XYZ, XYZ_SMOKE
INTEGER :: IOS, IZERO, N, I, J, K, IOR
CHARACTER(30) QUANTITY, MAX_HUMANS_RAMP, INPUT_ID(40)
CHARACTER(60) FYI,ID,PERS_ID,TO_NODE,EVAC_ID, DEFAULT_PROPERTIES, AVATAR_TYPE
CHARACTER(30) FLOW_FIELD_ID
INTEGER :: DIAMETER_DIST,VELOCITY_DIST,PRE_EVAC_DIST,DET_EVAC_DIST,TAU_EVAC_DIST, GUARD_MEN_IN
REAL(EB) :: VEL_MEAN,VEL_PARA,VEL_PARA2,VEL_LOW,VEL_HIGH, &
DIA_MEAN,DIA_PARA,DIA_PARA2,DIA_LOW,DIA_HIGH, &
PRE_MEAN,PRE_PARA,PRE_PARA2,PRE_LOW,PRE_HIGH, &
DET_MEAN,DET_PARA,DET_PARA2,DET_LOW,DET_HIGH, &
TAU_MEAN,TAU_PARA,TAU_PARA2,TAU_LOW,TAU_HIGH, &
FCONST_A,FCONST_B,L_NON_SP,C_YOUNG,GAMMA,KAPPA,ANGLE, &
D_TORSO_MEAN,D_SHOULDER_MEAN, TAU_ROT, M_INERTIA, TARGET_X, TARGET_Y, &
DELTA_X, DELTA_Y
INTEGER :: MAX_HUMANS_INSIDE, n_max_in_corrs, COLOR_INDEX, MAX_HUMANS, AGENT_TYPE
REAL(EB) :: MAX_FLOW, WIDTH, TIME_START, TIME_STOP, WIDTH1, &
WIDTH2, EFF_WIDTH, EFF_LENGTH, FAC_SPEED, TIME_OPEN, TIME_CLOSE
REAL(EB) :: UBAR0, VBAR0, TIME_DELAY, TRAVEL_TIME
LOGICAL :: CHECK_FLOW, COUNT_ONLY, AFTER_REACTION_TIME, EXIT_SIGN, KEEP_XY, USE_V0, SHOW, COUNT_DENSITY, GLOBAL
LOGICAL :: OUTPUT_SPEED, OUTPUT_MOTIVE_FORCE, OUTPUT_FED, OUTPUT_OMEGA, OUTPUT_DENSITY, &
OUTPUT_ANGLE, OUTPUT_CONTACT_FORCE, OUTPUT_TOTAL_FORCE, OUTPUT_MOTIVE_ANGLE, OUTPUT_ACCELERATION, &
LOCKED_WHEN_CLOSED, TARGET_WHEN_CLOSED, WAIT_AT_XYZ, ELEVATOR
INTEGER, DIMENSION(3) :: RGB, AVATAR_RGB
CHARACTER(30) :: VENT_FFIELD, MESH_ID, EVAC_MESH, PROP_ID
REAL(EB) :: FAC_V0_UP, FAC_V0_DOWN, FAC_V0_HORI, HEIGHT, HEIGHT0, ESC_SPEED, PROB
CHARACTER(25) :: COLOR, DEAD_COLOR, AVATAR_COLOR
! Stairs variables
REAL(EB) :: XB_CORE(4), XB_CORES(500,6), XB_LANDINGS(500,6), XB_STAIRS(500,8)
REAL(EB) VERTICAL_LANDING_SEPARATION, STR_Length, STR_Height
INTEGER N_LANDINGS, NL, NODES_TMP(500)
LOGICAL :: RIGHT_HANDED, LEFT_HANDED
CHARACTER(60), DIMENSION(51) :: KNOWN_DOOR_NAMES
REAL(EB), DIMENSION(51) :: KNOWN_DOOR_PROBS
INTEGER, DIMENSION(:), ALLOCATABLE :: TMP_AVATAR_TYPE_INDEX
CHARACTER(60), DIMENSION(:), ALLOCATABLE :: TMP_AVATAR_TYPE_NAME, TMP_AVATAR_TYPE_PROP
INTEGER :: ii,jj,kk
INTEGER :: IJK(3), MPI_PROCESS, LEVEL, NMESHES_READ
LOGICAL :: EVACUATION, EVAC_HUMANS, SYNCHRONIZE, CYLINDRICAL, NO_EVAC_MESHES
REAL(EB) :: EVAC_Z_OFFSET
CHARACTER(30) :: MULT_ID
INTEGER :: N_EGRIDS_TMP, NM, N_CORES
INTEGER :: N_AVATAR_TYPE
NAMELIST /MESH/ IJK, FYI, ID, SYNCHRONIZE, EVACUATION, EVAC_HUMANS, CYLINDRICAL, XB, RGB, COLOR, EVAC_Z_OFFSET, &
MPI_PROCESS, LEVEL, MULT_ID
NAMELIST /EXIT/ ID, XB, IOR, FLOW_FIELD_ID, CHECK_FLOW, &
MAX_FLOW, FYI, COUNT_ONLY, WIDTH, XYZ, VENT_FFIELD, COUNT_DENSITY, &
MESH_ID, COLOR_INDEX, XYZ_SMOKE, EVAC_ID, PERS_ID, &
TIME_OPEN, TIME_CLOSE, EVAC_MESH, RGB, COLOR, SHOW, HEIGHT, LOCKED_WHEN_CLOSED, TARGET_WHEN_CLOSED, WAIT_AT_XYZ
NAMELIST /DOOR/ ID, XB, IOR, FLOW_FIELD_ID, CHECK_FLOW, &
MAX_FLOW, TO_NODE, FYI, WIDTH, XYZ, VENT_FFIELD, &
EXIT_SIGN, MESH_ID, COLOR_INDEX, XYZ_SMOKE, KEEP_XY, &
TIME_OPEN, TIME_CLOSE, EVAC_MESH, RGB, COLOR, SHOW, HEIGHT, LOCKED_WHEN_CLOSED, TARGET_WHEN_CLOSED, WAIT_AT_XYZ
NAMELIST /ENTR/ ID, XB, IOR, FLOW_FIELD_ID, MAX_FLOW, &
FYI, WIDTH, QUANTITY, PERS_ID, TIME_START, &
TIME_STOP, AFTER_REACTION_TIME, &
KNOWN_DOOR_NAMES, KNOWN_DOOR_PROBS, &
MESH_ID, COLOR_INDEX, EVAC_MESH, RGB, COLOR, &
AVATAR_COLOR, AVATAR_RGB, MAX_HUMANS, MAX_HUMANS_RAMP, SHOW, HEIGHT, AGENT_TYPE, AVATAR_TYPE, PROP_ID
NAMELIST /CORR/ ID, XB, IOR, FLOW_FIELD_ID, CHECK_FLOW, &
MAX_FLOW, TO_NODE, FYI, WIDTH, WIDTH1, WIDTH2, &
EFF_WIDTH, EFF_LENGTH, MAX_HUMANS_INSIDE, FAC_SPEED, &
XB1, XB2, RGB, COLOR, ELEVATOR, TRAVEL_TIME
NAMELIST /STRS/ ID, XB, XB_CORE, XB_CORES, TO_NODE, RIGHT_HANDED, LEFT_HANDED, MESH_ID, &
N_LANDINGS, XB_LANDINGS, VERTICAL_LANDING_SEPARATION, &
FAC_V0_UP, FAC_V0_DOWN, FAC_V0_HORI, RGB, COLOR, IJK, EVAC_Z_OFFSET
NAMELIST /EVAC/ NUMBER_INITIAL_PERSONS, QUANTITY, FYI, &
ID, DTSAM, XB, FLOW_FIELD_ID, PERS_ID, &
TIME_START, TIME_STOP, IOR, MAX_FLOW, WIDTH, ANGLE, &
AFTER_REACTION_TIME, GN_MIN, GN_MAX, &
KNOWN_DOOR_NAMES, KNOWN_DOOR_PROBS, MESH_ID, &
COLOR_INDEX, EVAC_MESH, RGB, COLOR, &
AVATAR_COLOR, AVATAR_RGB, SHOW, PRE_EVAC_DIST, DET_EVAC_DIST, &
PRE_MEAN,PRE_PARA,PRE_PARA2,PRE_LOW,PRE_HIGH, &
DET_MEAN,DET_PARA,DET_PARA2,DET_LOW,DET_HIGH, AGENT_TYPE, AVATAR_TYPE, PROP_ID, TIME_FALL_DOWN, &
GUARD_MEN_IN, TARGET_X, TARGET_Y, DELTA_X, DELTA_Y
NAMELIST /EVHO/ FYI, ID, XB, EVAC_ID, PERS_ID, MESH_ID, EVAC_MESH, RGB, COLOR, SHOW, TIME_FALL_DOWN
NAMELIST /EVSS/ FYI, ID, XB, MESH_ID, HEIGHT, HEIGHT0, IOR, &
FAC_V0_UP, FAC_V0_DOWN, FAC_V0_HORI, ESC_SPEED, EVAC_MESH, RGB, COLOR, &
UBAR0, VBAR0, USE_V0, SHOW, VENT_FFIELD, COUNT_ONLY
NAMELIST /PERS/ FYI,ID,DIAMETER_DIST,VELOCITY_DIST, &
PRE_EVAC_DIST,DET_EVAC_DIST,TAU_EVAC_DIST, &
VEL_MEAN,VEL_PARA,VEL_PARA2,VEL_LOW,VEL_HIGH, &
DIA_MEAN,DIA_PARA,DIA_PARA2,DIA_LOW,DIA_HIGH, &
PRE_MEAN,PRE_PARA,PRE_PARA2,PRE_LOW,PRE_HIGH, &
DET_MEAN,DET_PARA,DET_PARA2,DET_LOW,DET_HIGH, &
TAU_MEAN,TAU_PARA,TAU_PARA2,TAU_LOW,TAU_HIGH, &
FCONST_A,FCONST_B,L_NON_SP, C_YOUNG,GAMMA,KAPPA, GROUP_DENS, &
FAC_A_WALL, FAC_B_WALL, LAMBDA_WALL, NOISEME, NOISETH, NOISECM, &
I_FRIC_SW, GROUP_EFF, RADIUS_COMPLETE_0, &
RADIUS_COMPLETE_1, DEFAULT_PROPERTIES, &
NOT_RANDOM, FED_DOOR_CRIT, COLOR_METHOD, &
TDET_SMOKE_DENS, DENS_INIT, EVAC_DT_MAX, EVAC_DT_MIN, &
D_TORSO_MEAN, D_SHOULDER_MEAN, TAU_ROT, M_INERTIA, &
FC_DAMPING, V_MAX, V_ANGULAR_MAX, V_ANGULAR, &
OUTPUT_SPEED, OUTPUT_MOTIVE_FORCE, OUTPUT_FED, OUTPUT_OMEGA, OUTPUT_DENSITY, &
OUTPUT_MOTIVE_ANGLE, OUTPUT_ANGLE, OUTPUT_CONTACT_FORCE, OUTPUT_TOTAL_FORCE, &
OUTPUT_ACCELERATION, COLOR_INDEX, DEAD_RGB, DEAD_COLOR, &
SMOKE_MIN_SPEED, SMOKE_MIN_SPEED_VISIBILITY, &
TAU_CHANGE_DOOR, RGB, COLOR, AVATAR_COLOR, AVATAR_RGB, HUMAN_SMOKE_HEIGHT, &
TAU_CHANGE_V0, THETA_SECTOR, CONST_DF, FAC_DF, CONST_CF, FAC_CF, &
FAC_1_WALL, FAC_2_WALL, FAC_V0_DIR, FAC_V0_NOCF, FAC_NOCF, &
CF_MIN_A, CF_FAC_A_WALL, CF_MIN_TAU, CF_MIN_TAU_INER, CF_FAC_TAUS, &
FAC_DOOR_QUEUE, FAC_DOOR_ALPHA, FAC_DOOR_WAIT, CF_MIN_B, &
FAC_V0_UP, FAC_V0_DOWN, FAC_V0_HORI, FAC_DOOR_OLD, FAC_DOOR_OLD2, &
R_HERDING, W0_HERDING, WR_HERDING, I_HERDING_TYPE, DOT_HERDING, EVAC_FDS6, EVAC_DELTA_SEE, &
MAX_HUMANS_DIM, C_HAWK, R_HAWK_DOVE, A_HAWK_T_FACTOR, HERDING_TAU_FACTOR, &
ALPHA_HAWK, DELTA_HAWK, EPSILON_HAWK, THETA_HAWK, T_STOP_HD_GAME, A_HAWK_T_START, &
F_MIN_FALL, F_MAX_FALL, D_OVERLAP_FALL, TAU_FALL_DOWN, A_FAC_FALLEN, PROB_FALL_DOWN, &
T_ASET_HAWK, T_0_HAWK, T_ASET_TFAC_HAWK
!
NAMELIST /EDEV/ FYI, ID, TIME_DELAY, GLOBAL, EVAC_ID, PERS_ID, MESH_ID, INPUT_ID, &
PRE_EVAC_DIST, PRE_MEAN, PRE_PARA, PRE_PARA2, PRE_LOW, PRE_HIGH, PROB
!
IF_IMODE_1: IF (IMODE == 1) THEN
N_DOOR_MESHES = 0
IF (NO_EVACUATION) THEN
N_EVAC = 0
RETURN ! skip evacuation calculation
END IF
N_EGRIDS_TMP = 0
NMESHES_READ = 0
!NMESHES_TMP = 0
NO_EVAC_MESHES = .TRUE.
REWIND(LU_INPUT)
COUNT_MESH_LOOP: DO
CALL CHECKREAD('MESH', LU_INPUT, IOS)
IF (IOS==1) EXIT COUNT_MESH_LOOP
EVACUATION = .FALSE.
EVAC_HUMANS = .FALSE.
READ(LU_INPUT, MESH, END=15, ERR=16, IOSTAT=IOS)
NMESHES_READ = NMESHES_READ + 1
IF (EVACUATION_DRILL .AND. .NOT.EVACUATION) CYCLE COUNT_MESH_LOOP ! skip fire meshes
IF (EVACUATION_MC_MODE .AND. .NOT.EVACUATION) CYCLE COUNT_MESH_LOOP ! skip fire meshes
IF (.NOT.EVAC_HUMANS .AND. EVACUATION) CYCLE COUNT_MESH_LOOP ! skip additional evac meshes
IF (EVAC_HUMANS) NO_EVAC_MESHES = .FALSE.
IF (EVAC_HUMANS) N_EGRIDS_TMP = N_EGRIDS_TMP + 1
16 IF (IOS > 0) CALL SHUTDOWN('ERROR: Problem with MESH line.')
ENDDO COUNT_MESH_LOOP
15 CONTINUE
REWIND(LU_INPUT)
IF (NO_EVAC_MESHES) THEN
NO_EVACUATION = .TRUE.
EVACUATION_DRILL = .FALSE.
EVACUATION_MC_MODE = .FALSE.
N_EVAC = 0
RETURN ! No evacuation meshes in the input file
END IF
CALL COUNT_EVAC_NODES(1)
ALLOCATE(EMESH_ID( MAX(1,N_EGRIDS_TMP)), STAT=IZERO)
CALL ChkMemErr('READ_EVAC','EMESH_ID',IZERO)
ALLOCATE(EMESH_NM( MAX(1,N_EGRIDS_TMP)), STAT=IZERO)
CALL ChkMemErr('READ_EVAC','EMESH_NM',IZERO)
ALLOCATE(EMESH_NFIELDS(MAX(1,N_EGRIDS_TMP+N_STRS)), STAT=IZERO)
CALL ChkMemErr('READ_EVAC','EMESH_NFIELDS',IZERO)
EMESH_NFIELDS = 0
ALLOCATE(EMESH_XB(6, MAX(1,N_EGRIDS_TMP)), STAT=IZERO)
CALL ChkMemErr('READ_EVAC','EMESH_XB',IZERO)
ALLOCATE(EMESH_IJK(3, MAX(1,N_EGRIDS_TMP)), STAT=IZERO)
CALL ChkMemErr('READ_EVAC','EMESH_IJK',IZERO)
! Array for the exit+door information (not for the count only exits)
ALLOCATE(EMESH_EXITS(MAX(1,N_EXITS-N_CO_EXITS+N_DOORS)), STAT=IZERO)
CALL ChkMemErr('READ_EVAC','EMESH_EXITS',IZERO)
! Array for the strs information
ALLOCATE(EMESH_STAIRS(MAX(1,N_STRS)), STAT=IZERO)
CALL ChkMemErr('READ_EVAC','EMESH_STAIRS',IZERO)
NM = 0
MESH_LOOP: DO N = 1, NMESHES_READ
! Set MESH defaults
IJK(1)= 10
IJK(2)= 10
IJK(3)= 1
!TWO_D = .FALSE.
XB(1) = 0._EB
XB(2) = 1._EB
XB(3) = 0._EB
XB(4) = 1._EB
XB(5) = 0._EB
XB(6) = 1._EB
RGB = -1
COLOR = 'null'
ID = 'null'
!MULT_ID = 'null'
!CYLINDRICAL = .FALSE.
!SYNCHRONIZE = .FALSE.
EVACUATION = .FALSE.
EVAC_HUMANS = .FALSE.
!MPI_PROCESS = -1
!EVAC_Z_OFFSET = 1.0_EB
!LEVEL = 0
! Read the MESH line
CALL CHECKREAD('MESH', LU_INPUT, IOS)
IF (IOS==1) EXIT MESH_LOOP
READ(LU_INPUT, MESH)
IF (.NOT.EVACUATION) CYCLE MESH_LOOP ! skip fire meshes
IF (.NOT.EVAC_HUMANS .AND. EVACUATION) CYCLE MESH_LOOP ! skip additional evac meshes
! Increase the main evacuation MESH counter by 1
NM = NM + 1
! Reorder XB coordinates if necessary
CALL CHECK_XB(XB)
EMESH_ID(NM) = TRIM(ID)
EMESH_IJK(1,NM) = IJK(1)
EMESH_IJK(2,NM) = IJK(2)
EMESH_IJK(3,NM) = IJK(3)
EMESH_XB(1,NM) = XB(1)
EMESH_XB(2,NM) = XB(2)
EMESH_XB(3,NM) = XB(3)
EMESH_XB(4,NM) = XB(4)
EMESH_XB(5,NM) = XB(5)
EMESH_XB(6,NM) = XB(6)
END DO MESH_LOOP
REWIND(LU_INPUT)
! Read the STRS line
READ_STRS_LOOP: DO N = 1, N_STRS
!
! Set MESH defaults
IJK(1)= 10
IJK(2)= 10
IJK(3)= 1
ID = 'null'
XB = 0._EB
XB_CORE = 0._EB
XB_CORES = 0._EB
XB_LANDINGS = 0._EB
MESH_ID = 'null'
N_LANDINGS = 0
VERTICAL_LANDING_SEPARATION = 0._EB
EVAC_Z_OFFSET = 1.0_EB
!
CALL CHECKREAD('STRS',LU_INPUT,IOS)
IF (IOS == 1) THEN
EXIT READ_STRS_LOOP
END IF
READ(LU_INPUT,STRS,END=32,IOSTAT=IOS)
! Reorder XB coordinates if necessary
CALL CHECK_XB(XB)
! Colors, integer RGB(3), e.g., (23,255,0)
IF (ANY(RGB < 0) .AND. COLOR=='null') COLOR = 'BLACK'
IF (COLOR /= 'null') CALL COLOR2RGB(RGB,COLOR)
! Count number of cores
N_CORES = 0
DO I = 1,500
IF (ANY(XB_CORES(I,:)/=0._EB)) N_CORES = N_CORES + 1
ENDDO
IF (N_LANDINGS>500) THEN
WRITE(MESSAGE,'(A,A,A)') 'ERROR: STRS ',TRIM(ID),' N_LANDINGS > 500'
CALL SHUTDOWN(MESSAGE)
END IF
!N_LANDINGS = N_LANDINGS
!N_NODES = 2*N_LANDINGS - 1
IF (N_CORES == 0) THEN
N_CORES = 1
XB_CORES(1,1:4) = XB_CORE(1:4)
XB_CORES(1,5) = XB(5)
XB_CORES(1,6) = XB(6)
IF (ALL(XB_CORE==0._EB)) THEN
WRITE(MESSAGE,'(3A)') 'ERROR: STRS object ', TRIM(ID), ' has no XB_CORE defined.'
CALL SHUTDOWN(MESSAGE)
ENDIF
ELSE
! For now, just the first one is used (this is under construction)
XB_CORES(1,1:6) = XB_CORES(1,1:6)
! XB_CORE(1:N_CORES,1:6) = XB_CORES(1:N_CORES,1:6)
ENDIF
DEFINE_MESH = .TRUE.
IF (TRIM(MESH_ID)/='null') DEFINE_MESH = .FALSE.
EMESH_STAIRS(N)%IBAR = IJK(1)
EMESH_STAIRS(N)%JBAR = IJK(2)
EMESH_STAIRS(N)%KBAR = IJK(3) ! kbar = 1 is forced in read_mesh (for now)
EMESH_STAIRS(N)%EVAC_Z_OFFSET = EVAC_Z_OFFSET ! Not yet used properly in read_mesh???
EMESH_STAIRS(N)%N_CORES = N_CORES
EMESH_STAIRS(N)%N_LANDINGS = N_LANDINGS
EMESH_STAIRS(N)%NSTRS = N
EMESH_STAIRS(N)%RGB = RGB
EMESH_STAIRS(N)%ID = TRIM(ID)
EMESH_STAIRS(N)%DEFINE_MESH = DEFINE_MESH
EMESH_STAIRS(N)%XB = XB
EMESH_STAIRS(N)%XB_CORE(1:6) = XB_CORES(1,1:6)
END DO READ_STRS_LOOP
32 REWIND(LU_INPUT)
N_TMP = 0 ! N_TMP is exit+door index without count only exits
READ_EXIT_LOOP_0: DO N = 1, N_EXITS
DEFINE_MESH = .TRUE.
ID = 'null'
RGB = -1
COLOR = 'null'
XB = 0.0_EB
IOR = 0
MESH_ID = 'null'
EVAC_MESH = 'null'
VENT_FFIELD = 'null'
COUNT_ONLY = .FALSE.
COUNT_DENSITY = .FALSE.
COLOR_INDEX = -1
CALL CHECKREAD('EXIT', LU_INPUT, IOS)
IF (IOS == 1) THEN
EXIT READ_EXIT_LOOP_0
END IF
READ(LU_INPUT, EXIT, END=26, IOSTAT=IOS)
IF (VENT_FFIELD /= 'null') DEFINE_MESH = .FALSE. ! Old input, user gives the door flow meshes
! Old input used COLOR_INDEX, next lines are needed for that
IF (MYID==MAX(0,EVAC_PROCESS) .AND. COLOR_INDEX/=-1) WRITE (LU_ERR,'(A,A)') &
' WARNING: keyword COLOR_INDEX is replaced by COLOR at EXIT line ', TRIM(ID)
IF (COLOR_INDEX == 1) COLOR = 'BLACK'
IF (COLOR_INDEX == 2) COLOR = 'YELLOW'
IF (COLOR_INDEX == 3) COLOR = 'BLUE'
IF (COLOR_INDEX == 4) COLOR = 'RED'
IF (COLOR_INDEX == 5) COLOR = 'GREEN'
IF (COLOR_INDEX == 6) COLOR = 'MAGENTA'
IF (COLOR_INDEX == 7) COLOR = 'CYAN'
IF (COUNT_DENSITY) THEN
COUNT_ONLY = .TRUE.
IOR = +3
END IF
IF (COUNT_ONLY) CYCLE READ_EXIT_LOOP_0
N_TMP = N_TMP + 1 ! N_TMP is exit+door index without count only exits
! Colors, integer RGB(3), e.g., (23,255,0)
IF (ANY(RGB < 0) .AND. COLOR=='null') COLOR = 'FOREST GREEN'
IF (COLOR /= 'null') CALL COLOR2RGB(RGB,COLOR)
IF (EVAC_MESH /= 'null') THEN
MESH_ID = TRIM(EVAC_MESH)
IF (MYID==MAX(0,EVAC_PROCESS)) WRITE (LU_ERR,'(A,A)') &
' WARNING: keyword EVAC_MESH is replaced by MESH_ID at EXIT line ', TRIM(ID)
END IF
! Reorder XB coordinates if necessary
CALL CHECK_XB(XB)
! Check which evacuation mesh, NM is the number of main evacuation meshes.
II = 0
PEX_MeshLoop_0: DO I = 1, NM
IF (Is_Within_Bounds(XB(1), XB(2), XB(3), XB(4), XB(5), XB(6), &
EMESH_XB(1,I), EMESH_XB(2,I), EMESH_XB(3,I), EMESH_XB(4,I), EMESH_XB(5,I), EMESH_XB(6,I), &
0._EB, 0._EB, 0._EB)) THEN
IF (TRIM(MESH_ID) == 'null' .OR. TRIM(MESH_ID) == TRIM(EMESH_ID(I))) THEN
II = II + 1
! N_TMP is exit+door index without count only exits
! N is the exit index, I is the main evacuation mesh index
EMESH_EXITS(N_TMP)%EMESH = I
END IF
END IF
END DO PEX_MeshLoop_0
PEX_StrsLoop_0: DO I = 1, N_STRS
IF (Is_Within_Bounds(XB(1), XB(2), XB(3), XB(4), XB(5), XB(6), &
EMESH_STAIRS(I)%XB(1), EMESH_STAIRS(I)%XB(2), EMESH_STAIRS(I)%XB(3), &
EMESH_STAIRS(I)%XB(4), EMESH_STAIRS(I)%XB(5), EMESH_STAIRS(I)%XB(6), &
0._EB, 0._EB, 0._EB)) THEN
IF (TRIM(MESH_ID) == 'null' .OR. TRIM(MESH_ID) == ('Emesh_' // TRIM(EMESH_STAIRS(I)%ID))) THEN
II = II + 1
! N_TMP is exit+door index without count only exits
! N is the exit index, I is the main evacuation mesh index
EMESH_EXITS(N_TMP)%EMESH = 0
DEFINE_MESH = .FALSE.
END IF
END IF
END DO PEX_StrsLoop_0
IF (II == 0 .AND. MYID==MAX(0,EVAC_PROCESS)) THEN
WRITE(MESSAGE,'(A,A,A)') 'ERROR: EXIT ',TRIM(ID), ' problem with IMESH, no mesh found'
CALL SHUTDOWN(MESSAGE)
END IF
IF (II > 1 .AND. MYID==MAX(0,EVAC_PROCESS)) THEN
WRITE(MESSAGE,'(A,A,A)') 'ERROR: EXIT ',TRIM(ID), ' not an unique mesh found '
CALL SHUTDOWN(MESSAGE)
END IF
SELECT CASE (IOR)
CASE (-1,+1)
IF ( (XB(2)-XB(1)) > 0.0_EB ) THEN
IF (MYID==MAX(0,EVAC_PROCESS)) THEN
WRITE(MESSAGE,'(A,A,A)') 'ERROR: EXIT ',TRIM(ID), ' IOR=+-1 but not a vertical plane '
CALL SHUTDOWN(MESSAGE)
END IF
END IF
CASE (-2,+2)
IF ( (XB(4)-XB(3)) > 0.0_EB ) THEN
IF (MYID==MAX(0,EVAC_PROCESS)) THEN
WRITE(MESSAGE,'(A,A,A)') 'ERROR: EXIT ',TRIM(ID), ' IOR=+-2 but not a vertical plane '
CALL SHUTDOWN(MESSAGE)
END IF
END IF
CASE Default
IF (MYID==MAX(0,EVAC_PROCESS)) THEN
WRITE(MESSAGE,'(A,A,A)') 'ERROR: EXIT ',TRIM(ID), ' No IOR given or not -2,-1,+1,+2 '
CALL SHUTDOWN(MESSAGE)
END IF
END SELECT
! Doors/Exits are always vertical
XB(5) = EMESH_XB(5,EMESH_EXITS(N_TMP)%EMESH)
XB(6) = EMESH_XB(6,EMESH_EXITS(N_TMP)%EMESH)
!
! Save the information needed in READ_MESH, etc.
IF (DEFINE_MESH .AND. .NOT.EVAC_FDS6) N_DOOR_MESHES = N_DOOR_MESHES + 1
EMESH_EXITS(N_TMP)%NEXIT = N ! N is the exit line index (including count only ones)
EMESH_EXITS(N_TMP)%IOR = IOR
EMESH_EXITS(N_TMP)%IS_EXIT = .TRUE.
EMESH_EXITS(N_TMP)%DEFINE_MESH = DEFINE_MESH ! Count_only exits are not included in 1...N_TMP list
EMESH_EXITS(N_TMP)%ID = TRIM(ID)
EMESH_EXITS(N_TMP)%XB(:) = XB(:)
EMESH_EXITS(N_TMP)%RGB(:) = RGB(:)
EMESH_EXITS(N_TMP)%IMESH = EMESH_EXITS(N_TMP)%EMESH ! Updated in READ_MESH, the mesh index
EMESH_EXITS(N_TMP)%MAINMESH = EMESH_EXITS(N_TMP)%EMESH ! Updated in READ_MESH, the main mesh index
! EMESH_EXITS(N_TMP)%EMESH is the main evacuation mesh index: EMESH_ID, EMESH_IJK, EMESH_XB
END DO READ_EXIT_LOOP_0
26 CONTINUE
REWIND(LU_INPUT)
READ_DOOR_LOOP_0: DO N = 1, N_DOORS
DEFINE_MESH = .TRUE.
ID = 'null'
RGB = -1
COLOR = 'null'
XB = 0.0_EB
IOR = 0
MESH_ID = 'null'
EVAC_MESH = 'null'
TO_NODE = 'null'
VENT_FFIELD = 'null'
COLOR_INDEX = -1
CALL CHECKREAD('DOOR', LU_INPUT, IOS)
IF (IOS == 1) THEN
EXIT READ_DOOR_LOOP_0
END IF
READ(LU_INPUT, DOOR, END=27, IOSTAT=IOS)
IF (VENT_FFIELD /= 'null') DEFINE_MESH = .FALSE. ! Old input, user gives the door flow meshes
IF (TO_NODE == 'null') DEFINE_MESH = .FALSE. ! This is more or less like an entry.
! Old input used COLOR_INDEX, next lines are needed for that
IF (MYID==MAX(0,EVAC_PROCESS) .AND. COLOR_INDEX/=-1) WRITE (LU_ERR,'(A,A)') &
' WARNING: keyword COLOR_INDEX is replaced by COLOR at DOOR line ', TRIM(ID)
IF (COLOR_INDEX == 1) COLOR = 'BLACK'
IF (COLOR_INDEX == 2) COLOR = 'YELLOW'
IF (COLOR_INDEX == 3) COLOR = 'BLUE'
IF (COLOR_INDEX == 4) COLOR = 'RED'
IF (COLOR_INDEX == 5) COLOR = 'GREEN'
IF (COLOR_INDEX == 6) COLOR = 'MAGENTA'
IF (COLOR_INDEX == 7) COLOR = 'CYAN'
N_TMP = N_TMP + 1 ! N_TMP is exit+door index without count only exits
! Colors, integer RGB(3), e.g., (23,255,0)
IF (ANY(RGB < 0) .AND. COLOR=='null') COLOR = 'FOREST GREEN'
IF (COLOR /= 'null') CALL COLOR2RGB(RGB,COLOR)
IF (EVAC_MESH /= 'null') THEN
MESH_ID = TRIM(EVAC_MESH)
IF (MYID==MAX(0,EVAC_PROCESS)) WRITE (LU_ERR,'(A,A)') &
' WARNING: keyword EVAC_MESH is replaced by MESH_ID at DOOR line ', TRIM(ID)
END IF
! Reorder XB coordinates if necessary
CALL CHECK_XB(XB)
! Check which evacuation mesh, NM is the number of main evacuation meshes.
II = 0
PDX_MeshLoop_0: DO I = 1, NM
IF (Is_Within_Bounds(XB(1), XB(2), XB(3), XB(4), XB(5), XB(6), &
EMESH_XB(1,I), EMESH_XB(2,I), EMESH_XB(3,I), EMESH_XB(4,I), EMESH_XB(5,I), EMESH_XB(6,I), &
0._EB, 0._EB, 0._EB)) THEN
IF (TRIM(MESH_ID) == 'null' .OR. TRIM(MESH_ID) == TRIM(EMESH_ID(I))) THEN
II = II + 1
! N_TMP is exit+door index without count only exits
! N is the door index, I is the main evacuation mesh index
EMESH_EXITS(N_TMP)%EMESH = I
END IF
END IF
END DO PDX_MeshLoop_0
PDX_StrsLoop_0: DO I = 1, N_STRS
IF (Is_Within_Bounds(XB(1), XB(2), XB(3), XB(4), XB(5), XB(6), &
EMESH_STAIRS(I)%XB(1), EMESH_STAIRS(I)%XB(2), EMESH_STAIRS(I)%XB(3), &
EMESH_STAIRS(I)%XB(4), EMESH_STAIRS(I)%XB(5), EMESH_STAIRS(I)%XB(6), &
0._EB, 0._EB, 0._EB)) THEN
IF (TRIM(MESH_ID) == 'null' .OR. TRIM(MESH_ID) == ('Emesh_' // TRIM(EMESH_STAIRS(I)%ID))) THEN
II = II + 1
! N_TMP is exit+door index without count only exits
! N is the exit index, I is the main evacuation mesh index
DEFINE_MESH = .FALSE.
EMESH_EXITS(N_TMP)%EMESH = 0
END IF
END IF
END DO PDX_StrsLoop_0
IF (II == 0 .AND. MYID==MAX(0,EVAC_PROCESS)) THEN
WRITE(MESSAGE,'(A,A,A)') 'ERROR: DOOR ',TRIM(ID), ' problem with IMESH, no mesh found'
CALL SHUTDOWN(MESSAGE)
END IF
IF (II > 1 .AND. MYID==MAX(0,EVAC_PROCESS)) THEN
WRITE(MESSAGE,'(A,A,A)') 'ERROR: DOOR ',TRIM(ID), ' not an unique mesh found '
CALL SHUTDOWN(MESSAGE)
END IF
SELECT CASE (IOR)
CASE (-1,+1)
IF ( (XB(2)-XB(1)) > 0.0_EB ) THEN
IF (MYID==MAX(0,EVAC_PROCESS)) THEN
WRITE(MESSAGE,'(A,A,A)') 'ERROR: DOOR ',TRIM(ID), ' IOR=+-1 but not a vertical plane '
CALL SHUTDOWN(MESSAGE)
END IF
END IF
CASE (-2,+2)
IF ( (XB(4)-XB(3)) > 0.0_EB ) THEN
IF (MYID==MAX(0,EVAC_PROCESS)) THEN
WRITE(MESSAGE,'(A,A,A)') 'ERROR: DOOR ',TRIM(ID), ' IOR=+-2 but not a vertical plane '
CALL SHUTDOWN(MESSAGE)
END IF
END IF
CASE Default
IF (MYID==MAX(0,EVAC_PROCESS)) THEN
WRITE(MESSAGE,'(A,A,A)') 'ERROR: DOOR ',TRIM(ID), ' No IOR given or not -2,-1,+1,+2 '