Skip to content

Commit

Permalink
pCO2, Piston velocity and solubility output (NorESMhub#202)
Browse files Browse the repository at this point in the history
* add pCO2m (moist), CO2 piston velocity and solubility output - caution: kwco2 piston velocity now really holds only piston velocity (and not times solubility)
  • Loading branch information
jmaerz authored and TomasTorsvik committed Dec 5, 2022
1 parent 233c39f commit ca62d33
Show file tree
Hide file tree
Showing 6 changed files with 121 additions and 10 deletions.
14 changes: 13 additions & 1 deletion cime_config/buildnml
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,11 @@ set SRF_EXPORT = '0, 2, 2'
set SRF_EXPOSI = '0, 2, 2'
set SRF_EXPOCA = '0, 2, 2'
set SRF_KWCO2 = '0, 2, 2'
set SRF_KWCO2KHM = '0, 2, 2'
set SRF_CO2KH = '0, 2, 2'
set SRF_CO2KHM = '0, 2, 2'
set SRF_PCO2 = '0, 2, 2'
set SRF_PCO2M = '0, 2, 2'
set SRF_CO2FXD = '4, 2, 2'
set SRF_CO2FXU = '4, 2, 2'
set SRF_OXFLUX = '0, 2, 2'
Expand Down Expand Up @@ -1584,7 +1588,11 @@ cat >>! $RUNDIR/ocn_in$inststr << EOF
! EXPOCA - Ca export production (epcalc100) [mol Ca m-2 s-1]
! EXPOSI - Si export production (epsi100) [mol Si m-2 s-1]
! PCO2 - Surface PCO2 (spco2) [uatm]
! KWCO2 - kwco2 x solubility
! PCO2M - Surface PCO2 under moist air assumption [uatm]
! KWCO2 - Piston velocity (kwco2) [m s-1]
! KWCO2KHM - Piston velocity times solubility (kwco2*kh; moist air) [m s-1 mol kg-1 uatm-1]
! CO2KH - CO2 solubility under dry air assumption (khd) [mol kg-1 atm-1]
! CO2KHM - CO2 solubility under moist air assumption (kh) [mol kg-1 atm-1]
! CO2FXD - Downward CO2 flux (co2fxd) [kg C m-2 s-1]
! CO2FXU - Upward CO2 flux (co2fxu) [kg C m-2 s-1]
! NIFLUX - Nitrogen flux (fgn2) [mol N2 m-2 s-1]
Expand Down Expand Up @@ -1664,7 +1672,11 @@ cat >>! $RUNDIR/ocn_in$inststr << EOF
SRF_EXPOSI = $SRF_EXPOSI
SRF_EXPOCA = $SRF_EXPOCA
SRF_KWCO2 = $SRF_KWCO2
SRF_KWCO2KHM = $SRF_KWCO2KHM
SRF_CO2KH = $SRF_CO2KH
SRF_CO2KHM = $SRF_CO2KHM
SRF_PCO2 = $SRF_PCO2
SRF_PCO2M = $SRF_PCO2M
SRF_CO2FXD = $SRF_CO2FXD
SRF_CO2FXU = $SRF_CO2FXU
SRF_OXFLUX = $SRF_OXFLUX
Expand Down
12 changes: 9 additions & 3 deletions hamocc/accfields.F90
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ SUBROUTINE ACCFIELDS(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask)
!**********************************************************************
use mod_xc, only: mnproc
use mod_dia, only: ddm
use mo_carbch, only: atm,atmflx,co2fxd,co2fxu,co3,hi,kwco2sol,ndepflx,rivinflx,ocetra,omegaa,omegac,pco2d,satoxy,sedfluxo
use mo_carbch, only: atm,atmflx,co2fxd,co2fxu,co3,hi,kwco2sol,ndepflx,rivinflx,ocetra,omegaa,omegac,pco2d,satoxy, &
& sedfluxo,pco2m,kwco2d,co2sold,co2solm
use mo_biomod, only: bsiflx_bot,bsiflx0100,bsiflx0500,bsiflx1000,bsiflx2000,bsiflx4000,calflx_bot,calflx0100,calflx0500,&
& calflx1000,calflx2000,calflx4000,carflx_bot,carflx0100,carflx0500,carflx1000,carflx2000,carflx4000,&
& expoca,expoor,exposi,intdms_bac,intdms_uv,intdmsprod,intdnit,intnfix,intphosy,phosy3d
Expand All @@ -63,7 +64,8 @@ SUBROUTINE ACCFIELDS(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask)
& jlvlph,jlvlphosph,jlvlphosy,jlvlphyto,jlvlphyto13,jlvlpoc,jlvlpoc13,jlvlprefalk,jlvlprefdic, &
& jlvlprefo2,jlvlprefpo4,jlvlsf6,jlvlsilica,jlvlwnos,jlvlwphy,jn2flux,jn2o,jn2oflux,jn2ofx, &
& jprorca,jprcaca,jsilpro,jpodiic,jpodial,jpodiph,jpodiox,jpodin2,jpodino3,jpodisi,jndep, &
& jniflux,jnos,jo2flux,jo2sat,jomegaa,jomegac,jopal,joxflux,joxygen,jpco2,jph,jphosph,jphosy,jphyto, &
& jniflux,jnos,jo2flux,jo2sat,jomegaa,jomegac,jopal,joxflux,joxygen,jpco2,jpco2m,jkwco2khm,jco2khm, &
& jco2kh,jph,jphosph,jphosy,jphyto, &
& jpoc,jprefalk,jprefdic,jprefo2,jprefpo4,jsilica,jsrfalkali,jsrfano3,jsrfdic,jsrfiron,jsrfoxygen, &
& jsrfphosph,jsrfphyto,jsrfsilica,jwnos,jwphy,nbgc,nacc_bgc,bgcwrt,glb_inventory,bgct2d,acclvl, &
& acclyr,accsrf,bgczlv
Expand Down Expand Up @@ -227,7 +229,11 @@ SUBROUTINE ACCFIELDS(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask)

! Accumulate 2d diagnostics
call accsrf(jpco2,pco2d,omask,0)
call accsrf(jkwco2,kwco2sol,omask,0)
call accsrf(jpco2m,pco2m,omask,0)
call accsrf(jkwco2khm,kwco2sol,omask,0)
call accsrf(jkwco2,kwco2d,omask,0)
call accsrf(jco2kh,co2sold,omask,0)
call accsrf(jco2khm,co2solm,omask,0)
call accsrf(jsrfphosph,ocetra(1,1,1,iphosph),omask,0)
call accsrf(jsrfoxygen,ocetra(1,1,1,ioxygen),omask,0)
call accsrf(jsrfiron,ocetra(1,1,1,iiron),omask,0)
Expand Down
17 changes: 13 additions & 4 deletions hamocc/carchm.F90
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, &
! none.
!
!**********************************************************************
use mo_carbch, only: atm,atmflx,co2fxd,co2fxu,co2star,co3,hi,keqb,kwco2sol,ocetra,omegaa,omegac,pco2d,satn2o,satoxy
use mo_carbch, only: atm,atmflx,co2fxd,co2fxu,co2star,co3,hi,keqb,kwco2sol,ocetra,omegaa,omegac,pco2d,satn2o,satoxy, &
pco2m,kwco2d,co2sold,co2solm
use mo_chemcon, only: al1,al2,al3,al4,an0,an1,an2,an3,an4,an5,an6,atn2o,bl1,bl2,bl3,calcon,ox0,ox1,ox2,ox3,ox4,ox5,ox6, &
& oxyco,tzero
use mo_control_bgc, only: dtbgc
Expand Down Expand Up @@ -180,7 +181,11 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, &
co214fxd (:,:)=0.
co214fxu (:,:)=0.
#endif
pco2d (:,:)=0.
pco2d (:,:)=0.
pco2m (:,:)=0.
kwco2d (:,:)=0.
co2sold (:,:)=0.
co2solm (:,:)=0.
kwco2sol (:,:)=0.
co2star(:,:,:)=0.
co3 (:,:,:)=0.
Expand Down Expand Up @@ -518,13 +523,17 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, &

! Save pco2 w.r.t. dry air for output
pco2d(i,j) = cu * 1.e6 / Khd
!pCO2 wrt moist air
pco2m(i,j) = cu * 1.e6 / Kh
#ifdef natDIC
natpco2d(i,j) = natcu * 1.e6 / Khd
#endif

! Save product of piston velocity and solubility for output
kwco2sol(i,j) = kwco2*Kh*1e-6

kwco2sol(i,j) = kwco2*Kh*1e-6 !m/s mol/kg/muatm
kwco2d(i,j) = kwco2 ! m/s (incl. ice fraction!)
co2sold(i,j) = Khd ! mol/kg/atm
co2solm(i,j) = Kh ! mol/kg/atm

endif ! k==1
#ifdef BROMO
Expand Down
16 changes: 16 additions & 0 deletions hamocc/mo_bgcmean.F90
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ MODULE mo_bgcmean
! --- Namelist for diagnostic output
INTEGER, DIMENSION(nbgcmax), SAVE :: &
& SRF_KWCO2 =0 ,SRF_PCO2 =0 ,SRF_DMSFLUX =0 , &
& SRF_KWCO2KHM =0 ,SRF_CO2KHM =0 ,SRF_CO2KH =0 , &
& SRF_PCO2M =0 , &
& SRF_CO2FXD =0 ,SRF_CO2FXU =0 ,SRF_CO213FXD =0 , &
& SRF_CO213FXU =0 ,SRF_CO214FXD =0 ,SRF_CO214FXU =0 , &
& SRF_OXFLUX =0 ,SRF_NIFLUX =0 ,SRF_DMS =0 , &
Expand Down Expand Up @@ -150,6 +152,8 @@ MODULE mo_bgcmean
CHARACTER(LEN=10), DIMENSION(nbgcmax), SAVE :: GLB_FNAMETAG
namelist /DIABGC/ &
& SRF_KWCO2 ,SRF_PCO2 ,SRF_DMSFLUX , &
& SRF_KWCO2KHM ,SRF_CO2KHM ,SRF_CO2KH , &
& SRF_PCO2M , &
& SRF_CO2FXD ,SRF_CO2FXU ,SRF_CO213FXD , &
& SRF_CO213FXU ,SRF_CO214FXD ,SRF_CO214FXU , &
& SRF_OXFLUX ,SRF_NIFLUX ,SRF_DMS , &
Expand Down Expand Up @@ -255,7 +259,11 @@ MODULE mo_bgcmean
INTEGER, SAVE :: i_bsc_m2d
INTEGER, DIMENSION(nbgcmax), SAVE :: &
& jkwco2 = 0 , &
& jkwco2khm = 0 , &
& jco2kh = 0 , &
& jco2khm = 0 , &
& jpco2 = 0 , &
& jpco2m = 0 , &
& jdmsflux = 0 , &
& jco2fxd = 0 , &
& jco2fxu = 0 , &
Expand Down Expand Up @@ -560,8 +568,16 @@ SUBROUTINE ALLOC_MEM_BGCMEAN(kpie,kpje,kpke)
DO n=1,nbgc
IF (SRF_KWCO2(n).GT.0) i_bsc_m2d=i_bsc_m2d+1
jkwco2(n)=i_bsc_m2d*min(1,SRF_KWCO2(n))
IF (SRF_KWCO2KHM(n).GT.0) i_bsc_m2d=i_bsc_m2d+1
jkwco2khm(n)=i_bsc_m2d*min(1,SRF_KWCO2KHM(n))
IF (SRF_CO2KH(n).GT.0) i_bsc_m2d=i_bsc_m2d+1
jco2kh(n)=i_bsc_m2d*min(1,SRF_CO2KH(n))
IF (SRF_CO2KHM(n).GT.0) i_bsc_m2d=i_bsc_m2d+1
jco2khm(n)=i_bsc_m2d*min(1,SRF_CO2KHM(n))
IF (SRF_PCO2(n).GT.0) i_bsc_m2d=i_bsc_m2d+1
jpco2(n)=i_bsc_m2d*min(1,SRF_PCO2(n))
IF (SRF_PCO2M(n).GT.0) i_bsc_m2d=i_bsc_m2d+1
jpco2m(n)=i_bsc_m2d*min(1,SRF_PCO2M(n))
IF (SRF_DMSFLUX(n).GT.0) i_bsc_m2d=i_bsc_m2d+1
jdmsflux(n)=i_bsc_m2d*min(1,SRF_DMSFLUX(n))
IF (SRF_CO2FXD(n).GT.0) i_bsc_m2d=i_bsc_m2d+1
Expand Down
43 changes: 43 additions & 0 deletions hamocc/mo_carbch.F90
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@ MODULE mo_carbch
REAL, DIMENSION (:,:,:), ALLOCATABLE :: sedfluxo

REAL, DIMENSION (:,:), ALLOCATABLE :: pco2d
REAL, DIMENSION (:,:), ALLOCATABLE :: pco2m
REAL, DIMENSION (:,:), ALLOCATABLE :: kwco2sol
REAL, DIMENSION (:,:), ALLOCATABLE :: kwco2d
REAL, DIMENSION (:,:), ALLOCATABLE :: co2sold
REAL, DIMENSION (:,:), ALLOCATABLE :: co2solm
REAL, DIMENSION (:,:), ALLOCATABLE :: co2fxd
REAL, DIMENSION (:,:), ALLOCATABLE :: co2fxu
#ifdef cisonew
Expand Down Expand Up @@ -334,12 +338,51 @@ SUBROUTINE ALLOC_MEM_CARBCH(kpie,kpje,kpke)
if(errstat.ne.0) stop 'not enough memory pco2d'
pco2d(:,:) = 0.0

IF (mnproc.eq.1) THEN
WRITE(io_stdo_bgc,*)'Memory allocation for variable pco2m ...'
WRITE(io_stdo_bgc,*)'First dimension : ',kpie
WRITE(io_stdo_bgc,*)'Second dimension : ',kpje
ENDIF

ALLOCATE (pco2m(kpie,kpje),stat=errstat)
if(errstat.ne.0) stop 'not enough memory pco2m'
pco2m(:,:) = 0.0

IF (mnproc.eq.1) THEN
WRITE(io_stdo_bgc,*)'Memory allocation for variable kwco2d ...'
WRITE(io_stdo_bgc,*)'First dimension : ',kpie
WRITE(io_stdo_bgc,*)'Second dimension : ',kpje
ENDIF

ALLOCATE (kwco2d(kpie,kpje),stat=errstat)
if(errstat.ne.0) stop 'not enough memory kwco2d'
kwco2d(:,:) = 0.0

IF (mnproc.eq.1) THEN
WRITE(io_stdo_bgc,*)'Memory allocation for variable kwco2sol ...'
WRITE(io_stdo_bgc,*)'First dimension : ',kpie
WRITE(io_stdo_bgc,*)'Second dimension : ',kpje
ENDIF

IF (mnproc.eq.1) THEN
WRITE(io_stdo_bgc,*)'Memory allocation for variable co2sold ...'
WRITE(io_stdo_bgc,*)'First dimension : ',kpie
WRITE(io_stdo_bgc,*)'Second dimension : ',kpje
ENDIF

ALLOCATE (co2sold(kpie,kpje),stat=errstat)
if(errstat.ne.0) stop 'not enough memory co2sold'
co2sold(:,:) = 0.0

IF (mnproc.eq.1) THEN
WRITE(io_stdo_bgc,*)'Memory allocation for variable co2solm ...'
WRITE(io_stdo_bgc,*)'First dimension : ',kpie
WRITE(io_stdo_bgc,*)'Second dimension : ',kpje
ENDIF

ALLOCATE (co2solm(kpie,kpje),stat=errstat)
if(errstat.ne.0) stop 'not enough memory co2solm'
co2solm(:,:) = 0.0

ALLOCATE (kwco2sol(kpie,kpje),stat=errstat)
if(errstat.ne.0) stop 'not enough memory co2fxd,co2fxu'
Expand Down
29 changes: 27 additions & 2 deletions hamocc/ncout_hamocc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ subroutine ncwrt_bgc(iogrp)
& jlvlwnos,jlvlwphy,jn2flux,jn2o,jn2oflux, &
& jn2ofx,jndep,jniflux,jnos,jo2flux,jo2sat, &
& jomegaa,jomegac,jopal,joxflux,joxygen,jpco2, &
& jpco2m,jkwco2khm,jco2kh,jco2khm, &
& jph,jphosph,jphosy,jphyto,jpoc,jprefalk, &
& jprefdic,jprefo2,jprefpo4,jsilica, &
& jsrfalkali,jsrfano3,jsrfdic,jsrfiron, &
Expand All @@ -95,6 +96,7 @@ subroutine ncwrt_bgc(iogrp)
& lvl_n2o,lvl_prefo2,lvl_o2sat,lvl_prefpo4, &
& lvl_prefalk,lvl_prefdic,lvl_dicsat, &
& lvl_o2sat,srf_n2ofx,srf_atmco2,srf_kwco2, &
& srf_kwco2khm,srf_co2kh,srf_co2khm,srf_pco2m, &
& srf_pco2,srf_dmsflux,srf_co2fxd, &
& srf_co2fxu,srf_oxflux,srf_niflux,srf_dms, &
& srf_dmsprod,srf_dms_bac,srf_dms_uv, &
Expand Down Expand Up @@ -392,9 +394,18 @@ subroutine ncwrt_bgc(iogrp)

! --- Store 2d fields
call wrtsrf(jkwco2(iogrp),SRF_KWCO2(iogrp),rnacc,0.,cmpflg, &
& 'kwco2',' ',' ',' ')
& 'kwco2','CO2 piston velocity',' ','m s-1')
call wrtsrf(jkwco2khm(iogrp),SRF_KWCO2KHM(iogrp),rnacc,0.,cmpflg, &
& 'kwco2khm','CO2 piston velocity times solubility (moist air)',' ', &
& 'm s-1 mol kg-1 uatm-1')
call wrtsrf(jco2kh(iogrp),SRF_CO2KH(iogrp),rnacc,0.,cmpflg, &
& 'co2kh','CO2 solubility (dry air) ',' ','mol kg-1 atm-1')
call wrtsrf(jco2khm(iogrp),SRF_CO2KHM(iogrp),rnacc,0.,cmpflg, &
& 'co2khm','CO2 solubility (moist air) ',' ','mol kg-1 atm-1')
call wrtsrf(jpco2(iogrp),SRF_PCO2(iogrp),rnacc,0.,cmpflg, &
& 'pco2','Surface PCO2',' ','uatm')
call wrtsrf(jpco2m(iogrp),SRF_PCO2M(iogrp),rnacc,0.,cmpflg, &
& 'pco2m','Surface PCO2 (moist air)',' ','uatm')
call wrtsrf(jdmsflux(iogrp),SRF_DMSFLUX(iogrp),rnacc*1e3/dtbgc,0., &
& cmpflg,'dmsflux','DMS flux',' ','mol DMS m-2 s-1')
call wrtsrf(jco2fxd(iogrp),SRF_CO2FXD(iogrp),rnacc*12./dtbgc,0., &
Expand Down Expand Up @@ -877,7 +888,11 @@ subroutine ncwrt_bgc(iogrp)

! --- Initialise fields
call inisrf(jkwco2(iogrp),0.)
call inisrf(jkwco2khm(iogrp),0.)
call inisrf(jco2kh(iogrp),0.)
call inisrf(jco2khm(iogrp),0.)
call inisrf(jpco2(iogrp),0.)
call inisrf(jpco2m(iogrp),0.)
call inisrf(jdmsflux(iogrp),0.)
call inisrf(jco2fxd(iogrp),0.)
call inisrf(jco2fxu(iogrp),0.)
Expand Down Expand Up @@ -1119,6 +1134,7 @@ subroutine hamoccvardef(iogrp,timeunits,calendar,cmpflg)
& nctime,ncfcls,ncedef,ncdefvar3d,ndouble

use mo_bgcmean, only: srf_kwco2,srf_pco2,srf_dmsflux,srf_co2fxd, &
& srf_kwco2khm,srf_co2kh,srf_co2khm,srf_pco2m, &
& srf_co2fxu,srf_oxflux,srf_niflux,srf_dms,srf_dmsprod, &
& srf_dms_bac,srf_dms_uv,srf_export,srf_exposi,srf_expoca, &
& srf_dic,srf_alkali,srf_phosph,srf_oxygen,srf_ano3,srf_silica, &
Expand Down Expand Up @@ -1195,9 +1211,18 @@ subroutine hamoccvardef(iogrp,timeunits,calendar,cmpflg)
call ncattr('bounds','depth_bnds')
call ncdefvar('depth_bnds','bounds depth',ndouble,8)
call ncdefvar3d(SRF_KWCO2(iogrp),cmpflg,'p', &
& 'kwco2',' ',' ',' ',0)
& 'kwco2','CO2 piston velocity',' ','m s-1',0)
call ncdefvar3d(SRF_KWCO2KHM(iogrp),cmpflg,'p', &
& 'kwco2khm','CO2 piston velocity times solubility (moist air)',' ', &
& 'm s-1 mol kg-1 muatm-1',0)
call ncdefvar3d(SRF_CO2KH(iogrp),cmpflg,'p', &
& 'co2kh','CO2 solubility (dry air)',' ','mol kg-1 atm-1',0)
call ncdefvar3d(SRF_CO2KHM(iogrp),cmpflg,'p', &
& 'co2khm','CO2 solubility (moist air)',' ','mol kg-1 atm-1',0)
call ncdefvar3d(SRF_PCO2(iogrp),cmpflg,'p', &
& 'pco2','Surface PCO2',' ','uatm',0)
call ncdefvar3d(SRF_PCO2M(iogrp),cmpflg,'p', &
& 'pco2m','Surface PCO2 (moist air)',' ','uatm',0)
call ncdefvar3d(SRF_DMSFLUX(iogrp), &
& cmpflg,'p','dmsflux','DMS flux',' ','mol DMS m-2 s-1',0)
call ncdefvar3d(SRF_CO2FXD(iogrp), &
Expand Down

0 comments on commit ca62d33

Please sign in to comment.