Skip to content

Commit

Permalink
Merge pull request #19 from PALEOtoolkit/O2AlkUptakeRemin_bugfix
Browse files Browse the repository at this point in the history
Bugfix O2AlkUptakeRemin (missing P contribution to TAlk change)
  • Loading branch information
sjdaines authored Mar 18, 2024
2 parents aa6e323 + 8399660 commit e2a1621
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/PALEOaqchem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,31 @@ import PALEOboxes as PB
"""
O2AlkUptakeRemin(Corg, (NO3, TNH3, Ngas), TPO4, Ccarb; rO2Corg=1) -> (O2, Alk)
Oxygen and alkalinity assimilated for production (or released by remineralisation) of particulate matter
with specified Corg, Ccarb from specified nitrate NO3, total ammonia TNH3, gaseous N, total phosphate TPO4
Oxygen and alkalinity released by remineralisation
of particulate matter with specified Corg, Ccarb to specified nitrate NO3, total ammonia TNH3, gaseous N, total phosphate TPO4
NB sign: for Corg +ve, O2 is -ve (ie quantity to subtract from tracer sms for production, or add for remineralisation)
NB sign:
- for remineralization, Corg, NO3, TNH3, Ngas, TPO4, Ccarb are +ve, O2 is -ve
(ie provides O2eq (-ve) required and Alk to add to ocean solute tracers sms, for remineralisation of POC with C:N:P stoichiometry defined by Corg:sum(NO3, TNH3, Ngas):TPO4)
- for production by oxygenic photosynthesis, Corg, NO3, TNH3, Ngas, Ccarb are -ve, O2 is +ve
(ie provides O2 and Alk to add to ocean solute tracers sms for production of POC with C:N:P stoichiometry defined by Corg:sum(NO3, TNH3, Ngas):TPO4)
# Examples
```jldoctest; setup=:(import PALEOaqchem)
julia> PALEOaqchem.O2AlkUptakeRemin(106.0, (0.0, 0.0, 0.0), 1.0, 0.0) # Corg:P = 106:1, no N
(-106.0, 0.0)
(-106.0, -1.0)
julia> PALEOaqchem.O2AlkUptakeRemin(106.0, (16.0, 0.0, 0.0), 1.0, 0.0) # Corg:NO3:P = 106:16:1
(-138.0, -16.0)
(-138.0, -17.0)
julia> PALEOaqchem.O2AlkUptakeRemin(106.0, (0.0, 16.0, 0.0), 1.0, 0.0) # Corg:TNH3:P = 106:16:1
(-106.0, 16.0)
(-106.0, 15.0)
```
"""
function O2AlkUptakeRemin(Corg, (NO3, TNH3, Ngas), TPO4, Ccarb; rO2Corg=1)

O2 = -(rO2Corg*PB.get_total(Corg) +2.0*PB.get_total(NO3) + 3.0/4.0*PB.get_total(Ngas)) # -ve uptake/remin, ie oxygen released by production and consumed by remin
Alk = - PB.get_total(NO3) + PB.get_total(TNH3) + 2.0*PB.get_total(Ccarb) # production leads to increase in Alk with NO3 source, decrease with NH3 source
O2 = -(rO2Corg*PB.get_total(Corg) +2.0*PB.get_total(NO3) + 3.0/4.0*PB.get_total(Ngas)) # -ve uptake/remin, ie oxygen released by production and consumed by remin
Alk = - PB.get_total(NO3) + PB.get_total(TNH3) - PB.get_total(TPO4) + 2.0*PB.get_total(Ccarb) # production leads to increase in Alk with NO3 source, decrease with NH3 source

# Biomass organic carbon stoichiometry is CH2Ox, where x follows from k_O_rO2Corg
# CorgOx = 3 - 2*rO2Corg
Expand Down

0 comments on commit e2a1621

Please sign in to comment.