From b755dc9543ae60e4536e294be911011183362708 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Fri, 1 Apr 2016 15:37:48 -0700 Subject: [PATCH] After discussion with CDK, modified clm_driver call sequence to be ed_driver, EDBGCDyn and then EDBGCDynSummary --- components/clm/src/main/clm_driver.F90 | 135 ++++++++++++++----------- 1 file changed, 78 insertions(+), 57 deletions(-) diff --git a/components/clm/src/main/clm_driver.F90 b/components/clm/src/main/clm_driver.F90 index d4f24c302a..f7c81deb0f 100644 --- a/components/clm/src/main/clm_driver.F90 +++ b/components/clm/src/main/clm_driver.F90 @@ -693,7 +693,7 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate) cnveg_state_inst, cnveg_carbonflux_inst) call t_stopf('ecosysdyn') - elseif (use_ed) then +! elseif (use_ed) then ! call EDBGCDyn(bounds_clump, & ! filter(nc)%num_soilc, filter(nc)%soilc, & @@ -704,20 +704,20 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate) ! soilbiogeochem_state_inst, & ! soilbiogeochem_nitrogenflux_inst, soilbiogeochem_nitrogenstate_inst) - call EDBGCDyn(bounds_clump, & - filter(nc)%num_soilc, filter(nc)%soilc, & - filter(nc)%num_soilp, filter(nc)%soilp, & - filter(nc)%num_pcropp, filter(nc)%pcropp, doalb, & - cnveg_state_inst, & - cnveg_carbonflux_inst, cnveg_carbonstate_inst, & - ed_clm_inst, & - soilbiogeochem_carbonflux_inst, soilbiogeochem_carbonstate_inst, & - soilbiogeochem_state_inst, & - soilbiogeochem_nitrogenflux_inst, soilbiogeochem_nitrogenstate_inst, & - c13_soilbiogeochem_carbonstate_inst, c13_soilbiogeochem_carbonflux_inst, & - c14_soilbiogeochem_carbonstate_inst, c14_soilbiogeochem_carbonflux_inst, & - atm2lnd_inst, waterstate_inst, waterflux_inst, & - canopystate_inst, soilstate_inst, temperature_inst, crop_inst, ch4_inst) +! call EDBGCDyn(bounds_clump, & +! filter(nc)%num_soilc, filter(nc)%soilc, & +! filter(nc)%num_soilp, filter(nc)%soilp, & +! filter(nc)%num_pcropp, filter(nc)%pcropp, doalb, & +! cnveg_state_inst, & +! cnveg_carbonflux_inst, cnveg_carbonstate_inst, & +! ed_clm_inst, & +! soilbiogeochem_carbonflux_inst, soilbiogeochem_carbonstate_inst, & +! soilbiogeochem_state_inst, & +! soilbiogeochem_nitrogenflux_inst, soilbiogeochem_nitrogenstate_inst, & +! c13_soilbiogeochem_carbonstate_inst, c13_soilbiogeochem_carbonflux_inst, & +! c14_soilbiogeochem_carbonstate_inst, c14_soilbiogeochem_carbonflux_inst, & +! atm2lnd_inst, waterstate_inst, waterflux_inst, & +! canopystate_inst, soilstate_inst, temperature_inst, crop_inst, ch4_inst) end if @@ -782,7 +782,7 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate) ! vegetation structure (LAI, SAI, height) ! ============================================================================ - if (use_cn) then + if (use_cn) then ! Update the nitrogen leaching rate as a function of soluble mineral N ! and total soil water outflow. @@ -793,59 +793,80 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate) waterstate_inst, waterflux_inst, & cnveg_nitrogenflux_inst, cnveg_nitrogenstate_inst, & SoilBiogeochem_nitrogenflux_inst, SoilBiogeochem_nitrogenstate_inst) - + ! Call to all CN summary routines call CNDriverSummary(bounds_clump, & - filter(nc)%num_soilc, filter(nc)%soilc, & - filter(nc)%num_soilp, filter(nc)%soilp, & - cnveg_state_inst, cnveg_carbonflux_inst, cnveg_carbonstate_inst, & - c13_cnveg_carbonflux_inst, c13_cnveg_carbonstate_inst, & - c14_cnveg_carbonflux_inst, c14_cnveg_carbonstate_inst, & - cnveg_nitrogenflux_inst, cnveg_nitrogenstate_inst, & - soilbiogeochem_carbonflux_inst, soilbiogeochem_carbonstate_inst, & - c13_soilbiogeochem_carbonflux_inst, c13_soilbiogeochem_carbonstate_inst, & - c14_soilbiogeochem_carbonflux_inst, c14_soilbiogeochem_carbonstate_inst, & - soilbiogeochem_nitrogenflux_inst, soilbiogeochem_nitrogenstate_inst) + filter(nc)%num_soilc, filter(nc)%soilc, & + filter(nc)%num_soilp, filter(nc)%soilp, & + cnveg_state_inst, cnveg_carbonflux_inst, cnveg_carbonstate_inst, & + c13_cnveg_carbonflux_inst, c13_cnveg_carbonstate_inst, & + c14_cnveg_carbonflux_inst, c14_cnveg_carbonstate_inst, & + cnveg_nitrogenflux_inst, cnveg_nitrogenstate_inst, & + soilbiogeochem_carbonflux_inst, soilbiogeochem_carbonstate_inst, & + c13_soilbiogeochem_carbonflux_inst, c13_soilbiogeochem_carbonstate_inst, & + c14_soilbiogeochem_carbonflux_inst, c14_soilbiogeochem_carbonstate_inst, & + soilbiogeochem_nitrogenflux_inst, soilbiogeochem_nitrogenstate_inst) ! On the radiation time step, use C state variables to calculate ! vegetation structure (LAI, SAI, height) - if (doalb) then - call CNVegStructUpdate(filter(nc)%num_soilp, filter(nc)%soilp, & - waterstate_inst, frictionvel_inst, dgvs_inst, cnveg_state_inst, & - cnveg_carbonstate_inst, canopystate_inst) - end if - + if (doalb) then + call CNVegStructUpdate(filter(nc)%num_soilp, filter(nc)%soilp, & + waterstate_inst, frictionvel_inst, dgvs_inst, cnveg_state_inst, & + cnveg_carbonstate_inst, canopystate_inst) end if + end if + + - if ( use_ed ) then - call EDBGCDynSummary(bounds_clump, & - filter(nc)%num_soilc, filter(nc)%soilc, & - filter(nc)%num_soilp, filter(nc)%soilp, & - soilbiogeochem_carbonflux_inst, soilbiogeochem_carbonstate_inst, & - c13_soilbiogeochem_carbonflux_inst, c13_soilbiogeochem_carbonstate_inst, & - c14_soilbiogeochem_carbonflux_inst, c14_soilbiogeochem_carbonstate_inst, & - soilbiogeochem_nitrogenflux_inst, soilbiogeochem_nitrogenstate_inst, & - ed_clm_inst, ed_allsites_inst(bounds_clump%begg:bounds_clump%endg)) + if ( use_ed .and. is_beg_curr_day() ) then ! run ED at the start of each day + + if ( masterproc ) then + write(iulog,*) 'clm: calling ED model ', get_nstep() end if + + call ed_driver( bounds_clump, & + ed_allsites_inst(bounds_clump%begg:bounds_clump%endg), & + ed_clm_inst, ed_phenology_inst, & + atm2lnd_inst, soilstate_inst, temperature_inst, & + waterstate_inst, canopystate_inst) + + call setFilters( bounds_clump, glc2lnd_inst%icemask_grc ) + + end if ! use_ed branch + + + if ( use_ed ) then + + call EDBGCDyn(bounds_clump, & + filter(nc)%num_soilc, filter(nc)%soilc, & + filter(nc)%num_soilp, filter(nc)%soilp, & + filter(nc)%num_pcropp, filter(nc)%pcropp, doalb, & + cnveg_state_inst, & + cnveg_carbonflux_inst, cnveg_carbonstate_inst, & + ed_clm_inst, & + soilbiogeochem_carbonflux_inst, soilbiogeochem_carbonstate_inst, & + soilbiogeochem_state_inst, & + soilbiogeochem_nitrogenflux_inst, soilbiogeochem_nitrogenstate_inst, & + c13_soilbiogeochem_carbonstate_inst, c13_soilbiogeochem_carbonflux_inst, & + c14_soilbiogeochem_carbonstate_inst, c14_soilbiogeochem_carbonflux_inst, & + atm2lnd_inst, waterstate_inst, waterflux_inst, & + canopystate_inst, soilstate_inst, temperature_inst, crop_inst, ch4_inst) + + + call EDBGCDynSummary(bounds_clump, & + filter(nc)%num_soilc, filter(nc)%soilc, & + filter(nc)%num_soilp, filter(nc)%soilp, & + soilbiogeochem_carbonflux_inst, soilbiogeochem_carbonstate_inst, & + c13_soilbiogeochem_carbonflux_inst, c13_soilbiogeochem_carbonstate_inst, & + c14_soilbiogeochem_carbonflux_inst, c14_soilbiogeochem_carbonstate_inst, & + soilbiogeochem_nitrogenflux_inst, soilbiogeochem_nitrogenstate_inst, & + ed_clm_inst, ed_allsites_inst(bounds_clump%begg:bounds_clump%endg)) + end if + - if ( use_ed .and. is_beg_curr_day() ) then ! run ED at the start of each day - - if ( masterproc ) then - write(iulog,*) 'clm: calling ED model ', get_nstep() - end if - - call ed_driver( bounds_clump, & - ed_allsites_inst(bounds_clump%begg:bounds_clump%endg), & - ed_clm_inst, ed_phenology_inst, & - atm2lnd_inst, soilstate_inst, temperature_inst, & - waterstate_inst, canopystate_inst) - - call setFilters( bounds_clump, glc2lnd_inst%icemask_grc ) - - end if ! use_ed branch ! ============================================================================ ! Check the energy and water balance and also carbon and nitrogen balance