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

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

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


Revision 1.4 - (hide annotations) (download)
Wed Oct 9 15:37:05 2013 UTC (12 years, 1 month ago) by stephd
Branch: MAIN
Changes since 1.3: +2 -1 lines
o clean up carbon_coeffs so it can be pressure dependent or not (pass
  depth information); remove redundant subroutine

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

  ViewVC Help
Powered by ViewVC 1.1.22