/[MITgcm]/MITgcm_contrib/dcarroll/highres_darwin/code/dic_surfforcing.F
ViewVC logotype

Annotation of /MITgcm_contrib/dcarroll/highres_darwin/code/dic_surfforcing.F

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


Revision 1.1 - (hide annotations) (download)
Sun Sep 22 21:23:46 2019 UTC (5 years, 10 months ago) by dcarroll
Branch: MAIN
CVS Tags: HEAD
Initial check in of high resolution Darwin simulation code

1 dcarroll 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     #ifdef USE_EXFWIND
35     #include "EXF_FIELDS.h"
36     #endif
37    
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     _RL surftemp(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
71     #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     c put bounds on tracers so pH solver doesn't blow up
95     surfdic(i,j) =
96     & max(100. _d 0 , min(4000. _d 0, PTR_DIC(i,j)))*1e-3
97     & * maskC(i,j,kLev,bi,bj)
98     surfalk(i,j) =
99     & max(100. _d 0 , min(4000. _d 0, PTR_ALK(i,j)))*1e-3
100     & * maskC(i,j,kLev,bi,bj)
101     surfphos(i,j) =
102     & max(1. _d -10, min(10. _d 0, PTR_PO4(i,j)))*1e-3
103     & * maskC(i,j,kLev,bi,bj)
104     surfsi(i,j) =
105     & max(1. _d -8, min(500. _d 0, PTR_SIL(i,j)))*1e-3
106     & * maskC(i,j,kLev,bi,bj)
107     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     ENDDO
112     ENDDO
113    
114     CALL CARBON_COEFFS(
115     I surftemp,surfsalt,
116     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     #ifdef USE_EXFWIND
135     pisvel(i,j)=0.337 _d 0 *wspeed(i,j,bi,bj)**2/3.6 _d 5
136     cBX linear piston velocity after Krakauer et al. (2006), Eq. 3
137     cBX using <k> = 20, n=0.5, and <u^n> = 2.6747 (as determined from 2010
138     cBX EXFwspee field from cube92 run)
139     cDc pisvel(i,j)=20 _d 0 *(wspeed(i,j,bi,bj)**0.5
140     cDc & /2.6747 _d 0) /3.6 _d 5
141     #else
142     pisvel(i,j)=0.337 _d 0 *wind(i,j,bi,bj)**2/3.6 _d 5
143     #endif
144     Kwexch_Pre(i,j,bi,bj) = pisvel(i,j)
145     & * (1. _d 0 - FIce(i,j,bi,bj))
146    
147     ENDDO
148     ENDDO
149    
150     c pCO2 solver...
151     C$TAF LOOP = parallel
152     DO j=jmin,jmax
153     C$TAF LOOP = parallel
154     DO i=imin,imax
155    
156     IF ( maskC(i,j,kLev,bi,bj).NE.0. _d 0 ) THEN
157     CALL CALC_PCO2_APPROX(
158     I surftemp(i,j),surfsalt(i,j),
159     I surfdic(i,j), surfphos(i,j),
160     I surfsi(i,j),surfalk(i,j),
161     I ak1(i,j,bi,bj),ak2(i,j,bi,bj),
162     I ak1p(i,j,bi,bj),ak2p(i,j,bi,bj),ak3p(i,j,bi,bj),
163     I aks(i,j,bi,bj),akb(i,j,bi,bj),akw(i,j,bi,bj),
164     I aksi(i,j,bi,bj),akf(i,j,bi,bj),
165     I ak0(i,j,bi,bj), fugf(i,j,bi,bj),
166     I ff(i,j,bi,bj),
167     I bt(i,j,bi,bj),st(i,j,bi,bj),ft(i,j,bi,bj),
168     U pH(i,j,bi,bj),pCO2(i,j,bi,bj),CO3(i,j,bi,bj),
169     I myThid )
170     ELSE
171     pH(i,j,bi,bj) = 0. _d 0
172     pCO2(i,j,bi,bj) = 0. _d 0
173     CO3(i,j,bi,bj) = 0. _d 0
174     ENDIF
175     ENDDO
176     ENDDO
177    
178    
179     DO j=jmin,jmax
180     DO i=imin,imax
181    
182     IF ( maskC(i,j,kLev,bi,bj).NE.0. _d 0 ) THEN
183     C calculate SCHMIDT NO. for CO2
184     SchmidtNoDIC(i,j) =
185     & sca1
186     & + sca2 * surftemp(i,j)
187     & + sca3 * surftemp(i,j)*surftemp(i,j)
188     & + sca4 * surftemp(i,j)*surftemp(i,j)
189     & *surftemp(i,j)
190     c put positive bound on SCHMIT number (will go negative for temp>40)
191     SchmidtNoDIC(i,j) = max(1. _d -2, SchmidtNoDIC(i,j))
192    
193     C Determine surface flux (FDIC)
194     C first correct pCO2at for surface atmos pressure
195     pCO2sat(i,j) =
196     & AtmosP(i,j,bi,bj)*AtmospCO2(i,j,bi,bj)
197    
198     C then account for Schmidt number
199     Kwexch(i,j) = Kwexch_Pre(i,j,bi,bj)
200     & / sqrt(SchmidtNoDIC(i,j)/660.0 _d 0)
201    
202     #ifdef WATERVAP_BUG
203     C Calculate flux in terms of DIC units using K0, solubility
204     C Flux = Vp * ([CO2sat] - [CO2])
205     C CO2sat = K0*pCO2atmos*P/P0
206     C Converting pCO2 to [CO2] using ff, as in CALC_PCO2
207     FluxCO2(i,j,bi,bj) =
208     & Kwexch(i,j)*(
209     & ak0(i,j,bi,bj)*pCO2sat(i,j) -
210     & ff(i,j,bi,bj)*pCO2(i,j,bi,bj)
211     & )
212     #else
213     C Corrected by Val Bennington Nov 2010 per G.A. McKinley's finding
214     C of error in application of water vapor correction
215     c Flux = kw*rho*(ff*pCO2atm-k0*FugFac*pCO2ocean)
216     FluxCO2(i,j,bi,bj) =
217     & Kwexch(i,j)*(
218     & ff(i,j,bi,bj)*pCO2sat(i,j) -
219     & pCO2(i,j,bi,bj)*fugf(i,j,bi,bj)
220     & *ak0(i,j,bi,bj) )
221     &
222     #endif
223     ELSE
224     FluxCO2(i,j,bi,bj) = 0. _d 0
225     ENDIF
226     C convert flux (mol kg-1 m s-1) to (mol m-2 s-1)
227     FluxCO2(i,j,bi,bj) = FluxCO2(i,j,bi,bj)/permil
228     c convert flux (mol m-2 s-1) to (mmol m-2 s-1)
229     FluxCO2(i,j,bi,bj) = FluxCO2(i,j,bi,bj)*1. _d 3
230    
231    
232     #ifdef ALLOW_OLD_VIRTUALFLUX
233     IF (maskC(i,j,kLev,bi,bj).NE.0. _d 0) THEN
234     c calculate virtual flux
235     c EminusPforV = dS/dt*(1/Sglob)
236     C NOTE: Be very careful with signs here!
237     C Positive EminusPforV => loss of water to atmos and increase
238     C in salinity. Thus, also increase in other surface tracers
239     C (i.e. positive virtual flux into surface layer)
240     C ...so here, VirtualFLux = dC/dt!
241     VirtualFlux(i,j)=gsm_DIC*surfaceForcingS(i,j,bi,bj)/gsm_s
242     c OR
243     c let virtual flux be zero
244     c VirtualFlux(i,j)=0.d0
245     c
246     ELSE
247     VirtualFlux(i,j)=0. _d 0
248     ENDIF
249     #endif /* ALLOW_OLD_VIRTUALFLUX */
250     ENDDO
251     ENDDO
252    
253     C update tendency
254     DO j=jmin,jmax
255     DO i=imin,imax
256     GDC(i,j)= recip_drF(kLev)*recip_hFacC(i,j,kLev,bi,bj)
257     & *(FluxCO2(i,j,bi,bj)
258     #ifdef ALLOW_OLD_VIRTUALFLUX
259     & + VirtualFlux(i,j)
260     #endif
261     & )
262     #ifdef CO2_FLUX_BUDGET
263     if(budgetTStep1.EQ.0) then
264     C if first timestep
265     C this is problematic at restart clean-up later
266     dCO2Flux(i,j,bi,bj) = 0. _d 0
267     else
268     C can include VirtualFlux later, if it is needed
269     dCO2Flux(i,j,bi,bj) = FluxCO2(i,j,bi,bj) -
270     & fluxCO2_1(i,j,bi,bj)
271     endif
272     fluxCO2_1(i,j,bi,bj) = FluxCO2(i,j,bi,bj)
273    
274     #endif /* CO2_FLUX_BUDGET */
275     ENDDO
276     ENDDO
277    
278     RETURN
279     END
280     #endif /*ALLOW_CARBON*/
281    
282     #endif /*DARWIN*/
283     #endif /*ALLOW_PTRACERS*/
284     c ==================================================================

  ViewVC Help
Powered by ViewVC 1.1.22