/[MITgcm]/MITgcm_contrib/darwin2/pkg/monod/monod_cons.F
ViewVC logotype

Contents of /MITgcm_contrib/darwin2/pkg/monod/monod_cons.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.4 - (show annotations) (download)
Wed Dec 7 20:04:00 2011 UTC (13 years, 8 months ago) by jahn
Branch: MAIN
CVS Tags: ctrb_darwin2_ckpt63l_20120405, ctrb_darwin2_ckpt63o_20120629, ctrb_darwin2_ckpt63i_20120124, ctrb_darwin2_ckpt63m_20120506, ctrb_darwin2_ckpt63j_20120217, ctrb_darwin2_ckpt63g_20111220, ctrb_darwin2_ckpt63h_20111230, ctrb_darwin2_ckpt63p_20120707, ctrb_darwin2_ckpt63n_20120604, ctrb_darwin2_ckpt63k_20120317
Changes since 1.3: +1 -4 lines
fix some multi-threading bits

1 C $Header: /u/gcmpack/MITgcm_contrib/darwin2/pkg/monod/monod_cons.F,v 1.3 2011/09/22 16:01:30 jahn Exp $
2 C $Name: $
3
4 #include "CPP_OPTIONS.h"
5 #include "PTRACERS_OPTIONS.h"
6 #include "DARWIN_OPTIONS.h"
7
8 #ifdef ALLOW_PTRACERS
9 #ifdef ALLOW_MONOD
10
11 c=============================================================
12 c subroutine MONOD_cons
13 c check conservation in the model
14 C==============================================================
15 SUBROUTINE MONOD_CONS(
16 & myTime,myIter,myThid)
17 #include "SIZE.h"
18 #include "EEPARAMS.h"
19 #include "PARAMS.h"
20 #include "GRID.h"
21 #include "PTRACERS_SIZE.h"
22 #include "PTRACERS_PARAMS.h"
23 #include "PTRACERS_FIELDS.h"
24 #include "GCHEM.h"
25 #include "MONOD_SIZE.h"
26 #include "MONOD.h"
27 #include "DARWIN_IO.h"
28 #include "DYNVARS.h"
29
30 C === Global variables ===
31 INTEGER myIter
32 _RL myTime
33 INTEGER myThid
34
35 #ifdef CHECK_CONS
36 C============== Local variables ============================================
37 _RL tmptotP
38 _RL tmptotN
39 _RL tmptotSi
40 _RL tmptotFe
41 #ifdef ALLOW_CARBON
42 _RL tmptotC
43 _RL tmptotA
44 _RL tmptotO
45 #endif
46 _RL vol, voltot
47
48 INTEGER i,j,k,bi,bj
49 INTEGER np, nz, npnum
50
51
52 c
53 tmptotP=0. _d 0
54 tmptotN=0. _d 0
55 tmptotFe=0. _d 0
56 tmptotSi=0. _d 0
57 #ifdef ALLOW_CARBON
58 tmptotC=0. _d 0
59 tmptotA=0. _d 0
60 tmptotO=0. _d 0
61 #endif
62 voltot=0. _d 0
63
64 DO bj=myByLo(myThid),myByHi(myThid)
65 DO bi=myBxLo(myThid),myBxHi(myThid)
66
67 DO i=1,sNx
68 DO j=1,sNy
69 do k= 1, NR
70 c-----------------------------------------------------------------
71 vol=rA(i,j,bi,bj)*drF(k)
72 voltot=voltot+vol
73 c Phosphorus budget
74 tmptotP=tmptotP+Ptracer(i,j,k,bi,bj,iPO4)*vol !PO4
75 tmptotP=tmptotP+Ptracer(i,j,k,bi,bj,iDOP)*vol !DOP
76 tmptotP=tmptotP+Ptracer(i,j,k,bi,bj,iPOP)*vol !POP
77 do nz=1,nzmax
78 tmptotP=tmptotP+Ptracer(i,j,k,bi,bj,iZooP(nz))*vol !ZOO1P
79 enddo
80 do np=1,npmax
81 npnum=iPhy+np-1
82 tmptotP=tmptotP+Ptracer(i,j,k,bi,bj,npnum)*vol !Phy
83 enddo
84 c Nitrogen budget
85 tmptotN=tmptotN+Ptracer(i,j,k,bi,bj,iNO3)*vol !NO3
86 tmptotN=tmptotN+Ptracer(i,j,k,bi,bj,iNH4)*vol !NH4
87 tmptotN=tmptotN+Ptracer(i,j,k,bi,bj,iNO2)*vol !NO2
88 tmptotN=tmptotN+Ptracer(i,j,k,bi,bj,iDON)*vol !DON
89 tmptotN=tmptotN+Ptracer(i,j,k,bi,bj,iPON)*vol !PON
90 do nz=1,nzmax
91 tmptotN=tmptotN+Ptracer(i,j,k,bi,bj,iZooN(nz))*vol !ZOO1N
92 enddo
93 do np=1,npmax
94 npnum=iPhy+np-1
95 tmptotN=tmptotN+Ptracer(i,j,k,bi,bj,npnum)*R_NP(np)*vol !Phy
96 enddo
97 c Iron budget
98 tmptotFe=tmptotFe+Ptracer(i,j,k,bi,bj,iFeT)*vol !Fet
99 tmptotFe=tmptotFe+Ptracer(i,j,k,bi,bj,iDOFe)*vol !DOFe
100 tmptotFe=tmptotFe+Ptracer(i,j,k,bi,bj,iPOFe)*vol !POFe
101 do nz=1,nzmax
102 tmptotFe=tmptotFe+Ptracer(i,j,k,bi,bj,iZooFe(nz))*vol !ZOO1Fe
103 enddo
104 do np=1,npmax
105 npnum=iPhy+np-1
106 tmptotFe=tmptotFe+Ptracer(i,j,k,bi,bj,npnum)*R_FeP(np)*vol !Phy
107 enddo
108 c Silica budget
109 tmptotSi=tmptotSi+Ptracer(i,j,k,bi,bj,iSi)*vol !Si
110 tmptotSi=tmptotSi+Ptracer(i,j,k,bi,bj,iPOSi)*vol !POSi
111 do nz=1,nzmax
112 tmptotSi=tmptotSi+Ptracer(i,j,k,bi,bj,iZooSi(nz))*vol !ZOO1Si
113 enddo
114 do np=1,npmax
115 npnum=iPhy+np-1
116 tmptotSi=tmptotSi+Ptracer(i,j,k,bi,bj,npnum)*R_SiP(np)*vol !Phy
117 enddo
118 c------------------------------------------------------------
119 #ifdef ALLOW_CARBON
120 c carbon budget
121 tmptotC=tmptotC+Ptracer(i,j,k,bi,bj,iDIC)*vol !DIC
122 tmptotC=tmptotC+Ptracer(i,j,k,bi,bj,iDOC)*vol !DOC
123 tmptotC=tmptotC+Ptracer(i,j,k,bi,bj,iPOC)*vol !POC
124 tmptotC=tmptotC+Ptracer(i,j,k,bi,bj,iPIC)*vol !PIC
125 do nz=1,nzmax
126 tmptotC=tmptotC+Ptracer(i,j,k,bi,bj,iZooC(nz))*vol !ZOOC
127 enddo
128 do np=1,npmax
129 npnum=iPhy+np-1
130 tmptotC=tmptotC+Ptracer(i,j,k,bi,bj,npnum)*R_PC(np)*vol !Phy
131 enddo
132 c alkalinity budget !!!!! NOT FULL BUDGET!!!!!
133 tmptotA=tmptotA+Ptracer(i,j,k,bi,bj,iALK)*vol !ALK
134 c oxygem budget !!!!!!!! NOT FULL BUDGET !!!!!!!!!!!
135 tmptotO=tmptotO+Ptracer(i,j,k,bi,bj,iO2)*vol !O2
136 #endif
137 enddo
138 ENDDO
139 ENDDO
140 ENDDO
141 ENDDO
142
143 _GLOBAL_SUM_RL(tmptotP,myThid)
144 _GLOBAL_SUM_RL(tmptotN,myThid)
145 _GLOBAL_SUM_RL(tmptotFe,myThid)
146 _GLOBAL_SUM_RL(tmptotSi,myThid)
147 _GLOBAL_SUM_RL(voltot,myThid)
148 #ifdef ALLOW_CARBON
149 _GLOBAL_SUM_RL(tmptotC,myThid)
150 _GLOBAL_SUM_RL(tmptotA,myThid)
151 _GLOBAL_SUM_RL(tmptotO,myThid)
152 #endif
153
154
155 c print*,'tmptotP',tmptotP
156 c print*,'tmptotN',tmptotN
157 c print*,'tmptotFe',tmptotFe
158 c print*,'tmptotSi',tmptotSi
159 #ifdef ALLOW_CARBON
160 c print*,'tmptotC',tmptotC
161 c print*,'tmptotA',tmptotA
162 c print*,'tmptotO',tmptotO
163 #endif
164
165 IF ( myProcId.EQ.0 .AND. myThid.EQ.1 ) THEN
166 write(DAR_cons_unit1,*), myIter, tmptotP, tmptotP/voltot
167 write(DAR_cons_unit2,*), myIter, tmptotN, tmptotN/voltot
168 write(DAR_cons_unit3,*), myIter, tmptotFe, tmptotFe/voltot
169 write(DAR_cons_unit4,*), myIter, tmptotSi, tmptotSi/voltot
170 #ifdef ALLOW_CARBON
171 write(DAR_cons_unit5,*), myIter, tmptotC, tmptotC/voltot
172 write(DAR_cons_unit6,*), myIter, tmptotA, tmptotA/voltot
173 write(DAR_cons_unit7,*), myIter, tmptotO, tmptotO/voltot
174 #endif
175 ENDIF
176
177 C-- Everyone else must wait
178 _BARRIER
179 #endif
180 c
181 c -----------------------------------------------------
182 RETURN
183 END
184 #endif /*MONOD*/
185 #endif /*ALLOW_PTRACERS*/
186
187 C============================================================================

  ViewVC Help
Powered by ViewVC 1.1.22