1 |
|
C $Header$ |
2 |
|
C $Name$ |
3 |
|
|
4 |
#include "DIC_OPTIONS.h" |
#include "DIC_OPTIONS.h" |
|
#include "GCHEM_OPTIONS.h" |
|
5 |
|
|
6 |
CBOP |
CBOP |
7 |
C !ROUTINE: BIO_EXPORT |
C !ROUTINE: BIO_EXPORT |
8 |
|
|
9 |
C !INTERFACE: ========================================================== |
C !INTERFACE: ========================================================== |
10 |
SUBROUTINE BIO_EXPORT( PTR_PO4 , |
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 !DESCRIPTION: |
c !DESCRIPTION: |
19 |
C Calculate biological activity and export |
C Calculate biological activity and export |
20 |
|
|
21 |
C !USES: =============================================================== |
C !USES: =============================================================== |
22 |
IMPLICIT NONE |
IMPLICIT NONE |
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 !INPUT PARAMETERS: =================================================== |
C !INPUT PARAMETERS: =================================================== |
34 |
C myThid :: thread number |
C myThid :: thread number |
60 |
_RL sfac(1-OLy:sNy+OLy) |
_RL sfac(1-OLy:sNy+OLy) |
61 |
_RL lit, atten |
_RL lit, atten |
62 |
_RL nutlimit |
_RL nutlimit |
63 |
|
_RL tmpfe, tmppo4 |
64 |
#ifdef AD_SAFE |
#ifdef AD_SAFE |
65 |
_RL thx, thy, theps |
_RL thx, thy, theps |
66 |
#endif |
#endif |
68 |
|
|
69 |
|
|
70 |
#ifndef READ_PAR |
#ifndef READ_PAR |
71 |
call insol(myTime,sfac,bj) |
#ifndef USE_QSW |
72 |
|
CALL INSOL(myTime,sfac,bi,bj,myThid) |
73 |
|
#endif |
74 |
#endif |
#endif |
75 |
DO j=jmin,jmax |
DO j=jmin,jmax |
76 |
DO i=imin,imax |
DO i=imin,imax |
77 |
C Fortran-90 |
cph: following init assumes nlev=nr |
78 |
CRG C$TAF INIT bio_export = static, nlev |
cph: set in dic_init_fixed.F (ALLOW_AUTODIFF) |
79 |
|
C$TAF INIT bio_export = static, nr |
80 |
C FORTRAN-77 dynamic memory uses adstore adresto |
C FORTRAN-77 dynamic memory uses adstore adresto |
81 |
CRG C$TAF INIT bio_export = memory |
CRG C$TAF INIT bio_export = memory |
|
C FORTRAN-77 with know max of nlev |
|
|
C$TAF INIT bio_export = static, 10 |
|
82 |
#ifdef READ_PAR |
#ifdef READ_PAR |
83 |
lit=PAR(i,j,bi,bj) |
lit=PAR(i,j,bi,bj) |
84 |
|
#elif (defined USE_QSW) |
85 |
|
lit=-parfrac*Qsw(i,j,bi,bj)*maskC(i,j,1,bi,bj) |
86 |
#else |
#else |
87 |
lit=sfac(j) |
lit=sfac(j) |
88 |
#endif |
#endif |
89 |
|
|
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=lit*(1. _d 0 - FIce(i,j,bi,bj)) |
94 |
|
ENDIF |
95 |
|
c |
96 |
DO k=1,nlev |
DO k=1,nlev |
97 |
C$TAF STORE lit = bio_export |
C$TAF STORE lit = bio_export |
98 |
atten=(k0*drF(k)*hFacC(i,j,k,bi,bj)*.5) |
atten=(k0*drF(k)*hFacC(i,j,k,bi,bj)*.5 _d 0) |
99 |
if (k.gt.1) atten=atten+(k0*drF(k-1) |
if (k.gt.1) atten=atten+(k0*drF(k-1) |
100 |
& *hFacC(i,j,k-1,bi,bj)*.5) |
& *hFacC(i,j,k-1,bi,bj)*.5 _d 0) |
101 |
lit=lit*exp(-atten)*(1.d0-Fice(i,j,bi,bj)) |
lit=lit*exp(-atten) |
102 |
if (lit.lt.0.d0.or.lit.gt.150) then |
IF (lit.LT.0. _d 0.OR.lit.GT.350. _d 0) THEN |
103 |
print*,'QQ lit', lit |
print*,'QQ lit', lit |
104 |
endif |
ENDIF |
105 |
|
|
106 |
|
#ifdef DIC_NO_NEG |
107 |
|
tmppo4=max(0. _d 0, PTR_PO4(i,j,k)) |
108 |
|
lit=max(0. _d 0,lit) |
109 |
|
#else |
110 |
|
tmppo4=PTR_PO4(i,j,k) |
111 |
|
#endif |
112 |
|
|
113 |
#ifdef ALLOW_FE |
#ifdef ALLOW_FE |
114 |
|
#ifdef DIC_NO_NEG |
115 |
|
tmpfe=max(0. _d 0,PTR_FE(i,j,k)) |
116 |
|
#else |
117 |
|
tmpfe=PTR_FE(i,j,k) |
118 |
|
#endif |
119 |
#ifdef AD_SAFE |
#ifdef AD_SAFE |
120 |
thx = PTR_PO4(i,j,k)/(PTR_PO4(i,j,k)+KPO4) |
thx = tmppo4/(tmppo4+KPO4) |
121 |
thy = PTR_FE(i,j,k)/(PTR_FE(i,j,k)+KFE) |
thy = tmpfe/(tmpfe+KFE) |
122 |
theps = 1.d-6 |
c thx = PTR_PO4(i,j,k)/(PTR_PO4(i,j,k)+KPO4) |
123 |
nutlimit= ( 1.d0 - tanh((thx-thy)/theps) ) * thx/2 + |
c thy = PTR_FE(i,j,k)/(PTR_FE(i,j,k)+KFE) |
124 |
& ( 1.d0 + tanh((thx-thy)/theps) ) * thy/2 |
theps = 1. _d -6 |
125 |
|
nutlimit= ( 1. _d 0 - tanh((thx-thy)/theps) ) * thx/2. _d 0 |
126 |
|
& +( 1. _d 0 + tanh((thx-thy)/theps) ) * thy/2. _d 0 |
127 |
#else |
#else |
128 |
nutlimit= min(PTR_PO4(i,j,k)/(PTR_PO4(i,j,k)+KPO4), |
nutlimit= min(tmppo4/(tmppo4+KPO4), |
129 |
& PTR_FE(i,j,k)/(PTR_FE(i,j,k)+KFE) ) |
& tmpfe/(tmpfe+KFE) ) |
130 |
#endif |
#endif |
131 |
#else |
#else |
132 |
nutlimit= PTR_PO4(i,j,k)/(PTR_PO4(i,j,k)+KPO4) |
nutlimit= tmppo4/(tmppo4+KPO4) |
133 |
#endif |
#endif |
134 |
|
|
135 |
bioac(i,j,k)=alpha(i,j,bi,bj)* |
bioac(i,j,k)=alpha(i,j,bi,bj)* |