Skip to content

Commit

Permalink
Merge pull request #7 from lanl/rfiorella/IM1
Browse files Browse the repository at this point in the history
Adds reading of polygon type from surface file
  • Loading branch information
rfiorella authored Jun 14, 2024
2 parents ec37702 + f85f515 commit 86cebe7
Show file tree
Hide file tree
Showing 12 changed files with 361 additions and 210 deletions.
3 changes: 3 additions & 0 deletions components/elm/bld/namelist_files/namelist_defaults.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2155,4 +2155,7 @@ this mask will have smb calculated over the entire global land surface
<use_fan use_fates=".true." >.false.</use_fan>
<use_fan fan_mode='disable'>.false.</use_fan>

<!-- NGEE Arctic Options -->
<use_polygonal_tundra>.false.</use_polygonal_tundra>;

</namelist_defaults>
10 changes: 10 additions & 0 deletions components/elm/bld/namelist_files/namelist_definition.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2135,4 +2135,14 @@ not be called.
<default>Default: 0</default>
</entry>

<!-- ======================================================================================== -->
<!-- NGEE Arctic Options -->
<!-- ======================================================================================== -->

<entry id="use_polygonal_tundra" type="logical" category="default_settings"
group="elm_inparm" value=".false.">
Use polygonal tundra parameterizations for ice wedge polygon microtopography and inindation fraction
<default>Default: .false.</default>
</entry>

</namelist_definition>
22 changes: 20 additions & 2 deletions components/elm/src/biogeophys/ActiveLayerMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,21 @@ subroutine alt_calc(num_soilc, filter_soilc, &
real(r8), dimension(nlevgrnd) :: melt_profile ! profile of melted excess ice
!-----------------------------------------------------------------------

! RF NOTE: use of 1989 ALT in these parameterizations is somewhat of a placeholder used to compare against
! ATS runs for NGEE Arctic Phase 3. It should ultimately be replaced by a more physically based threshold
! later on.
associate( &
t_soisno => col_es%t_soisno , & ! Input: [real(r8) (:,:) ] soil temperature (Kelvin) (-nlevsno+1:nlevgrnd)

alt => canopystate_vars%alt_col , & ! Output: [real(r8) (:) ] current depth of thaw
altmax => canopystate_vars%altmax_col , & ! Output: [real(r8) (:) ] maximum annual depth of thaw
altmax_lastyear => canopystate_vars%altmax_lastyear_col , & ! Output: [real(r8) (:) ] prior year maximum annual depth of thaw
altmax_1989 => canopystate_vars%altmax_1989_col , & ! Output: [real(r8) (:) ] maximum ALT in 1989
altmax_ever => canopystate_vars%altmax_ever_col , & ! Output: [real(r8) (:) ] maximum thaw depth since initialization
alt_indx => canopystate_vars%alt_indx_col , & ! Output: [integer (:) ] current depth of thaw
altmax_indx => canopystate_vars%altmax_indx_col , & ! Output: [integer (:) ] maximum annual depth of thaw
altmax_lastyear_indx => canopystate_vars%altmax_lastyear_indx_col , & ! Output: [integer (:) ] prior year maximum annual depth of thaw
altmax_1989_indx => canopystate_vars%altmax_1989_indx_col, & ! Output: [integer (:) ] index of maximum ALT in 1989
altmax_ever_indx => canopystate_vars%altmax_ever_indx_col, & ! Output: [integer (:) ] maximum thaw depth since initialization
excess_ice => col_ws%excess_ice , & ! Input: [real(r8) (:,:) ] depth variable excess ice content in soil column (-)
rmax => col_pp%iwp_microrel , & ! Output: [real(r8) (:) ] ice wedge polygon microtopographic relief (m)
Expand Down Expand Up @@ -154,7 +159,6 @@ subroutine alt_calc(num_soilc, filter_soilc, &
endif
endif


! if appropriate, update maximum annual active layer thickness
if (alt(c) > altmax(c)) then
altmax(c) = alt(c)
Expand All @@ -170,6 +174,13 @@ subroutine alt_calc(num_soilc, filter_soilc, &
endif
endif

! special loop for if year = 1989, see above note regarding
! replacing with more physically based mechanism.
if (year .eq. 1989) then
altmax_1989(c) = altmax(c)
altmax_1989_indx(c) = altmax_indx(c)
endif

! update subsidence based on change in ALT
! melt_profile stores the amount of excess_ice
! melted in this timestep.
Expand All @@ -178,15 +189,22 @@ subroutine alt_calc(num_soilc, filter_soilc, &
melt_profile(j) = 0.0_r8
else if (j .eq. k_frz) then
melt_profile(j) = excess_ice(c,j) + ((z2-alt(c))/(z2-z1))*excess_ice(c,j+1) ! TODO: check indices here!!
! remove melted excess ice:
excess_ice(c,j) = 0._r8
excess_ice(c,j+1) = excess_ice(c,j+1)*(1._r8 - min(1._r8,(z2-alt(c))/(z2-z1)))
else
melt_profile(j) = excess_ice(c,j)
! remove melted excess ice
excess_ice(c,j) = 0._r8
end if
! calculate subsidence at this layer:
melt_profile(j) = melt_profile(j) * dzsoi(j)
end do

! subsidence is integral of melt profile:
subsidence(c) = subsidence(c) + sum(melt_profile)
if ((year .ge. 1989) .and. (altmax_ever(c) .ge. altmax_1989(c))) then
subsidence(c) = subsidence(c) + sum(melt_profile)
end if

! limit subsidence to 0.4 m
subsidence(c) = min(0.4_r8, subsidence(c))
Expand Down
63 changes: 46 additions & 17 deletions components/elm/src/biogeophys/CanopyStateType.F90
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ module CanopyStateType
use elm_varcon , only : spval,ispval
use elm_varpar , only : nlevcan, nvegwcs
use elm_varctl , only : iulog, use_cn, use_fates, use_hydrstress, use_fates_sp
use elm_varctl , only : use_polygonal_tundra
use LandunitType , only : lun_pp
use ColumnType , only : col_pp
use VegetationType , only : veg_pp
Expand Down Expand Up @@ -62,9 +63,11 @@ module CanopyStateType
integer , pointer :: alt_indx_col (:) ! col current depth of thaw
real(r8) , pointer :: altmax_col (:) ! col maximum annual depth of thaw
real(r8) , pointer :: altmax_lastyear_col (:) ! col prior year maximum annual depth of thaw
real(r8) , pointer :: altmax_ever_col (:) ! col maximum thaw depth from beginning of simulation
integer , pointer :: altmax_indx_col (:) ! col maximum annual depth of thaw
integer , pointer :: altmax_lastyear_indx_col (:) ! col prior year maximum annual depth of thaw
real(r8) , pointer :: altmax_1989_col (:) ! col maximum annual thaw depth in 1989 RF note: temporary for IM1!
real(r8) , pointer :: altmax_ever_col (:) ! col maximum thaw depth from beginning of simulation
integer , pointer :: altmax_1989_indx_col (:) ! col 1989 maximum thaw depth RF note: temporary for IM1!
integer , pointer :: altmax_ever_indx_col (:) ! col maximum thaw depth from beginning of simulation

real(r8) , pointer :: dewmx_patch (:) ! patch maximum allowed dew [mm]
Expand Down Expand Up @@ -144,11 +147,13 @@ subroutine InitAllocate(this, bounds )
allocate(this%alt_col (begc:endc)) ; this%alt_col (:) = spval;
allocate(this%altmax_col (begc:endc)) ; this%altmax_col (:) = spval
allocate(this%altmax_lastyear_col (begc:endc)) ; this%altmax_lastyear_col (:) = spval
allocate(this%altmax_1989_col (begc:endc)) ; this%altmax_1989_col (:) = spval
allocate(this%altmax_ever_col (begc:endc)) ; this%altmax_ever_col (:) = spval
allocate(this%alt_indx_col (begc:endc)) ; this%alt_indx_col (:) = huge(1)
allocate(this%altmax_indx_col (begc:endc)) ; this%altmax_indx_col (:) = huge(1)
allocate(this%altmax_lastyear_indx_col (begc:endc)) ; this%altmax_lastyear_indx_col (:) = huge(1)
allocate(this%altmax_ever_indx_col (begc:endc)) ; this%altmax_ever_indx_col (:) = huge(1)
allocate(this%altmax_1989_indx_col (begc:endc)) ; this%altmax_1989_indx_col (:) = huge(1)
allocate(this%altmax_ever_indx_col (begc:endc)) ; this%altmax_ever_indx_col (:) = huge(1)

allocate(this%dewmx_patch (begp:endp)) ; this%dewmx_patch (:) = spval
allocate(this%dleaf_patch (begp:endp)) ; this%dleaf_patch (:) = spval
Expand Down Expand Up @@ -282,10 +287,17 @@ subroutine InitHistory(this, bounds)
avgflag='A', long_name='maximum prior year active layer thickness', &
ptr_col=this%altmax_lastyear_col)

this%altmax_ever_col(begc:endc) = spval
call hist_addfld1d (fname='ALTMAX_EVER', units='m', &
avgflag='A', long_name='maximum ever active layer thickness throughout simulation', &
ptr_col=this%altmax_ever_col)
if (use_polygonal_tundra) then
this%altmax_1989_col(begc:endc) = spval
call hist_addfld1d (fname='ALTMAX_1989', units='m', &
avgflag='A', long_name='maximum 1989 active layer thickness', &
ptr_col=this%altmax_1989_col)

this%altmax_ever_col(begc:endc) = spval
call hist_addfld1d (fname='ALTMAX_EVER', units='m', &
avgflag='A', long_name='maximum ever active layer thickness throughout simulation', &
ptr_col=this%altmax_ever_col)
end if
end if

! Allow active layer fields to be optionally output even if not running CN
Expand All @@ -306,10 +318,17 @@ subroutine InitHistory(this, bounds)
avgflag='A', long_name='maximum prior year active layer thickness', &
ptr_col=this%altmax_lastyear_col, default='inactive')

this%altmax_ever_col(begc:endc) = spval
call hist_addfld1d (fname='ALTMAX_EVER', units='m', &
avgflag='A', long_name='maximum ever active layer thickness throughout simulation', &
ptr_col=this%altmax_ever_col, default='inactive')
if (use_polygonal_tundra) then
this%altmax_1989_col(begc:endc) = spval
call hist_addfld1d (fname='ALTMAX_1989', units='m', &
avgflag='A', long_name='maximum 1989 active layer thickness', &
ptr_col=this%altmax_1989_col, default='inactive')

this%altmax_ever_col(begc:endc) = spval
call hist_addfld1d (fname='ALTMAX_EVER', units='m', &
avgflag='A', long_name='maximum ever active layer thickness throughout simulation', &
ptr_col=this%altmax_ever_col, default='inactive')
end if
end if

! Accumulated fields
Expand Down Expand Up @@ -516,10 +535,12 @@ subroutine InitCold(this, bounds)
this%alt_col(c) = 0._r8
this%altmax_col(c) = 0._r8
this%altmax_lastyear_col(c) = 0._r8
this%altmax_1989_col(c) = 0._r8
this%altmax_ever_col(c) = 0._r8
this%alt_indx_col(c) = 0
this%altmax_indx_col(c) = 0
this%altmax_lastyear_indx_col(c) = 0
this%altmax_1989_indx_col(c) = 0
this%altmax_ever_indx_col(c) = 0
end if
end do
Expand Down Expand Up @@ -588,19 +609,27 @@ subroutine Restart(this, bounds, ncid, flag)
call restartvar(ncid=ncid, flag=flag, varname='altmax_lastyear', xtype=ncd_double, &
dim1name='column', long_name='', units='', &
interpinic_flag='interp', readvar=readvar, data=this%altmax_lastyear_col)
call restartvar(ncid=ncid, flag=flag, varname='altmax_ever', xtype=ncd_double, &
dim1name='column', long_name='', units='', &
interpinic_flag='interp', readvar=readvar, data=this%altmax_ever_col)
call restartvar(ncid=ncid, flag=flag, varname='altmax_indx', xtype=ncd_int, &
dim1name='column', long_name='', units='', &
interpinic_flag='interp', readvar=readvar, data=this%altmax_indx_col)
call restartvar(ncid=ncid, flag=flag, varname='altmax_lastyear_indx', xtype=ncd_int, &
dim1name='column', long_name='', units='', &
interpinic_flag='interp', readvar=readvar, data=this%altmax_lastyear_indx_col)
call restartvar(ncid=ncid, flag=flag, varname='altmax_ever_indx', xtype=ncd_int, &
dim1name='column', long_name='', units='', &
interpinic_flag='interp', readvar=readvar, data=this%altmax_ever_indx_col)
end if
if (use_polygonal_tundra) then
call restartvar(ncid=ncid, flag=flag, varname='altmax_1989_indx', xtype=ncd_double, &
dim1name='column', long_name='', units='', &
interpinic_flag='interp', readvar=readvar, data=this%altmax_1989_indx_col)
call restartvar(ncid=ncid, flag=flag, varname='altmax_ever_indx', xtype=ncd_int, &
dim1name='column', long_name='', units='', &
interpinic_flag='interp', readvar=readvar, data=this%altmax_ever_indx_col)
call restartvar(ncid=ncid, flag=flag, varname='altmax_1989', xtype=ncd_double, &
dim1name='column', long_name='', units='', &
interpinic_flag='interp', readvar=readvar, data=this%altmax_1989_col)
call restartvar(ncid=ncid, flag=flag, varname='altmax_ever', xtype=ncd_double, &
dim1name='column', long_name='', units='', &
interpinic_flag='interp', readvar=readvar, data=this%altmax_ever_col)
end if ! polygonal tundra
end if ! cn or fates
if ( use_hydrstress ) then
call restartvar(ncid=ncid, flag=flag, varname='vegwp', xtype=ncd_double, &
dim1name='pft', dim2name='vegwcs', switchdim=.true., &
Expand Down
2 changes: 1 addition & 1 deletion components/elm/src/biogeophys/SoilHydrologyMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ subroutine Infiltration(bounds, num_hydrologyc, filter_hydrologyc, num_urbanc, f
use elm_varcon , only : denh2o, denice, roverg, wimp, mu, tfrz
use elm_varcon , only : pondmx, watmin
use column_varcon , only : icol_roof, icol_road_imperv, icol_sunwall, icol_shadewall, icol_road_perv
use landunit_varcon , only : istsoil, istcrop, ilowcenpoly
use landunit_varcon , only : istsoil, istcrop, ilowcenpoly, iflatcenpoly, ihighcenpoly
use elm_time_manager , only : get_step_size, get_nstep
use atm2lndType , only : atm2lnd_type ! land river two way coupling
use lnd2atmType , only : lnd2atm_type
Expand Down
Loading

0 comments on commit 86cebe7

Please sign in to comment.