Skip to content

Commit

Permalink
Interface: completes the removal of EDCLMLinkMod
Browse files Browse the repository at this point in the history
Merge branch 'rgknox-CLMLink2' into master

This change-group completes the removal of EDCLMLinkMod. It does this
by splitting the portions of ed_clm_link() that update FATES internal
structures and those that update HLM structures, and pushing those
into appropriate places and having them called by an interface
wrapper.

There was one slight complication that prevented perfect B4B
regressions. EDCLMLink stored two globally accessible parameters
cwd_fcel_ed and cwd_fliq_ed, which were set during BGC and CN type
soil biogechemistry reads. These global parameters should not be
accessible in those parts of the code and those parameters should have
their own entries in the ED/FATES parameter file (indicated in the
issue already). Nonetheless, they values in the parameter file were
recorded and migrated to the FATES function where they are currently
used temporarily, until we have the new parameter file system in
place. Specifying the parameters as constants in the code itself
rather than reading the parameter values from a file is creating
slight differences in TOTLITC on the order of 10-10 to 10-14. No other
variables are showing differences against regressions on lawrencium.

Fixes: none
User interface changes?: none

Code review: @rgknox, @ckoven

Testing:

  rgknox

    Test suite: lawrencium-lr3
    Test baseline: 3335811
    Test namelist changes:

    Test answer changes: B4B except TOTLITC on
    SMS_D_Ld5.f45_f45.ICLM45ED.lawrencium-lr3_intel.clm-edTest
    ERS_D_Ld5.f45_g37.ICLM45ED.lawrencium-lr3_intel.clm-edTest
    SMS_D_Lm6.f45_f45.ICLM45ED.lawrencium-lr3_intel.clm-edTest

    Test summary: all PASS

  andre:
    Test suite: clm_short - yellowstone gnu, intel, pgi
    Test baseline: clm4_5_12_r195
    Test namelist changes: none
    Test answer changes: bit for bit
    Test summary: all tests pass

    Test suite: ed - yellowstone gnu, intel, pgi
    Test baseline: 3335811
    Test namelist changes: none
    Test answer changes: TOTLITC changes answers in some simulations,
                         see above, otherwise bit for bit.

    Test summary: ok. All tests pass functionality, bit for bit except
                  for TOTLITC in:
              ERS_D_Ld5.f45_g37.ICLM45ED.yellowstone_gnu.clm-edTest
              ERS_D_Ld5.f45_g37.ICLM45ED.yellowstone_intel.clm-edTest
              ERS_D_Ld5.f45_g37.ICLM45ED.yellowstone_pgi.clm-edTest
              SMS_D_Ld5.f45_f45.ICLM45ED.yellowstone_gnu.clm-edTest
              SMS_D_Ld5.f45_f45.ICLM45ED.yellowstone_intel.clm-edTest
              SMS_D_Ld5.f45_f45.ICLM45ED.yellowstone_pgi.clm-edTest
              SMS_D_Lm6.f45_f45.ICLM45ED.yellowstone_gnu.clm-edTest
              SMS_D_Lm6.f45_f45.ICLM45ED.yellowstone_intel.clm-edTest
              SMS_D_Lm6.f45_f45.ICLM45ED.yellowstone_pgi.clm-edTest
  • Loading branch information
bandre-ucar committed Oct 10, 2016
2 parents 3335811 + f9d9847 commit 49733e8
Show file tree
Hide file tree
Showing 15 changed files with 957 additions and 949 deletions.
2 changes: 1 addition & 1 deletion cime/cime_config/cesm/machines/config_machines.xml
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,7 @@
</walltimes>
</batch_system>
<mpirun mpilib="mpi-serial">
<executable>mpirun</executable>
<executable></executable>
<arguments>
<arg name="num_tasks">-np {{ num_tasks }}</arg>
<arg name="tasks_per_node"> -npernode {{ tasks_per_node }}</arg>
Expand Down
707 changes: 678 additions & 29 deletions components/clm/src/ED/biogeochem/EDCanopyStructureMod.F90

Large diffs are not rendered by default.

25 changes: 16 additions & 9 deletions components/clm/src/ED/biogeochem/EDPhysiologyMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1290,7 +1290,9 @@ subroutine flux_into_litter_pools(nsites, sites, bc_in, bc_out)

use EDTypesMod, only : AREA, numpft_ed, cp_numlevdecomp_full, cp_numlevdecomp
use SoilBiogeochemVerticalProfileMod, only: surfprof_exp
use EDCLMLinkMod, only: cwd_fcel_ed, cwd_flig_ed

!use EDCLMLinkMod, only: cwd_fcel_ed, cwd_flig

use pftconMod, only : pftcon
use shr_const_mod, only: SHR_CONST_CDAY
use clm_varcon, only : zisoi, dzsoi_decomp, zsoi
Expand Down Expand Up @@ -1349,6 +1351,11 @@ subroutine flux_into_litter_pools(nsites, sites, bc_in, bc_out)
real(r8) :: froot_prof(1:nsites, 1:numpft_ed, 1:cp_numlevdecomp)
real(r8) :: croot_prof(1:nsites, 1:cp_numlevdecomp)
real(r8) :: stem_prof(1:nsites, 1:cp_numlevdecomp)

! INTERF-TODO: THESE PARAMETERS WERE ORIGINALLY SET BY params_inst%
! THEY NEED THEIR OWN ENTRIES IN THE PARAMETER FILE (RGK)
real(r8), parameter :: cwd_fcel = 0.76
real(r8), parameter :: cwd_flig = 0.24


delta = 0.001_r8
Expand Down Expand Up @@ -1571,26 +1578,26 @@ subroutine flux_into_litter_pools(nsites, sites, bc_in, bc_out)
! now disaggregate, vertically and by decomposition substrate type, the actual fluxes from CWD and litter pools
!
! do c = 1, ncwd
! write(iulog,*)'cdk CWD_AG_out', c, currentpatch%CWD_AG_out(c), cwd_fcel_ed, currentpatch%area/AREA
! write(iulog,*)'cdk CWD_BG_out', c, currentpatch%CWD_BG_out(c), cwd_fcel_ed, currentpatch%area/AREA
! write(iulog,*)'cdk CWD_AG_out', c, currentpatch%CWD_AG_out(c), cwd_fcel, currentpatch%area/AREA
! write(iulog,*)'cdk CWD_BG_out', c, currentpatch%CWD_BG_out(c), cwd_fcel, currentpatch%area/AREA
! end do
! do ft = 1,numpft_ed
! write(iulog,*)'cdk leaf_litter_out', ft, currentpatch%leaf_litter_out(ft), cwd_fcel_ed, currentpatch%area/AREA
! write(iulog,*)'cdk root_litter_out', ft, currentpatch%root_litter_out(ft), cwd_fcel_ed, currentpatch%area/AREA
! write(iulog,*)'cdk leaf_litter_out', ft, currentpatch%leaf_litter_out(ft), cwd_fcel, currentpatch%area/AREA
! write(iulog,*)'cdk root_litter_out', ft, currentpatch%root_litter_out(ft), cwd_fcel, currentpatch%area/AREA
! end do
! !
! CWD pools fragmenting into decomposing litter pools.
do ci = 1, ncwd
do j = 1, cp_numlevdecomp
bc_out(s)%FATES_c_to_litr_cel_c_col(j) = bc_out(s)%FATES_c_to_litr_cel_c_col(j) + &
currentpatch%CWD_AG_out(ci) * cwd_fcel_ed * currentpatch%area/AREA * stem_prof(s,j)
currentpatch%CWD_AG_out(ci) * cwd_fcel * currentpatch%area/AREA * stem_prof(s,j)
bc_out(s)%FATES_c_to_litr_lig_c_col(j) = bc_out(s)%FATES_c_to_litr_lig_c_col(j) + &
currentpatch%CWD_AG_out(ci) * cwd_flig_ed * currentpatch%area/AREA * stem_prof(s,j)
currentpatch%CWD_AG_out(ci) * cwd_flig * currentpatch%area/AREA * stem_prof(s,j)
!
bc_out(s)%FATES_c_to_litr_cel_c_col(j) = bc_out(s)%FATES_c_to_litr_cel_c_col(j) + &
currentpatch%CWD_BG_out(ci) * cwd_fcel_ed * currentpatch%area/AREA * croot_prof_perpatch(j)
currentpatch%CWD_BG_out(ci) * cwd_fcel * currentpatch%area/AREA * croot_prof_perpatch(j)
bc_out(s)%FATES_c_to_litr_lig_c_col(j) = bc_out(s)%FATES_c_to_litr_lig_c_col(j) + &
currentpatch%CWD_BG_out(ci) * cwd_flig_ed * currentpatch%area/AREA * croot_prof_perpatch(j)
currentpatch%CWD_BG_out(ci) * cwd_flig * currentpatch%area/AREA * croot_prof_perpatch(j)
end do
end do

Expand Down
3 changes: 1 addition & 2 deletions components/clm/src/ED/biogeophys/EDPhotosynthesisMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ subroutine Photosynthesis_ED (nsites, sites,bc_in,bc_out,dtime)
use EDtypesMod , only : numpatchespercol, cp_nlevcan, cp_nclmax
use EDCanopyStructureMod,only: calc_areaindex


!
! !ARGUMENTS:
integer,intent(in) :: nsites
Expand Down Expand Up @@ -774,7 +773,7 @@ subroutine Photosynthesis_ED (nsites, sites,bc_in,bc_out,dtime)
! Unpack fluxes from arrays into cohorts
!==============================================================================!

call currentPatch%set_root_fraction()
call currentPatch%set_root_fraction(bc_in(s)%depth_gl)

if(currentPatch%countcohorts > 0.0)then !avoid errors caused by empty patches

Expand Down
Loading

0 comments on commit 49733e8

Please sign in to comment.