Skip to content

Commit

Permalink
Merge pull request #2 from rgknox/andre-issue24-fix
Browse files Browse the repository at this point in the history
Modified clm_driver call sequence: ed_drver, EDBGCDyn, EDBGCDynSummary
  • Loading branch information
bandre-ucar committed Apr 3, 2016
2 parents 41a2a3c + b755dc9 commit 8174e7f
Showing 1 changed file with 78 additions and 57 deletions.
135 changes: 78 additions & 57 deletions components/clm/src/main/clm_driver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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, &
Expand All @@ -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

Expand Down Expand Up @@ -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.
Expand All @@ -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
Expand Down

0 comments on commit 8174e7f

Please sign in to comment.