All Docs

Main.DarOneTools.MITgcm_pathConstant
MITgcm_path

Path to a MITgcm folder. MITgcm_path[1] should generally be used. MITgcm_path[2] is mostly meant to facilitate comparisons between e.g. MITgcm releases when needed.

source
Main.DarOneTools.base_configurationConstant
base_configuration

Name of the folder that lives in the /verificaion folder of the MITgcm. This holds the basic configuration for Dar_One, which is a homogenous 1m x 1m x 1m water parcel with air/sea exchange, no mixing, few nuturients, and no biological forcing.

source
Main.DarOneTools.filexeConstant
filexe

Path to the file that contains the built MITgcm, normally named "mitgcmuv". The executable should be compiled on whatever machine you're using to run the model, unless using the docker container [TODO: link]

source
Main.DarOneTools.MITgcm_configType
MITgcm_config()

Concrete type of AbstractModelConfig for MITgcm (as part of the ClimateModels.jl interface for MITgcm) which contains

    model :: String = "MITgcm"
    configuration :: String = ""
    options :: OrderedDict{Any,Any} = OrderedDict{Any,Any}()
    inputs :: OrderedDict{Any,Any} = OrderedDict{Any,Any}()
    outputs :: OrderedDict{Any,Any} = OrderedDict{Any,Any}()
    status :: OrderedDict{Any,Any} = OrderedDict{Any,Any}()
    channel :: Channel{Any} = Channel{Any}(10) 
    folder :: String = tempdir()
    ID :: UUID = UUIDs.uuid4()

and can be constructed using keywords as follows

unknown_config=MITgcm_config(configuration="unknown")
source
Main.DarOneTools.MITgcm_namelistType
MITgcm_namelist(groups,params)

Data structure representing a MITgcm namelist file, such as data.pkg, which contains

    groups :: Array{Symbol,1} = Array{Symbol,1}(undef, 0)
    params :: Array{OrderedDict{Symbol,Any},1} = Array{OrderedDict{Symbol,Any},1}(undef, 0)

with model parameters (params) being organized in groups as done in the files.

using MITgcmTools
fil=joinpath(MITgcm_path[1],"verification","advect_xy","run","data")
nml=read_namelist(fil)
MITgcm_namelist(nml.groups,nml.params)
MITgcm_namelist(groups=nml.groups,params=nml.params)
MITgcm_namelist(groups=nml.groups)
source
ClimateModels.buildMethod
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.buildMethod
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

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

source
ClimateModels.cleanMethod
clean(config::MITgcm_config)

Cancel any remaining task (config.channel) and clean up the run directory (via rm).

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

source
ClimateModels.compileMethod
compile(config::MITgcm_config)

Compile the model using make in build/ that has already been setup.

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

source
ClimateModels.setupMethod
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
Main.DarOneTools.MITgcm_launchMethod
MITgcm_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
Main.DarOneTools.create_MITgcm_configMethod
create_MITgcm_config(config_id)

Arguments:

  • configid: unique name for your darone run

Returns

  • configobj::MITgcmconfig
  • rundir::AbstractString - folder where output will be
source
Main.DarOneTools.hold_nutrients_constantFunction

holdnutrientsconstant(param_list)

Takes a vector of length 19, for each of the non-plankton tracers, with values of either 0 or 1. This function modifies darwin_plankton.F, and mulitplies the computed tendencies of the nutrient tracers by the value passed in. 0 = hold constant 1 = allow change

The appropriate vector to pass in to hold all nutrients constant would be zeros(19). To allow all nutrients to vary, the parameter would be ones(19). The indices in the param_list correspond to the following nutrients, in order: [DIC, NO3, NO2, NH4, PO4, SiO2, FeT, DOC, DON, DOP, DOFe, PIC, POC, PON, PIP, PISi, POFe, ALK, O2]

source
Main.DarOneTools.init_temperature_gridFunction
init_temperature_grid(config_obj, tracer_name, init_list, dim, grid_size=(5,3))

Create a bin file of initial values for temperature. For a grid of size (X, Y), the initial conditions for each grid cell are set in a binary file with X*Y number of floats, in big-endian format, with no headers.

Arguments

  • config_obj
  • tracer_name: String
  • init_list: list of values to initialize the temperature to
  • dim: "x" or "y" - which dimension to set to the list; values won't change along the other axis
  • grid_size: tuple ints, default 2x2

Returns

  • the matrix of initial values
source
Main.DarOneTools.init_temperature_gridMethod
init_temperature_grid(config_obj, tracer_name, init_matrix)

Create a bin file of initial values for temperature. For a grid of size (X, Y), the initial conditions for each grid cell are set in a binary file with X*Y number of floats, in big-endian format, with no headers.

Arguments

  • config_obj
  • init_matrix: 2D list of values to write to the bin file

Returns

  • the matrix of initial values
source
Main.DarOneTools.init_tracer_gridFunction
init_tracer_grid(config_obj, tracer_name, init_list, dim, grid_size=(5,3))

Create a bin file of initial values for a tracer. For a grid of size (X, Y), the initial conditions for each grid cell are set in a binary file with X*Y number of floats, in big-endian format, with no headers.

Arguments

  • config_obj
  • tracer_name: String
  • init_list: list of values to initialize the tracer to
  • dim: "x" or "y" - which dimension to set to the list; values won't change along the other axis
  • grid_size: tuple ints, default 2x2

Returns

  • the matrix of initial values
source
Main.DarOneTools.init_tracer_gridMethod
init_tracer_grid(config_obj, tracer_name, init_matrix)

Create a bin file of initial values for a tracer. For a grid of size (X, Y), the initial conditions for each grid cell are set in a binary file with X*Y number of floats, in big-endian format, with no headers.

Arguments

  • config_obj
  • tracer_name: String
  • init_matrix: 2D list of values to write to the bin file

Returns

  • the matrix of initial values
source
Main.DarOneTools.read_available_diagnosticsMethod
read_available_diagnostics(fldname::String; filename="available_diagnostics.log")

Get the information for a particular variable fldname from the available_diagnostics.log text file generated by MITgcm.

source
Main.DarOneTools.read_mdsioMethod
read_mdsio(pth::String,fil::String)

Read a set of MITgcm MDSIO-type files (".data" binary + ".meta" text pair), combine, and return as an Array. Unlike read_mdsio(fil::String) where fil is one complete file name, this method will search within pth for files that start with fil.

p="./hs94.cs-32x32x5/run/"
x=read_mdsio(p,"surfDiag.0000000020")
y=read_mdsio(p,"pickup.ckptA")
z=read_mdsio(p,"T.0000000000")
source
Main.DarOneTools.read_mdsioMethod
read_mdsio(fil::String)

Read a single MITgcm MDSIO-type file (".data" binary + ".meta" text pair), and return as an Array

p="./hs94.cs-32x32x5/run/"
x=read_mdsio(p*"surfDiag.0000000020.002.001.data")
y=read_mdsio(p*"pickup.ckptA.002.001.data")
z=read_mdsio(p*"T.0000000000.002.001.data")
source
Main.DarOneTools.read_metaMethod
read_meta(metafile)

Read a MITgcm metadata file, parse it, and return as a NamedTuple

p="./hs94.cs-32x32x5/run/"
meta=read_meta(p*"surfDiag.0000000020.002.001.meta")
pairs(meta)
meta.dimList
source
Main.DarOneTools.read_metaMethod
read_meta(pth::String,fil::String)

Read a MITgcm metadata files, parse them, and return as an array of NamedTuple

p="./hs94.cs-32x32x5/run/"
meta=read_meta(p,"surfDiag.0000000020")
pairs(meta[end])
[meta[i].dimList for i in 1:length(meta)]
source
Main.DarOneTools.read_mncMethod
read_mnc(pth::String,fil::String,var::String)

Read variable var from a set of MITgcm MNC-type files (netcdf files), combine, and return as an Array. This method will search within pth for files that start with fil.

source
Main.DarOneTools.read_namelistMethod
read_namelist(fil)

Read a MITgcm namelist file, parse it, and return as a NamedTuple

  • assumes a single variable definition per line
using MITgcmTools
testreport("advect_xy")
fil=joinpath(MITgcm_path[1],"verification","advect_xy","run","data")
namelist=read_namelist(fil)
source
Main.DarOneTools.scan_rundirMethod
scan_rundir(pth::String)

Scan a MITgcm run directory and standard output text file ("output.txt" or "STDOUT.0000") and return a NamedTuple of collected information (various formats)

Initially, the output looked like (grid=gr,packages=pac,params_time=par1,params_grid=par2,completed=co)

source
Main.DarOneTools.scan_stdoutMethod
scan_stdout(filout::String)

Scan a MITgcm standard output text file ("output.txt" or "STDOUT.0000") and return a NamedTuple of collected information (various formats).

  • packages : report of packages being compiled and used
  • params_time : initial time, model duation, output frequency, etc
  • params_grid : type of grid (Curvilinear, Cartesian, ...) and array sizes
  • paramsfiles : type of output (usemdsio, use_mnc) and array size (ioSize)
  • completed : true / false depending on the end of standard output file (filout)
source
Main.DarOneTools.testreportFunction
testreport(nam::String,ext="")

Run the testreport script for one model config nam (or "all"), with additional options (optional) speficied in ext

using MITgcmTools
testreport(MITgcm_config(configuration="front_relax"),"-norun")
#testreport(MITgcm_config(configuration="all"),"-norun")
source
Main.DarOneTools.update_ALKMethod
update_ALK(config_obj, new_val)

Arguments:

  • config_obj: the MITgcm_config you are working with
  • new_val: amount of ALK for the model's initial condition (note: it will equalize through air-sea exchange)
source
Main.DarOneTools.update_CDOMMethod
update_CDOM(config_obj, new_val)

Arguments:

  • config_obj: the MITgcm_config you are working with
  • new_val: amount of CDOM for the model's initial condition
source
Main.DarOneTools.update_DOCMethod
update_DOC(config_obj, new_val)

Arguments:

  • config_obj: the MITgcm_config you are working with
  • new_val: amount of DOC for the model's initial condition
source
Main.DarOneTools.update_DOFeMethod
update_DOFe(config_obj, new_val)

Arguments:

  • config_obj: the MITgcm_config you are working with
  • new_val: amount of DOFe for the model's initial condition
source
Main.DarOneTools.update_DONMethod
update_DON(config_obj, new_val)

Arguments:

  • config_obj: the MITgcm_config you are working with
  • new_val: amount of DON for the model's initial condition
source
Main.DarOneTools.update_DOPMethod
update_DOP(config_obj, new_val)

Arguments:

  • config_obj: the MITgcm_config you are working with
  • new_val: amount of DOP for the model's initial condition
source
Main.DarOneTools.update_FeTMethod
update_FeT(config_obj, new_val)

Arguments:

  • config_obj: the MITgcm_config you are working with
  • new_val: amount of FeT for the model's initial condition
source
Main.DarOneTools.update_NH4Method
update_NH4(config_obj, new_val)

Arguments:

  • config_obj: the MITgcm_config you are working with
  • new_val: amount of NH4 for the model's initial condition
source
Main.DarOneTools.update_NO2Method
update_NO2(config_obj, new_val)

Arguments:

  • config_obj: the MITgcm_config you are working with
  • new_val: amount of NO2 for the model's initial condition
source
Main.DarOneTools.update_NO3Method
update_NO3(config_obj, new_val)

Arguments:

  • config_obj`: the MITgcm_config you are working with
  • new_val: amount of NO3 for the model's initial condition
source
Main.DarOneTools.update_O2Method
update_O2(config_obj, new_val)

Arguments:

  • config_obj: the MITgcm_config you are working with
  • new_val: amount of O2 for the model's initial condition (note: it will equalize through air-sea exchange)
source
Main.DarOneTools.update_PICMethod
update_PIC(config_obj, new_val)

Arguments:

  • config_obj: the MITgcm_config you are working with
  • new_val: amount of PIC for the model's initial condition
source
Main.DarOneTools.update_PO4Method
update_PO4(config_obj, new_val)

Arguments:

  • config_obj`: the MITgcm_config you are working with
  • new_val: amount of PO4 for the model's initial condition
source
Main.DarOneTools.update_POCMethod
update_POC(config_obj, new_val)

Arguments:

  • config_obj: the MITgcm_config you are working with
  • new_val: amount of POC for the model's initial condition
source
Main.DarOneTools.update_POFeMethod
update_POFe(config_obj, new_val)

Arguments:

  • config_obj: the MITgcm_config you are working with
  • new_val: amount of POFe for the model's initial condition
source
Main.DarOneTools.update_PONMethod
update_PON(config_obj, new_val)

Arguments:

  • config_obj: the MITgcm_config you are working with
  • new_val: amount of PON for the model's initial condition
source
Main.DarOneTools.update_POPMethod
update_POP(config_obj, new_val)

Arguments:

  • config_obj: the MITgcm_config you are working with
  • new_val: amount of POP for the model's initial condition
source
Main.DarOneTools.update_POSiMethod
update_POSi(config_obj, new_val)

Arguments:

  • config_obj: the MITgcm_config you are working with
  • new_val: amount of POSi for the model's initial condition
source
Main.DarOneTools.update_SiO2Method
update_SiO2(config_obj, new_val)

Arguments:

  • config_obj: the MITgcm_config you are working with
  • new_val: amount of SiO2 for the model's initial condition
source
Main.DarOneTools.update_all_diagnostic_freqsFunction
update_all_diagnostic_freqs(config_obj, frequency)

Speficy a frequency in seconds at which to write all diagnostic files

Arguments:

  • configobj: the MITgcmconfig you are working with
  • frequency: new frequency at which to write to the files, in seconds
source
Main.DarOneTools.update_diagnostic_freqMethod
update_diagnostic_freq(config_obj, diagnostic_num, frequency)

Speficy a frequency in seconds at which to write to a diagnostic file

Arguments:

  • diagnostic_num: the integer identifier for the diagnostic file you want to modify
  • frequency: new frequency at which to write to that file, in seconds
  • configobj: the MITgcmconfig you are working with

TODO: create enums for diagnostic names (and name them better?)

TODO: what should the initial frequency be? - in file

source
Main.DarOneTools.update_end_timeMethod
update_end_time(end_time, config_obj)

Set how long the simulation will run, in iterations. Each iteration is 3 hours, or 10800 seconds. One year is 2880 iterations, which is the default.

Arguments:

  • end_time: how many iterations to run the model for
  • configobj: the MITgcmconfig you are working with
source
Main.DarOneTools.update_paramsMethod
update_params(config_obj, file_name, group_names, param_names, new_param_values)

Update multiple parameters in the same file.

Arguments:

  • TODO
source
Main.DarOneTools.update_proMethod
update_pro(config_obj, new_val)

Arguments:

  • config_obj: the MITgcm_config you are working with
  • new_val: amount of Prochlorococcus for the model's initial condition
source
Main.DarOneTools.update_radtransMethod
update_radtrans(config_obj, ds::NCDataset, x, y, z, t)

Arguments:

  • config_obj: the MITgcm_config you are working with
  • new_val: amount of Synechococcus for the model's initial condition
source
Main.DarOneTools.update_synMethod
update_syn(config_obj, new_val)

Arguments:

  • config_obj: the MITgcm_config you are working with
  • new_val: amount of Synechococcus for the model's initial condition
source
Main.DarOneTools.update_temperatureMethod
update_temperature(config_obj, new_temp)

Set the temperature (in celcius). This temperature will be constant throughout the run. TODO: how do you set a variable temperature? i.e. seasonal?

Arguments:

  • new_temp: new temperature in celsius
  • configobj: the MITgcmconfig you are working with
source
Main.DarOneTools.write_namelistMethod
write_namelist(fil)

Save a MITgcm namelist file. In the example below, one is read from file, modified, and then saved to a new file using write_namelist.

using MITgcmTools
fil=joinpath(MITgcm_path[1],"verification","advect_xy","run","data")
nml=read_namelist(fil)
write_namelist(fil*"_new",namelist)

or

nml=read(fil,MITgcm_namelist())
write(fil*"_new",nml)
source