Skip to content

Commit

Permalink
Change variable haslake to pct_lake_max throughout
Browse files Browse the repository at this point in the history
  • Loading branch information
slevis-lmwg committed Oct 4, 2022
1 parent ac53754 commit ea5dbae
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
do_transient_lakes = .true.

! This file was created with the following command:
! ncap2 -s 'PCT_LAKE=array(0.0,0.0,PCT_CROP); PCT_LAKE={0.,50.,25.,25.,25.,25.}; HASLAKE=array(1.,1.,AREA); PCT_CROP=array(0.0,0.0,PCT_LAKE); PCT_CROP={0.,25.,12.,12.,12.,12.}' landuse.timeseries_1x1_smallvilleIA_hist_78pfts_simyr1850-1855_c160127.nc landuse.timeseries_1x1_smallvilleIA_hist_78pfts_simyr1850-1855_dynLakes_c200928.nc
! ncap2 -s 'PCT_LAKE=array(0.0,0.0,PCT_CROP); PCT_LAKE={0.,50.,25.,25.,25.,25.}; PCT_LAKE_MAX=array(1.,1.,AREA); PCT_CROP=array(0.0,0.0,PCT_LAKE); PCT_CROP={0.,25.,12.,12.,12.,12.}' landuse.timeseries_1x1_smallvilleIA_hist_78pfts_simyr1850-1855_c160127.nc landuse.timeseries_1x1_smallvilleIA_hist_78pfts_simyr1850-1855_dynLakes_c200928.nc
! Key points are that lake area starts as 0, increases after the first year, then decreases after the second year.
! PCT_CROP is also changed so that PCT_LAKE + PCT_CROP <= 100. (Here, PCT_CROP increases and decreases at the same time as PCT_LAKE in order to exercise the simultaneous increase or decrease of two landunits, but that isn't a critical part of this test.)
! Note that the use of this file means that this testmod can only be used with the 1x1_smallvilleIA grid.
Expand Down
6 changes: 3 additions & 3 deletions src/main/clm_initializeMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module clm_initializeMod
use clm_varctl , only : use_lch4, use_cn, use_cndv, use_c13, use_c14, use_fates
use clm_varctl , only : use_soil_moisture_streams
use clm_instur , only : wt_lunit, urban_valid, wt_nat_patch, wt_cft, fert_cft
use clm_instur , only : irrig_method, wt_glc_mec, topo_glc_mec, haslake, pct_urban_max
use clm_instur , only : irrig_method, wt_glc_mec, topo_glc_mec, pct_lake_max, pct_urban_max
use perf_mod , only : t_startf, t_stopf
use readParamsMod , only : readParameters
use ncdio_pio , only : file_desc_t
Expand Down Expand Up @@ -218,7 +218,7 @@ subroutine initialize2(ni,nj)
allocate (irrig_method (begg:endg, cft_lb:cft_ub ))
allocate (wt_glc_mec (begg:endg, maxpatch_glc ))
allocate (topo_glc_mec (begg:endg, maxpatch_glc ))
allocate (haslake (begg:endg ))
allocate (pct_lake_max (begg:endg ))
allocate (pct_urban_max(begg:endg, numurbl ))

! Read list of Patches and their corresponding parameter values
Expand Down Expand Up @@ -295,7 +295,7 @@ subroutine initialize2(ni,nj)
! Some things are kept until the end of initialize2; urban_valid is kept through the
! end of the run for error checking, pct_urban_max is kept through the end of the run
! for reweighting in subgridWeights.
deallocate (wt_lunit, wt_cft, wt_glc_mec, haslake)
deallocate (wt_lunit, wt_cft, wt_glc_mec, pct_lake_max)

! Determine processor bounds and clumps for this processor
call get_proc_bounds(bounds_proc)
Expand Down
2 changes: 1 addition & 1 deletion src/main/clm_varsur.F90
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ module clm_instur
real(r8), pointer :: topo_glc_mec(:,:)

! whether we have lake to initialise in each grid cell
logical , pointer :: haslake(:)
real(r8), pointer :: pct_lake_max(:)

! whether we have urban to initialize in each grid cell
! (second dimension goes 1:numurbl)
Expand Down
10 changes: 5 additions & 5 deletions src/main/subgridMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -568,11 +568,11 @@ function lake_landunit_exists(gi) result(exists)
!
! !DESCRIPTION:
! Returns true if a land unit for lakes should be created in memory
! which is defined for gridcells which will grow lake, given by haslake
! which is defined for gridcells which will grow lake, given by pct_lake_max
!
! !USES:
use dynSubgridControlMod , only : get_do_transient_lakes
use clm_instur , only : haslake
use clm_instur , only : pct_lake_max
!
! !ARGUMENTS:
logical :: exists ! function result
Expand All @@ -584,10 +584,10 @@ function lake_landunit_exists(gi) result(exists)
!-----------------------------------------------------------------------

if (get_do_transient_lakes()) then
! To support dynamic landunits, we initialise a lake land unit in each grid cell in which there are lakes.
! This is defined by the haslake variable
! To support dynamic landunits, we initialise a lake land unit in
! each grid cell in which there are lakes as defined by pct_lake_max

if (haslake(gi)) then
if (pct_lake_max(gi) > 0._r8) then
exists = .true.
else
exists = .false.
Expand Down
6 changes: 3 additions & 3 deletions src/main/surfrdMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,7 @@ subroutine surfrd_lakemask(begg, endg)
! Necessary for the initialisation of the lake land units
!
! !USES:
use clm_instur , only : haslake
use clm_instur , only : pct_lake_max
use dynSubgridControlMod , only : get_flanduse_timeseries
use clm_varctl , only : fname_len
use fileutils , only : getfil
Expand Down Expand Up @@ -836,9 +836,9 @@ subroutine surfrd_lakemask(begg, endg)
call ncd_pio_openfile (ncid_dynuse, trim(locfn), 0)

! read the lakemask
call ncd_io(ncid=ncid_dynuse, varname='HASLAKE' , flag='read', data=haslake, &
call ncd_io(ncid=ncid_dynuse, varname='PCT_LAKE_MAX' , flag='read', data=pct_lake_max, &
dim1name=grlnd, readvar=readvar)
if (.not. readvar) call endrun( msg=' ERROR: HASLAKE is not on landuse.timeseries file'//errMsg(sourcefile, __LINE__))
if (.not. readvar) call endrun( msg=' ERROR: PCT_LAKE_MAX is not on landuse.timeseries file'//errMsg(sourcefile, __LINE__))

! close landuse_timeseries file again
call ncd_pio_closefile(ncid_dynuse)
Expand Down

0 comments on commit ea5dbae

Please sign in to comment.