/[MITgcm]/MITgcm_contrib/ecco_darwin/v4_llc270/code_darwin/dic_budgetTemp.F
ViewVC logotype

Annotation of /MITgcm_contrib/ecco_darwin/v4_llc270/code_darwin/dic_budgetTemp.F

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


Revision 1.3 - (hide annotations) (download)
Thu Aug 1 19:36:25 2019 UTC (7 years, 1 month ago) by dimitri
Branch: MAIN
Changes since 1.2: +8 -7 lines
replacing global FluxCO2 with local FluxCO2_loc variable in budget computations

1 dimitri 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_BUDGETTEMP
12    
13     C !INTERFACE: ==========================================================
14     SUBROUTINE DIC_BUDGETTEMP( PTR_DIC , PTR_ALK, PTR_PO4, PTR_SIL,
15     I bi,bj,imin,imax,jmin,jmax,
16     I myIter,myTime,myThid)
17    
18     C !DESCRIPTION:
19     C Calculate the carbon air-sea flux terms
20     C following external_forcing_dic.F (OCMIP run) from Mick
21    
22     C !USES: ===============================================================
23     IMPLICIT NONE
24     #include "SIZE.h"
25     #include "DYNVARS.h"
26     #include "EEPARAMS.h"
27     #include "PARAMS.h"
28     #include "GRID.h"
29     #include "FFIELDS.h"
30     #include "DARWIN_SIZE.h"
31     #include "DARWIN_IO.h"
32     #include "DARWIN_FLUX.h"
33     #ifdef USE_EXFWIND
34     #include "EXF_FIELDS.h"
35     #endif
36    
37     C !INPUT PARAMETERS: ===================================================
38     C myThid :: thread number
39     C myIter :: current timestep
40     C myTime :: current time
41     c PTR_DIC :: DIC tracer field
42     INTEGER myIter, myThid
43     _RL myTime
44     _RL PTR_DIC(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
45     _RL PTR_ALK(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
46     _RL PTR_PO4(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
47     _RL PTR_SIL(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
48     INTEGER iMin,iMax,jMin,jMax, bi, bj
49    
50     C !LOCAL VARIABLES: ====================================================
51     INTEGER I,J, kLev, it
52     C Number of iterations for pCO2 solvers...
53     C Solubility relation coefficients
54     _RL SchmidtNoDIC(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
55     _RL pCO2sat(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
56     _RL Kwexch(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
57     _RL pisvel(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
58     C local variables for carbon chem
59     _RL surfdic(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
60     _RL surfalk(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
61     _RL surfphos(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
62     _RL surfsi(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
63     _RL surfsalt(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
64     _RL surftemp(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
65     #ifdef ALLOW_OLD_VIRTUALFLUX
66     _RL VirtualFlux(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
67     #endif
68 dimitri 1.3 C local variables for CO2_FLUX_BUDGET
69     _RL FluxCO2_loc(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
70 dimitri 1.1 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     c put bounds on tracers so pH solver doesn't blow up
91     surfdic(i,j) =
92     & max(100. _d 0 , min(4000. _d 0, PTR_DIC(i,j)))*1e-3
93     & * maskC(i,j,kLev,bi,bj)
94     surfalk(i,j) =
95     & max(100. _d 0 , min(4000. _d 0, PTR_ALK(i,j)))*1e-3
96     & * maskC(i,j,kLev,bi,bj)
97     surfphos(i,j) =
98     & max(1. _d -10, min(10. _d 0, PTR_PO4(i,j)))*1e-3
99     & * maskC(i,j,kLev,bi,bj)
100     surfsi(i,j) =
101     & max(1. _d -8, min(500. _d 0, PTR_SIL(i,j)))*1e-3
102     & * maskC(i,j,kLev,bi,bj)
103     surfsalt(i,j) =
104     & max(4. _d 0, min(50. _d 0, salt(i,j,kLev,bi,bj)))
105     surftemp(i,j) = budgetTemp1(i,j,bi,bj)
106     budgetTemp1(i,j,bi,bj) =
107     & max(-4. _d 0, min(39. _d 0, theta(i,j,kLev,bi,bj)))
108     if(budgetTStep1.EQ.0) then
109     C if first timestep
110     C this is problematic for restarts; to do correctly we will have to
111     C add to pickups or run simulation without interruptions
112     surftemp(i,j) = budgetTemp1(i,j,bi,bj)
113     endif
114     ENDDO
115     ENDDO
116    
117     CALL CARBON_COEFFS(
118     I surftemp,surfsalt,
119     I bi,bj,iMin,iMax,jMin,jMax,myThid)
120     C====================================================================
121    
122     DO j=jmin,jmax
123     DO i=imin,imax
124     C Compute AtmosP and Kwexch_Pre which are re-used for flux of O2
125    
126     #ifdef USE_PLOAD
127     C Convert anomalous pressure pLoad (in Pa) from atmospheric model
128     C to total pressure (in Atm)
129     C Note: it is assumed the reference atmospheric pressure is 1Atm=1013mb
130     C rather than the actual ref. pressure from Atm. model so that on
131     C average AtmosP is about 1 Atm.
132     AtmosP(i,j,bi,bj)= 1. _d 0 + pLoad(i,j,bi,bj)/Pa2Atm
133     #endif
134    
135     C Pre-compute part of exchange coefficient: pisvel*(1-fice)
136     C Schmidt number is accounted for later
137     #ifdef USE_EXFWIND
138     pisvel(i,j)=0.337 _d 0 *wspeed(i,j,bi,bj)**2/3.6 _d 5
139     cBX linear piston velocity after Krakauer et al. (2006), Eq. 3
140     cBX using <k> = 20, n=0.5, and <u^n> = 2.6747 (as determined from 2010
141     cBX EXFwspee field from cube92 run)
142     cDc pisvel(i,j)=20 _d 0 *(wspeed(i,j,bi,bj)**0.5
143     cDc & /2.6747 _d 0) /3.6 _d 5
144     #else
145     pisvel(i,j)=0.337 _d 0 *wind(i,j,bi,bj)**2/3.6 _d 5
146     #endif
147     Kwexch_Pre(i,j,bi,bj) = pisvel(i,j)
148     & * (1. _d 0 - FIce(i,j,bi,bj))
149    
150     ENDDO
151     ENDDO
152    
153     c pCO2 solver...
154     C$TAF LOOP = parallel
155     DO j=jmin,jmax
156     C$TAF LOOP = parallel
157     DO i=imin,imax
158    
159     IF ( maskC(i,j,kLev,bi,bj).NE.0. _d 0 ) THEN
160     CALL CALC_PCO2_APPROX(
161     I surftemp(i,j),surfsalt(i,j),
162     I surfdic(i,j), surfphos(i,j),
163     I surfsi(i,j),surfalk(i,j),
164     I ak1(i,j,bi,bj),ak2(i,j,bi,bj),
165     I ak1p(i,j,bi,bj),ak2p(i,j,bi,bj),ak3p(i,j,bi,bj),
166     I aks(i,j,bi,bj),akb(i,j,bi,bj),akw(i,j,bi,bj),
167     I aksi(i,j,bi,bj),akf(i,j,bi,bj),
168     I ak0(i,j,bi,bj), fugf(i,j,bi,bj),
169     I ff(i,j,bi,bj),
170     I bt(i,j,bi,bj),st(i,j,bi,bj),ft(i,j,bi,bj),
171     U pH(i,j,bi,bj),pCO2(i,j,bi,bj),CO3(i,j,bi,bj),
172     I myThid )
173     ELSE
174     pH(i,j,bi,bj) = 0. _d 0
175     pCO2(i,j,bi,bj) = 0. _d 0
176     CO3(i,j,bi,bj) = 0. _d 0
177     ENDIF
178     ENDDO
179     ENDDO
180    
181    
182     DO j=jmin,jmax
183     DO i=imin,imax
184    
185     IF ( maskC(i,j,kLev,bi,bj).NE.0. _d 0 ) THEN
186     C calculate SCHMIDT NO. for CO2
187     SchmidtNoDIC(i,j) =
188     & sca1
189     & + sca2 * surftemp(i,j)
190     & + sca3 * surftemp(i,j)*surftemp(i,j)
191     & + sca4 * surftemp(i,j)*surftemp(i,j)
192     & *surftemp(i,j)
193     c put positive bound on SCHMIT number (will go negative for temp>40)
194     SchmidtNoDIC(i,j) = max(1. _d -2, SchmidtNoDIC(i,j))
195    
196     C Determine surface flux (FDIC)
197     C first correct pCO2at for surface atmos pressure
198     pCO2sat(i,j) =
199     & AtmosP(i,j,bi,bj)*AtmospCO2(i,j,bi,bj)
200    
201     C then account for Schmidt number
202     Kwexch(i,j) = Kwexch_Pre(i,j,bi,bj)
203     & / sqrt(SchmidtNoDIC(i,j)/660.0 _d 0)
204    
205     #ifdef WATERVAP_BUG
206     C Calculate flux in terms of DIC units using K0, solubility
207     C Flux = Vp * ([CO2sat] - [CO2])
208     C CO2sat = K0*pCO2atmos*P/P0
209     C Converting pCO2 to [CO2] using ff, as in CALC_PCO2
210 dimitri 1.3 FluxCO2_loc(i,j) =
211 dimitri 1.1 & Kwexch(i,j)*(
212     & ak0(i,j,bi,bj)*pCO2sat(i,j) -
213     & ff(i,j,bi,bj)*pCO2(i,j,bi,bj)
214     & )
215     #else
216     C Corrected by Val Bennington Nov 2010 per G.A. McKinley's finding
217     C of error in application of water vapor correction
218     c Flux = kw*rho*(ff*pCO2atm-k0*FugFac*pCO2ocean)
219 dimitri 1.3 FluxCO2_loc(i,j) =
220 dimitri 1.1 & Kwexch(i,j)*(
221     & ff(i,j,bi,bj)*pCO2sat(i,j) -
222     & pCO2(i,j,bi,bj)*fugf(i,j,bi,bj)
223     & *ak0(i,j,bi,bj) )
224     &
225     #endif
226     ELSE
227 dimitri 1.3 FluxCO2_loc(i,j) = 0. _d 0
228 dimitri 1.1 ENDIF
229     C convert flux (mol kg-1 m s-1) to (mol m-2 s-1)
230 dimitri 1.3 FluxCO2_loc(i,j) = FluxCO2_loc(i,j)/permil
231 dimitri 1.1 c convert flux (mol m-2 s-1) to (mmol m-2 s-1)
232 dimitri 1.3 FluxCO2_loc(i,j) = FluxCO2_loc(i,j)*1. _d 3
233 dimitri 1.1
234     #ifdef ALLOW_OLD_VIRTUALFLUX
235     IF (maskC(i,j,kLev,bi,bj).NE.0. _d 0) THEN
236     c calculate virtual flux
237     c EminusPforV = dS/dt*(1/Sglob)
238     C NOTE: Be very careful with signs here!
239     C Positive EminusPforV => loss of water to atmos and increase
240     C in salinity. Thus, also increase in other surface tracers
241     C (i.e. positive virtual flux into surface layer)
242     C ...so here, VirtualFLux = dC/dt!
243     VirtualFlux(i,j)=gsm_DIC*surfaceForcingS(i,j,bi,bj)/gsm_s
244     c OR
245     c let virtual flux be zero
246     c VirtualFlux(i,j)=0.d0
247     c
248     ELSE
249     VirtualFlux(i,j)=0. _d 0
250     ENDIF
251     #endif /* ALLOW_OLD_VIRTUALFLUX */
252     ENDDO
253     ENDDO
254    
255     C update tendency
256     DO j=jmin,jmax
257     DO i=imin,imax
258 dimitri 1.2 if(budgetTStep1.EQ.0) then
259 dimitri 1.1 C if first timestep
260     C this is problematic at restart; clean-up later
261 dimitri 1.2 dFluxCO2Temp(i,j,bi,bj) = 0. d 0
262     else
263 dimitri 1.1 C at this point in code, fluxCO2_1 contains total flux for current time step
264 dimitri 1.2 dFluxCO2Temp(i,j,bi,bj) = fluxCO2_1(i,j,bi,bj) -
265 dimitri 1.3 & FluxCO2_loc(i,j)
266 dimitri 1.2 endif
267 dimitri 1.1 ENDDO
268     ENDDO
269    
270     RETURN
271     END
272     #endif /*ALLOW_CARBON*/
273    
274     #endif /*DARWIN*/
275     #endif /*ALLOW_PTRACERS*/
276     c ==================================================================

  ViewVC Help
Powered by ViewVC 1.1.22