-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathmo_biomod.F90
429 lines (367 loc) · 16.3 KB
/
mo_biomod.F90
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
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
! Copyright (C) 2001 S. Legutke
! Copyright (C) 2020 K. Assmann, J. Tjiputra, J. Schwinger, I. Kriest
!
! This file is part of BLOM/iHAMOCC.
!
! BLOM is free software: you can redistribute it and/or modify it under the
! terms of the GNU Lesser General Public License as published by the Free
! Software Foundation, either version 3 of the License, or (at your option)
! any later version.
!
! BLOM is distributed in the hope that it will be useful, but WITHOUT ANY
! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
! FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
! more details.
!
! You should have received a copy of the GNU Lesser General Public License
! along with BLOM. If not, see https://www.gnu.org/licenses/.
module mo_biomod
!*************************************************************************************************
! Variables for marine biology (declaration and memory allocation).
!
! S.Legutke, *MPI-MaD, HH* 31.10.01
!
! Modified
! I. Kriest, GEOMAR, 11.08.2016
! - included T-dependence of cyanobacteria growth
! - modified stoichiometry for denitrification
! J.Schwinger, *Uni Research, Bergen* 2018-04-12
! - moved accumulation of all output fields to seperate subroutine,
! new global fields for output defined here
!*************************************************************************************************
implicit none
private
! Routines
public :: alloc_mem_biomod ! Allocate memory for biomod variables
! Module variables
real, dimension (:,:), allocatable, public :: strahl
real, dimension (:,:), allocatable, public :: expoor
real, dimension (:,:), allocatable, public :: expoca
real, dimension (:,:), allocatable, public :: exposi
real, dimension (:,:), allocatable, public :: intphosy
real, dimension (:,:), allocatable, public :: intdnit
real, dimension (:,:), allocatable, public :: intnfix
real, dimension (:,:), allocatable, public :: intdmsprod
real, dimension (:,:), allocatable, public :: intdms_bac
real, dimension (:,:), allocatable, public :: intdms_uv
real, dimension (:,:), allocatable, public :: carflx0100
real, dimension (:,:), allocatable, public :: carflx0500
real, dimension (:,:), allocatable, public :: carflx1000
real, dimension (:,:), allocatable, public :: carflx2000
real, dimension (:,:), allocatable, public :: carflx4000
real, dimension (:,:), allocatable, public :: carflx_bot
real, dimension (:,:), allocatable, public :: bsiflx0100
real, dimension (:,:), allocatable, public :: bsiflx0500
real, dimension (:,:), allocatable, public :: bsiflx1000
real, dimension (:,:), allocatable, public :: bsiflx2000
real, dimension (:,:), allocatable, public :: bsiflx4000
real, dimension (:,:), allocatable, public :: bsiflx_bot
real, dimension (:,:), allocatable, public :: calflx0100
real, dimension (:,:), allocatable, public :: calflx0500
real, dimension (:,:), allocatable, public :: calflx1000
real, dimension (:,:), allocatable, public :: calflx2000
real, dimension (:,:), allocatable, public :: calflx4000
real, dimension (:,:), allocatable, public :: calflx_bot
real, dimension (:,:), allocatable, public :: dustflx0100
real, dimension (:,:), allocatable, public :: dustflx0500
real, dimension (:,:), allocatable, public :: dustflx1000
real, dimension (:,:), allocatable, public :: dustflx2000
real, dimension (:,:), allocatable, public :: dustflx4000
real, dimension (:,:), allocatable, public :: dustflx_bot
real, dimension (:,:,:), allocatable, public :: phosy3d
! Variables for interactive phytoplanktion absorption (use_FB_BGC_OCE=.true.)
real, dimension (:,:,:), allocatable, public :: abs_oce
! Variables for aggregation scheme (use_AGG=.true.)
real, dimension (:,:,:), allocatable, public :: wmass
real, dimension (:,:,:), allocatable, public :: wnumb
real, dimension (:,:,:), allocatable, public :: eps3d
real, dimension (:,:,:), allocatable, public :: asize3d
! Variables for bromoform scheme (use_BROMO=.true.)
real, dimension (:,:), allocatable, public :: int_chbr3_prod
real, dimension (:,:), allocatable, public :: int_chbr3_uv
real, dimension (:,:,:), allocatable, public :: nitr_NH4
real, dimension (:,:,:), allocatable, public :: nitr_NO2
real, dimension (:,:,:), allocatable, public :: nitr_N2O_prod
real, dimension (:,:,:), allocatable, public :: nitr_NH4_OM
real, dimension (:,:,:), allocatable, public :: nitr_NO2_OM
real, dimension (:,:,:), allocatable, public :: denit_NO3
real, dimension (:,:,:), allocatable, public :: denit_NO2
real, dimension (:,:,:), allocatable, public :: denit_N2O
real, dimension (:,:,:), allocatable, public :: DNRA_NO2
real, dimension (:,:,:), allocatable, public :: anmx_N2_prod
real, dimension (:,:,:), allocatable, public :: anmx_OM_prod
real, dimension (:,:,:), allocatable, public :: phosy_NH4
real, dimension (:,:,:), allocatable, public :: phosy_NO3
real, dimension (:,:,:), allocatable, public :: remin_aerob
real, dimension (:,:,:), allocatable, public :: remin_sulf
CONTAINS
subroutine alloc_mem_biomod(kpie,kpje,kpke)
!******************************************************************************
! ALLOC_MEM_BIOMOD - Allocate variables in this module
!******************************************************************************
use mod_xc, only: mnproc
use mo_control_bgc, only: io_stdo_bgc
use mo_control_bgc, only: use_FB_BGC_OCE,use_AGG,use_BROMO,use_extNcycle
! Arguments
integer, intent(in) :: kpie
integer, intent(in) :: kpje
integer, intent(in) :: kpke
! local variables
integer :: errstat
if (mnproc.eq.1) then
write(io_stdo_bgc,*)' '
write(io_stdo_bgc,*)'***************************************************'
write(io_stdo_bgc,*)'Memory allocation for marine biology module :'
write(io_stdo_bgc,*)' '
endif
if (mnproc.eq.1) then
write(io_stdo_bgc,*)'Memory allocation for variable strahl ...'
write(io_stdo_bgc,*)'First dimension : ',kpie
write(io_stdo_bgc,*)'Second dimension : ',kpje
endif
allocate (strahl(kpie,kpje),stat=errstat)
if(errstat.ne.0) stop 'not enough memory strahl'
strahl(:,:) = 0.0
if (use_FB_BGC_OCE ) then
if (mnproc.eq.1) then
write(io_stdo_bgc,*)'Memory allocation for variable abs_oce'
write(io_stdo_bgc,*)'First dimension : ',kpie
write(io_stdo_bgc,*)'Second dimension : ',kpje
write(io_stdo_bgc,*)'Third dimension : ',kpke
endif
allocate (abs_oce(kpie,kpje,kpke),stat=errstat)
if(errstat.ne.0) stop 'not enough memory abs_oce'
abs_oce(:,:,:) = 0.0
endif
if (mnproc.eq.1) then
write(io_stdo_bgc,*)'Memory allocation for variable expoor ...'
write(io_stdo_bgc,*)'First dimension : ',kpie
write(io_stdo_bgc,*)'Second dimension : ',kpje
endif
allocate (expoor(kpie,kpje),stat=errstat)
if(errstat.ne.0) stop 'not enough memory expoor'
expoor(:,:) = 0.0
if (mnproc.eq.1) then
write(io_stdo_bgc,*)'Memory allocation for variable expoca ...'
write(io_stdo_bgc,*)'First dimension : ',kpie
write(io_stdo_bgc,*)'Second dimension : ',kpje
endif
allocate (expoca(kpie,kpje),stat=errstat)
if(errstat.ne.0) stop 'not enough memory expoca'
expoca(:,:) = 0.0
if (mnproc.eq.1) then
write(io_stdo_bgc,*)'Memory allocation for variable exposi ...'
write(io_stdo_bgc,*)'First dimension : ',kpie
write(io_stdo_bgc,*)'Second dimension : ',kpje
endif
allocate (exposi(kpie,kpje),stat=errstat)
if(errstat.ne.0) stop 'not enough memory exposi'
exposi(:,:) = 0.0
if (mnproc.eq.1) then
write(io_stdo_bgc,*)'Memory allocation for variable intphosy ...'
write(io_stdo_bgc,*)'First dimension : ',kpie
write(io_stdo_bgc,*)'Second dimension : ',kpje
endif
allocate (intphosy(kpie,kpje),stat=errstat)
if(errstat.ne.0) stop 'not enough memory intphosy'
intphosy(:,:) = 0.0
if (mnproc.eq.1) then
write(io_stdo_bgc,*)'Memory allocation for variable intdnit ...'
write(io_stdo_bgc,*)'First dimension : ',kpie
write(io_stdo_bgc,*)'Second dimension : ',kpje
endif
allocate (intdnit(kpie,kpje),stat=errstat)
if(errstat.ne.0) stop 'not enough memory intdnit'
intdnit(:,:) = 0.0
if (mnproc.eq.1) then
write(io_stdo_bgc,*)'Memory allocation for variable intnfix ...'
write(io_stdo_bgc,*)'First dimension : ',kpie
write(io_stdo_bgc,*)'Second dimension : ',kpje
endif
allocate (intnfix(kpie,kpje),stat=errstat)
if(errstat.ne.0) stop 'not enough memory intnfix'
intnfix(:,:) = 0.0
if (mnproc.eq.1) then
write(io_stdo_bgc,*)'Memory allocation for variable intdmsprod, intdms_bac, intdms_uv ...'
write(io_stdo_bgc,*)'First dimension : ',kpie
write(io_stdo_bgc,*)'Second dimension : ',kpje
endif
allocate (intdmsprod(kpie,kpje),stat=errstat)
allocate (intdms_bac(kpie,kpje),stat=errstat)
allocate (intdms_uv(kpie,kpje),stat=errstat)
if(errstat.ne.0) stop 'not enough memory intdmsprod, intdms_bac, intdms_uv'
intdmsprod(:,:) = 0.0
intdms_bac(:,:) = 0.0
intdms_uv(:,:) = 0.0
if (mnproc.eq.1) then
write(io_stdo_bgc,*)'Memory allocation for variable carflx* ...'
write(io_stdo_bgc,*)'First dimension : ',kpie
write(io_stdo_bgc,*)'Second dimension : ',kpje
endif
allocate (carflx0100(kpie,kpje),stat=errstat)
allocate (carflx0500(kpie,kpje),stat=errstat)
allocate (carflx1000(kpie,kpje),stat=errstat)
allocate (carflx2000(kpie,kpje),stat=errstat)
allocate (carflx4000(kpie,kpje),stat=errstat)
allocate (carflx_bot(kpie,kpje),stat=errstat)
if(errstat.ne.0) stop 'not enough memory carflx*'
carflx0100(:,:) = 0.0
carflx0500(:,:) = 0.0
carflx1000(:,:) = 0.0
carflx2000(:,:) = 0.0
carflx4000(:,:) = 0.0
carflx_bot(:,:) = 0.0
if (mnproc.eq.1) then
write(io_stdo_bgc,*)'Memory allocation for variable bsiflx* ...'
write(io_stdo_bgc,*)'First dimension : ',kpie
write(io_stdo_bgc,*)'Second dimension : ',kpje
endif
allocate (bsiflx0100(kpie,kpje),stat=errstat)
allocate (bsiflx0500(kpie,kpje),stat=errstat)
allocate (bsiflx1000(kpie,kpje),stat=errstat)
allocate (bsiflx2000(kpie,kpje),stat=errstat)
allocate (bsiflx4000(kpie,kpje),stat=errstat)
allocate (bsiflx_bot(kpie,kpje),stat=errstat)
if(errstat.ne.0) stop 'not enough memory bsiflx*'
bsiflx0100(:,:) = 0.0
bsiflx0500(:,:) = 0.0
bsiflx1000(:,:) = 0.0
bsiflx2000(:,:) = 0.0
bsiflx4000(:,:) = 0.0
bsiflx_bot(:,:) = 0.0
if (mnproc.eq.1) then
write(io_stdo_bgc,*)'Memory allocation for variable calflx* ...'
write(io_stdo_bgc,*)'First dimension : ',kpie
write(io_stdo_bgc,*)'Second dimension : ',kpje
endif
allocate (calflx0100(kpie,kpje),stat=errstat)
allocate (calflx0500(kpie,kpje),stat=errstat)
allocate (calflx1000(kpie,kpje),stat=errstat)
allocate (calflx2000(kpie,kpje),stat=errstat)
allocate (calflx4000(kpie,kpje),stat=errstat)
allocate (calflx_bot(kpie,kpje),stat=errstat)
if(errstat.ne.0) stop 'not enough memory calflx*'
calflx0100(:,:) = 0.0
calflx0500(:,:) = 0.0
calflx1000(:,:) = 0.0
calflx2000(:,:) = 0.0
calflx4000(:,:) = 0.0
calflx_bot(:,:) = 0.0
if (mnproc.eq.1) then
write(io_stdo_bgc,*)'Memory allocation for variable dustflx* ...'
write(io_stdo_bgc,*)'First dimension : ',kpie
write(io_stdo_bgc,*)'Second dimension : ',kpje
endif
allocate (dustflx0100(kpie,kpje),stat=errstat)
allocate (dustflx0500(kpie,kpje),stat=errstat)
allocate (dustflx1000(kpie,kpje),stat=errstat)
allocate (dustflx2000(kpie,kpje),stat=errstat)
allocate (dustflx4000(kpie,kpje),stat=errstat)
allocate (dustflx_bot(kpie,kpje),stat=errstat)
if(errstat.ne.0) stop 'not enough memory dustflx*'
dustflx0100(:,:) = 0.0
dustflx0500(:,:) = 0.0
dustflx1000(:,:) = 0.0
dustflx2000(:,:) = 0.0
dustflx4000(:,:) = 0.0
dustflx_bot(:,:) = 0.0
if (mnproc.eq.1) then
write(io_stdo_bgc,*)'Memory allocation for variable phosy3d ...'
write(io_stdo_bgc,*)'First dimension : ',kpie
write(io_stdo_bgc,*)'Second dimension : ',kpje
write(io_stdo_bgc,*)'Third dimension : ',kpke
endif
allocate (phosy3d(kpie,kpje,kpke),stat=errstat)
if(errstat.ne.0) stop 'not enough memory phosy3d'
phosy3d(:,:,:) = 0.0
if (use_AGG) then
if (mnproc.eq.1) then
write(io_stdo_bgc,*)'Memory allocation for variable wmass ...'
write(io_stdo_bgc,*)'First dimension : ',kpie
write(io_stdo_bgc,*)'Second dimension : ',kpje
write(io_stdo_bgc,*)'Third dimension : ',kpke
endif
allocate (wmass(kpie,kpje,kpke),stat=errstat)
if(errstat.ne.0) stop 'not enough memory eps3d'
wmass(:,:,:) = 0.0
if (mnproc.eq.1) then
write(io_stdo_bgc,*)'Memory allocation for variable wnumb ...'
write(io_stdo_bgc,*)'First dimension : ',kpie
write(io_stdo_bgc,*)'Second dimension : ',kpje
write(io_stdo_bgc,*)'Third dimension : ',kpke
endif
allocate (wnumb(kpie,kpje,kpke),stat=errstat)
if(errstat.ne.0) stop 'not enough memory eps3d'
wnumb(:,:,:) = 0.0
if (mnproc.eq.1) then
write(io_stdo_bgc,*)'Memory allocation for variable eps3d ...'
write(io_stdo_bgc,*)'First dimension : ',kpie
write(io_stdo_bgc,*)'Second dimension : ',kpje
write(io_stdo_bgc,*)'Third dimension : ',kpke
endif
allocate (eps3d(kpie,kpje,kpke),stat=errstat)
if(errstat.ne.0) stop 'not enough memory eps3d'
eps3d(:,:,:) = 0.0
if (mnproc.eq.1) then
write(io_stdo_bgc,*)'Memory allocation for variable asize3d ...'
write(io_stdo_bgc,*)'First dimension : ',kpie
write(io_stdo_bgc,*)'Second dimension : ',kpje
write(io_stdo_bgc,*)'Third dimension : ',kpke
endif
allocate (asize3d(kpie,kpje,kpke),stat=errstat)
if(errstat.ne.0) stop 'not enough memory asize3d'
asize3d(:,:,:) = 0.0
endif
if (use_BROMO) then
if (mnproc.eq.1) then
write(io_stdo_bgc,*)'Memory allocation for variable int_chbr3_prod, int_chbr3_uv ...'
write(io_stdo_bgc,*)'First dimension : ',kpie
write(io_stdo_bgc,*)'Second dimension : ',kpje
endif
allocate (int_chbr3_prod(kpie,kpje),stat=errstat)
allocate (int_chbr3_uv(kpie,kpje),stat=errstat)
if(errstat.ne.0) stop 'not enough memory int_chbr3_prod, int_chbr3_uv'
int_chbr3_prod(:,:) = 0.0
int_chbr3_uv(:,:) = 0.0
endif
if (use_extNcycle) then
if (mnproc.eq.1) then
write(io_stdo_bgc,*)'Memory allocation for variable of the extended nitrogen cycle ...'
write(io_stdo_bgc,*)'First dimension : ',kpie
write(io_stdo_bgc,*)'Second dimension : ',kpje
write(io_stdo_bgc,*)'Third dimension : ',kpke
endif
allocate (nitr_NH4(kpie,kpje,kpke),stat=errstat)
allocate (nitr_NO2(kpie,kpje,kpke),stat=errstat)
allocate (nitr_N2O_prod(kpie,kpje,kpke),stat=errstat)
allocate (nitr_NH4_OM(kpie,kpje,kpke),stat=errstat)
allocate (nitr_NO2_OM(kpie,kpje,kpke),stat=errstat)
allocate (denit_NO3(kpie,kpje,kpke),stat=errstat)
allocate (denit_NO2(kpie,kpje,kpke),stat=errstat)
allocate (denit_N2O(kpie,kpje,kpke),stat=errstat)
allocate (DNRA_NO2(kpie,kpje,kpke),stat=errstat)
allocate (anmx_N2_prod(kpie,kpje,kpke),stat=errstat)
allocate (anmx_OM_prod(kpie,kpje,kpke),stat=errstat)
allocate (phosy_NH4(kpie,kpje,kpke),stat=errstat)
allocate (phosy_NO3(kpie,kpje,kpke),stat=errstat)
allocate (remin_aerob(kpie,kpje,kpke),stat=errstat)
allocate (remin_sulf(kpie,kpje,kpke),stat=errstat)
if(errstat.ne.0) stop 'not enough memory extended nitrogen cycle'
nitr_NH4 = 0.
nitr_NO2 = 0.
nitr_N2O_prod = 0.
nitr_NH4_OM = 0.
nitr_NO2_OM = 0.
denit_NO3 = 0.
denit_NO2 = 0.
denit_N2O = 0.
DNRA_NO2 = 0.
anmx_N2_prod = 0.
anmx_OM_prod = 0.
phosy_NH4 = 0.
phosy_NO3 = 0.
remin_aerob = 0.
remin_sulf = 0.
endif
end subroutine alloc_mem_biomod
end module mo_biomod