1 |
mmazloff |
1.4 |
C $Header: /u/gcmpack/MITgcm_contrib/bling/pkg/bling_carbonate_sys.F,v 1.3 2016/02/28 21:49:24 mmazloff Exp $ |
2 |
mmazloff |
1.1 |
C $Name: $ |
3 |
|
|
|
4 |
|
|
#include "BLING_OPTIONS.h" |
5 |
|
|
|
6 |
|
|
CBOP |
7 |
|
|
subroutine BLING_CARBONATE_SYS( |
8 |
mmazloff |
1.3 |
I PTR_DIC, PTR_ALK, PTR_PO4, |
9 |
mmazloff |
1.1 |
I bi, bj, imin, imax, jmin, jmax, |
10 |
|
|
I myIter, myTime, myThid) |
11 |
|
|
|
12 |
|
|
C ================================================================= |
13 |
|
|
C | subroutine bling_carbonate_sys |
14 |
|
|
C | o Calculate carbonate fluxes |
15 |
|
|
C | Also update pH (3d field) |
16 |
|
|
C ================================================================= |
17 |
|
|
|
18 |
|
|
implicit none |
19 |
|
|
|
20 |
|
|
C == GLobal variables == |
21 |
|
|
#include "SIZE.h" |
22 |
|
|
#include "DYNVARS.h" |
23 |
|
|
#include "EEPARAMS.h" |
24 |
|
|
#include "PARAMS.h" |
25 |
|
|
#include "GRID.h" |
26 |
|
|
#include "BLING_VARS.h" |
27 |
|
|
|
28 |
|
|
C == Routine arguments == |
29 |
|
|
C PTR_DIC :: dissolved inorganic carbon |
30 |
|
|
C PTR_ALK :: alkalinity |
31 |
mmazloff |
1.3 |
C PTR_PO4 :: phosphate |
32 |
mmazloff |
1.1 |
C myThid :: thread Id. number |
33 |
|
|
C myIter :: current timestep |
34 |
|
|
C myTime :: current time |
35 |
|
|
INTEGER myThid |
36 |
|
|
INTEGER myIter |
37 |
|
|
_RL myTime |
38 |
|
|
_RL PTR_DIC(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
39 |
|
|
_RL PTR_ALK(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
40 |
mmazloff |
1.3 |
_RL PTR_PO4(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
41 |
mmazloff |
1.1 |
INTEGER imin, imax, jmin, jmax, bi, bj |
42 |
|
|
|
43 |
|
|
|
44 |
|
|
#ifdef ALLOW_PTRACERS |
45 |
|
|
|
46 |
|
|
C == Local variables == |
47 |
|
|
C i,j,k :: loop indices |
48 |
|
|
C carbonate :: local value of calcium carbonate |
49 |
|
|
C calcium :: local value of Ca |
50 |
|
|
C diclocal :: local value of DIC |
51 |
|
|
C alklocal :: local value of ALK |
52 |
|
|
C pCO2local :: local value of pCO2 |
53 |
|
|
C pHlocal :: local value of pH |
54 |
|
|
C CO3ITER :: iterations counter for CO3 ion calculation |
55 |
|
|
C CO3ITERmax :: total number of iterations |
56 |
|
|
C silicaDEEP :: subsurface silica concentration |
57 |
|
|
INTEGER i,j,k |
58 |
|
|
_RL carbonate |
59 |
|
|
_RL calcium |
60 |
|
|
_RL po4local |
61 |
|
|
_RL diclocal |
62 |
|
|
_RL alklocal |
63 |
|
|
_RL pCO2local |
64 |
|
|
_RL pHlocal |
65 |
|
|
_RL silicaDEEP |
66 |
mmazloff |
1.3 |
|
67 |
|
|
|
68 |
|
|
_RL ttmp(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
69 |
|
|
_RL stmp(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
70 |
|
|
|
71 |
mmazloff |
1.1 |
INTEGER CO3ITER |
72 |
|
|
INTEGER CO3ITERmax |
73 |
|
|
CEOP |
74 |
|
|
|
75 |
|
|
|
76 |
|
|
C Assume constant deep silica value |
77 |
|
|
C 30 micromol = 0.03 mol m-3 |
78 |
|
|
C This is temporary until SiBLING is included |
79 |
|
|
|
80 |
|
|
C Since pH is now a 3D field and is solved for at every time step |
81 |
|
|
C few iterations are needed |
82 |
|
|
CO3itermax = 1 |
83 |
|
|
|
84 |
|
|
C determine carbonate ion concentration through full domain |
85 |
|
|
C determine calcite saturation state |
86 |
|
|
|
87 |
|
|
C$TAF LOOP = parallel |
88 |
|
|
DO k=1,Nr |
89 |
|
|
|
90 |
mmazloff |
1.3 |
DO j=jMin,jMax |
91 |
|
|
DO i=iMin,iMax |
92 |
|
|
ttmp(i,j,k) = theta(i,j,k,bi,bj) |
93 |
|
|
stmp(i,j,k) = salt(i,j,k,bi,bj) |
94 |
|
|
ENDDO |
95 |
|
|
ENDDO |
96 |
|
|
|
97 |
mmazloff |
1.1 |
C Get coefficients for carbonate calculations |
98 |
|
|
CALL CARBON_COEFFS_PRESSURE_DEP( |
99 |
mmazloff |
1.3 |
I ttmp, stmp, |
100 |
mmazloff |
1.1 |
I bi, bj, imin, imax, jmin, jmax, |
101 |
|
|
I k, myThid) |
102 |
|
|
|
103 |
|
|
C-------------------------------------------------- |
104 |
|
|
|
105 |
|
|
C$TAF LOOP = parallel |
106 |
|
|
DO j=jMin,jMax |
107 |
|
|
C$TAF LOOP = parallel |
108 |
mmazloff |
1.3 |
DO i=iMin,iMax |
109 |
|
|
|
110 |
mmazloff |
1.1 |
IF ( hFacC(i,j,k,bi,bj) .gt. 0. _d 0) THEN |
111 |
|
|
C$TAF init dic_caco3 = static, 2 |
112 |
|
|
|
113 |
|
|
|
114 |
|
|
C Estimate calcium concentration from salinity |
115 |
|
|
calcium = 1.028 _d -2*salt(i,j,k,bi,bj)/35. _d 0 |
116 |
|
|
|
117 |
mmazloff |
1.3 |
po4local = PTR_PO4(i,j,k) |
118 |
mmazloff |
1.1 |
diclocal = PTR_DIC(i,j,k) |
119 |
|
|
alklocal = PTR_ALK(i,j,k) |
120 |
|
|
pHlocal = pH(i,j,k,bi,bj) |
121 |
|
|
silicaDEEP = 0.03 _d 0 |
122 |
|
|
|
123 |
|
|
C Evaluate carbonate (CO3) ions concentration |
124 |
|
|
C iteratively |
125 |
|
|
|
126 |
|
|
c DO CO3iter = 1, CO3itermax |
127 |
|
|
|
128 |
|
|
C-------------------------------------------------- |
129 |
|
|
|
130 |
|
|
CALL CALC_PCO2_APPROX( |
131 |
mmazloff |
1.3 |
I ttmp(i,j,k),stmp(i,j,k), |
132 |
mmazloff |
1.1 |
I diclocal, po4local, |
133 |
|
|
I silicaDEEP,alklocal, |
134 |
|
|
I ak1(i,j,bi,bj),ak2(i,j,bi,bj), |
135 |
|
|
I ak1p(i,j,bi,bj),ak2p(i,j,bi,bj),ak3p(i,j,bi,bj), |
136 |
|
|
I aks(i,j,bi,bj),akb(i,j,bi,bj),akw(i,j,bi,bj), |
137 |
|
|
I aksi(i,j,bi,bj),akf(i,j,bi,bj), |
138 |
|
|
I ak0(i,j,bi,bj), fugf(i,j,bi,bj), ff(i,j,bi,bj), |
139 |
|
|
I bt(i,j,bi,bj),st(i,j,bi,bj),ft(i,j,bi,bj), |
140 |
|
|
U pHlocal,pCO2local,carbonate, |
141 |
|
|
I i,j,k,bi,bj,myIter,myThid ) |
142 |
|
|
c ENDDO |
143 |
|
|
|
144 |
|
|
pH(i,j,k,bi,bj) = pHlocal |
145 |
|
|
|
146 |
|
|
C Calculate calcium carbonate (calcite and aragonite) |
147 |
|
|
C saturation state |
148 |
|
|
omegaC(i,j,k,bi,bj) = calcium * carbonate / |
149 |
|
|
& Ksp_TP_Calc(i,j,bi,bj) |
150 |
|
|
omegaAr(i,j,k,bi,bj) = calcium * carbonate / |
151 |
|
|
& Ksp_TP_Arag(i,j,bi,bj) |
152 |
|
|
|
153 |
|
|
else |
154 |
|
|
|
155 |
mmazloff |
1.3 |
pH(i,j,k,bi,bj) = 8. _d 0 |
156 |
mmazloff |
1.1 |
omegaC(i,j,k,bi,bj) = 0. _d 0 |
157 |
|
|
omegaAr(i,j,k,bi,bj) = 0. _d 0 |
158 |
|
|
|
159 |
|
|
endif |
160 |
|
|
|
161 |
|
|
ENDDO |
162 |
|
|
ENDDO |
163 |
|
|
ENDDO |
164 |
|
|
|
165 |
|
|
#endif /* ALLOW_PTRACERS */ |
166 |
|
|
RETURN |
167 |
|
|
END |