/[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.3 - (hide annotations) (download)
Mon May 9 20:17:39 2011 UTC (14 years, 6 months ago) by stephd
Branch: MAIN
CVS Tags: ctrb_darwin2_ckpt64k_20130723, ctrb_darwin2_ckpt63l_20120405, ctrb_darwin2_ckpt64h_20130528, ctrb_darwin2_ckpt64m_20130820, ctrb_darwin2_ckpt64f_20130405, ctrb_darwin2_ckpt63f_20111201, ctrb_darwin2_ckpt64a_20121116, ctrb_darwin2_ckpt64n_20130826, ctrb_darwin2_ckpt62y_20110526, ctrb_darwin2_ckpt64i_20130622, ctrb_darwin2_ckpt62x_20110513, ctrb_darwin2_ckpt63o_20120629, ctrb_darwin2_ckpt64e_20130305, ctrb_darwin2_ckpt63c_20111011, ctrb_darwin2_ckpt63i_20120124, ctrb_darwin2_ckpt63m_20120506, ctrb_darwin2_ckpt63s_20120908, ctrb_darwin2_ckpt63e_20111107, ctrb_darwin2_ckpt63b_20110830, ctrb_darwin2_ckpt63j_20120217, ctrb_darwin2_ckpt63r_20120817, ctrb_darwin2_ckpt64g_20130503, ctrb_darwin2_ckpt64l_20130806, ctrb_darwin2_ckpt63g_20111220, ctrb_darwin2_ckpt64c_20130120, ctrb_darwin2_ckpt63a_20110804, ctrb_darwin2_ckpt64j_20130704, ctrb_darwin2_ckpt63h_20111230, ctrb_darwin2_ckpt63p_20120707, ctrb_darwin2_ckpt63d_20111107, ctrb_darwin2_ckpt63q_20120731, ctrb_darwin2_ckpt63_20110728, ctrb_darwin2_ckpt64b_20121224, ctrb_darwin2_ckpt64d_20130219, ctrb_darwin2_ckpt64_20121012, ctrb_darwin2_ckpt63n_20120604, ctrb_darwin2_ckpt63k_20120317, ctrb_darwin2_ckpt62z_20110622
Changes since 1.2: +30 -13 lines
o add extra bounds to dic/temp/salt so pH solver doesn't blow up

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 jahn 1.1 I bi,bj,iMin,iMax,jMin,jMax,myThid)
117     C====================================================================
118    
119     DO j=jmin,jmax
120     DO i=imin,imax
121     C Compute AtmosP and Kwexch_Pre which are re-used for flux of O2
122    
123     #ifdef USE_PLOAD
124     C Convert anomalous pressure pLoad (in Pa) from atmospheric model
125     C to total pressure (in Atm)
126     C Note: it is assumed the reference atmospheric pressure is 1Atm=1013mb
127     C rather than the actual ref. pressure from Atm. model so that on
128     C average AtmosP is about 1 Atm.
129     AtmosP(i,j,bi,bj)= 1. _d 0 + pLoad(i,j,bi,bj)/Pa2Atm
130     #endif
131    
132     C Pre-compute part of exchange coefficient: pisvel*(1-fice)
133     C Schmidt number is accounted for later
134 stephd 1.3 #ifdef USE_EXFWIND
135     pisvel(i,j)=0.337 _d 0 *wspeed(i,j,bi,bj)**2/3.6 _d 5
136     #else
137 jahn 1.1 pisvel(i,j)=0.337 _d 0 *wind(i,j,bi,bj)**2/3.6 _d 5
138 stephd 1.3 #endif
139 jahn 1.1 Kwexch_Pre(i,j,bi,bj) = pisvel(i,j)
140     & * (1. _d 0 - FIce(i,j,bi,bj))
141    
142     ENDDO
143     ENDDO
144    
145     c pCO2 solver...
146     C$TAF LOOP = parallel
147     DO j=jmin,jmax
148     C$TAF LOOP = parallel
149     DO i=imin,imax
150    
151     IF ( maskC(i,j,kLev,bi,bj).NE.0. _d 0 ) THEN
152     CALL CALC_PCO2_APPROX(
153 stephd 1.3 I surftemp(i,j),surfsalt(i,j),
154 jahn 1.1 I surfdic(i,j), surfphos(i,j),
155     I surfsi(i,j),surfalk(i,j),
156     I ak1(i,j,bi,bj),ak2(i,j,bi,bj),
157     I ak1p(i,j,bi,bj),ak2p(i,j,bi,bj),ak3p(i,j,bi,bj),
158     I aks(i,j,bi,bj),akb(i,j,bi,bj),akw(i,j,bi,bj),
159 stephd 1.2 I aksi(i,j,bi,bj),akf(i,j,bi,bj),
160     I ak0(i,j,bi,bj), fugf(i,j,bi,bj),
161     I ff(i,j,bi,bj),
162 jahn 1.1 I bt(i,j,bi,bj),st(i,j,bi,bj),ft(i,j,bi,bj),
163     U pH(i,j,bi,bj),pCO2(i,j,bi,bj),
164     I myThid )
165     ELSE
166     pCO2(i,j,bi,bj)=0. _d 0
167     ENDIF
168     ENDDO
169     ENDDO
170    
171    
172     DO j=jmin,jmax
173     DO i=imin,imax
174    
175     IF ( maskC(i,j,kLev,bi,bj).NE.0. _d 0 ) THEN
176     C calculate SCHMIDT NO. for CO2
177     SchmidtNoDIC(i,j) =
178     & sca1
179 stephd 1.3 & + sca2 * surftemp(i,j)
180     & + sca3 * surftemp(i,j)*surftemp(i,j)
181     & + sca4 * surftemp(i,j)*surftemp(i,j)
182     & *surftemp(i,j)
183     c put positive bound on SCHMIT number (will go negative for temp>40)
184     SchmidtNoDIC(i,j) = max(1. _d -2, SchmidtNoDIC(i,j))
185 jahn 1.1
186     C Determine surface flux (FDIC)
187     C first correct pCO2at for surface atmos pressure
188     pCO2sat(i,j) =
189     & AtmosP(i,j,bi,bj)*AtmospCO2(i,j,bi,bj)
190    
191     C then account for Schmidt number
192 stephd 1.3 Kwexch(i,j) = Kwexch_Pre(i,j,bi,bj)
193 jahn 1.1 & / sqrt(SchmidtNoDIC(i,j)/660.0 _d 0)
194    
195 stephd 1.2 #ifdef WATERVAP_BUG
196 jahn 1.1 C Calculate flux in terms of DIC units using K0, solubility
197     C Flux = Vp * ([CO2sat] - [CO2])
198     C CO2sat = K0*pCO2atmos*P/P0
199     C Converting pCO2 to [CO2] using ff, as in CALC_PCO2
200     FluxCO2(i,j,bi,bj) =
201     & Kwexch(i,j)*(
202     & ak0(i,j,bi,bj)*pCO2sat(i,j) -
203     & ff(i,j,bi,bj)*pCO2(i,j,bi,bj)
204     & )
205 stephd 1.2 #else
206     C Corrected by Val Bennington Nov 2010 per G.A. McKinley's finding
207     C of error in application of water vapor correction
208     c Flux = kw*rho*(ff*pCO2atm-k0*FugFac*pCO2ocean)
209     FluxCO2(i,j,bi,bj) =
210     & Kwexch(i,j)*(
211     & ff(i,j,bi,bj)*pCO2sat(i,j) -
212     & pCO2(i,j,bi,bj)*fugf(i,j,bi,bj)
213     & *ak0(i,j,bi,bj) )
214     &
215     #endif
216 jahn 1.1 ELSE
217     FluxCO2(i,j,bi,bj) = 0. _d 0
218     ENDIF
219     C convert flux (mol kg-1 m s-1) to (mol m-2 s-1)
220     FluxCO2(i,j,bi,bj) = FluxCO2(i,j,bi,bj)/permil
221     c convert flux (mol m-2 s-1) to (mmol m-2 s-1)
222     FluxCO2(i,j,bi,bj) = FluxCO2(i,j,bi,bj)*1. _d 3
223    
224    
225     #ifdef ALLOW_OLD_VIRTUALFLUX
226     IF (maskC(i,j,kLev,bi,bj).NE.0. _d 0) THEN
227     c calculate virtual flux
228     c EminusPforV = dS/dt*(1/Sglob)
229     C NOTE: Be very careful with signs here!
230     C Positive EminusPforV => loss of water to atmos and increase
231     C in salinity. Thus, also increase in other surface tracers
232     C (i.e. positive virtual flux into surface layer)
233     C ...so here, VirtualFLux = dC/dt!
234     VirtualFlux(i,j)=gsm_DIC*surfaceForcingS(i,j,bi,bj)/gsm_s
235     c OR
236     c let virtual flux be zero
237     c VirtualFlux(i,j)=0.d0
238     c
239     ELSE
240     VirtualFlux(i,j)=0. _d 0
241     ENDIF
242     #endif /* ALLOW_OLD_VIRTUALFLUX */
243     ENDDO
244     ENDDO
245    
246     C update tendency
247     DO j=jmin,jmax
248     DO i=imin,imax
249     GDC(i,j)= recip_drF(kLev)*recip_hFacC(i,j,kLev,bi,bj)
250     & *(FluxCO2(i,j,bi,bj)
251     #ifdef ALLOW_OLD_VIRTUALFLUX
252     & + VirtualFlux(i,j)
253     #endif
254     & )
255     ENDDO
256     ENDDO
257    
258     RETURN
259     END
260     #endif /*ALLOW_CARBON*/
261    
262     #endif /*DARWIN*/
263     #endif /*ALLOW_PTRACERS*/
264     c ==================================================================

  ViewVC Help
Powered by ViewVC 1.1.22