Skip to content

Commit

Permalink
Merge branch 'thorntonpe/lnd/archv2_cols' (PR #2742)
Browse files Browse the repository at this point in the history
Implement ELM v2 data architecture for mass and energy state
and flux variables

Migrates mass and energy state and flux variables from CLM4.5
data structures, which mixed variables at multiple subgrid
levels, to ELM v2 data structures, which separate the variables
according to subgrid level. For example, carbon state variables
are moved from a single type into three distinct types, one for
gridcell-level, one for column-level, and one for vegetation
(patch)-level variables. Methods acting on these types are also
defined independently for each subgrid level. Migrates all energy,
water, carbon, nitrogen, and phosphorus state and flux variables
and data-type methods.

Leaves open the issue of how to structure subroutine calling
interfaces. The original code uses a variety of methods. Here, an
example is provided for the module biogeochem/CNCStateUpdate1Mod.F90
and all its upstream calls, based on explicit references to data
type instances at the clm_driver() level, and passed references at
all lower levels.

Branch tests bit-for-bit against the E3SM land developer test suite.

[BFB]
  • Loading branch information
jqyin committed Mar 12, 2019
2 parents 8a8eefb + 33ccf67 commit 1bf22e3
Show file tree
Hide file tree
Showing 138 changed files with 32,062 additions and 24,885 deletions.
741 changes: 373 additions & 368 deletions components/clm/src/biogeochem/AllocationMod.F90

Large diffs are not rendered by default.

19 changes: 7 additions & 12 deletions components/clm/src/biogeochem/AnnualUpdateMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ module AnnualUpdateMod
use decompMod , only : bounds_type
use CNCarbonFluxType , only : carbonflux_type
use CNStateType , only : cnstate_type
use ColumnDataType , only : col_cf
use VegetationDataType, only : veg_cf
!
implicit none
save
Expand All @@ -32,7 +34,6 @@ subroutine AnnualUpdate(bounds, &
use clm_time_manager, only: get_step_size, get_days_per_year
use clm_varcon , only: secspday
use SubgridAveMod , only: p2c
use clm_varctl , only: use_cndv
!
! !ARGUMENTS:
type(bounds_type) , intent(in) :: bounds
Expand Down Expand Up @@ -83,21 +84,15 @@ subroutine AnnualUpdate(bounds, &
cnstate_vars%tempavg_t2m_patch(p) = 0._r8

! update annual NPP accumulator, convert to annual total
carbonflux_vars%annsum_npp_patch(p) = carbonflux_vars%tempsum_npp_patch(p) * dt
carbonflux_vars%tempsum_npp_patch(p) = 0._r8

if (use_cndv) then
! update annual litfall accumulator, convert to annual total
carbonflux_vars%annsum_litfall_patch(p) = carbonflux_vars%tempsum_litfall_patch(p) * dt
carbonflux_vars%tempsum_litfall_patch(p) = 0._r8
end if
end do
veg_cf%annsum_npp(p) = veg_cf%tempsum_npp(p) * dt
veg_cf%tempsum_npp(p) = 0._r8

end do
! use p2c routine to get selected column-average pft-level fluxes and states

call p2c(bounds, num_soilc, filter_soilc, &
carbonflux_vars%annsum_npp_patch(bounds%begp:bounds%endp), &
carbonflux_vars%annsum_npp_col(bounds%begc:bounds%endc))
veg_cf%annsum_npp(bounds%begp:bounds%endp), &
col_cf%annsum_npp(bounds%begc:bounds%endc))

call p2c(bounds, num_soilc, filter_soilc, &
cnstate_vars%annavg_t2m_patch(bounds%begp:bounds%endp), &
Expand Down
52 changes: 27 additions & 25 deletions components/clm/src/biogeochem/C14DecayMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ module C14DecayMod
use CNCarbonStateType , only : carbonstate_type
use CNStateType , only : cnstate_type
use clm_varctl , only : nu_com
use ColumnDataType , only : c14_col_cs
use VegetationDataType , only : c14_veg_cs
!
implicit none
save
Expand Down Expand Up @@ -63,31 +65,31 @@ subroutine C14Decay( num_soilc, filter_soilc, num_soilp, filter_soilp, &
associate( &
spinup_factor => decomp_cascade_con%spinup_factor , & ! Input: [real(r8) (:) ] factor for AD spinup associated with each pool

decomp_cpools_vr => c14_carbonstate_vars%decomp_cpools_vr_col , & ! Output: [real(r8) (:,:,:) ] (gC/m3) vertically-resolved decomposing (litter, cwd, soil) c pools
seedc => c14_carbonstate_vars%seedc_col , & ! Output: [real(r8) (:) ]
cpool => c14_carbonstate_vars%cpool_patch , & ! Output: [real(r8) (:) ] (gC/m2) temporary photosynthate C pool
xsmrpool => c14_carbonstate_vars%xsmrpool_patch , & ! Output: [real(r8) (:) ] (gC/m2) execss maint resp C pool
deadcrootc => c14_carbonstate_vars%deadcrootc_patch , & ! Output: [real(r8) (:) ] (gC/m2) dead coarse root C
deadcrootc_storage => c14_carbonstate_vars%deadcrootc_storage_patch , & ! Output: [real(r8) (:) ] (gC/m2) dead coarse root C storage
deadcrootc_xfer => c14_carbonstate_vars%deadcrootc_xfer_patch , & ! Output: [real(r8) (:) ] (gC/m2) dead coarse root C transfer
deadstemc => c14_carbonstate_vars%deadstemc_patch , & ! Output: [real(r8) (:) ] (gC/m2) dead stem C
deadstemc_storage => c14_carbonstate_vars%deadstemc_storage_patch , & ! Output: [real(r8) (:) ] (gC/m2) dead stem C storage
deadstemc_xfer => c14_carbonstate_vars%deadstemc_xfer_patch , & ! Output: [real(r8) (:) ] (gC/m2) dead stem C transfer
frootc => c14_carbonstate_vars%frootc_patch , & ! Output: [real(r8) (:) ] (gC/m2) fine root C
frootc_storage => c14_carbonstate_vars%frootc_storage_patch , & ! Output: [real(r8) (:) ] (gC/m2) fine root C storage
frootc_xfer => c14_carbonstate_vars%frootc_xfer_patch , & ! Output: [real(r8) (:) ] (gC/m2) fine root C transfer
gresp_storage => c14_carbonstate_vars%gresp_storage_patch , & ! Output: [real(r8) (:) ] (gC/m2) growth respiration storage
gresp_xfer => c14_carbonstate_vars%gresp_xfer_patch , & ! Output: [real(r8) (:) ] (gC/m2) growth respiration transfer
leafc => c14_carbonstate_vars%leafc_patch , & ! Output: [real(r8) (:) ] (gC/m2) leaf C
leafc_storage => c14_carbonstate_vars%leafc_storage_patch , & ! Output: [real(r8) (:) ] (gC/m2) leaf C storage
leafc_xfer => c14_carbonstate_vars%leafc_xfer_patch , & ! Output: [real(r8) (:) ] (gC/m2) leaf C transfer
livecrootc => c14_carbonstate_vars%livecrootc_patch , & ! Output: [real(r8) (:) ] (gC/m2) live coarse root C
livecrootc_storage => c14_carbonstate_vars%livecrootc_storage_patch , & ! Output: [real(r8) (:) ] (gC/m2) live coarse root C storage
livecrootc_xfer => c14_carbonstate_vars%livecrootc_xfer_patch , & ! Output: [real(r8) (:) ] (gC/m2) live coarse root C transfer
livestemc => c14_carbonstate_vars%livestemc_patch , & ! Output: [real(r8) (:) ] (gC/m2) live stem C
livestemc_storage => c14_carbonstate_vars%livestemc_storage_patch , & ! Output: [real(r8) (:) ] (gC/m2) live stem C storage
livestemc_xfer => c14_carbonstate_vars%livestemc_xfer_patch , & ! Output: [real(r8) (:) ] (gC/m2) live stem C transfer
pft_ctrunc => c14_carbonstate_vars%ctrunc_patch & ! Output: [real(r8) (:) ] (gC/m2) pft-level sink for C truncation
decomp_cpools_vr => c14_col_cs%decomp_cpools_vr , & ! Output: [real(r8) (:,:,:) ] (gC/m3) vertically-resolved decomposing (litter, cwd, soil) c pools
seedc => c14_col_cs%seedc , & ! Output: [real(r8) (:) ]
cpool => c14_veg_cs%cpool , & ! Output: [real(r8) (:) ] (gC/m2) temporary photosynthate C pool
xsmrpool => c14_veg_cs%xsmrpool , & ! Output: [real(r8) (:) ] (gC/m2) execss maint resp C pool
deadcrootc => c14_veg_cs%deadcrootc , & ! Output: [real(r8) (:) ] (gC/m2) dead coarse root C
deadcrootc_storage => c14_veg_cs%deadcrootc_storage , & ! Output: [real(r8) (:) ] (gC/m2) dead coarse root C storage
deadcrootc_xfer => c14_veg_cs%deadcrootc_xfer , & ! Output: [real(r8) (:) ] (gC/m2) dead coarse root C transfer
deadstemc => c14_veg_cs%deadstemc , & ! Output: [real(r8) (:) ] (gC/m2) dead stem C
deadstemc_storage => c14_veg_cs%deadstemc_storage , & ! Output: [real(r8) (:) ] (gC/m2) dead stem C storage
deadstemc_xfer => c14_veg_cs%deadstemc_xfer , & ! Output: [real(r8) (:) ] (gC/m2) dead stem C transfer
frootc => c14_veg_cs%frootc , & ! Output: [real(r8) (:) ] (gC/m2) fine root C
frootc_storage => c14_veg_cs%frootc_storage , & ! Output: [real(r8) (:) ] (gC/m2) fine root C storage
frootc_xfer => c14_veg_cs%frootc_xfer , & ! Output: [real(r8) (:) ] (gC/m2) fine root C transfer
gresp_storage => c14_veg_cs%gresp_storage , & ! Output: [real(r8) (:) ] (gC/m2) growth respiration storage
gresp_xfer => c14_veg_cs%gresp_xfer , & ! Output: [real(r8) (:) ] (gC/m2) growth respiration transfer
leafc => c14_veg_cs%leafc , & ! Output: [real(r8) (:) ] (gC/m2) leaf C
leafc_storage => c14_veg_cs%leafc_storage , & ! Output: [real(r8) (:) ] (gC/m2) leaf C storage
leafc_xfer => c14_veg_cs%leafc_xfer , & ! Output: [real(r8) (:) ] (gC/m2) leaf C transfer
livecrootc => c14_veg_cs%livecrootc , & ! Output: [real(r8) (:) ] (gC/m2) live coarse root C
livecrootc_storage => c14_veg_cs%livecrootc_storage , & ! Output: [real(r8) (:) ] (gC/m2) live coarse root C storage
livecrootc_xfer => c14_veg_cs%livecrootc_xfer , & ! Output: [real(r8) (:) ] (gC/m2) live coarse root C transfer
livestemc => c14_veg_cs%livestemc , & ! Output: [real(r8) (:) ] (gC/m2) live stem C
livestemc_storage => c14_veg_cs%livestemc_storage , & ! Output: [real(r8) (:) ] (gC/m2) live stem C storage
livestemc_xfer => c14_veg_cs%livestemc_xfer , & ! Output: [real(r8) (:) ] (gC/m2) live stem C transfer
pft_ctrunc => c14_veg_cs%ctrunc & ! Output: [real(r8) (:) ] (gC/m2) pft-level sink for C truncation
)

! set time steps
Expand Down
Loading

0 comments on commit 1bf22e3

Please sign in to comment.