Library
Documenting the user interface.
GiantKelpDynamics.jl
GiantKelpDynamics.GiantKelpDynamics
— ModuleA coupled model for the motion (and in the future growth and biogeochemical interactions) of giant kelp (Macrocystis pyrifera).
Based on the models proposed by Utter and Denny (1996) and Rosman et al. (2013), and used in Strong-Wright et al. (2023).
Implemented in the framework of OceanBioME.jl(Strong-Wright et al., 2023) and the coupled with the fluid dynamics of Oceananigans.jl(Ramadhan et al., 2020).
GiantKelpDynamics.Euler
— TypeEuler()
Sets up an Euler timestepper.
GiantKelpDynamics.GiantKelp
— MethodGiantKelp(; grid,
holdfast_x, holdfast_y, holdfast_z,
scalefactor = ones(length(holdfast_x)),
number_nodes = 8,
segment_unstretched_length = 3.,
initial_stipe_radii = 0.004,
initial_blade_areas = 3.0 * (isa(segment_unstretched_length, Number) ?
ones(number_nodes) ./ number_nodes :
segment_area_fraction(segment_unstretched_length)),
initial_pneumatocyst_volume = (2.5 / (5 * 9.81)) .* (isa(segment_unstretched_length, Number) ?
1 / number_nodes .* ones(number_nodes) :
segment_unstretched_length ./ sum(segment_unstretched_length)),
kinematics = UtterDenny(),
timestepper = Euler(),
max_Δt = Inf,
tracer_forcing = NamedTuple(),
custom_dynamics = nothingfunc)
Constructs a model of giant kelps with bases at holdfast_x
, _y
, _z
.
Keyword Arguments
grid
: (required) the geometry to build the model onholdfast_x
,holdfast_y
,holdfast_z
: An array of the base/holdfast positions of the individualsscalefactor
: array of the scalefactor for each plant (used to allow each plant model to represnt the effect of multiple individuals)number_nodes
: the number of nodes to split each individual interiorsegment_unstretched_length
: either a scalar specifying the unstretched length of all segments, or an array of the length of each segment (at the moment each plant must have the same)initial_stipe_radii
: either a scalar specifying the stipe radii of all segments, or an array of the stipe radii of each segment (at the moment each plant must have the same)initial_blade_areas
: an array of the blade area attatched to each segmentinitial_pneumatocyst_volume
: an array of the volume of pneumatocyst attatched to each segmentkinematics
: the kinematics model specifying the individuals motiontimestepper
: the timestepper to integrate the motion with (at each substep)max_Δt
: the maximum timestep for integrating the motiontracer_forcing
: aNamedTuple
ofOceananigans.Forcings(func; field_dependencies, parameters)
with for discrete form forcing only. Functions must be of the formfunc(i, j, k, p, n, grid, clock, tracers, particles, parameters)
wherefield_dependencies
can be particle properties or fields from the underlying model (tracers or velocities)custom_dynamics
: function of the formfunc(particles, model, bgc, Δt)
to be executed at every timestep after the kelp model properties are updated.
Example
julia> using GiantKelpDynamics, Oceananigans
julia> grid = RectilinearGrid(size=(16, 16, 16), extent=(100, 100, 8));
julia> kelp = GiantKelp(; grid, holdfast_x = [10., 20.], holdfast_y = [10., 20], holdfast_z = [-8., -8.])
Giant kelp (Macrocystis pyrifera) model with 2 individuals of 8 nodes.
Base positions:
- x ∈ [10.0, 20.0]
- y ∈ [10.0, 20.0]
- z ∈ [-8.0, -8.0]
GiantKelpDynamics.NothingBGC
— TypeNothingBGC()
An Oceananigans AbstractContinuousFormBiogeochemistry
which specifies no biogeochemical interactions to allow the giant kelp model to be run alone.
Example
julia> using GiantKelpDynamics, Oceananigans, OceanBioME
julia> grid = RectilinearGrid(size=(16, 16, 16), extent=(100, 100, 8));
julia> kelp = GiantKelp(; grid, number_nodes = 2, holdfast_x = [10., 20.], holdfast_y = [10., 20], holdfast_z = [-8., -8.])
Giant kelp (Macrocystis pyrifera) model with 2 individuals of 2 nodes.
Base positions:
- x ∈ [10.0, 20.0]
- y ∈ [10.0, 20.0]
- z ∈ [-8.0, -8.0]
julia> biogeochemistry = Biogeochemistry(NothingBGC(); particles = kelp)
No biogeochemistry
Light attenuation: Nothing
Sediment: Nothing
Particles: Giant kelp (Macrocystis pyrifera) model with 2 individuals of 2 nodes.
Modifiers: Nothing
GiantKelpDynamics.RK3
— TypeRK3(; γ :: G = (8//15, 5//12, 3//4),
ζ :: Z = (0.0, -17//60, -5//12)
Holds parameters for a third-order Runge-Kutta-Wray time-stepping scheme described by Le and Moin (1991).
GiantKelpDynamics.nothingfunc
— Methodnothingfunc(args...)
Returns nothing for nothing(args...)
Oceananigans.Fields.set!
— Methodset!(kelp::GiantKelp; kwargs...)
Sets the properties of the kelp
model. The keyword arguments kwargs... take the form name=data, where name refers to one of the properties of kelp
, and the data may be an array mathcing the size of the property for one individual (i.e. size(kelp.name[1])), or for all (i.e. size(kelp.name)).
Example
julia> using GiantKelpDynamics, Oceananigans
julia> grid = RectilinearGrid(size=(16, 16, 16), extent=(100, 100, 8));
julia> kelp = GiantKelp(; grid, number_nodes = 2, holdfast_x = [10., 20.], holdfast_y = [10., 20], holdfast_z = [-8., -8.])
Giant kelp (Macrocystis pyrifera) model with 2 individuals of 2 nodes.
Base positions:
- x ∈ [10.0, 20.0]
- y ∈ [10.0, 20.0]
- z ∈ [-8.0, -8.0]
julia> set!(kelp, positions = [0 0 8; 8 0 8])
julia> initial_positions = zeros(2, 2, 3);
julia> initial_positions[1, :, :] = [0 0 8; 8 0 8];
julia> initial_positions[1, :, :] = [0 0 -8; 8 0 -8];
julia> set!(kelp, positions = initial_positions)