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

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

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

revision 1.2 by stephd, Wed Jul 9 19:59:18 2003 UTC revision 1.12 by stephd, Tue Nov 28 21:16:03 2006 UTC
# Line 1  Line 1 
1  #include "CPP_OPTIONS.h"  C $Header$
2    C $Name$
3    
4    #include "DIC_OPTIONS.h"
5  #include "PTRACERS_OPTIONS.h"  #include "PTRACERS_OPTIONS.h"
6  #include "GCHEM_OPTIONS.h"  #include "GCHEM_OPTIONS.h"
7    
8  CStartOfInterFace  CBOP
9        SUBROUTINE DIC_SURFFORCING( PTR_CO2 , GDC,  C !ROUTINE: DIC_SURFFORCING
10    
11    C !INTERFACE: ==========================================================
12          SUBROUTINE DIC_SURFFORCING( PTR_CO2 , PTR_ALK, PTR_PO4, GDC,
13       I           bi,bj,imin,imax,jmin,jmax,       I           bi,bj,imin,imax,jmin,jmax,
14       I           myIter,myTime,myThid)       I           myIter,myTime,myThid)
15    
16  C     /==========================================================\  C !DESCRIPTION:
17  C     | SUBROUTINE DIC_SURFFORCING                               |  C  Calculate the carbon air-sea flux terms              
18  C     | o Calculate the carbon air-sea flux terms                |  C  following external_forcing_dic.F (OCMIP run) from Mick            
 C     | o following external_forcing_dic.F from Mick             |  
 C     |==========================================================|  
       IMPLICIT NONE  
19    
20  C     == GLobal variables ==  C !USES: ===============================================================
21          IMPLICIT NONE
22  #include "SIZE.h"  #include "SIZE.h"
23  #include "DYNVARS.h"  #include "DYNVARS.h"
24  #include "EEPARAMS.h"  #include "EEPARAMS.h"
# Line 22  C     == GLobal variables == Line 26  C     == GLobal variables ==
26  #include "GRID.h"  #include "GRID.h"
27  #include "FFIELDS.h"  #include "FFIELDS.h"
28  #include "DIC_ABIOTIC.h"  #include "DIC_ABIOTIC.h"
 #ifdef DIC_BIOTIC  
 #include "PTRACERS.h"  
 #endif  
29    
30  C     == Routine arguments ==  C !INPUT PARAMETERS: ===================================================
31    C  myThid               :: thread number
32    C  myIter               :: current timestep
33    C  myTime               :: current time
34    c  PTR_CO2              :: DIC tracer field
35        INTEGER myIter, myThid        INTEGER myIter, myThid
36        _RL myTime        _RL myTime
37        _RL  PTR_CO2(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)        _RL  PTR_CO2(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
38        _RL  GDC(1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL  PTR_ALK(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
39          _RL  PTR_PO4(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
40        INTEGER iMin,iMax,jMin,jMax, bi, bj        INTEGER iMin,iMax,jMin,jMax, bi, bj
41    
42    C !OUTPUT PARAMETERS: ===================================================
43    c GDC                   :: tendency due to air-sea exchange
44          _RL  GDC(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
45    
46  #ifdef ALLOW_PTRACERS  #ifdef ALLOW_PTRACERS
47  #ifdef DIC_ABIOTIC  
48  C     == Local variables ==  C !LOCAL VARIABLES: ====================================================
49         INTEGER I,J, kLev, it         INTEGER I,J, kLev, it
50  C Number of iterations for pCO2 solvers...  C Number of iterations for pCO2 solvers...
       INTEGER inewtonmax  
       INTEGER ibrackmax  
       INTEGER donewt  
51  C Solubility relation coefficients  C Solubility relation coefficients
52        _RL SchmidtNoDIC(1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL SchmidtNoDIC(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
53        _RL pCO2sat(1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL pCO2sat(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
# Line 50  C local variables for carbon chem Line 57  C local variables for carbon chem
57        _RL surfphos(1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL surfphos(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
58        _RL surfsi(1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL surfsi(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
59        _RL VirtualFlux(1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL VirtualFlux(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
60    CEOP
61    
62  cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc  cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
63    
# Line 65  C PRE-INDUSTRIAL STEADY STATE pCO2 = 278 Line 73  C PRE-INDUSTRIAL STEADY STATE pCO2 = 278
73    
74  C =================================================================  C =================================================================
75  C determine inorganic carbon chem coefficients  C determine inorganic carbon chem coefficients
76          DO j=1-OLy,sNy+OLy          DO j=jmin,jmax
77           DO i=1-OLx,sNx+OLx           DO i=imin,imax
78    
79  #ifdef DIC_BIOTIC  #ifdef DIC_BIOTIC
80  cQQQQ check ptracer numbers  cQQQQ check ptracer numbers
81               surfalk(i,j) = PTRACER(i,j,klev,bi,bj,2)               surfalk(i,j) = PTR_ALK(i,j,klev)
82       &                          * maskC(i,j,kLev,bi,bj)       &                          * maskC(i,j,kLev,bi,bj)
83               surfphos(i,j)  = PTRACER(i,j,klev,bi,bj,3)               surfphos(i,j)  = PTR_PO4(i,j,klev)
84       &                          * maskC(i,j,kLev,bi,bj)       &                          * maskC(i,j,kLev,bi,bj)
85  #else  #else
86               surfalk(i,j) = 2.366595 * salt(i,j,kLev,bi,bj)/gsm_s               surfalk(i,j) = 2.366595 * salt(i,j,kLev,bi,bj)/gsm_s
# Line 80  cQQQQ check ptracer numbers Line 88  cQQQQ check ptracer numbers
88               surfphos(i,j)  = 5.1225e-4 * maskC(i,j,kLev,bi,bj)               surfphos(i,j)  = 5.1225e-4 * maskC(i,j,kLev,bi,bj)
89  #endif  #endif
90  C FOR NON-INTERACTIVE Si  C FOR NON-INTERACTIVE Si
91               surfsi(i,j)   = 7.6838e-3 * maskC(i,j,kLev,bi,bj)               surfsi(i,j)   = SILICA(i,j,bi,bj) * maskC(i,j,kLev,bi,bj)
92            ENDDO            ENDDO
93           ENDDO           ENDDO
94    
# Line 89  C FOR NON-INTERACTIVE Si Line 97  C FOR NON-INTERACTIVE Si
97       I                       bi,bj,iMin,iMax,jMin,jMax)       I                       bi,bj,iMin,iMax,jMin,jMax)
98  C====================================================================  C====================================================================
99    
 #define PH_APPROX  
 c set number of iterations for [H+] solvers  
 #ifdef PH_APPROX  
        inewtonmax = 1  
 #else  
        inewtonmax = 10  
 #endif  
        ibrackmax = 30  
 C determine pCO2 in surface ocean  
 C set guess of pH for first step here  
 C IF first step THEN use bracket-bisection for first step,  
 C and determine carbon coefficients for safety  
 C ELSE use newton-raphson with previous H+(x,y) as first guess  
   
        donewt=1  
   
 c for first few timesteps  
        IF(myIter .le. (nIter0+inewtonmax) )then  
           donewt=0  
           DO j=1-OLy,sNy+OLy  
            DO i=1-OLx,sNx+OLx  
                   pH(i,j,bi,bj) = 8.0  
            ENDDO  
           ENDDO  
 #ifdef PH_APPROX  
           print*,'QQ: pCO2 approximation method'  
 c first approxmation  
        DO j=1-OLy,sNy+OLy  
         DO i=1-OLx,sNx+OLx  
          do it=1,10  
           CALL CALC_PCO2_APPROX(  
      I        theta(i,j,kLev,bi,bj),salt(i,j,kLev,bi,bj),  
      I        PTR_CO2(i,j,kLev), surfphos(i,j),  
      I        surfsi(i,j),surfalk(i,j),  
      I        ak1(i,j,bi,bj),ak2(i,j,bi,bj),  
      I        ak1p(i,j,bi,bj),ak2p(i,j,bi,bj),ak3p(i,j,bi,bj),  
      I        aks(i,j,bi,bj),akb(i,j,bi,bj),akw(i,j,bi,bj),  
      I        aksi(i,j,bi,bj),akf(i,j,bi,bj),ff(i,j,bi,bj),  
      I        bt(i,j,bi,bj),st(i,j,bi,bj),ft(i,j,bi,bj),  
      U        pH(i,j,bi,bj),pCO2(i,j,bi,bj) )  
          enddo  
         ENDDO  
        ENDDO  
 #else  
           print*,'QQ: pCO2 full method'  
 #endif  
        ENDIF  
   
   
100  c pCO2 solver...  c pCO2 solver...
101         DO j=1-OLy,sNy+OLy  C$TAF LOOP = parallel
102          DO i=1-OLx,sNx+OLx         DO j=jmin,jmax
103    C$TAF LOOP = parallel
104            DO i=imin,imax
105    
106            IF(maskC(i,j,kLev,bi,bj) .NE. 0.)THEN            IF(maskC(i,j,kLev,bi,bj) .NE. 0.)THEN
 #ifdef PH_APPROX  
107              CALL CALC_PCO2_APPROX(              CALL CALC_PCO2_APPROX(
108       I        theta(i,j,kLev,bi,bj),salt(i,j,kLev,bi,bj),       I        theta(i,j,kLev,bi,bj),salt(i,j,kLev,bi,bj),
109       I        PTR_CO2(i,j,kLev), surfphos(i,j),       I        PTR_CO2(i,j,kLev), surfphos(i,j),
# Line 154  c pCO2 solver... Line 114  c pCO2 solver...
114       I        aksi(i,j,bi,bj),akf(i,j,bi,bj),ff(i,j,bi,bj),       I        aksi(i,j,bi,bj),akf(i,j,bi,bj),ff(i,j,bi,bj),
115       I        bt(i,j,bi,bj),st(i,j,bi,bj),ft(i,j,bi,bj),       I        bt(i,j,bi,bj),st(i,j,bi,bj),ft(i,j,bi,bj),
116       U        pH(i,j,bi,bj),pCO2(i,j,bi,bj) )       U        pH(i,j,bi,bj),pCO2(i,j,bi,bj) )
 #else  
             CALL CALC_PCO2(donewt,inewtonmax,ibrackmax,  
      I        theta(i,j,kLev,bi,bj),salt(i,j,kLev,bi,bj),  
      I        PTR_CO2(i,j,kLev), surfphos(i,j),  
      I        surfsi(i,j),surfalk(i,j),  
      I        ak1(i,j,bi,bj),ak2(i,j,bi,bj),  
      I        ak1p(i,j,bi,bj),ak2p(i,j,bi,bj),ak3p(i,j,bi,bj),  
      I        aks(i,j,bi,bj),akb(i,j,bi,bj),akw(i,j,bi,bj),  
      I        aksi(i,j,bi,bj),akf(i,j,bi,bj),ff(i,j,bi,bj),  
      I        bt(i,j,bi,bj),st(i,j,bi,bj),ft(i,j,bi,bj),  
      U        pH(i,j,bi,bj),pCO2(i,j,bi,bj) )  
 #endif  
117            ELSE            ELSE
118               pCO2(i,j,bi,bj)=0. _d 0               pCO2(i,j,bi,bj)=0. _d 0
119            END IF            END IF
120          ENDDO          ENDDO
121         ENDDO         ENDDO
122    
123         DO j=1-OLy,sNy+OLy         DO j=jmin,jmax
124          DO i=1-OLx,sNx+OLx          DO i=imin,imax
125    
126              IF (maskC(i,j,kLev,bi,bj).NE.0.) THEN              IF (maskC(i,j,kLev,bi,bj).NE.0.) THEN
127  C calculate SCHMIDT NO. for CO2  C calculate SCHMIDT NO. for CO2
# Line 190  C first correct pCO2at for surface atmos Line 138  C first correct pCO2at for surface atmos
138       &          AtmosP(i,j,bi,bj)*AtmospCO2(i,j,bi,bj)       &          AtmosP(i,j,bi,bj)*AtmospCO2(i,j,bi,bj)
139  c find exchange coefficient  c find exchange coefficient
140  c  account for schmidt number and and varible piston velocity  c  account for schmidt number and and varible piston velocity
141                  pisvel(i,j,bi,bj)  =0.337*wind(i,j,bi,bj)**2/3.6d5
142                Kwexch(i,j) =                Kwexch(i,j) =
143       &             pisvel(i,j,bi,bj)       &             pisvel(i,j,bi,bj)
144       &             / sqrt(SchmidtNoDIC(i,j)/660.0)       &             / sqrt(SchmidtNoDIC(i,j)/660.0)
145  c OR use a constant  coeff  c OR use a constant  coeff
146  c             Kwexch(i,j) = 5e-5  c             Kwexch(i,j) = 5e-5
147  c ice influence  c ice influence
148  cQQ           Kwexch(i,j)  =(1.d0-Fice(i,j,bi,bj))*Kwexch(i,j)                Kwexch(i,j)  =(1.d0-Fice(i,j,bi,bj))*Kwexch(i,j)
149    
150    
151  C Calculate flux in terms of DIC units using K0, solubility  C Calculate flux in terms of DIC units using K0, solubility
# Line 222  C Positive EminusPforV => loss of water Line 171  C Positive EminusPforV => loss of water
171  C in salinity. Thus, also increase in other surface tracers  C in salinity. Thus, also increase in other surface tracers
172  C (i.e. positive virtual flux into surface layer)  C (i.e. positive virtual flux into surface layer)
173  C ...so here, VirtualFLux = dC/dt!  C ...so here, VirtualFLux = dC/dt!
174                VirtualFlux(i,j)=gsm_DIC*surfaceTendencyS(i,j,bi,bj)/gsm_s                VirtualFlux(i,j)=gsm_DIC*surfaceForcingS(i,j,bi,bj)/gsm_s
175  c OR  c OR
176  c let virtual flux be zero  c let virtual flux be zero
177  c              VirtualFlux(i,j)=0.d0  c              VirtualFlux(i,j)=0.d0
# Line 234  c Line 183  c
183           ENDDO           ENDDO
184    
185  C update tendency        C update tendency      
186           DO j=1-OLy,sNy+OLy           DO j=jmin,jmax
187            DO i=1-OLx,sNx+OLx            DO i=imin,imax
188             GDC(i,j)= maskC(i,j,kLev,bi,bj)*(             GDC(i,j)= maskC(i,j,kLev,bi,bj)*recip_drF(kLev)*
189       &                    FluxCO2(i,j,bi,bj)*recip_drF(kLev)       &                     recip_hFacC(i,j,kLev,bi,bj)*(
190       &                    + VirtualFlux(i,j)       &                    FluxCO2(i,j,bi,bj) + VirtualFlux(i,j)
191       &                                              )       &                                              )
192            ENDDO            ENDDO
193           ENDDO           ENDDO
194    
195  #endif  #endif
 #endif  
196          RETURN          RETURN
197          END          END

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.12

  ViewVC Help
Powered by ViewVC 1.1.22