21 |
#include "PARAMS.h" |
#include "PARAMS.h" |
22 |
#include "GRID.h" |
#include "GRID.h" |
23 |
#include "DYNVARS.h" |
#include "DYNVARS.h" |
24 |
#ifdef USE_QSW |
c for Qsw and/or surfaceForcingT |
25 |
|
c choice which field to take pCO2 from for pCO2limit |
26 |
|
c this assumes we use Ttendency from offline |
27 |
#include "FFIELDS.h" |
#include "FFIELDS.h" |
|
#endif |
|
28 |
#ifdef ALLOW_LONGSTEP |
#ifdef ALLOW_LONGSTEP |
29 |
#include "LONGSTEP.h" |
#include "LONGSTEP.h" |
30 |
#endif |
#endif |
44 |
#include "WAVEBANDS_PARAMS.h" |
#include "WAVEBANDS_PARAMS.h" |
45 |
#endif |
#endif |
46 |
|
|
47 |
|
|
48 |
C === Global variables === |
C === Global variables === |
49 |
c tracers |
c tracers |
50 |
_RL Ptr(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy,nDarwin) |
_RL Ptr(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy,nDarwin) |
70 |
_RL Phy_k(npmax,Nr) |
_RL Phy_k(npmax,Nr) |
71 |
_RL Phyup(npmax) |
_RL Phyup(npmax) |
72 |
_RL part_k(Nr) |
_RL part_k(Nr) |
73 |
|
#ifdef ALLOW_CDOM |
74 |
|
_RL cdom_k(Nr) |
75 |
|
#endif |
76 |
c iron partitioning |
c iron partitioning |
77 |
_RL freefe(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
_RL freefe(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
78 |
c some working variables |
c some working variables |
98 |
_RL Edz(tlam,Nr),Esz(tlam,Nr),Euz(tlam,Nr),Eutop(tlam,Nr) |
_RL Edz(tlam,Nr),Esz(tlam,Nr),Euz(tlam,Nr),Eutop(tlam,Nr) |
99 |
_RL tirrq(nr) |
_RL tirrq(nr) |
100 |
_RL tirrwq(tlam,nr) |
_RL tirrwq(tlam,nr) |
101 |
|
_RL c1(tlam,nr), c2(tlam,nr) |
102 |
_RL solz |
_RL solz |
103 |
_RL rmud |
_RL rmud |
104 |
_RL actot,bctot,bbctot |
_RL actot,bctot,bbctot |
117 |
_RL Diver2(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
_RL Diver2(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
118 |
_RL Diver3(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
_RL Diver3(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
119 |
_RL Diver4(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
_RL Diver4(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
120 |
|
_RL Shannon(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
121 |
|
_RL Simpson(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
122 |
|
|
123 |
_RL tmpphy(npmax) |
_RL tmpphy(npmax) |
124 |
_RL totphy, biotot, maxphy, phymax |
_RL totphy, biotot, maxphy, phymax |
132 |
_RL chlup(npmax) |
_RL chlup(npmax) |
133 |
#endif |
#endif |
134 |
#endif |
#endif |
135 |
|
#ifdef ALLOW_CDOM |
136 |
|
_RL cdoml |
137 |
|
_RL dcdoml |
138 |
|
#endif |
139 |
|
|
140 |
#ifdef ALLOW_DIAGNOSTICS |
#ifdef ALLOW_DIAGNOSTICS |
141 |
COJ for diagnostics |
COJ for diagnostics |
197 |
_RL PSiupl |
_RL PSiupl |
198 |
_RL Tlocal |
_RL Tlocal |
199 |
_RL Slocal |
_RL Slocal |
200 |
|
_RL pCO2local |
201 |
_RL Qswlocal |
_RL Qswlocal |
202 |
_RL NH4l |
_RL NH4l |
203 |
_RL NO2l |
_RL NO2l |
290 |
Diver2(i,j,k)=0. _d 0 |
Diver2(i,j,k)=0. _d 0 |
291 |
Diver3(i,j,k)=0. _d 0 |
Diver3(i,j,k)=0. _d 0 |
292 |
Diver4(i,j,k)=0. _d 0 |
Diver4(i,j,k)=0. _d 0 |
293 |
|
Shannon(i,j,k)=0. _d 0 |
294 |
|
Simpson(i,j,k)=1. _d 0 |
295 |
#endif |
#endif |
296 |
|
|
297 |
#ifdef ALLOW_DIAGNOSTICS |
#ifdef ALLOW_DIAGNOSTICS |
298 |
COJ for diagnostics |
COJ for diagnostics |
299 |
PParr(i,j,k) = 0. _d 0 |
PParr(i,j,k) = 0. _d 0 |
300 |
Nfixarr(i,j,k) = 0. _d 0 |
Nfixarr(i,j,k) = 0. _d 0 |
301 |
|
#ifdef DAR_DIAG_CHL |
302 |
|
GeiderChlarr(i,j,k) = 0. _d 0 |
303 |
|
GeiderChl2Carr(i,j,k) = 0. _d 0 |
304 |
|
DoneyChlarr(i,j,k) = 0. _d 0 |
305 |
|
DoneyChl2Carr(i,j,k) = 0. _d 0 |
306 |
|
CloernChlarr(i,j,k) = 0. _d 0 |
307 |
|
CloernChl2Carr(i,j,k) = 0. _d 0 |
308 |
|
#endif |
309 |
c ANNA_TAVE |
c ANNA_TAVE |
310 |
#ifdef WAVES_DIAG_PCHL |
#ifdef WAVES_DIAG_PCHL |
311 |
DO np=1,npmax |
DO np=1,npmax |
428 |
c ------------ these are convenient ------------------------------------ |
c ------------ these are convenient ------------------------------------ |
429 |
DO k=1,Nr |
DO k=1,Nr |
430 |
part_k(k) = max(Ptr(i,j,k,bi,bj,iPOP),0. _d 0) |
part_k(k) = max(Ptr(i,j,k,bi,bj,iPOP),0. _d 0) |
431 |
|
#ifdef ALLOW_CDOM |
432 |
|
cdom_k(k) = max(Ptr(i,j,k,bi,bj,iCDOM),0. _d 0) |
433 |
|
#endif |
434 |
DO np = 1,npmax |
DO np = 1,npmax |
435 |
Phy_k(np,k) = max(Ptr(i,j,k,bi,bj,iPhy+np-1),0. _d 0) |
Phy_k(np,k) = max(Ptr(i,j,k,bi,bj,iPhy+np-1),0. _d 0) |
436 |
#ifdef GEIDER |
#ifdef GEIDER |
446 |
c ------------ GET CDOM_k FOR WAVEBANDS_3D and RADTRANS ---------------- |
c ------------ GET CDOM_k FOR WAVEBANDS_3D and RADTRANS ---------------- |
447 |
#ifdef WAVEBANDS |
#ifdef WAVEBANDS |
448 |
#if defined(DAR_CALC_ACDOM) || defined(DAR_RADTRANS) |
#if defined(DAR_CALC_ACDOM) || defined(DAR_RADTRANS) |
449 |
|
#ifdef ALLOW_CDOM |
450 |
|
call MONOD_ACDOM(cdom_k, |
451 |
|
O acdom_k, |
452 |
|
I myThid) |
453 |
|
#else |
454 |
call MONOD_ACDOM(phychl_k,aphy_chl,aw, |
call MONOD_ACDOM(phychl_k,aphy_chl,aw, |
455 |
O acdom_k, |
O acdom_k, |
456 |
I myThid) |
I myThid) |
457 |
|
#endif |
458 |
#else |
#else |
459 |
DO k=1,Nr |
DO k=1,Nr |
460 |
DO ilam = 1,tlam |
DO ilam = 1,tlam |
634 |
I darwin_radtrans_kmax,darwin_radtrans_niter, |
I darwin_radtrans_kmax,darwin_radtrans_niter, |
635 |
O Edz,Esz,Euz,Eutop, |
O Edz,Esz,Euz,Eutop, |
636 |
O tirrq,tirrwq, |
O tirrq,tirrwq, |
637 |
|
O c1,c2, |
638 |
I myThid) |
I myThid) |
639 |
#else |
#else |
640 |
c dzlocal ????? |
c dzlocal ????? |
690 |
psil = max(Ptr(i,j,k,bi,bj,iPOSi ),0. _d 0) |
psil = max(Ptr(i,j,k,bi,bj,iPOSi ),0. _d 0) |
691 |
NH4l = max(Ptr(i,j,k,bi,bj,iNH4 ),0. _d 0) |
NH4l = max(Ptr(i,j,k,bi,bj,iNH4 ),0. _d 0) |
692 |
NO2l = max(Ptr(i,j,k,bi,bj,iNO2 ),0. _d 0) |
NO2l = max(Ptr(i,j,k,bi,bj,iNO2 ),0. _d 0) |
693 |
|
#ifdef ALLOW_CDOM |
694 |
|
cdoml = max(Ptr(i,j,k,bi,bj,iCDOM ),0. _d 0) |
695 |
|
#endif |
696 |
#ifdef ALLOW_CARBON |
#ifdef ALLOW_CARBON |
697 |
dicl = max(Ptr(i,j,k,bi,bj,iDIC ),0. _d 0) |
dicl = max(Ptr(i,j,k,bi,bj,iDIC ),0. _d 0) |
698 |
docl = max(Ptr(i,j,k,bi,bj,iDOC ),0. _d 0) |
docl = max(Ptr(i,j,k,bi,bj,iDOC ),0. _d 0) |
763 |
Diver4(i,j,k)=Diver4(i,j,k)+1. _d 0 |
Diver4(i,j,k)=Diver4(i,j,k)+1. _d 0 |
764 |
endif |
endif |
765 |
enddo |
enddo |
766 |
|
c totphy > thresh0 |
767 |
|
endif |
768 |
|
c Shannon and Simpson indices |
769 |
|
Shannon(i,j,k) = 0. _d 0 |
770 |
|
c note: minimal valid value is 1, but we set to zero below threshold |
771 |
|
Simpson(i,j,k) = 0. _d 0 |
772 |
|
if (totphy.gt.shannon_thresh) then |
773 |
|
do np=1,npmax |
774 |
|
if (Phy(np) .gt. 0. _d 0) then |
775 |
|
tmpphy(np) = Phy(np)/totphy |
776 |
|
Shannon(i,j,k)=Shannon(i,j,k)+tmpphy(np)*LOG(tmpphy(np)) |
777 |
|
Simpson(i,j,k)=Simpson(i,j,k)+tmpphy(np)*tmpphy(np) |
778 |
|
endif |
779 |
|
enddo |
780 |
|
Shannon(i,j,k) = -Shannon(i,j,k) |
781 |
|
Simpson(i,j,k) = 1./Simpson(i,j,k) |
782 |
endif |
endif |
783 |
#endif |
#endif |
784 |
|
|
815 |
Slocal = salt(i,j,k,bi,bj) |
Slocal = salt(i,j,k,bi,bj) |
816 |
#endif |
#endif |
817 |
|
|
818 |
|
c choice where to get pCO2 from |
819 |
|
c taking from igsm dic run - fed through Tflux array |
820 |
|
c pCO2local=surfaceForcingT(i,j,bi,bj) |
821 |
|
c or from darwin carbon module |
822 |
|
#ifdef ALLOW_CARBON |
823 |
|
pCO2local=pCO2(i,j,bi,bj) |
824 |
|
#else |
825 |
|
pCO2local=280. _d -6 |
826 |
|
#endif |
827 |
|
|
828 |
freefu = max(freefe(i,j,k),0. _d 0) |
freefu = max(freefe(i,j,k),0. _d 0) |
829 |
if (k.eq.1) then |
if (k.eq.1) then |
830 |
inputFel = inputFe(i,j,bi,bj) |
inputFel = inputFe(i,j,bi,bj) |
869 |
dphychl(np)=0. _d 0 |
dphychl(np)=0. _d 0 |
870 |
enddo |
enddo |
871 |
#endif |
#endif |
872 |
|
#ifdef ALLOW_CDOM |
873 |
|
dcdoml=0. _d 0 |
874 |
|
#endif |
875 |
#ifdef ALLOW_CARBON |
#ifdef ALLOW_CARBON |
876 |
ddicl=0. _d 0 |
ddicl=0. _d 0 |
877 |
ddocl=0. _d 0 |
ddocl=0. _d 0 |
941 |
I pofeupl, psiupl, |
I pofeupl, psiupl, |
942 |
I PARl, |
I PARl, |
943 |
I Tlocal, Slocal, |
I Tlocal, Slocal, |
944 |
|
I pCO2local, |
945 |
I freefu, inputFel, |
I freefu, inputFel, |
946 |
I bottom, dzlocal, |
I bottom, dzlocal, |
947 |
O Rstarl, RNstarl, |
O Rstarl, RNstarl, |
972 |
I dphychl, |
I dphychl, |
973 |
I chlup, |
I chlup, |
974 |
#endif |
#endif |
975 |
|
#ifdef ALLOW_CDOM |
976 |
|
O dcdoml, |
977 |
|
I cdoml, |
978 |
|
#endif |
979 |
#ifdef WAVEBANDS |
#ifdef WAVEBANDS |
980 |
I PARw_k(1,k), |
I PARw_k(1,k), |
981 |
#endif |
#endif |
1001 |
c |
c |
1002 |
#ifdef IRON_SED_SOURCE |
#ifdef IRON_SED_SOURCE |
1003 |
c only above minimum depth (continental shelf) |
c only above minimum depth (continental shelf) |
1004 |
if (rF(k).lt.depthfesed) then |
if (rF(k).gt.-depthfesed) then |
1005 |
c only if bottom layer |
c only if bottom layer |
1006 |
if (bottom.eq.1.0 _d 0) then |
if (bottom.eq.1.0 _d 0) then |
1007 |
#ifdef IRON_SED_SOURCE_VARIABLE |
#ifdef IRON_SED_SOURCE_VARIABLE |
1182 |
#endif |
#endif |
1183 |
#endif |
#endif |
1184 |
ENDDO |
ENDDO |
1185 |
|
#ifdef ALLOW_CDOM |
1186 |
|
Ptr(i,j,k,bi,bj,iCDOM ) = Ptr(i,j,k,bi,bj,iCDOM ) + |
1187 |
|
& dtplankton*dcdoml |
1188 |
|
#endif |
1189 |
#ifdef ALLOW_CARBON |
#ifdef ALLOW_CARBON |
1190 |
Ptr(i,j,k,bi,bj,iDIC ) = Ptr(i,j,k,bi,bj,iDIC ) + |
Ptr(i,j,k,bi,bj,iDIC ) = Ptr(i,j,k,bi,bj,iDIC ) + |
1191 |
& dtplankton*ddicl |
& dtplankton*ddicl |
1341 |
& Eutop(ilam,k)*dtplankton |
& Eutop(ilam,k)*dtplankton |
1342 |
enddo |
enddo |
1343 |
#endif |
#endif |
1344 |
|
#ifdef DAR_DIAG_IRR_AMPS |
1345 |
|
do ilam = 1,tlam |
1346 |
|
c1ave(i,j,k,bi,bj,ilam)=c1ave(i,j,k,bi,bj,ilam)+ |
1347 |
|
& c1(ilam,k)*dtplankton |
1348 |
|
c2ave(i,j,k,bi,bj,ilam)=c2ave(i,j,k,bi,bj,ilam)+ |
1349 |
|
& c2(ilam,k)*dtplankton |
1350 |
|
enddo |
1351 |
|
#endif |
1352 |
#ifdef DAR_DIAG_ABSORP |
#ifdef DAR_DIAG_ABSORP |
1353 |
do ilam = 1,tlam |
do ilam = 1,tlam |
1354 |
aave(i,j,k,bi,bj,ilam)=aave(i,j,k,bi,bj,ilam)+ |
aave(i,j,k,bi,bj,ilam)=aave(i,j,k,bi,bj,ilam)+ |
1373 |
& bbpart_k(k,ilam)*dtplankton |
& bbpart_k(k,ilam)*dtplankton |
1374 |
enddo |
enddo |
1375 |
#endif |
#endif |
1376 |
|
#ifdef DAR_RADTRANS |
1377 |
|
if (k.eq.1) then |
1378 |
|
rmudave(i,j,bi,bj)=rmudave(i,j,bi,bj)+ |
1379 |
|
& rmud*dtplankton |
1380 |
|
endif |
1381 |
|
#endif |
1382 |
#ifdef DAR_DIAG_RSTAR |
#ifdef DAR_DIAG_RSTAR |
1383 |
do np=1,npmax |
do np=1,npmax |
1384 |
Rstarave(i,j,k,bi,bj,np)=Rstarave(i,j,k,bi,bj,np)+ |
Rstarave(i,j,k,bi,bj,np)=Rstarave(i,j,k,bi,bj,np)+ |
1526 |
WRITE(diagname,'(A8)') 'Diver4 ' |
WRITE(diagname,'(A8)') 'Diver4 ' |
1527 |
CALL DIAGNOSTICS_FILL( Diver4(1-Olx,1-Oly,1), diagname, |
CALL DIAGNOSTICS_FILL( Diver4(1-Olx,1-Oly,1), diagname, |
1528 |
& 0,Nr,2,bi,bj,myThid ) |
& 0,Nr,2,bi,bj,myThid ) |
1529 |
|
WRITE(diagname,'(A8)') 'Shannon ' |
1530 |
|
CALL DIAGNOSTICS_FILL( Shannon(1-Olx,1-Oly,1), diagname, |
1531 |
|
& 0,Nr,2,bi,bj,myThid ) |
1532 |
|
WRITE(diagname,'(A8)') 'Simpson ' |
1533 |
|
CALL DIAGNOSTICS_FILL( Simpson(1-Olx,1-Oly,1), diagname, |
1534 |
|
& 0,Nr,2,bi,bj,myThid ) |
1535 |
#endif |
#endif |
1536 |
#ifdef ALLOW_DIAZ |
#ifdef ALLOW_DIAZ |
1537 |
#ifdef DAR_DIAG_NFIXP |
#ifdef DAR_DIAG_NFIXP |