| 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_BUDGETALK |
| 12 |
|
| 13 |
C !INTERFACE: ========================================================== |
| 14 |
SUBROUTINE DIC_BUDGETALK( PTR_DIC , PTR_ALK, PTR_PO4, PTR_SIL, |
| 15 |
O deltaAlk, |
| 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 !LOCAL VARIABLES: ==================================================== |
| 52 |
INTEGER I,J, kLev, it |
| 53 |
C Number of iterations for pCO2 solvers... |
| 54 |
C Solubility relation coefficients |
| 55 |
_RL SchmidtNoDIC(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
| 56 |
_RL pCO2sat(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
| 57 |
_RL Kwexch(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
| 58 |
_RL pisvel(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
| 59 |
C local variables for carbon chem |
| 60 |
_RL surfdic(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
| 61 |
_RL surfalk(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
| 62 |
_RL surfphos(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
| 63 |
_RL surfsi(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
| 64 |
_RL surfsalt(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
| 65 |
_RL surftemp(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
| 66 |
_RL budgetAlkPert(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
| 67 |
#ifdef ALLOW_OLD_VIRTUALFLUX |
| 68 |
_RL VirtualFlux(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
| 69 |
#endif |
| 70 |
C local variables for CO2_FLUX_BUDGET |
| 71 |
_RL deltaAlk(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
| 72 |
CEOP |
| 73 |
|
| 74 |
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc |
| 75 |
|
| 76 |
kLev=1 |
| 77 |
|
| 78 |
cc if coupled to atmsopheric model, use the |
| 79 |
cc Co2 value passed from the coupler |
| 80 |
c#ifndef USE_ATMOSCO2 |
| 81 |
cC PRE-INDUSTRIAL STEADY STATE pCO2 = 278.0 ppmv |
| 82 |
c DO j=1-OLy,sNy+OLy |
| 83 |
c DO i=1-OLx,sNx+OLx |
| 84 |
c AtmospCO2(i,j,bi,bj)=278.0 _d -6 |
| 85 |
c ENDDO |
| 86 |
c ENDDO |
| 87 |
c#endif |
| 88 |
C ================================================================= |
| 89 |
C determine inorganic carbon chem coefficients |
| 90 |
DO j=jmin,jmax |
| 91 |
DO i=imin,imax |
| 92 |
c put bounds on tracers so pH solver doesn't blow up |
| 93 |
surfdic(i,j) = |
| 94 |
& max(100. _d 0 , min(4000. _d 0, PTR_DIC(i,j)))*1e-3 |
| 95 |
& * maskC(i,j,kLev,bi,bj) |
| 96 |
surfalk(i,j) = |
| 97 |
& max(100. _d 0 , min(4000. _d 0, PTR_ALK(i,j)))*1e-3 |
| 98 |
& * maskC(i,j,kLev,bi,bj) |
| 99 |
surfphos(i,j) = |
| 100 |
& max(1. _d -10, min(10. _d 0, PTR_PO4(i,j)))*1e-3 |
| 101 |
& * maskC(i,j,kLev,bi,bj) |
| 102 |
surfsi(i,j) = |
| 103 |
& max(1. _d -8, min(500. _d 0, PTR_SIL(i,j)))*1e-3 |
| 104 |
& * maskC(i,j,kLev,bi,bj) |
| 105 |
surfsalt(i,j) = |
| 106 |
& max(4. _d 0, min(50. _d 0, salt(i,j,kLev,bi,bj))) |
| 107 |
surftemp(i,j) = |
| 108 |
& max(-4. _d 0, min(39. _d 0, theta(i,j,kLev,bi,bj))) |
| 109 |
budgetAlkPert(i,j) = surfalk(i,j) + budgetPert |
| 110 |
ENDDO |
| 111 |
ENDDO |
| 112 |
|
| 113 |
CALL CARBON_COEFFS( |
| 114 |
I surftemp,surfsalt, |
| 115 |
I bi,bj,iMin,iMax,jMin,jMax,myThid) |
| 116 |
C==================================================================== |
| 117 |
|
| 118 |
DO j=jmin,jmax |
| 119 |
DO i=imin,imax |
| 120 |
C Compute AtmosP and Kwexch_Pre which are re-used for flux of O2 |
| 121 |
|
| 122 |
#ifdef USE_PLOAD |
| 123 |
C Convert anomalous pressure pLoad (in Pa) from atmospheric model |
| 124 |
C to total pressure (in Atm) |
| 125 |
C Note: it is assumed the reference atmospheric pressure is 1Atm=1013mb |
| 126 |
C rather than the actual ref. pressure from Atm. model so that on |
| 127 |
C average AtmosP is about 1 Atm. |
| 128 |
AtmosP(i,j,bi,bj)= 1. _d 0 + pLoad(i,j,bi,bj)/Pa2Atm |
| 129 |
#endif |
| 130 |
|
| 131 |
C Pre-compute part of exchange coefficient: pisvel*(1-fice) |
| 132 |
C Schmidt number is accounted for later |
| 133 |
#ifdef USE_EXFWIND |
| 134 |
pisvel(i,j)=0.337 _d 0 *wspeed(i,j,bi,bj)**2/3.6 _d 5 |
| 135 |
cBX linear piston velocity after Krakauer et al. (2006), Eq. 3 |
| 136 |
cBX using <k> = 20, n=0.5, and <u^n> = 2.6747 (as determined from 2010 |
| 137 |
cBX EXFwspee field from cube92 run) |
| 138 |
cDc pisvel(i,j)=20 _d 0 *(wspeed(i,j,bi,bj)**0.5 |
| 139 |
cDc & /2.6747 _d 0) /3.6 _d 5 |
| 140 |
#else |
| 141 |
pisvel(i,j)=0.337 _d 0 *wind(i,j,bi,bj)**2/3.6 _d 5 |
| 142 |
#endif |
| 143 |
Kwexch_Pre(i,j,bi,bj) = pisvel(i,j) |
| 144 |
& * (1. _d 0 - FIce(i,j,bi,bj)) |
| 145 |
|
| 146 |
ENDDO |
| 147 |
ENDDO |
| 148 |
|
| 149 |
c pCO2 solver... |
| 150 |
C$TAF LOOP = parallel |
| 151 |
DO j=jmin,jmax |
| 152 |
C$TAF LOOP = parallel |
| 153 |
DO i=imin,imax |
| 154 |
|
| 155 |
IF ( maskC(i,j,kLev,bi,bj).NE.0. _d 0 ) THEN |
| 156 |
CALL CALC_PCO2_APPROX( |
| 157 |
I surftemp(i,j),surfsalt(i,j), |
| 158 |
I surfdic(i,j), surfphos(i,j), |
| 159 |
I surfsi(i,j),budgetAlkPert(i,j), |
| 160 |
I ak1(i,j,bi,bj),ak2(i,j,bi,bj), |
| 161 |
I ak1p(i,j,bi,bj),ak2p(i,j,bi,bj),ak3p(i,j,bi,bj), |
| 162 |
I aks(i,j,bi,bj),akb(i,j,bi,bj),akw(i,j,bi,bj), |
| 163 |
I aksi(i,j,bi,bj),akf(i,j,bi,bj), |
| 164 |
I ak0(i,j,bi,bj), fugf(i,j,bi,bj), |
| 165 |
I ff(i,j,bi,bj), |
| 166 |
I bt(i,j,bi,bj),st(i,j,bi,bj),ft(i,j,bi,bj), |
| 167 |
U pH(i,j,bi,bj),pCO2(i,j,bi,bj),CO3(i,j,bi,bj), |
| 168 |
I myThid ) |
| 169 |
ELSE |
| 170 |
pH(i,j,bi,bj) = 0. _d 0 |
| 171 |
pCO2(i,j,bi,bj) = 0. _d 0 |
| 172 |
CO3(i,j,bi,bj) = 0. _d 0 |
| 173 |
ENDIF |
| 174 |
ENDDO |
| 175 |
ENDDO |
| 176 |
|
| 177 |
C update tendency |
| 178 |
DO j=jmin,jmax |
| 179 |
DO i=imin,imax |
| 180 |
if(budgetTStep1.EQ.0) then |
| 181 |
C if first timestep |
| 182 |
C this is problematic at restart; clean-up later |
| 183 |
deltaAlk(i,j) = 0. _d 0 |
| 184 |
previousAlk(i,j,bi,bj) = surfalk(i,j) |
| 185 |
else |
| 186 |
C current value - value from last timestep |
| 187 |
deltaAlk(i,j) = surfalk(i,j) - previousAlk(i,j,bi,bj) |
| 188 |
previousAlk(i,j,bi,bj) = surfalk(i,j) |
| 189 |
endif |
| 190 |
ENDDO |
| 191 |
ENDDO |
| 192 |
|
| 193 |
RETURN |
| 194 |
END |
| 195 |
#endif /*ALLOW_CARBON*/ |
| 196 |
|
| 197 |
#endif /*DARWIN*/ |
| 198 |
#endif /*ALLOW_PTRACERS*/ |
| 199 |
c ================================================================== |