# Dissolved Inorganic Carbon in a closed system ### 1 collaborator lin xiang (Author)

### Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by the author
Model was written in NetLogo 6.2.2 • Viewed 32 times • Downloaded 1 time • Run 0 times Download this modelEmbed this model

## WHAT IS IT?

Carbonic acid (H2CO3), Bicarbonate ion (HCO3-), and carbonate ion (CO3 (2-))are three species of dissolved inorganic carbon (DIC) that coexist in water. In a closed system, assuming that no carbon leaves or enters the system, the proportions of these species are determined by many factors. This model presents the proportions of three DIC species at different pH levels, ranging from 0 to 14, holding other factors constant. This model may serve as the foundation for students to explore the phenomenon of ocean acidification.

## HOW IT WORKS

In the model, a total DIC concentration of 0.002 (mol kg-1) is used. The values of two equilibrium constants, Ka1 = 10 ^ (-5.903) and Ka2 = 10 ^ (-9.702), obtained from Millero et al. (2006), are used to calculate the concentrations of three species in a closed system where salinity is 3.3758% and temperature is 20 degree celsius.

The following equations are used in calculations:

1) [H2CO3]+[HCO3-]+[CO3--]= Total Carbon (TC) 2) [HCO3-][H+]/[H2CO3]=Ka1 3) [CO3--][H+]/[HCO3]=Ka2

Equations 2-3 can be rearranged: 4) [H2CO3]=[HCO3-][H+]/Ka1 5) [CO3--]=Ka2*[HCO3]/[H+]

Equations 4-5 can be substituted in equation 1 to solve [HCO3-]:

6) [HCO3-] = (TC * Ka1 * [H+])/([H+]^2 + Ka1 * [H+] + Ka1 * Ka2)

Then [HCO3-] can be substituted in equations 4-5 to solve corresponding [H2CO3] and [CO3--] at the same pH level.

The percentage of each species is calculated using equation 7:

7) Percentage of [species] = [species] * 100 / TC

## HOW TO USE IT

1. Choose a visual style. The icon visual is more visually friendly, and the molecule visual provides more authentic molecular properties of the species.

2. Click on the set up/restart button the confirm the setting.

3. You may run the model and then drag the pH slider to observe how the proportions of three species vary at the pH ranging from 0 to 14.

4. You may also let the model * auto plot* the changes for you.

## THINGS TO TRY AND NOTICE

The main observation is to see how the concentration of three species changes at different ph levels by dragging the pH slider or using the auto plot button. The teacher may also guide students to see that the current ph change in the ocean concerns a small range (8-8.2) in the spectrum.

Use switches to hide some ions to focus your observation. For example, only show H2CO3 and hide the rest ions.

## RELATED MODELS

See more chemistry models at https://sites.google.com/view/3d-science-abm/physics-chemistry

## CREDITS AND REFERENCES

Dr. Lin Xiang created this module at the University of Kentucky in 2022. If you mention this model in a publication, we ask that you include the citations below.

Xiang, L. (2022). Dissolved Inorganic Carbon in a closed system. Department of STEM Education, University of Kentucky, Lexington, KY. References: Millero, F. J.; Graham, T. B.; Huang, F.; Bustos-Serrano, H.; Pierrot, D. Dissociation constants of carbonic acid as a function of salinity and temperature. (2006). Marine Chemistry, 100 (1-2), 80-94.

This model is inspired by the KCVS applets from the 2100 C.E. RCP projections. https://applets.kcvs.ca/OceanAcidification/oceanAcid.html?rcp=2.6

Click to Run Model

```;Dr. Lin Xiang created this module at the University of Kentucky in 2022. If you mention this model in a publication, we ask that you include the citations below.
;
;Xiang, L. (2022). Dissolved Inorganic Carbon in a closed system. Department of STEM Education, University of Kentucky, Lexington, KY.
;
;![CC BY-NC-SA 4.0](http://ccl.northwestern.edu/images/creativecommons/byncsa.png)
;

breed [H2CO3s H2CO3]
breed [HCO3s HCO3]
breed [CO3s CO3]
breed [H3OS H30]
breed [OHs OH]
breed [legends legend]

turtles-own[ ]
globals [
Num-H
Num-OH
Num-H2CO3
Num-HCO3
Num-CO3
current-ph
current-pOH
current-conc-H
current-conc-OH
current-conc-H2CO3s
current-conc-HCO3s
current-conc-CO3s
Ka1
Ka2
TC
denom
num
]

to setup
ca
set-bk
set-legends
set-shapes
set-tt
plot-ion-concentrations-log
reset-ticks
end

to set-bk
ask patches with [ pycor = max-pycor or pycor < 6] [set pcolor 101]
ask patches with [ pxcor = min-pxcor or pxcor = max-pxcor] [set pcolor 101]
end

to set-tt

;set constants
set TC 0.002
set Ka1 10 ^ (-5.903)         ;from Millero et al. (2006)
set Ka2 10 ^ (-9.702)         ;;from Millero et al. (2006)

;set initial carbon species
set ph 0
set-carbon-concentrations

; set particles
set num-H2CO3 round (5000 * 3 ^ (log current-conc-H2CO3s 10))
set num-HCO3 round (5000 * 3 ^ (log current-conc-HCO3s 10))
set num-CO3 round (5000 * 3 ^ (log current-conc-CO3s 10))

create-H2CO3s Num-H2CO3  [set-tt-properties-aq]
create-HCO3s Num-HCO3  [set-tt-properties-aq]
create-CO3s Num-CO3  [set-tt-properties-aq]

set num-H round (500 * 1.3895 ^ (-1 * current-ph))
set num-OH round (500 * 1.3895 ^ (-1 * (14 - current-ph)))

create-h3os num-H [set-tt-properties-aq ]
create-ohs num-OH [set-tt-properties-aq ]

;hiding ions
if Hide-H2CO3? = true
[if any? H2CO3s [ask H2CO3s [die]]]

if hide-HCO3? = true
[if any? HCO3s [ask HCO3s [die]]]

if hide-CO3? = true
[if any? CO3s [ask CO3s [die]]]

if Hide-H3Os-and-OHs? = true
[if any? H3Os [ask H3Os [die]]
if any? OHs [ask OHs [die]]]
end

to set-carbon-concentrations

set current-ph pH
set current-conc-H 10 ^ (- current-ph)

set denom (current-conc-H * current-conc-H + Ka1 * Ka2 + current-conc-H * Ka1)
set current-conc-H2CO3s (current-conc-H * current-conc-H * TC) / denom
set current-conc-HCO3s (Ka1 * current-conc-H * TC) / denom
set current-conc-CO3s (Ka1 * Ka2 * TC) / denom
end

to set-tt-properties-aq
setxy 1 + random-float (max-pxcor - 2) 6 + random-float (max-pycor - 7)
(ifelse
choose-a-visual = "Molecule visual" [set size 1.25]
choose-a-visual = "Icon visual" [set size 1.75])
end

to set-legends
create-legends 10 [set label-color white]

[set shape "blank" set size 1
set label "Hydroxide(OH-)" setxy 10 3.9]

ask legend 2 [setxy 2 1]

[set shape "blank" set size 1
set label "Hydronium (H3O+)" setxy 11 1.3]

[set shape "blank" set size 1.5
set label "Carbonate (CO3--)" setxy 37.4 3.9]

ask legend 6 [setxy 14 3.5]

[set shape "blank" set size 1.5
set label "Carbonic acid (H2CO3)" setxy 25 3.9]

ask legend 8 [setxy 14 1]

[set shape "blank" set size 1.5
set label "Bicarbonate (HCO3-)" setxy 24 1.3]
end

to go

set-shapes-1
aq-move
set-carbon-concentrations
display-particles
plot-ion-concentrations-log

tick
end

to display-particles

set num-H2CO3 round (5000 * 3 ^ (log current-conc-H2CO3s 10))
set num-HCO3 round (5000 * 3 ^ (log current-conc-HCO3s 10))
set num-CO3 round (5000 * 3 ^ (log current-conc-CO3s 10))

ifelse Hide-H2CO3? = false
[
let current-H2CO3 count H2CO3s

(ifelse
current-H2CO3 > num-H2CO3
[ask up-to-n-of (current-H2CO3 - num-H2CO3) H2CO3s [die]]
current-H2CO3 < num-H2CO3
[create-H2CO3s (num-H2CO3 - current-H2CO3) [set-tt-properties-aq]])
]

[if any? H2CO3s [ask H2CO3s [die]]]

ifelse hide-HCO3? = false
[let current-HCO3 count HCO3s
(ifelse
current-HCO3 > num-HCO3
[ask up-to-n-of (current-HCO3 - num-HCO3) HCO3s [die]]
current-HCO3 < num-HCO3
[create-HCO3s (num-HCO3 - current-HCO3) [set-tt-properties-aq]])]
[if any? HCO3s [ask HCO3s [die]]]

ifelse hide-CO3? = false
[let current-CO3 count CO3s
(ifelse
current-CO3 > num-CO3
[ask up-to-n-of (current-CO3 - num-CO3) CO3s [die]]
current-CO3 < num-CO3
[create-CO3s (num-CO3 - current-CO3) [ set-tt-properties-aq]])]
[if any? CO3s [ask CO3s [die]]]

ifelse Hide-H3Os-and-OHs? = false
[ H-OH-equilibrium]
[if any? H3Os [ask H3Os [die]]
if any? OHs [ask OHs [die]]]
end

to H-OH-equilibrium

set num-H round (500 * 1.3895 ^ (-1 * current-ph))
set num-OH round (500 * 1.3895 ^ (-1 * (14 - current-ph)))

let current-H count H3Os
let current-OH count OHs

(ifelse
num-H > current-H
[create-h3os abs (num-H - current-H) [set-tt-properties-aq ]]
num-H < current-H
[ask n-of abs (num-H - current-H) h3os [die]])

(ifelse
num-OH > current-OH
[create-ohs abs (num-OH - current-OH) [set-tt-properties-aq ]]
num-OH < current-OH
[ask n-of abs (num-OH - current-OH) OHs [die]])
end

to aq-move
[(ifelse
[pcolor] of patch-at dx dy = 101 or [pcolor] of patch-at dx dy = 89  [rt random 360]    ;if it's boundary ahead, rotate
[pcolor] of patch-at dx dy = 96.5  [fd 0.2 rt random 360 if ycor < 6 [set ycor 6]] ;if the patch-ahead has the proper color, move forward.If ycor is low, put ycor higher
)]
end

to plot-ion-concentrations-log ;; this creates the bar graph

set-current-plot "Relative Concentrations"
clear-plot
set-plot-x-range 0 2
set-plot-y-range 0 300
plot-pen-down
set-current-plot-pen "H2CO3"
plotxy 0 count H2CO3s
set-current-plot-pen "HCO3-"
plotxy 1 count HCO3s
set-current-plot-pen "CO3(2-)"
plotxy 2 count CO3s
end

to set-shapes
(ifelse
choose-a-visual = "Molecule visual"
[set-default-shape ohs "ab-oh-1"
set-default-shape H3Os "ab-h3o-1"
set-default-shape H2CO3s "ab-H2CO3"
set-default-shape HCO3s "ab-HCO3"
set-default-shape CO3s "ab-CO3"
ask legend 0 [set shape "ab-oh-1" set size 1.75]
ask legend 2 [set shape "ab-h3o-1" set size 1.75]
ask legend 6 [set shape "ab-H2CO3" set size 1.75]
ask legend 8 [set shape "ab-HCO3" set size 1.75]
ask legend 4 [set shape "ab-CO3" set size 1.75]
]

choose-a-visual = "Icon visual"
[set-default-shape ohs "ab-oh-2"
set-default-shape H3Os "ab-h3o-2"
set-default-shape H2CO3s "ab-H2CO3-1"
set-default-shape HCO3s "ab-HCO3-1"
set-default-shape CO3s "ab-CO3-1"
ask ohs [set shape "ab-oh-2" set size 1.25]
ask H3Os [set shape "ab-h3o-2" set size 1.25]
ask legend 0 [set shape "ab-oh-2" set size 1.75]
ask legend 2 [set shape "ab-h3o-2" set size 1.75]
ask legend 6 [set shape "ab-H2CO3-1" set size 1.75]
ask legend 8 [set shape "ab-HCO3-1" set size 1.75]
ask legend 4 [set shape "ab-CO3-1" set size 1.75]
])
end

to set-shapes-1
(ifelse
choose-a-visual = "Molecule visual"
[set-default-shape ohs "ab-oh-1"
set-default-shape H3Os "ab-h3o-1"
set-default-shape H2CO3s "ab-H2CO3"
set-default-shape HCO3s "ab-HCO3"
set-default-shape CO3s "ab-CO3"
ask ohs [set shape "ab-oh-1" set size 1.25]
ask H3Os [set shape "ab-h3o-1" set size 1.25]
ask H2CO3s [set shape "ab-H2CO3" set size 1.25]
ask HCO3s [set shape "ab-HCO3" set size 1.25]
ask CO3s [set shape "ab-CO3" set size 1.25]
ask legend 0 [set shape "ab-oh-1" set size 1.75]
ask legend 2 [set shape "ab-h3o-1" set size 1.75]
ask legend 6 [set shape "ab-H2CO3" set size 1.75]
ask legend 8 [set shape "ab-HCO3" set size 1.75]
ask legend 4 [set shape "ab-CO3" set size 1.75]
]

choose-a-visual = "Icon visual"
[set-default-shape ohs "ab-oh-2"
set-default-shape H3Os "ab-h3o-2"
set-default-shape H2CO3s "ab-H2CO3-1"
set-default-shape HCO3s "ab-HCO3-1"
set-default-shape CO3s "ab-CO3-1"
ask ohs [set shape "ab-oh-2" set size 1.75]
ask H3Os [set shape "ab-h3o-2" set size 1.75]
ask H2CO3s [set shape "ab-H2CO3-1" set size 1.75]
ask HCO3s [set shape "ab-HCO3-1" set size 1.75]
ask CO3s [set shape "ab-CO3-1" set size 1.75]
ask legend 0 [set shape "ab-oh-2" set size 1.75]
ask legend 2 [set shape "ab-h3o-2" set size 1.75]
ask legend 6 [set shape "ab-H2CO3-1" set size 1.75]
ask legend 8 [set shape "ab-HCO3-1" set size 1.75]
ask legend 4 [set shape "ab-CO3-1" set size 1.75]
])
end
```

There are 2 versions of this model.