-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmodule_sf_bep_bem-Madrid.F
5758 lines (4731 loc) · 213 KB
/
module_sf_bep_bem-Madrid.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
MODULE module_sf_bep_bem
#if defined(mpas)
use mpas_atmphys_utilities, only: physics_error_fatal
#define FATAL_ERROR(M) call physics_error_fatal( M )
#else
use module_wrf_error
#define FATAL_ERROR(M) call wrf_error_fatal( M )
!USE module_model_constants
#endif
USE module_sf_urban
USE module_sf_bem
USE module_bep_bem_helper, ONLY: nurbm
! SGClarke 09/11/2008
! Access urban_param.tbl values through calling urban_param_init in module_physics_init
! for CASE (BEPSCHEME) select sf_urban_physics
!
! -----------------------------------------------------------------------
! Dimension for the array used in the BEP module
! -----------------------------------------------------------------------
integer nurbmax ! Maximum number of urban classes
parameter (nurbmax=11)
integer ndm ! Maximum number of street directions
parameter (ndm=2)
integer nz_um ! Maximum number of vertical levels in the urban grid
parameter(nz_um=18)
integer ng_u ! Number of grid levels in the ground
parameter (ng_u=10)
integer ngr_u ! Number of grid levels in green roof
parameter (ngr_u=10)
integer nwr_u ! Number of grid levels in the walls or roofs
parameter (nwr_u=10)
integer nf_u !Number of grid levels in the floors (BEM)
parameter (nf_u=10)
integer ngb_u !Number of grid levels in the ground below building (BEM)
parameter (ngb_u=10)
real dz_u ! Urban grid resolution
parameter (dz_u=5.)
integer nbui_max !maximum number of types of buildings in an urban class
parameter (nbui_max=15) !must be less or equal than nz_um
real h_water
parameter(h_water=0.0009722) !mm of irrigation per hour
!---------------------------------------------------------------------------------
!Parameters of the windows. The glasses of windows are considered without films -
!Read the paper of J.Karlsson and A.Roos(2000):"modelling the angular behaviour -
!of the total solar energy transmittance of windows".Solar Energy Vol.69,No.4, -
!pp. 321-329, for more details. -
!---------------------------------------------------------------------------------
integer p_num !number of panes in the windows (1,2 or 3)
parameter (p_num=2)
integer q_num !category number for the windows (q_num= 4, standard glasses)
parameter(q_num=4) !Possible values 1,2,...,10
! The change of ng_u, nwr_u should be done in agreement with the block data
! in the routine "surf_temp"
! -----------------------------------------------------------------------
! Constant used in the BEP module
! -----------------------------------------------------------------------
real vk ! von Karman constant
real g_u ! Gravity acceleration
real pi !
real r ! Perfect gas constant
real cp_u ! Specific heat at constant pressure
real rcp_u !
real sigma !
real p0 ! Reference pressure at the sea level
real latent ! Latent heat of vaporization [J/kg] (used in BEM)
real dgmax ! Maximum ground water holding capacity (mm)
real drmax ! Maximum ground roof holding capacity (mm)
parameter(vk=0.40,g_u=9.81,pi=3.141592653,r=287.,cp_u=1004.)
parameter(rcp_u=r/cp_u,sigma=5.67e-08,p0=1.e+5,latent=2.45e+06,dgmax=1.,drmax=1.)
! -----------------------------------------------------------------------
CONTAINS
subroutine BEP_BEM(FRC_URB2D,UTYPE_URB2D,itimestep,dz8w,dt,u_phy,v_phy, &
th_phy,rho,p_phy,swdown,glw, &
gmt,julday,xlong,xlat, &
declin_urb,cosz_urb2d,omg_urb2d, &
num_urban_ndm, urban_map_zrd, urban_map_zwd, urban_map_gd, &
urban_map_zd, urban_map_zdf, urban_map_bd, urban_map_wd, &
urban_map_gbd, urban_map_fbd, &
urban_map_zgrd, num_urban_hi, &
trb_urb4d,tw1_urb4d,tw2_urb4d,tgb_urb4d, &
tlev_urb3d,qlev_urb3d,tw1lev_urb3d,tw2lev_urb3d, &
tglev_urb3d,tflev_urb3d,sf_ac_urb3d,lf_ac_urb3d, &
cm_ac_urb3d, &
sfvent_urb3d,lfvent_urb3d, &
sfwin1_urb3d,sfwin2_urb3d, &
sfw1_urb3d,sfw2_urb3d,sfr_urb3d,sfg_urb3d, &
ep_pv_urb3d,t_pv_urb3d, &
trv_urb4d,qr_urb4d,qgr_urb3d,tgr_urb3d, &
drain_urb4d,draingr_urb3d, &
sfrv_urb3d,lfrv_urb3d, &
dgr_urb3d,dg_urb3d, &
lfr_urb3d,lfg_urb3d,rainbl,swddir,swddif, &
lp_urb2d,hi_urb2d,lb_urb2d,hgt_urb2d, &
a_u,a_v,a_t,a_e,b_u,b_v, &
b_t,b_e,b_q,dlg,dl_u,sf,vl, &
rl_up,rs_abs,emiss,grdflx_urb,qv_phy, &
ids,ide, jds,jde, kds,kde, &
ims,ime, jms,jme, kms,kme, &
its,ite, jts,jte, kts,kte)
implicit none
!------------------------------------------------------------------------
! Input
!------------------------------------------------------------------------
INTEGER :: ids,ide, jds,jde, kds,kde, &
ims,ime, jms,jme, kms,kme, &
its,ite, jts,jte, kts,kte, &
itimestep
REAL, DIMENSION( ims:ime, kms:kme, jms:jme ):: DZ8W
REAL, DIMENSION( ims:ime, kms:kme, jms:jme ):: P_PHY
REAL, DIMENSION( ims:ime, kms:kme, jms:jme ):: RHO
REAL, DIMENSION( ims:ime, kms:kme, jms:jme ):: TH_PHY
REAL, DIMENSION( ims:ime, kms:kme, jms:jme ):: T_PHY
REAL, DIMENSION( ims:ime, kms:kme, jms:jme ):: U_PHY
REAL, DIMENSION( ims:ime, kms:kme, jms:jme ):: V_PHY
REAL, DIMENSION( ims:ime, kms:kme, jms:jme ):: U
REAL, DIMENSION( ims:ime, kms:kme, jms:jme ):: V
REAL, DIMENSION( ims:ime , jms:jme ) :: GLW
REAL, DIMENSION( ims:ime , jms:jme ) :: swdown
REAL, DIMENSION( ims:ime , jms:jme ) :: swddir
REAL, DIMENSION( ims:ime , jms:jme ) :: swddif
REAL, DIMENSION( ims:ime, jms:jme ) :: UST
INTEGER, DIMENSION( ims:ime , jms:jme ), INTENT(IN ):: UTYPE_URB2D
REAL, DIMENSION( ims:ime , jms:jme ), INTENT(IN ):: FRC_URB2D
REAL, INTENT(IN ) :: GMT
INTEGER, INTENT(IN ) :: JULDAY
REAL, DIMENSION( ims:ime, jms:jme ), &
INTENT(IN ) :: XLAT, XLONG
REAL, INTENT(IN) :: DECLIN_URB
REAL, DIMENSION( ims:ime, jms:jme ), INTENT(IN) :: COSZ_URB2D
REAL, DIMENSION( ims:ime, jms:jme ), INTENT(IN) :: OMG_URB2D
INTEGER, INTENT(IN ) :: urban_map_zrd
INTEGER, INTENT(IN ) :: urban_map_zwd
INTEGER, INTENT(IN ) :: urban_map_gd
INTEGER, INTENT(IN ) :: urban_map_zd
INTEGER, INTENT(IN ) :: urban_map_zdf
INTEGER, INTENT(IN ) :: urban_map_bd
INTEGER, INTENT(IN ) :: urban_map_wd
INTEGER, INTENT(IN ) :: urban_map_gbd
INTEGER, INTENT(IN ) :: urban_map_fbd
INTEGER, INTENT(IN ) :: num_urban_ndm
INTEGER, INTENT(IN) :: num_urban_hi
INTEGER , INTENT(IN) :: urban_map_zgrd
REAL, DIMENSION( ims:ime, 1:urban_map_zrd, jms:jme ), INTENT(INOUT) :: trb_urb4d
REAL, DIMENSION( ims:ime, 1:urban_map_zwd, jms:jme ), INTENT(INOUT) :: tw1_urb4d
REAL, DIMENSION( ims:ime, 1:urban_map_zwd, jms:jme ), INTENT(INOUT) :: tw2_urb4d
REAL, DIMENSION( ims:ime, 1:urban_map_gd , jms:jme ), INTENT(INOUT) :: tgb_urb4d
REAL, DIMENSION( ims:ime, 1:urban_map_zgrd, jms:jme ), INTENT(INOUT) :: trv_urb4d
REAL, DIMENSION( ims:ime, 1:urban_map_zgrd, jms:jme ), INTENT(INOUT) :: qr_urb4d
REAL, DIMENSION( ims:ime, jms:jme ), INTENT(INOUT) :: qgr_urb3d
REAL, DIMENSION( ims:ime, jms:jme ), INTENT(INOUT) :: tgr_urb3d
REAL, DIMENSION( ims:ime, 1:urban_map_zdf, jms:jme ), INTENT(INOUT) :: drain_urb4d
REAL, DIMENSION( ims:ime, jms:jme ), INTENT(IN) :: rainbl
REAL, DIMENSION( ims:ime, jms:jme ), INTENT(INOUT) :: draingr_urb3d
!New variables used for BEM
REAL, DIMENSION( ims:ime, kms:kme, jms:jme ):: qv_phy
REAL, DIMENSION( ims:ime, 1:urban_map_bd, jms:jme ), INTENT(INOUT) :: tlev_urb3d
REAL, DIMENSION( ims:ime, 1:urban_map_bd , jms:jme ), INTENT(INOUT) :: qlev_urb3d
REAL, DIMENSION( ims:ime, 1:urban_map_wd , jms:jme ), INTENT(INOUT) :: tw1lev_urb3d
REAL, DIMENSION( ims:ime, 1:urban_map_wd , jms:jme ), INTENT(INOUT) :: tw2lev_urb3d
REAL, DIMENSION( ims:ime, 1:urban_map_gbd, jms:jme ), INTENT(INOUT) :: tglev_urb3d
REAL, DIMENSION( ims:ime, 1:urban_map_fbd, jms:jme ), INTENT(INOUT) :: tflev_urb3d
REAL, DIMENSION( ims:ime, jms:jme ), INTENT(INOUT) :: lf_ac_urb3d
REAL, DIMENSION( ims:ime, jms:jme ), INTENT(INOUT) :: sf_ac_urb3d
REAL, DIMENSION( ims:ime, jms:jme ), INTENT(INOUT) :: cm_ac_urb3d
REAL, DIMENSION( ims:ime, jms:jme ), INTENT(INOUT) :: ep_pv_urb3d
REAL, DIMENSION( ims:ime, 1:urban_map_zdf, jms:jme ), INTENT(INOUT) :: t_pv_urb3d
REAL, DIMENSION( ims:ime, jms:jme ), INTENT(INOUT) :: sfvent_urb3d
REAL, DIMENSION( ims:ime, jms:jme ), INTENT(INOUT) :: lfvent_urb3d
REAL, DIMENSION( ims:ime, 1:urban_map_wd , jms:jme ), INTENT(INOUT) :: sfwin1_urb3d
REAL, DIMENSION( ims:ime, 1:urban_map_wd , jms:jme ), INTENT(INOUT) :: sfwin2_urb3d
!End variables
REAL, DIMENSION( ims:ime, 1:urban_map_zd , jms:jme ), INTENT(INOUT) :: sfw1_urb3d
REAL, DIMENSION( ims:ime, 1:urban_map_zd , jms:jme ), INTENT(INOUT) :: sfw2_urb3d
REAL, DIMENSION( ims:ime, 1:urban_map_zdf, jms:jme ), INTENT(INOUT) :: sfr_urb3d
REAL, DIMENSION( ims:ime, 1:num_urban_ndm, jms:jme ), INTENT(INOUT) :: sfg_urb3d
REAL, DIMENSION( ims:ime, 1:urban_map_zdf, jms:jme ), INTENT(INOUT) :: sfrv_urb3d
REAL, DIMENSION( ims:ime, 1:urban_map_zdf, jms:jme ), INTENT(INOUT) :: lfrv_urb3d
REAL, OPTIONAL, DIMENSION( ims:ime, 1:urban_map_zdf, jms:jme ),INTENT(INOUT) :: dgr_urb3d !GRZ
REAL, OPTIONAL, DIMENSION( ims:ime, 1:num_urban_ndm, jms:jme ),INTENT(INOUT) :: dg_urb3d !GRZ
REAL, OPTIONAL, DIMENSION( ims:ime, 1:urban_map_zdf, jms:jme ),INTENT(INOUT) :: lfr_urb3d !GRZ
REAL, OPTIONAL, DIMENSION( ims:ime, 1:num_urban_ndm, jms:jme ),INTENT(INOUT) :: lfg_urb3d !G
REAL, DIMENSION( ims:ime, 1:num_urban_hi, jms:jme ), INTENT(IN) :: hi_urb2d
REAL, DIMENSION( ims:ime,jms:jme), INTENT(IN) :: lp_urb2d
REAL, DIMENSION( ims:ime,jms:jme), INTENT(IN) :: lb_urb2d
REAL, DIMENSION( ims:ime,jms:jme), INTENT(IN) :: hgt_urb2d
real z(ims:ime,kms:kme,jms:jme) ! Vertical coordinates
REAL, INTENT(IN ):: DT ! Time step
!------------------------------------------------------------------------
! Output
!------------------------------------------------------------------------
!
! Implicit and explicit components of the source and sink terms at each levels,
! the fluxes can be computed as follow: FX = A*X + B example: t_fluxes = a_t * pt + b_t
real a_u(ims:ime,kms:kme,jms:jme) ! Implicit component for the momemtum in X-direction (center)
real a_v(ims:ime,kms:kme,jms:jme) ! Implicit component for the momemtum in Y-direction (center)
real a_t(ims:ime,kms:kme,jms:jme) ! Implicit component for the temperature
real a_e(ims:ime,kms:kme,jms:jme) ! Implicit component for the TKE
real b_u(ims:ime,kms:kme,jms:jme) ! Explicit component for the momemtum in X-direction (center)
real b_v(ims:ime,kms:kme,jms:jme) ! Explicit component for the momemtum in Y-direction (center)
real b_t(ims:ime,kms:kme,jms:jme) ! Explicit component for the temperature
real b_e(ims:ime,kms:kme,jms:jme) ! Explicit component for the TKE
real b_q(ims:ime,kms:kme,jms:jme) ! Explicit component for the Humidity
real dlg(ims:ime,kms:kme,jms:jme) ! Height above ground (L_ground in formula (24) of the BLM paper).
real dl_u(ims:ime,kms:kme,jms:jme) ! Length scale (lb in formula (22) ofthe BLM paper).
! urban surface and volumes
real sf(ims:ime,kms:kme,jms:jme) ! surface of the urban grid cells
real vl(ims:ime,kms:kme,jms:jme) ! volume of the urban grid cells
! urban fluxes
real rl_up(its:ite,jts:jte) ! upward long wave radiation
real rs_abs(its:ite,jts:jte) ! absorbed short wave radiation
real emiss(its:ite,jts:jte) ! emissivity averaged for urban surfaces
real grdflx_urb(its:ite,jts:jte) ! ground heat flux for urban areas
!------------------------------------------------------------------------
! Local
!------------------------------------------------------------------------
real hi_urb(its:ite,1:nz_um,jts:jte) ! Height histograms of buildings
real hi_urb1D(nz_um) ! Height histograms of buildings
real ss_urb(nz_um,nurbmax) ! Probability that a building has an height equal to z
real pb_urb(nz_um) ! Probability that a building has an height greater or equal to z
real hb_u(nz_um) ! Bulding's heights
integer nz_urb(nurbmax) ! Number of layer in the urban grid
integer nzurban(nurbmax)
! Building parameters
real alag_u(nurbmax) ! Ground thermal diffusivity [m^2 s^-1]
real alaw_u(nurbmax) ! Wall thermal diffusivity [m^2 s^-1]
real alar_u(nurbmax) ! Roof thermal diffusivity [m^2 s^-1]
real csg_u(nurbmax) ! Specific heat of the ground material [J m^3 K^-1]
real csw_u(nurbmax) ! Specific heat of the wall material [J m^3 K^-1]
real csr_u(nurbmax) ! Specific heat of the roof material [J m^3 K^-1]
real twini_u(nurbmax) ! Initial temperature inside the building's wall [K]
real trini_u(nurbmax) ! Initial temperature inside the building's roof [K]
real tgini_u(nurbmax) ! Initial road temperature
!
! Building materials
!
real csg(ng_u) ! Specific heat of the ground material [J m^3 K^-1]
real csw(nwr_u) ! Specific heat of the wall material for the current urban class [J m^3 K^-1]
real csr(nwr_u) ! Specific heat of the roof material for the current urban class [J m^3 K^-1]
real csgb(ngb_u) ! Specific heat of the ground material below the buildings at each ground levels[J m^3 K^-1]
real csf(nf_u) ! Specific heat of the floors materials in the buildings at each levels[J m^3 K^-1]
real alar(nwr_u+1) ! Roof thermal diffusivity for the current urban class [W/m K]
real alaw(nwr_u+1) ! Walls thermal diffusivity for the current urban class [W/m K]
real alag(ng_u) ! Ground thermal diffusivity for the current urban class [m^2 s^-1]
real alagb(ngb_u+1) ! Ground thermal diffusivity below the building at each wall layer [W/m K]
real alaf(nf_u+1) ! Floor thermal diffusivity at each wall layers [W/m K]
real dzr(nwr_u) ! Layer sizes in the roofs [m]
real dzf(nf_u) ! Layer sizes in the floors[m]
real dzw(nwr_u) ! Layer sizes in the walls [m]
real dzgb(ngb_u) ! Layer sizes in the ground below the buildings [m]
!
!New street and radiation parameters
real bs(ndm) ! Building width for the current urban class
real ws(ndm) ! Street widths of the current urban class
real strd(ndm) ! Street lengths for the current urban class
real drst(ndm) ! street directions for the current urban class
real ss(nz_um) ! Probability to have a building with height h
real pb(nz_um) ! Probability to have a building with an height equal
real HFGR_D(nz_um)
!New roughness and buildings parameters
!
real z0(ndm,nz_um) ! Roughness lengths "profiles"
real bs_urb(ndm,nurbmax) ! Building width
real ws_urb(ndm,nurbmax) ! Street width
!
! for twini_u, and trini_u the initial value at the deepest level is kept constant during the simulation
!
! Radiation paramters
real albg_u(nurbmax) ! Albedo of the ground
real albw_u(nurbmax) ! Albedo of the wall
real albr_u(nurbmax) ! Albedo of the roof
real albwin_u(nurbmax) ! Albedo of the windows
real emwind_u(nurbmax) ! Emissivity of windows
real emg_u(nurbmax) ! Emissivity of ground
real emw_u(nurbmax) ! Emissivity of wall
real emr_u(nurbmax) ! Emissivity of roof
real gr_frac_roof_u(nurbmax)
real pv_frac_roof_u(nurbmax)
integer gr_flag_u
integer gr_type_u
! fww_u,fwg_u,fgw_u,fsw_u,fsg_u are the view factors used to compute the long wave
! and the short wave radiation.
real fww_u(nz_um,nz_um,ndm,nurbmax) ! from wall to wall
real fwg_u(nz_um,ndm,nurbmax) ! from wall to ground
real fgw_u(nz_um,ndm,nurbmax) ! from ground to wall
real fsw_u(nz_um,ndm,nurbmax) ! from sky to wall
real fws_u(nz_um,ndm,nurbmax) ! from sky to wall
real fsg_u(ndm,nurbmax) ! from sky to ground
! Roughness parameters
real z0g_u(nurbmax) ! The ground's roughness length
real z0r_u(nurbmax) ! The roof's roughness length
! Street parameters
integer nd_u(nurbmax) ! Number of street direction for each urban class
real strd_u(ndm,nurbmax) ! Street length (fix to greater value to the horizontal length of the cells)
real drst_u(ndm,nurbmax) ! Street direction
real ws_u(ndm,nurbmax) ! Street width
real bs_u(ndm,nurbmax) ! Building width
real h_b(nz_um,nurbmax) ! Bulding's heights
real d_b(nz_um,nurbmax) ! Probability that a building has an height h_b
real ss_u(nz_um,nurbmax)! Probability that a building has an height equal to z
real pb_u(nz_um,nurbmax)! Probability that a building has an height greater or equal to z
! Grid parameters
integer nz_u(nurbmax) ! Number of layer in the urban grid
real z_u(nz_um) ! Height of the urban grid levels
!FS
real cop_u(nurbmax)
real bldac_frc_u(nurbmax)
real cooled_frc_u(nurbmax)
real pwin_u(nurbmax)
real beta_u(nurbmax)
integer sw_cond_u(nurbmax)
real time_on_u(nurbmax)
real time_off_u(nurbmax)
real targtemp_u(nurbmax)
real gaptemp_u(nurbmax)
real targhum_u(nurbmax)
real gaphum_u(nurbmax)
real perflo_u(nurbmax)
real hsesf_u(nurbmax)
real hsequip(24)
real irho(24)
! 1D array used for the input and output of the routine "urban"
real z1D(kms:kme) ! vertical coordinates
real ua1D(kms:kme) ! wind speed in the x directions
real va1D(kms:kme) ! wind speed in the y directions
real pt1D(kms:kme) ! potential temperature
real da1D(kms:kme) ! air density
real pr1D(kms:kme) ! air pressure
real pt01D(kms:kme) ! reference potential temperature
real zr1D ! zenith angle
real deltar1D ! declination of the sun
real ah1D ! hour angle (it should come from the radiation routine)
real rs1D ! solar radiation
real rld1D ! downward flux of the longwave radiation
real swddir1D
real swddif1D ! short wave diffuse solar radiation _gl
real tw1D(2*ndm,nz_um,nwr_u,nbui_max) ! temperature in each layer of the wall
real tg1D(ndm,ng_u) ! temperature in each layer of the ground
real tr1D(ndm,nz_um,nwr_u) ! temperature in each layer of the roof
real trv1D(ndm,nz_um,ngr_u) ! temperature in each layer of the GREEN roof
real qr1D(ndm,nz_um,ngr_u) ! humidity in each layer of the GREEN roof
!
!New variable for BEM
!
real tlev1D(nz_um,nbui_max) ! temperature in each floor and in each different type of building
real qlev1D(nz_um,nbui_max) ! specific humidity in each floor and in each different type of building
real twlev1D(2*ndm,nz_um,nbui_max) ! temperature in each window in each floor in each different type of building
real tglev1D(ndm,ngb_u,nbui_max) ! temperature in each layer of the ground below of a type of building
real tflev1D(ndm,nf_u,nz_um-1,nbui_max)! temperature in each layer of the floors in each building
real lflev1D(nz_um,nz_um) ! latent heat flux due to the air conditioning systems
real sflev1D(nz_um,nz_um) ! sensible heat flux due to the air conditioning systems
real lfvlev1D(nz_um,nz_um) ! latent heat flux due to ventilation
real sfvlev1D(nz_um,nz_um) ! sensible heat flux due to ventilation
real sfwin1D(2*ndm,nz_um,nbui_max) ! sensible heat flux from windows
real consumlev1D(nz_um,nz_um) ! consumption due to the air conditioning systems
real eppvlev1D(nz_um) ! electricity production of PV panels
real tair1D(nz_um)
real tpvlev1D(ndm,nz_um)
real qv1D(kms:kme) ! specific humidity
real meso_urb ! constant to link meso and urban scales [m-2]
real meso_urb_ac
real roof_frac ! Surface fraction occupied by roof
real d_urb(nz_um)
real sf_ac
integer ibui,nbui
integer nlev(nz_um)
!
!End new variables
!
real sfw1D(2*ndm,nz_um,nbui_max) ! sensible heat flux from walls
real sfg1D(ndm) ! sensible heat flux from ground (road)
real sfr1D(ndm,nz_um) ! sensible heat flux from roofs
real sfrpv1D(ndm,nz_um)
real tpv1D(nbui_max)
real sfr_indoor1D(nbui_max)
real sfrv1D(ndm,nz_um) ! sensible heat flux from roofs
real lfrv1D(ndm,nz_um) ! latent heat flux from roofs
real dg1D(ndm) ! water depth from ground
real dgr1D(ndm,nz_um) ! water depth from roofs
real lfg1D(ndm) ! latent heat flux from ground (road)
real lfr1D(ndm,nz_um) ! latent heat flux from roofs
real drain1D(ndm,nz_um) ! sensible heat flux from roofs
real sf1D(kms:kme) ! surface of the urban grid cells
real vl1D(kms:kme) ! volume of the urban grid cells
real a_u1D(kms:kme) ! Implicit component of the momentum sources or sinks in the X-direction
real a_v1D(kms:kme) ! Implicit component of the momentum sources or sinks in the Y-direction
real a_t1D(kms:kme) ! Implicit component of the heat sources or sinks
real a_e1D(kms:kme) ! Implicit component of the TKE sources or sinks
real b_u1D(kms:kme) ! Explicit component of the momentum sources or sinks in the X-direction
real b_v1D(kms:kme) ! Explicit component of the momentum sources or sinks in the Y-direction
real b_t1D(kms:kme) ! Explicit component of the heat sources or sinks
real b_ac1D(kms:kme)
real b_e1D(kms:kme) ! Explicit component of the TKE sources or sinks
real b_q1D(kms:kme) ! Explicit component of the Humidity sources or sinks
real dlg1D(kms:kme) ! Height above ground (L_ground in formula (24) of the BLM paper).
real dl_u1D(kms:kme) ! Length scale (lb in formula (22) ofthe BLM paper)
real gfr1D(ndm,nz_um)
real time_bep
! arrays used to collapse indexes
integer ind_zwd(nbui_max,nz_um,nwr_u,ndm)
integer ind_gd(ng_u,ndm)
integer ind_zd(nbui_max,nz_um,ndm)
integer ind_zdf(nz_um,ndm)
integer ind_zrd(nz_um,nwr_u,ndm)
integer ind_grd(nz_um,ngr_u,ndm)
!
integer ind_bd(nbui_max,nz_um)
integer ind_wd(nbui_max,nz_um,ndm)
integer ind_gbd(nbui_max,ngb_u,ndm)
integer ind_fbd(nbui_max,nf_u,nz_um-1,ndm)
integer ix,iy,iz,iurb,id,iz_u,iw,ig,ir,ix1,iy1,k
integer it, nint
integer iii
logical first
character(len=80) :: text
data first/.true./
save first,time_bep
save alag_u,alaw_u,alar_u,csg_u,csw_u,csr_u, &
albg_u,albw_u,albr_u,emg_u,emw_u,emr_u, &
z0g_u,z0r_u, nd_u,strd_u,drst_u,ws_u,bs_u,h_b,d_b,ss_u,pb_u, &
nz_u,z_u,albwin_u,emwind_u,cop_u,pwin_u,beta_u,sw_cond_u, &
bldac_frc_u,cooled_frc_u, &
time_on_u,time_off_u,targtemp_u,gaptemp_u,targhum_u,gaphum_u, &
perflo_u,gr_frac_roof_u, &
pv_frac_roof_u,hsesf_u,hsequip,irho,gr_flag_u,gr_type_u
!------------------------------------------------------------------------
! Calculation of the momentum, heat and turbulent kinetic fluxes
! produced by buildings
!
! References:
! Martilli, A., Clappier, A., Rotach, M.W.:2002, 'AN URBAN SURFACE EXCHANGE
! PARAMETERISATION FOR MESOSCALE MODELS', Boundary-Layer Meteorolgy 104:
! 261-304
!
! F. Salamanca and A. Martilli, 2009: 'A new Building Energy Model coupled
! with an Urban Canopy Parameterization for urban climate simulations - part II.
! Validation with one dimension off-line simulations'. Theor Appl Climatol
! DOI 10.1007/s00704-009-0143-8
!------------------------------------------------------------------------
!
!prepare the arrays to collapse indexes
!
if(urban_map_zwd.lt.nbui_max*nz_um*ndm*max(nwr_u,ng_u))then
write(*,*)'urban_map_zwd too small, please increase to at least ', nbui_max*nz_um*ndm*max(nwr_u,ng_u)
stop
endif
!
!New conditions for BEM
!
if(urban_map_bd.lt.nbui_max*nz_um)then !limit for indoor temperature and indoor humidity
write(*,*)'urban_map_bd too small, please increase to at least ', nbui_max*nz_um
stop
endif
if(urban_map_wd.lt.nbui_max*nz_um*ndm)then !limit for window temperature
write(*,*)'urban_map_wd too small, please increase to at least ', nbui_max*nz_um*ndm
stop
endif
if(urban_map_gbd.lt.nbui_max*ndm*ngb_u)then !limit for ground temperature below a building
write(*,*)'urban_map_gbd too small, please increase to at least ', nbui_max*ndm*ngb_u
stop
endif
if(urban_map_fbd.lt.(nz_um-1)*nbui_max*ndm*nf_u)then !limit for floor temperature
write(*,*)'urban_map_fbd too small, please increase to at least ', nbui_max*ndm*nf_u*(nz_um-1)
stop
endif
if (ndm.ne.2)then
write(*,*) 'number of directions is not correct',ndm
stop
endif
!End of new conditions
!
!
!Initialize collapse indexes
!
ind_zwd=0
ind_gd=0
ind_zd=0
ind_zdf=0
ind_zrd=0
ind_grd=0
ind_bd=0
ind_wd=0
ind_gbd=0
ind_fbd=0
!
!End initialization indexes
!
iii=0
do ibui=1,nbui_max
do iz_u=1,nz_um
do iw=1,nwr_u
do id=1,ndm
iii=iii+1
ind_zwd(ibui,iz_u,iw,id)=iii
enddo
enddo
enddo
enddo
iii=0
do ig=1,ng_u
do id=1,ndm
iii=iii+1
ind_gd(ig,id)=iii
enddo
enddo
iii=0
do ibui=1,nbui_max
do iz_u=1,nz_um
do id=1,ndm
iii=iii+1
ind_zd(ibui,iz_u,id)=iii
enddo
enddo
enddo
iii=0
do iz_u=1,nz_um
do iw=1,nwr_u
do id=1,ndm
iii=iii+1
ind_zrd(iz_u,iw,id)=iii
enddo
enddo
enddo
iii=0
do iz_u=1,nz_um
do iw=1,ngr_u
do id=1,ndm
iii=iii+1
ind_grd(iz_u,iw,id)=iii
enddo
enddo
enddo
!
!New indexes for BEM
iii=0
do iz_u=1,nz_um
do id=1,ndm
iii=iii+1
ind_zdf(iz_u,id)=iii
enddo ! id
enddo ! iz_u
iii=0
do ibui=1,nbui_max !Type of building
do iz_u=1,nz_um !vertical levels
iii=iii+1
ind_bd(ibui,iz_u)=iii
enddo !iz_u
enddo !ibui
iii=0
do ibui=1,nbui_max !type of building
do iz_u=1,nz_um !vertical levels
do id=1,ndm !direction
iii=iii+1
ind_wd(ibui,iz_u,id)=iii
enddo !id
enddo !iz_u
enddo !ibui
iii=0
do ibui=1,nbui_max!type of building
do iw=1,ngb_u !layers in the wall (ground below a building)
do id=1,ndm !direction
iii=iii+1
ind_gbd(ibui,iw,id)=iii
enddo !id
enddo !iw
enddo !ibui
iii=0
do ibui=1,nbui_max !type of building
do iw=1,nf_u !layers in the wall (floor)
do iz_u=1,nz_um-1 !vertical levels
do id=1,ndm !direction
iii=iii+1
ind_fbd(ibui,iw,iz_u,id)=iii
enddo !id
enddo !iz_u
enddo !iw
enddo !ibui
!End of new indexes
if (num_urban_hi.ge.nz_um)then
write(*,*)'nz_um too small, please increase to at least ', num_urban_hi+1
stop
endif
do ix=its,ite
do iy=jts,jte
do iz_u=1,nz_um
hi_urb(ix,iz_u,iy)=0.
enddo
enddo
enddo
do ix=its,ite
do iy=jts,jte
z(ix,kts,iy)=0.
do iz=kts+1,kte+1
z(ix,iz,iy)=z(ix,iz-1,iy)+dz8w(ix,iz-1,iy)
enddo
iii=0
do iz_u=1,num_urban_hi
hi_urb(ix,iz_u,iy)= hi_urb2d(ix,iz_u,iy)
if (hi_urb(ix,iz_u,iy)/=0.) then
iii=iii+1
endif
enddo !iz_u
if (iii.gt.nbui_max) then
write(*,*) 'nbui_max too small, please increase to at least ',iii
stop
endif
enddo
enddo
if (first) then ! True only on first call
call init_para(alag_u,alaw_u,alar_u,csg_u,csw_u,csr_u,&
twini_u,trini_u,tgini_u,albg_u,albw_u,albr_u,albwin_u,emg_u,emw_u,&
emr_u,emwind_u,z0g_u,z0r_u,nd_u,strd_u,drst_u,ws_u,bs_u,h_b,d_b, &
cop_u,pwin_u,beta_u,sw_cond_u,time_on_u,time_off_u,targtemp_u, &
bldac_frc_u,cooled_frc_u, &
gaptemp_u,targhum_u,gaphum_u,perflo_u, &
gr_frac_roof_u,pv_frac_roof_u, &
hsesf_u,hsequip,irho,gr_flag_u,gr_type_u)
!Initialisation of the urban parameters and calculation of the view factor
call icBEP(nd_u,h_b,d_b,ss_u,pb_u,nz_u,z_u)
first=.false.
endif ! first
do ix=its,ite
do iy=jts,jte
if (FRC_URB2D(ix,iy).gt.0.) then ! Calling BEP only for existing urban classes.
iurb=UTYPE_URB2D(ix,iy)
hi_urb1D=0.
do iz_u=1,nz_um
hi_urb1D(iz_u)=hi_urb(ix,iz_u,iy)
enddo
call icBEPHI_XY(iurb,hb_u,hi_urb1D,ss_urb,pb_urb, &
nz_urb(iurb),z_u)
call param(iurb,nz_u(iurb),nz_urb(iurb),nzurban(iurb), &
nd_u(iurb),csg_u,csg,alag_u,alag,csr_u,csr, &
alar_u,alar,csw_u,csw,alaw_u,alaw, &
ws_u,ws_urb,ws,bs_u,bs_urb,bs,z0g_u,z0r_u,z0, &
strd_u,strd,drst_u,drst,ss_u,ss_urb,ss,pb_u, &
pb_urb,pb,dzw,dzr,dzf,csf,alaf,dzgb,csgb,alagb, &
lp_urb2d(ix,iy),lb_urb2d(ix,iy), &
hgt_urb2d(ix,iy),FRC_URB2D(ix,iy))
!
!We compute the view factors in the icBEP_XY routine
!
call icBEP_XY(iurb,fww_u,fwg_u,fgw_u,fsw_u,fws_u,fsg_u, &
nd_u(iurb),strd,ws,nzurban(iurb),z_u)
ibui=0
nlev=0
nbui=0
d_urb=0.
do iz=1,nz_um
if(ss_urb(iz,iurb).gt.0) then
ibui=ibui+1
nlev(ibui)=iz-1
d_urb(ibui)=ss_urb(iz,iurb)
nbui=ibui
endif
end do !iz
if (nbui.gt.nbui_max) then
write (*,*) 'nbui_max must be increased to',nbui
stop
endif
do iz= kts,kte
ua1D(iz)=u_phy(ix,iz,iy)
va1D(iz)=v_phy(ix,iz,iy)
pt1D(iz)=th_phy(ix,iz,iy)
da1D(iz)=rho(ix,iz,iy)
pr1D(iz)=p_phy(ix,iz,iy)
pt01D(iz)=300.
z1D(iz)=z(ix,iz,iy)
qv1D(iz)=qv_phy(ix,iz,iy)
a_u1D(iz)=0.
a_v1D(iz)=0.
a_t1D(iz)=0.
a_e1D(iz)=0.
b_u1D(iz)=0.
b_v1D(iz)=0.
b_t1D(iz)=0.
b_ac1D(iz)=0.
b_e1D(iz)=0.
enddo
z1D(kte+1)=z(ix,kte+1,iy)
do id=1,ndm
do iz_u=1,nz_um
do iw=1,nwr_u
do ibui=1,nbui_max
tw1D(2*id-1,iz_u,iw,ibui)=tw1_urb4d(ix,ind_zwd(ibui,iz_u,iw,id),iy)
tw1D(2*id,iz_u,iw,ibui)=tw2_urb4d(ix,ind_zwd(ibui,iz_u,iw,id),iy)
enddo
enddo
enddo
enddo
do id=1,ndm
do ig=1,ng_u
tg1D(id,ig)=tgb_urb4d(ix,ind_gd(ig,id),iy)
enddo
do iz_u=1,nz_um
do ir=1,nwr_u
tr1D(id,iz_u,ir)=trb_urb4d(ix,ind_zrd(iz_u,ir,id),iy)
enddo
do ir=1,ngr_u
if(gr_flag_u.eq.1)then
trv1D(id,iz_u,ir)=trv_urb4d(ix,ind_grd(iz_u,ir,id),iy)
qr1D(id,iz_u,ir)=qr_urb4d(ix,ind_grd(iz_u,ir,id),iy)
else
trv1D(id,iz_u,ir)=0.
qr1D(id,iz_u,ir)=0.
endif
enddo
enddo
enddo
!Initialize variables for BEM
tlev1D=0. !Indoor temperature
qlev1D=0. !Indoor humidity
twlev1D=0. !Window temperature
tglev1D=0. !Ground temperature
tflev1D=0. !Floor temperature
sflev1D=0. !Sensible heat flux from the a.c.
lflev1D=0. !latent heat flux from the a.c.
consumlev1D=0.!consumption of the a.c.
eppvlev1D=0. !electricity production of PV panels
tpvlev1D=0.
sfvlev1D=0. !Sensible heat flux from natural ventilation
lfvlev1D=0. !Latent heat flux from natural ventilation
sfwin1D=0. !Sensible heat flux from windows
sfw1D=0. !Sensible heat flux from walls
do iz_u=1,nz_um !vertical levels
do ibui=1,nbui_max !Type of building
tlev1D(iz_u,ibui)= tlev_urb3d(ix,ind_bd(ibui,iz_u),iy)
qlev1D(iz_u,ibui)= qlev_urb3d(ix,ind_bd(ibui,iz_u),iy)
enddo !ibui
enddo !iz_u
do id=1,ndm !direction
do iz_u=1,nz_um !vertical levels
do ibui=1,nbui_max !type of building
twlev1D(2*id-1,iz_u,ibui)=tw1lev_urb3d(ix,ind_wd(ibui,iz_u,id),iy)
twlev1D(2*id,iz_u,ibui)=tw2lev_urb3d(ix,ind_wd(ibui,iz_u,id),iy)
sfwin1D(2*id-1,iz_u,ibui)=sfwin1_urb3d(ix,ind_wd(ibui,iz_u,id),iy)
sfwin1D(2*id,iz_u,ibui)=sfwin2_urb3d(ix,ind_wd(ibui,iz_u,id),iy)
enddo !ibui
enddo !iz_u
enddo !id
do id=1,ndm !direction
do iw=1,ngb_u !layer in the wall
do ibui=1,nbui_max !type of building
tglev1D(id,iw,ibui)=tglev_urb3d(ix,ind_gbd(ibui,iw,id),iy)
enddo !ibui
enddo !iw
enddo !id
do id=1,ndm !direction
do iw=1,nf_u !layer in the walls
do iz_u=1,nz_um-1 !verticals levels
do ibui=1,nbui_max !type of building
tflev1D(id,iw,iz_u,ibui)=tflev_urb3d(ix,ind_fbd(ibui,iw,iz_u,id),iy)
enddo !ibui
enddo ! iz_u
enddo !iw
enddo !id
!
!End initialization for BEM
!
do id=1,ndm
do iz=1,nz_um
do ibui=1,nbui_max !type of building
!! sfw1D(2*id-1,iz)=sfw1(ix,iy,ind_zd(iz,id))
!! sfw1D(2*id,iz)=sfw2(ix,iy,ind_zd(iz,id))
sfw1D(2*id-1,iz,ibui)=sfw1_urb3d(ix,ind_zd(ibui,iz,id),iy)
sfw1D(2*id,iz,ibui)=sfw2_urb3d(ix,ind_zd(ibui,iz,id),iy)
enddo
enddo
enddo
do id=1,ndm
sfg1D(id)=sfg_urb3d(ix,id,iy)
lfg1D(id)=lfg_urb3d(ix,id,iy)
dg1D(id)=dg_urb3d(ix,id,iy)
enddo
do id=1,ndm
do iz=1,nz_um
tpvlev1D(id,iz)=t_pv_urb3d(ix,ind_zdf(iz,id),iy)
sfr1D(id,iz)=sfr_urb3d(ix,ind_zdf(iz,id),iy)
lfr1D(id,iz)=lfr_urb3d(ix,ind_zdf(iz,id),iy)
dgr1D(id,iz)=dgr_urb3d(ix,ind_zdf(iz,id),iy)
if(gr_flag_u.eq.1)then
sfrv1D(id,iz)=sfrv_urb3d(ix,ind_zdf(iz,id),iy)
lfrv1D(id,iz)=lfrv_urb3d(ix,ind_zdf(iz,id),iy)
drain1D(id,iz)=drain_urb4d(ix,ind_zdf(iz,id),iy)
else
sfrv1D(id,iz)=0.
lfrv1D(id,iz)=0.
drain1D(id,iz)=0.
endif
enddo
enddo
rs1D=swdown(ix,iy)
rld1D=glw(ix,iy)
swddir1D=swddir(ix,iy) !_gl
swddif1D=swddif(ix,iy) !_gl
zr1D=acos(COSZ_URB2D(ix,iy))
deltar1D=DECLIN_URB
ah1D=OMG_URB2D(ix,iy)
call BEP1D(itimestep,ix,iy,iurb,kms,kme,kts,kte,z1D,dt,ua1D,va1D,pt1D,da1D,pr1D,pt01D, &
zr1D,deltar1D,ah1D,rs1D,rld1D,alagb, &
alag,alaw,alar,alaf,csgb,csg,csw,csr,csf, &
dzr,dzf,dzw,dzgb,xlat(ix,iy),swddir1D,swddif1D, &
albg_u(iurb),albw_u(iurb),albr_u(iurb), &
albwin_u(iurb),emg_u(iurb),emw_u(iurb), &
emr_u(iurb),emwind_u(iurb),fww_u,fwg_u, &
fgw_u,fsw_u,fws_u,fsg_u,z0, &
nd_u(iurb),strd,drst,ws,bs_urb,bs,ss,pb, &
nzurban(iurb),z_u,cop_u,pwin_u,beta_u, &
sw_cond_u,time_on_u,time_off_u,targtemp_u, &
gaptemp_u,targhum_u,gaphum_u,perflo_u, &
gr_frac_roof_u(iurb),pv_frac_roof_u(iurb), &
hsesf_u,hsequip,irho,gr_flag_u,gr_type_u, &
tw1D,tg1D,tr1D,trv1D,sfw1D,sfg1D,sfr1D, &
sfrv1D,lfrv1D, &
dgr1D,dg1D,lfr1D,lfg1D, &
drain1D,rainbl(ix,iy),qr1D, &
a_u1D,a_v1D,a_t1D,a_e1D, &
b_u1D,b_v1D,b_t1D,b_ac1D,b_e1D,b_q1D, &
dlg1D,dl_u1D,sf1D,vl1D,rl_up(ix,iy), &
rs_abs(ix,iy),emiss(ix,iy),grdflx_urb(ix,iy), &
qv1D,tlev1D,qlev1D,sflev1D,lflev1D,consumlev1D, &
eppvlev1D,tpvlev1D,sfvlev1D,lfvlev1D,twlev1D,tglev1D,tflev1D,sfwin1D,tair1D,sfr_indoor1D,sfrpv1D,gfr1D)
do ibui=1,nbui_max !type of building
do iz=1,nz_um !vertical levels
do id=1,ndm ! direction
sfw1_urb3d(ix,ind_zd(ibui,iz,id),iy)=sfw1D(2*id-1,iz,ibui)
sfw2_urb3d(ix,ind_zd(ibui,iz,id),iy)=sfw1D(2*id,iz,ibui)
enddo
enddo
enddo
do id=1,ndm
sfg_urb3d(ix,id,iy)=sfg1D(id)
lfg_urb3d(ix,id,iy)=lfg1D(id)
dg_urb3d(ix,id,iy)=dg1D(id)
enddo
do id=1,ndm
do iz=1,nz_um
t_pv_urb3d(ix,ind_zdf(iz,id),iy)=tpvlev1D(id,iz)
sfr_urb3d(ix,ind_zdf(iz,id),iy)=sfr1D(id,iz)
dgr_urb3d(ix,ind_zdf(iz,id),iy)=dgr1D(id,iz)
lfr_urb3d(ix,ind_zdf(iz,id),iy)=lfr1D(id,iz)
if(gr_flag_u.eq.1)then
sfrv_urb3d(ix,ind_zdf(iz,id),iy)=sfrv1D(id,iz)
lfrv_urb3d(ix,ind_zdf(iz,id),iy)=lfrv1D(id,iz)
drain_urb4d(ix,ind_zdf(iz,id),iy)=drain1D(id,iz)
endif
enddo
enddo
do ibui=1,nbui_max
do iz_u=1,nz_um
do iw=1,nwr_u
do id=1,ndm
tw1_urb4d(ix,ind_zwd(ibui,iz_u,iw,id),iy)=tw1D(2*id-1,iz_u,iw,ibui)
tw2_urb4d(ix,ind_zwd(ibui,iz_u,iw,id),iy)=tw1D(2*id,iz_u,iw,ibui)
enddo
enddo
enddo
enddo
do id=1,ndm
do ig=1,ng_u
tgb_urb4d(ix,ind_gd(ig,id),iy)=tg1D(id,ig)
enddo
do iz_u=1,nz_um
do ir=1,nwr_u
trb_urb4d(ix,ind_zrd(iz_u,ir,id),iy)=tr1D(id,iz_u,ir)
enddo
if(gr_flag_u.eq.1)then