This directory contains all code necessary to run, and plot, the 1-dimensional
sea ice experiments described in the associated study, 'The location of the
thermodynamic atmosphere-ice interface in fully-coupled models - a case
study using JULES and CICE'.

The code is described below in 3 groups: (a) the basic model, (b) the plotting 
code of the main paper, (c) the plotting code of the stability analysis in 
Appendix A.

-----------------------------------------------------------------------
(a) The basic 1-D model

This is written in Fortran and is based on the thermodynamic routines of 
CICE version 4, adapted from CICE initially by Alison McLaren and edited
for additional experiments by Alex West.

In the study, the model is run in three configurations, corresponding to three 
calling programs and compilation scripts:

   i)   The basic 'serial' configuration used from Sections 4.1 - 4.3 is 
        controlled by run_ice_serial.F90, compiled with make_command_serial, and
        reads namelist run_ice.namelist, in which output directory, timestep
        values and vertical resolution are set;
   ii)  The 'parallel' configuration used in Section 4.4 is controlled by
        run_ice_parallel.F90, compiled with make_command_parallel, and also
        reads namelist run_ice.namelist;
   iii) The stability experiments of the Appendix are controlled by
        run_ice_stability.F90, compiled with make_command_stability.  This
        routine is very similar to the 'serial' control program, but makes
        use of different variables in the namelist.  It reads 
        run_ice_stability.namelist, in which wind speed and ice thickness
        are set.

In addition, the 1-D model contains a number of routines that are used by all 
configurations:

 - ice_therm_vertical.F90, where the ice thermodynamics are calculated;
 - ice_coupling.F90, where the surface energy balance is computed in the
   'JULES' configuration;
 - ice_domain_size.F90, where key array sizes are set;
 - ice_constants.F90, where physical constants are specified;
 - ice_kinds_mod.F90, where variable types are set.


For the stability configuration, a section of the calling program below the 
variable definition section allows output files, timestep values and vertical
resolution to be determined, but for the serial and parallel configurations 
these parameters can be set in the namelist.

For each configuration, a separate parameter called 'min_print' allows output 
to be written at a reduced frequency; this is useful for timestep equal to 1 
second, which would otherwise produce exceptionally large files.


N. B. A separate, older copy of the 1D model, without the JULES-style 
interface ice_coupling.F90, is kept in the subdirectory Section_3_code.  This
contains the version used to run the basic resolution experiments of 
Section 3 and is compiled with 'make_command'.  All parameters in this 
version are set within the calling program, in a section below the
variable definition area.


------------------------------------------------------------------------
(b) Plotting code of the main paper

This is written in IDL and directly reads data files written by the serial
and parallel configurations, which can be specified at the top of the routine;
it transforms data from these to 'ml1' structures, which associate each data
value with an integer number of seconds.  These data structures are 
automatically saved and if the parameter 'read_data' is subsequently set to 0,
the saved files are read instead, which is much quicker.

The three calling programs each begin 'Figure_'; their purpose is 
self-explanatory.  They each make use of ml1_read.pro, ml1_plot.pro, set_ml1.pro
and ml1_diff.pro.


------------------------------------------------------------------------
(c) Plotting code of the Appendix

To produce the stability maps of the appendix, it was necessary to run the 
solver a very large number of times with varying wind speed and ice thickness
values.  In the altered control structure, in addition to the ice and 
atmosphere data files, the 1D model writes either 0 or 1 to a 'result file'
to say whether or not it has successfully completed its run.  The code to run 
the ensemble, and plot the results, is written in Python.

The routine 'run_stability_analysis.py' loops through the required ice
thickness and wind speed values, in turn editing the namelist, running the 
model, checking for convergence in the result file, and then examining the ice
data file to determine the nature of the convergence, and its speed.  The 
2D arrays of results are written to Python pickle files in 'datadir'.

Following this, the routine 'plot_stability_analysis.py' produces a stability
map of the solver.  The text locations, labelling regions of oscillating or
monotonic convergence, are hardcoded and may need altering for different
configurations.

For Figure A2, the arrows joining the timeseries to the map were added in
Powerpoint, and these are not therefore visible in the raw matplotlib figure
produced by the routine.