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