/[MITgcm]/MITgcm_contrib/darwin2/pkg/darwin/dic_surfforcing.F
ViewVC logotype

Contents of /MITgcm_contrib/darwin2/pkg/darwin/dic_surfforcing.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (show annotations) (download)
Wed Apr 20 19:19:27 2011 UTC (14 years, 6 months ago) by stephd
Branch: MAIN
CVS Tags: ctrb_darwin2_ckpt62w_20110426
Changes since 1.1: +15 -1 lines
o add fix to two bugs in handling water vapour pressure in carbonate chemisty
  and air-sea fluxes. Found by Val Bennington and Galen McKinley

1 #include "CPP_OPTIONS.h"
2 #include "PTRACERS_OPTIONS.h"
3 #include "DARWIN_OPTIONS.h"
4
5 #ifdef ALLOW_PTRACERS
6 #ifdef ALLOW_DARWIN
7
8 #ifdef ALLOW_CARBON
9
10 CBOP
11 C !ROUTINE: DIC_SURFFORCING
12
13 C !INTERFACE: ==========================================================
14 SUBROUTINE DIC_SURFFORCING( PTR_DIC , PTR_ALK, PTR_PO4, PTR_SIL,
15 O GDC,
16 I bi,bj,imin,imax,jmin,jmax,
17 I myIter,myTime,myThid)
18
19 C !DESCRIPTION:
20 C Calculate the carbon air-sea flux terms
21 C following external_forcing_dic.F (OCMIP run) from Mick
22
23 C !USES: ===============================================================
24 IMPLICIT NONE
25 #include "SIZE.h"
26 #include "DYNVARS.h"
27 #include "EEPARAMS.h"
28 #include "PARAMS.h"
29 #include "GRID.h"
30 #include "FFIELDS.h"
31 #include "DARWIN_SIZE.h"
32 #include "DARWIN_IO.h"
33 #include "DARWIN_FLUX.h"
34
35 C !INPUT PARAMETERS: ===================================================
36 C myThid :: thread number
37 C myIter :: current timestep
38 C myTime :: current time
39 c PTR_DIC :: DIC tracer field
40 INTEGER myIter, myThid
41 _RL myTime
42 _RL PTR_DIC(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
43 _RL PTR_ALK(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
44 _RL PTR_PO4(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
45 _RL PTR_SIL(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
46 INTEGER iMin,iMax,jMin,jMax, bi, bj
47
48 C !OUTPUT PARAMETERS: ===================================================
49 c GDC :: tendency due to air-sea exchange
50 _RL GDC(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
51
52
53 C !LOCAL VARIABLES: ====================================================
54 INTEGER I,J, kLev, it
55 C Number of iterations for pCO2 solvers...
56 C Solubility relation coefficients
57 _RL SchmidtNoDIC(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
58 _RL pCO2sat(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
59 _RL Kwexch(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
60 _RL pisvel(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
61 C local variables for carbon chem
62 _RL surfdic(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
63 _RL surfalk(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
64 _RL surfphos(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
65 _RL surfsi(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
66 _RL surfsalt(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
67 #ifdef ALLOW_OLD_VIRTUALFLUX
68 _RL VirtualFlux(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
69 #endif
70 CEOP
71
72 cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
73
74 kLev=1
75
76 cc if coupled to atmsopheric model, use the
77 cc Co2 value passed from the coupler
78 c#ifndef USE_ATMOSCO2
79 cC PRE-INDUSTRIAL STEADY STATE pCO2 = 278.0 ppmv
80 c DO j=1-OLy,sNy+OLy
81 c DO i=1-OLx,sNx+OLx
82 c AtmospCO2(i,j,bi,bj)=278.0 _d -6
83 c ENDDO
84 c ENDDO
85 c#endif
86 C =================================================================
87 C determine inorganic carbon chem coefficients
88 DO j=jmin,jmax
89 DO i=imin,imax
90 surfdic(i,j) = max(10. _d 0 , PTR_DIC(i,j))*1e-3
91 & * maskC(i,j,kLev,bi,bj)
92 surfalk(i,j) = max(10. _d 0 , PTR_ALK(i,j))*1e-3
93 & * maskC(i,j,kLev,bi,bj)
94 surfphos(i,j) = max(1. _d -10, PTR_PO4(i,j))*1e-3
95 & * maskC(i,j,kLev,bi,bj)
96 surfsi(i,j) = max(1. _d -8, PTR_SIL(i,j))*1e-3
97 & * maskC(i,j,kLev,bi,bj)
98 surfsalt(i,j) = max(4. _d 0, salt(i,j,kLev,bi,bj))
99 ENDDO
100 ENDDO
101
102 CALL CARBON_COEFFS(
103 I theta,salt,
104 I bi,bj,iMin,iMax,jMin,jMax,myThid)
105 C====================================================================
106
107 DO j=jmin,jmax
108 DO i=imin,imax
109 C Compute AtmosP and Kwexch_Pre which are re-used for flux of O2
110
111 #ifdef USE_PLOAD
112 C Convert anomalous pressure pLoad (in Pa) from atmospheric model
113 C to total pressure (in Atm)
114 C Note: it is assumed the reference atmospheric pressure is 1Atm=1013mb
115 C rather than the actual ref. pressure from Atm. model so that on
116 C average AtmosP is about 1 Atm.
117 AtmosP(i,j,bi,bj)= 1. _d 0 + pLoad(i,j,bi,bj)/Pa2Atm
118 #endif
119
120 C Pre-compute part of exchange coefficient: pisvel*(1-fice)
121 C Schmidt number is accounted for later
122 pisvel(i,j)=0.337 _d 0 *wind(i,j,bi,bj)**2/3.6 _d 5
123 Kwexch_Pre(i,j,bi,bj) = pisvel(i,j)
124 & * (1. _d 0 - FIce(i,j,bi,bj))
125
126 ENDDO
127 ENDDO
128
129 c pCO2 solver...
130 C$TAF LOOP = parallel
131 DO j=jmin,jmax
132 C$TAF LOOP = parallel
133 DO i=imin,imax
134
135 IF ( maskC(i,j,kLev,bi,bj).NE.0. _d 0 ) THEN
136 CALL CALC_PCO2_APPROX(
137 I theta(i,j,kLev,bi,bj),surfsalt(i,j),
138 I surfdic(i,j), surfphos(i,j),
139 I surfsi(i,j),surfalk(i,j),
140 I ak1(i,j,bi,bj),ak2(i,j,bi,bj),
141 I ak1p(i,j,bi,bj),ak2p(i,j,bi,bj),ak3p(i,j,bi,bj),
142 I aks(i,j,bi,bj),akb(i,j,bi,bj),akw(i,j,bi,bj),
143 I aksi(i,j,bi,bj),akf(i,j,bi,bj),
144 I ak0(i,j,bi,bj), fugf(i,j,bi,bj),
145 I ff(i,j,bi,bj),
146 I bt(i,j,bi,bj),st(i,j,bi,bj),ft(i,j,bi,bj),
147 U pH(i,j,bi,bj),pCO2(i,j,bi,bj),
148 I myThid )
149 ELSE
150 pCO2(i,j,bi,bj)=0. _d 0
151 ENDIF
152 ENDDO
153 ENDDO
154
155
156 DO j=jmin,jmax
157 DO i=imin,imax
158
159 IF ( maskC(i,j,kLev,bi,bj).NE.0. _d 0 ) THEN
160 C calculate SCHMIDT NO. for CO2
161 SchmidtNoDIC(i,j) =
162 & sca1
163 & + sca2 * theta(i,j,kLev,bi,bj)
164 & + sca3 * theta(i,j,kLev,bi,bj)*theta(i,j,kLev,bi,bj)
165 & + sca4 * theta(i,j,kLev,bi,bj)*theta(i,j,kLev,bi,bj)
166 & *theta(i,j,kLev,bi,bj)
167
168 C Determine surface flux (FDIC)
169 C first correct pCO2at for surface atmos pressure
170 pCO2sat(i,j) =
171 & AtmosP(i,j,bi,bj)*AtmospCO2(i,j,bi,bj)
172
173 C then account for Schmidt number
174 Kwexch(i,j) = Kwexch_Pre(i,j,bi,bj)
175 & / sqrt(SchmidtNoDIC(i,j)/660.0 _d 0)
176
177
178 #ifdef WATERVAP_BUG
179 C Calculate flux in terms of DIC units using K0, solubility
180 C Flux = Vp * ([CO2sat] - [CO2])
181 C CO2sat = K0*pCO2atmos*P/P0
182 C Converting pCO2 to [CO2] using ff, as in CALC_PCO2
183 FluxCO2(i,j,bi,bj) =
184 & Kwexch(i,j)*(
185 & ak0(i,j,bi,bj)*pCO2sat(i,j) -
186 & ff(i,j,bi,bj)*pCO2(i,j,bi,bj)
187 & )
188 #else
189 C Corrected by Val Bennington Nov 2010 per G.A. McKinley's finding
190 C of error in application of water vapor correction
191 c Flux = kw*rho*(ff*pCO2atm-k0*FugFac*pCO2ocean)
192 FluxCO2(i,j,bi,bj) =
193 & Kwexch(i,j)*(
194 & ff(i,j,bi,bj)*pCO2sat(i,j) -
195 & pCO2(i,j,bi,bj)*fugf(i,j,bi,bj)
196 & *ak0(i,j,bi,bj) )
197 &
198 #endif
199 ELSE
200 FluxCO2(i,j,bi,bj) = 0. _d 0
201 ENDIF
202 C convert flux (mol kg-1 m s-1) to (mol m-2 s-1)
203 FluxCO2(i,j,bi,bj) = FluxCO2(i,j,bi,bj)/permil
204 c convert flux (mol m-2 s-1) to (mmol m-2 s-1)
205 FluxCO2(i,j,bi,bj) = FluxCO2(i,j,bi,bj)*1. _d 3
206
207
208 #ifdef ALLOW_OLD_VIRTUALFLUX
209 IF (maskC(i,j,kLev,bi,bj).NE.0. _d 0) THEN
210 c calculate virtual flux
211 c EminusPforV = dS/dt*(1/Sglob)
212 C NOTE: Be very careful with signs here!
213 C Positive EminusPforV => loss of water to atmos and increase
214 C in salinity. Thus, also increase in other surface tracers
215 C (i.e. positive virtual flux into surface layer)
216 C ...so here, VirtualFLux = dC/dt!
217 VirtualFlux(i,j)=gsm_DIC*surfaceForcingS(i,j,bi,bj)/gsm_s
218 c OR
219 c let virtual flux be zero
220 c VirtualFlux(i,j)=0.d0
221 c
222 ELSE
223 VirtualFlux(i,j)=0. _d 0
224 ENDIF
225 #endif /* ALLOW_OLD_VIRTUALFLUX */
226 ENDDO
227 ENDDO
228
229 C update tendency
230 DO j=jmin,jmax
231 DO i=imin,imax
232 GDC(i,j)= recip_drF(kLev)*recip_hFacC(i,j,kLev,bi,bj)
233 & *(FluxCO2(i,j,bi,bj)
234 #ifdef ALLOW_OLD_VIRTUALFLUX
235 & + VirtualFlux(i,j)
236 #endif
237 & )
238 ENDDO
239 ENDDO
240
241 RETURN
242 END
243 #endif /*ALLOW_CARBON*/
244
245 #endif /*DARWIN*/
246 #endif /*ALLOW_PTRACERS*/
247 c ==================================================================

  ViewVC Help
Powered by ViewVC 1.1.22