-
Notifications
You must be signed in to change notification settings - Fork 18
/
module_fr_sfire_driver.F
1160 lines (999 loc) · 51.6 KB
/
module_fr_sfire_driver.F
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
! SFIRE - Spread fire model in WRF-Fire
!
!*** Jan Mandel August 2007 - July 2010
!*** email: Jan.Mandel@gmail.com
! For support please subscribe to the wrf-fire mailing list at NCAR at
! http://mailman.ucar.edu/mailman/listinfo/wrf-fire
! or go to http://www.openwfm.org/wiki/WRF-Fire_user_support
! This module is the only entry point from WRF-ARW to the wildland
! fire model. The call to sfire_driver advances the fire model by
! one timestep. The fire model inputs the wind and outputs
! temperature and humidity tendencies. The fire model also inputs a
! number of constant arrays (fuel data, topography). Additional
! arguments are model state (for data assimilation) and constant arrays
! the model gives to WRF for safekeeping because it is not allowed
! to save anything.
! This code is described in [1]. The fire model is coupled with WRF
! but the fire code itself is not dependent on WRF in any way other
! than calls to few WRF utilities from module_fr_sfire_util. This
! model uses a level set function method for advancing the fireline.
! It is a reimplementation of an earlier model, which used fireline
! propagation by tracers and was coupled with the Clark-Hall
! atmospheric code, described in [2]. For WRF documentation see [3].
! If you use this code, please acknowledge our work by citing [1].
! Thank you.
! Acknowledgements
!
! Contributions to development of the level set
! method by Mijeong Kim. Contribution to fuel calculation by Volodymyr
! Kondratenko.
!
! The fire physics is adapted from an earlier code by Terry
! L. Clark, Janice L. Coen, and Don Latham [2]. The interface with
! WRF is adapted from a code by Ned Patton for coupling of the earlier
! fire model with WRF, based on the foundation outlined in [4].
! The changes in WRF infrastructure and support of
! refined fire grids were provided by John Michalakes.
! Jonathan D. Beezley has set up and maintained the WRF build and
! execution environment, provided software engineering infrastructure
! including synchronization with the WRF repository, and was responsibe
! for all aspects of WRF modification.
! Refefences
!
! [1] Jan Mandel, Jonathan D. Beezley, Janice L. Coen, and Minjeong Kim,
! Data Asimilation for Wildland Fires: Ensemble Kalman filters in
! coupled atmosphere-surface models, IEEE Control Systems Magazine 29,
! Issue 3, June 2009, 47-65.
! [2] T. L. Clark, J. Coen, and D. Latham, Description of a coupled
! atmosphere-fire model, Intl. J. Wildland Fire, vol. 13, pp. 49-64,
! 2004
!
! [3] http://www.mmm.ucar.edu/wrf/OnLineTutorial/Introduction/index.html
!
! [4] Edward G. Patton and Janice L. Coen, WRF-Fire: A Coupled
! Atmosphere-Fire Module for WRF, Preprints of Joint MM5/Weather
! Research and Forecasting Model Users' Workshop, Boulder, CO,
! June 22-25, 2004, pp. 221-223, NCAR
module module_fr_sfire_driver
! use this module for standalone call, you only need to provide some
! mock-up wrf modules
use module_fr_sfire_model
use module_fr_sfire_phys
use module_fr_sfire_util
implicit none
private
public sfire_driver_em,use_atm_vars
logical:: use_atm_vars=.true. ! interpolate wind from atm mesh and average output fluxes back
contains
#define DEBUG_OUT
subroutine sfire_driver_em ( grid , config_flags &
,fire_ifun_start,fire_ifun_end,tsteps &
,ids,ide, kds,kde, jds,jde &
,ims,ime, kms,kme, jms,jme &
,ips,ipe, kps,kpe, jps,jpe &
,ifds,ifde, jfds,jfde &
,ifms,ifme, jfms,jfme &
,ifps,ifpe, jfps,jfpe )
!*** purpose: driver from grid structure
! Driver layer modules
USE module_domain
USE module_configure
! USE module_driver_constants
! USE module_machine
! USE module_tiles
#ifdef DM_PARALLEL
USE module_dm , ONLY : ntasks_x,ntasks_y,local_communicator,mytask,ntasks
USE module_comm_dm , ONLY : halo_fire_lfn_sub,halo_fire_longlat_sub,halo_fire_ht_sub &
,halo_fire_zsf_sub, halo_fire_fuel_sub,halo_fire_wind_a_sub &
,halo_fire_wind_f_sub,halo_fire_tign_sub
#endif
implicit none
!*** arguments
TYPE(domain) , TARGET :: grid ! state
TYPE (grid_config_rec_type) , INTENT(IN) :: config_flags ! namelist
integer, intent(in):: fire_ifun_start,fire_ifun_end,tsteps ! driver cycle controls
integer, intent(in):: &
ids,ide, kds,kde, jds,jde, &
ims,ime, kms,kme, jms,jme, &
ips,ipe, kps,kpe, jps,jpe, &
ifds,ifde, jfds,jfde, &
ifms,ifme, jfms,jfme, &
ifps,ifpe, jfps,jfpe
!*** local
INTEGER:: fire_num_ignitions
integer, parameter::fire_max_ignitions=5
REAL, DIMENSION(fire_max_ignitions):: &
fire_ignition_start_x, &
fire_ignition_start_y, &
fire_ignition_end_x, &
fire_ignition_end_y, &
fire_ignition_start_time, &
fire_ignition_end_time, &
fire_ignition_radius
integer::fire_ifun,ir,jr,fire_ignition_longlat,istep,itimestep
logical::need_lfn_update,restart
real, dimension(ifms:ifme, jfms:jfme)::lfn_out
real:: corner_ll,corner_ul,corner_ur,corner_lr
character(len=128)msg
real:: unit_fxlong ,unit_fxlat
type(fire_params)::fp
!*** executable
call print_id
! populate our structures from wrf
! pointers to be passed to fire spread formulas
fp%vx => grid%uf ! fire winds
fp%vy => grid%vf ! fire winds
fp%zsf => grid%zsf ! terrain height
fp%dzdxf => grid%dzdxf ! terrain grad
fp%dzdyf => grid%dzdyf ! terrain grad
fp%bbb => grid%bbb ! spread formula coeff
fp%betafl => grid%betafl ! spread formula coeff
fp%phiwc => grid%phiwc ! spread formula coeff
fp%r_0 => grid%r_0 ! spread formula coeff
fp%fgip => grid%fgip ! spread formula coeff
fp%ischap => grid%ischap ! spread formula coeff
! get ignition data
call fire_ignition_convert (config_flags,fire_max_ignitions,fire_ignition_longlat, &
fire_ignition_start_x,fire_ignition_start_y,fire_ignition_end_x,fire_ignition_end_y, &
fire_ignition_radius,fire_ignition_start_time,fire_ignition_end_time,fire_num_ignitions, &
unit_fxlong,unit_fxlat)
! copy configuration flags to sfire internal structures
call set_flags(config_flags)
! refinement r
ir=grid%sr_x ! refinement ratio
jr=grid%sr_y
itimestep=grid%itimestep
restart=config_flags%restart
!$OMP CRITICAL(SFIRE_DRIVER_CRIT)
write(msg,'(a,i1,a,i1,a,i4)') &
'sfire_driver_em: ifun from ',fire_ifun_start,' to ',fire_ifun_end,' test steps',tsteps
!$OMP END CRITICAL(SFIRE_DRIVER_CRIT)
call message(msg)
do istep=0,tsteps ! istep >0 is for testing only, exit after the first call
itimestep = grid%itimestep + istep ! in the first call, do fire_test_steps steps of the fire model
need_lfn_update=.false.
do fire_ifun=fire_ifun_start,fire_ifun_end
! 1 = initialize run pass 1: interpolate height to zsf=terrain
! 2 = initialize run pass 2: set fuel data, terrain gradient
! 3 = initialize timestep: interpolate winds, check for ignition
! 4 = do one timestep
! 5 = copy timestep output to input
! 6 = compute output fluxes
#ifdef DM_PARALLEL
if(need_lfn_update)then
! halo exchange on lfn width 2
#include "HALO_FIRE_LFN.inc"
endif
if(fire_ifun.eq.1)then
! halo exchange on topography
#include "HALO_FIRE_LONGLAT.inc"
!! if(fire_topo_from_atm.eq.1)then
!!#include "HALO_FIRE_HT.inc"
!! endif
elseif(fire_ifun.eq.2)then
! halo exchange on zsf width 2
#include "HALO_FIRE_ZSF.inc"
elseif(fire_ifun.eq.3)then
! halo exchange on atm winds width 1 for interpolation
#include "HALO_FIRE_WIND_A.inc"
elseif(fire_ifun.eq.4)then
! halo exchange on fire winds width 2 for a 2-step RK method
#include "HALO_FIRE_WIND_F.inc"
elseif(fire_ifun.eq.6)then
! computing fuel_left needs ignition time from neighbors
#include "HALO_FIRE_TIGN.inc"
endif
#endif
! need domain by 1 smaller, in last row.col winds are not set properly
call sfire_driver_phys ( &
fire_ifun,need_lfn_update, &
ids,ide-1, kds,kde, jds,jde-1, &
ims,ime, kms,kme, jms,jme, &
ips,min(ipe,ide-1), kps,kpe, jps,min(jpe,jde-1), &
ifds,ifde-ir, jfds,jfde-jr, &
ifms,ifme, jfms,jfme, &
ifps,min(ifpe,ifde-ir), jfps,min(jfpe,jfde-jr), &
ir,jr, & ! atm/fire grid ratio
grid%num_tiles, & ! atm grid tiling
grid%i_start,min(grid%i_end,ide-1), &
grid%j_start,min(grid%j_end,jde-1), &
itimestep,restart,config_flags%fire_fuel_read,config_flags%fire_fuel_cat, & ! in scalars
grid%dt,grid%dx,grid%dy, &
grid%u_frame,grid%v_frame, &
unit_fxlong,unit_fxlat, & ! coordinates of grid center
config_flags%fire_ext_grnd,config_flags%fire_ext_crwn,config_flags%fire_crwn_hgt, &
fire_num_ignitions, &
fire_ignition_longlat, &
fire_ignition_start_x,fire_ignition_start_y, & ! ignition - small arrays
fire_ignition_end_x,fire_ignition_end_y, &
fire_ignition_radius, &
fire_ignition_start_time, &
fire_ignition_end_time, &
grid%u_2,grid%v_2,grid%ht, & ! in arrays, on atm grid
grid%xlong,grid%xlat, & ! coordinates of atm grid centers, for ignition location
grid%lfn,grid%tign_g,grid%fuel_frac, & ! state arrays, fire grid
grid%fire_area, & ! redundant, for display, fire grid
lfn_out, & ! work - one timestep
grid%avg_fuel_frac, & ! out redundant arrays, atm grid
grid%grnhfx,grid%grnqfx,grid%canhfx,grid%canqfx, & ! out redundant arrays, atm grid
grid%fgrnhfx,grid%fgrnqfx,grid%fcanhfx,grid%fcanqfx, & ! out redundant arrays, atm grid
grid%ros, & ! rate of spread
grid%fxlong,grid%fxlat, &
grid%nfuel_cat, & ! input, or internal for safekeeping
grid%fuel_time, &
fp &
)
#ifdef DM_PARALLEL
if(fire_ifun.eq.2)then
! halo exchange on all fuel data width 2
#include "HALO_FIRE_FUEL.inc"
endif
#endif
enddo
enddo
if(tsteps>0)call crash('sfire_driver_em: test run of uncoupled fire model completed')
end subroutine sfire_driver_em
!
!*******************
!
! module_fr_sfire_driver%%sfire_driver
subroutine sfire_driver_phys (ifun,need_lfn_update, &
ids,ide, kds,kde, jds,jde, & ! atm grid dimensions
ims,ime, kms,kme, jms,jme, &
ips,ipe, kps,kpe, jps,jpe, &
ifds, ifde, jfds, jfde, & ! fire grid dimensions
ifms, ifme, jfms, jfme, &
ifps, ifpe, jfps, jfpe, & ! fire patch in - will use smaller
ir,jr, & ! atm/fire grid ratio
num_tiles,i_start,i_end,j_start,j_end, & ! atm grid tiling
itimestep,restart,ifuelread,nfuel_cat0,dt,dx,dy, & ! in scalars
u_frame,v_frame, &
unit_fxlong,unit_fxlat, & ! fxlong, fxlat units in m
fire_ext_grnd,fire_ext_crwn,fire_crwn_hgt, &
num_ignitions, &
ignition_longlat, &
ignition_start_x,ignition_start_y, & ! ignition - small arrays
ignition_end_x,ignition_end_y, &
ignition_radius, &
ignition_start_time, &
ignition_end_time, &
u,v,zs, & ! in arrays, atm grid
xlong,xlat, &
lfn,tign,fuel_frac, & ! state arrays, fire grid
fire_area, & ! redundant state, fire grid
lfn_out, & ! out level set function
avg_fuel_frac, &
grnhfx,grnqfx,canhfx,canqfx, & ! out redundant arrays, atm grid
fgrnhfx,fgrnqfx,fcanhfx,fcanqfx, & ! out redundant arrays, fire grid
ros, &
fxlong,fxlat, & !
nfuel_cat, & ! in array, data, fire grid, or constant internal
fuel_time, & ! save constant internal data, fire grid
fp & ! fire params
)
USE module_dm, only:wrf_dm_maxval_integer
implicit none
!*** arguments
integer, intent(in)::ifun, &
ids,ide, kds,kde, jds,jde, & ! atm domain bounds
ims,ime, kms,kme, jms,jme, & ! atm memory bounds
ips,ipe, kps,kpe, jps,jpe, & ! atm patch bounds
ifds, ifde, jfds, jfde, & ! fire domain bounds
ifms, ifme, jfms, jfme, & ! fire memory bounds
ifps, ifpe, jfps, jfpe, & ! fire patch bounds
ir,jr, & ! atm/fire grid refinement ratio
itimestep, & ! number of this timestep
ifuelread, & ! how to initialize nfuel_cat:
! -1=not at all, done outside
! 0=from nfuel_cat0
! 1=from altitude
! 2=from file
nfuel_cat0, & ! fuel category to initialize everything to
num_tiles ! number of tiles
logical, intent(in)::restart
logical, intent(out)::need_lfn_update
integer,dimension(num_tiles),intent(in) :: i_start,i_end,j_start,j_end ! atm grid tiling
real, intent(in):: &
dt, & ! time step
dx,dy, & ! atm grid step
u_frame,v_frame, & ! velocity offset
unit_fxlong,unit_fxlat, & ! fxlong, fxlat units in m
fire_crwn_hgt, & ! lowest height crown fire heat is released (m)
fire_ext_grnd, & ! extinction depth of ground fire heat (m)
fire_ext_crwn ! extinction depth of crown fire heat (m)
integer, intent(in):: num_ignitions ! number of ignitions, can be 0
real, dimension(num_ignitions), intent(in):: &
ignition_start_x,ignition_start_y, &
ignition_end_x,ignition_end_y,ignition_radius, & ! start, end, radius, time
ignition_start_time, & ! of ignition lines start
ignition_end_time ! of ignition lines end
integer, intent(in):: ignition_longlat ! if 1 ignition give as long/lat, otherwise as m from lower left corner
real,intent(in),dimension(ims:ime,kms:kme,jms:jme)::u,v ! wind velocity (m/s) (node based, atm grid)
real,intent(in),dimension(ims:ime, jms:jme):: zs ! terrain height
real, dimension(ims:ime, jms:jme), intent(inout)::xlong, xlat ! inout because of extension at bdry
real, intent(inout), dimension(ifms:ifme,jfms:jfme):: &
nfuel_cat ! fuel data; can be also set inside (cell based, fire grid)
real, intent(inout), dimension(ifms:ifme, jfms:jfme):: &
lfn,tign,fuel_frac, & ! state: level function, ign time, fuel left
lfn_out ! fire wind velocities
real, intent(out), dimension(ifms:ifme, jfms:jfme):: &
fire_area ! fraction of each cell burning
real, intent(out), dimension(ims:ime, jms:jme):: & ! redundant arrays, for display purposes only (atm grid)
avg_fuel_frac, & ! average fuel fraction
grnhfx, & ! heat flux from ground fire (W/m^2)
grnqfx, & ! moisture flux from ground fire (W/m^2)
canhfx, & ! heat flux from crown fire (W/m^2)
canqfx ! moisture flux from crown fire (W/m^2)
real, intent(out), dimension(ifms:ifme, jfms:jfme):: & ! redundant arrays, for display only, fire grid
fgrnhfx, & ! heat flux from ground fire (W/m^2)
fgrnqfx, & ! moisture flux from ground fire (W/m^2)
fcanhfx, & ! heat flux from crown fire (W/m^2)
fcanqfx, & ! moisture flux from crown fire (W/m^2)
ros ! fire rate of spread (m/s)
! ***** data (constant in time) *****
real, dimension(ifms:ifme, jfms:jfme), intent(inout)::fxlong,fxlat ! fire mesh coordinates
real, intent(out), dimension(ifms:ifme, jfms:jfme)::fuel_time ! fire params arrays
type(fire_params),intent(inout)::fp
!*** local
real :: dxf,dyf,time_start,latm, s
integer :: its,ite,jts,jte,kts,kte, & ! tile
ij,i,j,k,id,pid,kpe1, &
ifts,ifte,jfts,jfte ! fire tile
character(len=128)::msg
character(len=3)::kk
integer::ignitions_done_tile(num_tiles),ignited_tile(num_ignitions,num_tiles)
integer::ignitions_done,ignited_patch(num_ignitions),idex,jdex
!*** executable
! time - assume dt does not change
time_start = itimestep * dt
! fire mesh step
dxf=dx/ir
dyf=dy/jr
!$OMP CRITICAL(SFIRE_DRIVER_CRIT)
write(msg,'(a,2f15.6)')'atmosphere mesh step:',dx,dy
call message(msg)
write(msg,'(a,2f15.6)')'fire mesh step: ',dxf,dyf
call message(msg)
write(msg,7001)'atm domain ','ids',ids,ide,jds,jde
call message(msg)
write(msg,7001)'atm memory ','ims',ims,ime,jms,jme
call message(msg)
write(msg,7001)'atm patch ','ips',ips,ipe,jps,jpe
call message(msg)
write(msg,7001)'fire domain ','ifds',ifds,ifde,jfds,jfde
call message(msg)
write(msg,7001)'fire memory ','ifms',ifms,ifme,jfms,jfme
call message(msg)
write(msg,7001)'fire patch ','ifps',ifps,ifpe,jfps,jfpe
call message(msg)
!$OMP END CRITICAL(SFIRE_DRIVER_CRIT)
! check mesh dimensions
call check_fmesh(ids,ide,ifds,ifde,ir,'id') ! check if atm and fire grids line up
call check_fmesh(jds,jde,jfds,jfde,jr,'jd')
call check_fmesh(ips,ipe,ifps,ifpe,ir,'ip')
call check_fmesh(jps,jpe,jfps,jfpe,jr,'jp')
call check_mesh_2dim(ips,ipe,jps,jpe,ims,ime,jms,jme) ! check if atm patch fits in atm array
call check_mesh_2dim(ifps,ifpe,jfps,jfpe,ifms,ifme,jfms,jfme) ! check if fire patch fits in fire array
call check_mesh_2dim(ips,ipe,jps,jpe,ids,ide,jds,jde) ! check if atm patch fits in atm domain
call check_mesh_2dim(ifps,ifpe,jfps,jfpe,ifds,ifde,jfds,jfde) ! check if fire patch fits in fire domain
!$OMP SINGLE
! init rest of fuel tables with derived constants
if(ifun.eq.1) then
call init_fuel_cats ! common for all threads
endif
!$OMP END SINGLE
pid=0
if(itimestep.le.10.or.mod(itimestep,10).eq.0)pid=itimestep ! print 1-10 then every 10th
!pid=itimestep
! fake atm tile bounds
kts=kps
kte=kpe
! set up fire tiles & interpolate to fire grid
!$OMP PARALLEL DO PRIVATE(ij,its,ite,jts,jte,ifts,ifte,jfts,jfte,msg,id) &
!$OMP SCHEDULE(STATIC)
do ij=1,num_tiles
id=0 ! do not print/write anything
if(itimestep.le.10.or.mod(itimestep,10).eq.0)id=itimestep+ij*10000
ignitions_done_tile(ij)=0
! set up tile bounds
its = i_start(ij) ! start atmospheric tile in i
ite = i_end(ij) ! end atmospheric tile in i
jts = j_start(ij) ! start atmospheric tile in j
jte = j_end(ij) ! end atmospheric tile in j
ifts= (its-ids)*ir+ifds ! start fire tile in i
ifte= (ite-ids+1)*ir+ifds-1 ! end fire tile in i
jfts= (jts-jds)*jr+jfds ! start fire tile in j
jfte= (jte-jds+1)*jr+jfds-1 ! end fire tile in j
!$OMP CRITICAL(SFIRE_DRIVER_CRIT)
write(msg,'(3(a,i3,1x))')'tile=',ij,' id=',id,' ifun=',ifun
call message(msg)
write(msg,7001)'atm tile ','its',its,ite,jts,jte
call message(msg)
write(msg,7001)'fire tile ','ifts',ifts,ifte,jfts,jfte
call message(msg)
!$OMP END CRITICAL(SFIRE_DRIVER_CRIT)
! check the tiles
call check_mesh_2dim(its,ite,jts,jte,ips,ipe,jps,jpe) ! check if atm tile fits in atm patch
call check_mesh_2dim(ifts,ifte,jfts,jfte,ifps,ifpe,jfps,jfpe) ! check if fire tile fits in fire patch
call check_mesh_2dim(ifts-2,ifte+2,jfts-2,jfte+2,ifms,ifme,jfms,jfme)! check if fire node tile fits in memory
!$OMP CRITICAL(SFIRE_DRIVER_CRIT)
write(msg,'(a,i6,a,2(f15.6,a))')'time step',itimestep,' at',time_start,' duration',dt,'s'
call message(msg)
7001 format(a,' dimensions ',a4,':',i6,' to ',i6,' by ',i6,' to ',i6)
write(msg,'(a,2i9)')'refinement ratio:',ir,jr
!$OMP END CRITICAL(SFIRE_DRIVER_CRIT)
if(ifun.eq.1)then ! set terrain
if(restart)then
call message('restart - topo initialization skipped')
else
!
! call print_2d_stats(ips,ipe,jps,jpe,ims,ime,jms,jme,zs,'driver:zs')
!
! ! interpolate terrain height
! if(fire_topo_from_atm.eq.1)then
! call interpolate_z2fire(id, & ! for debug output, <= 0 no output
! ids,ide, jds,jde, & ! atm grid dimensions
! ims,ime, jms,jme, &
! ips,ipe,jps,jpe, &
! its,ite,jts,jte, &
! ifds, ifde, jfds, jfde, & ! fire grid dimensions
! ifms, ifme, jfms, jfme, &
! ifts,ifte,jfts,jfte, &
! ir,jr, & ! atm/fire grid ratio
! zs, & ! atm grid arrays in
! fp%zsf) ! fire grid arrays out
! else
!!$OMP CRITICAL(SFIRE_DRIVER_CRIT)
! write(msg,'(a,i3,a)')'fire_topo_from_atm=',fire_topo_from_atm,' assuming ZSF set, interpolation skipped'
!!$OMP END CRITICAL(SFIRE_DRIVER_CRIT)
! endif
if(ignition_longlat .eq.0)then
! set ideal fire mesh coordinates - used for ignition only
! do not forget to set unit_fxlong, unit_fxlat outside of parallel loop
call set_ideal_coord( dxf,dyf, &
ifds,ifde,jfds,jfde, &
ifms,ifme,jfms,jfme, &
ifts,ifte,jfts,jfte, &
fxlong,fxlat )
call set_ideal_coord( dx,dy, &
ids,ide,jds,jde, &
ims,ime,jms,jme, &
its,ite,jts,jte, &
xlong,xlat )
elseif(use_atm_vars)then
! assume halo xlong xlat
! interpolate nodal coordinates
#ifdef DEBUG_OUT
call write_array_m(its,ite,jts,jte,ims,ime,jms,jme,xlat,'xlat',id)
call write_array_m(its,ite,jts,jte,ims,ime,jms,jme,xlong,'xlong',id)
#endif
call interpolate_z2fire(id, & ! for debug output, <= 0 no output
ids,ide, jds,jde, & ! atm grid dimensions
ims,ime, jms,jme, &
ips,ipe,jps,jpe, &
its,ite,jts,jte, &
ifds, ifde, jfds, jfde, & ! fire grid dimensions
ifms, ifme, jfms, jfme, &
ifts,ifte,jfts,jfte, &
ir,jr, & ! atm/fire grid ratio
xlat, & ! atm grid arrays in
fxlat) ! fire grid arrays out
call interpolate_z2fire(id, & ! for debug output, <= 0 no output
ids,ide, jds,jde, & ! atm grid dimensions
ims,ime, jms,jme, &
ips,ipe,jps,jpe, &
its,ite,jts,jte, &
ifds, ifde, jfds, jfde, & ! fire grid dimensions
ifms, ifme, jfms, jfme, &
ifts,ifte,jfts,jfte, &
ir,jr, & ! atm/fire grid ratio
xlong, & ! atm grid arrays in
fxlong) ! fire grid arrays out
endif
endif
elseif(ifun.eq.2)then
! after the loop where zsf created exited and all synced
call print_2d_stats(ifts,ifte,jfts,jfte,ifms,ifme,jfms,jfme,fp%zsf,'driver_phys:zsf')
elseif(ifun.eq.3)then ! interpolate winds to the fire grid
if(use_atm_vars)then
call interpolate_atm2fire(id, & ! flag for debug output
ids,ide, kds,kde, jds,jde, & ! atm grid dimensions
ims,ime, kms,kme, jms,jme, &
ips,ipe,jps,jpe, &
its,ite,jts,jte, &
ifds, ifde, jfds, jfde, & ! fire grid dimensions
ifms, ifme, jfms, jfme, &
ifts,ifte,jfts,jfte, &
ir,jr, & ! atm/fire grid ratio
u_frame, v_frame, & ! velocity frame correction
u,v, & ! atm grid arrays in
fp%vx,fp%vy) ! fire grid arrays out
endif
endif
! the following executes in any case
call sfire_model (id,ifun,restart,need_lfn_update, &
num_ignitions, & ! switches
ifuelread,nfuel_cat0, & ! initialize fuel categories
ifds,ifde,jfds,jfde, & ! fire domain dims
ifms,ifme,jfms,jfme, & ! fire memory dims
ifps,ifpe,jfps,jfpe, &
ifts,ifte,jfts,jfte, & ! fire patch dims
time_start,dt, & ! time and increment
dxf,dyf, & ! fire mesh spacing
ignition_start_x,ignition_start_y, & ! ignition - small arrays
ignition_end_x,ignition_end_y, &
ignition_radius, &
ignition_start_time, &
ignition_end_time, &
ignitions_done_tile(ij),ignited_tile(1,ij), &
fxlong,fxlat,unit_fxlong,unit_fxlat, & ! fire mesh coordinates
lfn,lfn_out,tign,fuel_frac, & ! state: level function, ign time, fuel left
fire_area, & ! output: fraction of cell burning
fgrnhfx,fgrnqfx, & ! output: heat fluxes
ros, & ! output: rate of spread for display
nfuel_cat, & ! fuel data per point
fuel_time, & ! save derived internal data
fp & ! fire coefficients
)
if(ifun.eq.6)then ! heat fluxes into the atmosphere
call print_2d_stats(ifts,ifte,jfts,jfte,ifms,ifme,jfms,jfme,fgrnhfx,'fire_driver:fgrnhfx')
call print_2d_stats(ifts,ifte,jfts,jfte,ifms,ifme,jfms,jfme,fgrnqfx,'fire_driver:fgrnqfx')
! sum the fluxes over atm cells
if(use_atm_vars)then
call sum_2d_cells( &
ifms,ifme,jfms,jfme, &
ifts,ifte,jfts,jfte, &
fuel_frac, &
ims, ime, jms, jme, &
its,ite,jts,jte, &
avg_fuel_frac)
call sum_2d_cells( &
ifms,ifme,jfms,jfme, &
ifts,ifte,jfts,jfte, &
fgrnhfx, &
ims, ime, jms, jme, &
its,ite,jts,jte, &
grnhfx)
!comment out the next call to get results as before commit 55fd92051196b796891b60cb7ec1c4bdb8800078
call sum_2d_cells( &
ifms,ifme,jfms,jfme, &
ifts,ifte,jfts,jfte, &
fgrnqfx, &
ims, ime, jms, jme, &
its,ite,jts,jte, &
grnqfx)
!$OMP CRITICAL(SFIRE_DRIVER_CRIT)
write(msg,'(a,f6.3)')'fire-atmosphere feedback scaling ',fire_atm_feedback
!$OMP end CRITICAL(SFIRE_DRIVER_CRIT)
call message(msg)
s = 1./(ir*jr)
do j=jts,jte
do i=its,ite
! scale ground fluxes to get the averages
avg_fuel_frac(i,j)=avg_fuel_frac(i,j)*s
grnhfx(i,j)=fire_atm_feedback*grnhfx(i,j)*s
grnqfx(i,j)=fire_atm_feedback*grnqfx(i,j)*s
! we do not have canopy fluxes yet...
canhfx(i,j)=0
canqfx(i,j)=0
enddo
enddo
call print_2d_stats(its,ite,jts,jte,ims,ime,jms,jme,grnhfx,'fire_driver:grnhfx')
call print_2d_stats(its,ite,jts,jte,ims,ime,jms,jme,grnqfx,'fire_driver:grnqfx')
endif
endif ! ifun=6
enddo ! tiles
!$OMP END PARALLEL DO
if (ifun.eq.3)then
ignitions_done=ignitions_done_tile(1) ! all should be the same
do i=1,ignitions_done
!$OMP CRITICAL(SFIRE_DRIVER_CRIT)
write(msg,'(2(a,i4,1x))')'sfire_driver_phys: checking ignition ',i,' of ',ignitions_done
!$OMP END CRITICAL(SFIRE_DRIVER_CRIT)
call message(msg)
ignited_patch(i)=0
do ij=1,num_tiles
ignited_patch(i)=ignited_patch(i)+ignited_tile(i,ij)
enddo
#ifdef DM_PARALLEL
call message('sfire_driver_phys: checking ignitions, collect counts')
call wrf_dm_maxval_integer(ignited_patch(i),idex,jdex)
call message('sfire_driver_phys: collected')
#endif
if(ignited_patch(i).eq.0)then
call crash('sfire_driver_phys: Ignition failed, no nodes ignited. Bad coordinates?')
endif
enddo
endif
#ifdef DEBUG_OUT
if(ifun.eq.1)then
if(pid.ne.0)then
call write_array_m(ips,ipe,jps,jpe,ims,ime,jms,jme,zs,'zs',pid)
call write_array_m(ifps,ifpe,jfps,jfpe,ifms,ifme,jfms,jfme,fp%zsf,'zsf',pid)
endif
#endif
elseif(ifun.eq.3)then
#ifdef DEBUG_OUT
if(pid.gt.0)then
call write_array_m3(ips,ipe+1,kds,kds+1,jps,jpe+1,ims,ime,kms,kme,jms,jme,u,'u',pid)
call write_array_m3(ips,ipe+1,kds,kds+1,jps,jpe+1,ims,ime,kms,kme,jms,jme,v,'v',pid)
call write_array_m(ifps,ifpe,jfps,jfpe,ifms,ifme,jfms,jfme,fp%vx,'uf',pid)
call write_array_m(ifps,ifpe,jfps,jfpe,ifms,ifme,jfms,jfme,fp%vy,'vf',pid)
endif
#endif
elseif(ifun.eq.5)then
#ifdef DEBUG_OUT
if(pid.gt.0)then
call write_array_m(ifps,ifpe,jfps,jfpe,ifms,ifme,jfms,jfme,lfn,'lfn',pid)
call write_array_m(ifps,ifpe,jfps,jfpe,ifms,ifme,jfms,jfme,tign,'tign',pid)
endif
#endif
elseif(ifun.eq.6)then
#ifdef DEBUG_OUT
if(pid.gt.0)then
call write_array_m(ips,ipe,jps,jpe,ims,ime,jms,jme,grnhfx,'grnhfx',pid)
call write_array_m(ips,ipe,jps,jpe,ims,ime,jms,jme,grnqfx,'grnqfx',pid)
call write_array_m(ifps,ifpe,jfps,jfpe,ifms,ifme,jfms,jfme,fuel_frac,'fuel_frac',pid)
call write_array_m(ifps,ifpe,jfps,jfpe,ifms,ifme,jfms,jfme,fgrnhfx,'fgrnhfx',pid)
call write_array_m(ifps,ifpe,jfps,jfpe,ifms,ifme,jfms,jfme,fgrnqfx,'fgrnqfx',pid)
endif
#endif
endif
end subroutine sfire_driver_phys
!
!*******************
!
subroutine fire_ignition_convert (config_flags,fire_max_ignitions,fire_ignition_longlat, &
fire_ignition_start_x,fire_ignition_start_y,fire_ignition_end_x,fire_ignition_end_y, &
fire_ignition_radius,fire_ignition_start_time,fire_ignition_end_time,fire_num_ignitions, &
unit_fxlong,unit_fxlat)
use module_model_constants, only: reradius,pi2
USE module_configure
implicit none
! create ignition arrays from scalar flags
!*** arguments
TYPE (grid_config_rec_type) , INTENT(IN) :: config_flags
integer, intent(in)::fire_max_ignitions
real, dimension(fire_max_ignitions), intent(out):: &
fire_ignition_start_x,fire_ignition_start_y,fire_ignition_end_x,fire_ignition_end_y, &
fire_ignition_radius,fire_ignition_start_time,fire_ignition_end_time
integer, intent(out)::fire_num_ignitions,fire_ignition_longlat
real, intent(out)::unit_fxlong,unit_fxlat
!*** local
integer::i
logical:: real,ideal
real::lat_ctr,lon_ctr
!*** executable
! this is only until I figure out how to input arrays through the namelist...
if(fire_max_ignitions.lt.5)call crash('fire_max_ignitions too small')
! figure out which kind of coordinates from the first given
ideal=config_flags%fire_ignition_start_x1 .ne.0. .or. config_flags%fire_ignition_start_y1 .ne. 0.
real=config_flags%fire_ignition_start_lon1 .ne. 0. .or. config_flags%fire_ignition_start_lat1 .ne. 0.
if(ideal)call message('Using ideal ignition coordinates, m from the lower left domain corner')
if(real)call message('Using real ignition coordinates, longitude and latitude')
if(ideal.and.real)call crash('Only one of the ideal or real coordinates may be given')
fire_ignition_longlat=0 ! default, if no ignition
if(ideal)then
! use values from _x and _y variables
fire_ignition_longlat=0
fire_ignition_start_x(1)=config_flags%fire_ignition_start_x1
fire_ignition_start_y(1)=config_flags%fire_ignition_start_y1
fire_ignition_end_x(1)=config_flags%fire_ignition_end_x1
fire_ignition_end_y(1)=config_flags%fire_ignition_end_y1
fire_ignition_start_x(2)=config_flags%fire_ignition_start_x2
fire_ignition_start_y(2)=config_flags%fire_ignition_start_y2
fire_ignition_end_x(2)=config_flags%fire_ignition_end_x2
fire_ignition_end_y(2)=config_flags%fire_ignition_end_y2
fire_ignition_start_x(3)=config_flags%fire_ignition_start_x3
fire_ignition_start_y(3)=config_flags%fire_ignition_start_y3
fire_ignition_end_x(3)=config_flags%fire_ignition_end_x3
fire_ignition_end_y(3)=config_flags%fire_ignition_end_y3
fire_ignition_start_x(4)=config_flags%fire_ignition_start_x4
fire_ignition_start_y(4)=config_flags%fire_ignition_start_y4
fire_ignition_end_x(4)=config_flags%fire_ignition_end_x4
fire_ignition_end_y(4)=config_flags%fire_ignition_end_y4
fire_ignition_start_x(5)=config_flags%fire_ignition_start_x5
fire_ignition_start_y(5)=config_flags%fire_ignition_start_y5
fire_ignition_end_x(5)=config_flags%fire_ignition_end_x5
fire_ignition_end_y(5)=config_flags%fire_ignition_end_y5
endif
if(real)then
! use values from _long and _lat
fire_ignition_longlat=1
fire_ignition_start_x(1)=config_flags%fire_ignition_start_lon1
fire_ignition_start_y(1)=config_flags%fire_ignition_start_lat1
fire_ignition_end_x(1)=config_flags%fire_ignition_end_lon1
fire_ignition_end_y(1)=config_flags%fire_ignition_end_lat1
fire_ignition_start_x(2)=config_flags%fire_ignition_start_lon2
fire_ignition_start_y(2)=config_flags%fire_ignition_start_lat2
fire_ignition_end_x(2)=config_flags%fire_ignition_end_lon2
fire_ignition_end_y(2)=config_flags%fire_ignition_end_lat2
fire_ignition_start_x(3)=config_flags%fire_ignition_start_lon3
fire_ignition_start_y(3)=config_flags%fire_ignition_start_lat3
fire_ignition_end_x(3)=config_flags%fire_ignition_end_lon3
fire_ignition_end_y(3)=config_flags%fire_ignition_end_lat3
fire_ignition_start_x(4)=config_flags%fire_ignition_start_lon4
fire_ignition_start_y(4)=config_flags%fire_ignition_start_lat4
fire_ignition_end_x(4)=config_flags%fire_ignition_end_lon4
fire_ignition_end_y(4)=config_flags%fire_ignition_end_lat4
fire_ignition_start_x(5)=config_flags%fire_ignition_start_lon5
fire_ignition_start_y(5)=config_flags%fire_ignition_start_lat5
fire_ignition_end_x(5)=config_flags%fire_ignition_end_lon5
fire_ignition_end_y(5)=config_flags%fire_ignition_end_lat5
endif
! common to both cases
fire_ignition_radius(1)=config_flags%fire_ignition_radius1
fire_ignition_start_time(1)=config_flags%fire_ignition_start_time1
fire_ignition_end_time(1)=config_flags%fire_ignition_end_time1
fire_ignition_radius(2)=config_flags%fire_ignition_radius2
fire_ignition_start_time(2)=config_flags%fire_ignition_start_time2
fire_ignition_end_time(2)=config_flags%fire_ignition_end_time2
fire_ignition_radius(3)=config_flags%fire_ignition_radius3
fire_ignition_start_time(3)=config_flags%fire_ignition_start_time3
fire_ignition_end_time(3)=config_flags%fire_ignition_end_time3
fire_ignition_radius(4)=config_flags%fire_ignition_radius4
fire_ignition_start_time(4)=config_flags%fire_ignition_start_time4
fire_ignition_end_time(4)=config_flags%fire_ignition_end_time4
fire_ignition_radius(5)=config_flags%fire_ignition_radius5
fire_ignition_start_time(5)=config_flags%fire_ignition_start_time5
fire_ignition_end_time(5)=config_flags%fire_ignition_end_time5
!
fire_num_ignitions=0
do i=1,min(5,config_flags%fire_num_ignitions)
! count the ignitions
if(fire_ignition_radius(i).gt.0.)fire_num_ignitions=i
! expand ignition data given as zero
if(fire_ignition_end_x(i).eq.0.)fire_ignition_end_x(i)=fire_ignition_start_x(i)
if(fire_ignition_end_y(i).eq.0.)fire_ignition_end_y(i)=fire_ignition_start_y(i)
if(fire_ignition_end_time(i).eq.0.)fire_ignition_end_time(i)=fire_ignition_start_time(i)
enddo
if(fire_ignition_longlat .eq. 0)then
! ideal
! ignition is in m
unit_fxlong=1.
unit_fxlat=1.
! will set fire mesh coordinates to uniform mesh below
else
! real
lat_ctr=config_flags%cen_lat
lon_ctr=config_flags%cen_lon
! 1 degree in m (approximate OK)
unit_fxlat=pi2/(360.*reradius) ! earth circumference in m / 360 degrees
unit_fxlong=cos(lat_ctr*pi2/360.)*unit_fxlat ! latitude
endif
end subroutine fire_ignition_convert
!
!*****************************
!
!module_fr_sfire_driver%%interpolate_atm2fire
subroutine interpolate_atm2fire(id, & ! for debug output, <= 0 no output
ids,ide, kds,kde, jds,jde, & ! atm grid dimensions
ims,ime, kms,kme, jms,jme, &
ips,ipe,jps,jpe, &
its,ite,jts,jte, &
ifds, ifde, jfds, jfde, & ! fire grid dimensions
ifms, ifme, jfms, jfme, &
ifts,ifte,jfts,jfte, &
ir,jr, & ! atm/fire grid ratio
u_frame, v_frame, & ! velocity frame correction
u,v, & ! atm grid arrays in
uf,vf) ! fire grid arrays out
implicit none
!*** purpose: interpolate winds and height
!*** arguments
integer, intent(in)::id, &
ids,ide, kds,kde, jds,jde, & ! atm domain bounds
ims,ime, kms,kme, jms,jme, & ! atm memory bounds
ips,ipe,jps,jpe, &
its,ite,jts,jte, & ! atm tile bounds
ifds, ifde, jfds, jfde, & ! fire domain bounds
ifms, ifme, jfms, jfme, & ! fire memory bounds
ifts,ifte,jfts,jfte, & ! fire tile bounds
ir,jr ! atm/fire grid refinement ratio
real, intent(in):: u_frame, v_frame ! velocity frame correction
real,intent(in),dimension(ims:ime,kms:kme,jms:jme)::&
u,v ! atm wind velocity, staggered
real,intent(out), dimension(ifms:ifme,jfms:jfme)::&
uf,vf ! wind velocity fire grid nodes
!*** local
#define TDIMS its-1,ite+2,jts-1,jte+2
real, dimension(its-1:ite+2,jts-1:jte+2):: ua,va ! atm winds, averaged over height
integer:: i,j,k,ifts1,ifte1,jfts1,jfte1
!*** executable
k=kds ! the ground
do j = jts-1,jte+2
do i = its-1,ite+2
! average 1st 2 layers, correct const shift
ua(i,j)=0.5*( u(i,k,j) + u(i,k+1,j)) + u_frame
va(i,j)=0.5*( v(i,k,j) + v(i,k+1,j)) + v_frame
enddo
enddo
! extend the winds by one beyond the domain boundary
call continue_at_boundary(1,0,0., & ! do x direction or y direction
TDIMS, & ! memory dims
ids,ide+1,jds,jde+1, & ! domain dims - winds defined up to +1
ips,ipe+1,jps,jpe+1, & ! patch dims - winds defined up to +1
its,ite+1,jts,jte+1, & ! tile dims
va) ! array
call continue_at_boundary(0,1,0., & ! do x direction or y direction
TDIMS, & ! memory dims
ids,ide+1,jds,jde+1, & ! domain dims - winds defined up to +1
ips,ipe+1,jps,jpe+1, & ! patch dims - winds defined up to +1
its,ite+1,jts,jte+1, & ! tile dims
ua) ! array
!if (id.gt.0) then
! call write_array_m(TDIMS,TDIMS,ua,'ua',id)
! call write_array_m(TDIMS,TDIMS,va,'va',id)
!endif
call print_2d_stats_vec(its,ite+1,jts,jte+1,TDIMS,ua,va, &
'driver: atm wind (m/s)')
! ---------------
! | F | F | F | F | Example of atmospheric and fire grid with
! |-------|-------| ir=jr=4.
! | F | F | F | F | Winds are given at the midpoints of the sides of the atmosphere grid,
! ua------z-------| interpolated to midpoints of the cells of the fine fire grid F.
! | F | F | F | F | This is (1,1) cell of atmosphere grid, and [*] is the (1,1) cell of the fire grid.
! |---------------| ua(1,1) <--> uf(0.5,2.5)
! | * | F | F | F | va(1,1) <--> vf(2.5,0.5)
! -------va------ za(1,1) <--> zf(2.5,2.5)
!
! ^ x2
! | --------va(1,2)---------
! | | | | Example of atmospheric and fire grid with
! | | | | ir=jr=1.
! | | za,zf | Winds are given at the midpoints of the sides of the atmosphere grid,
! | ua(1,1)----uf,vf-----ua(2,1) interpolated to midpoints of the cells of the (the same) fire grid
! | | (1,1) | ua(1,1) <--> uf(0.5,1)
! | | | | va(1,1) <--> vf(1,0.5)
! | | | | za(1,1) <--> zf(1,1)
! | --------va(1,1)---------
! |--------------------> x1
!
! Meshes are aligned by the lower left cell of the domain. Then in the above figure
! u = node with the ua component of the wind at (ids,jds), midpoint of side
! v = node with the va component of the wind at (ids,jds), midpoint of side
! * = fire grid node at (ifds,jfds)
! z = node with height, midpoint of cell
!
! ua(ids,jds)=uf(ifds-0.5,jfds+jr*0.5-0.5) = uf(ifds-0.5,jfds+(jr-1)*0.5)
! va(ids,jds)=vf(ifds+ir*0.5-0.5,jfds-0.5) = vf(ifds+(ir-1)*0.5,jfds-0.5)
! za(ids,jds)=zf(ifds+ir*0.5-0.5,jfds+jr*0.5-0.5) = zf(ifds+(ir-1)*0.5,jfds+(jr-1)*0.5)
ifts1=snode(ifts,ifds,-1) ! go 1 beyond domain boundary but not between tiles
ifte1=snode(ifte,ifde,+1)
jfts1=snode(jfts,jfds,-1)
jfte1=snode(jfte,jfde,+1)