1 |
dfer |
1.7 |
C $Header: /u/gcmpack/MITgcm/pkg/dic/car_flux_omega_top.F,v 1.6 2008/04/04 21:32:36 dfer Exp $ |
2 |
jmc |
1.4 |
C $Name: $ |
3 |
|
|
|
4 |
stephd |
1.1 |
#include "DIC_OPTIONS.h" |
5 |
|
|
|
6 |
|
|
CBOP |
7 |
|
|
C !ROUTINE: CAR_FLUX |
8 |
|
|
|
9 |
|
|
C !INTERFACE: ========================================================== |
10 |
|
|
SUBROUTINE CAR_FLUX_OMEGA_TOP( bioac, cflux, |
11 |
|
|
I bi,bj,imin,imax,jmin,jmax, |
12 |
|
|
I myIter,myTime,myThid) |
13 |
|
|
|
14 |
|
|
C !DESCRIPTION: |
15 |
|
|
C Calculate carbonate fluxes |
16 |
|
|
C HERE ONLY HAVE DISSOLUTION WHEN OMEGA < 1.0 |
17 |
|
|
C Karsten Friis and Mick Follows Sep 2004 |
18 |
|
|
|
19 |
|
|
C !USES: =============================================================== |
20 |
|
|
IMPLICIT NONE |
21 |
|
|
#include "SIZE.h" |
22 |
|
|
#include "DYNVARS.h" |
23 |
|
|
#include "EEPARAMS.h" |
24 |
|
|
#include "PARAMS.h" |
25 |
|
|
#include "GRID.h" |
26 |
dfer |
1.6 |
#include "DIC_VARS.h" |
27 |
stephd |
1.1 |
|
28 |
|
|
C !INPUT PARAMETERS: =================================================== |
29 |
|
|
C myThid :: thread number |
30 |
|
|
C myIter :: current timestep |
31 |
|
|
C myTime :: current time |
32 |
|
|
C bioac :: biological productivity |
33 |
|
|
INTEGER myIter |
34 |
|
|
_RL myTime |
35 |
|
|
INTEGER myThid |
36 |
|
|
_RL bioac(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
37 |
|
|
INTEGER imin, imax, jmin, jmax, bi, bj |
38 |
|
|
|
39 |
|
|
C !OUTPUT PARAMETERS: =================================================== |
40 |
|
|
C cflux :: carbonate flux |
41 |
|
|
_RL cflux(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
42 |
|
|
|
43 |
|
|
#ifdef ALLOW_PTRACERS |
44 |
|
|
#ifdef DIC_BIOTIC |
45 |
|
|
|
46 |
|
|
C !LOCAL VARIABLES: ==================================================== |
47 |
|
|
C i,j,k :: loop indices |
48 |
|
|
c ko :: loop-within-loop index |
49 |
|
|
c caexport :: flux of carbonate from base each "productive" |
50 |
|
|
c layer |
51 |
|
|
c depth_u, depth_l :: depths of upper and lower interfaces |
52 |
|
|
c flux_u, flux_l :: flux through upper and lower interfaces |
53 |
|
|
_RL caexport(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
54 |
|
|
INTEGER I,J,k, ko |
55 |
|
|
_RL flux_u, flux_l |
56 |
|
|
c variables for calcium carbonate dissolution |
57 |
|
|
_RL KierRate |
58 |
|
|
_RL DissolutionRate |
59 |
|
|
_RL WsinkPIC |
60 |
|
|
INTEGER iflx |
61 |
|
|
_RL dumrate |
62 |
|
|
|
63 |
|
|
c diagnostics |
64 |
|
|
c _RL exp_tot |
65 |
|
|
c _RL flx_tot |
66 |
|
|
c integer knum |
67 |
|
|
c _RL omeg_bot |
68 |
|
|
c _RL tmp |
69 |
|
|
|
70 |
|
|
|
71 |
|
|
CEOP |
72 |
|
|
|
73 |
|
|
c flag to either remineralize in bottom or top layer if flux |
74 |
|
|
c reaches bottom layer 0=bottom, 1=top |
75 |
|
|
iflx=1 |
76 |
|
|
c set some nominal particulate sinking rate |
77 |
|
|
c try 100m/day |
78 |
|
|
WsinkPIC = 100/86400.0 |
79 |
|
|
c calculate carbonate flux from base of each nlev |
80 |
stephd |
1.3 |
DO j=jmin,jmax |
81 |
|
|
DO i=imin,imax |
82 |
stephd |
1.1 |
c exp_tot=0 |
83 |
|
|
do k=1,nR |
84 |
|
|
cflux(i,j,k)=0.d0 |
85 |
|
|
enddo |
86 |
|
|
DO k=1,nLev |
87 |
|
|
if (hFacC(i,j,k,bi,bj).gt.0.d0) then |
88 |
dfer |
1.5 |
caexport(i,j)= R_CP*rain_ratio(i,j,bi,bj)*bioac(i,j,k)* |
89 |
stephd |
1.1 |
& (1.0-DOPfraction)*drF(k)*hFacC(i,j,k,bi,bj) |
90 |
|
|
c exp_tot=exp_tot+caexport(i,j) |
91 |
|
|
c calculate flux to each layer from base of k |
92 |
|
|
Do ko=k+1,Nr |
93 |
|
|
if (hFacC(i,j,ko,bi,bj).gt.0.d0) then |
94 |
|
|
if (ko .eq. k+1) then |
95 |
|
|
flux_u = caexport(i,j) |
96 |
|
|
else |
97 |
|
|
flux_u = flux_l |
98 |
|
|
endif |
99 |
|
|
|
100 |
|
|
|
101 |
|
|
|
102 |
|
|
C flux through lower face of cell |
103 |
|
|
if (omegaC(i,j,ko,bi,bj) .gt. 1.0) then |
104 |
|
|
flux_l = flux_u |
105 |
|
|
|
106 |
|
|
c if at bottom, remineralize remaining flux |
107 |
|
|
if (ko.eq.Nr.or.hFacC(i,j,ko+1,bi,bj).eq.0.d0) then |
108 |
|
|
if (iflx.eq.1) then |
109 |
|
|
c ... at surface |
110 |
|
|
cflux(i,j,1)=cflux(i,j,1)+ |
111 |
|
|
& ( (flux_l)/(drF(1)*hFacC(i,j,1,bi,bj)) ) |
112 |
|
|
else |
113 |
|
|
|
114 |
|
|
c ... at bottom |
115 |
|
|
flux_l=0.d0 |
116 |
|
|
endif |
117 |
|
|
endif |
118 |
|
|
else |
119 |
|
|
c if dissolution, then use rate from Kier (1980) Geochem. Cosmochem. Acta |
120 |
|
|
c Kiers dissolution rate in % per day |
121 |
|
|
KierRate = 7.177* ((1.0-omegaC(i,j,ko,bi,bj))**4.54) |
122 |
|
|
c convert to per s |
123 |
|
|
c Karsten finds Kier value not in 0/0 after all... therefore drop 100 factor |
124 |
|
|
c DissolutionRate = KierRate/(100.0*86400.0) |
125 |
|
|
DissolutionRate = KierRate/(86400.0) |
126 |
|
|
c flux_l = flux_u*(1.0-DissolutionRate*drF(k)/WsinkPIC) |
127 |
|
|
c Karstens version |
128 |
|
|
c - gives NaNs (because using kierrate, not dissolution rate)??? |
129 |
|
|
c flux_l = flux_u*(1.0-KierRate)**(drF(k)/WsinkPIC) |
130 |
|
|
c MICKS NEW VERSION... based on vertical sinking/remin balance |
131 |
stephd |
1.2 |
dumrate = -1.0d0*DissolutionRate*drF(ko)* |
132 |
|
|
& hFacC(i,j,ko,bi,bj)/WsinkPIC |
133 |
stephd |
1.1 |
flux_l = flux_u*exp(dumrate) |
134 |
|
|
c TEST ............................ |
135 |
|
|
c if(i .eq. 76 .and. j .eq. 36)then |
136 |
|
|
c write(6,*)'k,flux_l/flux_u',ko,(flux_l/flux_u) |
137 |
|
|
c write(6,*)'K, KierRate, drF(k), drF(ko), WsinkPIC,OmegaC' |
138 |
|
|
c write(6,*)ko,KierRate,drF(k),drF(ko),WsinkPIC, |
139 |
|
|
c & omegaC(i,j,ko,bi,bj) |
140 |
|
|
c endif |
141 |
|
|
c TEST ............................ |
142 |
|
|
c no flux to ocean bottom |
143 |
|
|
if (ko.eq.Nr.or.hFacC(i,j,ko+1,bi,bj).eq.0.d0) |
144 |
|
|
& flux_l=0.d0 |
145 |
|
|
endif |
146 |
|
|
|
147 |
|
|
c flux divergence |
148 |
|
|
cflux(i,j,ko)=cflux(i,j,ko) + |
149 |
|
|
& ( (flux_u-flux_l)/(drF(ko)*hFacC(i,j,ko,bi,bj)) ) |
150 |
|
|
c TEST ............................ |
151 |
|
|
c if(i .eq. 76 .and. j .eq. 36)then |
152 |
|
|
c write(6,*)'k,flux_l/flux_u',ko,(flux_l/flux_u) |
153 |
|
|
c write(6,*)'k,flux_l,cflux ',ko,flux_l,cflux(i,j,ko) |
154 |
|
|
c endif |
155 |
|
|
c TEST ............................ |
156 |
|
|
else |
157 |
|
|
c if no layer below initial layer, remineralize |
158 |
|
|
if (ko.eq.k+1) then |
159 |
|
|
if (iflx.eq.1.and.omegaC(i,j,k,bi,bj) .gt. 1.d0) then |
160 |
|
|
c ... at surface |
161 |
|
|
cflux(i,j,1)=cflux(i,j,1) |
162 |
|
|
& +bioac(i,j,k)*(1.0-DOPfraction)* |
163 |
dfer |
1.5 |
& R_CP*rain_ratio(i,j,bi,bj) |
164 |
stephd |
1.1 |
& *drF(k)*hFacC(i,j,k,bi,bj)/ |
165 |
|
|
& (drF(1)*hFacC(i,j,1,bi,bj) ) |
166 |
|
|
else |
167 |
|
|
c ... at bottom |
168 |
|
|
cflux(i,j,k)=cflux(i,j,k) |
169 |
|
|
& +bioac(i,j,k)*(1.0-DOPfraction)* |
170 |
dfer |
1.5 |
& R_CP*rain_ratio(i,j,bi,bj) |
171 |
stephd |
1.1 |
endif |
172 |
|
|
endif |
173 |
|
|
endif |
174 |
|
|
ENDDO |
175 |
|
|
|
176 |
|
|
endif |
177 |
|
|
ENDDO |
178 |
|
|
c diagnostic |
179 |
|
|
c flx_tot=0 |
180 |
|
|
c k=0 |
181 |
|
|
c do k=1,nR |
182 |
|
|
c flx_tot=flx_tot+cflux(i,j,k)*drF(k)*hFacC(i,j,k,bi,bj) |
183 |
|
|
c if (hFacC(i,j,k,bi,bj).gt.0) then |
184 |
|
|
c knum=k |
185 |
|
|
c omeg_bot=omegaC(i,j,k,bi,bj) |
186 |
|
|
c endif |
187 |
|
|
c enddo |
188 |
|
|
c if (hFacC(i,j,k,bi,bj).gt.0) then |
189 |
|
|
c tmp=abs(exp_tot-flx_tot) |
190 |
|
|
c if (tmp>1e-20) then |
191 |
|
|
c print*,'QQ car_flux', knum, |
192 |
|
|
c & omeg_bot, exp_tot, flx_tot, exp_tot-flx_tot |
193 |
|
|
c endif |
194 |
|
|
c endif |
195 |
|
|
c end diagnostic |
196 |
|
|
ENDDO |
197 |
|
|
ENDDO |
198 |
|
|
c |
199 |
|
|
#endif |
200 |
|
|
#endif |
201 |
|
|
RETURN |
202 |
|
|
END |