1 |
C $Header: /u/gcmpack/MITgcm/pkg/dic/bio_export.F,v 1.21 2007/12/06 22:24:34 stephd Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "DIC_OPTIONS.h" |
5 |
#include "GCHEM_OPTIONS.h" |
6 |
|
7 |
CBOP |
8 |
C !ROUTINE: BIO_EXPORT |
9 |
|
10 |
C !INTERFACE: ========================================================== |
11 |
SUBROUTINE BIO_EXPORT( PTR_PO4 , |
12 |
#ifdef ALLOW_FE |
13 |
I PTR_FE, |
14 |
#endif |
15 |
I bioac, |
16 |
I bi,bj,imin,imax,jmin,jmax, |
17 |
I myIter,myTime,myThid) |
18 |
|
19 |
c !DESCRIPTION: |
20 |
C Calculate biological activity and export |
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 "DIC_VARS.h" |
30 |
#ifdef USE_QSW |
31 |
#include "FFIELDS.h" |
32 |
#endif |
33 |
|
34 |
C !INPUT PARAMETERS: =================================================== |
35 |
C myThid :: thread number |
36 |
C myIter :: current timestep |
37 |
C myTime :: current time |
38 |
C PTR_PO4 :: phosphate tracer field |
39 |
C PTR_FE :: iron tracer field |
40 |
INTEGER myIter |
41 |
_RL myTime |
42 |
INTEGER myThid |
43 |
_RL PTR_PO4(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
44 |
#ifdef ALLOW_FE |
45 |
_RL PTR_FE(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
46 |
#endif |
47 |
INTEGER imin, imax, jmin, jmax, bi, bj |
48 |
|
49 |
|
50 |
C !OUTPUT PARAMETERS: ================================================== |
51 |
C bioac :: biological productivity (will be split |
52 |
C between export and dissolved pool) |
53 |
_RL bioac(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nR) |
54 |
|
55 |
#ifdef ALLOW_PTRACERS |
56 |
#ifdef DIC_BIOTIC |
57 |
|
58 |
C !LOCAL VARIABLES: ==================================================== |
59 |
C i,j,k :: loop indices |
60 |
INTEGER I,J,k |
61 |
_RL sfac(1-OLy:sNy+OLy) |
62 |
_RL lit, atten |
63 |
_RL nutlimit |
64 |
_RL tmpfe, tmppo4 |
65 |
#ifdef AD_SAFE |
66 |
_RL thx, thy, theps |
67 |
#endif |
68 |
CEOP |
69 |
|
70 |
|
71 |
#ifndef READ_PAR |
72 |
#ifndef USE_QSW |
73 |
call insol(myTime,sfac,bj) |
74 |
#endif |
75 |
#endif |
76 |
DO j=jmin,jmax |
77 |
DO i=imin,imax |
78 |
C Fortran-90 |
79 |
CRG C$TAF INIT bio_export = static, nlev |
80 |
C FORTRAN-77 dynamic memory uses adstore adresto |
81 |
CRG C$TAF INIT bio_export = memory |
82 |
C FORTRAN-77 with know max of nlev |
83 |
C$TAF INIT bio_export = static, 10 |
84 |
#ifdef READ_PAR |
85 |
lit=PAR(i,j,bi,bj) |
86 |
#elif (defined USE_QSW) |
87 |
lit=-parfrac*Qsw(i,j,bi,bj)*maskC(i,j,1,bi,bj) |
88 |
#else |
89 |
lit=sfac(j) |
90 |
#endif |
91 |
|
92 |
IF ( .NOT. QSW_underice ) THEN |
93 |
c if using Qsw but not seaice/thsice or coupled, then |
94 |
c ice fraction needs to be taken into account |
95 |
lit=lit*(1. _d 0 - FIce(i,j,bi,bj)) |
96 |
ENDIF |
97 |
c |
98 |
DO k=1,nlev |
99 |
C$TAF STORE lit = bio_export |
100 |
atten=(k0*drF(k)*hFacC(i,j,k,bi,bj)*.5 _d 0) |
101 |
if (k.gt.1) atten=atten+(k0*drF(k-1) |
102 |
& *hFacC(i,j,k-1,bi,bj)*.5 _d 0) |
103 |
lit=lit*exp(-atten) |
104 |
IF (lit.LT.0. _d 0.OR.lit.GT.350. _d 0) THEN |
105 |
print*,'QQ lit', lit |
106 |
ENDIF |
107 |
|
108 |
#ifdef DIC_NO_NEG |
109 |
tmppo4=max(0. _d 0, PTR_PO4(i,j,k)) |
110 |
lit=max(0. _d 0,lit) |
111 |
#else |
112 |
tmppo4=PTR_PO4(i,j,k) |
113 |
#endif |
114 |
|
115 |
#ifdef ALLOW_FE |
116 |
#ifdef DIC_NO_NEG |
117 |
tmpfe=max(0. _d 0,PTR_FE(i,j,k)) |
118 |
#else |
119 |
tmpfe=PTR_FE(i,j,k) |
120 |
#endif |
121 |
#ifdef AD_SAFE |
122 |
thx = tmppo4/(tmppo4+KPO4) |
123 |
thy = tmpfe/(tmpfe+KFE) |
124 |
c thx = PTR_PO4(i,j,k)/(PTR_PO4(i,j,k)+KPO4) |
125 |
c thy = PTR_FE(i,j,k)/(PTR_FE(i,j,k)+KFE) |
126 |
theps = 1. _d -6 |
127 |
nutlimit= ( 1. _d 0 - tanh((thx-thy)/theps) ) * thx/2. _d 0 |
128 |
& +( 1. _d 0 + tanh((thx-thy)/theps) ) * thy/2. _d 0 |
129 |
#else |
130 |
nutlimit= min(tmppo4/(tmppo4+KPO4), |
131 |
& tmpfe/(tmpfe+KFE) ) |
132 |
#endif |
133 |
#else |
134 |
nutlimit= tmppo4/(tmppo4+KPO4) |
135 |
#endif |
136 |
|
137 |
bioac(i,j,k)=alpha(i,j,bi,bj)* |
138 |
& lit/(lit+lit0)*maskC(i,j,k,bi,bj)* |
139 |
& nutlimit |
140 |
ENDDO |
141 |
ENDDO |
142 |
ENDDO |
143 |
c |
144 |
#endif |
145 |
#endif |
146 |
RETURN |
147 |
END |