Calculate dissolved inorganic carbon (DIC) and individual carbonate species in an open or closes system at equilibrium.

carbonic acid* = H2CO3* (aqueous CO2 + H2CO3)

bicarbonate = HCO3(-)

carbonate = CO3(2-)

```
calculate_DIC(
pH,
pCO2,
`H2CO3*` = solubility * pCO2,
solubility = calculate_gas_solubility("CO2", temperature),
temperature = qty(25, "C"),
pKa1 = 6.3,
pKa2 = 10.3
)
calculate_carbonic_acid(
pH,
pCO2,
DIC,
solubility = calculate_gas_solubility("CO2", temperature),
temperature = qty(25, "C"),
pKa1 = 6.3,
pKa2 = 10.3
)
calculate_bicarbonate(
pH,
pCO2,
DIC,
solubility = calculate_gas_solubility("CO2", temperature),
temperature = qty(25, "C"),
pKa1 = 6.3,
pKa2 = 10.3
)
calculate_carbonate(
pH,
pCO2,
DIC,
solubility = calculate_gas_solubility("CO2", temperature),
temperature = qty(25, "C"),
pKa1 = 6.3,
pKa2 = 10.3
)
```

- pH
the pH of the system

- pCO2
the partial pressure of CO2 (a pressure quantity)

- H2CO3*
the concentration of H2CO3* (a molarity quantity), by default is calculated automatically from pCO2

- solubility
the solubility of CO2, by default is determined based on the temperature of the system

- temperature
the temperature of the system, used to calculate the solubility constant

- pKa1
the acid dissociation constant for H2CO3*

- pKa2
the acid dissociation constant for bicarbonate (HCO3-)

- DIC
dissolved inorganic carbon (a molarity quantity)

`calculate_DIC()`

: calculates the concentration of dissolved inorganic carbon based on pH and either pCO2 or H2CO3*. Returns DIC as a molarity quantity.`calculate_carbonic_acid()`

: calculates the concentration of carbonic acid (H2CO3*) based on pH and either pCO2 or DIC. Returns carbonic acid as a molarity quantity.`calculate_bicarbonate()`

: calculates the concentration of bicarbonate based on pH and either pCO2 or DIC. Returns bicarbonate concentration as a molarity quantity.`calculate_carbonate()`

: calculates the concentration of carbonate based on pH and either pCO2 or DIC. Returns carbonate concentration as a molarity quantity.

Other carbonate chemistry:
`closed_system`

,
`open_system`

```
calculate_DIC(pH = 7.0, pCO2 = qty(0.4, "mbar"))
#> <mk_molarity_concentration[1]>
#> [1] 79.38987
calculate_DIC(pH = 7.0, pCO2 = qty(0.4, "mbar"), temperature = qty(0, "C"))
#> <mk_molarity_concentration[1]>
#> [1] 165.8548
calculate_DIC(pH = 7.0, `H2CO3*` = qty(1, "mM"))
#> <mk_molarity_concentration[1]>
#> [1] 6.014384
```