Skip to content

Commit

Permalink
Merge branch 'dev_14_15_to_release' into release-clm5.0
Browse files Browse the repository at this point in the history
From dev014 & dev015: CMIP6 compset modifiers, output usermods & fixes

Bring in all changes from ctsm1.0.dev014 and ctsm1.0.dev015:

From ctsm1.0.dev015:

(1) Support %BGC-CROP-CMIP6DECK and %BGC-CROP-CMIP6WACCMDECK compset
    modifiers, so that we can turn on the necessary options
    (output-related and others) via new CMIP6-specific compsets.

(2) Turn on carbon isotopes in CMIP6 runs (from Erik Kluzek)

(3) Remove setting of CCSM_BGC=CO2A in the cmip6 usermods

(4) Add usermods directories for getting typical extra output that's
    wanted in many cases: output_crop, output_crop_highfreq, output_bgc,
    output_bgc_highfreq, output_sp, and output_sp_highfreq. These can be
    enabled by adding something like '--user-mods-dir output_crop' on
    the create_newcase line (that short-hand works for an I compset; for
    F or B compsets, you need to provide the full path to the usermod
    directory).

(4) Allow holes in the number of history tapes. Holes are cases where,
    for example, we have h0, h1 and h3 tapes, but no h2 tape (because
    there are no fields on the h2 tape). (This is needed for (3).)

(5) Fix reading and writing of 1-d logical global arrays. This fixes
    ESCOMP#24 for real (rather than just preventing an attempt to
    read/write 1-d logical arrays, as was done in the previous 'fix').

(6) Add C13_NBP and C14_NBP diagnostic fields (from Keith Oleson)

(7) Make a bunch of carbon isotope diagnostic fields inactive by default

(8) Don't allow interpolation (use_init_interp) from a case without
    carbon isotopes to a case with carbon isotopes: Due to
    ESCOMP#67, interpolation from a case
    without carbon isotopes to a case with carbon isotopes yields
    incorrect initialization values for the carbon isotopes. Now that
    we're turning carbon isotopes on via some semi-out-of-the-box
    usermods (for cmip6), it is becoming more important to check to make
    sure someone doesn't shoot themselves in the foot this way.

(9) Add tests of the new output usermods as well as of the CMIP6 compset
    modifiers

From ctsm1.0.dev014: Four miscellaneous minor, bit-for-bit bug fixes:

(1) Py3 pylint check and address cime issue ESMCI/cime#2822 (from Jim
    Edwards: ESCOMP#526)

(2) Change uppercase DEBUG variables to lowercase debug (requested by
    Jim Edwards to avoid conflicting with the DEBUG CPP token)
    (Fixes ESCOMP#534)

(3) Remove unnecessary line of code in LunaMod.F90 that was causing
    problems with some compilers due to an uninitialized variable
    (Fixes ESCOMP#322)

(4) Add r8 to 0 constant to fix build issue with XLF compiler (from Jim
    Edwards: ESCOMP#531)
  • Loading branch information
billsacks committed Oct 29, 2018
2 parents c9f0d66 + 5868f49 commit 942c76e
Show file tree
Hide file tree
Showing 22 changed files with 423 additions and 160 deletions.
8 changes: 4 additions & 4 deletions src/biogeochem/CNCIsoAtmTimeSeriesReadMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,13 @@ subroutine C14_init_BombSpike()
character(len=*), parameter :: vname = 'Delta14co2_in_air' ! Variable name on file
!-----------------------------------------------------------------------

call getfil(atm_c14_filename, locfn, 0)

if ( masterproc ) then
write(iulog, *) 'C14_init_BombSpike: preparing to open file:'
write(iulog, *) trim(locfn)
endif

call getfil(atm_c14_filename, locfn, 0)

call ncd_pio_openfile (ncid, trim(locfn), 0)

call ncd_inqdlen(ncid,dimid,ntim,'time')
Expand Down Expand Up @@ -241,13 +241,13 @@ subroutine C13_init_TimeSeries()
character(len=*), parameter :: vname = 'delta13co2_in_air' ! Variable name on file
!-----------------------------------------------------------------------

call getfil(atm_c13_filename, locfn, 0)

if ( masterproc ) then
write(iulog, *) 'C13_init_TimeSeries: preparing to open file:'
write(iulog, *) trim(locfn)
endif

call getfil(atm_c13_filename, locfn, 0)

call ncd_pio_openfile (ncid, trim(locfn), 0)

call ncd_inqdlen(ncid,dimid,ntim,'time')
Expand Down
19 changes: 13 additions & 6 deletions src/biogeochem/CNProductsMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -162,20 +162,27 @@ subroutine InitHistory(this, bounds)
!
! !LOCAL VARIABLES:
integer :: begg,endg
character(len=:), allocatable :: active_if_non_isotope

character(len=*), parameter :: subname = 'InitHistory'
!-----------------------------------------------------------------------

begg = bounds%begg
endg = bounds%endg

if (this%species%is_isotope()) then
active_if_non_isotope = 'inactive'
else
active_if_non_isotope = 'active'
end if

this%cropprod1_grc(begg:endg) = spval
call hist_addfld1d( &
fname = this%species%hist_fname('CROPPROD1'), &
units = 'g' // this%species%get_species() // '/m^2', &
avgflag = 'A', &
long_name = '1-yr grain product ' // this%species%get_species(), &
ptr_gcell = this%cropprod1_grc)
ptr_gcell = this%cropprod1_grc, default=active_if_non_isotope)

this%prod10_grc(begg:endg) = spval
call hist_addfld1d( &
Expand All @@ -199,7 +206,7 @@ subroutine InitHistory(this, bounds)
units = 'g' // this%species%get_species() // '/m^2', &
avgflag = 'A', &
long_name = 'total wood product ' // this%species%get_species(), &
ptr_gcell = this%tot_woodprod_grc)
ptr_gcell = this%tot_woodprod_grc, default=active_if_non_isotope)

this%dwt_prod10_gain_grc(begg:endg) = spval
call hist_addfld1d( &
Expand All @@ -223,23 +230,23 @@ subroutine InitHistory(this, bounds)
units = 'g' // this%species%get_species() // '/m^2/s', &
avgflag = 'A', &
long_name = 'landcover change-driven addition to wood product pools', &
ptr_gcell = this%dwt_woodprod_gain_grc)
ptr_gcell = this%dwt_woodprod_gain_grc, default=active_if_non_isotope)

this%dwt_cropprod1_gain_grc(begg:endg) = spval
call hist_addfld1d( &
fname = this%species%hist_fname('DWT_CROPPROD1', suffix='_GAIN'), &
units = 'g' // this%species%get_species() // '/m^2/s', &
avgflag = 'A', &
long_name = 'landcover change-driven addition to 1-year crop product pool', &
ptr_gcell = this%dwt_cropprod1_gain_grc)
ptr_gcell = this%dwt_cropprod1_gain_grc, default=active_if_non_isotope)

this%cropprod1_loss_grc(begg:endg) = spval
call hist_addfld1d( &
fname = this%species%hist_fname('CROPPROD1', suffix='_LOSS'), &
units = 'g' // this%species%get_species() // '/m^2/s', &
avgflag = 'A', &
long_name = 'loss from 1-yr grain product pool', &
ptr_gcell = this%cropprod1_loss_grc)
ptr_gcell = this%cropprod1_loss_grc, default=active_if_non_isotope)

this%prod10_loss_grc(begg:endg) = spval
call hist_addfld1d( &
Expand All @@ -263,7 +270,7 @@ subroutine InitHistory(this, bounds)
units = 'g' // this%species%get_species() // '/m^2/s', &
avgflag = 'A', &
long_name = 'total loss from wood product pools', &
ptr_gcell = this%tot_woodprod_loss_grc)
ptr_gcell = this%tot_woodprod_loss_grc, default=active_if_non_isotope)

end subroutine InitHistory

Expand Down
82 changes: 48 additions & 34 deletions src/biogeochem/CNVegCarbonFluxType.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1695,17 +1695,17 @@ subroutine InitHistory(this, bounds, carbon_type)
this%rr_patch(begp:endp) = spval
call hist_addfld1d (fname='C13_RR', units='gC13/m^2/s', &
avgflag='A', long_name='C13 root respiration (fine root MR + total root GR)', &
ptr_patch=this%rr_patch)
ptr_patch=this%rr_patch, default='inactive')

this%mr_patch(begp:endp) = spval
call hist_addfld1d (fname='C13_MR', units='gC13/m^2/s', &
avgflag='A', long_name='C13 maintenance respiration', &
ptr_patch=this%mr_patch)
ptr_patch=this%mr_patch, default='inactive')

this%gr_patch(begp:endp) = spval
call hist_addfld1d (fname='C13_GR', units='gC13/m^2/s', &
avgflag='A', long_name='C13 total growth respiration', &
ptr_patch=this%gr_patch)
ptr_patch=this%gr_patch, default='inactive')

this%ar_patch(begp:endp) = spval
call hist_addfld1d (fname='C13_AR', units='gC13/m^2/s', &
Expand All @@ -1715,17 +1715,17 @@ subroutine InitHistory(this, bounds, carbon_type)
this%npp_patch(begp:endp) = spval
call hist_addfld1d (fname='C13_NPP', units='gC13/m^2/s', &
avgflag='A', long_name='C13 net primary production', &
ptr_patch=this%npp_patch)
ptr_patch=this%npp_patch, default='inactive')

this%agnpp_patch(begp:endp) = spval
call hist_addfld1d (fname='C13_AGNPP', units='gC13/m^2/s', &
avgflag='A', long_name='C13 aboveground NPP', &
ptr_patch=this%agnpp_patch)
ptr_patch=this%agnpp_patch, default='inactive')

this%bgnpp_patch(begp:endp) = spval
call hist_addfld1d (fname='C13_BGNPP', units='gC13/m^2/s', &
avgflag='A', long_name='C13 belowground NPP', &
ptr_patch=this%bgnpp_patch)
ptr_patch=this%bgnpp_patch, default='inactive')

this%litfall_patch(begp:endp) = spval
call hist_addfld1d (fname='C13_LITFALL', units='gC13/m^2/s', &
Expand All @@ -1735,7 +1735,7 @@ subroutine InitHistory(this, bounds, carbon_type)
this%fire_closs_patch(begp:endp) = spval
call hist_addfld1d (fname='C13_PFT_FIRE_CLOSS', units='gC13/m^2/s', &
avgflag='A', long_name='C13 total patch-level fire C loss', &
ptr_patch=this%fire_closs_patch)
ptr_patch=this%fire_closs_patch, default='inactive')

this%m_leafc_to_litter_patch(begp:endp) = spval
call hist_addfld1d (fname='C13_M_LEAFC_TO_LITTER', units='gC13/m^2/s', &
Expand Down Expand Up @@ -2010,12 +2010,12 @@ subroutine InitHistory(this, bounds, carbon_type)
this%psnsun_to_cpool_patch(begp:endp) = spval
call hist_addfld1d (fname='C13_PSNSUN_TO_CPOOL', units='gC13/m^2/s', &
avgflag='A', long_name='C13 C fixation from sunlit canopy', &
ptr_patch=this%psnsun_to_cpool_patch)
ptr_patch=this%psnsun_to_cpool_patch, default='inactive')

this%psnshade_to_cpool_patch(begp:endp) = spval
call hist_addfld1d (fname='C13_PSNSHADE_TO_CPOOL', units='gC13/m^2/s', &
avgflag='A', long_name='C13 C fixation from shaded canopy', &
ptr_patch=this%psnshade_to_cpool_patch)
ptr_patch=this%psnshade_to_cpool_patch, default='inactive')

this%cpool_to_leafc_patch(begp:endp) = spval
call hist_addfld1d (fname='C13_CPOOL_TO_LEAFC', units='gC13/m^2/s', &
Expand Down Expand Up @@ -2518,12 +2518,12 @@ subroutine InitHistory(this, bounds, carbon_type)
this%psnsun_to_cpool_patch(begp:endp) = spval
call hist_addfld1d (fname='C14_PSNSUN_TO_CPOOL', units='gC14/m^2/s', &
avgflag='A', long_name='C14 C fixation from sunlit canopy', &
ptr_patch=this%psnsun_to_cpool_patch)
ptr_patch=this%psnsun_to_cpool_patch, default='inactive')

this%psnshade_to_cpool_patch(begp:endp) = spval
call hist_addfld1d (fname='C14_PSNSHADE_TO_CPOOL', units='gC14/m^2/s', &
avgflag='A', long_name='C14 C fixation from shaded canopy', &
ptr_patch=this%psnshade_to_cpool_patch)
ptr_patch=this%psnshade_to_cpool_patch, default='inactive')

this%cpool_to_leafc_patch(begp:endp) = spval
call hist_addfld1d (fname='C14_CPOOL_TO_LEAFC', units='gC14/m^2/s', &
Expand Down Expand Up @@ -2748,17 +2748,17 @@ subroutine InitHistory(this, bounds, carbon_type)
this%rr_patch(begp:endp) = spval
call hist_addfld1d (fname='C14_RR', units='gC14/m^2/s', &
avgflag='A', long_name='C14 root respiration (fine root MR + total root GR)', &
ptr_patch=this%rr_patch)
ptr_patch=this%rr_patch, default='inactive')

this%mr_patch(begp:endp) = spval
call hist_addfld1d (fname='C14_MR', units='gC14/m^2/s', &
avgflag='A', long_name='C14 maintenance respiration', &
ptr_patch=this%mr_patch)
ptr_patch=this%mr_patch, default='inactive')

this%gr_patch(begp:endp) = spval
call hist_addfld1d (fname='C14_GR', units='gC14/m^2/s', &
avgflag='A', long_name='C14 total growth respiration', &
ptr_patch=this%gr_patch)
ptr_patch=this%gr_patch, default='inactive')

this%ar_patch(begp:endp) = spval
call hist_addfld1d (fname='C14_AR', units='gC14/m^2/s', &
Expand All @@ -2768,17 +2768,17 @@ subroutine InitHistory(this, bounds, carbon_type)
this%npp_patch(begp:endp) = spval
call hist_addfld1d (fname='C14_NPP', units='gC14/m^2/s', &
avgflag='A', long_name='C14 net primary production', &
ptr_patch=this%npp_patch)
ptr_patch=this%npp_patch, default='inactive')

this%agnpp_patch(begp:endp) = spval
call hist_addfld1d (fname='C14_AGNPP', units='gC14/m^2/s', &
avgflag='A', long_name='C14 aboveground NPP', &
ptr_patch=this%agnpp_patch)
ptr_patch=this%agnpp_patch, default='inactive')

this%bgnpp_patch(begp:endp) = spval
call hist_addfld1d (fname='C14_BGNPP', units='gC14/m^2/s', &
avgflag='A', long_name='C14 belowground NPP', &
ptr_patch=this%bgnpp_patch)
ptr_patch=this%bgnpp_patch, default='inactive')

this%litfall_patch(begp:endp) = spval
call hist_addfld1d (fname='C14_LITFALL', units='gC14/m^2/s', &
Expand All @@ -2788,7 +2788,7 @@ subroutine InitHistory(this, bounds, carbon_type)
this%fire_closs_patch(begp:endp) = spval
call hist_addfld1d (fname='C14_PFT_FIRE_CLOSS', units='gC14/m^2/s', &
avgflag='A', long_name='C14 total patch-level fire C loss', &
ptr_patch=this%fire_closs_patch)
ptr_patch=this%fire_closs_patch, default='inactive')
endif

!-------------------------------
Expand Down Expand Up @@ -3034,7 +3034,7 @@ subroutine InitHistory(this, bounds, carbon_type)
call hist_addfld1d (fname='C13_DWT_CONV_CFLUX', units='gC13/m^2/s', &
avgflag='A', long_name='C13 conversion C flux (immediate loss to atm) ' // &
'(0 at all times except first timestep of year)', &
ptr_gcell=this%dwt_conv_cflux_grc)
ptr_gcell=this%dwt_conv_cflux_grc, default='inactive')

this%dwt_conv_cflux_patch(begp:endp) = spval
call hist_addfld1d (fname='C13_DWT_CONV_CFLUX_PATCH', units='gC13/m^2/s', &
Expand All @@ -3048,12 +3048,12 @@ subroutine InitHistory(this, bounds, carbon_type)
call hist_addfld1d (fname='C13_DWT_CONV_CFLUX_DRIBBLED', units='gC13/m^2/s', &
avgflag='A', &
long_name='C13 conversion C flux (immediate loss to atm), dribbled throughout the year', &
ptr_gcell=this%dwt_conv_cflux_dribbled_grc)
ptr_gcell=this%dwt_conv_cflux_dribbled_grc, default='inactive')

this%dwt_slash_cflux_col(begc:endc) = spval
call hist_addfld1d (fname='C13_DWT_SLASH_CFLUX', units='gC/m^2/s', &
avgflag='A', long_name='C13 slash C flux to litter and CWD due to land use', &
ptr_col=this%dwt_slash_cflux_col)
ptr_col=this%dwt_slash_cflux_col, default='inactive')

this%dwt_frootc_to_litr_met_c_col(begc:endc,:) = spval
call hist_addfld_decomp (fname='C13_DWT_FROOTC_TO_LITR_MET_C', units='gC13/m^2/s', type2d='levdcmp', &
Expand Down Expand Up @@ -3088,12 +3088,12 @@ subroutine InitHistory(this, bounds, carbon_type)
this%sr_col(begc:endc) = spval
call hist_addfld1d (fname='C13_SR', units='gC13/m^2/s', &
avgflag='A', long_name='C13 total soil respiration (HR + root resp)', &
ptr_col=this%sr_col)
ptr_col=this%sr_col, default='inactive')

this%er_col(begc:endc) = spval
call hist_addfld1d (fname='C13_ER', units='gC13/m^2/s', &
avgflag='A', long_name='C13 total ecosystem respiration, autotrophic + heterotrophic', &
ptr_col=this%er_col)
ptr_col=this%er_col, default='inactive')

this%litfire_col(begc:endc) = spval
call hist_addfld1d (fname='C13_LITFIRE', units='gC13/m^2/s', &
Expand All @@ -3113,17 +3113,24 @@ subroutine InitHistory(this, bounds, carbon_type)
this%fire_closs_col(begc:endc) = spval
call hist_addfld1d (fname='C13_COL_FIRE_CLOSS', units='gC13/m^2/s', &
avgflag='A', long_name='C13 total column-level fire C loss', &
ptr_col=this%fire_closs_col)
ptr_col=this%fire_closs_col, default='inactive')

this%nep_col(begc:endc) = spval
call hist_addfld1d (fname='C13_NEP', units='gC13/m^2/s', &
avgflag='A', long_name='C13 net ecosystem production, excludes fire flux, positive for sink', &
ptr_col=this%nep_col)
ptr_col=this%nep_col, default='inactive')

this%nee_grc(begg:endg) = spval
call hist_addfld1d (fname='C13_NEE', units='gC13/m^2/s', &
avgflag='A', long_name='C13 net ecosystem exchange of carbon, includes fire flux, positive for source', &
ptr_gcell=this%nee_grc)
ptr_gcell=this%nee_grc, default='inactive')

this%nbp_grc(begg:endg) = spval
call hist_addfld1d (fname='C13_NBP', units='gC13/m^2/s', &
avgflag='A', long_name='C13 net biome production, includes fire, landuse,'&
//' harvest and hrv_xsmrpool flux (latter smoothed over the year), positive for sink'&
//' (same as net carbon exchange between land and atmosphere)', &
ptr_gcell=this%nbp_grc)

endif

Expand Down Expand Up @@ -3183,7 +3190,7 @@ subroutine InitHistory(this, bounds, carbon_type)
call hist_addfld1d (fname='C14_DWT_CONV_CFLUX', units='gC14/m^2/s', &
avgflag='A', long_name='C14 conversion C flux (immediate loss to atm) ' // &
'(0 at all times except first timestep of year)', &
ptr_gcell=this%dwt_conv_cflux_grc)
ptr_gcell=this%dwt_conv_cflux_grc, default='inactive')

this%dwt_conv_cflux_patch(begp:endp) = spval
call hist_addfld1d (fname='C14_DWT_CONV_CFLUX_PATCH', units='gC14/m^2/s', &
Expand All @@ -3197,12 +3204,12 @@ subroutine InitHistory(this, bounds, carbon_type)
call hist_addfld1d (fname='C14_DWT_CONV_CFLUX_DRIBBLED', units='gC14/m^2/s', &
avgflag='A', &
long_name='C14 conversion C flux (immediate loss to atm), dribbled throughout the year', &
ptr_gcell=this%dwt_conv_cflux_dribbled_grc)
ptr_gcell=this%dwt_conv_cflux_dribbled_grc, default='inactive')

this%dwt_slash_cflux_col(begc:endc) = spval
call hist_addfld1d (fname='C14_DWT_SLASH_CFLUX', units='gC/m^2/s', &
avgflag='A', long_name='C14 slash C flux to litter and CWD due to land use', &
ptr_col=this%dwt_slash_cflux_col)
ptr_col=this%dwt_slash_cflux_col, default='inactive')

this%dwt_frootc_to_litr_met_c_col(begc:endc,:) = spval
call hist_addfld_decomp (fname='C14_DWT_FROOTC_TO_LITR_MET_C', units='gC14/m^2/s', type2d='levdcmp', &
Expand Down Expand Up @@ -3237,12 +3244,12 @@ subroutine InitHistory(this, bounds, carbon_type)
this%sr_col(begc:endc) = spval
call hist_addfld1d (fname='C14_SR', units='gC14/m^2/s', &
avgflag='A', long_name='C14 total soil respiration (HR + root resp)', &
ptr_col=this%sr_col)
ptr_col=this%sr_col, default='inactive')

this%er_col(begc:endc) = spval
call hist_addfld1d (fname='C14_ER', units='gC14/m^2/s', &
avgflag='A', long_name='C14 total ecosystem respiration, autotrophic + heterotrophic', &
ptr_col=this%er_col)
ptr_col=this%er_col, default='inactive')

this%litfire_col(begc:endc) = spval
call hist_addfld1d (fname='C14_LITFIRE', units='gC14/m^2/s', &
Expand All @@ -3262,17 +3269,24 @@ subroutine InitHistory(this, bounds, carbon_type)
this%fire_closs_col(begc:endc) = spval
call hist_addfld1d (fname='C14_COL_FIRE_CLOSS', units='gC14/m^2/s', &
avgflag='A', long_name='C14 total column-level fire C loss', &
ptr_col=this%fire_closs_col)
ptr_col=this%fire_closs_col, default='inactive')

this%nep_col(begc:endc) = spval
call hist_addfld1d (fname='C14_NEP', units='gC14/m^2/s', &
avgflag='A', long_name='C14 net ecosystem production, excludes fire flux, positive for sink', &
ptr_col=this%nep_col)
ptr_col=this%nep_col, default='inactive')

this%nee_grc(begg:endg) = spval
call hist_addfld1d (fname='C14_NEE', units='gC14/m^2/s', &
avgflag='A', long_name='C14 net ecosystem exchange of carbon, includes fire flux, positive for source', &
ptr_gcell=this%nee_grc)
ptr_gcell=this%nee_grc, default='inactive')

this%nbp_grc(begg:endg) = spval
call hist_addfld1d (fname='C14_NBP', units='gC13/m^2/s', &
avgflag='A', long_name='C14 net biome production, includes fire, landuse,'&
//' harvest and hrv_xsmrpool flux (latter smoothed over the year), positive for sink'&
//' (same as net carbon exchange between land and atmosphere)', &
ptr_gcell=this%nbp_grc)

endif

Expand Down
Loading

0 comments on commit 942c76e

Please sign in to comment.