Model Simulation

A PlanktonSimulation includes a PlanktonModel and its time step ΔT and number of time steps nΔT. It will time step the PlanktonModel by calling update!.

PlanktonIndividuals.Simulation.PlanktonSimulationType
PlanktonSimulation(model; ΔT, iterations,
                   PARF = default_PARF(model.grid),
                   temp = default_temperature(model.grid),
                   diags = nothing,
                   vels = (;),
                   ΔT_vel = ΔT,
                   ΔT_PAR::AbstractFloat = 3600.0f0,
                   ΔT_temp::AbstractFloat = 3600.0f0,
                   output_writer = nothing,
                   )

Generate a PlanktonSimulation data structure.

Keyword Arguments (Required)

  • ΔT : time step in second.
  • iterations : run the simulation for this number of iterations.

Keyword Arguments (Optional)

  • PARF : External forcings of surface PAR. Hourly PAR of a single day is provided by default.
  • temp : External forcings of temperature. Hourly data of a single day is provided by default.
  • diags : Diagnostics of the simulation generated by PlanktonDiagnostics.
  • vels : The velocity fields for nutrient fields and individuals. nothing means no velocities will be applied in the simulation. Otherwise, vels mush be a NamedTuple containing all u, v, and w. Each of u, v, and w must be an 4D-Array of (Nx, Ny, Nz, nΔT) elements, excluding halo points. N+1 is required for bounded direction.
  • ΔT_vel : time step of velocities provided externally (in seconds).
  • ΔT_PAR : time step of surface PAR provided externally (in seconds).
  • ΔT_temp : time step of temperature provided externally (in seconds).
  • output_writer : Output writer of the simulation generated by PlanktonOutputWriter.
source

Model Diagnostics

PlanktonIndividuals.Diagnostics.PlanktonDiagnosticsType
PlanktonDiagnostics(model; tracer=(:PAR, :NH4, :NO3, :DOC),
                    plankton=(:num, :graz, :mort, :dvid),
                    time_interval = 1)

Generate a PlanktonDiagnostics structure.

Keyword Arguments (Optional)

  • tracer : a Tuple containing the names of nutrient fields to be diagnosed.
  • plankton : a Tuple containing the names of physiological processes of plankton individuals to be diagnosed.
  • iteration_interval : The number of timesteps that diagnostics is averaged, 1 iteration by default.
source

Model diagnostics are specified by tracer (for tracers) and plankton (for individuals). Diagnostics for individuals are aggregated into gridded fields.

A full list of available diagnostics is provided below:

tracer = (:PAR, # photosynthetically active radiation
          :DIC, # dissolved inorganic carbon
          :NH4, # ammonia
          :NO3, # nitrate
          :PO4, # phosphate
          :DOC, # dissolved organic carbon
          :DON, # dissolved organic nitrogen
          :DOP, # dissolved organic phosphorus
          :POC, # particulate organic carbon
          :PON, # particulate organic nitrogen
          :POP  # particulate organic phosphorus
         )

plankton = (:num,  # number of individuals
            :graz, # number of grazed individuals
            :mort, # number of died individuals
            :dvid, # number of divided individuals
            :PS,   # photosynthesis rate
            :BS,   # biosynthesis rate
            :VDOC, # DOC uptake rate
            :VHN4, # NH4 uptake rate
            :VNO3, # NO3 uptake rate
            :VPO4, # PO4 uptake rate
            :resp, # respiration rate
            :exu,  # exudation rate
            :Bm,   # functional biomass
            :Cq,   # Carbon pool
            :Nq,   # Nitrogen pool
            :Pq,   # Phosphorus pool
            :Chl   # Chla
           )

Output Writer

PlanktonIndividuals.Output.PlanktonOutputWriterType
PlanktonOutputWriter(;dir = "./results",
                           diags_prefix = "diags",
                           plankton_prefix = "plankton",
                           write_log = false,
                           save_diags = false,
                           save_plankton = false,
                           plankton_include = (:x, :y, :z, :Sz),
                           plankton_iteration_interval = 1,
                           max_filesize = Inf,
                           )

Generate a PlanktonOutputWriter structure which includes settings for model outputs

Keyword Arguments (Optional)

  • dir: The directory to store model outputs, "./results" by default
  • diags_prefix: Descriptive filename prefixed to diagnostic output files.
  • plankton_prefix: Descriptive filename prefixed to plankton output files.
  • write_log: write model logs which contain global averages of simulated plankton, default: false.
  • save_diags: write diagnostics to disk, default: false.
  • save_plankton: write plankton to disk, default: false.
  • plankton_include: list of plankton properties to save, default: (:x, :y, :z, :Sz).
  • plankton_iteration_interval: The time interval that plankton are saved, 1 timestep by default.
  • max_filesize: The writer will stop writing to the output file once the file size exceeds max_filesize, and write to a new one with a consistent naming scheme ending in part1, part2, etc. default: Inf.
source

The model currently has two types of outputs which are both saved in JLD2 files.

First, the state of all individuals at each time step of a PlanktonSimulation gets saved in a file named plankton_prefix*".jld2", default: plankton.jld2.

Second, for diagnostics, individuals at each time step will be aggregated into tracer fields. The keyword argument time_interval in PlanktonDiagnostics specifies the time window that the diagnostics are averaged. Only diagnostics specified by tracer and plankton in PlanktonDiagnostics will be saved. All the diagnostics of a PlanktonSimulation will be saved in a file named diags_prefix*".jld2", default: diags.jld2.