Skip to content
Draft
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions bld/namelist_files/namelist_defaults_ctsm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,15 @@ attributes from the config_cache.xml file (with keys converted to upper-case).
<use_c14_bombspike phys="clm6_0" bgc_mode="bgc" >.true.</use_c14_bombspike>

<!-- Carbon isotope concentration files -->
<atm_c13_filename use_c13=".true." use_c13_timeseries=".true." ssp_rcp="hist" >lnd/clm2/isotopes/atm_delta_C13_CMIP6_1850-2015_yearly_v2.0_c190528.nc</atm_c13_filename>
<atm_c13_filename use_c13=".true." use_c13_timeseries=".true." ssp_rcp="hist" >lnd/clm2/isotopes/rawdata_copies/delta13co2_input4MIPs_atmosphericState_C4MIP_ImperialCollege-3-0_gm_1700-2023.nc</atm_c13_filename>
<atm_c13_filename use_c13=".true." use_c13_timeseries=".true." ssp_rcp="SSP1-1.9" >lnd/clm2/isotopes/atm_delta_C13_CMIP6_SSP119_1850-2100_yearly_c181209.nc</atm_c13_filename>
<atm_c13_filename use_c13=".true." use_c13_timeseries=".true." ssp_rcp="SSP1-2.6" >lnd/clm2/isotopes/atm_delta_C13_CMIP6_SSP126_1850-2100_yearly_c181209.nc</atm_c13_filename>
<atm_c13_filename use_c13=".true." use_c13_timeseries=".true." ssp_rcp="SSP2-4.5" >lnd/clm2/isotopes/atm_delta_C13_CMIP6_SSP245_1850-2100_yearly_c181209.nc</atm_c13_filename>
<atm_c13_filename use_c13=".true." use_c13_timeseries=".true." ssp_rcp="SSP3-7.0" >lnd/clm2/isotopes/atm_delta_C13_CMIP6_SSP3B_1850-2100_yearly_c181209.nc</atm_c13_filename>
<atm_c13_filename use_c13=".true." use_c13_timeseries=".true." ssp_rcp="SSP5-3.4" >lnd/clm2/isotopes/atm_delta_C13_CMIP6_SSP534os_1850-2100_yearly_c181209.nc</atm_c13_filename>
<atm_c13_filename use_c13=".true." use_c13_timeseries=".true." ssp_rcp="SSP5-8.5" >lnd/clm2/isotopes/atm_delta_C13_CMIP6_SSP5B_1850-2100_yearly_c181209.nc</atm_c13_filename>

<atm_c14_filename use_c14=".true." use_c14_bombspike =".true." ssp_rcp="hist" >lnd/clm2/isotopes/atm_delta_C14_CMIP6_3x1_global_1850-2015_yearly_v2.0_c190528.nc</atm_c14_filename>
<atm_c14_filename use_c14=".true." use_c14_bombspike =".true." ssp_rcp="hist" >lnd/clm2/isotopes/rawdata_copies/delta14co2_input4MIPs_atmosphericState_C4MIP_ImperialCollege-3-0_gz_1700-2023.nc</atm_c14_filename>
<atm_c14_filename use_c14=".true." use_c14_bombspike =".true." ssp_rcp="SSP1-1.9" >lnd/clm2/isotopes/atm_delta_C14_CMIP6_SSP119_3x1_global_1850-2100_yearly_c181209.nc</atm_c14_filename>
<atm_c14_filename use_c14=".true." use_c14_bombspike =".true." ssp_rcp="SSP1-2.6" >lnd/clm2/isotopes/atm_delta_C14_CMIP6_SSP126_3x1_global_1850-2100_yearly_c181209.nc</atm_c14_filename>
<atm_c14_filename use_c14=".true." use_c14_bombspike =".true." ssp_rcp="SSP2-4.5" >lnd/clm2/isotopes/atm_delta_C14_CMIP6_SSP245_3x1_global_1850-2100_yearly_c181209.nc</atm_c14_filename>
Expand Down
23 changes: 14 additions & 9 deletions src/biogeochem/CNCIsoAtmTimeSeriesReadMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module CIsoAtmTimeseriesMod
!
! !USES:
use shr_kind_mod , only : r8 => shr_kind_r8
use clm_time_manager , only : get_curr_date, get_curr_yearfrac
use clm_time_manager , only : get_curr_date, get_curr_yearfrac, get_average_days_per_year
use clm_varcon , only : c14ratio, secspday
use shr_const_mod , only : SHR_CONST_PDB ! Ratio of C13/C12
use clm_varctl , only : iulog
Expand All @@ -27,7 +27,7 @@ module CIsoAtmTimeseriesMod
character(len=256) , public :: atm_c14_filename = ' ' ! file name of C14 input data
logical , public :: use_c13_timeseries = .false. ! do we use time-varying atmospheric C13?
character(len=256) , public :: atm_c13_filename = ' ' ! file name of C13 input data
integer, parameter , public :: nsectors_c14 = 3 ! Number of latitude sectors the C14 data has
integer, parameter , public :: nsectors_c14 = 4 ! Number of latitude sectors the C14 data has

!
! !PRIVATE MEMBER FUNCTIONS:
Expand All @@ -38,7 +38,7 @@ module CIsoAtmTimeseriesMod
real(r8), allocatable, private :: atm_delta_c14(:,:) ! Delta C14 data
real(r8), allocatable, private :: atm_c13file_time(:) ! time for C13 data
real(r8), allocatable, private :: atm_delta_c13(:) ! Delta C13 data
real(r8), parameter :: time_axis_offset = 1850.0_r8 ! Offset in years of time on file
real(r8), parameter :: time_axis_offset = 1700.0_r8 ! Offset in years of time on file

character(len=*), parameter, private :: sourcefile = &
__FILE__
Expand Down Expand Up @@ -119,7 +119,7 @@ subroutine C14_init_BombSpike()
integer :: nsec ! number of input data sectors
integer :: t ! time index
logical :: readvar ! if variable read or not
character(len=*), parameter :: vname = 'Delta14co2_in_air' ! Variable name on file
character(len=*), parameter :: vname = 'Delta14co2' ! Variable name on file
!-----------------------------------------------------------------------

call getfil(atm_c14_filename, locfn, 0)
Expand All @@ -132,7 +132,7 @@ subroutine C14_init_BombSpike()
call ncd_pio_openfile (ncid, trim(locfn), 0)

call ncd_inqdlen(ncid,dimid,ntim,'time')
call ncd_inqdlen(ncid,dimid,nsec,'sector')
call ncd_inqdlen(ncid,dimid,nsec,'lat')
if ( nsec /= nsectors_c14 )then
call endrun(msg="ERROR: number of sectors on file not what's expected"//errMsg(sourcefile, __LINE__))
end if
Expand All @@ -158,7 +158,10 @@ subroutine C14_init_BombSpike()
call ncd_pio_closefile(ncid)

! check to make sure that time dimension is well behaved
atm_c14file_time(1) = atm_c14file_time(1) / get_average_days_per_year()
do t = 2, ntim
! Convert time in days to years
atm_c14file_time(t) = atm_c14file_time(t) / get_average_days_per_year()
if ( atm_c14file_time(t) - atm_c14file_time(t-1) <= 0._r8 ) then
write(iulog, *) 'C14_init_BombSpike: error. time axis must be monotonically increasing'
call endrun(msg=errMsg(sourcefile, __LINE__))
Expand Down Expand Up @@ -196,6 +199,8 @@ subroutine C13TimeSeries( rc13_atm )
ntim_atm_ts = size(atm_c13file_time)
ind_below = 0
do nt = 1, ntim_atm_ts
! Convert time in days to years
atm_c13file_time(nt) = atm_c13file_time(nt) / get_average_days_per_year()
if ((dateyear - time_axis_offset) >= atm_c13file_time(nt) ) then
ind_below = ind_below+1
endif
Expand Down Expand Up @@ -238,7 +243,7 @@ subroutine C13_init_TimeSeries()
integer :: ntim ! number of input data time samples
integer :: t ! Time index
logical :: readvar ! if variable read or not
character(len=*), parameter :: vname = 'delta13co2_in_air' ! Variable name on file
character(len=*), parameter :: vname = 'delta13co2' ! Variable name on file
!-----------------------------------------------------------------------

call getfil(atm_c13_filename, locfn, 0)
Expand Down Expand Up @@ -304,14 +309,14 @@ subroutine check_units( ncid, vname, relativeto )

call ncd_inqvid( ncid, 'time', varid, vardesc )
call ncd_getatt( ncid, varid, "units", units )
write(t_units_expected,'("years since", I5, "-01-01 0:0:0.0")' ) nint(time_axis_offset)
write(t_units_expected,'("days since", I5, "-01-01 00:00:00")' ) nint(time_axis_offset)
if ( trim(units) /= t_units_expected )then
call endrun(msg="ERROR: time units on file are NOT what's expected"//errMsg(sourcefile, __LINE__))
end if
call ncd_inqvid( ncid, vname, varid, vardesc )
call ncd_getatt( ncid, varid, "units", units )
if ( trim(units) /= "per mil, relative to "//relativeto )then
call endrun(msg="ERROR: units on file for "//vname//" are NOT what's expected"//errMsg(sourcefile, __LINE__))
if ( trim(units) /= "1" )then
call endrun(msg="ERROR: units on file for "//vname//" are NOT what's expected", file=sourcefile, line=__LINE__ )
end if
end subroutine check_units

Expand Down
Loading