Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix and improve anomaly forcings for ISSP cases #2686

Draft
wants to merge 28 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
208c594
Point CDEPS external at cdeps1.0.33.
samsrabin May 3, 2024
8d628f2
Update other externals after CESM tag cesm2_3_alpha17e.
samsrabin May 3, 2024
702477d
Add datm_rcp45_anom_forc testmod.
samsrabin May 9, 2024
f59d045
Point CDEPS external at my branch, with Anomaly.Forcing.cmip5.rcp45.
samsrabin May 9, 2024
662e536
datm_rcp45_anom_forc testmod now uses Anomaly.Forcing.cmip5.rcp45.
samsrabin Aug 8, 2024
8df08ff
Added a few scripts for this work
samsrabin Aug 8, 2024
1416363
Remove user_nl_datm_streams from datm_rcp45_anom_forc testmod.
samsrabin Aug 8, 2024
4b96267
Update CDEPS external to 462c7a9.
samsrabin Aug 8, 2024
825fbb6
Update CDEPS external to 759c591.
samsrabin Aug 8, 2024
496c154
datm_ssp126_anom_forc testmod now uses Anomaly.Forcing.cmip6.ssp126.
samsrabin Aug 8, 2024
0a8df10
Add 'ssp' test suite.
samsrabin Aug 8, 2024
634cfce
Update CDEPS external to 84669d7.
samsrabin Aug 9, 2024
42b7575
Add testmods for ssp245, 370, 585.
samsrabin Aug 9, 2024
567fcad
Add ssp suite tests for 245, 370, 585.
samsrabin Aug 9, 2024
597a4de
Merge remote-tracking branch 'escomp/b4b-dev' into ssp-anomaly-fixes
samsrabin Aug 9, 2024
c4ec313
Update CDEPS external to 547506603e.
samsrabin Aug 9, 2024
49382ee
Update CDEPS external to 3f36622.
samsrabin Sep 4, 2024
728257b
Update CDEPS external to 797b320.
samsrabin Sep 5, 2024
4da4587
Update CDEPS external to 274b06b.
samsrabin Sep 5, 2024
51a8e1b
Update "Running with anomaly forcing" doc for latest CDEPS.
samsrabin Sep 5, 2024
1644c61
Running-with-anomaly-forcing.rst: Formatting improvements.
samsrabin Sep 5, 2024
5aae2a6
Running-with-anomaly-forcing.rst: Resolve a TODO.
samsrabin Sep 5, 2024
a2fc1c1
Running-with-anomaly-forcing.rst: Update single-pt instructions.
samsrabin Sep 5, 2024
f514ed8
Update CDEPS external to 1e403a8.
samsrabin Sep 5, 2024
da2f4e8
Update CDEPS external to b1f17519.
samsrabin Sep 5, 2024
8cb5854
Remove datm_ssp*_anom_forc testmods.
samsrabin Sep 5, 2024
01967bf
Replace non-SSP test in ssp suite with nvhpc version.
samsrabin Sep 5, 2024
124027b
Update CDEPS external to 25c7b92.
samsrabin Sep 5, 2024
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 .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ fxDONOTUSEurl = https://github.com/ESCOMP/CMEPS.git

[submodule "cdeps"]
path = components/cdeps
url = https://github.com/ESCOMP/CDEPS.git
fxtag = cdeps1.0.34
url = https://github.com/samsrabin/CDEPS.git
fxtag = 25c7b920de8fdf1a90b00276a0d7b003b4a845a9
fxrequired = ToplevelRequired
# Standard Fork to compare to with "git fleximod test" to ensure personal forks aren't committed
fxDONOTUSEurl = https://github.com/ESCOMP/CDEPS.git
Expand Down
34 changes: 33 additions & 1 deletion cime_config/testdefs/testlist_clm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1989,6 +1989,7 @@
<machines>
<machine name="izumi" compiler="intel" category="aux_clm"/>
<machine name="derecho" compiler="nvhpc" category="aux_clm"/>
<machine name="derecho" compiler="nvhpc" category="ssp"/>
<machine name="izumi" compiler="gnu" category="aux_clm"/>
</machines>
<options>
Expand Down Expand Up @@ -2513,15 +2514,46 @@
<option name="comment" >Transient production future scenario SSP3-7.0 case with isotopes with a december 2050 start</option>
</options>
</test>
<test name="SMS_D_Ld5" grid="f09_g17" compset="ISSP126Clm50BgcCrop" testmods="clm/datm_ssp126_anom_forc">

<test name="SMS_D_Ld5" grid="f09_g17" compset="ISSP126Clm50BgcCrop" testmods="clm/default">
<machines>
<machine name="derecho" compiler="intel" category="aux_clm"/>
<machine name="derecho" compiler="intel" category="ssp"/>
</machines>
<options>
<option name="wallclock">00:20:00</option>
<option name="comment" >Transient production with anomaly forcing future scenario SSP1-2.6 case</option>
</options>
</test>
<test name="SMS_D_Ld5" grid="f10_f10_mg37" compset="ISSP245Clm50BgcCrop" testmods="clm/default">
<machines>
<machine name="derecho" compiler="intel" category="ssp"/>
</machines>
<options>
<option name="wallclock">00:20:00</option>
<option name="comment" >Transient production with anomaly forcing future scenario SSP2-4.5 case</option>
</options>
</test>
<test name="SMS_D_Ld5" grid="f09_g17" compset="ISSP370Clm50BgcCrop" testmods="clm/default">
<machines>
<machine name="derecho" compiler="intel" category="ssp"/>
</machines>
<options>
<option name="wallclock">00:20:00</option>
<option name="comment" >Transient production with anomaly forcing future scenario SSP3-7.0 case</option>
</options>
</test>
<test name="SMS_D_Ld5" grid="f09_g17" compset="ISSP585Clm50BgcCrop" testmods="clm/default">
<machines>
<machine name="derecho" compiler="intel" category="ssp"/>
</machines>
<options>
<option name="wallclock">00:20:00</option>
<option name="comment" >Transient production with anomaly forcing future scenario SSP5-8.5 case</option>
</options>
</test>


<test name="ERP_D_Ld5" grid="f10_f10_mg37" compset="I1850Clm50Bgc" testmods="clm/nlevgrnd_small">
<machines>
<machine name="izumi" compiler="intel" category="aux_clm">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
flanduse_timeseries = '$DIN_LOC_ROOT/lnd/clm2/surfdata_esmf/ctsm5.2.0/landuse.timeseries_0.9x1.25_SSP2-4.5_1850-2100_78pfts_c240216.nc'
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
anomaly_forcing = 'Anomaly.Forcing.cmip5.rcp45'

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,41 +5,69 @@
==============================
Running with anomaly forcing
==============================
Because performing fully coupled climate simulations is computationally expensive, an alternate method of running land-only simulations forced by future climate projections was developed for CTSM called 'anomaly forcing'. The anomaly forcing method uses a previously completed fully coupled simulation to create monthly anomalies, relative to the present day, of near-surface atmospheric states and fluxes. These anomalies, representing the evolution of future climate projections, are applied to a repeating cycle of present day atmospheric forcing data, either as an additive (for states) or multiplicative (for fluxes) quantity. Thus, high-frequency variability is obtained from the present day atmospheric forcing data, while the long-term evolution of the climate is determined by the anomaly forcing dataset.
Because performing fully coupled climate simulations is computationally expensive, an alternate method of running land-only simulations forced by future climate projections was developed for CTSM called "anomaly forcing." The anomaly forcing method uses a previously-completed, fully-coupled simulation to create monthly anomalies, relative to the present day, of near-surface atmospheric states and fluxes. These anomalies, representing the evolution of future climate projections, are applied to a repeating cycle of present day atmospheric forcing data, either as an additive (for states) or multiplicative (for fluxes) quantity. Thus, high-frequency variability is obtained from the present day atmospheric forcing data, while the long-term evolution of the climate is determined by the anomaly forcing dataset.

To enable anomaly forcing in a CTSM simulation, the following namelist variable can be added to the user\_nl\_datm file:
Anomaly climate forcings are automatically enabled for ``ISSP`` compsets (e.g., ``ISSP585``). After the namelist has been created, ``CaseDocs/datm.streams.xml`` will have an entry like this pointing to the anomaly forcing file being used:

anomaly\_forcing = 'Anomaly.Forcing.Precip','Anomaly.Forcing.Temperature','Anomaly.Forcing.Pressure','Anomaly.Forcing.Humidity','Anomaly.Forcing.Uwind','Anomaly.Forcing.Vwind','Anomaly.Forcing.Shortwave','Anomaly.Forcing.Longwave'
::

Any combination or subset of forcing variables can be used, e.g. to modify only a single atmospheric forcing variable, one could use:
<stream_info name="Anomaly.Forcing.cmip6.ssp585">
...
<datafiles>
<file>/glade/campaign/cesm/cesmdata/inputdata/atm/datm7/anomaly_forcing/CMIP6-SSP5-8.5/af.allvars.CESM.SSP5-8.5.2015-2100_c20220628.nc</file>
</datafiles>
<datavars>
<var>huss Sa_shum_af</var>
<var>pr Faxa_prec_af</var>
<var>ps Sa_pbot_af</var>
<var>rlds Faxa_lwdn_af</var>
<var>rsds Faxa_swdn_af</var>
<var>tas Sa_tbot_af</var>
<var>uas Sa_u_af</var>
<var>vas Sa_v_af</var>
</datavars>
...
</stream_info>

anomaly\_forcing = 'Anomaly.Forcing.Temperature'
To use alternative data, add a ``user_nl_datm_streams`` namelist file to your case with contents like so:

which will only adjust the temperature (TBOT).
::

After the namelist has been created, the run directory will be populated with files such as these:
Anomaly.Forcing.cmip6.ssp585:datafiles = /path/to/your/datafile
Anomaly.Forcing.cmip6.ssp585:meshfile = /path/to/meshfile/for/your/datafile

datm.streams.txt.Anomaly.Forcing.Temperature
! List of Data types to use
! Remove the variables you do NOT want to include in the anomaly forcing:
! pr is precipitation
! tas is temperature
! huss is humidity
! uas and vas are U and V winds
! rsds is solare
! rlds is LW down
Anomaly.Forcing.cmip6.ssp585:datavars = pr Faxa_prec_af, \
tas Sa_tbot_af, \
ps Sa_pbot_af, \
huss Sa_shum_af, \
uas Sa_u_af, \
vas Sa_v_af, \
rsds Faxa_swdn_af, \
rlds Faxa_lwdn_af

which will contain the location of the default anomaly forcing datasets. To use alternative data, copy these files to the case directory with the 'user\_' prefix, and modify the 'user\_*' files accordingly, e.g.:
To instead disable anomaly forcing in ``ISSP`` compsets, the following can be added to the ``user_nl_datm`` file:

user\_datm.streams.txt.Anomaly.Forcing.Temperature
::

For example, one could use the user\_datm.streams.txt.Anomaly.Forcing.* files to point to these SSP-derived anomaly forcing datasets:
anomaly_forcing = 'none'

/glade/p/cesmdata/cseg/inputdata/atm/datm7/anomaly\_forcing/CMIP6-SSP3-7.0
Note that other inputs are also set automatically for ``ISSP`` compsets, including CO2 (``co2tseries``), ozone (``preso3``), N deposition (``presndep``), and aerosols (``presaero``).

af.huss.cesm2.SSP3-7.0.2015-2100\_c20200329.nc
af.pr.cesm2.SSP3-7.0.2015-2100\_c20200329.nc
af.ps.cesm2.SSP3-7.0.2015-2100\_c20200329.nc
af.rlds.cesm2.SSP3-7.0.2015-2100\_c20200329.nc
af.rsds.cesm2.SSP3-7.0.2015-2100\_c20200329.nc
af.tas.cesm2.SSP3-7.0.2015-2100\_c20200329.nc
For single-point simulations, the global anomaly forcing files can be used, but the map should be nearest-neighbor interpolated by putting the following in ``user_nl_datm_streams``:

Users may wish to also update files such as the landuse\_timeseries and aerosol and Ndepostion files to correspond to the appropriate SSP.
TODO: IS THIS ACTUALLY NEEDED?

For single point simulations, the global anomaly forcing files can be used, but the map_algo namelist variable should be appended with nearest neighbor values for each of the anomaly forcing fields, e.g.
::

mapalgo = 'nn','nn','nn','nn','nn','nn','nn','nn','nn','nn','nn','nn','nn' (the number of 'nn' values will depend on the number of original streams plus the number of anomaly forcing streams)
! Replace "ssp585" if needed
Anomaly.Forcing.cmip6.ssp585:mapalgo = nn

The cycling of the present-day (base) climate is controlled through the DATM\_CLMNCEP\_YR\_START and DATM_CLMNCEP\_YR\_END variables in env\_run.xml.
The first and last years over which the present-day (base) climate should cycle are set through the ``DATM_YR_START`` and ``DATM_YR_END`` XML variables.
46 changes: 46 additions & 0 deletions tmp_scripts/make_allvars_files.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/bash
set -e

module load nco

indir=/glade/campaign/cesm/cesmdata/cseg/inputdata/atm/datm7/anomaly_forcing
outdir=/glade/work/samrabin/ctsm_cdeps_ssp-temperature

rcp=$1
if [[ ${rcp} == "" ]]; then
echo "You must provide rcp (e.g., 45)" >&2
exit 1
fi

if [[ ! -d "${indir}" ]]; then
echo "Input directory not found: ${indir}" >&2
exit 1
fi

restoffilename="ccsm4.rcp${rcp}.2006-2300.nc"

pushd "${indir}" 1>/dev/null
varlist="$(ls af.*.${restoffilename} | grep -v allvars | cut -f2 -d.)"
if [[ "${varlist}" == "" ]]; then
echo "No variables found" >&2
exit 1
fi
popd 1>/dev/null

newfile="${outdir}/af.allvars.${restoffilename}"

i=0
for var in ${varlist}; do
echo $var
i=$((i + 1))
thisfile="${indir}/af.${var}.${restoffilename}"
if [[ ${i} -eq 1 ]]; then
nccopy -k cdf5 "${thisfile}" "${newfile}"
continue
fi
ncks -A -v ${var} "${thisfile}" "${newfile}"
done

echo Done

exit 0
35 changes: 35 additions & 0 deletions tmp_scripts/test-ssp-temperature-ctsm5.2.003.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash
set -e

ssp=$1
if [[ ${ssp} == "" ]]; then
echo "You must provide an SSP number (e.g., 245)" >&2
exit 1
fi
ssp_punctuation="$(echo ${ssp} | sed -E "s/(.)(.)(.)/\1-\2.\3/")"

casedir="$HOME/cases_ctsm/test_cdeps_ssp-temperature"
compset="SSP${ssp}_DATM%GSWP3v1_CLM51%BGC-CROP_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV"
res="f10_f10_mg37"

if [[ -d "${casedir}" ]]; then
rm -r "${casedir}"
fi

cime/scripts/create_newcase --run-unsupported --case "${casedir}" --compset ${compset} --res ${res} \
--handle-preexisting-dirs r

cd "${casedir}"
./case.setup

#echo "anomaly_forcing = 'Anomaly.Forcing.Temperature'" >> user_nl_datm
echo "anomaly_forcing = 'Anomaly.Forcing.cmip5.rcp45'" >> user_nl_datm
echo "flanduse_timeseries = '/glade/campaign/cesm/cesmdata/cseg/inputdata/lnd/clm2/surfdata_esmf/ctsm5.2.0/landuse.timeseries_10x15_SSP${ssp_punctuation}_78_CMIP6_1850-2100_c230517.nc'" >> user_nl_clm

echo "Generating namelists..."
./preview_namelists 1>/dev/null

./xmlquery COMPSET
grep "<file>" CaseDocs/datm.streams.xml | grep anomaly_forcing | grep '.tas.'

exit 0