.. _initializing-the-model-state:

Initializing the model state
=============================

Temperature and salinity distribution
-------------------------------------

.. todo:: put in link for namelist **&init\_ts\_nml** for Temperature and salinity initialization

Restart control
---------------

As a POP calculation proceeds, restart files are produced at intervals
of simulated time specified by the parameter ``restart_freq`` in
namelist ``restart_nml``. The root of the restart filename is given by
the ``restart_outfile`` variable. The actual full filename will be
*restart\_outfile.runid.suffix* where *suffix* is a number that depends
on ``restart_freq_opt``. If this option is 'nyear', 'nmonth' or 'nday'
*suffix* will be the calendar day in yyyymmdd. If the option is 'nstep',
*suffix* will be the current step number. In the unlikely case that the
user chooses 'nhour' or 'nsecond', *suffix* will be yyyymmdd.[hh,sssss]
where hh and sssss denote the current hour or seconds in the current
day. 

.. todo:: put in lnk for namelist **&restart\_nml** for Restart file namelist

In addition to these named restart files, additional restart files may
be written using the even/odd convention. If ``leven_odd`` is set to
.true., the model will write restart files every
``even_odd_freq steps``. These files will be named
*restart\_outfile.runid.even,odd* where the code alternately writes to
an even or odd file. Any previous file of the same name will be
overwritten. This capability is particularly useful for backup in case
the simulation terminates prematurely; it provides restart capability
without needing to keep many named restart files present in the file
system. The model writes alternately to each of two such files so that
if an error occurs while writing one restart file, the other restart
file will still (presumably) be all right.

Restart files contain only the minimum information required to restart
the model exactly, so that the results are the same after a restart as
would have been the case had no restart been done. This means that two
time-levels (n-1 and n) of the prognostic variables (PT, S, U, V and H)
must be saved in 64-bit precision. The restart format is governed by the
``restart_fmt`` option. Note that using netCDF for restarts on machines
that do not use the IEEE binary format standard will result in restart
files that are not exact due to internal conversion by the netCDF
library. This will prevent exact reproducibility on such machines.
Binary format is therefore highly recommended for restart files.