Skip to content

Commit

Permalink
Made handle do_transient_lakes to use in namelist for enabling the dy…
Browse files Browse the repository at this point in the history
…namic lake land unit. Use similar to do_transient_crops
  • Loading branch information
Inne Vanderkelen authored and billsacks committed Jun 19, 2020
1 parent 8862554 commit 939fa4d
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 5 deletions.
6 changes: 6 additions & 0 deletions bld/namelist_files/namelist_definition_ctsm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2426,6 +2426,12 @@ If TRUE, apply transient crops from flanduse_timeseries file.
(Only valid for transient runs, where there is a flanduse_timeseries file.)
</entry>

<entry id="do_transient_lakes" type="logical" category="physics"
group="dynamic_subgrid" valid_values="" >
If TRUE, apply transient lakes from flanduse_timeseries file.
(Only valid for transient runs, where there is a flanduse_timeseries file.)
</entry>

<entry id="do_harvest" type="logical" category="physics"
group="dynamic_subgrid" valid_values="" >
If TRUE, apply harvest from flanduse_timeseries file.
Expand Down
32 changes: 32 additions & 0 deletions src/dyn_subgrid/dynSubgridControlMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ module dynSubgridControlMod
public :: get_flanduse_timeseries ! return the value of the flanduse_timeseries file name
public :: get_do_transient_pfts ! return the value of the do_transient_pfts control flag
public :: get_do_transient_crops ! return the value of the do_transient_crops control flag
public :: get_do_transient_lakes ! return the value of the do_transient_lakes control flag
public :: run_has_transient_landcover ! returns true if any aspects of prescribed transient landcover are enabled
public :: get_do_harvest ! return the value of the do_harvest control flag
public :: get_reset_dynbal_baselines ! return the value of the reset_dynbal_baselines control flag
Expand All @@ -40,6 +41,7 @@ module dynSubgridControlMod
character(len=fname_len) :: flanduse_timeseries = ' ' ! transient landuse dataset
logical :: do_transient_pfts = .false. ! whether to apply transient natural PFTs from dataset
logical :: do_transient_crops = .false. ! whether to apply transient crops from dataset
logical :: do_transient_lakes = .false. ! whether to apply transient lakes from dataset
logical :: do_harvest = .false. ! whether to apply harvest from dataset

logical :: reset_dynbal_baselines = .false. ! whether to reset baseline values of total column water and energy in the first step of the run
Expand Down Expand Up @@ -116,6 +118,7 @@ subroutine read_namelist( NLFilename )
character(len=fname_len) :: flanduse_timeseries
logical :: do_transient_pfts
logical :: do_transient_crops
logical :: do_transient_lakes
logical :: do_harvest
logical :: reset_dynbal_baselines
logical :: for_testing_allow_non_annual_changes
Expand All @@ -131,6 +134,7 @@ subroutine read_namelist( NLFilename )
flanduse_timeseries, &
do_transient_pfts, &
do_transient_crops, &
do_transient_lakes, &
do_harvest, &
reset_dynbal_baselines, &
for_testing_allow_non_annual_changes, &
Expand All @@ -140,6 +144,7 @@ subroutine read_namelist( NLFilename )
flanduse_timeseries = ' '
do_transient_pfts = .false.
do_transient_crops = .false.
do_transient_lakes = .false.
do_harvest = .false.
reset_dynbal_baselines = .false.
for_testing_allow_non_annual_changes = .false.
Expand All @@ -164,6 +169,7 @@ subroutine read_namelist( NLFilename )
call shr_mpi_bcast (flanduse_timeseries, mpicom)
call shr_mpi_bcast (do_transient_pfts, mpicom)
call shr_mpi_bcast (do_transient_crops, mpicom)
call shr_mpi_bcast (do_transient_lakes, mpicom)
call shr_mpi_bcast (do_harvest, mpicom)
call shr_mpi_bcast (reset_dynbal_baselines, mpicom)
call shr_mpi_bcast (for_testing_allow_non_annual_changes, mpicom)
Expand All @@ -173,6 +179,7 @@ subroutine read_namelist( NLFilename )
flanduse_timeseries = flanduse_timeseries, &
do_transient_pfts = do_transient_pfts, &
do_transient_crops = do_transient_crops, &
do_transient_lakes = do_transient_lakes, &
do_harvest = do_harvest, &
reset_dynbal_baselines = reset_dynbal_baselines, &
for_testing_allow_non_annual_changes = for_testing_allow_non_annual_changes, &
Expand Down Expand Up @@ -218,6 +225,11 @@ subroutine check_namelist_consistency
write(iulog,*) 'a flanduse_timeseries file (currently flanduse_timeseries is blank)'
call endrun(msg=errMsg(sourcefile, __LINE__))
end if
if (dyn_subgrid_control_inst%do_transient_lakes) then
write(iulog,*) 'ERROR: do_transient_lakes can only be true if you are running with'
write(iulog,*) 'a flanduse_timeseries file (currently flanduse_timeseries is blank)'
call endrun(msg=errMsg(sourcefile, __LINE__))
end if
if (dyn_subgrid_control_inst%do_harvest) then
write(iulog,*) 'ERROR: do_harvest can only be true if you are running with'
write(iulog,*) 'a flanduse_timeseries file (currently flanduse_timeseries is blank)'
Expand Down Expand Up @@ -277,6 +289,14 @@ subroutine check_namelist_consistency
end if
end if

if (dyn_subgrid_control_inst%do_transient_lakes) then
if (use_fates) then
write(iulog,*) 'ERROR: do_transient_lakes currently does not work with use_fates'
call endrun(msg=errMsg(sourcefile, __LINE__))
end if
end if


end subroutine check_namelist_consistency

!-----------------------------------------------------------------------
Expand Down Expand Up @@ -316,6 +336,18 @@ logical function get_do_transient_crops()
get_do_transient_crops = dyn_subgrid_control_inst%do_transient_crops

end function get_do_transient_crops

!-----------------------------------------------------------------------
logical function get_do_transient_lakes()
! !DESCRIPTION:
! Return the value of the do_transient_lakes control flag
!-----------------------------------------------------------------------

SHR_ASSERT(dyn_subgrid_control_inst%initialized, errMsg(sourcefile, __LINE__))

get_do_transient_lakes = dyn_subgrid_control_inst%do_transient_lakes

end function get_do_transient_lakes

!-----------------------------------------------------------------------
logical function run_has_transient_landcover()
Expand Down
9 changes: 4 additions & 5 deletions src/dyn_subgrid/dynSubgridDriverMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module dynSubgridDriverMod
use decompMod , only : bounds_type, BOUNDS_LEVEL_PROC, BOUNDS_LEVEL_CLUMP
use decompMod , only : get_proc_clumps, get_clump_bounds
use dynSubgridControlMod , only : get_flanduse_timeseries
use dynSubgridControlMod , only : get_do_transient_pfts, get_do_transient_crops
use dynSubgridControlMod , only : get_do_transient_pfts, get_do_transient_crops, get_do_transient_lakes
use dynSubgridControlMod , only : get_do_harvest
use dynPriorWeightsMod , only : prior_weights_type
use dynPatchStateUpdaterMod , only : patch_state_updater_type
Expand Down Expand Up @@ -256,10 +256,9 @@ subroutine dynSubgrid_driver(bounds_proc,
call dynHarvest_interp(bounds_proc)
end if

! add lake interp (condition to be added later)

call dynlake_interp(bounds_proc)

if (get_do_transient_lakes()) then
call dynlake_interp(bounds_proc)
end if
! ==========================================================================
! Do land cover change that does not require I/O
! ==========================================================================
Expand Down

0 comments on commit 939fa4d

Please sign in to comment.