-
Notifications
You must be signed in to change notification settings - Fork 0
/
vege.f90
3537 lines (3005 loc) · 140 KB
/
vege.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
MODULE VEGE
USE COMP_FUNCTIONS
USE PRECISION_PARAMETERS
USE GLOBAL_CONSTANTS
USE MESH_POINTERS
USE TRAN
USE PART
USE MEMORY_FUNCTIONS, ONLY:CHKMEMERR
USE TYPES, ONLY: PARTICLE_TYPE, PARTICLE_CLASS_TYPE, PARTICLE_CLASS ! , WALL_TYPE,SURFACE_TYPE
IMPLICIT NONE
PRIVATE
PUBLIC INITIALIZE_LEVEL_SET_FIREFRONT,LEVEL_SET_FIREFRONT_PROPAGATION,END_LEVEL_SET,INITIALIZE_RAISED_VEG, &
DEALLOCATE_VEG_ARRAYS,RAISED_VEG_MASS_ENERGY_TRANSFER,GET_REV_vege, &
BNDRY_VEG_MASS_ENERGY_TRANSFER
TYPE (PARTICLE_TYPE), POINTER :: LP=>NULL()
TYPE (PARTICLE_CLASS_TYPE), POINTER :: PC=>NULL()
!TYPE (WALL_TYPE), POINTER :: WC
!TYPE (SURFACE_TYPE), POINTER :: SF
CHARACTER(255), PARAMETER :: vegeid='$Id: vege.f90 9718 2011-12-30 17:49:06Z drjfloyd $'
CHARACTER(255), PARAMETER :: vegerev='$Revision: 9718 $'
CHARACTER(255), PARAMETER :: vegedate='$Date: 2011-12-30 09:49:06 -0800 (Fri, 30 Dec 2011) $'
LOGICAL, ALLOCATABLE, DIMENSION(:,:,:) :: VEG_PRESENT_FLAG,CELL_TAKEN_FLAG
INTEGER, ALLOCATABLE, DIMENSION(:,:,:) :: IJK_VEGOUT
INTEGER :: IZERO,NLP_VEG_FUEL,NCONE_TREE,NXB,NYB
REAL(EB) :: RCELL,R_TREE,XCELL,XI,YJ,YCELL,ZCELL,ZK
!For Level Set
INTEGER :: LIMITER_LS,LU_CRWN_PROB_LS,LU_FLI_LS,LU_ROSX_LS,LU_ROSY_LS,LU_SLCF_LS,LU_SLCF_FLI_LS, &
LU_SLCF_PROBC_LS,LU_SLCF_ROS_LS,LU_SLCF_TOA_LS,LU_TOA_LS,NX_LS,NY_LS
REAL(EB) :: DT_LS,DX_LS,DY_LS,DT_OUTPUT,SUM_T_SLCF,SUMTIME,TIME_LS,TIME_FLANKFIRE_QUENCH
REAL(EB) :: DT_COEF,DYN_SR_MAX,IDX_LS,IDY_LS,T_FINAL,ROS_HEAD1,UMAG,UMF_TMP
REAL(EB) :: CPUTIME,LS_T_BEG,LS_T_END,PHI_MIN_LS,PHI_MAX_LS,ROS_BACKS,ROS_HEADS
REAL(EB) :: B_ROTH,BETA_OP_ROTH,C_ROTH,E_ROTH
CONTAINS
SUBROUTINE INITIALIZE_RAISED_VEG(NM)
USE MEMORY_FUNCTIONS, ONLY: RE_ALLOCATE_PARTICLES
USE TRAN, ONLY : GET_IJK
REAL(EB) CROWN_LENGTH,CROWN_VOLUME,TANGENT,CROWN_WIDTH
REAL(EB) DX_RING,DZ_RING,INNER_RADIUS,OUTER_RADIUS,R_CTR_CYL, &
RING_BOTTOM,RING_TOP,SLANT_WIDTH
REAL(EB) V_CELL,XLOC,YLOC,ZLOC,X_EXTENT,Y_EXTENT,Z_EXTENT
INTEGER NCT,NLP_TREE,NLP_RECT_VEG,N_TREE,NXB,NYB,NZB,IPC
INTEGER N_CFCR_TREE,N_FRUSTUM_TREE,N_RECT_TREE,N_RING_TREE,N_IGN
INTEGER I,II,I_OUTER_RING,JJ,KK,K_BOTTOM_RING
INTEGER, INTENT(IN) :: NM
!IF (.NOT. TREE) RETURN !Exit if there are no trees anywhere
IF (.NOT. TREE_MESH(NM)) RETURN !Exit routine if no raised veg in mesh
IF (EVACUATION_ONLY(NM)) RETURN ! Don't waste time if an evac mesh
CALL POINT_TO_MESH(NM)
ALLOCATE(VEG_PRESENT_FLAG(0:IBP1,0:JBP1,0:KBP1))
CALL ChkMemErr('VEGE','VEG_PRESENT_FLAG',IZERO)
ALLOCATE(CELL_TAKEN_FLAG(0:IBP1,0:JBP1,0:KBP1))
CALL ChkMemErr('VEGE','CELL_TAKEN_FLAG',IZERO)
ALLOCATE(IJK_VEGOUT(0:IBP1,0:JBP1,0:KBP1))
CALL ChkMemErr('VEGE','IJK_VEGOUT',IZERO)
!Diagnostic files
!IF (NM == NMESHES) THEN
!OPEN(9999,FILE='total_PARTICLE_mass.out',STATUS='REPLACE')
! OPEN(9998,FILE='diagnostics.out',STATUS='REPLACE')
!ENDIF
TREE_MESH(NM) = .FALSE.
CONE_TREE_PRESENT = .FALSE.
FRUSTUM_TREE_PRESENT = .FALSE.
CYLINDER_TREE_PRESENT = .FALSE.
RING_TREE_PRESENT = .FALSE.
RECTANGLE_TREE_PRESENT = .FALSE.
IJK_VEGOUT = 0
TREE_LOOP: DO NCT=1,N_TREES
VEG_PRESENT_FLAG = .FALSE. ; CELL_TAKEN_FLAG = .FALSE.
IPC = TREE_PARTICLE_CLASS(NCT)
PC=>PARTICLE_CLASS(IPC)
PC%KILL_RADIUS = 0.5_EB/PC%VEG_SV !radius bound below which fuel elements are removed
!
! Build a conical volume of solid (vegetation) fuel
!
IF_CONE_VEGETATION: IF(VEG_FUEL_GEOM(NCT) == 'CONE') THEN
!
CONE_TREE_PRESENT = .TRUE.
N_CFCR_TREE = TREE_CFCR_INDEX(NCT)
CROWN_WIDTH = CROWN_W(N_CFCR_TREE)
CROWN_LENGTH = TREE_H(N_CFCR_TREE) - CROWN_B_H(N_CFCR_TREE)
IF(CROWN_LENGTH <= 0.0_EB) THEN
PRINT*,'ERROR CONE TREE: Crown base height >= tree height for (maybe) tree number ', NCT
PRINT*,'CONE TREE_HEIGHT = ',TREE_H(N_CFCR_TREE)
PRINT*,'CONE CROWN_BASE_HEIGHT = ',CROWN_B_H(N_CFCR_TREE)
STOP
ENDIF
TANGENT = 0.5_EB*CROWN_W(N_CFCR_TREE)/CROWN_LENGTH
CROWN_VOLUME = PI*CROWN_WIDTH**2*CROWN_LENGTH/12._EB
NLP_TREE = 0
DO NZB=1,KBAR
IF (Z(NZB)>=Z_TREE(N_CFCR_TREE)+CROWN_B_H(N_CFCR_TREE) .AND. &
Z(NZB)<=Z_TREE(N_CFCR_TREE)+TREE_H(N_CFCR_TREE)) THEN
PARTICLE_TAG = PARTICLE_TAG + NMESHES
! R_TREE = TANGENT*(TREE_H(N_CFCR_TREE)+Z_TREE(N_CFCR_TREE)-Z(NZB)+0.5_EB*DZ(NZB))
R_TREE = TANGENT*(TREE_H(N_CFCR_TREE)+Z_TREE(N_CFCR_TREE)-Z(NZB))
DO NXB = 1,IBAR
DO NYB = 1,JBAR
RCELL = SQRT((X(NXB)-X_TREE(N_CFCR_TREE))**2 + (Y(NYB)-Y_TREE(N_CFCR_TREE))**2)
IF (RCELL <= R_TREE) THEN
NLP = NLP + 1
NLP_TREE = NLP_TREE + 1
IF (NLP>NLPDIM) THEN
CALL RE_ALLOCATE_PARTICLES(1,NM,0,1000)
PARTICLE=>MESHES(NM)%PARTICLE
ENDIF
LP=>PARTICLE(NLP)
LP%VEG_VOLFRACTION = 1._EB
LP%TAG = PARTICLE_TAG
LP%X = REAL(NXB,EB)
LP%Y = REAL(NYB,EB)
LP%Z = REAL(NZB,EB)
LP%CLASS = IPC
LP%PWT = 1._EB ! This is not used, but it is necessary to assign a non-zero weight factor to each particle
VEG_PRESENT_FLAG(NXB,NYB,NZB) = .TRUE.
ENDIF
ENDDO
ENDDO
ENDIF
ENDDO
NLP_VEG_FUEL = NLP_TREE
!
ENDIF IF_CONE_VEGETATION
!
! Build a frustum volume of solid (vegetation) fuel
!
IF_FRUSTUM_VEGETATION: IF(VEG_FUEL_GEOM(NCT) == 'FRUSTUM') THEN
!
FRUSTUM_TREE_PRESENT = .TRUE.
N_CFCR_TREE = TREE_CFCR_INDEX(NCT)
N_FRUSTUM_TREE = TREE_FRUSTUM_INDEX(NCT)
CROWN_LENGTH = TREE_H(N_CFCR_TREE) - CROWN_B_H(N_CFCR_TREE)
IF(CROWN_LENGTH <= 0.0_EB) THEN
PRINT*,'ERROR FRUSTUM TREE: Crown base height >= tree height for (maybe) tree number ', NCT
PRINT*,'FRUSTUM TREE_HEIGHT = ',TREE_H(N_CFCR_TREE)
PRINT*,'FRUSTUM CROWN_BASE_HEIGHT = ',CROWN_B_H(N_CFCR_TREE)
STOP
ENDIF
R_CTR_CYL = 0.5*MIN(CROWN_W_TOP(N_FRUSTUM_TREE),CROWN_W_BOTTOM(N_FRUSTUM_TREE))
SLANT_WIDTH = 0.5*ABS(CROWN_W_TOP(N_FRUSTUM_TREE) - CROWN_W_BOTTOM(N_FRUSTUM_TREE))
TANGENT = SLANT_WIDTH/CROWN_LENGTH
CROWN_VOLUME = PI*CROWN_LENGTH*(CROWN_W_BOTTOM(N_FRUSTUM_TREE)**2 + &
CROWN_W_TOP(N_FRUSTUM_TREE)*CROWN_W_TOP(N_FRUSTUM_TREE) + CROWN_W_TOP(N_FRUSTUM_TREE)**2)/3._EB
NLP_TREE = 0
DO NZB=1,KBAR
IF (Z(NZB)>=Z_TREE(N_CFCR_TREE)+CROWN_B_H(N_CFCR_TREE) .AND. &
Z(NZB)<=Z_TREE(N_CFCR_TREE)+TREE_H(N_CFCR_TREE)) THEN
PARTICLE_TAG = PARTICLE_TAG + NMESHES
IF(CROWN_W_TOP(N_FRUSTUM_TREE) <= CROWN_W_BOTTOM(N_FRUSTUM_TREE)) &
R_TREE = R_CTR_CYL + TANGENT*(TREE_H(N_CFCR_TREE)+Z_TREE(N_CFCR_TREE)-Z(NZB))
IF(CROWN_W_TOP(N_FRUSTUM_TREE) > CROWN_W_BOTTOM(N_FRUSTUM_TREE)) &
R_TREE = R_CTR_CYL + TANGENT*(Z(NZB)-Z_TREE(N_CFCR_TREE)-CROWN_B_H(N_CFCR_TREE))
DO NXB = 1,IBAR
DO NYB = 1,JBAR
RCELL = SQRT((X(NXB)-X_TREE(N_CFCR_TREE))**2 + (Y(NYB)-Y_TREE(N_CFCR_TREE))**2)
IF (RCELL <= R_TREE) THEN
NLP = NLP + 1
NLP_TREE = NLP_TREE + 1
IF (NLP>NLPDIM) THEN
CALL RE_ALLOCATE_PARTICLES(1,NM,0,1000)
PARTICLE=>MESHES(NM)%PARTICLE
ENDIF
LP=>PARTICLE(NLP)
LP%VEG_VOLFRACTION = 1._EB
LP%TAG = PARTICLE_TAG
LP%X = REAL(NXB,EB)
LP%Y = REAL(NYB,EB)
LP%Z = REAL(NZB,EB)
LP%CLASS = IPC
LP%PWT = 1._EB ! This is not used, but it is necessary to assign a non-zero weight factor to each particle
VEG_PRESENT_FLAG(NXB,NYB,NZB) = .TRUE.
ENDIF
ENDDO
ENDDO
ENDIF
ENDDO
NLP_VEG_FUEL = NLP_TREE
!
ENDIF IF_FRUSTUM_VEGETATION
!
! Build a cylindrical volume of vegetative fuel
!
IF_CYLINDRICAL_VEGETATION: IF (VEG_FUEL_GEOM(NCT) == 'CYLINDER') THEN
!
CYLINDER_TREE_PRESENT = .TRUE.
N_CFCR_TREE = TREE_CFCR_INDEX(NCT)
CROWN_WIDTH = CROWN_W(N_CFCR_TREE)
R_TREE = 0.5*CROWN_WIDTH
CROWN_LENGTH = TREE_H(N_CFCR_TREE) - CROWN_B_H(N_CFCR_TREE)
IF(CROWN_LENGTH <= 0.0_EB) THEN
PRINT*,'ERROR CYLINDER TREE: Crown base height >= tree height for (maybe) tree number ', NCT
PRINT*,'CYLINDER TREE_HEIGHT = ',TREE_H(N_CFCR_TREE)
PRINT*,'CYLINDER CROWN_BASE_HEIGHT = ',CROWN_B_H(N_CFCR_TREE)
STOP
ENDIF
CROWN_VOLUME = 0.25*PI*CROWN_WIDTH**2*CROWN_LENGTH
NLP_TREE = 0
DO NZB=1,KBAR
IF (Z(NZB)>=Z_TREE(N_CFCR_TREE)+CROWN_B_H(N_CFCR_TREE) .AND. Z(NZB)<=Z_TREE(N_CFCR_TREE)+TREE_H(N_CFCR_TREE)) THEN
PARTICLE_TAG = PARTICLE_TAG + NMESHES
DO NXB = 1,IBAR
DO NYB = 1,JBAR
RCELL = SQRT((X(NXB)-X_TREE(N_CFCR_TREE))**2 + (Y(NYB)-Y_TREE(N_CFCR_TREE))**2)
IF (RCELL <= R_TREE) THEN
NLP = NLP + 1
NLP_TREE = NLP_TREE + 1
IF (NLP>NLPDIM) THEN
CALL RE_ALLOCATE_PARTICLES(1,NM,0,1000)
PARTICLE=>MESHES(NM)%PARTICLE
ENDIF
LP=>PARTICLE(NLP)
LP%VEG_VOLFRACTION = 1._EB
LP%TAG = PARTICLE_TAG
LP%X = REAL(NXB,EB)
LP%Y = REAL(NYB,EB)
LP%Z = REAL(NZB,EB)
LP%CLASS = IPC
LP%PWT = 1._EB ! This is not used, but it is necessary to assign a non-zero weight factor to each particle
VEG_PRESENT_FLAG(NXB,NYB,NZB) = .TRUE.
ENDIF
ENDDO
ENDDO
ENDIF
ENDDO
NLP_VEG_FUEL = NLP_TREE
!
ENDIF IF_CYLINDRICAL_VEGETATION
!
! Build a rectangular volume containing vegetation
!
IF_RECTANGULAR_VEGETATION:IF (VEG_FUEL_GEOM(NCT) == 'RECTANGLE')THEN
RECTANGLE_TREE_PRESENT = .TRUE.
N_RECT_TREE = TREE_RECT_INDEX(NCT)
NLP_RECT_VEG = 0
DO NZB=0,KBAR-1
ZLOC = Z(NZB) + 0.5_EB*DZ(NZB)
IF (ZLOC>=ZS_RECT_VEG(N_RECT_TREE) .AND. ZLOC<=ZF_RECT_VEG(N_RECT_TREE)) THEN
DO NXB = 0,IBAR-1
XLOC = X(NXB) + 0.5_EB*DX(NXB)
IF (XLOC >= XS_RECT_VEG(N_RECT_TREE) .AND. XLOC <= XF_RECT_VEG(N_RECT_TREE)) THEN
DO NYB = 0,JBAR-1
YLOC = Y(NYB) + 0.5_EB*DY(NYB)
IF (YLOC >= YS_RECT_VEG(N_RECT_TREE) .AND. YLOC <= YF_RECT_VEG(N_RECT_TREE)) THEN
NLP = NLP + 1
NLP_RECT_VEG = NLP_RECT_VEG + 1
IF (NLP>NLPDIM) THEN
CALL RE_ALLOCATE_PARTICLES(1,NM,0,1000)
PARTICLE=>MESHES(NM)%PARTICLE
ENDIF
LP=>PARTICLE(NLP)
LP%TAG = PARTICLE_TAG
LP%X = REAL(NXB,EB)
LP%Y = REAL(NYB,EB)
LP%Z = REAL(NZB,EB)
LP%CLASS = IPC
LP%PWT = 1._EB ! This is not used, but it is necessary to assign a non-zero weight factor to each particle
VEG_PRESENT_FLAG(NXB,NYB,NZB) = .TRUE.
X_EXTENT = XF_RECT_VEG(N_RECT_TREE) - XS_RECT_VEG(N_RECT_TREE)
Y_EXTENT = YF_RECT_VEG(N_RECT_TREE) - YS_RECT_VEG(N_RECT_TREE)
Z_EXTENT = ZF_RECT_VEG(N_RECT_TREE) - ZS_RECT_VEG(N_RECT_TREE)
IF(X_EXTENT <= 0.0_EB .OR. Y_EXTENT <= 0.0_EB .OR. Z_EXTENT <= 0.0_EB) THEN
PRINT*,'ERROR RECTANGULAR TREE: for (maybe) tree number ', NCT
PRINT*,'ZERO OR NEGATIVE TREE WIDTH IN ONE OR MORE DIRECTIONS'
PRINT*,'X LENGTH = ',X_EXTENT
PRINT*,'Y LENGTH = ',Y_EXTENT
PRINT*,'Z LENGTH = ',Z_EXTENT
STOP
ENDIF
LP%VEG_VOLFRACTION = 1._EB
! IF (X_EXTENT < DX(NXB)) LP%VEG_VOLFRACTION = LP%VEG_VOLFRACTION*X_EXTENT/DX(NXB)
! IF (Y_EXTENT < DY(NYB)) LP%VEG_VOLFRACTION = LP%VEG_VOLFRACTION*Y_EXTENT/DY(NYB)
IF (Z_EXTENT < DZ(NZB)) LP%VEG_VOLFRACTION = LP%VEG_VOLFRACTION*Z_EXTENT/DZ(NZB)
! print*,'veg_volfraction',z_extent,dz(nzb),LP%veg_volfraction
! print*,'veg_volfraction',xs_rect_veg(nct),xf_rect_veg(nct),ys_rect_veg(nct),yf_rect_veg(nct), &
! zs_rect_veg(nct),zf_rect_veg(nct),z_extent,dz(nzb),LP%VEG_VOLFRACTION
ENDIF
ENDDO
ENDIF
ENDDO
ENDIF
ENDDO
NLP_VEG_FUEL = NLP_RECT_VEG
ENDIF IF_RECTANGULAR_VEGETATION
!
! Build a ring volume of vegetation fuel
!
IF_RING_VEGETATION_BUILD: IF (VEG_FUEL_GEOM(NCT) == 'RING') THEN
RING_TREE_PRESENT = .TRUE.
N_CFCR_TREE = TREE_CFCR_INDEX(NCT)
N_RING_TREE = TREE_RING_INDEX(NCT)
K_BOTTOM_RING = 0
DZ_RING = 0.0_EB
OUTER_RADIUS = 0.5_EB*CROWN_W(N_CFCR_TREE)
RING_BOTTOM = Z_TREE(N_CFCR_TREE) + CROWN_B_H(N_CFCR_TREE)
RING_TOP = Z_TREE(N_CFCR_TREE) + TREE_H(N_CFCR_TREE)
! print*,'--------- NM = ',nm
! print*,outer_radius
DO II=1,IBAR-1
IF(X(II) <= OUTER_RADIUS .AND. X(II+1) > OUTER_RADIUS) I_OUTER_RING = II
ENDDO
! print*,i_outer_ring,nct
! print*,dx(i_outer_ring),ring_thickness_veg(nct)
! DX_RING = MAX(DX(I_OUTER_RING),RING_THICKNESS_VEG(N_RING_TREE))
DX_RING = DX(1)
INNER_RADIUS = OUTER_RADIUS - DX_RING
DO KK=1,KBAR-1
IF(Z(KK) <= RING_BOTTOM .AND. Z(KK+1) > RING_BOTTOM) K_BOTTOM_RING = KK
ENDDO
IF (K_BOTTOM_RING > 0) DZ_RING = MAX(DZ(K_BOTTOM_RING),RING_TOP-RING_BOTTOM)
RING_TOP = RING_BOTTOM + DZ_RING
NLP_TREE = 0
!
DO NZB=1,KBAR
IF (Z(NZB)>=RING_BOTTOM .AND. Z(NZB)<=RING_TOP) THEN
PARTICLE_TAG = PARTICLE_TAG + NMESHES
DO NXB = 1,IBAR
DO NYB = 1,JBAR
RCELL = SQRT((X(NXB)-X_TREE(N_CFCR_TREE))**2 + (Y(NYB)-Y_TREE(N_CFCR_TREE))**2)
IF (RCELL <= OUTER_RADIUS .AND. RCELL >= INNER_RADIUS) THEN
NLP = NLP + 1
NLP_TREE = NLP_TREE + 1
IF (NLP>NLPDIM) THEN
CALL RE_ALLOCATE_PARTICLES(1,NM,0,1000)
PARTICLE=>MESHES(NM)%PARTICLE
ENDIF
LP=>PARTICLE(NLP)
LP%VEG_VOLFRACTION = 1._EB
LP%TAG = PARTICLE_TAG
LP%X = REAL(NXB,EB)
LP%Y = REAL(NYB,EB)
LP%Z = REAL(NZB,EB)
LP%CLASS = IPC
LP%PWT = 1._EB ! This is not used, but it is necessary to assign a non-zero weight factor to each particle
VEG_PRESENT_FLAG(NXB,NYB,NZB) = .TRUE.
ENDIF
ENDDO
ENDDO
ENDIF
ENDDO
NLP_VEG_FUEL = NLP_TREE
ENDIF IF_RING_VEGETATION_BUILD
!
! For the current vegetation type (particle class) assign one fuel
! element (PARTICLE) to each grid cell and initialize PARTICLE properties
! (this is precautionary needs more testing to determine its necessity)
!
REP_VEG_ELEMS: DO I=NLP-NLP_VEG_FUEL+1,NLP
LP=>PARTICLE(I)
LP%IGNITOR = .FALSE.
DO NZB=0,KBAR
DO NXB=0,IBAR
GRID_LOOP: DO NYB=0,JBAR
IF (.NOT. VEG_PRESENT_FLAG(NXB,NYB,NZB)) CYCLE GRID_LOOP
IF (REAL(NXB,EB)==LP%X .AND. REAL(NYB,EB)==LP%Y .AND. REAL(NZB,EB)==LP%Z) THEN
IF(CELL_TAKEN_FLAG(NXB,NYB,NZB)) THEN
LP%R = 0.0001_EB*PC%KILL_RADIUS
CYCLE REP_VEG_ELEMS
ENDIF
CELL_TAKEN_FLAG(NXB,NYB,NZB) = .TRUE.
LP%X = X(NXB) - 0.5_EB*DX(NXB)
LP%Y = Y(NYB) - 0.5_EB*DY(NYB)
LP%Z = Z(NZB) - 0.5_EB*DZ(NZB)
IF (VEG_FUEL_GEOM(NCT) == 'RECTANGLE')THEN
LP%X = X(NXB) + 0.5_EB*DX(NXB)
LP%Y = Y(NYB) + 0.5_EB*DY(NYB)
LP%Z = Z(NZB) + 0.5_EB*DZ(NZB)
ENDIF
TREE_MESH(NM) = .TRUE.
LP%SHOW = .TRUE.
LP%T = 0.
LP%U = 0.
LP%V = 0.
LP%W = 0.
! LP%R = 3./PC%VEG_SV !sphere, Porterie
LP%R = 2./PC%VEG_SV !cylinder, Porterie
LP%IOR = 0
LP%VEG_FUEL_MASS = PC%VEG_BULK_DENSITY
LP%VEG_MOIST_MASS = PC%VEG_MOISTURE*LP%VEG_FUEL_MASS
! LP%VEG_CHAR_MASS = PC%VEG_BULK_DENSITY*PC%VEG_CHAR_FRACTION
LP%VEG_CHAR_MASS = 0.0_EB
LP%VEG_ASH_MASS = 0.0_EB
LP%VEG_PACKING_RATIO = PC%VEG_BULK_DENSITY/PC%VEG_DENSITY
LP%VEG_SV = PC%VEG_SV
LP%VEG_KAPPA = 0.25*PC%VEG_SV*PC%VEG_BULK_DENSITY/PC%VEG_DENSITY
LP%TMP = PC%VEG_INITIAL_TEMPERATURE
LP%VEG_IGNITED = .FALSE.
IF(IGN_ELEMS(NCT)) THEN
IGNITOR_PRESENT = .TRUE.
LP%TMP = TMPA
LP%IGNITOR = .TRUE.
N_IGN = TREE_IGN_INDEX(NCT)
LP%VEG_IGN_TON = TON_IGN_ELEMS(N_IGN)
LP%VEG_IGN_TOFF = TOFF_IGN_ELEMS(N_IGN)
LP%VEG_IGN_TRAMPON = T_RAMPON_IGN_ELEMS(N_IGN)
LP%VEG_IGN_TRAMPOFF = T_RAMPOFF_IGN_ELEMS(N_IGN)
ENDIF
LP%VEG_EMISS = 4._EB*SIGMA*LP%VEG_KAPPA*LP%TMP**4
LP%VEG_DIVQR = 0.0_EB
LP%VEG_N_TREE_OUTPUT = 0
! TREE_MESH_OUT(NM) = .FALSE.
IF (N_TREE_OUT(NCT) /= 0) THEN
CALL GET_IJK(LP%X,LP%Y,LP%Z,NM,XI,YJ,ZK,II,JJ,KK)
IJK_VEGOUT(II,JJ,KK) = 1
LP%VEG_N_TREE_OUTPUT = N_TREE_OUT(NCT)
LP%IOR = 0 !airborne static PARTICLE
! TREE_MESH_OUT(NM) = .TRUE.
ENDIF
CYCLE REP_VEG_ELEMS
ENDIF
ENDDO GRID_LOOP
ENDDO
ENDDO
ENDDO REP_VEG_ELEMS
!
!print*,'in vege 2: NM,NCT,N_TREE_OUT(NCT)', NM,NCT,N_TREE_OUT(NCT)
!print*,'in vege 2: NLP,NM,TREE_MESH_OUT(NM),NCT',NLP,NM,TREE_MESH_OUT(NM),NCT
ENDDO TREE_LOOP
CALL REMOVE_PARTICLES(0._EB,NM)
!Fill veg output arrays with initial values
IF (N_TREES_OUT > 0) THEN
CALL POINT_TO_MESH(NM)
TREE_OUTPUT_DATA(:,:,NM) = 0._EB
PARTICLE_LOOP: DO I=1,NLP
LP=>PARTICLE(I)
N_TREE = LP%VEG_N_TREE_OUTPUT
CALL GET_IJK(LP%X,LP%Y,LP%Z,NM,XI,YJ,ZK,II,JJ,KK)
IF(N_TREE == 0 .AND. IJK_VEGOUT(II,JJ,KK)==1 .AND. .NOT. LP%IGNITOR) LP%R = 0.0001_EB*PC%KILL_RADIUS
IF (N_TREE /= 0) THEN
V_CELL = DX(II)*DY(JJ)*DZ(KK)
TREE_OUTPUT_DATA(N_TREE,1,NM) = TREE_OUTPUT_DATA(N_TREE,1,NM) + LP%TMP - 273._EB !C
TREE_OUTPUT_DATA(N_TREE,2,NM) = TREE_OUTPUT_DATA(N_TREE,2,NM) + TMPA - 273._EB !C
TREE_OUTPUT_DATA(N_TREE,3,NM) = TREE_OUTPUT_DATA(N_TREE,3,NM) + LP%VEG_FUEL_MASS*V_CELL !kg
TREE_OUTPUT_DATA(N_TREE,4,NM) = TREE_OUTPUT_DATA(N_TREE,4,NM) + LP%VEG_MOIST_MASS*V_CELL !kg
TREE_OUTPUT_DATA(N_TREE,5,NM) = TREE_OUTPUT_DATA(N_TREE,5,NM) + LP%VEG_CHAR_MASS*V_CELL !kg
TREE_OUTPUT_DATA(N_TREE,6,NM) = TREE_OUTPUT_DATA(N_TREE,6,NM) + LP%VEG_ASH_MASS*V_CELL !kg
TREE_OUTPUT_DATA(N_TREE,7,NM) = TREE_OUTPUT_DATA(N_TREE,7,NM) + LP%VEG_DIVQR*V_CELL*0.001_EB !kW
TREE_OUTPUT_DATA(N_TREE,8,NM) = TREE_OUTPUT_DATA(N_TREE,8,NM) + LP%VEG_DIVQR*V_CELL*0.001_EB !kW
TREE_OUTPUT_DATA(N_TREE,10,NM) = 0.0_EB !kg
TREE_OUTPUT_DATA(N_TREE,11,NM) = 0.0_EB !kW
ENDIF
ENDDO PARTICLE_LOOP
ENDIF
CALL REMOVE_PARTICLES(0._EB,NM)
!Deallocate arrays
DEALLOCATE(VEG_PRESENT_FLAG)
DEALLOCATE(CELL_TAKEN_FLAG)
DEALLOCATE(IJK_VEGOUT)
END SUBROUTINE INITIALIZE_RAISED_VEG
SUBROUTINE DEALLOCATE_VEG_ARRAYS
!Deallocate arrays used to initialize vegetation particles
IF (CONE_TREE_PRESENT .OR. FRUSTUM_TREE_PRESENT .OR. CYLINDER_TREE_PRESENT .OR. RING_TREE_PRESENT) THEN
DEALLOCATE(TREE_CFCR_INDEX)
DEALLOCATE(X_TREE)
DEALLOCATE(Y_TREE)
DEALLOCATE(Z_TREE)
DEALLOCATE(TREE_H)
DEALLOCATE(CROWN_B_H)
DEALLOCATE(CROWN_W)
ENDIF
IF (FRUSTUM_TREE_PRESENT) THEN
DEALLOCATE(TREE_FRUSTUM_INDEX)
DEALLOCATE(CROWN_W_TOP)
DEALLOCATE(CROWN_W_BOTTOM)
ENDIF
IF (RECTANGLE_TREE_PRESENT) THEN
DEALLOCATE(TREE_RECT_INDEX)
DEALLOCATE(XS_RECT_VEG)
DEALLOCATE(XF_RECT_VEG)
DEALLOCATE(YS_RECT_VEG)
DEALLOCATE(YF_RECT_VEG)
DEALLOCATE(ZS_RECT_VEG)
DEALLOCATE(ZF_RECT_VEG)
ENDIF
IF (RING_TREE_PRESENT) THEN
DEALLOCATE(TREE_RING_INDEX)
DEALLOCATE(RING_THICKNESS_VEG)
ENDIF
IF (IGNITOR_PRESENT) THEN
DEALLOCATE(IGN_ELEMS)
DEALLOCATE(TREE_IGN_INDEX)
DEALLOCATE(TON_IGN_ELEMS)
DEALLOCATE(TOFF_IGN_ELEMS)
DEALLOCATE(T_RAMPOFF_IGN_ELEMS)
DEALLOCATE(T_RAMPON_IGN_ELEMS)
ENDIF
END SUBROUTINE DEALLOCATE_VEG_ARRAYS
SUBROUTINE RAISED_VEG_MASS_ENERGY_TRANSFER(T,NM)
! Mass and energy transfer between gas and raised vegetation fuel elements
USE PHYSICAL_FUNCTIONS, ONLY : GET_MASS_FRACTION,GET_SPECIFIC_HEAT
USE MATH_FUNCTIONS, ONLY : AFILL2
USE TRAN, ONLY: GET_IJK
!arrays for debugging
REAL(EB), POINTER, DIMENSION(:,:,:) :: HOLD1,HOLD2,HOLD3,HOLD4
REAL(EB), POINTER, DIMENSION(:,:,:) :: UU,VV,WW !,RHOP
REAL(EB) :: RE_D,RCP_GAS,CP_GAS
REAL(EB) :: RDT,T,V_CELL,V_VEG
REAL(EB) :: CP_ASH,CP_H2O,CP_CHAR,H_VAP_H2O,TMP_H2O_BOIL
REAL(EB) :: K_AIR,MASS_GAS,MU_AIR,RHO_GAS,RRHO_GAS_NEW,TMP_GAS,UBAR,VBAR,WBAR,UREL,VREL,WREL
REAL(EB) :: CHAR_FCTR,CHAR_FCTR2,CP_VEG,DTMP_VEG,MPV_MOIST,MPV_MOIST_MIN,DMPV_VEG,MPV_VEG,MPV_VEG_MIN, &
SV_VEG,TMP_VEG,TMP_VEG_NEW
REAL(EB) :: TMP_IGNITOR
REAL(EB) :: MPV_ADDED,MPV_MOIST_LOSS,MPV_VOLIT,MPV_MOIST_LOSS_MAX,MPV_VOLIT_MAX
REAL(EB) :: QCON_VEG,QNET_VEG,QRAD_VEG,QREL,TMP_GMV,Q_FOR_DRYING,Q_VOLIT,Q_FOR_VOLIT, &
Q_UPTO_VOLIT
REAL(EB) :: H_SENS_VEG_VOLIT,Q_ENTHALPY,Q_VEG_MOIST,Q_VEG_VOLIT,Q_VEG_CHAR
REAL(EB) :: MW_AVERAGE,MW_VEG_MOIST_TERM,MW_VEG_VOLIT_TERM
REAL(EB) :: XI,YJ,ZK
REAL(EB) :: A_H2O_VEG,E_H2O_VEG,A_PYR_VEG,E_PYR_VEG,H_PYR_VEG,R_H_PYR_VEG
REAL(EB) :: A_CHAR_VEG,E_CHAR_VEG,BETA_CHAR_VEG,NU_CHAR_VEG,NU_ASH_VEG,NU_O2_CHAR_VEG, &
MPV_ASH,MPV_ASH_MAX,MPV_CHAR,MPV_CHAR_LOSS,MPV_CHAR_MIN,MPV_CHAR_CO2,Y_O2, &
H_CHAR_VEG ,ORIG_PACKING_RATIO,CP_VEG_FUEL_AND_CHAR_MASS,CP_MASS_VEG_SOLID, &
TMP_CHAR_MAX
REAL(EB) :: ZZ_GET(0:N_TRACKED_SPECIES)
INTEGER :: I,II,JJ,KK,IIX,JJY,KKZ,IPC,N_TREE,I_FUEL
INTEGER, INTENT(IN) :: NM
LOGICAL :: VEG_DEGRADATION_LINEAR,VEG_DEGRADATION_ARRHENIUS
INTEGER :: IDT,NDT_CYCLES
REAL(EB) :: FCTR_DT_CYCLES,FCTR_RDT_CYCLES,Q_VEG_CHAR_TOTAL,MPV_CHAR_CO2_TOTAL,MPV_CHAR_LOSS_TOTAL, &
MPV_MOIST_LOSS_TOTAL,MPV_VOLIT_TOTAL
REAL(EB) :: VEG_CRITICAL_MASSFLUX,VEG_CRITICAL_MASSSOURCE
!place holder
REAL(EB) :: RCP_TEMPORARY
!Debug
REAL(EB)TOTAL_BULKDENS_MOIST,TOTAL_BULKDENS_DRY_FUEL,TOTAL_MASS_DRY_FUEL,TOTAL_MASS_MOIST
!IF (.NOT. TREE) RETURN !Exit if no raised veg anywhere
IF (.NOT. TREE_MESH(NM)) RETURN !Exit if raised veg is not present in mesh
CALL POINT_TO_MESH(NM)
!IF (PREDICTOR) THEN
UU => U
VV => V
WW => W
! RHOP => RHO
!ELSE
! UU => US
! VV => VS
! WW => WS
! RHOP => RHOS
!ENDIF
! Initializations
RDT = 1._EB/DT
!RCP_TEMPORARY = 1._EB/CP_GAMMA
RCP_TEMPORARY = 1._EB/1010._EB
!Critical mass flux (kg/(s m^2)
VEG_CRITICAL_MASSFLUX = 0.0025_EB !kg/s/m^2 for qradinc=50 kW/m^2, M=4% measured by McAllister Fire Safety J., 61:200-206 2013
!VEG_CRITICAL_MASSFLUX = 0.0035_EB !kg/s/m^2 largest measured by McAllister Fire Safety J., 61:200-206 2013
!VEG_CRITICAL_MASSFLUX = 999999._EB !kg/s/m^2 for testing
!Constants for Arrhenius pyrolyis and Arrhenius char oxidation models
!are from the literature (Porterie et al., Num. Heat Transfer, 47:571-591, 2005)
CP_H2O = 4190._EB !J/kg/K specific heat of water
TMP_H2O_BOIL = 373.15_EB
!H_VAP_H2O = 2259._EB*1000._EB !J/kg/K heat of vaporization of water
TMP_CHAR_MAX = 1300._EB !K
!Kinetic constants used by multiple investigators from Porterie or Morvan papers
!A_H2O_VEG = 600000._EB !1/s sqrt(K)
!E_H2O_VEG = 5800._EB !K
!A_PYR_VEG = 36300._EB !1/s
!E_PYR_VEG = 7250._EB !K
!E_CHAR_VEG = 9000._EB !K
!BETA_CHAR_VEG = 0.2_EB
!!NU_CHAR_VEG = 0.3_EB
!!NU_ASH_VEG = 0.1_EB
!NU_O2_CHAR_VEG = 1.65_EB
CP_ASH = 800._EB !J/kg/K
!Kinetic constants used by Morvan and Porterie mostly obtained from Grishin
!H_PYR_VEG = 418000._EB !J/kg
!A_CHAR_VEG = 430._EB !m/s
!H_CHAR_VEG = -12.0E+6_EB ! J/kg
!Kinetic constants used by Yolanda and Paul
!H_PYR_VEG = 418000._EB !J/kg
!A_CHAR_VEG = 215._EB !m/s Yolanda, adjusted from Morvan, Porterie values based on HRR exp
!H_CHAR_VEG = -32.74E+6_EB !J/kg via Susott
!Kinetic constants used by Shankar
!H_PYR_VEG = 418._EB !J/kg Shankar
!A_CHAR_VEG = 430._EB !m/s Porterie, Morvan
!H_CHAR_VEG = -32.74E+6_EB !J/kg Shankar via Susott
!Kinetic constants used by me for ROS vs Slope excelsior experiments
!H_PYR_VEG = 711000._EB !J/kg excelsior Catchpole et al. (via Susott)
!A_CHAR_VEG = 430._EB !m/s Porterie, Morvan
!H_CHAR_VEG = -32.74E+6_EB !J/kg via Susott
!R_H_PYR_VEG = 1._EB/H_PYR_VEG
!D_AIR = 2.6E-5_EB ! Water Vapor - Air binary diffusion (m2/s at 25 C, Incropera & DeWitt, Table A.8)
!SC_AIR = 0.6_EB ! NU_AIR/D_AIR (Incropera & DeWitt, Chap 7, External Flow)
!PR_AIR = 0.7_EB
! Working arrays
IF(N_TREES_OUT > 0) TREE_OUTPUT_DATA(:,:,NM) = 0._EB !for output of veg data
!DMPVDT_FM_VEG = 0.0_EB
!Clear arrays and scalars
HOLD1 => WORK4 ; WORK4 = 0._EB
HOLD2 => WORK5 ; WORK5 = 0._EB
HOLD3 => WORK6 ; WORK6 = 0._EB
HOLD4 => WORK7 ; WORK7 = 0._EB
TOTAL_BULKDENS_MOIST = 0.0_EB
TOTAL_BULKDENS_DRY_FUEL = 0.0_EB
TOTAL_MASS_MOIST = 0.0_EB
TOTAL_MASS_DRY_FUEL = 0.0_EB
V_VEG = 0.0_EB
!print*,'vege h-m transfer: NM, NLP',nm,nlp
PARTICLE_LOOP: DO I=1,NLP
LP => PARTICLE(I)
IPC = LP%CLASS
PC=>PARTICLE_CLASS(IPC)
IF (.NOT. PC%TREE) CYCLE PARTICLE_LOOP !Ensure grid cell has vegetation
IF (PC%MASSLESS) CYCLE PARTICLE_LOOP !Skip PARTICLE if massless
THERMAL_CALC: IF (.NOT. PC%VEG_STEM) THEN !compute heat transfer, etc if thermally thin
!Quantities for sub-cycling the thermal degradation time stepping
NDT_CYCLES = PC%VEG_NDT_SUBCYCLES !number of thermal degradation time stepping loops within one gas phase DT
FCTR_DT_CYCLES = 1._EB/REAL(NDT_CYCLES,EB)
FCTR_RDT_CYCLES = REAL(NDT_CYCLES,EB)
! Intialize quantities
LP%VEG_MLR = 0.0_EB
Q_VEG_CHAR = 0.0_EB
Q_VEG_MOIST = 0.0_EB
Q_VEG_VOLIT = 0.0_EB
Q_UPTO_VOLIT = 0.0_EB
Q_VOLIT = 0.0_EB
MPV_MOIST_LOSS = 0.0_EB
MPV_CHAR_LOSS = 0.0_EB
MPV_CHAR_CO2 = 0.0_EB
MPV_VOLIT = 0.0_EB
MPV_ADDED = 0.0_EB
MW_VEG_MOIST_TERM = 0.0_EB
MW_VEG_VOLIT_TERM = 0.0_EB
CP_VEG_FUEL_AND_CHAR_MASS = 0.0_EB
CP_MASS_VEG_SOLID = 0.0_EB
VEG_DEGRADATION_LINEAR = .FALSE.
VEG_DEGRADATION_ARRHENIUS = .FALSE.
MPV_CHAR_CO2_TOTAL = 0.0_EB !needed for time subcycling
MPV_CHAR_LOSS_TOTAL = 0.0_EB !needed for time subcycling
MPV_MOIST_LOSS_TOTAL = 0.0_EB !needed for time subcycling
MPV_VOLIT_TOTAL = 0.0_EB !needed for time subcycling
Q_VEG_CHAR_TOTAL = 0.0_EB !needed for time subcyling
! Vegetation variables
NU_CHAR_VEG = PC%VEG_CHAR_FRACTION
NU_ASH_VEG = PC%VEG_ASH_FRACTION/PC%VEG_CHAR_FRACTION !fraction of char that can become ash
CHAR_FCTR = 1._EB - PC%VEG_CHAR_FRACTION !factor used to determine volatile mass
CHAR_FCTR2 = 1._EB/CHAR_FCTR !factor used to determine char mass
SV_VEG = LP%VEG_SV !surface-to-volume ration 1/m
TMP_VEG = LP%TMP
MPV_VEG = LP%VEG_FUEL_MASS !bulk density of dry veg kg/m^3
MPV_CHAR = LP%VEG_CHAR_MASS !bulk density of char
MPV_ASH = LP%VEG_ASH_MASS !bulk density of ash
MPV_MOIST = LP%VEG_MOIST_MASS !bulk density of moisture in veg
MPV_VEG_MIN = PC%VEG_FUEL_MPV_MIN
MPV_CHAR_MIN = PC%VEG_CHAR_MPV_MIN
MPV_MOIST_MIN = PC%VEG_MOIST_MPV_MIN
MPV_ASH_MAX = PC%VEG_ASH_MPV_MAX !maxium ash bulk density
MPV_MOIST_LOSS_MAX = PC%VEG_DEHYDRATION_RATE_MAX*DT*FCTR_DT_CYCLES
MPV_VOLIT_MAX = PC%VEG_BURNING_RATE_MAX*DT*FCTR_DT_CYCLES
ORIG_PACKING_RATIO = PC%VEG_BULK_DENSITY/PC%VEG_DENSITY
H_VAP_H2O = PC%VEG_H_H2O !J/kg/K heat of vaporization of water
A_H2O_VEG = PC%VEG_A_H2O !1/s sqrt(K)
E_H2O_VEG = PC%VEG_E_H2O !K
H_PYR_VEG = PC%VEG_H_PYR !J/kg
A_PYR_VEG = PC%VEG_A_PYR !1/s
E_PYR_VEG = PC%VEG_E_PYR !K
H_CHAR_VEG = PC%VEG_H_CHAR ! J/kg
A_CHAR_VEG = PC%VEG_A_CHAR !m/s
E_CHAR_VEG = PC%VEG_E_CHAR !K
BETA_CHAR_VEG = PC%VEG_BETA_CHAR
NU_O2_CHAR_VEG = PC%VEG_NU_O2_CHAR
! Thermal degradation approach parameters
IF(PC%VEG_DEGRADATION == 'LINEAR') VEG_DEGRADATION_LINEAR = .TRUE.
IF(PC%VEG_DEGRADATION == 'ARRHENIUS') VEG_DEGRADATION_ARRHENIUS = .TRUE.
R_H_PYR_VEG = 1._EB/H_PYR_VEG
!Bound on volumetric mass flux
VEG_CRITICAL_MASSSOURCE = VEG_CRITICAL_MASSFLUX*SV_VEG*LP%VEG_PACKING_RATIO
! Determine grid cell quantities of the vegetation fuel element
CALL GET_IJK(LP%X,LP%Y,LP%Z,NM,XI,YJ,ZK,II,JJ,KK)
IIX = FLOOR(XI+0.5_EB)
JJY = FLOOR(YJ+0.5_EB)
KKZ = FLOOR(ZK+0.5_EB)
V_CELL = DX(II)*DY(JJ)*DZ(KK)
! Gas velocities in vegetation grid cell
UBAR = AFILL2(UU,II-1,JJY,KKZ,XI-II+1,YJ-JJY+.5_EB,ZK-KKZ+.5_EB)
VBAR = AFILL2(VV,IIX,JJ-1,KKZ,XI-IIX+.5_EB,YJ-JJ+1,ZK-KKZ+.5_EB)
WBAR = AFILL2(WW,IIX,JJY,KK-1,XI-IIX+.5_EB,YJ-JJY+.5_EB,ZK-KK+1)
UREL = LP%U - UBAR
VREL = LP%V - VBAR
WREL = LP%W - WBAR
QREL = MAX(1.E-6_EB,SQRT(UREL*UREL + VREL*VREL + WREL*WREL))
! Gas thermophysical quantities
TMP_GAS = TMP(II,JJ,KK)
RHO_GAS = RHO(II,JJ,KK)
MASS_GAS = RHO_GAS*V_CELL
MU_AIR = MU_Z(MIN(5000,NINT(TMP_GAS)),0)*SPECIES_MIXTURE(0)%MW
K_AIR = CPOPR*MU_AIR !W/m.K
NDT_CYCLES=1
TIME_SUBCYCLING_LOOP: DO IDT=1,NDT_CYCLES
! Veg thermophysical properties
TMP_GMV = TMP_GAS - TMP_VEG
CP_VEG = (0.01_EB + 0.0037_EB*TMP_VEG)*1000._EB !J/kg/K Ritchie IAFSS 1997:177-188
CP_CHAR = 420._EB + 2.09_EB*TMP_VEG + 6.85E-4_EB*TMP_VEG**2 !J/kg/K Park etal. C&F 2010 147:481-494
! Divergence of convective and radiative heat fluxes
!print*,'---- NM=',NM
!print*,rho_gas,qrel,sv_veg,mu_air
RE_D = RHO_GAS*QREL*2._EB/(SV_VEG*MU_AIR)
!IF (TMP_VEG >= TMP_GAS )QCON_VEG = SV_VEG*(0.5_EB*K_AIR*0.683_EB*RE_D**0.466_EB)*0.5_EB*TMP_GMV !W/m^2 from Porterie
!IF (TMP_VEG < TMP_GAS ) QCON_VEG = TMP_GMV*1.42_EB*(ABS(TMP_GMV)/DZ(KK))**0.25_EB !Holman
QCON_VEG = SV_VEG*(0.5_EB*K_AIR*0.683_EB*RE_D**0.466_EB)*0.5_EB*TMP_GMV !W/m^2 from Porterie (cylinder)
!QCON_VEG = TMP_GMV*1.42_EB*(ABS(TMP_GMV)/DZ(KK))**0.25_EB !Holman
QCON_VEG = SV_VEG*LP%VEG_PACKING_RATIO*QCON_VEG !W/m^3
LP%VEG_DIVQC = QCON_VEG
QRAD_VEG = LP%VEG_DIVQR
! Divergence of net heat flux
QNET_VEG = QCON_VEG + QRAD_VEG !W/m^3
! Update temperature of vegetation
!CP_VEG_FUEL_AND_CHAR_MASS = CP_VEG*MPV_VEG + CP_CHAR*MPV_CHAR
!DTMP_VEG = DT*QNET_VEG/(CP_VEG_FUEL_AND_CHAR_MASS + CP_H2O*MPV_MOIST)
CP_MASS_VEG_SOLID = CP_VEG*MPV_VEG + CP_CHAR*MPV_CHAR + CP_ASH*MPV_ASH
DTMP_VEG = FCTR_DT_CYCLES*DT*QNET_VEG/(CP_MASS_VEG_SOLID + CP_H2O*MPV_MOIST)
!print*,'vege:tmpveg,qnet_veg,cp_mass_veg_solid',tmp_veg,qnet_veg,cp_mass_veg_solid
TMP_VEG_NEW = TMP_VEG + DTMP_VEG
IF (TMP_VEG_NEW < TMPA) TMP_VEG_NEW = TMP_GAS
!print*,'---------------------------------------------------------'
!print 1113,ii,jj,kk,idt
!1113 format(2x,4(I3))
!print 1112,tmp_veg_new,tmp_veg,qnet_veg,cp_mass_veg_solid,cp_h2o,dtmp_veg
!1112 format(2x,6(e15.5))
! Set temperature of inert ignitor elements
IF(LP%IGNITOR) THEN
TMP_IGNITOR = PC%VEG_INITIAL_TEMPERATURE
TMP_VEG_NEW = TMP_GAS
IF(T>=LP%VEG_IGN_TON .AND. T<=LP%VEG_IGN_TON+LP%VEG_IGN_TRAMPON) THEN
TMP_VEG_NEW = &
TMPA + (TMP_IGNITOR-TMPA)*(T-LP%VEG_IGN_TON)/LP%VEG_IGN_TRAMPON
ENDIF
IF(T>LP%VEG_IGN_TON+LP%VEG_IGN_TRAMPON) TMP_VEG_NEW = TMP_IGNITOR
IF(T>=LP%VEG_IGN_TOFF .AND. T<=LP%VEG_IGN_TOFF+LP%VEG_IGN_TRAMPOFF)THEN
TMP_VEG_NEW = &
TMP_IGNITOR - (TMP_IGNITOR-TMP_GAS)*(T-LP%VEG_IGN_TOFF)/LP%VEG_IGN_TRAMPOFF
ENDIF
IF(T > LP%VEG_IGN_TOFF+LP%VEG_IGN_TRAMPOFF) THEN
LP%R = 0.0001_EB*PC%KILL_RADIUS !remove ignitor element
TMP_VEG_NEW = TMP_GAS
ENDIF
ENDIF
! ************** Fuel Element Linear Pyrolysis Degradation model *************************
! Drying occurs if qnet > 0 with Tveg held at 100 c
! Pyrolysis occurs if qnet > 0 according to Morvan & Dupuy empirical formula. Linear
! temperature dependence with qnet factor.
! Char oxidation occurs if qnet > 0 (user must request char ox) after pyrolysis is completed.
!
IF_VEG_DEGRADATION_LINEAR: IF(VEG_DEGRADATION_LINEAR) THEN
IF_NET_HEAT_INFLUX: IF (QNET_VEG > 0.0_EB .AND. .NOT. LP%IGNITOR) THEN !dehydrate or pyrolyze
! Drying of fuel element vegetation
IF_DEHYDRATION: IF (MPV_MOIST > MPV_MOIST_MIN .AND. TMP_VEG_NEW > TMP_H2O_BOIL) THEN
Q_FOR_DRYING = (TMP_VEG_NEW - TMP_H2O_BOIL)/DTMP_VEG * QNET_VEG
MPV_MOIST_LOSS = MIN(DT*Q_FOR_DRYING/H_VAP_H2O,MPV_MOIST-MPV_MOIST_MIN)
MPV_MOIST_LOSS = LP%VEG_VOLFRACTION*MPV_MOIST_LOSS !accounts for veg not filling grid cell in z
MPV_MOIST_LOSS = MIN(MPV_MOIST_LOSS,MPV_MOIST_LOSS_MAX) !use specified max
TMP_VEG_NEW = TMP_H2O_BOIL
LP%VEG_MOIST_MASS = MPV_MOIST - MPV_MOIST_LOSS !kg/m^3
IF (LP%VEG_MOIST_MASS <= MPV_MOIST_MIN) LP%VEG_MOIST_MASS = 0.0_EB
Q_VEG_MOIST = MPV_MOIST_LOSS*CP_H2O*(TMP_VEG_NEW - TMPA)
MW_VEG_MOIST_TERM = MPV_MOIST_LOSS/MW_H2O
! IF (I == 1) print*,MPV_MOIST,MPV_MOIST_LOSS
ENDIF IF_DEHYDRATION
! Volitalization of fuel element vegetation
IF_VOLITALIZATION: IF(MPV_MOIST <= MPV_MOIST_MIN) THEN
IF_MD_VOLIT: IF(MPV_VEG > MPV_VEG_MIN .AND. TMP_VEG_NEW >= 400._EB) THEN !Morvan & Dupuy volitalization
Q_UPTO_VOLIT = CP_MASS_VEG_SOLID*MAX((400._EB-TMP_VEG),0._EB)
Q_FOR_VOLIT = DT*QNET_VEG - Q_UPTO_VOLIT
Q_VOLIT = Q_FOR_VOLIT*0.01_EB*(MIN(500._EB,TMP_VEG)-400._EB)
! MPV_VOLIT = Q_VOLIT*R_H_PYR_VEG
MPV_VOLIT = CHAR_FCTR*Q_VOLIT*R_H_PYR_VEG
MPV_VOLIT = MAX(MPV_VOLIT,0._EB)
MPV_VOLIT = LP%VEG_VOLFRACTION*MPV_VOLIT !accounts for veg not filling grid cell in z
MPV_VOLIT = MIN(MPV_VOLIT,MPV_VOLIT_MAX) !user specified max
DMPV_VEG = CHAR_FCTR2*MPV_VOLIT
DMPV_VEG = MIN(DMPV_VEG,(MPV_VEG - MPV_VEG_MIN))
MPV_VEG = MPV_VEG - DMPV_VEG
MPV_VOLIT = CHAR_FCTR*DMPV_VEG
! MPV_CHAR = MPV_CHAR + NU_CHAR_VEG*MPV_VOLIT !kg/m^3
! MPV_CHAR = MPV_CHAR + PC%VEG_CHAR_FRACTION*MPV_VOLIT !kg/m^3
MPV_CHAR = MPV_CHAR + PC%VEG_CHAR_FRACTION*DMPV_VEG !kg/m^3
Q_VOLIT = MPV_VOLIT*H_PYR_VEG
CP_MASS_VEG_SOLID = CP_VEG*MPV_VEG + CP_CHAR*MPV_CHAR
TMP_VEG_NEW = TMP_VEG + (Q_FOR_VOLIT-Q_VOLIT)/CP_MASS_VEG_SOLID
TMP_VEG_NEW = MIN(TMP_VEG_NEW,500._EB) !set to high pyrol temp if too hot
!Handle veg. fuel elements if element mass <= prescribed minimum
IF (MPV_VEG <= MPV_VEG_MIN) THEN
MPV_VEG = MPV_VEG_MIN
IF(PC%VEG_REMOVE_CHARRED .AND. .NOT. PC%VEG_CHAR_OXIDATION) &
LP%R = 0.0001_EB*PC%KILL_RADIUS !fuel element will be removed
ENDIF
!Enthalpy of fuel element volatiles using Cp,volatiles(T) from Ritchie
H_SENS_VEG_VOLIT = 0.0445_EB*(TMP_VEG**1.5_EB - TMP_GAS**1.5_EB) - 0.136_EB*(TMP_VEG - TMP_GAS)
H_SENS_VEG_VOLIT = H_SENS_VEG_VOLIT*1000._EB !J/kg
Q_VEG_VOLIT = CHAR_FCTR*MPV_VOLIT*H_SENS_VEG_VOLIT !J/m^3
MW_VEG_VOLIT_TERM= MPV_VOLIT/SPECIES(FUEL_INDEX)%MW
ENDIF IF_MD_VOLIT
LP%VEG_FUEL_MASS = MPV_VEG
LP%VEG_CHAR_MASS = MPV_CHAR !kg/m^3
ENDIF IF_VOLITALIZATION
ENDIF IF_NET_HEAT_INFLUX
!Char oxidation of fuel element with the Linear pyrolysis model from Morvan and Dupuy, Comb.
!Flame, 138:199-210 (2004)
!(note that this can be handled only approximately with the conserved
!scalar based gas-phase combustion model - the oxygen is consumed by
!the char oxidation reaction is not accounted for since it would be inconsistent with the state
!relation for oxygen that is based on the conserved scalar approach used for gas phase
!combustion)
IF_CHAR_OXIDATION_LIN: IF (PC%VEG_CHAR_OXIDATION .AND. MPV_MOIST <= MPV_MOIST_MIN) THEN
ZZ_GET(1:N_TRACKED_SPECIES) = ZZ(II,JJ,KK,1:N_TRACKED_SPECIES)
CALL GET_MASS_FRACTION(ZZ_GET,O2_INDEX,Y_O2)
MPV_CHAR_LOSS = DT*RHO_GAS*Y_O2*A_CHAR_VEG/NU_O2_CHAR_VEG*SV_VEG*LP%VEG_PACKING_RATIO* &
EXP(-E_CHAR_VEG/TMP_VEG)*(1+BETA_CHAR_VEG*SQRT(2._EB*RE_D))
MPV_CHAR = MAX(MPV_CHAR - MPV_CHAR_LOSS,0.0_EB)
MPV_CHAR_LOSS = LP%VEG_CHAR_MASS - MPV_CHAR
MPV_CHAR_CO2 = (1._EB + NU_O2_CHAR_VEG - NU_ASH_VEG)*MPV_CHAR_LOSS
LP%VEG_CHAR_MASS = MPV_CHAR !kg/m^3
CP_MASS_VEG_SOLID = MPV_VEG*CP_VEG + MPV_CHAR*CP_CHAR + MPV_ASH*CP_ASH
! Reduce fuel element size based on char consumption
! IF (MPV_VEG <= MPV_VEG_MIN) THEN !charring reduce veg elem size
LP%VEG_PACKING_RATIO = LP%VEG_PACKING_RATIO - MPV_CHAR_LOSS/(PC%VEG_DENSITY*PC%VEG_CHAR_FRACTION)
LP%VEG_SV = PC%VEG_SV*(ORIG_PACKING_RATIO/LP%VEG_PACKING_RATIO)**0.333_EB
LP%VEG_KAPPA = 0.25_EB*LP%VEG_SV*LP%VEG_PACKING_RATIO
! ENDIF
!remove fuel element if char ox is complete
IF (MPV_CHAR <= MPV_CHAR_MIN .AND. MPV_VEG <= MPV_VEG_MIN) THEN
CP_MASS_VEG_SOLID = MPV_CHAR_MIN*CP_CHAR + MPV_ASH*CP_ASH
LP%VEG_CHAR_MASS = 0.0_EB
IF(PC%VEG_REMOVE_CHARRED) LP%R = 0.0001_EB*PC%KILL_RADIUS
ENDIF
Q_VEG_CHAR = MPV_CHAR_LOSS*H_CHAR_VEG
TMP_VEG_NEW = TMP_VEG_NEW - PC%VEG_CHAR_ENTHALPY_FRACTION*Q_VEG_CHAR/CP_MASS_VEG_SOLID
TMP_VEG_NEW = MIN(TMP_CHAR_MAX,TMP_VEG_NEW)
! print*,'vege: q_veg_char,temp_veg_new,',q_veg_char,tmp_veg_new
! print*,'------------------'
! ENDIF IF_CHAR_OXIDATION_LIN_2
ENDIF IF_CHAR_OXIDATION_LIN
ENDIF IF_VEG_DEGRADATION_LINEAR
! ************** Fuel Element Arrehnius Degradation model *************************
! Drying and pyrolysis of fuel element occur according to Arrehnius expressions obtained
! from the literature (Porterie et al., Num. Heat Transfer, 47:571-591, 2005
! Predicting wildland fire behavior and emissions using a fine-scale physical
! model
!
IF_VEG_DEGRADATION_ARRHENIUS: IF(VEG_DEGRADATION_ARRHENIUS) THEN
IF_NOT_IGNITOR1: IF (.NOT. LP%IGNITOR) THEN !dehydrate or pyrolyze
! Drying of fuel element vegetation
IF_DEHYDRATION_2: IF (MPV_MOIST > MPV_MOIST_MIN) THEN
MPV_MOIST_LOSS = MIN(FCTR_DT_CYCLES*DT*MPV_MOIST*A_H2O_VEG*EXP(-E_H2O_VEG/TMP_VEG)/SQRT(TMP_VEG), &
MPV_MOIST-MPV_MOIST_MIN)
MPV_MOIST_LOSS = MIN(MPV_MOIST_LOSS,MPV_MOIST_LOSS_MAX) !use specified max
MPV_MOIST = MPV_MOIST - MPV_MOIST_LOSS
LP%VEG_MOIST_MASS = MPV_MOIST !kg/m^3
IF (MPV_MOIST <= MPV_MOIST_MIN) LP%VEG_MOIST_MASS = 0.0_EB
MW_VEG_MOIST_TERM = MPV_MOIST_LOSS/MW_H2O
Q_VEG_MOIST = MPV_MOIST_LOSS*CP_H2O*(TMP_VEG - TMPA)
! IF (I == 1) print*,MPV_MOIST,MPV_MOIST_LOSS
ENDIF IF_DEHYDRATION_2
! Volitalization of fuel element vegetation
IF_VOLITALIZATION_2: IF(MPV_VEG > MPV_VEG_MIN) THEN
MPV_VOLIT = FCTR_DT_CYCLES*DT*CHAR_FCTR*MPV_VEG*A_PYR_VEG*EXP(-E_PYR_VEG/TMP_VEG)
MPV_VOLIT = MIN(MPV_VOLIT,MPV_VOLIT_MAX) !user specified max
DMPV_VEG = CHAR_FCTR2*MPV_VOLIT
DMPV_VEG = MIN(DMPV_VEG,(MPV_VEG - MPV_VEG_MIN))
MPV_VEG = MPV_VEG - DMPV_VEG
MPV_VOLIT = CHAR_FCTR*DMPV_VEG
MPV_CHAR = MPV_CHAR + PC%VEG_CHAR_FRACTION*DMPV_VEG !kg/m^3
! MPV_CHAR = MPV_CHAR + PC%VEG_CHAR_FRACTION*MPV_VOLIT !kg/m^3
CP_MASS_VEG_SOLID = CP_VEG*MPV_VEG + CP_CHAR*MPV_CHAR + CP_ASH*MPV_ASH
!Yolanda's
! MPV_VOLIT = DT*MPV_VEG*A_PYR_VEG*EXP(-E_PYR_VEG/TMP_VEG)
! MPV_VOLIT = MAX(MPV_VOLIT,0._EB)
! MPV_VOLIT = MIN(MPV_VOLIT,MPV_VOLIT_MAX) !user specified max
! MPV_VOLIT = MIN(MPV_VOLIT,(MPV_VEG-MPV_VEG_MIN))
! MPV_VEG = MPV_VEG - MPV_VOLIT
! MPV_CHAR = MPV_CHAR + PC%VEG_CHAR_FRACTION*MPV_VOLIT !kg/m^3
! CP_MASS_VEG_SOLID = CP_VEG*MPV_VEG + CP_CHAR*MPV_CHAR + CP_ASH*MPV_ASH
! MPV_VOLIT = CHAR_FCTR*MPV_VOLIT ! added by Paul to account that volatiles are a fraction of the dry mass transformed *****
!Handle veg. fuel elements if original element mass <= prescribed minimum
IF (MPV_VEG <= MPV_VEG_MIN) THEN
! MPV_VEG = MPV_VEG_MIN
MPV_VEG = 0.0_EB
CP_MASS_VEG_SOLID = CP_CHAR*MPV_CHAR + CP_ASH*MPV_ASH
IF(PC%VEG_REMOVE_CHARRED .AND. .NOT. PC%VEG_CHAR_OXIDATION) LP%R = 0.0001_EB*PC%KILL_RADIUS !remove part
ENDIF
!Enthalpy of fuel element volatiles using Cp,volatiles(T) from Ritchie
H_SENS_VEG_VOLIT = 0.0445_EB*(TMP_VEG**1.5_EB - TMP_GAS**1.5_EB) - 0.136_EB*(TMP_VEG - TMP_GAS)
H_SENS_VEG_VOLIT = H_SENS_VEG_VOLIT*1000._EB !J/kg
Q_VEG_VOLIT = MPV_VOLIT*H_SENS_VEG_VOLIT !J
MW_VEG_VOLIT_TERM= MPV_VOLIT/SPECIES(FUEL_INDEX)%MW
ENDIF IF_VOLITALIZATION_2
LP%VEG_FUEL_MASS = MPV_VEG
LP%VEG_CHAR_MASS = MPV_CHAR
!Char oxidation or fuel element within the Arrhenius pyrolysis model
!(note that this can be handled only approximately with the conserved
!scalar based gas-phase combustion model - no gas phase oxygen is consumed by
!the char oxidation reaction since it would be inconsistent with the state
!relation for oxygen based on the conserved scalar approach for gas phase
!combustion)
! MPV_CHAR_LOSS = 0.0_EB
IF_CHAR_OXIDATION: IF (PC%VEG_CHAR_OXIDATION) THEN
ZZ_GET(1:N_TRACKED_SPECIES) = ZZ(II,JJ,KK,1:N_TRACKED_SPECIES)
CALL GET_MASS_FRACTION(ZZ_GET,O2_INDEX,Y_O2)
MPV_CHAR_LOSS = FCTR_DT_CYCLES*DT*RHO_GAS*Y_O2*A_CHAR_VEG/NU_O2_CHAR_VEG*SV_VEG*LP%VEG_PACKING_RATIO* &
EXP(-E_CHAR_VEG/TMP_VEG)*(1+BETA_CHAR_VEG*SQRT(2._EB*RE_D))
MPV_CHAR_LOSS = MIN(MPV_CHAR,MPV_CHAR_LOSS)
MPV_CHAR = MPV_CHAR - MPV_CHAR_LOSS
MPV_ASH = MPV_ASH + NU_ASH_VEG*MPV_CHAR_LOSS