-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathmo_boxatm.F90
162 lines (137 loc) · 6.16 KB
/
mo_boxatm.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
! Copyright (C) 2018-2019 A. Moree
! Copyright (C) 2023 J. Schwinger
!
! 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_boxatm
!*************************************************************************************************
! This module contains the routine update_boxatm for updating a 1-D/scalar/box atmosphere
!
! The global sum of the air-sea C fluxes is calculated, then converted to ppm
! and added to the global atmospheric concentration. For C14, an atmospheric
! production term corresponding to the total decay in the ocean (plus sediment
! if activated) is assumed.
!
! A. Moree, *GFI, Bergen* Oct 2019
!
! Modified
! A. Moree, *GFI, Bergen* 2019-10
! - 14C source added to atmosphere as the sum of all 14C loss (decay)
! J. Schwinger, *NORCE, Bergen* 2023-08-02
! - ported into NorESM2 code, no functional changes
!*************************************************************************************************
implicit none
private
public :: update_boxatm
contains
subroutine update_boxatm(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask)
use mod_xc, only: mnproc,nbdy,ips,xcsum
use mo_control_bgc, only: io_stdo_bgc, use_cisonew, use_sedbypass
use mo_carbch, only: atmflx, atm, ocetra
use mo_param_bgc, only: rcar,c14dec
use mo_param1_bgc, only: iatmco2,iatmc13,iatmc14,isco214,idet14,icalc14,idoc14,iphy14,izoo14, &
ipowc14,issso14,isssc14
use mo_sedmnt, only: powtra,sedlay,seddw,porwat,porsol
! Arguments
integer,intent(in) :: kpie,kpje,kpke
real, intent(in) :: pdlxp(kpie,kpje),pdlyp(kpie,kpje)
real, intent(in) :: pddpo(kpie,kpje,kpke),omask(kpie,kpje)
! Local variables
real, parameter :: pg2ppm = 1.0/2.13 ! conversion factor PgC -> ppm CO2
integer :: i,j,k
real :: ztmp1(1-nbdy:kpie+nbdy,1-nbdy:kpje+nbdy)
real :: co2flux, co2flux_ppm
real :: ztmp2(1-nbdy:kpie+nbdy,1-nbdy:kpje+nbdy) ! cisonew
real :: co213flux, co213flux_ppm ! cisonew
real :: co214flux, co214flux_ppm ! cisonew
real :: totc14dec, vol ! cisonew
co2flux = 0.0
! Calculate global total air-sea flux [kmol]
ztmp1(:,:) = 0.0
do j=1,kpje
do i=1,kpie
ztmp1(i,j) = atmflx(i,j,iatmco2)*pdlxp(i,j)*pdlyp(i,j) ![kmol CO2/ m2] * [m] * [m]
enddo
enddo
call xcsum(co2flux,ztmp1,ips)
! Convert global CO2 flux to ppm
co2flux_ppm = co2flux*12.*1.e-12*pg2ppm ! [kmol C] -> [ppm]
! Update atmospheric pCO2
do j=1,kpje
do i=1,kpie
atm(i,j,iatmco2)=atm(i,j,iatmco2) + co2flux_ppm
enddo
enddo
if (use_cisonew) then
co213flux = 0.0
co214flux = 0.0
! Calculate global total air-sea flux for C isotopes [kmol]
ztmp1(:,:) = 0.0
ztmp2(:,:) = 0.0
do j=1,kpje
do i=1,kpie
ztmp1(i,j) = atmflx(i,j,iatmc13)*pdlxp(i,j)*pdlyp(i,j) ![kmol 13CO2/ m2] * [m] * [m]
ztmp2(i,j) = atmflx(i,j,iatmc14)*pdlxp(i,j)*pdlyp(i,j) ![kmol 14CO2/ m2] * [m] * [m]
enddo
enddo
call xcsum(co213flux,ztmp1,ips)
call xcsum(co214flux,ztmp2,ips)
! Convert global CO2 isotope fluxes to ppm isotope fluxes
co213flux_ppm = co213flux*13.*1.e-12*pg2ppm*12./13. ! [kmol 13CO2] -> [ppm]
co214flux_ppm = co214flux*14.*1.e-12*pg2ppm*12./14. ! [kmol 14CO2] -> [ppm]
! Calculate sum of 14C decay. Only decay in ocean, so only ocean tracers.
totc14dec = 0.0
ztmp1(:,:) = 0.0
do k=1,kpke
do j=1,kpje
do i=1,kpie
vol = pdlxp(i,j)*pdlyp(i,j)*pddpo(i,j,k)*omask(i,j) ! ocean volume
ztmp1(i,j) = ztmp1(i,j)+ocetra(i,j,k,isco214)*vol*(1.0-c14dec)
ztmp1(i,j) = ztmp1(i,j)+ocetra(i,j,k,idet14) *vol*(1.0-c14dec)*rcar
ztmp1(i,j) = ztmp1(i,j)+ocetra(i,j,k,icalc14)*vol*(1.0-c14dec)
ztmp1(i,j) = ztmp1(i,j)+ocetra(i,j,k,idoc14) *vol*(1.0-c14dec)*rcar
ztmp1(i,j) = ztmp1(i,j)+ocetra(i,j,k,iphy14) *vol*(1.0-c14dec)*rcar
ztmp1(i,j) = ztmp1(i,j)+ocetra(i,j,k,izoo14) *vol*(1.0-c14dec)*rcar
if (.not. use_sedbypass) then
vol = seddw(k)*pdlxp(i,j)*pdlyp(i,j)*porwat(i,j,k)*omask(i,j) ! porewater volume
ztmp1(i,j) = ztmp1(i,j)+powtra(i,j,k,ipowc14) *vol*(1.0-c14dec)
vol = seddw(k)*pdlxp(i,j)*pdlyp(i,j)*porsol(i,j,k)*omask(i,j) ! sediment volume
ztmp1(i,j) = ztmp1(i,j)+sedlay(i,j,k,issso14) *vol*(1.0-c14dec)*rcar
ztmp1(i,j) = ztmp1(i,j)+sedlay(i,j,k,isssc14) *vol*(1.0-c14dec)
endif
enddo
enddo
enddo
call xcsum(totc14dec,ztmp1,ips)
! Update atmospheric p13CO2 and p14CO2
do j=1,kpje
do i=1,kpie
atm(i,j,iatmc13)=atm(i,j,iatmc13) + co213flux_ppm
atm(i,j,iatmc14)=atm(i,j,iatmc14) + co214flux_ppm
atm(i,j,iatmc14)=atm(i,j,iatmc14) + totc14dec*14.*1.e-12*pg2ppm*12./14. ! add 14C decay (ppm)
enddo
enddo
if (mnproc.eq.1) then
write(io_stdo_bgc,*) ' '
write(io_stdo_bgc,*) 'Boxatm fluxes (ppm)'
write(io_stdo_bgc,*) ' co213flux_ppm: ',co213flux_ppm
write(io_stdo_bgc,*) ' co214flux_ppm: ',co214flux_ppm
write(io_stdo_bgc,*) ' totc14dec (ppm): ',(totc14dec*14.*1.e-12*pg2ppm*12./14.)
write(io_stdo_bgc,*) ' '
endif
endif ! end of use_cisonew
end subroutine update_boxatm
!*************************************************************************************************
end module mo_boxatm