Skip to content

Commit

Permalink
Restart refactor
Browse files Browse the repository at this point in the history
Merge branch 'rgknox-restart-refactor'

This change-group completes a first version of a refactored restart
process that conforms to our new interface design. The general
approach was to re-use as much of the design of the history restart
process, ie using a vector list of objects to hold all of the restart
information along with its recent refactors.

Design points:

FatesHistoryDimensionsMod -> FatesIODimensionsMod, which contains
types and procedures that handle setting up the dimensioning for BOTH
history and restarts.

FatesHistoryVariableKindMod -> FatesIOVariableKindMod, which now
contains the types and procedures associated with the "dimension-kind"
structures, for BOTH history and restarts.

Some local constants such as the number of dimensions and dim-kinds
were re-tooled a little so that history and restarts have their own.

Some procedures of different classes were using the same name, which
was confusing, changed name for different classes.

The fates_bounds_type was moved to FatesIODimensionsMod, this seems
consistent as it is a holding place for dimensioning information
(bounds).

The registry of variables was cleaned-up regarding variable names,
long names and units.

Fixes: #129

User interface changes?: no

Code review:

Testing:

  rgknox

    Test suite: lawrencium-lr3 (intel), edTest, clm_short_45
    Test baseline: 2ac7960
    Test namelist changes: none
    Test answer changes: none, b4b

    Test summary: all PASS

  andre:
    Test suite: ed - yellowstone gnu, intel, pgi
                     hobart nag
    Test baseline: ed-clm-5c5928f
    Test namelist changes: none
    Test answer changes: no bit for bit
    Test summary: all tests pass

    Test suite: aux_clm40, aux_clm45 -
                          yellowstone gnu, intel, pgi
                          hobart nag
    Test baseline: clm4_5_12_r195
    Test namelist changes: none
    Test answer changes: bit for bit except for ed compsets
    Test summary: all tests pass except ed compsets which have
                  diverged from r195.
  • Loading branch information
bandre-ucar committed Jan 9, 2017
2 parents 5c5928f + fc8c670 commit d116008
Show file tree
Hide file tree
Showing 16 changed files with 2,423 additions and 2,582 deletions.
4 changes: 2 additions & 2 deletions components/clm/src/ED/biogeochem/EDCohortDynamicsMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module EDCohortDynamicsMod
use EDGrowthFunctionsMod , only : c_area, tree_lai
use EDTypesMod , only : ed_site_type, ed_patch_type, ed_cohort_type
use EDTypesMod , only : fusetol, cp_nclmax
use EDtypesMod , only : ncwd, numcohortsperpatch, udata
use EDtypesMod , only : ncwd, maxcohortsperpatch, udata
use EDtypesMod , only : sclass_ed,nlevsclass_ed,AREA
use EDtypesMod , only : min_npm2, min_nppatch, min_n_safemath
!
Expand Down Expand Up @@ -626,7 +626,7 @@ subroutine fuse_cohorts(patchptr)
iterate = 1
fusion_took_place = 0
currentPatch => patchptr
maxcohorts = numCohortsPerPatch
maxcohorts = maxCohortsPerPatch

!---------------------------------------------------------------------!
! Keep doing this until nocohorts <= maxcohorts !
Expand Down
4 changes: 2 additions & 2 deletions components/clm/src/ED/biogeochem/EDPatchDynamicsMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module EDPatchDynamicsMod
use clm_varctl , only : iulog
use pftconMod , only : pftcon
use EDCohortDynamicsMod , only : fuse_cohorts, sort_cohorts, insert_cohort
use EDtypesMod , only : ncwd, n_dbh_bins, ntol, numpft_ed, area, dbhmax, numPatchesPerCol
use EDtypesMod , only : ncwd, n_dbh_bins, ntol, numpft_ed, area, dbhmax, maxPatchesPerCol
use EDTypesMod , only : ed_site_type, ed_patch_type, ed_cohort_type, udata
use EDTypesMod , only : min_patch_area, cp_numlevgrnd, cp_numSWb
!
Expand Down Expand Up @@ -1018,7 +1018,7 @@ subroutine fuse_patches( csite )
!---------------------------------------------------------------------

!maxpatch = 4
maxpatch = numPatchesPerCol
maxpatch = maxPatchesPerCol

currentSite => csite

Expand Down
8 changes: 4 additions & 4 deletions components/clm/src/ED/biogeophys/EDPhotosynthesisMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ subroutine Photosynthesis_ED (nsites, sites,bc_in,bc_out,dtime)
use EDTypesMod , only : ed_cohort_type
use EDTypesMod , only : ed_site_type
use EDTypesMod , only : numpft_ed
use EDTypesMod , only : numpatchespercol
use EDTypesMod , only : maxpatchespercol
use EDTypesMod , only : cp_numlevsoil
use EDTypesMod , only : cp_nlevcan
use EDTypesMod , only : cp_nclmax
Expand Down Expand Up @@ -105,9 +105,9 @@ subroutine Photosynthesis_ED (nsites, sites,bc_in,bc_out,dtime)
real(r8) :: ci ! intracellular leaf CO2 (Pa)
real(r8) :: lnc(mxpft) ! leaf N concentration (gN leaf/m^2)

real(r8) :: kc( numpatchespercol ) ! Michaelis-Menten constant for CO2 (Pa)
real(r8) :: ko( numpatchespercol ) ! Michaelis-Menten constant for O2 (Pa)
real(r8) :: co2_cp( numpatchespercol ) ! CO2 compensation point (Pa)
real(r8) :: kc( maxpatchespercol ) ! Michaelis-Menten constant for CO2 (Pa)
real(r8) :: ko( maxpatchespercol ) ! Michaelis-Menten constant for O2 (Pa)
real(r8) :: co2_cp( maxpatchespercol ) ! CO2 compensation point (Pa)

! ---------------------------------------------------------------
! TO-DO: bbbopt is slated to be transferred to the parameter file
Expand Down
14 changes: 7 additions & 7 deletions components/clm/src/ED/biogeophys/EDSurfaceAlbedoMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module EDSurfaceRadiationMod

use EDtypesMod , only : ed_patch_type, ed_site_type
use EDtypesMod , only : numpft_ed
use EDtypesMod , only : numPatchesPerCol
use EDtypesMod , only : maxPatchesPerCol
use shr_kind_mod , only : r8 => shr_kind_r8
use shr_log_mod , only : errMsg => shr_log_errMsg
use FatesInterfaceMod , only : bc_in_type, &
Expand Down Expand Up @@ -74,8 +74,8 @@ subroutine ED_Norman_Radiation (nsites, sites, bc_in, bc_out )
real(r8) :: k_dir(numpft_ed) ! Direct beam extinction coefficient
real(r8) :: tr_dir_z(cp_nclmax,numpft_ed,cp_nlevcan) ! Exponential transmittance of direct beam radiation through a single layer
real(r8) :: tr_dif_z(cp_nclmax,numpft_ed,cp_nlevcan) ! Exponential transmittance of diffuse radiation through a single layer
real(r8) :: forc_dir(numPatchesPerCol,cp_maxSWb)
real(r8) :: forc_dif(numPatchesPerCol,cp_maxSWb)
real(r8) :: forc_dir(maxPatchesPerCol,cp_maxSWb)
real(r8) :: forc_dif(maxPatchesPerCol,cp_maxSWb)
real(r8) :: weighted_dir_tr(cp_nclmax)
real(r8) :: weighted_fsun(cp_nclmax)
real(r8) :: weighted_dif_ratio(cp_nclmax,cp_maxSWb)
Expand All @@ -93,8 +93,8 @@ subroutine ED_Norman_Radiation (nsites, sites, bc_in, bc_out )
real(r8) :: abs_rad(cp_maxSWb) !radiation absorbed by soil
real(r8) :: tr_soili ! Radiation transmitted to the soil surface.
real(r8) :: tr_soild ! Radiation transmitted to the soil surface.
real(r8) :: phi1b(numPatchesPerCol,numpft_ed) ! Radiation transmitted to the soil surface.
real(r8) :: phi2b(numPatchesPerCol,numpft_ed)
real(r8) :: phi1b(maxPatchesPerCol,numpft_ed) ! Radiation transmitted to the soil surface.
real(r8) :: phi2b(maxPatchesPerCol,numpft_ed)
real(r8) :: laisum ! cumulative lai+sai for canopy layer (at middle of layer)
real(r8) :: angle

Expand All @@ -107,8 +107,8 @@ subroutine ED_Norman_Radiation (nsites, sites, bc_in, bc_out )
integer :: fp,iv,s ! array indices
integer :: ib ! waveband number
real(r8) :: cosz ! 0.001 <= coszen <= 1.000
real(r8) :: chil(numPatchesPerCol) ! -0.4 <= xl <= 0.6
real(r8) :: gdir(numPatchesPerCol) ! leaf projection in solar direction (0 to 1)
real(r8) :: chil(maxPatchesPerCol) ! -0.4 <= xl <= 0.6
real(r8) :: gdir(maxPatchesPerCol) ! leaf projection in solar direction (0 to 1)

!-----------------------------------------------------------------------

Expand Down
4 changes: 0 additions & 4 deletions components/clm/src/ED/main/EDInitMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,6 @@ subroutine zero_site( site_in )
site_in%oldest_patch => null() ! pointer to oldest patch at the site
site_in%youngest_patch => null() ! pointer to yngest patch at the site

! INDICES
site_in%lat = nan
site_in%lon = nan

! DISTURBANCE
site_in%disturbance_rate = 0._r8 ! site level disturbance rates from mortality and fire.
site_in%dist_type = 0 ! disturbance dist_type id.
Expand Down
Loading

0 comments on commit d116008

Please sign in to comment.