/[MITgcm]/MITgcm/pkg/dic/dic_surfforcing.F
ViewVC logotype

Annotation of /MITgcm/pkg/dic/dic_surfforcing.F

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


Revision 1.27 - (hide annotations) (download)
Thu May 5 22:23:27 2011 UTC (14 years, 2 months ago) by stephd
Branch: MAIN
CVS Tags: checkpoint62z, checkpoint62y, checkpoint62x
Changes since 1.26: +28 -4 lines
o add min/max bounds to dic, temp, salt, alk, PO4 before passing to pH solver. Need
  #ifdef DIC_BOUNDS to use (i.e. default to not having bounds). pH solver
  was blowing up for some extreme values.

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

  ViewVC Help
Powered by ViewVC 1.1.22