-
Notifications
You must be signed in to change notification settings - Fork 1
/
darwin_readparams.F
413 lines (375 loc) · 13.7 KB
/
darwin_readparams.F
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
C $Header: /u/gcmpack/MITgcm_contrib/darwin2/pkg/darwin/darwin_readparams.F,v 1.3 2011/09/22 19:23:31 jahn Exp $
C $Name: $
#include "DARWIN_OPTIONS.h"
CBOP
C !ROUTINE: DARWIN_READPARMS
C !INTERFACE: ==========================================================
SUBROUTINE DARWIN_READPARMS( myThid )
C !DESCRIPTION:
C Initialize DARWIN parameters, read in data.darwin
C !USES: ===============================================================
IMPLICIT NONE
#include "SIZE.h"
#include "EEPARAMS.h"
#include "PARAMS.h"
#include "GCHEM.h"
#include "DARWIN_SIZE.h"
#include "DARWIN_IO.h"
#include "DARWIN_PARAMS.h"
#ifdef WAVEBANDS
#include "SPECTRAL_SIZE.h"
#include "SPECTRAL.h"
#include "WAVEBANDS_PARAMS.h"
#endif
C !INPUT PARAMETERS: ===================================================
C myThid :: thread number
INTEGER myThid
C !OUTPUT PARAMETERS: ==================================================
C none
#ifdef ALLOW_DARWIN
C !LOCAL VARIABLES: ====================================================
C iUnit :: unit number for I/O
C msgBuf :: message buffer
INTEGER iUnit,errIO
CHARACTER*(MAX_LEN_MBUF) msgBuf
#if defined(WAVEBANDS) || defined(OASIM)
INTEGER ilam,i
_RL planck, c, hc, oavo, hcoavo, rlamm
#endif
CEOP
NAMELIST /DARWIN_FORCING/
& darwin_iceFile,
& darwin_ironFile,
& darwin_PARFile,
& darwin_nutWVelFile,
& darwin_PO4_relaxFile, darwin_NO3_relaxFile,
& darwin_FeT_relaxFile, darwin_Si_relaxFile,
& darwin_PO4_fluxFile, darwin_NO3_fluxFile,
& darwin_FeT_fluxFile, darwin_Si_fluxFile,
& darwin_waterabsorbFile, darwin_phytoabsorbFile,
& darwin_surfacespecFile, darwin_acdomFile,
& darwin_particleabsorbFile,
#ifdef OASIM
& darwin_oasim_edFile, darwin_oasim_esFile,
#endif
& darwin_relaxscale,
& darwin_ForcingPeriod, darwin_ForcingCycle,
& darwin_PARunits, darwin_W_to_uEins,
& darwin_ironUnits,
& darwin_dustFrac,
#ifdef ALLOW_PAR_DAY
& darwin_PARavPeriod,
#endif
& darwin_seed
#if defined(WAVEBANDS) || defined(OASIM)
NAMELIST /DARWIN_SPECTRAL_PARM/
& darwin_waves
#ifdef WAVEBANDS
#ifdef DAR_CALC_ACDOM
& ,darwin_Sdom
#endif
#ifdef DAR_DIAG_ACDOM
& ,darwin_diag_acdom_ilam
#endif
#ifdef DAR_RADTRANS
& ,darwin_PAR_ilamLo
& ,darwin_PAR_ilamHi
& ,darwin_radmodThresh
& ,darwin_Dmax
& ,darwin_rmus
& ,darwin_rmuu
& ,darwin_bbw
& ,darwin_bbphy
& ,darwin_bbmin
& ,darwin_radtrans_kmax
& ,darwin_radtrans_niter
& ,darwin_part_size_P
#endif
#endif /* WAVEBANDS */
#endif /* WAVEBANDS || OASIM */
#ifdef DAR_DIAG_CHL
NAMELIST /DARWIN_CHL/
& Geider_Bigalphachl, Geider_smallalphachl,
& Geider_Bigchl2cmax, Geider_smallchl2cmax,
& Geider_Bigchl2cmin,
& Doney_Bmin, Doney_Bmax, Doney_PARstar,
& Cloern_A, Cloern_B, Cloern_C, Cloern_chl2cmin
#endif
#ifdef ALLOW_CARBON
NAMELIST /DIC_FORCING/
& DIC_windFile, DIC_atmospFile,
& dic_pCO2, dic_int1, dic_int2, dic_int3, dic_int4
#endif
C Set defaults values for parameters in DARWIN_IO.h
darwin_iceFile=' '
darwin_ironFile=' '
darwin_PARFile=' '
darwin_nutWVelFile=' '
darwin_PO4_relaxFile=' '
darwin_NO3_relaxFile=' '
darwin_FeT_relaxFile=' '
darwin_Si_relaxFile=' '
darwin_PO4_fluxFile=' '
darwin_NO3_fluxFile=' '
darwin_FeT_fluxFile=' '
darwin_Si_fluxFile=' '
darwin_waterabsorbFile=' '
darwin_phytoabsorbFile=' '
darwin_particleabsorbFile=' '
darwin_surfacespecFile=' '
darwin_acdomFile=' '
darwin_oasim_edFile=' '
darwin_oasim_esFile=' '
darwin_PARunits='Ein/m2/d '
darwin_W_to_uEins=1. _d 0/0.2174 _d 0
darwin_ironUnits='mol Fe/m2/s '
darwin_dustFrac=0.035 _d 0
darwin_relaxscale=0. _d 0
darwin_seed=0
c default periodic forcing to same as for GCHEM
darwin_forcingPeriod=gchem_ForcingPeriod
darwin_forcingCycle=gchem_ForcingCycle
#ifdef ALLOW_CARBON
DIC_windFile = ' '
DIC_atmospFile= ' '
dic_int1 = 0
dic_int2 = 0
dic_int3 = 0
dic_int4 = 0
dic_pCO2 = 0. _d 0
#endif
#ifdef ALLOW_PAR_DAY
darwin_PARavPeriod=86400. _d 0
#endif
#if defined(WAVEBANDS) || defined(OASIM)
DO ilam=1,tlam
darwin_waves(ilam) = 0
ENDDO
IF (tlam.EQ.13) THEN
darwin_waves(1) = 400
darwin_waves(2) = 425
darwin_waves(3) = 450
darwin_waves(4) = 475
darwin_waves(5) = 500
darwin_waves(6) = 525
darwin_waves(7) = 550
darwin_waves(8) = 575
darwin_waves(9) = 600
darwin_waves(10) = 625
darwin_waves(11) = 650
darwin_waves(12) = 675
darwin_waves(13) = 700
ENDIF
#endif
#ifdef WAVEBANDS
#ifdef DAR_CALC_ACDOM
darwin_Sdom = 0.014 _d 0
#endif
#ifdef DAR_DIAG_ACDOM
c value >= 100 will be converted to index in wavebands_init_fixed
darwin_diag_acdom_ilam = 450
#endif
#ifdef DAR_RADTRANS
darwin_PAR_ilamLo = 1
darwin_PAR_ilamHi = tlam
darwin_radmodThresh = 1 _d -4
darwin_Dmax = 500 _d 0
darwin_rmus = 1.0/0.83 _d 0
darwin_rmuu = 1.0/0.4 _d 0
darwin_bbmin = 0.0002 _d 0
darwin_bbw = 0.5 _d 0
do i=1,tnabp
darwin_bbphy(i) = 0 _d 0
enddo
darwin_radtrans_kmax = Nr
darwin_radtrans_niter = 1
darwin_part_size_P = 1 _d -15 ! mmol P per particle
#endif
#endif /* WAVEBANDS */
C Open and read the data.darwin file
_BEGIN_MASTER(myThid)
WRITE(msgBuf,'(A)') ' DARWIN_READPARMS: opening data.darwin'
CALL PRINT_MESSAGE(msgBuf, standardMessageUnit,
& SQUEEZE_RIGHT , 1)
CALL OPEN_COPY_DATA_FILE(
I 'data.darwin', 'DARWIN_READPARAMS',
O iUnit,
I myThid )
READ(UNIT=iUnit,NML=DARWIN_FORCING)
#ifdef ALLOW_PAR_DAY
darwin_PARnav = NINT(darwin_PARavPeriod*nsubtime/dTtracerLev(1))
#endif
C factor for conversion to uEin/m2/s
IF ( darwin_PARunits(1:16) .EQ. 'uEin/m2/s ' ) THEN
darwin_PARFileConv = 1. _d 0
ELSEIF ( darwin_PARunits(1:16) .EQ. 'Ein/m2/d ' ) THEN
darwin_PARFileConv = 1. _d 6/86400. _d 0
ELSEIF ( darwin_PARunits(1:16) .EQ. 'W/m2 ' ) THEN
darwin_PARFileConv = darwin_W_to_uEins
ELSE
WRITE(msgBuf,'(2A)') 'S/R DARWIN_READPARMS:',
& 'darwin_PARunits must be one of Ein/m2/d, uEin/m2/s, W/m2'
CALL PRINT_ERROR( msgBuf , 1)
STOP 'unknown darwin_PARunits'
ENDIF
C factor for conversion to mmol Fe/m2/s (bioavailable fraction is done later)
IF ( darwin_ironUnits(1:16) .EQ. 'mol Fe/m2/s ' ) THEN
darwin_ironFileConv = 1000. _d 0
ELSEIF ( darwin_ironUnits(1:16) .EQ. 'kg dust/m2/s ' ) THEN
darwin_ironFileConv = 1000.*darwin_dustFrac*1000./55.845 _d 0
ELSE
WRITE(msgBuf,'(2A)') 'S/R DARWIN_READPARMS:',
& 'darwin_ironUnits must be one of mol Fe/m2/s, kg dust/m2/s'
CALL PRINT_ERROR( msgBuf , 1)
STOP 'unknown darwin_Feunits'
ENDIF
#ifdef DAR_DIAG_CHL
C default values
C Geider: chl:c = max(chl2cmin, chl2cmax/(1+(chl2cmax*alphachl*PARday)/(2*Pcm)))
C Pcm = mu*limit*phytoTempFunction
Geider_smallalphachl = 2. _d -6 ! mmol C (mg Chl)-1 m2 (uEin)-1
Geider_Bigalphachl = 1. _d -6 ! mmol C (mg Chl)-1 m2 (uEin)-1
Geider_smallchl2cmax = 0.35 _d 0 ! mg Chl (mmol C)-1
Geider_Bigchl2cmax = 0.65 _d 0 ! mg Chl (mmol C)-1
Geider_smallchl2cmin = 0.003 _d 0 * 12. _d 0 ! mg Chl a/mmol C
Geider_Bigchl2cmin = 0.003 _d 0 * 12. _d 0 ! mg Chl a/mmol C
C Doney: chl:c = (Bmax - (Bmax-Bmin)*MIN(1,PARday/PARstar))*limit
Doney_Bmax = 12. _d 0 / 37. _d 0 ! mg Chl a/mmol C
Doney_Bmin = 12. _d 0 / 90. _d 0 ! mg Chl a/mmol C
Doney_PARstar = 90. _d 0 / 0.2174 _d 0 ! uEin/m2/s
C Cloern: chl:c = chl2cmin + A*exp(B*T)*exp(-C*PARday)*limit
Cloern_chl2cmin = 0.003 _d 0 * 12. _d 0 ! mg Chl a/mmol C
Cloern_A = 0.0154 _d 0 * 12. _d 0 ! mg Chl a/mmol C
Cloern_B = 0.050 _d 0 ! (degree C)^{-1}
Cloern_C = 0.059 _d 0 * 86400. _d 0 / 1. _d 6 ! m^2 s/uEin
READ(UNIT=iUnit,NML=DARWIN_CHL)
#endif /* DAR_DIAG_CHL */
#ifdef ALLOW_CARBON
READ(UNIT=iUnit,NML=DIC_FORCING)
#endif
#ifdef DAR_RADTRANS
#ifndef DAR_NONSPECTRAL_BACKSCATTERING_RATIO
DO i=1,tnabp
IF ( darwin_bbphy(i) .NE. 0 _d 0 ) THEN
WRITE(msgBuf,'(2A)') 'S/R DARWIN_READPARMS:',
& 'darwin_bbphy is obsolete.'
CALL PRINT_ERROR( msgBuf , 1)
WRITE(msgBuf,'(2A)') 'S/R DARWIN_READPARMS:',
& 'Backscattering coefficients are now read from'
CALL PRINT_ERROR( msgBuf , 1)
WRITE(msgBuf,'(2A)') 'S/R DARWIN_READPARMS:',
& 'darwin_phytoabsorbFile.'
CALL PRINT_ERROR( msgBuf , 1)
ENDIF
ENDDO
#endif
#endif
#if defined(WAVEBANDS) || defined(OASIM)
READ(UNIT=iUnit,NML=DARWIN_SPECTRAL_PARM,IOSTAT=errIO)
IF ( errIO .LT. 0 ) THEN
WRITE(msgBuf,'(A)')
& 'S/R DARWIN_READPARMS'
CALL PRINT_ERROR( msgBuf , 1)
WRITE(msgBuf,'(A)')
& 'Error reading darwin package'
CALL PRINT_ERROR( msgBuf , 1)
WRITE(msgBuf,'(A)')
& 'parameter file "data.darwin"'
CALL PRINT_ERROR( msgBuf , 1)
WRITE(msgBuf,'(A)')
& 'Problem in namelist DARWIN_SPECTRAL_PARM'
CALL PRINT_ERROR( msgBuf , 1)
STOP 'ABNORMAL END: S/R DARWIN_READPARMS'
ENDIF
#endif
WRITE(msgBuf,'(A)')
& ' DARWIN_READPARMS: finished reading data.darwin'
CALL PRINT_MESSAGE(msgBuf, standardMessageUnit,
& SQUEEZE_RIGHT , 1)
C Close the open data file
CLOSE(iUnit)
#if defined(WAVEBANDS) || defined(OASIM)
c Quanta conversion
planck = 6.6256 _d -34 !Plancks constant J sec
c = 2.998 _d 8 !speed of light m/sec
hc = 1.0/(planck*c)
oavo = 1.0/6.023 _d 23 ! 1/Avogadros number
hcoavo = hc*oavo
do ilam = 1,tlam
rlamm = darwin_waves(ilam)*1 _d -9 !lambda in m
WtouEins(ilam) = 1 _d 6*rlamm*hcoavo !Watts to uEin/s conversion
enddo
#endif
C-- Print a summary of parameter values:
iUnit = standardMessageUnit
WRITE(msgBuf,'(A)') '// ==================================='
CALL PRINT_MESSAGE( msgBuf, iUnit, SQUEEZE_RIGHT , myThid )
WRITE(msgBuf,'(A)') '// darwin parameters '
CALL PRINT_MESSAGE( msgBuf, iUnit, SQUEEZE_RIGHT , myThid )
WRITE(msgBuf,'(A)') '// ==================================='
CALL PRINT_MESSAGE( msgBuf, iUnit, SQUEEZE_RIGHT , myThid )
CALL WRITE_0D_I( darwin_seed, INDEX_NONE,
& 'darwin_seed =',
& ' /* seed for random number generator */')
WRITE(msgBuf,'(A)') ' -----------------------------------'
CALL PRINT_MESSAGE( msgBuf, iUnit, SQUEEZE_RIGHT, myThid )
#if defined(WAVEBANDS) || defined(OASIM)
CALL WRITE_1D_I( darwin_waves, tlam, 0,
& 'darwin_waves =',
&' /* "central" wavelengths of wavebands */')
#endif
#ifdef WAVEBANDS
#ifdef DAR_CALC_ACDOM
CALL WRITE_0D_RL( darwin_Sdom, INDEX_NONE,
& 'darwin_Sdom =',
&' /* spectral slope for aCDOM */')
#endif
#ifdef DAR_DIAG_ACDOM
CALL WRITE_0D_I( darwin_diag_acdom_ilam, INDEX_NONE,
& 'darwin_diag_acdom_ilam =',
&' /* waveband to use for aCDOM diagnostic */')
#endif
#ifdef DAR_RADTRANS
CALL WRITE_0D_I( darwin_PAR_ilamLo, INDEX_NONE,
& 'darwin_PAR_ilamLo =',
&' /* waveband index of PAR lower bound */')
CALL WRITE_0D_I( darwin_PAR_ilamHi, INDEX_NONE,
& 'darwin_PAR_ilamHi =',
&' /* waveband index of PAR upper bound */')
CALL WRITE_0D_RL( darwin_radmodThresh, INDEX_NONE,
& 'darwin_radmodThresh =',
&' /* threshold for calling radmod (W/m2/waveband) */')
CALL WRITE_0D_RL( darwin_Dmax, INDEX_NONE,
& 'darwin_Dmax =',
&' /* depth at which Ed is assumed zero */')
CALL WRITE_0D_RL( darwin_rmus, INDEX_NONE,
& 'darwin_rmus =',
&' /* inverse average cosine of downward diffuse irradiance */')
CALL WRITE_0D_RL( darwin_rmuu, INDEX_NONE,
& 'darwin_rmuu =',
&' /* inverse average cosine of upward diffuse irradiance */')
CALL WRITE_0D_RL( darwin_bbw, INDEX_NONE,
& 'darwin_bbw =',
&' /* backscattering to forward scattering ratio for water */')
CALL WRITE_0D_RL( darwin_bbmin, INDEX_NONE,
& 'darwin_bbmin =',
&' /* minimum backscattering coefficient (1/m) */')
CALL WRITE_1D_RL( darwin_bbphy, tnabp, 0,
& 'darwin_bbphy =',
&' /* backscattering to forward scattering ratio for phyto */')
CALL WRITE_0D_I( darwin_radtrans_kmax, INDEX_NONE,
& 'darwin_radtrans_kmax =',
&' /* deepest level in which to compute irradiances */')
CALL WRITE_0D_I( darwin_radtrans_niter, INDEX_NONE,
& 'darwin_radtrans_niter =',
&' /* number of "radtrans improvement" iterations */')
#endif /* DAR_RADTRANS */
#endif /* WAVEBANDS */
WRITE(msgBuf,'(A)') ' ==================================='
CALL PRINT_MESSAGE( msgBuf, iUnit, SQUEEZE_RIGHT, myThid )
_END_MASTER(myThid)
C Everyone else must wait for the parameters to be loaded
_BARRIER
#endif /* ALLOW_DARWIN */
RETURN
END