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

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

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


Revision 1.2 - (show annotations) (download)
Mon May 2 17:55:00 2011 UTC (14 years, 3 months ago) by stephd
Branch: MAIN
CVS Tags: ctrb_darwin2_ckpt62y_20110526, ctrb_darwin2_ckpt62x_20110513, ctrb_darwin2_ckpt63b_20110830, ctrb_darwin2_ckpt63a_20110804, ctrb_darwin2_ckpt63_20110728, ctrb_darwin2_ckpt62z_20110622
Changes since 1.1: +13 -2 lines
o fix, so DYNCHL can work without WAVEBAND

1 C $Header: /u/gcmpack/MITgcm_contrib/darwin2/pkg/monod/monod_init_vari.F,v 1.1 2011/04/13 18:56:25 jahn Exp $
2 C $Name: $
3
4 #include "CPP_OPTIONS.h"
5 #include "DARWIN_OPTIONS.h"
6
7 #ifdef ALLOW_PTRACERS
8 #ifdef ALLOW_MONOD
9
10 c ==========================================================
11 c SUBROUTINE MONOD_INIT_VARI()
12 c initialize stuff for generalized plankton model
13 c adapted from NPZD2Fe - Mick Follows, Fall 2005
14 c modified - Stephanie Dutkiewicz, Spring 2006
15 c ==========================================================
16 c
17 SUBROUTINE MONOD_INIT_VARI(myThid)
18
19 IMPLICIT NONE
20
21 #include "SIZE.h"
22 #include "GRID.h"
23 #include "DYNVARS.h"
24 #include "EEPARAMS.h"
25 #include "PARAMS.h"
26 #include "MONOD_SIZE.h"
27 #include "MONOD.h"
28 #include "DARWIN_IO.h"
29
30 c ANNA define params for WAVEBANDS
31 #ifdef WAVEBANDS
32 #include "SPECTRAL_SIZE.h"
33 #include "SPECTRAL.h"
34 #include "WAVEBANDS_PARAMS.h"
35 #endif
36
37 #ifdef ALLOW_DIAZ
38 #include "PTRACERS_SIZE.h"
39 #include "PTRACERS_PARAMS.h"
40 #include "PTRACERS_FIELDS.h"
41 #endif
42
43
44 C !INPUT PARAMETERS: ===================================================
45 C myThid :: thread number
46 INTEGER myThid
47
48 C === Functions ===
49 _RL DARWIN_RANDOM
50 EXTERNAL DARWIN_RANDOM
51
52 C !LOCAL VARIABLES:
53 C === Local variables ===
54 C msgBuf - Informational/error meesage buffer
55 CHARACTER*(MAX_LEN_MBUF) msgBuf
56 INTEGER IniUnit1, IniUnit2
57
58 INTEGER bi, bj, k, i, j, iPAR
59
60 INTEGER np
61 INTEGER nz
62 c ANNA need nl for wavebands
63 #ifdef WAVEBANDS
64 integer ilam
65 integer nl
66 _RL cu_area
67 #endif
68
69 CEOP
70
71 WRITE(msgBuf,'(A)')
72 & '// ======================================================='
73 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
74 & SQUEEZE_RIGHT, myThid )
75 WRITE(msgBuf,'(A)') '// Darwin init variables >>> START <<<'
76 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
77 & SQUEEZE_RIGHT, myThid )
78 WRITE(msgBuf,'(A)')
79 & '// ======================================================='
80 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
81 & SQUEEZE_RIGHT, myThid )
82
83 c test....................
84 c write(6,*)'testing in npzd2fe_init_vari '
85 c test....................
86
87
88 c set up ecosystem coefficients
89 c
90 c seed randomization
91 CALL DARWIN_RANDOM_INIT(darwin_seed, myThid)
92
93 c initialize total number of functional groups tried
94 ngroups = 0
95 do np = 1, npmax
96 #ifdef ALLOW_MUTANTS
97 call MONOD_GENERATE_MUTANTS(MyThid, np)
98 #else
99 call MONOD_GENERATE_PHYTO(MyThid, np)
100 #endif
101 end do
102
103 c reduce amount of diaz
104 #ifdef ALLOW_DIAZ
105 do np = 1, npmax
106 if (diazotroph(np) .eq. 1. _d 0) then
107 DO bj = myByLo(myThid), myByHi(myThid)
108 DO bi = myBxLo(myThid), myBxHi(myThid)
109 DO j=1-Oly,sNy+Oly
110 DO i=1-Olx,sNx+Olx
111 DO k=1,nR
112 Ptracer(i,j,k,bi,bj,iPhy+np-1) =
113 & Ptracer(i,j,k,bi,bj,iPhy+np-1)/10. _d 0
114 ENDDO
115 ENDDO
116 ENDDO
117 ENDDO
118 ENDDO
119 endif
120 enddo
121 #endif
122
123 c initialize zooplankton
124 call MONOD_GENERATE_ZOO(MyThid)
125
126 c %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
127
128 c ANNA call WAVEBANDS_INIT_VARI to assign variable parameters
129 #ifdef WAVEBANDS
130 call WAVEBANDS_INIT_VARI(MyThid)
131 #endif
132
133 c ANNA get alphachl from mQyield / aphy_chl
134 c ANNA must do this after params are assigned, but before written out
135 c ANNA use aphy_chl_ps for growth. To turn off, simply set same coefs as aphy_chl in input files.
136 #ifdef GEIDER
137 #ifndef WAVEBANDS
138 do np = 1,npmax
139 alphachl(np) = mQyield(np) * aphy_chl_ave
140 c C:CHl minimum: chosen to be Chl:C at high light (2000uEin/m2/s) and
141 c no temp/nutrient limitation
142 c chl2cmin(np)=chl2cmax(np)/
143 c & (1+(chl2cmax(np)*alphachl(np)*2000. _d 0)/
144 c & (2*pcmax(np)))
145 chl2cmin(np)=0. _d 0
146 enddo
147 #else
148 do np = 1,npmax
149 do nl = 1,tlam
150 alphachl_nl(np,nl) = mQyield(np) * aphy_chl_ps(np,nl)
151 end do
152 c find mean
153 cu_area = 0.d0
154 do nl = 1,tlam
155 cu_area = cu_area + wb_width(nl)*alphachl_nl(np,nl)
156 end do
157 alpha_mean(np) = cu_area / wb_totalWidth
158
159 chl2cmin(np)=chl2cmax(np)/
160 & (1+(chl2cmax(np)* alpha_mean(np) *2000. _d 0)/
161 & (2*pcmax(np)))
162 end do
163 #endif
164 #ifdef DYNAMIC_CHL
165 c check Chl fields are reasonable
166 #ifndef WAVEBANDS
167 do np = 1,npmax
168 c C:CHl minimum: chosen to be Chl:C at high light (2000uEin/m2/s) and
169 c no temp/nutrient limitation
170 chl2cmin(np)=chl2cmax(np)/
171 & (1+(chl2cmax(np)*alphachl(np)*2000. _d 0)/
172 & (2*pcmax(np)))
173 chl2cmin(np)=0. _d 0
174 enddo
175 #else
176 do np=1,npmax
177 chl2cmin(np)=chl2cmax(np)/
178 & (1+(chl2cmax(np)* alpha_mean(np) *2000. _d 0)/
179 & (2*pcmax(np)))
180 enddo
181 #endif
182 call MONOD_CHECK_CHL(myThid)
183 #endif
184 #endif
185 c ANNA endif
186
187 _BEGIN_MASTER(myThid)
188 c write out initial phyto characteristics
189 #ifndef GEIDER
190 CALL MDSFINDUNIT( IniUnit1, mythid )
191 open(IniUnit1,file='plankton-ini-char.dat',status='unknown')
192 CALL MDSFINDUNIT( IniUnit2, mythid )
193 open(IniUnit2,file='plankton_ini_char_nohead.dat',
194 & status='unknown')
195 #ifdef OLD_GRAZE
196 write(IniUnit1,*)'dico diaz size mu mort Rnp Rfep Rsip
197 & wsink KsP KsN KsFe KsSi g1 g2 Kpar Kinh
198 & Topt nsrc np'
199 do np = 1, npmax
200 write(IniUnit1,110)diacoc(np),diazotroph(np),physize(np),
201 & 1.0/(mu(np)*86400.), 1.0/(mortphy(np)*86400.),
202 & R_NP(np),R_FeP(np)*1000.,R_SiP(np),
203 & wsink(np),
204 & KsatPO4(np),KsatNO3(np),KsatFeT(np)*1000.
205 & ,KsatSi(np),
206 & graze(np,1),graze(np,2),
207 & KsatPAR(np),Kinhib(np),
208 & phytoTempOptimum(np),nsource(np),np
209 write(IniUnit2,110)diacoc(np),diazotroph(np),physize(np),
210 & 1.0/(mu(np)*86400.),1.0/(mortphy(np)*86400.),
211 & R_NP(np),R_FeP(np)*1000.,R_SiP(np),
212 & wsink(np),
213 & KsatPO4(np),KsatNO3(np),KsatFeT(np)*1000.
214 & ,KsatSi(np),
215 & graze(np,1),graze(np,2),
216 & KsatPAR(np),Kinhib(np),
217 & phytoTempOptimum(np),nsource(np),np
218 end do
219 #else
220 write(IniUnit1,*)'dico diaz size mu mort Rnp Rfep Rsip wsink
221 & KsP KsN KsFe KsSi palat1 palat2 Kpar Kinh Topt nsrc
222 & np'
223 do np = 1, npmax
224 write(IniUnit1,111)diacoc(np),diazotroph(np),physize(np),
225 & 1.0/(mu(np)*86400.), 1.0/(mortphy(np)*86400.),
226 & R_NP(np),R_FeP(np)*1000.,R_SiP(np),
227 & wsink(np),
228 & KsatPO4(np),KsatNO3(np),KsatFeT(np)*1000.
229 & ,KsatSi(np),
230 & palat(np,1),palat(np,2),
231 & KsatPAR(np),Kinhib(np),
232 & phytoTempOptimum(np),nsource(np),np
233 write(IniUnit2,111)diacoc(np),diazotroph(np),physize(np),
234 & 1.0/(mu(np)*86400.),1.0/(mortphy(np)*86400.),
235 & R_NP(np),R_FeP(np)*1000.,R_SiP(np),
236 & wsink(np),
237 & KsatPO4(np),KsatNO3(np),KsatFeT(np)*1000.
238 & ,KsatSi(np),
239 & palat(np,1),palat(np,2),
240 & KsatPAR(np),Kinhib(np),
241 & phytoTempOptimum(np),nsource(np),np
242 end do
243 #endif
244 #endif
245
246 #ifdef GEIDER
247 c ANNA outputs mQyield as 10^(4) mmol C (uEin)-1
248 CALL MDSFINDUNIT( IniUnit1, mythid )
249 open(IniUnit1,file='gplankton-ini-char.dat',status='unknown')
250 CALL MDSFINDUNIT( IniUnit2, mythid )
251 open(IniUnit2,file='gplankton_ini_char_nohead.dat',
252 & status='unknown')
253 write(IniUnit1,*)'dico diaz size pcmax mort Rnp Rfep Rsip wsink
254 & KsP KsN KsFe KsSi palat1 palat2 mQY(-4) chl2c Topt nsrc
255 & np'
256 do np = 1, npmax
257 write(IniUnit1,111)diacoc(np),diazotroph(np),physize(np),
258 & 1.0/(pcmax(np)*86400.), 1.0/(mortphy(np)*86400.),
259 & R_NP(np),R_FeP(np)*1000.,R_SiP(np),
260 & wsink(np),
261 & KsatPO4(np),KsatNO3(np),KsatFeT(np)*1000.
262 & ,KsatSi(np),
263 & palat(np,1),palat(np,2),
264 & mQyield(np)*1e4,chl2cmax(np),
265 & phytoTempOptimum(np),nsource(np),np
266 write(IniUnit2,111)diacoc(np),diazotroph(np),physize(np),
267 & 1.0/(pcmax(np)*86400.), 1.0/(mortphy(np)*86400.),
268 & R_NP(np),R_FeP(np)*1000.,R_SiP(np),
269 & wsink(np),
270 & KsatPO4(np),KsatNO3(np),KsatFeT(np)*1000.
271 & ,KsatSi(np),
272 & palat(np,1),palat(np,2),
273 & mQyield(np)*1e4,chl2cmax(np),
274 & phytoTempOptimum(np),nsource(np),np
275 end do
276 #endif
277
278 close(IniUnit2)
279 close(IniUnit1)
280 110 format(3f4.0,f6.2,4f4.0,f5.1,4f7.3,2e11.2,2f9.4,f6.1,2i5)
281 111 format(3f4.0,f6.2,4f4.0,f5.1,4f7.3,2f6.1,2f9.4,f6.1,2i5)
282
283 CALL LEF_ZERO( fice,myThid )
284 CALL LEF_ZERO( inputFe,myThid )
285 CALL LEF_ZERO( sur_par,myThid )
286 #ifdef NUT_SUPPLY
287 DO bj = myByLo(myThid), myByHi(myThid)
288 DO bi = myBxLo(myThid), myBxHi(myThid)
289 DO j=1-Oly,sNy+Oly
290 DO i=1-Olx,sNx+Olx
291 DO k=1,nR
292 nut_wvel(i,j,k,bi,bj) = 0. _d 0
293 ENDDO
294 ENDDO
295 ENDDO
296 ENDDO
297 ENDDO
298 #endif
299
300 #ifdef ALLOW_PAR_DAY
301 DO iPAR=1,2
302 DO bj=myByLo(myThid), myByHi(myThid)
303 DO bi=myBxLo(myThid), myBxHi(myThid)
304 DO k=1,nR
305 DO j=1-Oly,sNy+Oly
306 DO i=1-Olx,sNx+Olx
307 PARday(i,j,k,bi,bj,iPAR) = 0. _d 0
308 ENDDO
309 ENDDO
310 ENDDO
311 ENDDO
312 ENDDO
313 ENDDO
314 IF ( .NOT. ( startTime .EQ. baseTime .AND. nIter0 .EQ. 0
315 & .AND. pickupSuff .EQ. ' ') ) THEN
316 COJ should probably initialize from a file when nIter0 .EQ. 0
317 CALL DARWIN_READ_PICKUP( nIter0, myThid )
318 ENDIF
319 #endif
320 c
321 #ifdef ALLOW_TIMEAVE
322 c set arrays to zero if first timestep
323 DO bj = myByLo(myThid), myByHi(myThid)
324 DO bi = myBxLo(myThid), myBxHi(myThid)
325 CALL TIMEAVE_RESET(PARave, Nr, bi, bj, myThid)
326 CALL TIMEAVE_RESET(PPave, Nr, bi, bj, myThid)
327 CALL TIMEAVE_RESET(Chlave, Nr, bi, bj, myThid)
328 CALL TIMEAVE_RESET(Nfixave, Nr, bi, bj, myThid)
329 CALL TIMEAVE_RESET(Denitave, Nr, bi, bj, myThid)
330 #ifdef DAR_DIAG_ACDOM
331 CALL TIMEAVE_RESET(aCDOMave, Nr, bi, bj, myThid)
332 #endif
333 #ifdef DAR_DIAG_IRR
334 do i=1,tlam
335 CALL TIMEAVE_RESET(Edave(1-OLx,1-OLy,1,1,1,i),
336 & Nr,bi,bj,myThid)
337 CALL TIMEAVE_RESET(Esave(1-OLx,1-OLy,1,1,1,i),
338 & Nr,bi,bj,myThid)
339 CALL TIMEAVE_RESET(Euave(1-OLx,1-OLy,1,1,1,i),
340 & Nr,bi,bj,myThid)
341 CALL TIMEAVE_RESET(Eutave(1-OLx,1-OLy,1,1,1,i),
342 & Nr,bi,bj,myThid)
343 enddo
344 #endif
345 #ifdef DAR_DIAG_ABSORP
346 do i=1,tlam
347 CALL TIMEAVE_RESET(aave(1-OLx,1-OLy,1,1,1,i),
348 & Nr,bi,bj,myThid)
349 enddo
350 #endif
351 #ifdef DAR_DIAG_SCATTER
352 do i=1,tlam
353 CALL TIMEAVE_RESET(btave(1-OLx,1-OLy,1,1,1,i),
354 & Nr,bi,bj,myThid)
355 CALL TIMEAVE_RESET(bbave(1-OLx,1-OLy,1,1,1,i),
356 & Nr,bi,bj,myThid)
357 enddo
358 #endif
359 #ifdef DAR_DIAG_PART_SCATTER
360 do i=1,tlam
361 CALL TIMEAVE_RESET(apartave(1-OLx,1-OLy,1,1,1,i),
362 & Nr,bi,bj,myThid)
363 CALL TIMEAVE_RESET(btpartave(1-OLx,1-OLy,1,1,1,i),
364 & Nr,bi,bj,myThid)
365 CALL TIMEAVE_RESET(bbpartave(1-OLx,1-OLy,1,1,1,i),
366 & Nr,bi,bj,myThid)
367 enddo
368 #endif
369 c ANNA_TAVE
370 #ifdef WAVES_DIAG_PCHL
371 do np=1,npmax
372 CALL TIMEAVE_RESET(Pchlave(1-OLx,1-OLy,1,1,1,np),
373 & Nr,bi,bj,myThid)
374 enddo
375 #endif
376 c ANNA end TAVE
377 #ifdef DAR_DIAG_RSTAR
378 do np=1,npmax
379 CALL TIMEAVE_RESET(Rstarave(1-OLx,1-OLy,1,1,1,np),
380 & Nr,bi,bj,myThid)
381 CALL TIMEAVE_RESET(RNstarave(1-OLx,1-OLy,1,1,1,np),
382 & Nr,bi,bj,myThid)
383 enddo
384 #endif
385 #ifdef DAR_DIAG_DIVER
386 CALL TIMEAVE_RESET(Diver1ave, Nr, bi, bj, myThid)
387 CALL TIMEAVE_RESET(Diver2ave, Nr, bi, bj, myThid)
388 CALL TIMEAVE_RESET(Diver3ave, Nr, bi, bj, myThid)
389 CALL TIMEAVE_RESET(Diver4ave, Nr, bi, bj, myThid)
390 #endif
391 #ifdef ALLOW_DIAZ
392 #ifdef DAR_DIAG_NFIXP
393 do np=1,npmax
394 CALL TIMEAVE_RESET(NfixPave(1-OLx,1-OLy,1,1,1,np),
395 & Nr,bi,bj,myThid)
396 enddo
397 #endif
398 #endif
399 c CALL TIMEAVE_RESET(SURave, 1, bi, bj, myThid)
400 WRITE(msgbuf,'(A)')
401 & 'QQ start timeave'
402 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
403 & SQUEEZE_RIGHT , mythid)
404
405 do k=1,Nr
406 DAR_TimeAve(bi,bj,k)=0. _d 0
407 enddo
408 ENDDO
409 ENDDO
410 #endif /* ALLOW_TIMEAVE */
411
412 #ifdef CHECK_CONS
413 coj find unused units for darwin_cons output
414 CALL MDSFINDUNIT( DAR_cons_unit1, mythid )
415 open(DAR_cons_unit1,file='darwin_cons_P.txt',status='unknown')
416 CALL MDSFINDUNIT( DAR_cons_unit2, mythid )
417 open(DAR_cons_unit2,file='darwin_cons_N.txt',status='unknown')
418 CALL MDSFINDUNIT( DAR_cons_unit3, mythid )
419 open(DAR_cons_unit3,file='darwin_cons_Fe.txt',status='unknown')
420 CALL MDSFINDUNIT( DAR_cons_unit4, mythid )
421 open(DAR_cons_unit4,file='darwin_cons_Si.txt',status='unknown')
422 #ifdef ALLOW_CARBON
423 CALL MDSFINDUNIT( DAR_cons_unit5, mythid )
424 open(DAR_cons_unit5,file='darwin_cons_C.txt',status='unknown')
425 CALL MDSFINDUNIT( DAR_cons_unit6, mythid )
426 open(DAR_cons_unit6,file='darwin_cons_A.txt',status='unknown')
427 CALL MDSFINDUNIT( DAR_cons_unit7, mythid )
428 open(DAR_cons_unit7,file='darwin_cons_O.txt',status='unknown')
429 #endif
430 #endif
431 _END_MASTER(myThid)
432
433 c test....................
434 c write(6,*)'finishing darwin_init_vari '
435 c test....................
436 WRITE(msgBuf,'(A)')
437 & '// ======================================================='
438 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
439 & SQUEEZE_RIGHT, myThid )
440 WRITE(msgBuf,'(A)') '// Darwin init variables >>> END <<<'
441 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
442 & SQUEEZE_RIGHT, myThid )
443 WRITE(msgBuf,'(A)')
444 & '// ======================================================='
445 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
446 & SQUEEZE_RIGHT, myThid )
447
448
449 RETURN
450 END
451 #endif /*MONOD*/
452 #endif /*ALLOW_PTRACERS*/
453 c ==========================================================
454

  ViewVC Help
Powered by ViewVC 1.1.22