Library

The public user interface.

Architectures

Grids

Fields

PlanktonIndividuals.Fields.FieldMethod
Field(arch::Architecture, grid::AbstractGrid, FT::DataType; bcs = default_bcs())

Construct a Field on grid with data and boundary conditions on architecture arch with DataType FT.

source
PlanktonIndividuals.Fields.set_bc!Method
set_bc!(model; tracer::Symbol, pos::Symbol, bc_value::Union{Number, AbstractArray})

Set the boundary condition of tracer on pos with bc_value of DataType FT.

Keyword Arguments

  • tracer: the tracer of which the boundary condition will be set.
  • pos: the position of the bounday condition to be set, e.g., :east, :top etc.
  • bc_value: the value that will be used to set the boundary condition.
source

Biogeochmeistry

PlanktonIndividuals.Biogeochemistry.generate_nutrientsMethod
generate_nutrients(arch, grid, source, FT)

Set up initial nutrient fields according to grid.

Arguments

  • arch: CPU() or GPU(). The computer architecture used to time-step model.
  • grid: The resolution and discrete geometry on which nutrient fields are solved.
  • source: A NamedTuple containing 10 numbers each of which is the uniform initial condition of one tracer, or a Dict containing the file paths pointing to the files of nutrient initial conditions.
  • FT: Floating point data type. Default: Float32.
source

Parameters

PlanktonIndividuals.Parameters.update_bgc_paramsMethod
update_bgc_params(tmp::Ditc, FT::DataType)

Update parameter values based on a Dict provided by user

Keyword Arguments

  • tmp: a Dict containing the parameters needed to be upadated
  • FT: Floating point data type. Default: Float32.
source
PlanktonIndividuals.Parameters.update_phyt_paramsMethod
update_phyt_params(tmp::Dict, FT::DataType; N::Int64, mode::AbstractMode)

Update parameter values based on a Dict provided by user Keyword Arguments =================

  • tmp is a Dict containing the parameters needed to be upadated
  • FT: Floating point data type. Default: Float32.
  • N is a Int64 indicating the number of species
  • mode is the mode of phytoplankton physiology resolved in the model
source

Diagnostics

PlanktonIndividuals.Diagnostics.PlanktonDiagnosticsMethod
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

PlanktonIndividuals.IronEnergyModeType
IronEnergyMode <: AbstractMode

Type for the phytoplankton physiology mode which resolves carbon, nitrogen, phosphorus, and iron quotas. This mode also resolves energy.

source
PlanktonIndividuals.Model.PlanktonModelMethod
PlanktonModel(arch::Architecture, grid::AbstractGrid;
              FT = Float32,
              mode = QuotaMode(),
              N_species = 1,
              N_individual = [1024],
              max_individuals = 1024*8,
              bgc_params = nothing, 
              phyt_params = nothing,
              nut_initial = default_nut_init(),
              t = 0.0,
              )

Generate a PlanktonModel data structure.

Keyword Arguments (Required)

  • arch : CPU() or GPU(). Computer architecture being used to run the model.
  • grid : a AbstractGrid structure. Discrete grid for the model (resolution and geometry).

Keyword Arguments (Optional)

  • FT: Floating point data type. Default: Float32.
  • mode : Phytoplankton physiology mode, choose among CarbonMode(), QuotaMode(), or MacroMolecularMode().
  • N_species : Number of species.
  • N_individual : Number of individuals per species, should be a vector with N_species elements.
  • max_individuals : Maximum number of individuals for each species the model can hold, usually take the maximum of all the species and apply a factor to account for the growth of individuals during one simulation.
  • bgc_params : Parameter set for biogeochemical processes modeled in the model, use default if nothing, use Dict to update parameters, the format and names of parameters can be found by running bgc_params_default().
  • phyt_params : Parameter set for physiological processes of individuals modeled in the model, use default if nothing, use Dict to update parameters, the format and names of parameters can be found by running phyt_params_default(N_species, mode).
  • nut_initial : The source of initial conditions of nutrient fields, should be either a NamedTuple or a Dict containing the file paths pointing to the files of nutrient initial conditions.
  • t : Model time, start from 0 by default, in second.
source

Simulation

PlanktonIndividuals.Simulation.PlanktonSimulationMethod
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
PlanktonIndividuals.Simulation.update!Method
update!(sim::PlanktonSimulation; time_offset = (vels = true, PAFR = true, temp = true))

Update the PlanktonSimulation for sim.iterations time steps. time_offset is used when velocities (or PARF or temperature) starts from timestep 1, but model.t is not. It is usually used when velocity fields are too large and need to be broken down into several parts. Only one part of the whole velocity fields can be constructed into a PlanktonSimulation, so in this PlanktonSimulation model.iteration might no be 1, but the velocity fields need to start from 1 (same for PARF or temperature fields).

source

Output

PlanktonIndividuals.Output.PlanktonOutputWriterMethod
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