Skip to content

Commit

Permalink
Merge pull request #186 from OceanBioME/jsw/refactor-carbonate-chemistry
Browse files Browse the repository at this point in the history
Refactors gas exchange carbon chemistry (+ adds some complexity)
  • Loading branch information
jagoosw authored Aug 15, 2024
2 parents 4bcaf29 + 1033f83 commit d4802b1
Show file tree
Hide file tree
Showing 45 changed files with 2,434 additions and 638 deletions.
4 changes: 2 additions & 2 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ steps:

- label: ":speedboat: GPU unit tests"
commands:
- "$JULIA_PATH/julia-$JULIA_VERSION/bin/julia -O0 --color=yes --project -e 'using Pkg; Pkg.Registry.update(); Pkg.test()'"
- "$JULIA_PATH/julia-$JULIA_VERSION/bin/julia -O0 --color=yes --project --check-bounds=yes -e 'using Pkg; Pkg.Registry.update(); Pkg.test()'"
depends_on: "init"
notify:
- github_commit_status:
Expand All @@ -30,7 +30,7 @@ steps:
env:
CUDA_VISIBLE_DEVICES: "-1"
commands:
- "$JULIA_PATH/julia-$JULIA_VERSION/bin/julia -O0 --color=yes --project -e 'using Pkg; Pkg.Registry.update(); Pkg.test()'"
- "$JULIA_PATH/julia-$JULIA_VERSION/bin/julia -O0 --color=yes --project --check-bounds=yes -e 'using Pkg; Pkg.Registry.update(); Pkg.test()'"
depends_on: "init"
notify:
- github_commit_status:
Expand Down
14 changes: 13 additions & 1 deletion Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

julia_version = "1.10.2"
manifest_format = "2.0"
project_hash = "4319b71589d68d891265adf31b9a9017f2b1b326"
project_hash = "37e11a3bdd396c973917441db34ded05b97faa85"

[[deps.AbstractFFTs]]
deps = ["LinearAlgebra"]
Expand Down Expand Up @@ -362,6 +362,18 @@ git-tree-sha1 = "518ebd058c9895de468a8c255797b0c53fdb44dd"
uuid = "61eb1bfa-7361-4325-ad38-22787b887f55"
version = "0.26.5"

[[deps.GibbsSeaWater]]
deps = ["GibbsSeaWater_jll", "Libdl", "Test"]
git-tree-sha1 = "d1642ddc78d0754603d747d76fac0042a5a85104"
uuid = "9a22fb26-0b63-4589-b28e-8f9d0b5c3d05"
version = "0.1.3"

[[deps.GibbsSeaWater_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "c91ca76546871efaa1aefdd2b19cc41c3ead2160"
uuid = "6727f6b2-98ea-5d0a-8239-2f72283ddb11"
version = "3.5.2+0"

[[deps.Glob]]
git-tree-sha1 = "97285bbd5230dd766e9ef6749b80fc617126d496"
uuid = "c27321d9-0574-5035-807b-f59d2c89b15c"
Expand Down
6 changes: 5 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,26 +1,30 @@
name = "OceanBioME"
uuid = "a49af516-9db8-4be4-be45-1dad61c5a376"
authors = ["Jago Strong-Wright <[email protected]> and contributors"]
version = "0.10.5"
version = "0.11.0"

[deps]
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
GibbsSeaWater = "9a22fb26-0b63-4589-b28e-8f9d0b5c3d05"
JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819"
KernelAbstractions = "63c18a36-062a-441e-b654-da1e3ab1ce7c"
Oceananigans = "9e8cae18-63c1-5223-a75c-80ca9d6e9a09"
Roots = "f2b01f46-fcfa-551c-844a-d8ac1e96c665"
SeawaterPolynomials = "d496a93d-167e-4197-9f49-d3af4ff8fe40"
StructArrays = "09ab397b-f2b6-538f-b94a-2f83cf4a842a"

[compat]
Adapt = "3, 4"
CUDA = "5"
Documenter = "1"
EnsembleKalmanProcesses = "1"
GibbsSeaWater = "0.1"
JLD2 = "0.4"
KernelAbstractions = "0.9"
Oceananigans = "0.91"
Roots = "2"
SeawaterPolynomials = "0.3"
StructArrays = "0.4, 0.5, 0.6"
julia = "1.10"

Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,7 @@ grid = RectilinearGrid(GPU(), size = (256, 32), extent = (500meters, 100meters),

## Documentation

See the [documentation](https://oceanbiome.github.io/OceanBioME.jl) for full description of the software
package and more examples.
See the [documentation](https://oceanbiome.github.io/OceanBioME.jl) for full description of the software package and more examples, as well as full descriptions of the included models and parametrisations.

## Contributing
If you're interested in contributing to the development of OceanBioME we would appreciate your help!
Expand Down
18 changes: 9 additions & 9 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
using Documenter, DocumenterCitations, Literate

using OceanBioME
using OceanBioME.SLatissimaModel: SLatissima
using OceanBioME.LOBSTERModel: LOBSTER
using OceanBioME.Boundaries.Sediments: SimpleMultiG, InstantRemineralisation
using OceanBioME.Boundaries: OCMIP_default, GasExchange
using OceanBioME: SLatissima, LOBSTER, NutrientPhytoplanktonZooplanktonDetritus
using OceanBioME.Sediments: SimpleMultiG, InstantRemineralisation
using OceanBioME: CarbonChemistry, GasExchange

using Oceananigans.Grids: RectilinearGrid

Expand Down Expand Up @@ -58,14 +57,14 @@ model_parameters = (LOBSTER(; grid = BoxModelGrid(), light_attenuation_model = n
TwoBandPhotosyntheticallyActiveRadiation(; grid = RectilinearGrid(size=(1, 1, 1), extent=(1, 1, 1))),
SimpleMultiG(; grid = BoxModelGrid()),
InstantRemineralisation(; grid = BoxModelGrid()),
OCMIP_default,
GasExchange(; gas = :CO₂).condition.func,
GasExchange(; gas = :O₂).condition.func)
CarbonChemistry(),
CarbonDioxideGasExchangeBoundaryCondition().condition.func,
OxygenGasExchangeBoundaryCondition().condition.func)

exchanged_gas(::Val{G}) where G = G

model_name(model) = if Base.typename(typeof(model)).wrapper == GasExchange
"$(exchanged_gas(model.gas)) air-sea exchange"
ifelse(isa(model.water_concentration, CarbonChemistry), "CO₂", "O₂")*" air-sea exchange"
else
Base.typename(typeof(model)).wrapper
end
Expand Down Expand Up @@ -98,6 +97,7 @@ individuals_pages = [
component_pages = [
"Biogeochemical models" => bgc_pages,
"Air-sea gas exchange" => "model_components/air-sea-gas.md",
"Carbon chemistry" => "model_components/carbon-chemistry.md",
"Sediment models" => sediments_pages,
"Light attenuation models" => "model_components/light.md",
"Individuals" => individuals_pages,
Expand Down Expand Up @@ -145,7 +145,7 @@ makedocs(sitename = "OceanBioME.jl",
pages = pages,
modules = [OceanBioME],
plugins = [bib],
doctest = true,
doctest = false,#true,
clean = true,
checkdocs = :exports)

Expand Down
104 changes: 104 additions & 0 deletions docs/oceanbiome.bib
Original file line number Diff line number Diff line change
Expand Up @@ -293,3 +293,107 @@ @book{tan1998
publisher={Oxford University Press},
pages={271-291}
}

@article{dickson2007,
title = {Guide to best practices for ocean CO2 measurement},
author = {Dickson, A.G. and Sabine, C.L and Christian, J.R.},
year = {2007},
doi = {10.25607/OBP-1342},
journal = {North Pacific Marine Science Organization},
pages = {191},
volume = {PICES Special Publication 3; IOCCP Report 8}
}

@article{branson2023,
author = {Branson, Oscar},
doi = {10.5281/zenodo.7732476},
month = mar,
journal = {Zenodo},
title = {oscarbranson/cbsyst},
url = {https://doi.org/10.5281/zenodo.7732476},
year = 2023,
}


@article{humphreys2022,
author = {Humphreys, M. P. and Lewis, E. R. and Sharp, J. D. and Pierrot, D.},
journal = {Geoscientific Model Development},
number = {1},
pages = {15--43},
title = {PyCO2SYS v1.8: marine carbonate system calculations in Python},
volume = {15},
year = {2022}
}


@article{feistel2008,
abstract = {The specific Gibbs energy of seawater is determined from experimental data of heat capacities, freezing points, vapour pressures and mixing heats at atmospheric pressure in the range −6 to 80$\,^{\circ}$C in temperature and 0--120gkg--1 in absolute salinity. Combined with the pure-water properties available from the 1996 Release of the International Association for the Properties of Water and Steam (IAPWS-95), and the densities from the 2003 Gibbs function of seawater, a new saline part of the Gibbs function is developed for seawater that has an extended range of validity including elevated temperatures and salinities. In conjunction with the IAPWS 2006 Release on ice, the correct description of concentrated brines by the new formulations permits an accurate evaluation of sea ice properties down to salinity saturation temperatures. The new Gibbs function is expressed in terms of the temperature scale ITS-90. Its input variable for the concentration is absolute salinity, available from the new Reference-Composition Salinity Scale of 2008.},
author = {Rainer Feistel},
doi = {https://doi.org/10.1016/j.dsr.2008.07.004},
issn = {0967-0637},
journal = {Deep Sea Research Part I: Oceanographic Research Papers},
number = {12},
pages = {1639-1671},
title = {A Gibbs function for seawater thermodynamics for −6 to 80$\,^{\circ}$C and salinity up to 120gkg--1},
url = {https://www.sciencedirect.com/science/article/pii/S0967063708001489},
volume = {55},
year = {2008},
bdsk-url-1 = {https://www.sciencedirect.com/science/article/pii/S0967063708001489},
bdsk-url-2 = {https://doi.org/10.1016/j.dsr.2008.07.004}
}


@article{roquet2015,
author = {F. Roquet and G. Madec and Trevor J. McDougall and Paul M. Barker},
journal = {Ocean Modelling},
pages = {29-43},
title = {Accurate polynomial expressions for the density and specific volume of seawater using the TEOS-10 standard},
volume = {90},
year = {2015}
}

@article{Ho2006,
abstract = {The SOLAS Air-Sea Gas Exchange (SAGE) Experiment was conducted in the western Pacific sector of the Southern Ocean. During SAGE, gas transfer velocities were determined using the 3He/SF6 dual gas tracer technique, and results were obtained at higher wind speeds (16.0 m s−1) than in previous open ocean dual tracer experiments. The results clearly reveal a quadratic relationship between wind speed and gas transfer velocity rather than a recently proposed cubic relationship. A new parameterization between wind speed and gas transfer velocity is proposed, which is consistent with previous 3He/SF6 dual tracer results from the coastal and open ocean obtained at lower wind speeds. This suggests that factors controlling air-sea gas exchange in this region are similar to those in other parts of the world ocean, and that the parameterization presented here should be applicable to the global ocean.},
author = {Ho, David T. and Law, Cliff S. and Smith, Murray J. and Schlosser, Peter and Harvey, Mike and Hill, Peter},
doi = {https://doi.org/10.1029/2006GL026817},
eprint = {https://agupubs.onlinelibrary.wiley.com/doi/pdf/10.1029/2006GL026817},
journal = {Geophysical Research Letters},
number = {16},
title = {Measurements of air-sea gas exchange at high wind speeds in the Southern Ocean: Implications for global parameterizations},
url = {https://agupubs.onlinelibrary.wiley.com/doi/abs/10.1029/2006GL026817},
volume = {33},
year = {2006},
bdsk-url-1 = {https://agupubs.onlinelibrary.wiley.com/doi/abs/10.1029/2006GL026817},
bdsk-url-2 = {https://doi.org/10.1029/2006GL026817}
}

@article{Wanninkhof2014,
author = {Wanninkhof, Rik},
title = {Relationship between wind speed and gas exchange over the ocean revisited},
journal = {Limnology and Oceanography: Methods},
volume = {12},
number = {6},
pages = {351-362},
doi = {https://doi.org/10.4319/lom.2014.12.351},
url = {https://aslopubs.onlinelibrary.wiley.com/doi/abs/10.4319/lom.2014.12.351},
eprint = {https://aslopubs.onlinelibrary.wiley.com/doi/pdf/10.4319/lom.2014.12.351},
year = {2014}
}


@article{Weiss1974,
author = {R.F. Weiss},
doi = {https://doi.org/10.1016/0304-4203(74)90015-2},
issn = {0304-4203},
journal = {Marine Chemistry},
number = {3},
pages = {203-215},
title = {Carbon dioxide in water and seawater: the solubility of a non-ideal gas},
url = {https://www.sciencedirect.com/science/article/pii/0304420374900152},
volume = {2},
year = {1974},
bdsk-url-1 = {https://www.sciencedirect.com/science/article/pii/0304420374900152},
bdsk-url-2 = {https://doi.org/10.1016/0304-4203(74)90015-2}
}


28 changes: 14 additions & 14 deletions docs/src/appendix/library.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,54 +5,54 @@ Documenting the user interface.
## OceanBioME.jl
```@autodocs
Modules = [OceanBioME]
private = false
```

## Biogeochemical Models

### Nutrient Phytoplankton Zooplankton Detritus

```@autodocs
Modules = [OceanBioME.NPZDModel]
private = false
Modules = [OceanBioME.Models.NPZDModel]
```

### The Lodyc-DAMTP Ocean Biogeochemical Simulation Tools for Ecosystem and Resources (LOBSTER)

```@autodocs
Modules = [OceanBioME.LOBSTERModel]
private = true
Modules = [OceanBioME.Models.LOBSTERModel]
```

### Sugar kelp (Saccharina latissima)

```@autodocs
Modules = [OceanBioME.SLatissimaModel]
private = true
Modules = [OceanBioME.Models.SLatissimaModel]
```

### Carbon Chemistry

```@autodocs
Modules = [OceanBioME.Models.CarbonChemistryModel]
```

## Light Attenuation Models

```@autodocs
Modules = [OceanBioME.Light]
private = false
```

## Boundary Conditions
## Sediments

```@autodocs
Modules = [OceanBioME.Boundaries]
private = false
Modules = [OceanBioME.Models.Sediments]
```

## Gas exchange boundary conditions

```@autodocs
Modules = [OceanBioME.Boundaries.Sediments]
private = false
Modules = [OceanBioME.Models.GasExchangeModel, OceanBioME.Models.GasExchangeModel.ScaledGasTransferVelocity]
```

## Box Model

```@autodocs
Modules = [OceanBioME.BoxModels]
private = false
```
Loading

2 comments on commit d4802b1

@jagoosw
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register

Release notes:

This PR overhauls the carbon chemistry model and changes the API to access the model.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/113187

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.11.0 -m "<description of version>" d4802b1821eed5a7edab5f7b8c41c11cadafc608
git push origin v0.11.0

Please sign in to comment.