SEAICE tutorial

From Fluids Wiki
Revision as of 10:49, 16 August 2018 by Tghill (talk | contribs)
Jump to navigation Jump to search

The SEAICE tutorial is intended to help you carry out the first few runs of the MITgcm in configurations with seaice and external forcing. and to become familiar with the gcmpy package for handling and processing MITgcm model output. It is recommended to have run the Gravity wave tutorial first.

This tutorial has three cases, which require increasingly more independent work. By the final case, you design your own initial conditions and setup files.

The setup files included in this tutorial should be a good starting point for designing new cases.

This tutorial assumes you have:

For this tutorial, change directories into the SEAICE_tutorial/ directory.


Case 1: Simple ice growth

This case is one of the most basic setups possible with seaice. We start with a shallow lake at constant temperature of +1 C, air temperature -10 C, with no wind and no downward radiation.

Build the model

cd into the case1/build directory. If you have followed the recommended directory structure, the following commands will build the model. The -j flag compiles in parallel.

   ../../../../tools/genmake2 -mods ../code [-of OPTFILE] -mpi
   make depend -j
   make -j

Run the model

Now we can run the model .We have to run the model using the same number of processors as we compiled for. In SIZE.h we set nPx = 4 and nPy = 4 so we use 16 processors. This case takes about 10 minutes to run on Hood for me. cd into the include directory. Run the python scripts:

   python initial_temperature.py
   python meteorological_forcing.py
   python rectangular_flat_bottomed_lake.py

Change into the run/ directory, cd ../run. Copy the necessary files

   cp ../include/data* .
   cp ../include/eedata .
   cp ../include/*bin .
   cp ../build/mitgcmuv .

Now you should be able to run the model. If you are on a system with SLURM (ie, Graham or Mountain Lake servers) you will need to make an SBATCH script, which might look like (Many more resources for making SLURM scripts on the Graham tips page)

   #!/bin/bash
   #SBATCH --time=00-00:30
   #SBATCH --account=ctb-mmstastn
   #SBATCH --job-name="MITgcm tut-01"
   #SBATCH --output=results
   #SBATCH --mem-per-cpu=2G
   #SBATCH --ntasks=16
   srun ./mitgcmuv

Then submit by running the command sbatch submit.sh (or whatever you called your script). If you're on a machine without SLURM (eg. Hood), you can run with

   mpirun -np 16 ./mitgcmuv &

Process the results

First we create netCDF files with the gcmpy.netCDFbinary package. In the directory with the binary output files, run the command

   python -m gcmpy.netCDFbinary T Rho U V W UICE VICE SIarea SIheff SIqnet

Once it finishes you should have some output_*.nc files in the run directory. Change directories into the data_processing directory. Look at the script copydata.sh. This script copies the necessary data from the run directory in the processing directory. Run the script.

Open the file makefigures.py. This script is formatted to make animations of the results with the gcmpy.postprocessing package. To make the animations, run

   python -m gcmpy.postprocessing makefigures.py

Once this finishes you should have 4 animations in the GIF subfolder, and screenshots saved in the PNG folder. This case isn't particularly exciting, but it is a minimal setup to run with the SEAICE and EXF packages.

Optional: Extra steps

Run the simulation longer, and see how thick the ice grows in a few days or a week of time. Re-process the results, and try changing some of the plot parameters. eg, take the constant x slice at a different value, change the colourmap, make a density animation.

Case 2: Advecting ice

This case focuses on setting up and initial configuration of ice, and letting the ice be advected by winds and surface currents. The instructions here are purposely less specific; by now you should be able to follow the usage pattern without explicit instructions. With this setup, when looking at the results it will seem like it takes a while for the ice to actually start moving. Only near the end of the simulated time does something start to happen. You can try making the simulation run longer, and you should see some interesting things happen.

Build and run the model

Build the model, and copy the executable to the run directory. Run the python scripts in the include directory, and copy the .bin files to the run/ directory. Copy over all the data files, as well as eedata. Run the model (check the number of required processors in SIZE.h)

Post-processing

Make the netCDF files for the binary model output. Remember, this is

   python -m gcmpy.netCDFbinary [FIELDS]

Where FIELDS is replaced by a list of all the diagnostics you want. Check the data.diagnostics file to see what you have available to convert.

I included a makefigures.py file in the data_processing directory. Copy over the netCDF files. The postprocessing routines also need the Depth.meta and Depth.data files to correctly map the bathymetry. Also copy over the data file; the post-processing routines read the time step and griding information from this.

Run the post-processing routines, and look at the results.

Optional: Extra steps

This simulation can run for a lot longer than it is set to here. Try reducing the output diagnostics frequency (just so you don't have a huge numberof files), and increase the end time of the model run. Try running for a few days. Look at the checkpoint frequency values in the data file. If you pick multiples of these times, you can use the checkpoint files to restart the model if you decide you want to run it for longer.


Case 3: Setting it up yourself

For this case we will use the setup from the previous simulations, but you will have to change the model parameters, modify the scripts to generate initial conditions, and control the post-processing routines yourself.

For this case we want to compare the effect of solar radiation over open water and ice-covered water. The changes you want to make are:

  • Change the resolution. Depending on your resources available, increase/decrease the number of processors and total Nx, Ny. Then modify data accordingly. Keep a domain that's a similar size -- pick a number that gives you close to integer resolution
  • Increase downward solar radiation to about 200 to 300 W/m2 in both shortwave and longwave.
  • Reduce the wind speed to about 0.5 to 1 m/s in x, keep 0 m/s in y
  • Change the air temperature to constant 0 C
  • Change the initial temperature of the lake to be temperature stratified, with 0 C on top and 4 C at the bottom. Use a tanh function. * Specifically, use T(z) = Tmax/2 * tanh[ (z0 - z) / d] where Tmax is the temperature at the surface, z0 is the depth of the center of the pycnocline, and d is the thickness of the pycnocline. Use Tmax = 4, and choose the other values to give a stratification you like.
  • Change initial ice configuration to 1 m thick 100% coverage in the northhalf of the lake.
  • Add some snow coverage to the northeast quarter of the ice sheet to insulate that side more
  • Change the run time to 1 day to start (86400 s)
  • Search through the available_diagnostics.log file from the other runs and add a few diagnostics you want to look at to the data.diagnostics file. It's probably a good idea to at least include SIhsnow, the effective snow thickness. To have more than 10 diagnostics you will have to increase numlists = 10 and numdiags = 10*Nr above 10. I usually increase to 25.

Note: I had to set checkIniTemp=.FALSE. in NML05 of data because I had temperature specified at exactly 0C at the top. The model did not like this.

A sample solution is given in the case3_solution directory. This is an open-ended case, so try a few configurations and see what happens. They don't have to be the same as the sample solution provided.