1 |
C $Header: /u/gcmpack/MITgcm/pkg/dic/bio_export.F,v 1.28 2010/08/02 07:10:52 mlosch Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "DIC_OPTIONS.h" |
5 |
|
6 |
CBOP |
7 |
C !ROUTINE: BIO_EXPORT |
8 |
|
9 |
C !INTERFACE: ========================================================== |
10 |
SUBROUTINE BIO_EXPORT( PTR_PO4 , |
11 |
#ifdef ALLOW_FE |
12 |
I PTR_FE, |
13 |
#endif |
14 |
I bioac, |
15 |
I bi,bj,iMin,iMax,jMin,jMax, |
16 |
I myIter,myTime,myThid) |
17 |
|
18 |
c !DESCRIPTION: |
19 |
C Calculate biological activity and export |
20 |
|
21 |
C !USES: =============================================================== |
22 |
IMPLICIT NONE |
23 |
#include "SIZE.h" |
24 |
#include "DYNVARS.h" |
25 |
#include "EEPARAMS.h" |
26 |
#include "PARAMS.h" |
27 |
#include "GRID.h" |
28 |
#include "DIC_VARS.h" |
29 |
#ifdef USE_QSW |
30 |
#include "FFIELDS.h" |
31 |
#endif |
32 |
|
33 |
C !INPUT PARAMETERS: =================================================== |
34 |
C myThid :: thread number |
35 |
C myIter :: current timestep |
36 |
C myTime :: current time |
37 |
C PTR_PO4 :: phosphate tracer field |
38 |
C PTR_FE :: iron tracer field |
39 |
INTEGER myIter |
40 |
_RL myTime |
41 |
INTEGER myThid |
42 |
_RL PTR_PO4(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
43 |
#ifdef ALLOW_FE |
44 |
_RL PTR_FE(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
45 |
#endif |
46 |
INTEGER iMin, iMax, jMin, jMax, bi, bj |
47 |
|
48 |
C !OUTPUT PARAMETERS: ================================================== |
49 |
C bioac :: biological productivity (will be split |
50 |
C between export and dissolved pool) |
51 |
_RL bioac(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nR) |
52 |
|
53 |
#if (defined ALLOW_PTRACERS && defined DIC_BIOTIC) |
54 |
|
55 |
C !LOCAL VARIABLES: ==================================================== |
56 |
C i,j,k :: loop indices |
57 |
INTEGER i,j,k |
58 |
_RL sfac (1-OLy:sNy+OLy) |
59 |
_RL lit (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
60 |
_RL kall, atten |
61 |
_RL nutlimit |
62 |
_RL tmppo4 |
63 |
#ifdef ALLOW_FE |
64 |
_RL tmpfe |
65 |
#endif |
66 |
#ifdef AD_SAFE |
67 |
_RL thx, thy, theps, thaux |
68 |
#endif |
69 |
CEOP |
70 |
|
71 |
#ifndef READ_PAR |
72 |
#ifndef USE_QSW |
73 |
CALL INSOL(myTime,sfac,bi,bj,myThid) |
74 |
#endif |
75 |
#endif |
76 |
cph: following init assumes nlev=nr |
77 |
cph: set in dic_init_fixed.F (ALLOW_AUTODIFF) |
78 |
C$TAF INIT bio_export = static, nsx*nsy*nr |
79 |
C FORTRAN-77 dynamic memory uses adstore adresto |
80 |
CRG C$TAF INIT bio_export = memory |
81 |
DO j=jMin,jMax |
82 |
DO i=iMin,iMax |
83 |
#ifdef READ_PAR |
84 |
lit(i,j)=PAR(i,j,bi,bj) |
85 |
#elif (defined USE_QSW) |
86 |
lit(i,j)=-parfrac*Qsw(i,j,bi,bj)*maskC(i,j,1,bi,bj) |
87 |
#else |
88 |
lit(i,j)=sfac(j) |
89 |
#endif |
90 |
IF ( .NOT. QSW_underice ) THEN |
91 |
c if using Qsw but not seaice/thsice or coupled, then |
92 |
c ice fraction needs to be taken into account |
93 |
lit(i,j)=lit(i,j)*(1. _d 0 - FIce(i,j,bi,bj)) |
94 |
ENDIF |
95 |
ENDDO |
96 |
ENDDO |
97 |
|
98 |
kall = k0 |
99 |
DO k=1,nlev |
100 |
C$TAF STORE lit = bio_export |
101 |
DO j=jMin,jMax |
102 |
DO i=iMin,iMax |
103 |
#ifdef LIGHT_CHL |
104 |
c Add self-shading effects to light attenuation coefficient |
105 |
kall = k0+kchl*CHL(i,j,bi,bj) |
106 |
#endif |
107 |
atten = kall*drF(k)*hFacC(i,j,k,bi,bj)*.5 _d 0 |
108 |
if (k.gt.1) atten = atten |
109 |
& +( kall*drF(k-1)*hFacC(i,j,k-1,bi,bj)*.5 _d 0 ) |
110 |
lit(i,j)=lit(i,j)*exp(-atten) |
111 |
#ifndef TARGET_NEC_SX |
112 |
C this statement breaks vectorization and causes a dramatic |
113 |
C performance drop on vector computers |
114 |
IF (lit(i,j).LT.0. _d 0.OR.lit(i,j).GT.350. _d 0) THEN |
115 |
print*,'QQ lit',i,j,lit(i,j) |
116 |
ENDIF |
117 |
#endif |
118 |
#ifdef DIC_NO_NEG |
119 |
tmppo4=max(0. _d 0, PTR_PO4(i,j,k)) |
120 |
lit(i,j)=max(0. _d 0,lit(i,j)) |
121 |
#else |
122 |
tmppo4=PTR_PO4(i,j,k) |
123 |
#endif |
124 |
|
125 |
#ifdef ALLOW_FE |
126 |
#ifdef DIC_NO_NEG |
127 |
tmpfe=max(0. _d 0,PTR_FE(i,j,k)) |
128 |
#else |
129 |
tmpfe=PTR_FE(i,j,k) |
130 |
#endif |
131 |
#ifdef AD_SAFE |
132 |
thx = tmppo4/(tmppo4+KPO4) |
133 |
thy = tmpfe/(tmpfe+KFE) |
134 |
c thx = PTR_PO4(i,j,k)/(PTR_PO4(i,j,k)+KPO4) |
135 |
c thy = PTR_FE(i,j,k)/(PTR_FE(i,j,k)+KFE) |
136 |
c theps = 1. _d -6 |
137 |
c thaux = tanh( (thx-thy)/theps ) |
138 |
thaux = tanh( (thx-thy)*1. _d 6 ) |
139 |
nutlimit= ( 1. _d 0 - thaux ) * thx * 0.5 _d 0 |
140 |
& + ( 1. _d 0 + thaux ) * thy * 0.5 _d 0 |
141 |
#else |
142 |
nutlimit=min( tmppo4/(tmppo4+KPO4),tmpfe/(tmpfe+KFE) ) |
143 |
#endif |
144 |
#else |
145 |
nutlimit= tmppo4/(tmppo4+KPO4) |
146 |
#endif |
147 |
|
148 |
bioac(i,j,k)=alpha(i,j,bi,bj)* |
149 |
& lit(i,j)/(lit(i,j)+lit0)*maskC(i,j,k,bi,bj)* |
150 |
& nutlimit |
151 |
ENDDO |
152 |
ENDDO |
153 |
ENDDO |
154 |
c |
155 |
#endif /* definded ALLOW_PTRACERS && defined DIC_BIOTIC */ |
156 |
RETURN |
157 |
END |