CorePore

Documentation for CorePore.

CorePore.ClimateHistoryType
ClimateHistory

Custom struct to contain a climate record x over timescale t, where t contains n timesteps.

The type generated by LR04, which is used for (perhaps unnecessary) type stability and code readability.

source
CorePore.ConstantsType
Constants( ; k, dt, dz, depth )

Returns a Constants struct containing constants and coefficients used in diffusion history calculations. The inputs and their default values are listed in the table below. From these it calculates a few convenient variables–-the product dt * dz (dtdz), a Range of node depths z (in m), the number of nodes nz, and the penultimate_node–-as well as temperature-dependent diffusion coefficients used in diffusionadvection, using the temperature-depth paramterization of Morin+ 2010. These are returned as Vectors of length nz, where each cell corresponds to a depth node in z. The two coefficients are k1 and k2, both of which are follwed with cl or w to denote Cl⁻ or water, respectively: k1cl, k2cl, k1w, and k2w.

fielddescriptiondefault
khydraulic conductivity of sediment column0.1 m / yr
dttimestep10 yrs
dznode spacing5 m
depthsediment column depth2000 m
source
CorePore.CoreDataType
CoreData(z, mCl, σCl, mO, σO)

Returns an CoreData struct with sediment core data formatted for porewatermetropolis(; z, Cl = (mu, sig), O = (mu, sig)). Inputs are Vectors for values of sample depths z (meters below sea floor), measured (mean) chlorinity mCl and 1σ uncertainty σCl, and measured (mean) δ¹⁸O mO and 1σ uncertainties σO.

Vectors must all be of the same length. If Cl and δ¹⁸O sampling is not 1:1, use NaN or anything that is not a subtype of Number (e.g. missing, nothing). While NaN is used internally, CoreData does this conversion for you.


CoreData(z, m, σ, measurement)

Same as above, but for a core with only chlorinity or δ¹⁸O data (the other Vectors are empty to return null values in loglikelihood calculations). Provide sample depths z, measured means m, 1σ uncertainties σ, and the measurement as a symbol, e.g. :Cl or :O.


CorePore.jl comes loaded with convenience functions to generate data for andrill2a from Tracy+ 2010 (doi:10.1130/G30849.1) and andrill1b from Pompilio+ 2007 (https://digitalcommons.unl.edu/andrillrespub/37).

source
CorePore.PorewaterPropertyType
PorewaterProperty(n::Int, [, x])

struct to contain sediment column poperties at each node for the previous timestep o and present timestep p.

Constructor function returns an instance of PorewaterProperty with vectors of length n. Optionally provide a value x <: Number to fill vectors with (otherwise values are undefined).

source
CorePore.ProposalType
Proposal

Struct containing porewater parameters (described below). All inputs must be of type Number (converts to Float64). Built-in functionality includes splatting (...) and CorePore.fastsplat.

fielddescriptionunitsdefault
onsetonset of modelka5320
dfrzfreezing ratem/yr0.0001
dmltmelting ratem/yr0.001
sea2frzBenthic δ¹⁸O threshold for subglacial freezing3.5
frz2mltBenthic δ¹⁸O threshold for subglacial melting4.2
flrdepth of diffusion-dominated porewater columnm1000.
basalClchloridity at base of diffusion-dominated columng/kg119.4
basalOδ¹⁸O at base of diffusion-dominated column-25.2

see also: update

source
CorePore.ProposalPriorsType
ProposalPriors(climate, k; onset, dfrz, fmlt, climatelimits, flr, basalCl, basalO)

Custom struct to hold the bounds of parameters in Proposal as Tuples of (minimum value, maximum value). The constructor function takes a ClimateHistory instance climate and Constants instance k, as well as any customizations to default values.


Fields

See Proposal for descriptions and units of shared parameters.

fielddefaultexplanation
onset(0, first(climate.t))Onset date must fall within climate record timespan.
dfrz(0, 0.002)Freezing rate >0 and less than the upperbound of observed freezing rates (0.002 m/yr).¹
dmlt(0, 10)Annual melting rate >0 and less than that observed at the Thwaites grounding line.²
climatelimitsextrema(climate.x)sea2frz and frz2mlt must lie within the observed climate record values.
flr(0, k.depth)Diffusive porewater column (p.flr) has non-zero depth within model domain.
basalCl(0, 200)Basal [Cl⁻] compositions within 0-200 g/kg. (³)
basalO(-56, )δ¹⁸O exceed dome-like values.

¹ Must be ≤ 0.4dt/dz to prevent an error in a log-calculation in CorePore.boundaryconditions

² <10 m/yr – Davis+ 2023, https://www.nature.com/articles/s41586-022-05586-0

³ The water+halite peritectic is ~163 g/kg Cl, assuming charge balance with NaCl.

source
CorePore.SedimentColumnType
SedimentColumn(n::Int, [, Cl, O])

struct to contain PorewaterPropertys for the porewater properties of chloridity (Cl), δ¹⁸O (O), and density (rho).

Constructor function returns an instance of SedimentColumn with PorewaterProperty vectors of length n. Optionally provide values for Cl, O, and rho (otherwise values are undefined).

see also: PorewaterProperty, density

source
CorePore.LR04Method
LR04()

Generate a ClimateHistory instance containing the Liesiecki & Raymo 2004 benthic stack (data, publication) interpolated for 1 ka timesteps and going forward in time from 5.32 Ma.

fielddescription
ttime (ka)
xbenthic δ¹⁸O (‰)
ntimesteps in t
source
CorePore.boundaryconditionsMethod
function boundaryconditions(Cl, d18O, x, sea2freeze,freeze2melt, meltrate, freezerate, Clsw, d18Osw, dz, dt)

Calculates sediment surface boundary condition for δ¹⁸O (d18O) and chloridity (Cl), based on the thermodynamic state described by the current current benthic δ¹⁸O value x and the threshold values corresponding to subglacial freezing sea2freeze and subglacial melting freeze2melt.

For melting or freezing states, calculates boundary condition from the assumed meltrate, freezerate, timestep dt, length-step dt, and composition of seawater Clsw and d18Osw.

source
CorePore.checkpriorsMethod
CorePore.checkpriors(p::Proposal, pp::ProposalPriors)

Returns false if any proposal value p falls beyond the prescribed prior bounds in pp, or if proposed subglacial thresholds are non-physical, i.e. melting at lower benthic δ¹⁸O than freezing.

Otherwise returns true.

source
CorePore.deepbonneyMethod
deepbonney()

Generate a [`Water`](@ref) instance with >30 m Lake Bonney water compositions. Use for sediment column basal boundary condition. Chloridity (143.333 g/L  ÷ 1.2 kg/L ≈ 119 g/kg) from Angino+ 1963 ([doi:10.1086/626879](https://doi.org/10.1086/626879)) and δ¹⁸O from Matsubaya+ 1979 ([doi:10.1016/0016-7037(79)90042-5](https://doi.org/10.1016/0016-7037(79)90042-5)).
source
CorePore.densityMethod
density(chlorinity)

Calculates the density of a water parcel with chlorinity in units g/m³ (rather than kg/m³ for convenience with velocity)

see also: velocity

source
CorePore.diffusionMethod
diffusion(x,above,below,k)

Calculate the property of a node in a vertical profile given the effect of diffusion, alone. Returns the property given initial values for the node x, the overlying node above, the underlying node below, and (dt/dz²-scaled) diffusion coefficient k.

source
CorePore.diffusionadvectionMethod
diffusionadvection(x,above,below,k1,k2,v,dt,dz)

Calculate the property of a node in a vertical profile given the combined effects of diffusion and advection. Returns the property given initial values for the node x, the overlying node above, the underlying node below, (dt/dz-scaled) diffusion coefficients k1 and k2, vertical advection velocity v, timestep dt, and lengthstep dz. Alternatively provide the product of v * dt * dz for a minor speed-up.

source
CorePore.dt_climatetimestepMethod
dt_climatetimestep(katime,dt)

A helper function to calculate the number of diffusion model timesteps dt (in years) in each timestep of the climate timescale katime (in kiloannum). Returns an integer.

source
CorePore.equilibratecolumn!Method
equilibratecolumn!(sc, seawater, basalwater, z, flr)

Calculate an equilibrium linear profile for all SedimentColumn vectors in sc between a seafloor seawater and basalwater composition, given node depths z and diffusion-dominated column depth flr.

source
CorePore.fastsplatMethod
fastsplat(x::Proposal)

Returns a tuple of the contents of x. Avoids type inherent instability of Base.iterate for fast splatting.

source
CorePore.linterpMethod
linterp(x, x₁, Δx, y₂, y₁ )

Estimate the value of y corresponding to x given known coordinate (x₁, y₁), value y₂, and Δx= x₂ - x₁. Note that if x==x₁, y= y₁.

source
CorePore.loglikelihoodMethod
loglikelihood( zₒ, μ, σ, zₘ, m )

Calculate the (relative) log-likelihood that model values in m simulated at depth nodes in zₘ were drawn from normally distributed observations with sample depths, mean values, and 1σ uncertainties in corresponding indices of the Vectors zₒ, μₒ, and σ. The simulated value is linearly interpolated between bounding depth nodes in zₘ.

see also: normll, linterp

source
CorePore.meansMethod
means(x; std::Integer)

Calculate the means of each field in NamedTuple x. Optionally provide an integer number of standard deviations to calculate, returned as the form key = (m=μ, s=σ). Use with the returned chains of porewatermetropolis.

source
CorePore.mediansMethod
medians(x; ci::Float64)

Calculate the medians of each field in NamedTuple x. Optionally provide a ci ∈ [0,1] of standard deviations to calculate, returned as the form key = (m=median, l=lower, u=upper). Use with the returned chains of porewatermetropolis.

source
CorePore.normllMethod
normll(x, μ, σ)

Calculate the (relative) log-likelihood that an observation x was drawn from the normal distribution with mean μ and standard deviation σ. If μ is a NaN (instead of missing for type homogeneity), returns 0.

Note: This function excludes a constant that will not vary for different vlaues of x to speed up calculation in metropolis. To calculate the absolute log-likelihood, take the log of normpdf

source
CorePore.normpdfMethod
normpdf(x, μ, σ)

Calculate the probability density of a normal distribution with mean μ and standard deviation σ at the value x.

source
CorePore.porewaterhistory!Method
porewaterhistory!(sc::SedimentColumn, p::Proposal, k::Constants, climhist::NamedTuple, seawater::Water, ka_dt::Int)

In-place version of porewaterhistory, which takes every input as an arg (rather than some defaults as kwargs). It also requires you to provide ka_dt – the number of diffusion timesteps in each thousand-year climate timestep.

see also: porewaterhistory

source
CorePore.porewaterhistoryMethod
porewaterhistory(p [; k=Constants(), climatehistory=LR04(), seawater=mcmurdosound()])

Calculate the porewater advection-diffusion history of chlorinity and O-isotope-traced water in a sediment column described by properties in k (::Constants) over a given ClimateHistory (LR04 by default) and coretop seawater compositions.

Proposal) instance p describes the sensitivity and response of the system to climate fluctuations as recorded in climatehistory.

See diffuseadvectcolumn! for the underlying diffusion-advection transport calculations.

see also: porewaterhistory!, Proposal, Constants, LR04, Water

source
CorePore.porewatermetropolisMethod
porewatermetropolis(p, σ, priors, coredata, cliamte, k; burnin=10, chainsteps=10, climate, k, seawater, onlychloride=true, explore, rng)

Executes a Markov chain Monte Carlo (MCMC) routine that explores the parameter space of the variables in Proposal instance p, constrained by sediment column porewater chemistry records in CoreData instance coredata and climate record in ClimateHistory instance climate (e.g. LR04), and diffusion-advection parameters in Constants instance k (I recommend using default values Constants()).

Proposal instance σ describes the (1σ) Gaussian jump size corresponding to each field in p (note that fields :dmlt, :dfrz, and :basalCl use a log-normal jump and require a log-space value in σ), and priors are a ProposalPriors instance describing the prior bounds on p.

Kwarg onlychloride determines whether the MCMC inverts for only porewater chloridity (default=true) or porewater chloridity and δ¹⁸O (false).

Additional kwargs include...

kwargDataTypedescriptiondefault
burninIntnumber of Markov chain burnin-warm-up steps10
chainstepsIntnumber of recorded Markov chains steps10
seawaterWaterseawater composition overlying sediment columnmcmurdosound()
exploreTuple{Vararg{Symbol}}parameters explored by the MCMCfieldnames(Proposal)
rngAbstractRNGoptional random number seedRandom.Xoshiro()

see also: Proposal, CoreData, ClimateHistory, Constants, Water

source
CorePore.proposaljumpMethod
CorePore.proposaljump(p::Proposal, σ::Proposal; f, rng::AbstractRNG)

Add a random jump to a randomly selected field of p with a corresponding normal jumping distribution defined by the corresponding field in σ. The possible fields may be specified by providing a Tuple of Symbols f (default=fieldnames(Proposal)), and a specific RNG seed may be provided.

Note that :dmlt, :dfrz, and :basalCl are drawn from a lognormal jumping distribution (where σ is in log-space.)

see also: porewatermetropolis, Proposal

source
CorePore.stopwatchMethod
stopwatch(i, n, t)

Convenience function for [porewatermetropolis] that returns a String reporting the progress at step i for total steps n with start time t (in s since the epoch).

source
CorePore.velocityMethod
velocity(x, above, k)

Calculate the velocity (m/yr) at a node with density x, given the density of the node above, and the hydraulic conductivity k (m/yr).

see also: density

source