OceanGreensFunctionMethods
Documentation for OceanGreensFunctionMethods.
OceanGreensFunctionMethods.TracerInverseGaussianOceanGreensFunctionMethods.abyssal_overturningOceanGreensFunctionMethods.advective_diffusive_fluxOceanGreensFunctionMethods.advective_diffusive_fluxOceanGreensFunctionMethods.boundary_dimensionsOceanGreensFunctionMethods.boundary_fluxOceanGreensFunctionMethods.boundary_propagatorOceanGreensFunctionMethods.boundary_propagator_adjointOceanGreensFunctionMethods.boundary_propagator_forwardOceanGreensFunctionMethods.convergenceOceanGreensFunctionMethods.evolve_concentrationOceanGreensFunctionMethods.forcing_integrandOceanGreensFunctionMethods.global_ttdOceanGreensFunctionMethods.global_ttd_adjointOceanGreensFunctionMethods.global_ttd_forwardOceanGreensFunctionMethods.greens_functionOceanGreensFunctionMethods.ideal_ageOceanGreensFunctionMethods.ideal_age_adjointOceanGreensFunctionMethods.ideal_age_forwardOceanGreensFunctionMethods.integrate_forcingOceanGreensFunctionMethods.intermediate_overturningOceanGreensFunctionMethods.linear_probeOceanGreensFunctionMethods.location_iodine129_historyOceanGreensFunctionMethods.location_transient_tracer_historiesOceanGreensFunctionMethods.massOceanGreensFunctionMethods.mass_convergenceOceanGreensFunctionMethods.maximum_timescaleOceanGreensFunctionMethods.mean_ageOceanGreensFunctionMethods.mean_age_adjointOceanGreensFunctionMethods.mean_age_forwardOceanGreensFunctionMethods.mean_age_residenceOceanGreensFunctionMethods.model_dimensionsOceanGreensFunctionMethods.normalized_exponential_decayOceanGreensFunctionMethods.path_densityOceanGreensFunctionMethods.phi_functionOceanGreensFunctionMethods.radioactive_decayOceanGreensFunctionMethods.read_iodine129_historyOceanGreensFunctionMethods.read_transient_tracer_historiesOceanGreensFunctionMethods.residence_timeOceanGreensFunctionMethods.steady_tracer_timeseriesOceanGreensFunctionMethods.timestep_initial_conditionOceanGreensFunctionMethods.tracer_point_source_historyOceanGreensFunctionMethods.tracer_source_historyOceanGreensFunctionMethods.tracer_tendencyOceanGreensFunctionMethods.tracer_tendencyOceanGreensFunctionMethods.tracer_tendencyOceanGreensFunctionMethods.tracer_timeseriesOceanGreensFunctionMethods.transient_tracer_timeseriesOceanGreensFunctionMethods.ttd_widthOceanGreensFunctionMethods.ttd_width_adjointOceanGreensFunctionMethods.ttd_width_forwardOceanGreensFunctionMethods.ttd_width_residenceOceanGreensFunctionMethods.vertical_diffusionOceanGreensFunctionMethods.watermass_fractionOceanGreensFunctionMethods.watermass_fraction_adjointOceanGreensFunctionMethods.watermass_fraction_forwardOceanGreensFunctionMethods.watermass_fraction_residence
OceanGreensFunctionMethods.TracerInverseGaussian — TypeTracerInverseGaussian(Γ,Δ)using LinearAlgebra: NumberArray
The tracer inverse Gaussian distribution with mean Γ and width Δ has probability density function
\[G(𝐱, \tau) = \sqrt{\frac{\Gamma^3 }{4 \pi \Delta^2 \tau^3 }} \exp \left( - \frac{\Gamma (\tau - \Gamma)^2}{4 \Delta ^2 \tau}\right) \]
TracerInverseGaussian() # Tracer Inverse Gaussian distribution with unit mean and unit width, i.e. TracerInverseGaussian(1, 1)
TracerInverseGaussian(Γ, Δ) # Tracer Inverse Gaussian distribution with mean Γ and width Δ
params(d) # Get the parameters, i.e. (Γ, Δ)
mean(d) # Get the mean parameter, i.e. Γ
shape(d) # Get the shape parameter, i.e. ΔExternal links
OceanGreensFunctionMethods.abyssal_overturning — Methodabyssal_overturning(Ψ,model_dims)Set volume flux, Ψ, in an abyssal overturning loop that satisfies the conservation of volume. Return a structure of Fluxes.
OceanGreensFunctionMethods.advective_diffusive_flux — Methodadvective_diffusive_flux(C, Fv; ρ)Advective-diffusive flux of tracer C given volume fluxes Fv and optional density ρ.
Arguments
C::VectorDimArray: tracer distributionFv::VectorDimArray: volume fluxesρ::Number=1035kg/m^3: uniform density
Returns
Fc::VectorDimArray: tracer flux
OceanGreensFunctionMethods.advective_diffusive_flux — Methodadvective_diffusive_flux(C, Fv; ρ)Advective-diffusive flux of tracer C given volume fluxes Fv and optional density ρ.
Arguments
C::VectorDimArray: tracer distributionFv::Fluxes: volume fluxesρ::Number=1035kg/m^3: uniform density
Returns
Fc::Fluxes: tracer flux
OceanGreensFunctionMethods.boundary_dimensions — Methodboundary_dimensions()Define labels for the boundary's physical dimensions, as well as labels for the box names, consistently with the model dimensions. Use the format of DimensionalData.jl. Permits numerical quantities to be bundled with their meta-data. Dimensions are Unordered to avoid issues related to the alphabetical order.
OceanGreensFunctionMethods.boundary_flux — Methodboundary_flux(f::VectorDimArray, C::VectorDimArray, Fb::VectorDimArray)Convergence or net effect of boundary fluxes.
Arguments
f::VectorDimArray: Dirichlet boundary conditionC::VectorDimArray: tracer distributionFb::VectorDimArray: boundary exchange volume flux
Returns
Jb::Fluxes: boundary tracer flux
OceanGreensFunctionMethods.boundary_propagator — Methodboundary_propagator(τ, A, B; alg=:forward)Forward and adjoint boundary propagators.
Forward boundary propagator
boundary_propagator(τ, A, B, alg=:forward)The (forward) boundary propagator is the box model surface-to-interior transit time distribution (TTD) over transit times τ = t - t′, as given by equation 88 of Haine et al. (2024):
\[{\bf G}' (\tau) = {\bf G} (\tau) ~ {\bf B}\]
The N × Nₛ 𝐆′(τ) matrix quantifies transfer from the Nₛ components of the surface forcing to the N boxes with transit time τ.
Adjoint boundary propagator
boundary_propagator(τ, A, B, alg=:adjoint)The box model adjoint boundary propagator (interior-to-surface TTD over transit time τ† = t″ - t, where t″ ≥ t is the time of the adjoint source; equation 93 of Haine et al., 2024) is
\[{\bf G}'^{\dagger} (\tau^{\dagger} ) = {\bf B}^{T}~ {\bf G} (\tau^{\dagger}).\]
This Nₛ × N 𝐆′†(τ†) matrix quantifies transfer from the N interior boxes to the Nₛ surface boxes with transit time τ†.
OceanGreensFunctionMethods.boundary_propagator_adjoint — Methodboundary_propagator_adjoint(t,A,B)OceanGreensFunctionMethods.boundary_propagator_forward — Methodboundary_propagator_forward(t,A,B)OceanGreensFunctionMethods.convergence — Methodconvergence(J)Convergence of fluxes J of type Fluxes. This is a computational method that depends on proper slices and broadcasting and thus currently requires using parent on the left hand side below.
OceanGreensFunctionMethods.evolve_concentration — Methodevolve_concentration(C₀, A, B, tlist, source_history; halflife = nothing)Integrate forcing vector over time to compute the concentration history. Find propagator by analytical expression using eigen-methods.
Arguments
C₀: initial tracer concentrationA: tracer transport information used in matrix calculationsB: boundary condition information used in matrix calculationstlist: list of times to save tracer concentrationsource_history::Function: returns Dirichlet boundary condition at a given timehalflife=nothing: radioactive half life (optional)
OceanGreensFunctionMethods.forcing_integrand — Methodforcing_integrand(t, tf, μ, V, B, source_history)Integrand for boundary condition term in equation 10 (Haine et al., 2024).
Arguments
t: timetf: final timeμ: eigenvalue diagonal matrixV: eigenvector matrixB: boundary condition matrixsource_history::Function: returns Dirichlet boundary condition at a given time
OceanGreensFunctionMethods.global_ttd — Methodglobal_ttd(t, A, B; alg=:forward)Forward and adjoint global transit time distributions (TTDs).
Forward Global TTD
The forward global (total) TTD is the sum of surface-to-interior TTDs (equation 90 of Haine et al., 2024):
\[{\cal G} (t) = {\bf G} (t) ~ {\bf B} ~ {\bf 1}_{N_S},\]
where the product with the Ns × 1 column vector of ones (i.e., last matrix in previous equation) computes the sum over surface boxes. This expression yields an N × 1 column vector that is normalized for each box.
Adjoint Global TTD
The adjoint global (total) TTD is the sum of interior-to-surface TTDs.
OceanGreensFunctionMethods.global_ttd_adjoint — Methodglobal_ttd_adjoint(t, A, B)OceanGreensFunctionMethods.global_ttd_forward — Methodglobal_ttd_forward(t, A, B)OceanGreensFunctionMethods.greens_function — Methodgreens_function(τ,A)Green's function for a box model (for steady transport given by the matrix 𝐀 for response at time t to a source at time t′ where τ = t - t′): the matrix exponential function of the elapsed time between the source time and field time:
\[{\bf G}(\tau) = e^{ {\bf A} \tau}\]
where 𝐆(t) is a N × N matrix with the spatial locations of field points (boxes) down its N rows and source points (boxes) along its N columns. Thus, the element 𝐆{i,j}(τ) quantifies transfer from a source at time t′ in box j to receiver at time t in box i.
OceanGreensFunctionMethods.ideal_age — Methodideal_age(A, B; alg= :forward)OceanGreensFunctionMethods.ideal_age_adjoint — Methodideal_age_adjoint(A, B)OceanGreensFunctionMethods.ideal_age_forward — Methodideal_age_forward(A, B)OceanGreensFunctionMethods.integrate_forcing — Methodintegrate_forcing(t0, tf, μ, V, B, source_history)Integrate boundary condition term in equation 10 (Haine et al., 2024).
Arguments
t0: initial timetf: final timeμ: eigenvalue diagonal matrixV: eigenvector matrixB: boundary condition matrixsource_history::Function: returns Dirichlet boundary condition at a given time
OceanGreensFunctionMethods.intermediate_overturning — Methodintermediate_overturning(Ψ,model_dims)Set the volume flux, Ψ, in an intermediate overturning loop that satisfies the conservation of volume. Return a structure of Fluxes.
OceanGreensFunctionMethods.linear_probe — Methodlinear_probe(funk, x, args...)Probe a function to determine its linear response in matrix form. Assumes units are needed and available. A simpler function to handle cases without units would be nice.
Arguments
funk: function to be probedx: input (independent) variablehalflife::Number: radioactive half lifeargs: the arguments that followxinfunk
Returns
A::MatrixDimArray: labeled transport information used in matrix operations
OceanGreensFunctionMethods.location_iodine129_history — Methodlocation_transient_tracer_histories()URL of iodine-129 source history file.
OceanGreensFunctionMethods.location_transient_tracer_histories — Methodlocation_transient_tracer_histories()URL of tracer source history file.
OceanGreensFunctionMethods.mass — Methodmass(V; ρ)Seawater mass derived from the volume V and an optional input of density ρ.
OceanGreensFunctionMethods.mass_convergence — Methodmass_convergence(Fv)Convergence of volume derived from a field of volume fluxes Fv, translated into a mass flux convergence with the assumption of uniform density.
OceanGreensFunctionMethods.maximum_timescale — Methodmaximum_timescale(μ)Return Tmax for the eigenvalues μ. The matrix exponential of 𝐀τ has asymptotic properties because G(t) must eventually decay exponentially with timescale
\[T_{max} = -1/\mu_{min}, \]
where μmin is the eigenvalue with smallest real part. Thus, the Green's function has a maximum timescale of Tmax which is larger than all other transport timescales.
OceanGreensFunctionMethods.mean_age — Methodmean_age(μ, V, B; alg=:forward)Mean age of the forward TTDs, adjoint TTDs, and residence-time distributions.
Arguments
μ: eigenvalues vectorV: eigenvector matrixB: boundary matrixalg=:forward: algorithm (optional)
Forward mean age
mean_age(μ, V, B, alg=:forward)The mean transit time 𝚪 (mean age) is (equation 92 of Haine et al., 2004),
\[{\bf \Gamma} = {\bf V} ~ \mu^{-2} ~ {\bf V}^{-1} ~ {\bf B} ~ {\bf 1}_{N_S},\]
which is an N × 1 vector for each box (and which also equals the ideal age).
Adjoint mean age
mean_age(μ, V, B, alg=:adjoint)Residence-time mean age
mean_age(μ, V, B, alg=:residence)OceanGreensFunctionMethods.mean_age_adjoint — Methodmean_age_adjoint(μ, V, B)OceanGreensFunctionMethods.mean_age_forward — Methodmean_age_forward(μ, V, B)OceanGreensFunctionMethods.mean_age_residence — Methodmean_age_residence(μ, V, B)OceanGreensFunctionMethods.model_dimensions — Methodmodel_dimensions()Define labels for the model's physical dimensions, as well as labels for the box names. Use the format of DimensionalData.jl. Permits numerical quantities to be bundled with their meta-data. Dimensions are Unordered to avoid issues related to the alphabetical order.
OceanGreensFunctionMethods.normalized_exponential_decay — Methodnormalized_exponential_decay(t,Tmax)OceanGreensFunctionMethods.path_density — Methodpath_density(μ, V, B, t, mbox, vbox)Arguments
μ: eigenvalue diagonal matrixV: eigenvector matrixB: boundary matrixt: timembox: name of meridional box of interestvbox: name of vertical box of interest
Returns
E: path density
The path density 𝐄_i(τ) for i ∈ 1 ... N is (equation 96 of Haine et al., 2024):
\[{\bf E}_i (\tau) = \frac{1}{N} \int_{t - \tau}^{t} {\bf G}'^{\dagger} (t^* + \tau - t) ~ {\bf D}_i ~ {\bf G}' (t - t^*) ~ d t ^* , \]
where 𝐃i is the N × N matrix unit of zeros with a single one at the i-th row and i-th column. Therefore,
\[{\bf E}_i (\tau) = \frac{1}{N} \int_{0}^{\tau} {\bf G}'^{\dagger} (t') ~ {\bf D}_i ~ {\bf G}' (\tau - t') ~ d t '\]
and
\[{\bf E}_i (\tau) = \frac{1}{N} {\bf B}^{T} \int_{0}^{\tau} ~ e^{{\bf A} t'} ~ {\bf D}_i e^{{\bf A} ( au - t')} ~ d t ' {\bf B}\]
and
\[{\bf E}_i (\tau) = \frac{1}{N}{\bf B}^{T} ~ {\bf V} \left( \overline{\bf D}_i \circ \Phi (t) \right) {\bf V}^{-1} ~ {\bf B}\]
where ϕ is defined in equation (100) of Haine et al. (2024). For a particular interior box i, 𝐄_i(τ) is the density of pathways between all combinations of surface entry and surface exit boxes over total residence time τ.
OceanGreensFunctionMethods.phi_function — Methodphi_function(t, μ)OceanGreensFunctionMethods.radioactive_decay — Methodradioactive_decay(C, halflife)Radioactive decay rate of tracer C with half life of halflife.
OceanGreensFunctionMethods.read_iodine129_history — Methodread_iodine129_history()OceanGreensFunctionMethods.read_transient_tracer_histories — Methodread_transient_tracer_histories()Read transient tracer source histories and save as a DimArray.
OceanGreensFunctionMethods.residence_time — Methodresidence_time(t, A, B)The surface-to-surface residence-time distribution (RTD) is (equations 94 and 95 of Haine et al., 2024):
\[{\bf R} (\tau) = \frac{1}{N} \int_{t - \tau}^{t} {\bf G}'^{\dagger} (t^* + \tau - t) ~ {\bf G}' (t - t^*) ~ d t ^*\]
or
\[{\bf R} (\tau) = \frac{\tau}{N} {\bf B}^{T} ~ {\bf G} (\tau) ~ {\bf B},\]
where N is the number of boxes, G(τ) is the forward Green's function and B is the boundary matrix. The Ns × Ns R(τ) matrix quantifies transfer from the Ns surface boxes back to the Ns surface boxes with residence time τ (element R{i,j}(τ) quantifies transfer from entry box j to exit box i).
Note: not normalized by number of boxes in this code: consistent with manuscript?
OceanGreensFunctionMethods.steady_tracer_timeseries — Methodsteady_tracer_timeseries(tracername, A, B, halflife, tlist, mbox1, vbox1)Simulate non-transient tracers and return tracer timeseries from one box.
Arguments
tracername: name of tracerA: tracer transport matrixB: boundary condition matrixhalflife: radioactive half lifeBD: Dirichlet boundary conditiontlist: list of times to save tracer concentrationmbox: name of meridional box of interestvbox: name of vertical box of interest
OceanGreensFunctionMethods.timestep_initial_condition — Methodtimestep_initial_condition(C, μ, V, ti, tf)Arguments
C::VectorDimArray: tracer distribution attiμ: eigenvalue diagonal matrixV: eigenvector matrixti: initial timetf: final time
Returns
Cf::VectorDimArray: tracer distribution attf
OceanGreensFunctionMethods.tracer_point_source_history — Methodtracer_point_source_history(tracername, BD)Return a function that yields transient tracer source history (such as CFCs) at given time.
Arguments
tracername: name of tracer in source history fileBD::DimArray: Dirichlet boundary condition compendium for many tracers
OceanGreensFunctionMethods.tracer_source_history — Functiontracer_source_history(t, tracername, box2_box1_ratio, BD = nothing)Return source history values for all boundary points.
Arguments
t: timetracername: name of tracer in source history filebox2_box1_ratio: ratio of boundary condition value in Mid-latitudes to High LatitudesBD::DimArray=nothing: Dirichlet boundary condition compendium (optional)
OceanGreensFunctionMethods.tracer_tendency — Methodtracer_tendency(f, C, Fv, Fb, V)Tracer tendency ∂C/∂t for a boundary flux f, for use with finding B boundary matrix.
Arguments
f::VectorDimArray: Dirichlet boundary conditionC::VectorDimArray: tracer distributionFv::Fluxes: volume fluxesFb::Fluxes: volume fluxesV::VectorDimArray: box volume
Returns
dCdt::VectorDimArray: tracer tendency
OceanGreensFunctionMethods.tracer_tendency — Methodtracer_tendency(C)Tracer tendency ∂C/∂t for the radioactive decay of a tracer C with half life halflife, for use with finding the radioactive contribution to a tracer transport matrix.
Arguments
C::VectorDimArray: tracer distributionhalflife::Number: radioactive half life
Returns
dCdt::VectorDimArray: tracer tendency
OceanGreensFunctionMethods.tracer_tendency — Methodtracer_tendency(C, f, Fv, Fb, V)Tracer tendency ∂C/∂t for a tracer C, especially useful for finding a tracer transport matrix.
Arguments
C::VectorDimArray: tracer distributionf::VectorDimArray: Dirichlet boundary conditionFv::Fluxes: volume fluxesFb::VectorDimArray: boundary flux convergenceV::VectorDimArray: box volume
Returns
dCdt::VectorDimArray: tracer tendency
OceanGreensFunctionMethods.tracer_timeseries — Methodtracer_timeseries(tracername, A, B, tlist, mbox1, vbox1; BD=nothing, halflife=nothing)Simulate tracers and return tracer timeseries from one box.
Arguments
tracername: name of tracerA: tracer transport matrixB: boundary condition matrixtlist: list of times to save tracer concentrationmbox: name of meridional box of interestvbox: name of vertical box of interestBD=nothing: Dirichlet boundary conditionhalflife=nothing: radioactive half life
OceanGreensFunctionMethods.transient_tracer_timeseries — Methodtransient_tracer_timeseries(tracername, A, B, BD, tlist, mbox1, vbox1; halflife = nothing)Simulate transient tracers and return tracer timeseries from one box.
Arguments
tracername: name of tracerA: tracer transport matrixB: boundary condition matrixBD: Dirichlet boundary conditiontlist: list of times to save tracer concentrationmbox: name of meridional box of interestvbox: name of vertical box of interesthalflife=nothing: radioactive half life
OceanGreensFunctionMethods.ttd_width — Methodttd_width(μ, V, B; alg=:forward)Width of the forward TTDs, adjoint TTDs, and residence-time distributions.
Arguments
μ: eigenvalue diagonal matrixV: eigenvector matrixB: boundary matrixalg=:forward: algorithm (optional)
Returns
Δ: TTD width
Width of forward TTD
ttd_width(μ, V, B, alg=:forward)The TTD width is given by (equation 92 of Haine et al., 2024),
\[2 {\bf \Delta}^2 = -2 ~ {\bf V} ~ \mu^{-3} ~ {\bf V}^{-1} ~ {\bf B} ~ {\bf 1}_{N_S} - {\bf \Gamma}^2,\]
which is a N × 1 vector for each box.
Adjoint mean age
mean_age(μ, V, B, alg=:adjoint)Residence-time mean age
mean_age(μ, V, B, alg=:residence)OceanGreensFunctionMethods.ttd_width_adjoint — Methodttd_width_adjoint(μ, V, B)OceanGreensFunctionMethods.ttd_width_forward — Methodttd_width_forward(μ, V, B)OceanGreensFunctionMethods.ttd_width_residence — Methodttd_width_residence(μ, V, B)OceanGreensFunctionMethods.vertical_diffusion — Methodvertical_diffusion(Fv_exchange,model_dims)Set vertical diffusive-like exchange flux Fv_exchange. Return a structure of Fluxes.
OceanGreensFunctionMethods.watermass_fraction — Methodwatermass_fraction(μ, V, B; alg=:forward)Forward, adjoint, and residence-time water-mass fractions.
Forward water-mass fraction
watermass_fraction(μ, V, B, alg=:forward)The water mass fractions are (equation 89 of Haine et al., 2024)
\[{\bf a} = \int_0^{\infty} {\bf G} (\tau) ~ {\bf B} ~ d \tau\]
or
\[{\bf a} = -{\bf V} ~ \mu^{-1} ~ {\bf V}^{-1} ~ {\bf B} , \]
which is an N × Ns matrix with the interior boxes down the rows and the surface sources across the rows.
Adjoint water-mass fraction
watermass_fraction(μ, V, B, alg=:adjoint)Fraction of water that will return to the surface in a particular box.
Residence-time water-mass fraction
watermass_fraction(μ, V, B, alg=:residence)Fraction of water that leaves a particular box and returns in another box.
OceanGreensFunctionMethods.watermass_fraction_adjoint — Methodwatermass_fraction_adjoint(μ, V, B)OceanGreensFunctionMethods.watermass_fraction_forward — Methodwatermass_fraction_forward(μ, V, B)OceanGreensFunctionMethods.watermass_fraction_residence — Methodwatermass_fraction_residence(μ, V, B)