-
Notifications
You must be signed in to change notification settings - Fork 23
Tutorials
Check that the line
# postscript: sync_output_to_gdata.sh
is commented out in $ACCESS_OM_DIR/control/1deg_jra55_ryf/config.yaml
, or if not, that GDATADIR
in sync_output_to_gdata.sh
is in fact where you want output and restarts to be written.
WARNING: double-check GDATADIR
so you don't overwrite existing output! - see below.
CAUTION: OUT OF DATE! SEE ISSUE 42
Each experiment can be assigned a separate git branch via
git branch expt
git checkout expt
where expt
is the name for your experiment. For clarity it's best if this matches the name of the output directory used for the COSIMA Cookbook (e.g. 1deg_jra55_ryf_spinupN
in the next section).
For that matter you could also put the experiment name as the first line of $ACCESS_OM_DIR/control/1deg_jra55_ryf/ocean/diag_table
which will make it appear in the MOM output netcdf file metadata as the global title field.
More details here.
The first step is to work out which restart you want to begin from. run_summary.py can help - it will show you which run number corresponds to which date - e.g. see /g/data/hh5/tmp/cosima/access-om2-run-summaries
.
It's pretty straightforward if you want to continue from some restart in another experiment and have the start date of your experiment match the date in the initial restart:
- git clone the control directory from the experiment you are starting from, e.g.
git clone --no-hardlinks prev_control_dir my_new_experiment
, whereprev_control_dir
is what you're starting from, andmy_new_experiment
is whatever you want to call your new experiment. This creates a new directorymy_new_experiment
that copies the contents ofprev_control_dir
, including its entire git commit history. Using--no-hardlinks
to avoids potential permissions issues in git. cd my_new_experiment
- view your git remotes with
git remote -v
. You may wish to fixorigin
if you don't want it to refer toprev_control_dir
, e.g.git remote set-url origin https://github.com/COSIMA/1deg_jra55_iaf.git
if you're using that config. - if you want to start from a restart that isn't the most recent in
prev_control_dir
it's a good idea to check out the commit corresponding to that restart in case the configuration for that run was different from the latest, e.g.git checkout abc123
if the git hash for the run that generated that restart starts withabc123
. You can determine the relevant git hash withgit log
or by using run_summary.py which tabulates the run git hash for each run number and model date - e.g. see/g/data/hh5/tmp/cosima/access-om2-run-summaries
. - check out a new branch for the new experiment (e.g.
git checkout -b my_new_experiment
; it avoids confusion if this matches your directory name) - change
SYNCDIR
insync_data.sh
(orGDATADIR
insync_output_to_gdata.sh
in older configurations) to a currently non-existent path (for clarity it should match your branch name from the previous step) CHANGING SYNCDIR/GDATADIR IS CRUCIAL TO PREVENT POSSIBLE DATA LOSS! - make an
archive
symlink: dopayu setup
to create awork
symlink. Usels -l
to see where this links to and create an analogous directory with the same path but withwork
replaced witharchive
, usingmkdir -p
. Then useln -s <archive-path> archive
to make anarchive
directory symlink in your new control directory, where<archive-path>
is the path you used inmkdir -p
. Then dopayu sweep
to get rid of thework
symlink. - copy the required restart directory from the previous experiment (say,
restart123
) intoarchive
- you may also need to copy the associated
output123/ice/cice_in.nml
into yourarchive
- see https://github.com/payu-org/payu/issues/193 - make whatever other configuration changes you want
- update
metadata.yaml
if you want to document how your new experiment differs fromprev_control_dir
- run your experiment with
payu run
Things are more complicated if you want to change the run start date, for example continuing with interannual forcing after spinning up with repeat-year forcing.
As an example, the following steps show how the IAF run 01deg_jra55v13_iaf
was started from year 40 in the RYF run 01deg_jra55v13_ryf8485_spinup6
.
- git clone the control directory from the experiment you are starting from, e.g.
git clone --no-hardlinks prev_control_dir my_new_experiment
, whereprev_control_dir
is what you're starting from, andmy_new_experiment
is whatever you want to call your new experiment. This creates a new directorymy_new_experiment
that copies the contents ofprev_control_dir
, including its entire git commit history. Using--no-hardlinks
to avoids potential permissions issues in git. cd my_new_experiment
- check out the commit corresponding to the restart you have chosen to use (run_summary.py can help - it shows the run git hash corresponding to each run number and model date - e.g. see
/g/data/hh5/tmp/cosima/access-om2-run-summaries
), e.g.git checkout abc123
if the run git hash starts withabc123
- check out a new branch for the new experiment (e.g.
git checkout -b my_new_experiment
; it avoids confusion if this matches your directory name) - change
GDATADIR
insync_output_to_gdata.sh
to a currently non-existent path (for clarity it should match your branch name from the previous step) CHANGING GDATADIR IS CRUCIAL TO PREVENT POSSIBLE DATA LOSS! - check that
atmosphere/forcing.json
specifies the right forcing files (NB: wildcards such as*
cannot be used following this commit) - check/fix
forcing_start_date
andforcing_end_date
inaccessom2.nml
- make an
archive
symlink: dopayu setup
to create awork
symlink. Usels -l
to see where this links to and create an analogous directory with the same path but withwork
replaced witharchive
, usingmkdir -p
. Then useln -s <archive-path> archive
to make anarchive
directory symlink in your new control directory, where<archive-path>
is the path you used inmkdir -p
. Then dopayu sweep
to get rid of thework
symlink. - copy the required restart directory from the previous experiment (say,
restart123
) intoarchive
, and rename itrestart000
(if you want to) - you may also need to copy the associated
output123/ice/cice_in.nml
into yourarchive
- see https://github.com/payu-org/payu/issues/193 - check/fix
FORCING_CUR_DATE
andEXP_CUR_DATE
inarchive/restart000/accessom2_restart.nml
(you'll probably wantFORCING_CUR_DATE
to be the date of the start of your new run, since CICE will use this ifuse_restart_time = .false.
inice/cice_in.nml
) - check/fix calendar (should be gregorian for IAF, noleap for RYF) and current model time in
archive/restart000/ocean/ocean_solo.res
- for the first run you'll need to set
use_restart_time = .false.
inice/cice_in.nml
- run your experiment with
payu run
- after the first run you'll need to set
use_restart_time = .true.
inice/cice_in.nml
Check archive/output*/atmosphere/log/matmxx.pe00000.log
to see if the correct forcing files are being read. Also check that archive/output*/ice/OUTPUT
file dates are correct and that archive/output*/ocean/time_stamp.out
is correct.
If you can't get this to work you may need to omit step 10 and alter the timing information in the restart file as discussed here.
Be aware that there can be subtle problems with calendars and leap years, which can trigger a forcing and experiment dates are out of sync
error - see https://github.com/COSIMA/access-om2/issues/117 and https://github.com/COSIMA/access-om2/issues/149. If it doesn't bother you to have the forcing and run dates differing in more than just the year, set allow_forcing_and_exp_date_mismatch = .true.
in the date_manager_nml
group in accessom2.nml
.
aidan [09:28 AM] Care to share in case anyone else has the same problem?
nic [10:35 AM] yes, sorry. The problem was/is that CICE figures out its restart date based on an offset kept in the netcdf header of the restart file. This offset is from the beginning of the experiment and counted in seconds. the other models just use a restart date. the problem was that my experiment start date was different from Andrew, hence the ice restart date calculation came up with something different. so when I said that I dont see any difference between our configs I wasn't looking very hard.
aidan [10:40 AM] You had to edit the cice restart file to make this work?
nic [10:41 AM] no, I had to edit the accessom2.nml to make the forcing_start_date the same as his. this setup is not very clear/intuitive
however fixing cice date handling might be biting of more than we want to chew
aidan [10:51 AM] I'm thinking this might be a pretty common thing to want to do, so as long as we have clear guidelines/instructions on how to use someone else's restarts, what to do if you do need to change the model date etc.
If the MOM bathymetry file (topog.nc) needs to be changed on an existing run it's ocean restarts will need to be fixed up. Otherwise the restarts may not contain valid data at all points. This section describes a method for doing this. This github issue comment may also be helpful.
The approach taken is to create ocean restart files that match the new bathymetry (we call these the template restarts), then copy over all valid data from restarts for the existing run (call these the old restarts). The end result will be a restart that is the same as the existing run at all points which exist in both the old and the template (we call these the new restarts). Any new points that don't exist in the old restarts will contain whatever existed in the template restarts. This approach is very simple but does have a downside - if the bathymetry has changed a lot then there may be many points whose state is not consistent with the old restarts.
Step by step:
- Download topogtools. This contains a simple script that does the copying described above.
git clone https://github.com/COSIMA/topogtools.git
-
You'll need template restarts from a run with the new bathymetry. If no previous run exists you'll need to create the restarts with a very short run from rest using the new
topog.nc
and matching CICE and MOM land maskskmt.nc
andocean_mask.nc
as inputs (see step 7; create the land masks withtopogtools/topog2mask.py topog.nc kmt.nc ocean_mask.nc
). -
Collate the MOM restarts from both the template run with the new bathymetry and the run with the old bathymetry, e.g:
module use /g/data/hh5/public/modules
module load conda/analysis3
payu collate -d template-run/archive/restart000/ocean
payu collate -d old-topo-run/archive/restart123/ocean
- Get an interactive PBS session with additional CPUs and memory, e.g.:
qsub -I -P e14 -v DISPLAY -q express -l ncpus=4,mem=128Gb,walltime=10:00:00
- Run the
fix_restarts.py
script to create new MOM restarts based on the old restarts but with the new bathymetry and any new ocean points filled in with the template, e.g.:
cd topogtools
fix_restarts.py --help
./fix_restarts.py template-run/archive/restart000/ocean old-topo-run/archive/restart123/ocean new-topo-run/archive/restart123/ocean
This can take quite a while.
Note that fix_restarts.py
requires Python 3 - you might need to do module use /g/data/hh5/public/modules; module load conda/analysis3
first.
- Copy the restart files for the other model components, including the appropriate
kmt.nc
, e.g.:
cp old-topo-run/archive/restart123/accessom2_restart.nml new-topo-run/archive/restart123/
cp -r old-topo-run/archive/restart123/atmosphere new-topo-run/archive/restart123/
cp -r old-topo-run/archive/restart123/ice new-topo-run/archive/restart123/
cp template-run/archive/restart000/ice/kmt.nc new-topo-run/archive/restart123/ice
- Edit submodel input directories in
config.yaml
to ensure that MOM is usingtopog.nc
and the matching land maskocean_mask.nc
, and that CICE is using the matching land maskkmt.nc
. You might want to dopayu setup
to check that the resulting work directory links to the correct input files (thenpayu sweep
to tidy up).
The configuration should now be ready to run.
YATM permits arbitrary spatiotemporal scaling of the forcing (e.g. JRA55-do), which can be useful for perturbation experiments or to eliminate occasional timestep-limiting storms.
We leave the original forcing files untouched but carry multiplicative factors in auxiliary scaling files that are specified in atmosphere/forcing.json
via an optional key "scaling_filename"
, for example in /g/data/hh5/tmp/cosima/access-om2-01/01deg_jra55v13_ryf8485_spinup6_newtopog_scalewind/output435/atmosphere/forcing.json
:
{
"description": "JRA55-do V1.3 RYF 1984-85 forcing",
"inputs": [
{
"filename": "/g/data/ua8/JRA55-do/RYF/v1-3/RYF.rsds.1984_1985.nc",
"fieldname": "rsds",
"cname": "swfld_ai"
},
...trimmed...
{
"filename": "/g/data/ua8/JRA55-do/RYF/v1-3/RYF.u_10.1984_1985.nc",
"scaling_filename": "/home/156/aek156/payu/01deg_jra55v13_ryf8485_spinup6_newtopog_scalewind/input/RYF.u_10.1984_1985_scale.nc",
"fieldname": "uas_10m",
"cname": "uwnd_ai"
},
{
"filename": "/g/data/ua8/JRA55-do/RYF/v1-3/RYF.v_10.1984_1985.nc",
"scaling_filename": "/home/156/aek156/payu/01deg_jra55v13_ryf8485_spinup6_newtopog_scalewind/input/RYF.v_10.1984_1985_scale.nc",
"fieldname": "vas_10m",
"cname": "vwnd_ai"
},
]
}
Each auxiliary scaling .nc file (e.g. RYF.u_10.1984_1985_scale.nc
and RYF.v_10.1984_1985_scale.nc
above) has the same structure (variable and dimension names and order) as the forcing file that it will scale, specified by "filename"
(e.g. RYF.u_10.1984_1985.nc
and RYF.v_10.1984_1985.nc
above). Note that the scaling fields only need to be defined for the forcing times they are required. If the scaling file is present and defined for a given forcing time and field, the forcing field seen by the model will be the original field multiplied by the scaling factor. Otherwise the original field will be used.
The scaling values are arbitrary. The examples RYF.u_10.1984_1985_scale.nc
and RYF.v_10.1984_1985_scale.nc
above were generated by this notebook and are simply 1 minus a Gaussian in x,y,t which is localised to the location and time at which a problematic storm occurred in the JRA55-do data (see discussion here).
It's a very good idea to use compression in the netcdf scaling file, especially if your scaling is time-independent. We are investigating better ways to handle time-independent perturbations: https://github.com/COSIMA/libaccessom2/issues/31
This scaling capability was implemented in this commit; the scaling multiplication is done here.
This approach could scale any JRA55-do forcing field used to drive CICE (and therefore MOM), but if you wanted additive (not multiplicative) perturbations a code change would be needed: https://github.com/COSIMA/libaccessom2/issues/30
This tutorial describes the process to follow when changing the bathymetry and land-sea mask for the purposes of, say, opening a strait or simulating a paleo-oceanographic situation.
All changes to the bathymetry are made by creating a custom version of the topog.nc
located in the MOM folder of the input (e.g. /short/public/access-om2/input_236a3011/mom_1deg
for the 1-degree model). Any locations with a depth greater than 0 will be considered sea points subsequently for mask creation, while anything that has depth 0 (or negative depth) will be considered land. Place the new topography file in your own input folder (e.g. /short/e14/rmh561/access-om2/input/custom_topog_test/mom_1deg/
). This new input folder needs to be refered to in your config.yaml
in the mom submodule section above the default input folder (a similar line is needed to include the other custom input files below):
- name: ocean
model: mom
exe: /short/e14/rmh561/access-om2/bin/fms_ACCESS-OM_1c1f23e_libaccessom2_b6caeab.x
input:
- /short/e14/rmh561/access-om2/input/custom_topog_test/mom_1deg
- /short/public/access-om2/input_236a3011/mom_1deg
Since the input topog.nc
file has been changed, MOM's & CICE's land-sea masks will also need to be changed to match the new topography. The topog2mask script will create the corresponding CICE mask file (kmt.nc
) and MOM mask file (ocean_grid.nc
).
Download topogtools via:
git clone https://github.com/COSIMA/topogtools.git
This repository contains a simple python script (topog2mask.py
) that will create the matching land–sea masks through the command:
./topog2mask.py topog.nc kmt.nc ocean_mask.nc
Place the new files in your input folder, referring to them in config.yaml
above the public inputs (kmt.nc
in the cice
submodule).
The OASIS coupler is in charge of feeding CICE with the correct atmospheric forcings. To do this, OASIS remaps the atmosphere grid into the corresponding CICE grid according to the remapping weights files specified for each field in the ATMOSPHERE --->>> ICE
section of namcouple
. The default remapping weights files (rmp_jra55_cice_conserve.nc
and rmp_jra55_cice_smooth.nc
) mask out the atmospheric forcings over land. If they are not remade then OASIS will feed the model 0's over every land point, which can result in a variety of errors (e.g. a division-by-zero runtime error associated with the air temperature, or problems with the air-sea heat flux, see Issue 173.
To remake the mapping files using the new land-sea masks use the script make_remap_weights.py
in the access-om2/tools/
directory. This script needs the ocean_mask.nc
and ocean_hgrid.nc
input files from mom, as well as the JRA55 data directories and the yatm_1deg
directory (not sure why for this last one?). I used the following command from a qsub script (executed from my custom_topog_test
input directory) to get this working (I'm not on x77
so couldn't use Nic's directories):
../../tools/make_remap_weights.py ./ /g/data/ua8/JRA55-do/RYF/v1-3/ ../yatm_1deg/ --atm JRA55 --ocean MOM1 --npes 16
(the ocean_mask.nc
and ocean_hgrid.nc
files must be in the ./mom_1deg
folder). Note that the 1/4-degree and 1/10-degree models likely require more resources and a longer processing time (see the tools/make_remap_weights.sh
qsub script).
This command produces the JRA55_MOM1_conserve.nc
and JRA55_MOM1_patch.nc
remapping weights files that should be copied into a commmon_1deg_jra55/
input directory and then referenced in config.yaml
under the common inputs:
model: access-om2
input:
- /short/e14/rmh561/access-om2/input/custom_topog_test/common_1deg_jra55
- /short/public/access-om2/input_236a3011/common_1deg_jra55
Finally, the ATMOSPHERE --->>> ICE
section of namcouple
needs to be changed to refer to these new remap weights files. Replace all appearances of rmp_jra55_cice_conserve.nc
with JRA55_MOM1_conserve.nc
and rmp_jra55_cice_smooth.nc
with JRA55_MOM1_patch.nc
.
You should now be good to go. It is worth doing a payu setup
to check that all input folders' paths are correct. Note that some of the problems won't neccessarily result in a error being thrown by the model (e.g. incorrect conserve
remapping weights - see Issue 173). A useful field to look at to check that things are working is the net surface heat flux net_sfc_heating
. Note that you will likely still have problems if you're trying to restart from a previous run, as the initial conditions won't be defined if you've created new ocean points. However, it will work if starting from WOA initial conditions as these are defined everywhere.
- Quick start
- Downloading ACCESS-OM2
- Building the models
- Running a test case
- Checking model output
- Running on gadi
- Updating an experiment
- Creating a new experiment
- Starting an experiment from existing restarts
- Integrating with the COSIMA cookbook
- Archiving model output
- Updating model bathymetry
- Perturbing the forcing fields
- Changing the bathymetry, land-sea mask and OASIS remapping weights
- Overview
- Coupling strategy
- Model load balancing
- CICE block distribution
- Build system
- Future work
- libaccessom2 / YATM
- MOM
- CICE
- Building models individually
- Installing new executables
- Contributing changes to the ACCESS-OM2 repository
- Testing
- Release history