Interface to MITgcm

The ClimateModels.jl's interface is implemented in MITgcm.jl.

This allows you to easily create model simulations using MITgcm conveniently from Julia.

using MITgcm
MC=MITgcm_config(configuration="advect_xy")
setup(MC)
build(MC)
launch(MC)
"STOP NORMAL END"

Or in abbreviated form, equivalently :

using MITgcm
MC=run( MITgcm_config(configuration="advect_xy") )

To get information about how the model simulation is going (or has gone) :

monitor(MC)
  ID            = a4c0abb4-7915-4845-9559-66756d21809c
  model         = MITgcm
  configuration = advect_xy
  run folder    = /tmp/a4c0abb4-7915-4845-9559-66756d21809c
  log subfolder = /tmp/a4c0abb4-7915-4845-9559-66756d21809c/log
  task(s)       = MITgcm_launch

packages
8×2 DataFrame
 Row │ name             value
     │ Symbol           Bool
─────┼────────────────────────
   1 │ generic_advdiff   true
   2 │ mom_common       false
   3 │ mom_vecinv       false
   4 │ mom_fluxform     false
   5 │ monitor           true
   6 │ debug            false
   7 │ rw                true
   8 │ mdsio             true

params_grid
13×2 DataFrame
 Row │ name                     value
     │ Symbol                   Int64
─────┼────────────────────────────────
   1 │ usingCurvilinearGrid         0
   2 │ nSy                          2
   3 │ usingCartesianGrid           1
   4 │ nPx                          1
   5 │ sNy                         10
   6 │ usingCylindricalGrid         0
   7 │ Nx                          20
   8 │ sNx                         20
   9 │ nSx                          1
  10 │ Nr                           1
  11 │ Ny                          10
  12 │ usingSphericalPolarGrid      0
  13 │ nPy                          1

params_files
3×2 DataFrame
 Row │ name       value
     │ Symbol     Any
─────┼─────────────────────────
   1 │ use_mdsio  true
   2 │ use_mnc    false
   3 │ ioSize     (20.0, 20.0)

params_time
7×2 DataFrame
 Row │ name         value
     │ Symbol       Float64
─────┼──────────────────────
   1 │ nEndIter        80.0
   2 │ deltaTClock   2500.0
   3 │ nIter0           0.0
   4 │ monitorFreq  40000.0
   5 │ pChkPtFreq       0.0
   6 │ nTimeSteps      80.0
   7 │ dumpFreq     40000.0

completed
1×2 DataFrame
 Row │ name   value
     │ Int64  Bool
─────┼──────────────
   1 │     1   true

Functionalities

Main

Note

The following three methods implement the ClimateModels.jl's interface for MITgcm.

ClimateModels.setupFunction
setup(config::MITgcm_config)

Create a run/ folder and link everything there as needed to be ready to run model as normally done for most-standard MITgcm configurations (incl. prepare_run and mitgcmuv). Call ClimateModels.git_log_init(config) to setup git tracker and put!(config.channel,MITgcm_launch) to be executed via launch(config) later.

(part of the climate model interface as specialized for MITgcm)

source
ClimateModels.buildFunction
build(config::MITgcm_config)

Build the model using genmake2, make depend, and make. The first two link all code files, headers, etc in the build/ folder before compiling the model.

Note : this is skipped if config.inputs[:setup][:main][:exe] is specified.

source
build(config::MITgcm_config,options::String)

Build the model using genmake2, make depend, and make unless otherwise specified via options. The genmake2 and make depend commands link all code files, headers, etc in the build/ folder before make compiles the model.

(part of the climate model interface as specialized for MITgcm)

source
ClimateModels.launchFunction
launch(config::MITgcm_config)

Go to run/ folder and effectively call mitgcmuv > output.txt

(part of the climate model interface as specialized for MITgcm)

source

Tools

MITgcm.MITgcm_system_checkType
MITgcm_system_check()

Output of MITgcm.system_check.

  download :: Bool = false
  complete :: Bool = false
  genmake_log :: OrderedDict{Any,Any} = OrderedDict{Any,Any}()
  genmake_state :: OrderedDict{Any,Any} = OrderedDict{Any,Any}()
  name :: String = "advect_xy"
  folder :: String = ""
  path_MITgcm :: String = ""
  path_verification :: String = ""
  NETCDF_ROOT :: String = ""
  MPI_INC_DIR :: String = ""
  mpi :: Bool = false
source
MITgcm.system_checkFunction
system_check(;setenv=false,exe="",mpi=false,adj=false,opt=" -devel -ds -ieee")

Run a suite of diagnostics, including a test run of MITgcm.

Notes :

  • adj=true requires a properly set up TAF license
  • fix needed : tutorialglobalocebiogeo/inputad/data.gmredi and data.grdchk
using MITgcm
SC=system_check()
source
MITgcm.test_runFunction
test_run(MC::MITgcm_config; exe="", opt=" -devel -ds -ieee")

Build (exe="") and run a small MITgcm simulation. Ifexe` is specified then reuse precompiled executable.

using MITgcm
MC=MITgcm_config(configuration="advect_xy")
test_run(MC)
source
test_run(MC::MITgcm_config; exe="", mpi=false, adj=false, opt=" -devel -ds -ieee")
using MITgcm
MITgcm_path[1]=joinpath(MITgcm.getdata("mitgcmsmall"),"MITgcm")
MITgcm_path[2]=joinpath(MITgcm.getdata("mitgcmsmallverif"),"MITgcm","verification")
test_run("advect_xy")
source
MITgcm.setenvFunction
setenv(a,b)

Set environment variable a to value b. Issue warning.

MITgcm.setenv("DATADEPS_ALWAYS_ACCEPT",true)
env=MITgcm.default_environment_variables()
MITgcm.setenv("NETCDF_ROOT",env.NETCDF_ROOT)
MITgcm.setenv("MPI_INC_DIR",env.MPI_INC_DIR)
system_check()
source
MITgcm.set_environment_variables_to_defaultFunction
set_environment_variables_to_default()

Defines environment variables to default values.

!!! Warning : it is generally much better to adjust them to your own system !!!

!!! Warning : the defaults will likely NOT work on most systems !!!

source
MITgcm.getdataFunction
getdata(nam::String)

Add data to the scratch space folder. Known options for nam include "mitgcmsmall", "mitgcmsmallverif", "hs94pickup", "darwin3code", "darwin3oneD"

source
MITgcm.create_scriptFunction
create_script(rundir=pwd(),filename="")

Create submission script – for NASA pleiades in this example.

submission_script=MITgcm.create_script(pwd(),"job.csh")
source