Skip to content

Commit

Permalink
Introduce istocn = 3 and related code
Browse files Browse the repository at this point in the history
  • Loading branch information
slevis-lmwg committed Oct 23, 2023
1 parent 11a7542 commit 83bc76f
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 33 deletions.
16 changes: 4 additions & 12 deletions src/biogeophys/EnergyFluxType.F90
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ subroutine InitAllocate(this, bounds)
!
! !USES:
use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=)
use clm_varpar , only : nlevsno, nlevgrnd, nlevlak
use clm_varpar , only : nlevgrnd
implicit none
!
! !ARGUMENTS:
Expand Down Expand Up @@ -287,7 +287,7 @@ subroutine InitHistory(this, bounds, is_simple_buildtemp, is_prog_buildtemp)
!
! !USES:
use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=)
use clm_varpar , only : nlevsno, nlevgrnd
use clm_varpar , only : nlevgrnd
use clm_varctl , only : use_cn, use_hydrstress
use histFileMod , only : hist_addfld1d, hist_addfld2d, no_snow_normal
use ncdio_pio , only : ncd_inqvdlen
Expand Down Expand Up @@ -700,13 +700,8 @@ subroutine InitCold(this, bounds, t_grnd_col, is_simple_buildtemp, is_prog_build
!
! !USES:
use shr_kind_mod , only : r8 => shr_kind_r8
use shr_const_mod , only : SHR_CONST_TKFRZ
use clm_varpar , only : nlevsoi, nlevgrnd, nlevsno, nlevlak, nlevurb
use clm_varcon , only : denice, denh2o, sb
use landunit_varcon , only : istwet, istsoil, istdlak
use column_varcon , only : icol_road_imperv, icol_roof, icol_sunwall
use column_varcon , only : icol_shadewall, icol_road_perv
use clm_varctl , only : use_vancouver, use_mexicocity
use clm_varpar , only : nlevgrnd
use clm_varcon , only : sb
implicit none
!
! !ARGUMENTS:
Expand Down Expand Up @@ -936,7 +931,6 @@ subroutine InitAccBuffer (this, bounds)
! !USES
use accumulMod , only : init_accum_field
use clm_time_manager , only : get_step_size_real
use shr_const_mod , only : SHR_CONST_CDAY, SHR_CONST_TKFRZ
!
! !ARGUMENTS:
class(energyflux_type) :: this
Expand Down Expand Up @@ -964,7 +958,6 @@ subroutine InitAccVars(this, bounds)
! is read in and the accumulation buffer is obtained)
!
! !USES
use accumulMod , only : init_accum_field, extract_accum_field
use clm_time_manager , only : get_nstep
use clm_varctl , only : nsrest, nsrStartup
use abortutils , only : endrun
Expand Down Expand Up @@ -994,7 +987,6 @@ end subroutine InitAccVars
subroutine UpdateAccVars (this, bounds)
!
! USES
use shr_const_mod , only : SHR_CONST_CDAY, SHR_CONST_TKFRZ
use clm_time_manager , only : get_step_size, get_nstep, is_end_curr_day, get_curr_date
use accumulMod , only : update_accum_field, extract_accum_field, accumResetVal
use abortutils , only : endrun
Expand Down
9 changes: 5 additions & 4 deletions src/main/landunit_varcon.F90
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ module landunit_varcon

integer, parameter, public :: istsoil = 1 !soil landunit type (natural vegetation)
integer, parameter, public :: istcrop = 2 !crop landunit type
! Landunit 3 currently unused (used to be non-multiple elevation class glacier type:
! istice, and landunit 4 was istice_mec; now they are combined into a single landunit
! type, 4)
integer, parameter, public :: istocn = 3 !ocean landunit type
! Landunit 3 used to be non-multiple elevation class glacier type, istice
! Landunit 4 was istice_mec; now landunit 4 and old landunit 3 are combined
! into landunit 4
integer, parameter, public :: istice = 4 !land ice landunit type
integer, parameter, public :: istdlak = 5 !deep lake landunit type (now used for all lakes)
integer, parameter, public :: istwet = 6 !wetland landunit type (swamp, marsh, etc.)
Expand Down Expand Up @@ -118,7 +119,7 @@ subroutine set_landunit_names

landunit_names(istsoil) = 'vegetated_or_bare_soil'
landunit_names(istcrop) = 'crop'
landunit_names(istcrop+1) = unused
landunit_names(istocn) = 'ocean'
landunit_names(istice) = 'landice'
landunit_names(istdlak) = 'deep_lake'
landunit_names(istwet) = 'wetland'
Expand Down
9 changes: 4 additions & 5 deletions src/main/surfrdMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ subroutine surfrd_special(begg, endg, ncid, ns)
!
! !USES:
use clm_varpar , only : maxpatch_glc, nlevurb
use landunit_varcon , only : isturb_MIN, isturb_MAX, istdlak, istwet, istice
use landunit_varcon , only : isturb_MIN, isturb_MAX, istdlak, istwet, istice, istocn
use clm_instur , only : wt_lunit, urban_valid, wt_glc_mec, topo_glc_mec
use UrbanParamsType , only : CheckUrban
!
Expand Down Expand Up @@ -507,10 +507,9 @@ subroutine surfrd_special(begg, endg, ncid, ns)

! Until ctsm5.1 we would label ocean points as wetland in fsurdat
! files. Starting with ctsm5.2 we label ocean points as ocean
! (always 100%) and wetland points as wetland. Here we merge them
! again to keep model behavior unchanged for now.
wt_lunit(nl,istwet) = (pctocn(nl) + pctwet(nl)) / 100._r8

! (always 100%) and wetland points as wetland.
wt_lunit(nl,istwet) = pctwet(nl) / 100._r8
wt_lunit(nl,istocn) = pctocn(nl) / 100._r8
wt_lunit(nl,istice) = pctgla(nl) / 100._r8

do n = isturb_MIN, isturb_MAX
Expand Down
19 changes: 7 additions & 12 deletions src/main/surfrdUtilsMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,15 @@ end subroutine renormalize
subroutine apply_convert_ocean_to_land(wt_lunit, begg, endg)
!
! !DESCRIPTION:
! Apply the conversion of ocean points to land, by changing all "wetland" points to
! natveg; typically this will result in these points becoming bare ground.
! Convert ocean points to land by changing ocean to natveg;
! typically these points will become bare ground.
!
! The motivation for doing this is to avoid the negative runoff that sometimes comes
! Originally ocean points were assigned to wetland, so the motivation for
! for this subroutine was to avoid the negative runoff that sometimes comes
! from wetlands.
!
! !USES:
use landunit_varcon, only : istsoil, istwet, max_lunit
use landunit_varcon, only : istsoil, istocn, max_lunit
!
! !ARGUMENTS:
integer, intent(in) :: begg ! Beginning grid cell index
Expand All @@ -138,15 +139,9 @@ subroutine apply_convert_ocean_to_land(wt_lunit, begg, endg)
character(len=*), parameter :: subname = 'apply_convert_ocean_to_land'
!-----------------------------------------------------------------------

! BUG(wjs, 2022-10-27, ESCOMP/CTSM#1886) Ideally we would distinguish between ocean
! vs. true wetland points on the surface dataset; for now oceans are included in the
! wetland area on the surface dataset, so we convert all wetlands to land. (Typically
! there are no true/inland wetlands on the surface dataset, so this is currently okay,
! but this would become a problem if we started having inland wetlands on the surface
! dataset again.)
do g = begg, endg
wt_lunit(g,istsoil) = wt_lunit(g,istsoil) + wt_lunit(g,istwet)
wt_lunit(g,istwet) = 0._r8
wt_lunit(g,istsoil) = wt_lunit(g,istsoil) + wt_lunit(g,istocn)
wt_lunit(g,istocn) = 0._r8
end do

end subroutine apply_convert_ocean_to_land
Expand Down

0 comments on commit 83bc76f

Please sign in to comment.