@@ -14,16 +14,16 @@ module initVerticalMod
14
14
use spmdMod , only : masterproc
15
15
use elm_varpar , only : more_vertlayers, nlevsno, nlevgrnd, nlevlak
16
16
use elm_varpar , only : toplev_equalspace, nlev_equalspace
17
- use elm_varpar , only : nlevsoi, nlevsoifl, nlevurb, nlevslp
17
+ use elm_varpar , only : nlevsoi, nlevsoifl, nlevurb, nlevslp
18
18
use elm_varctl , only : fsurdat, iulog, use_var_soil_thick
19
19
use elm_varctl , only : use_vancouver, use_mexicocity, use_vertsoilc, use_extralakelayers, use_extrasnowlayers
20
- use elm_varctl , only : use_erosion
21
- use elm_varcon , only : zlak, dzlak, zsoi, dzsoi, zisoi, dzsoi_decomp, spval, grlnd
20
+ use elm_varctl , only : use_erosion, use_polygonal_tundra
21
+ use elm_varcon , only : zlak, dzlak, zsoi, dzsoi, zisoi, dzsoi_decomp, spval, grlnd
22
22
use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall, icol_road_perv, icol_road_imperv
23
23
use landunit_varcon, only : istdlak, istice_mec
24
24
use fileutils , only : getfil
25
- use LandunitType , only : lun_pp
26
- use ColumnType , only : col_pp
25
+ use LandunitType , only : lun_pp
26
+ use ColumnType , only : col_pp
27
27
use SnowHydrologyMod, only : InitSnowLayers
28
28
use ncdio_pio
29
29
use topounit_varcon , only : max_topounits
@@ -50,13 +50,14 @@ subroutine initVertical(bounds, snow_depth, thick_wall, thick_roof)
50
50
real (r8 ) , intent (in ) :: thick_roof(bounds% begl:)
51
51
!
52
52
! LOCAL VARAIBLES:
53
- integer :: c,l,t,ti,topi,g,i,j,lev ! indices
53
+ integer :: c,l,t,ti,topi,g,i,j,lev ! indices
54
54
type (file_desc_t) :: ncid ! netcdf id
55
- logical :: readvar
55
+ logical :: readvar
56
56
integer :: dimid ! dimension id
57
57
character (len= 256 ) :: locfn ! local filename
58
- real (r8 ) ,pointer :: std (:) ! read in - topo_std
59
- real (r8 ) ,pointer :: tslope (:) ! read in - topo_slope
58
+ real (r8 ) ,pointer :: std (:) ! read in - topo_std
59
+ real (r8 ) ,pointer :: tslope (:) ! read in - topo_slope
60
+ real (r8 ) ,pointer :: gradz(:) ! read in - gradz (polygonal tundra only)
60
61
real (r8 ) ,pointer :: hslp_p10 (:,:,:) ! read in - hillslope slope percentiles
61
62
real (r8 ) ,pointer :: dtb (:,:) ! read in - DTB
62
63
real (r8 ) :: beddep ! temporary
@@ -68,14 +69,14 @@ subroutine initVertical(bounds, snow_depth, thick_wall, thick_roof)
68
69
integer :: ier ! error status
69
70
real (r8 ) :: scalez = 0.025_r8 ! Soil layer thickness discretization (m)
70
71
real (r8 ) :: thick_equal = 0.2
71
- real (r8 ) ,pointer :: lakedepth_in(:,:) ! read in - lakedepth
72
+ real (r8 ) ,pointer :: lakedepth_in(:,:) ! read in - lakedepth
72
73
real (r8 ), allocatable :: zurb_wall(:,:) ! wall (layer node depth)
73
74
real (r8 ), allocatable :: zurb_roof(:,:) ! roof (layer node depth)
74
75
real (r8 ), allocatable :: dzurb_wall(:,:) ! wall (layer thickness)
75
76
real (r8 ), allocatable :: dzurb_roof(:,:) ! roof (layer thickness)
76
77
real (r8 ), allocatable :: ziurb_wall(:,:) ! wall (layer interface)
77
78
real (r8 ), allocatable :: ziurb_roof(:,:) ! roof (layer interface)
78
- real (r8 ) :: depthratio ! ratio of lake depth to standard deep lake depth
79
+ real (r8 ) :: depthratio ! ratio of lake depth to standard deep lake depth
79
80
integer :: begc, endc
80
81
integer :: begl, endl
81
82
!- -----------------------------------------------------------------------
@@ -87,7 +88,7 @@ subroutine initVertical(bounds, snow_depth, thick_wall, thick_roof)
87
88
SHR_ASSERT_ALL((ubound (thick_wall) == (/ endl/ )), errMsg(__FILE__, __LINE__))
88
89
SHR_ASSERT_ALL((ubound (thick_roof) == (/ endl/ )), errMsg(__FILE__, __LINE__))
89
90
90
- ! Open surface dataset to read in data below
91
+ ! Open surface dataset to read in data below
91
92
92
93
call getfil (fsurdat, locfn, 0 )
93
94
call ncd_pio_openfile (ncid, locfn, 0 )
@@ -103,19 +104,19 @@ subroutine initVertical(bounds, snow_depth, thick_wall, thick_roof)
103
104
end if
104
105
105
106
! --------------------------------------------------------------------
106
- ! Define layer structure for soil, lakes, urban walls and roof
107
+ ! Define layer structure for soil, lakes, urban walls and roof
107
108
! Vertical profile of snow is not initialized here - but below
108
109
! --------------------------------------------------------------------
109
-
110
+
110
111
! Soil layers and interfaces (assumed same for all non-lake patches)
111
112
! "0" refers to soil surface and "nlevsoi" refers to the bottom of model soil
112
-
113
+
113
114
if ( more_vertlayers )then
114
- ! replace standard exponential grid with a grid that starts out exponential,
115
- ! then has several evenly spaced layers, then finishes off exponential.
116
- ! this allows the upper soil to behave as standard, but then continues
115
+ ! replace standard exponential grid with a grid that starts out exponential,
116
+ ! then has several evenly spaced layers, then finishes off exponential.
117
+ ! this allows the upper soil to behave as standard, but then continues
117
118
! with higher resolution to a deeper depth, so that, for example, permafrost
118
- ! dynamics are not lost due to an inability to resolve temperature, moisture,
119
+ ! dynamics are not lost due to an inability to resolve temperature, moisture,
119
120
! and biogeochemical dynamics at the base of the active layer
120
121
do j = 1 , toplev_equalspace
121
122
zsoi(j) = scalez* (exp (0.5_r8 * (j-0.5_r8 ))- 1._r8 ) ! node depths
@@ -148,7 +149,7 @@ subroutine initVertical(bounds, snow_depth, thick_wall, thick_roof)
148
149
zisoi(nlevgrnd) = zsoi(nlevgrnd) + 0.5_r8 * dzsoi(nlevgrnd)
149
150
150
151
if (masterproc) then
151
- write (iulog, * ) ' zsoi' , zsoi(:)
152
+ write (iulog, * ) ' zsoi' , zsoi(:)
152
153
write (iulog, * ) ' zisoi: ' , zisoi(:)
153
154
write (iulog, * ) ' dzsoi: ' , dzsoi(:)
154
155
end if
@@ -164,7 +165,7 @@ subroutine initVertical(bounds, snow_depth, thick_wall, thick_roof)
164
165
dzsoi_decomp(1 ) = 1 .
165
166
end if
166
167
if (masterproc) then
167
- write (iulog, * ) ' dzsoi_decomp' , dzsoi_decomp(:)
168
+ write (iulog, * ) ' dzsoi_decomp' , dzsoi_decomp(:)
168
169
end if
169
170
170
171
if (nlevurb > 0 ) then
@@ -187,7 +188,7 @@ subroutine initVertical(bounds, snow_depth, thick_wall, thick_roof)
187
188
188
189
! "0" refers to urban wall/roof surface and "nlevsoi" refers to urban wall/roof bottom
189
190
if (lun_pp% urbpoi(l)) then
190
- if (use_vancouver) then
191
+ if (use_vancouver) then
191
192
zurb_wall(l,1 ) = 0.010_r8 / 2._r8
192
193
zurb_wall(l,2 ) = zurb_wall(l,1 ) + 0.010_r8 / 2._r8 + 0.020_r8 / 2._r8
193
194
zurb_wall(l,3 ) = zurb_wall(l,2 ) + 0.020_r8 / 2._r8 + 0.070_r8 / 2._r8
@@ -281,13 +282,13 @@ subroutine initVertical(bounds, snow_depth, thick_wall, thick_roof)
281
282
282
283
dzurb_roof(l,1 ) = 0.5 * (zurb_roof(l,1 )+ zurb_roof(l,2 )) ! thickness b/n two interfaces
283
284
do j = 2 ,nlevurb-1
284
- dzurb_roof(l,j)= 0.5 * (zurb_roof(l,j+1 )- zurb_roof(l,j-1 ))
285
+ dzurb_roof(l,j)= 0.5 * (zurb_roof(l,j+1 )- zurb_roof(l,j-1 ))
285
286
enddo
286
287
dzurb_roof(l,nlevurb) = zurb_roof(l,nlevurb)- zurb_roof(l,nlevurb-1 )
287
288
288
289
dzurb_wall(l,1 ) = 0.5 * (zurb_wall(l,1 )+ zurb_wall(l,2 )) ! thickness b/n two interfaces
289
290
do j = 2 ,nlevurb-1
290
- dzurb_wall(l,j)= 0.5 * (zurb_wall(l,j+1 )- zurb_wall(l,j-1 ))
291
+ dzurb_wall(l,j)= 0.5 * (zurb_wall(l,j+1 )- zurb_wall(l,j-1 ))
291
292
enddo
292
293
dzurb_wall(l,nlevurb) = zurb_wall(l,nlevurb)- zurb_wall(l,nlevurb-1 )
293
294
@@ -362,7 +363,7 @@ subroutine initVertical(bounds, snow_depth, thick_wall, thick_roof)
362
363
t = col_pp% topounit(c)
363
364
topi = grc_pp% topi(g)
364
365
ti = t - topi + 1
365
-
366
+
366
367
col_pp% lakedepth(c) = lakedepth_in(g,ti)
367
368
end do
368
369
deallocate (lakedepth_in)
@@ -435,7 +436,7 @@ subroutine initVertical(bounds, snow_depth, thick_wall, thick_roof)
435
436
436
437
else if (col_pp% lakedepth(c) > 1._r8 .and. col_pp% lakedepth(c) < 5000._r8 ) then
437
438
438
- depthratio = col_pp% lakedepth(c) / (zlak(nlevlak) + 0.5_r8 * dzlak(nlevlak))
439
+ depthratio = col_pp% lakedepth(c) / (zlak(nlevlak) + 0.5_r8 * dzlak(nlevlak))
439
440
col_pp% z_lake(c,1 ) = zlak(1 )
440
441
col_pp% dz_lake(c,1 ) = dzlak(1 )
441
442
col_pp% dz_lake(c,2 :nlevlak-1 ) = dzlak(2 :nlevlak-1 )* depthratio
@@ -466,12 +467,12 @@ subroutine initVertical(bounds, snow_depth, thick_wall, thick_roof)
466
467
end do
467
468
468
469
!- ----------------------------------------------
469
- ! Set cold-start values for snow levels, snow layers and snow interfaces
470
+ ! Set cold-start values for snow levels, snow layers and snow interfaces
470
471
!- ----------------------------------------------
471
472
472
473
if (.not. use_extrasnowlayers) then
473
-
474
- associate(snl = > col_pp% snl) ! Output: [integer (:) ] number of snow layers
474
+
475
+ associate(snl = > col_pp% snl) ! Output: [integer (:) ] number of snow layers
475
476
476
477
do c = bounds% begc,bounds% endc
477
478
l = col_pp% landunit(c)
@@ -547,12 +548,12 @@ subroutine initVertical(bounds, snow_depth, thick_wall, thick_roof)
547
548
col_pp% zi(c,- nlevsno+0 :0 ) = 0._r8
548
549
end if
549
550
end do
550
-
551
+
551
552
end associate
552
-
553
+
553
554
else ! use extra (16) snow layers, for firn model
554
555
call InitSnowLayers(bounds, snow_depth(bounds% begc:bounds% endc))
555
-
556
+
556
557
end if
557
558
558
559
!- ----------------------------------------------
@@ -563,7 +564,7 @@ subroutine initVertical(bounds, snow_depth, thick_wall, thick_roof)
563
564
call ncd_io(ncid= ncid, varname= ' SLOPE' , flag= ' read' , data = tslope, dim1name= grlnd, readvar= readvar)
564
565
if (.not. readvar) then
565
566
call shr_sys_abort(' ERROR: TOPOGRAPHIC SLOPE NOT on surfdata file' // &
566
- errMsg(__FILE__, __LINE__))
567
+ errMsg(__FILE__, __LINE__))
567
568
end if
568
569
do c = begc,endc
569
570
g = col_pp% gridcell(c)
@@ -572,11 +573,24 @@ subroutine initVertical(bounds, snow_depth, thick_wall, thick_roof)
572
573
end do
573
574
deallocate (tslope)
574
575
576
+ if (use_polygonal_tundra) then
577
+ allocate (gradz(bounds% begg:bounds% endg))
578
+ call ncd_io(ncid= ncid, varname= ' GRADZ' , flag= ' read' , data = gradz, dim1name= grlnd, readvar= readvar)
579
+ if (.not. readvar) then
580
+ call shr_sys_abort(' ERROR: polygonal tundra turned on, but GRADZ not on surfdata file' // &
581
+ errMsg(__FILE__, __LINE__))
582
+ end if
583
+ do c = begc,endc
584
+ g = col_pp% gridcell(c)
585
+ col_pp% meangradz(c) = gradz(g)
586
+ end do
587
+ end if
588
+
575
589
allocate (std(bounds% begg:bounds% endg))
576
590
call ncd_io(ncid= ncid, varname= ' STD_ELEV' , flag= ' read' , data = std, dim1name= grlnd, readvar= readvar)
577
591
if (.not. readvar) then
578
592
call shr_sys_abort(' ERROR: TOPOGRAPHIC STDdev (STD_ELEV) NOT on surfdata file' // &
579
- errMsg(__FILE__, __LINE__))
593
+ errMsg(__FILE__, __LINE__))
580
594
end if
581
595
do c = begc,endc
582
596
g = col_pp% gridcell(c)
@@ -623,11 +637,11 @@ subroutine initVertical(bounds, snow_depth, thick_wall, thick_roof)
623
637
else
624
638
do c = begc,endc
625
639
g = col_pp% gridcell(c)
626
- l = col_pp% landunit(c)
640
+ l = col_pp% landunit(c)
627
641
t = col_pp% topounit(c)
628
642
topi = grc_pp% topi(g)
629
643
ti = t - topi + 1
630
-
644
+
631
645
if (lun_pp% urbpoi(l) .and. col_pp% itype(c) /= icol_road_imperv .and. col_pp% itype(c) /= icol_road_perv) then
632
646
col_pp% nlevbed(c) = nlevurb
633
647
else if (lun_pp% itype(l) == istdlak) then
0 commit comments