Library
The public user interface.
Architectures
PlanktonIndividuals.Architectures.Architecture
— TypeArchitecture
Abstract type for architectures supported by PlanktonIndividuals.
PlanktonIndividuals.Architectures.CPU
— TypeCPU <: Architecture
Run PlanktonIndividuals on one CPU node.
PlanktonIndividuals.Architectures.GPU
— TypeGPU <: Architecture
Run PlanktonIndividuals on one CUDA GPU node.
Grids
PlanktonIndividuals.Grids.AbstractGrid
— TypeAbstractGrid{FT, TX, TY, TZ}
Abstract type for grids with elements of type FT
and topology {TX, TY, TZ}
.
PlanktonIndividuals.Grids.Bounded
— TypeBounded
Grid topology for bounded dimensions.
PlanktonIndividuals.Grids.Periodic
— TypePeriodic
Grid topology for periodic dimensions.
Fields
PlanktonIndividuals.Fields.Field
— MethodField(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
.
PlanktonIndividuals.Fields.set_bc!
— Methodset_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.
Biogeochmeistry
PlanktonIndividuals.Biogeochemistry.default_nut_init
— Methoddefault_nut_init()
Generate defalut nutrient initial conditions.
PlanktonIndividuals.Biogeochemistry.generate_nutrients
— Methodgenerate_nutrients(arch, grid, source, FT)
Set up initial nutrient fields according to grid
.
Arguments
arch
:CPU()
orGPU()
. The computer architecture used to time-stepmodel
.grid
: The resolution and discrete geometry on which nutrient fields are solved.source
: ANamedTuple
containing 10 numbers each of which is the uniform initial condition of one tracer, or aDict
containing the file paths pointing to the files of nutrient initial conditions.FT
: Floating point data type. Default:Float32
.
Parameters
PlanktonIndividuals.Parameters.bgc_params_default
— Methodbgc_params_default(FT::DataType)
Generate default biogeochemical parameter values
PlanktonIndividuals.Parameters.default_PARF
— Methoddefault_PARF(grid, ΔT, iterations)
Generate default hourly surface PAR.
PlanktonIndividuals.Parameters.default_temperature
— Methoddefault_temperature(grid, ΔT, iterations)
Generate default hourly temperature.
PlanktonIndividuals.Parameters.phyt_params_default
— Methodphyt_params_default(N::Int64, mode::AbstractMode)
Generate default phytoplankton parameter values based on AbstractMode
and species number N
.
PlanktonIndividuals.Parameters.phyt_params_default
— Methodphyt_params_default(N::Int64, mode::AbstractMode)
Generate default phytoplankton parameter values based on AbstractMode
and species number N
.
PlanktonIndividuals.Parameters.update_bgc_params
— Methodupdate_bgc_params(tmp::Ditc, FT::DataType)
Update parameter values based on a Dict
provided by user
Keyword Arguments
tmp
: aDict
containing the parameters needed to be upadatedFT
: Floating point data type. Default:Float32
.
PlanktonIndividuals.Parameters.update_phyt_params
— Methodupdate_phyt_params(tmp::Dict, FT::DataType; N::Int64, mode::AbstractMode)
Update parameter values based on a Dict
provided by user Keyword Arguments =================
tmp
is aDict
containing the parameters needed to be upadatedFT
: Floating point data type. Default:Float32
.N
is aInt64
indicating the number of speciesmode
is the mode of phytoplankton physiology resolved in the model
Diagnostics
PlanktonIndividuals.Diagnostics.PlanktonDiagnostics
— MethodPlanktonDiagnostics(model; tracer=(:PAR, :NH4, :NO3, :DOC),
plankton=(:num, :graz, :mort, :dvid),
time_interval = 1)
Generate a PlanktonDiagnostics
structure.
Keyword Arguments (Optional)
tracer
: aTuple
containing the names of nutrient fields to be diagnosed.plankton
: aTuple
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.
Model
PlanktonIndividuals.CarbonMode
— TypeCarbonMode <: AbstractMode
Type for the phytoplankton physiology mode which only resolves carbon quota.
PlanktonIndividuals.IronEnergyMode
— TypeIronEnergyMode <: AbstractMode
Type for the phytoplankton physiology mode which resolves carbon, nitrogen, phosphorus, and iron quotas. This mode also resolves energy.
PlanktonIndividuals.MacroMolecularMode
— TypeMacroMolecularMode <: AbstractMode
Type for the phytoplankton physiology mode which resolves marco-molecules.
PlanktonIndividuals.QuotaMode
— TypeQuotaMode <: AbstractMode
Type for the phytoplankton physiology mode which resolves carbon, nitrogen, and phosphorus quotas.
PlanktonIndividuals.Model.PlanktonModel
— MethodPlanktonModel(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()
orGPU()
. Computer architecture being used to run the model.grid
: aAbstractGrid
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 withN_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 ifnothing
, useDict
to update parameters, the format and names of parameters can be found by runningbgc_params_default()
.phyt_params
: Parameter set for physiological processes of individuals modeled in the model, use default ifnothing
, useDict
to update parameters, the format and names of parameters can be found by runningphyt_params_default(N_species, mode)
.nut_initial
: The source of initial conditions of nutrient fields, should be either aNamedTuple
or aDict
containing the file paths pointing to the files of nutrient initial conditions.t
: Model time, start from 0 by default, in second.
Simulation
PlanktonIndividuals.Simulation.PlanktonSimulation
— MethodPlanktonSimulation(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 byPlanktonDiagnostics
.vels
: The velocity fields for nutrient fields and individuals.nothing
means no velocities will be applied in the simulation. Otherwise,vels
mush be aNamedTuple
containing allu
,v
, andw
. Each ofu
,v
, andw
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 byPlanktonOutputWriter
.
PlanktonIndividuals.Simulation.update!
— Methodupdate!(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).
PlanktonIndividuals.Simulation.vel_copy!
— Methodvel_copy!(vel::NamedTuple, u, v, w, g::AbstractGrid{FT, TX, TY, TZ}) where {FT, TX, TY, TZ}
Copy external velocities into PlanktonModel
Output
PlanktonIndividuals.Output.PlanktonOutputWriter
— MethodPlanktonOutputWriter(;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 defaultdiags_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 exceedsmax_filesize
, and write to a new one with a consistent naming scheme ending inpart1
,part2
, etc. default:Inf
.