6. Create Initial Conditions - NOC-MSM/SRIL34 GitHub Wiki

The most usual way to initialize a regional model is by imposing Temperature and Salinity from a reanalysis product (like Copernicus), while the model starts from rest (i.e., current velocities set to zero). This way, the model will need a more thorough spin up (in the deeper ocean, spin up is of order of centuries, while in shelf seas that are shallower the spin up is of order of years to decades).

An alternative approach is to use a soft-restart to initialize your model, where a pseudo-restart file containing Temperature, Salinity Sea Surface Height, and current velocities (U and V) is constructed from a previous model run (e.g., a coarser resolution model) or a reanalysis product.

This page briefly runs through an example of how to create a pseudo-restart file from Copernicus reanalysis (note, these examples use Matlab scripts).

Download the reanalysis file

To maintain consistency and to reduce the chances of the model blowing up, it is recommended, where possible, to use the same file to create the ICS as for the OBC. If following the guidance set out in this SANH Wiki, this would be the CMEMS reanalysis product (see download instructions here).

T, S, SSH, U and V are all needed to create the pseudo-restart file (*NOTE: this was not the case here, but it is possible you need to merge different files into one if not all these information is in the same file - you can use ncks for that).

Create the Domain mask

If you do not have a domain mask, you will need to generate it using the mesh_mask capability in NEMO. I did not go through this myself as I already had a previous domain mask available, but below is a summary of how you would do it. More can be found on the wider SANH domain site here.

You will need to do a 'dummy' run of the model with no forcing.

Move all relevant files into your run directory *.xml files, namelist_cfg, namelist_ref,*slurm script, domain_cfg.nc, coordinates.nc, xios-server.exe, nemo executable .

Then modify the namelist to run the model without forcing:

!-----------------------------------------------------------------------
&namrun        !   parameters of the run
!-----------------------------------------------------------------------
   nn_no       =       0       !  Assimilation cycle index
   cn_exp      =  "test_sanh"
   nn_it000    =  1            !  first time step
   nn_itend    =  2          !  last  time step
   nn_date0    =  19930101     !  date at nit_0000 (format yyyymmdd) used if ln_rstart=F or (ln_rstart=T and nn_rstctl=0 or 1)
   nn_time0    =       0       !  initial time of day in hhmm
   nn_leapy    =       1       !  Leap year calendar (1) or not (0)
   ln_rstart   = .true.   !  start from rest (F) or from a restart file (T)
      nn_euler    =    0       !  = 0 : start with forward time step if ln_rstart=T
      nn_rstctl   =    0       !  restart control ==> activated only if ln_rstart=T
      !                           !    = 0 nn_date0 read in namelist ; nn_it000 : read in namelist
      !                           !    = 1 nn_date0 read in namelist ; nn_it000 : check consistancy between namelist and restart
      !                           !    = 2 nn_date0 read in restart  ; nn_it000 : check consistancy between namelist and restart

And set ln_meshmask = .true, and run the dummy model:

sbatch job_run_short.slurm

This will output a series of mesh_mask_* files, 1 per processor, which need to be rebuilt into one file using the rebuild.slurm job script. Edit this script to reflect the paths, then use sbatch rebuild.slurm to create a single mesh_mask.nc file.

Create the pseudo-restart file

Within the matlab script Restart_int_reanalysis.m define your domain configuration name, mask of your domain and the dataset that you want to generate the restart from:

file='domain_cfg.nc';
...
file='mesh_mask.nc';
....
file_data='CMEMS_input.nc';

Modified the paths in Restart_int_reanalysis.m, Int_RESTART_2D_reanalysis.m, and Int_RESTART_3D_reanalysis.m to point to your own domain, mask and input files.

Run Restart_int_reanalysis.m This script will:

(i) Use function Int_RESTART_2D_reanalysis.m to conduct a linear horizontal interpolation on the 2D fields (i.e. sea surface height), and also apply flooding and re-masking to "deal" with any inconsistencies in the coastline between the model domain and the reanalysis.

(ii) Use function Int_RESTART_3D_reanalysis.m to conduct a linear horizontal interpolation, and a vertical interpolation that is suitable for interpolating from data on z-level to sigma or hybrid sigma-z level model. Flooding is imposed to temperature and salinity, but there is no flooding for currents to avoid generating any unrealistic currents along the coast and the bottom that can lead to instabilities causing the model to "blow up" before it can slowly adjust to them.

(iii) Save a netcdf file with a "pseudo-restart" (MYRESTART.nc) compatible to be used with NEMO.