Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revise modules for handling of external inputs (N-dep, rinvers, iron)… #168

Merged
merged 2 commits into from
Jun 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions hamocc/accfields.F90
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ SUBROUTINE ACCFIELDS(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask)
! *REAL* *omask* - land/ocean mask
!
!**********************************************************************
use mo_carbch, only: atm,atmflx,co2fxd,co2fxu,co3,hi,kwco2sol,ndepflx,ocetra,omegaa,omegac,pco2d,satoxy,sedfluxo
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_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
use mod_dia, only: ddm
use mod_xc, only: mnproc
use mo_bgcmean, only: domassfluxes,jalkali,jano3,jasize,jatmco2,jbsiflx0100,jbsiflx0500,jbsiflx1000,jbsiflx2000, &
& jbsiflx4000,jbsiflx_bot,jcalc,jcalflx0100,jcalflx0500,jcalflx1000,jcalflx2000,jcalflx4000, &
& jcalflx_bot,jcarflx0100,jcarflx0500,jcarflx1000,jcarflx2000,jcarflx4000,jcarflx_bot, &
Expand All @@ -69,9 +69,8 @@ SUBROUTINE ACCFIELDS(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask)
& acclyr,accsrf,bgczlv
use mo_control_bgc, only: io_stdo_bgc
use mo_param1_bgc, only: ialkali,ian2o,iano3,iatmco2,iatmdms,iatmn2,iatmn2o,iatmo2,icalc,idet,idms,idicsat,idoc,iiron,iopal,&
& ioxygen,iphosph,iphy,iprefalk,iprefdic,iprefpo4,iprefo2,isco212,isilica,izoo
use mo_riverinpt, only: irdin,irdip,irsi,iralk,iriron,irdoc,irdet,rivinflx
use mod_config, only: expcnf
& ioxygen,iphosph,iphy,iprefalk,iprefdic,iprefpo4,iprefo2,isco212,isilica,izoo, &
& irdin,irdip,irsi,iralk,iriron,irdoc,irdet

#ifdef AGG
use mo_biomod, only: asize3d,eps3d,wnumb,wmass
Expand Down
21 changes: 14 additions & 7 deletions hamocc/hamocc4bcm.F90
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,11 @@ SUBROUTINE HAMOCC4BCM(kpie,kpje,kpke,kbnd,kplyear,kplmon,kplday,kldtday,&
use mo_biomod, only: strahl
use mo_control_bgc, only: ldtrunbgc,dtbgc,ldtbgc,io_stdo_bgc,dtbgc,ndtdaybgc, &
do_sedspinup,sedspin_yr_s,sedspin_yr_e,sedspin_ncyc
use mo_param1_bgc, only: iatmco2,iatmdms,nocetra
use mo_param1_bgc, only: iatmco2,iatmdms,nocetra,nriv
use mo_vgrid, only: set_vgrid
use mo_riverinpt, only: riverinpt,nriv
use mo_ndep, only: n_deposition
use mo_apply_fedep, only: apply_fedep
use mo_apply_rivin, only: apply_rivin
use mo_apply_ndep, only: apply_ndep
#if defined(BOXATM)
use mo_boxatm, only: update_boxatm
#endif
Expand Down Expand Up @@ -211,8 +212,14 @@ SUBROUTINE HAMOCC4BCM(kpie,kpje,kpke,kbnd,kplyear,kplmon,kplday,kldtday,&
!---------------------------------------------------------------------
! Biogeochemistry
!
CALL OCPROD(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,dust,ptho,&
& pi_ph)
! Apply dust (iron) deposition
! This routine should be moved to the other routines that handle
! external inputs below for consistency. For now we keep it here
! to maintain bit-for-bit reproducibility with the CMIP6 version of
! the model
CALL apply_fedep(kpie,kpje,kpke,pddpo,omask,dust)

CALL OCPROD(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph)

#ifdef PBGC_CK_TIMESTEP
IF (mnproc.eq.1) THEN
Expand Down Expand Up @@ -270,7 +277,7 @@ SUBROUTINE HAMOCC4BCM(kpie,kpje,kpke,kbnd,kplyear,kplmon,kplday,kldtday,&


! Apply n-deposition
CALL n_deposition(kpie,kpje,kpke,pddpo,omask,ndep)
CALL apply_ndep(kpie,kpje,kpke,pddpo,omask,ndep)

#ifdef PBGC_CK_TIMESTEP
IF (mnproc.eq.1) THEN
Expand All @@ -281,7 +288,7 @@ SUBROUTINE HAMOCC4BCM(kpie,kpje,kpke,kbnd,kplyear,kplmon,kplday,kldtday,&
#endif

! Apply riverine input of carbon and nutrients
call riverinpt(kpie,kpje,kpke,pddpo,omask,rivin)
call apply_rivin(kpie,kpje,kpke,pddpo,omask,rivin)

#ifdef PBGC_CK_TIMESTEP
IF (mnproc.eq.1) THEN
Expand Down
20 changes: 9 additions & 11 deletions hamocc/hamocc_init.F
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,17 @@ subroutine hamocc_init(read_rest,rstfnm_hamocc)
use mo_sedmnt, only: alloc_mem_sedmnt,sedlay,powtra,burial
use mo_vgrid, only: alloc_mem_vgrid,set_vgrid
use mo_bgcmean, only: alloc_mem_bgcmean
use mo_fedep, only: ini_fedep,fedepfile
use mo_read_rivin, only: ini_read_rivin,rivinfile
use mo_read_fedep, only: ini_read_fedep,fedepfile
use mo_read_ndep, only: ini_read_ndep,ndepfile
use mo_read_pi_ph, only: ini_pi_ph,pi_ph_file
use mo_clim_swa, only: ini_swa_clim,swaclimfile
use mo_ndep, only: ini_ndep,ndepfile
use mo_Gdata_read, only: inidic,inialk,inipo4,inioxy,inino3,
. inisil,inid13c,inid14c
use mo_riverinpt, only: ini_riverinpt,rivinfile,
. alloc_mem_riverinpt_bgm
use mo_intfcblom, only: alloc_mem_intfcblom,nphys,
. bgc_dx,bgc_dy,bgc_dp,bgc_rho,
. omask,sedlay2,powtra2,burial2,
. blom2hamocc
use mo_read_pi_ph, only: ini_pi_ph,pi_ph_file
#ifdef BOXATM
use mo_intfcblom, only: atm2
#endif
Expand Down Expand Up @@ -140,7 +139,6 @@ subroutine hamocc_init(read_rest,rstfnm_hamocc)
CALL ALLOC_MEM_BIOMOD(idm,jdm,kdm)
CALL ALLOC_MEM_SEDMNT(idm,jdm)
CALL ALLOC_MEM_CARBCH(idm,jdm,kdm)
c$$$ CALL ALLOC_MEM_RIVERINPT_BGM(idm,jdm,omask)
c
c --- initialise trc array (two time levels)
c
Expand Down Expand Up @@ -182,18 +180,18 @@ subroutine hamocc_init(read_rest,rstfnm_hamocc)
CALL BELEG_VARS(read_rest,idm,jdm,kdm,nbdy,bgc_dp,bgc_rho,omask,
. plon,plat)
c
c --- Initialise dust input, n-deposition and river input
c --- Initialise reading of input data (dust, n-deposition, river, etc.)
c
CALL ini_fedep(idm,jdm,omask)
CALL ini_read_fedep(idm,jdm,omask)

CALL ini_ndep(idm,jdm)
CALL ini_read_ndep(idm,jdm)

CALL ini_read_rivin(idm,jdm,omask)

#ifdef BROMO
CALL ini_swa_clim(idm,jdm,omask)
#endif

CALL INI_RIVERINPT(idm,jdm,omask)

call ini_pi_ph(idm,jdm,omask)
c
c --- Read restart fields from restart file if requested, otherwise
Expand Down
6 changes: 3 additions & 3 deletions hamocc/hamocc_step.F
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ subroutine hamocc_step(m,n,mm,nn,k1m,k1n)
. diagann_bgc
use mo_intfcblom, only: bgc_dx,bgc_dy,bgc_dp,bgc_rho,omask,
. blom2hamocc,hamocc2blom
use mo_riverinpt, only: rivflx
use mo_fedep, only: get_fedep
use mo_ndep, only: get_ndep
use mo_read_rivin, only: rivflx
use mo_read_fedep, only: get_fedep
use mo_read_ndep, only: get_ndep
use mo_read_pi_ph, only: get_pi_ph,pi_ph
use mo_control_bgc, only: with_dmsph
c
Expand Down
9 changes: 3 additions & 6 deletions hamocc/inventory_bgc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,16 @@ SUBROUTINE INVENTORY_BGC(kpie,kpje,kpke,dlxp,dlyp,ddpo,omask,iogrp)
! none.
!
!**********************************************************************

use mo_carbch, only: atm,atmflx,co3,hi,ndepflx,ocetra,sedfluxo
use mod_xc, only: mnproc,ips,nbdy,xcsum
use mo_carbch, only: atm,atmflx,co3,hi,ndepflx,rivinflx,ocetra,sedfluxo
use mo_sedmnt, only: prcaca,prorca,silpro
use mo_biomod, only: expoor,expoca,exposi,rcar,rnit
use mo_control_bgc, only: do_ndep,do_rivinpt,io_stdo_bgc
use mo_bgcmean, only: bgct2d,jco2flux,jirdin,jn2flux,jn2oflux,jndep,jo2flux,jprcaca,jprorca,jsilpro,nbgcmax,glb_inventory
use mo_param1_bgc, only: ialkali,ian2o,iano3,iatmco2,iatmn2,iatmn2o,iatmo2,icalc,idet,idoc,igasnit,iopal,ioxygen,iphosph, &
& iphy,ipowaic,ipowaox,ipowaph,ipowasi,ipown2,ipowno3,isco212,isilica,isssc12,issso12,issssil,izoo, &
& nocetra,npowtra,nsedtra
& irdin,irdip,irsi,iralk,irdoc,irdet,nocetra,npowtra,nsedtra,nriv
use mo_vgrid, only: dp_min
use mod_xc, only: mnproc,ips,nbdy,xcsum
use mod_config, only: expcnf
use mo_riverinpt, only: rivinflx,irdin,irdip,irsi,iralk,irdoc,irdet,nriv

# ifndef sedbypass
use mo_param1_bgc, only: ks
Expand Down
114 changes: 114 additions & 0 deletions hamocc/mo_apply_fedep.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
! Copyright (C) 2022 S. 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_apply_fedep
!********************************************************************************
!
! J. Schwinger, *NORCE climate, Bergen* 2022-05-19
!
!
! Purpose
! -------
! - Routines for applying iron deposition data
!
!
! Description:
! ------------
! Public routines and variable of this module:
!
! -subroutine apply_fedep
! apply iron deposition to the ocean tracer field
!
! This module replaces code previously found inside the ocprod-routine and
! encapsulates it in a module.
!
!
! Changes:
! --------
!
!********************************************************************************
implicit none

private
public :: apply_fedep

!********************************************************************************
contains


subroutine apply_fedep(kpie,kpje,kpke,pddpo,omask,dust)
!--------------------------------------------------------------------------------
!
! Purpose:
! --------
! Apply dust deposition input to oceanic tracer fields
!
! Description:
! ------------
!
!
! Arguments:
! ----------
! *INTEGER* *kpie* - 1st dimension of model grid.
! *INTEGER* *kpje* - 2nd dimension of model grid.
! *INTEGER* *kpke* - 3rd (vertical) dimension of model grid.
! *REAL* *pddpo* - size of scalar grid cell (3rd dimension) [m].
! *REAL* *omask* - ocean mask
! *REAL* *dust* - dust deposition flux [kg/m2/month].
!
!--------------------------------------------------------------------------------
use mo_control_bgc, only: dtb
use mo_param1_bgc, only: ifdust,iiron
use mo_biomod, only: perc_diron
use mo_carbch, only: ocetra

implicit none

integer,intent(in) :: kpie,kpje,kpke
real, intent(in) :: pddpo(kpie,kpje,kpke)
real, intent(in) :: omask(kpie,kpje)
real, intent(in) :: dust(kpie,kpje)

! local variables
integer :: i,j
real :: dustinp

! dust flux from the atmosphere to the surface layer; dust fields are
! monthly mean values (kg/m2/month - assume 30 days per month here)
! dissolved iron is a fixed fraction (typically 3.5%), and immediately released

!$OMP PARALLEL DO PRIVATE(i,dustinp)
do j = 1,kpje
do i = 1,kpie
if(omask(i,j) > 0.5) then
dustinp = dust(i,j) / 30. * dtb / pddpo(i,j,1)
ocetra(i,j,1,ifdust) = ocetra(i,j,1,ifdust) + dustinp
ocetra(i,j,1,iiron) = ocetra(i,j,1,iiron) + dustinp * perc_diron
endif
enddo
enddo
!$OMP END PARALLEL DO


!--------------------------------------------------------------------------------
end subroutine apply_fedep


!********************************************************************************
end module mo_apply_fedep

Loading