From 3a64f474d55d29567072aa368bd04cff5be7a666 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Sun, 29 Sep 2024 11:41:07 +0200 Subject: [PATCH 1/8] introduced use_nuopc_ndep to always obtain ndep from mediator --- cime_config/namelist_definition_blom.xml | 37 +++++++++++++++++------- drivers/nuopc/ocn_import_export.F90 | 11 +++++++ hamocc/mo_hamocc_init.F90 | 5 +++- hamocc/mo_read_ndep.F90 | 5 +++- phy/mod_forcing.F90 | 6 ++-- 5 files changed, 49 insertions(+), 15 deletions(-) diff --git a/cime_config/namelist_definition_blom.xml b/cime_config/namelist_definition_blom.xml index 26b1d48f..a27534dc 100644 --- a/cime_config/namelist_definition_blom.xml +++ b/cime_config/namelist_definition_blom.xml @@ -636,17 +636,6 @@ - - logical - limits - limits - - .false. - .true. - - if .true., use NUOPC stream relaxation capability - - real limits @@ -8738,6 +8727,32 @@ (ssster) [mol m-3] + + + + + + logical + limits + limits + + .false. + .true. + + if .true., use NUOPC stream relaxation capability + + + + logical + limits + limits + + .false. + .true. + + if .true., use NUOPC to obtain NDEP (always imported to model) + + diff --git a/drivers/nuopc/ocn_import_export.F90 b/drivers/nuopc/ocn_import_export.F90 index 1d4300b5..9064f686 100644 --- a/drivers/nuopc/ocn_import_export.F90 +++ b/drivers/nuopc/ocn_import_export.F90 @@ -43,6 +43,7 @@ module ocn_import_export rnf_da, rfi_da, fmltfz_da, sfl_da, ztx_da, mty_da, & ustarw_da, slp_da, abswnd_da, ficem_da, lamult_da, & lasl_da, ustokes_da, vstokes_da, atmco2_da, & + atmnhxdep_da, atmnoydep_da, & l1ci, l2ci use mod_utility, only: util1, util2 use mod_checksum, only: csdiag, chksummsk @@ -142,6 +143,7 @@ module ocn_import_export index_Faxa_lwdn = -1, & index_Faxa_snow = -1, & index_Faxa_rain = -1, & + index_Faxa_ndep = -1, & index_Sa_pslv = -1, & index_Sa_co2diag = -1, & index_Sa_co2prog = -1, & @@ -269,6 +271,8 @@ subroutine blom_advertise_imports(flds_scalar_name, fldsToOcn_num, fldsToOcn, & call fldlist_add(fldsToOcn_num, fldsToOcn, 'Faxa_lwdn' , index_Faxa_lwdn) call fldlist_add(fldsToOcn_num, fldsToOcn, 'Faxa_snow' , index_Faxa_snow) call fldlist_add(fldsToOcn_num, fldsToOcn, 'Faxa_rain' , index_Faxa_rain) + call fldlist_add(fldsToOcn_num, fldsToOcn, 'Faxa_ndep' , index_Faxa_ndep, & + ungridded_lbound=1, ungridded_ubound=2) if (flds_co2a .or. flds_co2c) then call fldlist_add(fldsToOcn_num, fldsToOcn, 'Sa_co2diag' ,index_Sa_co2diag) call fldlist_add(fldsToOcn_num, fldsToOcn, 'Sa_co2prog', index_Sa_co2prog) @@ -884,6 +888,9 @@ subroutine blom_importflds(fldlist_num, fldlist) ! Ice fraction []. ficem_da(i,j,l2ci) = fldlist(index_Si_ifrac)%dataptr(n) + ! Nitrogen deposition [kg m-2 s-1]. + atmnhxdep_da(i,j,l2ci) = fldlist(index_Faxa_ndep)%dataptr2d(n,1)*afac + atmnoydep_da(i,j,l2ci) = fldlist(index_Faxa_ndep)%dataptr2d(n,2)*afac endif enddo @@ -901,6 +908,8 @@ subroutine blom_importflds(fldlist_num, fldlist) call xctilr(swa_da(1-nbdy,1-nbdy,l2ci), 1,1, 0,0, halo_ps) call xctilr(nsf_da(1-nbdy,1-nbdy,l2ci), 1,1, 0,0, halo_ps) call xctilr(hmlt_da(1-nbdy,1-nbdy,l2ci), 1,1, 0,0, halo_ps) + call xctilr(atmnhxdep_da(1-nbdy,1-nbdy,l2ci), 1,1, 0,0, halo_ps) + call xctilr(atmnoydep_da(1-nbdy,1-nbdy,l2ci), 1,1, 0,0, halo_ps) endif call fill_global(mval, fval, halo_ps, slp_da(1-nbdy,1-nbdy,l2ci)) @@ -1034,6 +1043,8 @@ subroutine blom_importflds(fldlist_num, fldlist) call chksummsk(abswnd_da(1-nbdy,1-nbdy,l2ci),ip,1,'abswnd') call chksummsk( ficem_da(1-nbdy,1-nbdy,l2ci),ip,1,'ficem') call chksummsk(atmco2_da(1-nbdy,1-nbdy,l2ci),ip,1,'atmco2') + call chksummsk(atmnhxdep_da(1-nbdy,1-nbdy,l2ci),ip,1,'atmnhxdep') + call chksummsk(atmnoydep_da(1-nbdy,1-nbdy,l2ci),ip,1,'atmnoydep') endif if (first_call) then diff --git a/hamocc/mo_hamocc_init.F90 b/hamocc/mo_hamocc_init.F90 index edc7c60d..5b73b65d 100644 --- a/hamocc/mo_hamocc_init.F90 +++ b/hamocc/mo_hamocc_init.F90 @@ -38,6 +38,7 @@ subroutine hamocc_init(read_rest,rstfnm_hamocc) use mod_time, only: date,baclin use mod_xc, only: ii,jj,kk,idm,jdm,kdm,nbdy,isp,ifp,ilp,mnproc,lp,xchalt use mod_grid, only: plon,plat + use mod_forcing, only: use_nuopc_ndep use mod_tracers, only: ntrbgc,ntr,itrbgc,trc use mo_control_bgc, only: bgc_namelist,get_bgc_namelist,do_ndep,do_rivinpt,do_oalk, & do_sedspinup,sedspin_yr_s,sedspin_yr_e,sedspin_ncyc, & @@ -198,7 +199,9 @@ subroutine hamocc_init(read_rest,rstfnm_hamocc) ! --- Initialise reading of input data (dust, n-deposition, river, etc.) ! call ini_read_fedep(idm,jdm,omask) - call ini_read_ndep(idm,jdm) + if (.not. use_nuopc_ndep) then + call ini_read_ndep(idm,jdm) + end if call ini_read_rivin(idm,jdm,omask) call ini_read_oafx(idm,jdm,bgc_dx,bgc_dy,plat,omask) if (use_BROMO) then diff --git a/hamocc/mo_read_ndep.F90 b/hamocc/mo_read_ndep.F90 index 723e2c24..a398cb81 100644 --- a/hamocc/mo_read_ndep.F90 +++ b/hamocc/mo_read_ndep.F90 @@ -181,6 +181,7 @@ subroutine get_ndep(kpie,kpje,kbnd,kplyear,kplmon,omask,ndep,patmnhxdep,patmnoyd !*********************************************************************************************** use mod_xc, only: mnproc + use mod_forcing, only: use_nuopc_ndep use netcdf, only: nf90_open,nf90_close,nf90_nowrite use mo_control_bgc, only: io_stdo_bgc,do_ndep,use_extNcycle, do_ndep_coupled use mo_netcdf_bgcrw, only: read_netcdf_var @@ -209,7 +210,9 @@ subroutine get_ndep(kpie,kpje,kbnd,kplyear,kplmon,omask,ndep,patmnhxdep,patmnoyd return endif - if (use_extNcycle .and. do_ndep_coupled) then + ! Note - if use_nuopc_ndep - then nitrogen deposition is ALWAYS obtained from the + ! nuopc mediator + if (use_nuopc_ndep .or. (use_extNcycle .and. do_ndep_coupled)) then ! get N-deposition from atmosphere fatmndep = 365.*86400./mw_nitrogen diff --git a/phy/mod_forcing.F90 b/phy/mod_forcing.F90 index f5339acb..8067f4db 100644 --- a/phy/mod_forcing.F90 +++ b/phy/mod_forcing.F90 @@ -96,9 +96,10 @@ module mod_forcing sst_stream, & ! Sea-surface temperature [deg C] from stream data. ice_stream, & ! Sea-ice concentration [] from stream data. sss_stream ! Sea-surface salinity [g kg-1] from stream data. - logical :: use_stream_relaxation ! If true, use nuopc stream relaxation capability + logical :: use_nuopc_ndep ! If true, use nuopc input for rivin fluxes + ! Variables related to balancing the freshwater forcing budget. real(r8) :: & prfac ! Correction factor for precipitation and runoff []. @@ -182,7 +183,8 @@ module mod_forcing surflx, surrlx, sswflx, salflx, brnflx, salrlx, taux, tauy, & ustar, ustarb, ustar3, wstar3, buoyfl, t_sw_nonloc, t_rs_nonloc, & s_br_nonloc, s_rs_nonloc, inivar_forcing, fwbbal, & - sss_stream, sst_stream, ice_stream, use_stream_relaxation + sss_stream, sst_stream, ice_stream, use_stream_relaxation, & + use_nuopc_ndep contains From c54a2d7148b85489471d5e2083ee605998967ec6 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Mon, 30 Sep 2024 09:16:03 +0200 Subject: [PATCH 2/8] removed some ifdefs from mod_ifdefs and put in mod_xc and updated logic for obtaining ndep from cmeps --- cesm/mod_cesm.F90 | 4 +- cime_config/buildcpp | 3 -- cime_config/namelist_definition_blom.xml | 22 ++++++++- drivers/nuopc/ocn_import_export.F90 | 4 +- hamocc/mo_read_ndep.F90 | 57 ++++++++++++++---------- phy/mod_ifdefs.F90 | 32 +------------ phy/mod_rdlim.F90 | 10 ++++- phy/mod_xc.F90 | 11 ++++- 8 files changed, 77 insertions(+), 66 deletions(-) diff --git a/cesm/mod_cesm.F90 b/cesm/mod_cesm.F90 index 076bef6b..e7f7f728 100644 --- a/cesm/mod_cesm.F90 +++ b/cesm/mod_cesm.F90 @@ -242,7 +242,7 @@ subroutine getfrc_cesm call ncdefvar('atmbrf_da', 'x y', ndouble, 8) call ncdefvar('atmn2o_da', 'x y', ndouble, 8) call ncdefvar('atmnh3_da', 'x y', ndouble, 8) - call ncdefvar('atmnoydep_da', 'x y', ndouble, 8) + call ncdefvar('atmnhxdep_da', 'x y', ndouble, 8) call ncdefvar('atmnoydep_da', 'x y', ndouble, 8) call ncdefvar('ztx_da', 'x y', ndouble, 8) call ncdefvar('mty_da', 'x y', ndouble, 8) @@ -301,8 +301,6 @@ subroutine getfrc_cesm call ncwrtr('mty_da', 'x y', mty_da(1 - nbdy, 1 - nbdy, l2ci), & iv, 1, 1._r8, 0._r8, 8) call ncfcls - call xcstop('(getfrc_cesm)') - stop '(getfrc_cesm)' end if if (csdiag) then diff --git a/cime_config/buildcpp b/cime_config/buildcpp index c4355114..92fb7b1f 100644 --- a/cime_config/buildcpp +++ b/cime_config/buildcpp @@ -89,9 +89,6 @@ def buildcpp(case): if pio_typename == "pnetcdf": blom_cppdefs = blom_cppdefs + " -DPNETCDF" - if ocn_grid in ["tnx2v1", "tnx1.5v1", "tnx1v1", "tnx1v3", "tnx1v4", "tnx0.5v1", "tnx0.25v1", "tnx0.25v3", "tnx0.25v4", "tnx0.125v4"]: - blom_cppdefs = blom_cppdefs + " -DARCTIC" - if ocn_grid in ["gx1v5", "gx1v6", "tnx1v1", "tnx1v3", "tnx1v4", "tnx0.5v1", "tnx0.25v1", "tnx0.25v3", "tnx0.25v4", "tnx0.125v4"]: blom_cppdefs = blom_cppdefs + " -DLEVITUS2X" diff --git a/cime_config/namelist_definition_blom.xml b/cime_config/namelist_definition_blom.xml index a27534dc..c91b34e9 100644 --- a/cime_config/namelist_definition_blom.xml +++ b/cime_config/namelist_definition_blom.xml @@ -892,6 +892,26 @@ 0 = netcdf, 1 = pnetcdf + + logical + limits + limits + + .false. + + optionally turn on additional diagnostics + + + + logical + limits + limits + + .true. + + if region includes arctic ocean + + @@ -6040,7 +6060,7 @@ 0,0,0 0,0,0 - AMELIST FOR DIAGNOSTIC iHAMOCC OUTPUT + namelist for diagnostic iHAMOCC output diff --git a/drivers/nuopc/ocn_import_export.F90 b/drivers/nuopc/ocn_import_export.F90 index 9064f686..4a718509 100644 --- a/drivers/nuopc/ocn_import_export.F90 +++ b/drivers/nuopc/ocn_import_export.F90 @@ -889,8 +889,8 @@ subroutine blom_importflds(fldlist_num, fldlist) ficem_da(i,j,l2ci) = fldlist(index_Si_ifrac)%dataptr(n) ! Nitrogen deposition [kg m-2 s-1]. - atmnhxdep_da(i,j,l2ci) = fldlist(index_Faxa_ndep)%dataptr2d(n,1)*afac - atmnoydep_da(i,j,l2ci) = fldlist(index_Faxa_ndep)%dataptr2d(n,2)*afac + atmnhxdep_da(i,j,l2ci) = fldlist(index_Faxa_ndep)%dataptr2d(1,n)*afac + atmnoydep_da(i,j,l2ci) = fldlist(index_Faxa_ndep)%dataptr2d(2,n)*afac endif enddo diff --git a/hamocc/mo_read_ndep.F90 b/hamocc/mo_read_ndep.F90 index a398cb81..13c6d816 100644 --- a/hamocc/mo_read_ndep.F90 +++ b/hamocc/mo_read_ndep.F90 @@ -90,14 +90,14 @@ subroutine ini_read_ndep(kpie,kpje) ! Return if N deposition is turned off if (.not. do_ndep) then - if (mnproc.eq.1) then + if (mnproc == 1) then write(io_stdo_bgc,*) '' write(io_stdo_bgc,*) 'ini_read_ndep: N deposition is not activated.' endif return endif if (do_ndep_coupled) then - if (mnproc.eq.1) then + if (mnproc == 1) then write(io_stdo_bgc,*) '' write(io_stdo_bgc,*) 'ini_read_ndep: N deposition in interactive mode.' endif @@ -107,7 +107,7 @@ subroutine ini_read_ndep(kpie,kpje) ! Initialise the module if (.not. lini) then - if (mnproc.eq.1) then + if (mnproc == 1) then write(io_stdo_bgc,*)' ' write(io_stdo_bgc,*)'***************************************************' write(io_stdo_bgc,*)'iHAMOCC: Initialization of module mo_read_ndep:' @@ -116,7 +116,7 @@ subroutine ini_read_ndep(kpie,kpje) ! Check if nitrogen deposition file exists. If not, abort. inquire(file=ndepfile,exist=file_exists) - if (.not. file_exists .and. mnproc.eq.1) then + if (.not. file_exists .and. mnproc == 1) then write(io_stdo_bgc,*) '' write(io_stdo_bgc,*) 'ini_read_ndep: Cannot find N deposition file... ' call xchalt('(ini_read_ndep)') @@ -125,32 +125,32 @@ subroutine ini_read_ndep(kpie,kpje) if (use_extNcycle) then ! Allocate field to hold N-deposition fluxes - if (mnproc.eq.1) then + if (mnproc == 1) then write(io_stdo_bgc,*)'Memory allocation for variable nhxdepread ...' write(io_stdo_bgc,*)'First dimension : ',kpie write(io_stdo_bgc,*)'Second dimension : ',kpje endif allocate (nhxdepread(kpie,kpje),stat=errstat) - if(errstat.ne.0) stop 'not enough memory nhxdepread' + if(errstat /= 0) stop 'not enough memory nhxdepread' nhxdepread(:,:) = 0.0 - if (mnproc.eq.1) then + if (mnproc == 1) then write(io_stdo_bgc,*)'Memory allocation for variable noydepread ...' write(io_stdo_bgc,*)'First dimension : ',kpie write(io_stdo_bgc,*)'Second dimension : ',kpje endif allocate (noydepread(kpie,kpje),stat=errstat) - if(errstat.ne.0) stop 'not enough memory noydepread' + if(errstat /= 0) stop 'not enough memory noydepread' noydepread(:,:) = 0.0 else ! Allocate field to hold N-deposition fluxes - if (mnproc.eq.1) then + if (mnproc == 1) then write(io_stdo_bgc,*)'Memory allocation for variable ndepread ...' write(io_stdo_bgc,*)'First dimension : ',kpie write(io_stdo_bgc,*)'Second dimension : ',kpje endif allocate (ndepread(kpie,kpje),stat=errstat) - if(errstat.ne.0) stop 'not enough memory ndep' + if(errstat /= 0) stop 'not enough memory ndep' ndepread(:,:) = 0.0 endif @@ -160,7 +160,7 @@ subroutine ini_read_ndep(kpie,kpje) call ncgeti('endyear',endyear) call ncfcls - if (mnproc.eq.1) then + if (mnproc == 1) then write(io_stdo_bgc,*) '' write(io_stdo_bgc,*) 'ini_read_ndep: Using N deposition file '//trim(ndepfile) endif @@ -183,7 +183,7 @@ subroutine get_ndep(kpie,kpje,kbnd,kplyear,kplmon,omask,ndep,patmnhxdep,patmnoyd use mod_xc, only: mnproc use mod_forcing, only: use_nuopc_ndep use netcdf, only: nf90_open,nf90_close,nf90_nowrite - use mo_control_bgc, only: io_stdo_bgc,do_ndep,use_extNcycle, do_ndep_coupled + use mo_control_bgc, only: io_stdo_bgc, do_ndep, use_extNcycle, do_ndep_coupled use mo_netcdf_bgcrw, only: read_netcdf_var use mo_param1_bgc, only: nndep,idepnoy,idepnhx use mo_chemcon, only: mw_nitrogen @@ -210,14 +210,14 @@ subroutine get_ndep(kpie,kpje,kbnd,kplyear,kplmon,omask,ndep,patmnhxdep,patmnoyd return endif - ! Note - if use_nuopc_ndep - then nitrogen deposition is ALWAYS obtained from the + ! If use_nuopc_ndep, nitrogen deposition is ALWAYS obtained from the ! nuopc mediator - if (use_nuopc_ndep .or. (use_extNcycle .and. do_ndep_coupled)) then + if ((use_nuopc_ndep) .or. (use_extNcycle .and. do_ndep_coupled)) then ! get N-deposition from atmosphere fatmndep = 365.*86400./mw_nitrogen ndep(:,:,:) = 0. - !$OMP PARALLEL DO PRIVATE(i) + !$omp parallel do private(i) do j=1,kpje do i=1,kpie ! convert from kgN/m2/s to climatological input file units: kmolN/m2/yr @@ -229,17 +229,28 @@ subroutine get_ndep(kpie,kpje,kbnd,kplyear,kplmon,omask,ndep,patmnhxdep,patmnoyd endif enddo enddo - !$OMP END PARALLEL DO - if (mnproc .eq. 1) then + !$omp end parallel do + if (mnproc == 1) then write (io_stdo_bgc,*) 'iHAMOCC: getting NOy and NHx deposition from atm' endif + if (use_nuopc_ndep .and. .not. use_extNcycle) then + ! Reduced and oxidized forms will all enter the NO3 pool + !$omp parallel do private(i) + do j=1,kpje + do i=1,kpie + ndep(i,j,idepnoy) = ndep(i,j,idepnoy) + ndep(i,j,idepnhx) + enddo + enddo + !$omp end parallel do + end if + else ! read ndep data from file - if (kplmon.ne.oldmonth) then + if (kplmon /= oldmonth) then month_in_file=(max(startyear,min(endyear,kplyear))-startyear)*12+kplmon - if (mnproc.eq.1) then + if (mnproc == 1) then write(io_stdo_bgc,*) 'Read N deposition month ',month_in_file,' from file ',trim(ndepfile) endif ncstat=nf90_open(trim(ndepfile),nf90_nowrite,ncid) @@ -253,10 +264,10 @@ subroutine get_ndep(kpie,kpje,kbnd,kplyear,kplmon,omask,ndep,patmnhxdep,patmnoyd oldmonth=kplmon endif - !$OMP PARALLEL DO PRIVATE(i) + !$omp parallel do private(i) ! 1 = NO3; 2 = NH4 - do j=1,kpje - do i=1,kpie + do j=1,kpje + do i=1,kpie if (use_extNcycle) then ndep(i,j,idepnoy) = noydepread(i,j) ndep(i,j,idepnhx) = nhxdepread(i,j) @@ -265,7 +276,7 @@ subroutine get_ndep(kpie,kpje,kbnd,kplyear,kplmon,omask,ndep,patmnhxdep,patmnoyd endif enddo enddo - !$OMP END PARALLEL DO + !$omp end parallel do endif end subroutine get_ndep diff --git a/phy/mod_ifdefs.F90 b/phy/mod_ifdefs.F90 index a525a680..3af811f9 100644 --- a/phy/mod_ifdefs.F90 +++ b/phy/mod_ifdefs.F90 @@ -38,41 +38,13 @@ module mod_ifdefs #else logical :: use_IDLAGE = .false. #endif -#ifdef TIMER - logical :: use_TIMER = .true. -#else - logical :: use_TIMER = .false. -#endif -#ifdef DEBUG_TIMER - logical :: use_DEBUG_TIMER = .true. -#else - logical :: use_DEBUG_TIMER = .false. -#endif -#ifdef DEBUG_TIMER_ALL - logical :: use_DEBUG_TIMER_ALL = .true. -#else - logical :: use_DEBUG_TIMER_ALL = .false. -#endif -#ifdef DEBUG_ALL - logical :: use_DEBUG_ALL = .true. -#else - logical :: use_DEBUG_ALL = .false. -#endif -#ifdef ARCTIC - logical :: use_ARCTIC = .true. -#else - logical :: use_ARCTIC = .false. -#endif #ifdef MKS logical :: use_MKS = .true. #else logical :: use_MKS = .false. #endif -#ifdef DIAG - logical :: use_DIAG = .true. -#else - logical :: use_DIAG = .false. -#endif + ! Namelist input + logical :: use_diag = .false. end module mod_ifdefs diff --git a/phy/mod_rdlim.F90 b/phy/mod_rdlim.F90 index c3424a51..e5956b0e 100644 --- a/phy/mod_rdlim.F90 +++ b/phy/mod_rdlim.F90 @@ -28,7 +28,7 @@ module mod_rdlim nstep2, nstep, lstep, nstep_in_day, time0, & time, baclin, batrop, init_timevars, & set_day_of_year, step_time - use mod_xc, only: xcbcst, xchalt, xcstop, mnproc, lp + use mod_xc, only: xcbcst, xchalt, xcstop, mnproc, lp, use_arctic use mod_grid, only: grfile use mod_eos, only: pref use mod_inicon, only: icfile @@ -107,6 +107,7 @@ module mod_rdlim use mod_budget, only: cnsvdi use mod_checksum, only: csdiag use mod_nctools, only: ncfopn, ncgeti, ncgetr, ncfcls + use mod_ifdefs, only: use_diag implicit none private @@ -142,7 +143,8 @@ subroutine rdlim() itest,jtest, & cnsvdi, & csdiag, & - rstfrq,rstfmt,rstcmp,iotype,use_stream_relaxation + rstfrq,rstfmt,rstcmp,iotype,use_stream_relaxation, & + use_diag, use_arctic ! read limits namelist @@ -247,6 +249,8 @@ subroutine rdlim() write (lp,*) 'RSTCMP',RSTCMP write (lp,*) 'IOTYPE',IOTYPE write (lp,*) 'USE_STREAM_RELAXATION',use_stream_relaxation + write (lp,*) 'USE_DIAG',use_diag + write (lp,*) 'USE_ARCTIC',use_arctic write (lp,*) end if @@ -330,6 +334,8 @@ subroutine rdlim() call xcbcst(rstcmp) call xcbcst(iotype) call xcbcst(use_stream_relaxation) + call xcbcst(use_diag) + call xcbcst(use_arctic) ! resolve options select case (trim(wavsrc)) diff --git a/phy/mod_xc.F90 b/phy/mod_xc.F90 index 184f71f5..f87aad96 100644 --- a/phy/mod_xc.F90 +++ b/phy/mod_xc.F90 @@ -25,8 +25,6 @@ module mod_xc use dimensions, only: idm,jdm,kdm,itdm,jtdm,iqr,jqr,ijqr,& ii_pe,jj_pe,i0_pe,j0_pe,nreg use mod_wtime, only: wtime - use mod_ifdefs, only: use_TIMER, use_DEBUG_TIMER, use_DEBUG_TIMER_ALL, & - use_DEBUG_ALL, use_ARCTIC implicit none public @@ -171,6 +169,15 @@ module mod_xc real, private :: al(itdm,jdm),ala(itdm,jdm,jqr),at(idm*jdm),ata(idm*jdm,iqr) #endif + ! debug flags + logical :: use_DEBUG_TIMER = .false. + logical :: use_DEBUG_TIMER_ALL = .false. + logical :: use_DEBUG_ALL = .false. + logical :: use_TIMER = .false. + + ! other namelist flags + logical :: use_ARCTIC = .true. + contains !************************************************************************************** From 944dd2b3caf0044a2dd13ea374e45cb1161a872a Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Wed, 2 Oct 2024 12:19:35 +0200 Subject: [PATCH 3/8] place use_nuopc_ndep in mo_control_bgc --- cime_config/namelist_definition_blom.xml | 23 ++++++++++++----------- hamocc/mo_control_bgc.F90 | 1 + hamocc/mo_hamocc_init.F90 | 4 ++-- hamocc/mo_param1_bgc.F90 | 2 +- hamocc/mo_read_ndep.F90 | 3 +-- phy/mod_forcing.F90 | 5 +---- 6 files changed, 18 insertions(+), 20 deletions(-) diff --git a/cime_config/namelist_definition_blom.xml b/cime_config/namelist_definition_blom.xml index c91b34e9..ecebfe3a 100644 --- a/cime_config/namelist_definition_blom.xml +++ b/cime_config/namelist_definition_blom.xml @@ -3839,6 +3839,18 @@ File name (incl. full path) for atmopheric N-deposition data + + logical + bgcnml + bgcnml + + .false. + .true. + + if .true., use NUOPC to obtain NDEP (always imported to model) and ignore the + settings of do_ndep_coupled and ndepfile, whereas the setting of do_ndep is still used + + logical bgcnml @@ -8762,17 +8774,6 @@ if .true., use NUOPC stream relaxation capability - - logical - limits - limits - - .false. - .true. - - if .true., use NUOPC to obtain NDEP (always imported to model) - - diff --git a/hamocc/mo_control_bgc.F90 b/hamocc/mo_control_bgc.F90 index 18fa9521..3235710e 100644 --- a/hamocc/mo_control_bgc.F90 +++ b/hamocc/mo_control_bgc.F90 @@ -82,6 +82,7 @@ module mo_control_bgc logical :: use_BOXATM = .false. logical :: use_sedbypass = .false. logical :: use_extNcycle = .false. + logical :: use_nuopc_ndep = .false. logical :: use_pref_tracers = .true. contains diff --git a/hamocc/mo_hamocc_init.F90 b/hamocc/mo_hamocc_init.F90 index 5b73b65d..e1e42f8e 100644 --- a/hamocc/mo_hamocc_init.F90 +++ b/hamocc/mo_hamocc_init.F90 @@ -38,14 +38,14 @@ subroutine hamocc_init(read_rest,rstfnm_hamocc) use mod_time, only: date,baclin use mod_xc, only: ii,jj,kk,idm,jdm,kdm,nbdy,isp,ifp,ilp,mnproc,lp,xchalt use mod_grid, only: plon,plat - use mod_forcing, only: use_nuopc_ndep use mod_tracers, only: ntrbgc,ntr,itrbgc,trc use mo_control_bgc, only: bgc_namelist,get_bgc_namelist,do_ndep,do_rivinpt,do_oalk, & do_sedspinup,sedspin_yr_s,sedspin_yr_e,sedspin_ncyc, & dtb,dtbgc,io_stdo_bgc,ldtbgc, & ldtrunbgc,ndtdaybgc,with_dmsph,l_3Dvarsedpor,use_M4AGO, & do_ndep_coupled,lkwrbioz_off,do_n2onh3_coupled, & - ocn_co2_type, use_sedbypass, use_BOXATM, use_BROMO,use_extNcycle + ocn_co2_type, use_sedbypass, use_BOXATM, use_BROMO,use_extNcycle, & + use_nuopc_ndep use mo_param1_bgc, only: ks,init_por2octra_mapping use mo_param_bgc, only: ini_parambgc use mo_carbch, only: alloc_mem_carbch,ocetra,atm,atm_co2 diff --git a/hamocc/mo_param1_bgc.F90 b/hamocc/mo_param1_bgc.F90 index 391cc219..705c7efa 100644 --- a/hamocc/mo_param1_bgc.F90 +++ b/hamocc/mo_param1_bgc.F90 @@ -30,7 +30,7 @@ module mo_param1_bgc use mo_control_bgc, only: use_BROMO, use_AGG, use_WLIN, use_natDIC, use_CFC, & use_cisonew, use_PBGC_OCNP_TIMESTEP, use_PBGC_CK_TIMESTEP, & use_FB_BGC_OCE, use_BOXATM, use_sedbypass, use_extNcycle, & - use_pref_tracers + use_pref_tracers, use_nuopc_ndep implicit none public diff --git a/hamocc/mo_read_ndep.F90 b/hamocc/mo_read_ndep.F90 index 13c6d816..ecb4ae66 100644 --- a/hamocc/mo_read_ndep.F90 +++ b/hamocc/mo_read_ndep.F90 @@ -181,9 +181,8 @@ subroutine get_ndep(kpie,kpje,kbnd,kplyear,kplmon,omask,ndep,patmnhxdep,patmnoyd !*********************************************************************************************** use mod_xc, only: mnproc - use mod_forcing, only: use_nuopc_ndep use netcdf, only: nf90_open,nf90_close,nf90_nowrite - use mo_control_bgc, only: io_stdo_bgc, do_ndep, use_extNcycle, do_ndep_coupled + use mo_control_bgc, only: io_stdo_bgc, do_ndep, use_extNcycle, do_ndep_coupled, use_nuopc_ndep use mo_netcdf_bgcrw, only: read_netcdf_var use mo_param1_bgc, only: nndep,idepnoy,idepnhx use mo_chemcon, only: mw_nitrogen diff --git a/phy/mod_forcing.F90 b/phy/mod_forcing.F90 index 8067f4db..80f9eff5 100644 --- a/phy/mod_forcing.F90 +++ b/phy/mod_forcing.F90 @@ -98,8 +98,6 @@ module mod_forcing sss_stream ! Sea-surface salinity [g kg-1] from stream data. logical :: use_stream_relaxation ! If true, use nuopc stream relaxation capability - logical :: use_nuopc_ndep ! If true, use nuopc input for rivin fluxes - ! Variables related to balancing the freshwater forcing budget. real(r8) :: & prfac ! Correction factor for precipitation and runoff []. @@ -183,8 +181,7 @@ module mod_forcing surflx, surrlx, sswflx, salflx, brnflx, salrlx, taux, tauy, & ustar, ustarb, ustar3, wstar3, buoyfl, t_sw_nonloc, t_rs_nonloc, & s_br_nonloc, s_rs_nonloc, inivar_forcing, fwbbal, & - sss_stream, sst_stream, ice_stream, use_stream_relaxation, & - use_nuopc_ndep + sss_stream, sst_stream, ice_stream, use_stream_relaxation contains From 457c98f2975fe9fd56544582638dfddcce97df5f Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Wed, 2 Oct 2024 12:20:49 +0200 Subject: [PATCH 4/8] reverted mod_forcing to master --- phy/mod_forcing.F90 | 1 + 1 file changed, 1 insertion(+) diff --git a/phy/mod_forcing.F90 b/phy/mod_forcing.F90 index 80f9eff5..f5339acb 100644 --- a/phy/mod_forcing.F90 +++ b/phy/mod_forcing.F90 @@ -96,6 +96,7 @@ module mod_forcing sst_stream, & ! Sea-surface temperature [deg C] from stream data. ice_stream, & ! Sea-ice concentration [] from stream data. sss_stream ! Sea-surface salinity [g kg-1] from stream data. + logical :: use_stream_relaxation ! If true, use nuopc stream relaxation capability ! Variables related to balancing the freshwater forcing budget. From d90b354a9c73595ae52bb8dac24d674b5f80a6bd Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Wed, 2 Oct 2024 14:55:19 +0200 Subject: [PATCH 5/8] fixed namelist issue --- cime_config/namelist_definition_blom.xml | 4 ++-- hamocc/mo_param1_bgc.F90 | 6 +++--- phy/mod_rdlim.F90 | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cime_config/namelist_definition_blom.xml b/cime_config/namelist_definition_blom.xml index ecebfe3a..1ccde94a 100644 --- a/cime_config/namelist_definition_blom.xml +++ b/cime_config/namelist_definition_blom.xml @@ -3841,8 +3841,8 @@ logical - bgcnml - bgcnml + config_bgc + config_bgc .false. .true. diff --git a/hamocc/mo_param1_bgc.F90 b/hamocc/mo_param1_bgc.F90 index 705c7efa..f8d8fe29 100644 --- a/hamocc/mo_param1_bgc.F90 +++ b/hamocc/mo_param1_bgc.F90 @@ -30,7 +30,7 @@ module mo_param1_bgc use mo_control_bgc, only: use_BROMO, use_AGG, use_WLIN, use_natDIC, use_CFC, & use_cisonew, use_PBGC_OCNP_TIMESTEP, use_PBGC_CK_TIMESTEP, & use_FB_BGC_OCE, use_BOXATM, use_sedbypass, use_extNcycle, & - use_pref_tracers, use_nuopc_ndep + use_pref_tracers implicit none public @@ -242,12 +242,12 @@ subroutine init_indices() use mo_control_bgc, only: bgc_namelist,get_bgc_namelist, io_stdo_bgc use mo_control_bgc, only: use_BROMO,use_AGG,use_WLIN,use_natDIC,use_CFC,use_cisonew, & use_sedbypass,use_PBGC_OCNP_TIMESTEP,use_PBGC_CK_TIMESTEP, & - use_FB_BGC_OCE, use_BOXATM,use_extNcycle,use_pref_tracers + use_FB_BGC_OCE, use_BOXATM,use_extNcycle,use_pref_tracers,use_nuopc_ndep integer :: iounit namelist / config_bgc / use_BROMO,use_AGG,use_WLIN,use_natDIC,use_CFC,use_cisonew, & use_sedbypass,use_PBGC_OCNP_TIMESTEP,use_PBGC_CK_TIMESTEP, & - use_FB_BGC_OCE,use_BOXATM,use_extNcycle,use_pref_tracers + use_FB_BGC_OCE,use_BOXATM,use_extNcycle,use_pref_tracers,use_nuopc_ndep io_stdo_bgc = lp ! standard out. diff --git a/phy/mod_rdlim.F90 b/phy/mod_rdlim.F90 index e5956b0e..41aeb3f2 100644 --- a/phy/mod_rdlim.F90 +++ b/phy/mod_rdlim.F90 @@ -161,7 +161,7 @@ subroutine rdlim() open (newunit=nfu,file=nlfnm,status='old',action = 'read', & recl = 80) else - write (lp,*) 'rdlim: could not find namelist file!' + write (lp,*) 'rdlim: could not find namelist file! '//trim(nlfnm) call xchalt('(rdlim)') stop '(rdlim)' end if From 2b55a4ee34f5bd4a4c924d52a87e3ce07f81bb9e Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Wed, 2 Oct 2024 22:49:33 +0200 Subject: [PATCH 6/8] fixed computation of ndep update for use_nuopc_ndep is true --- hamocc/mo_read_ndep.F90 | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/hamocc/mo_read_ndep.F90 b/hamocc/mo_read_ndep.F90 index ecb4ae66..2cd75bfd 100644 --- a/hamocc/mo_read_ndep.F90 +++ b/hamocc/mo_read_ndep.F90 @@ -202,6 +202,7 @@ subroutine get_ndep(kpie,kpje,kbnd,kplyear,kplmon,omask,ndep,patmnhxdep,patmnoyd ! local variables integer :: month_in_file, ncstat, ncid, i, j real :: fatmndep + logical :: first_call = .true. ! if N-deposition is switched off set ndep to zero and return if (.not. do_ndep) then @@ -211,14 +212,14 @@ subroutine get_ndep(kpie,kpje,kbnd,kplyear,kplmon,omask,ndep,patmnhxdep,patmnoyd ! If use_nuopc_ndep, nitrogen deposition is ALWAYS obtained from the ! nuopc mediator - if ((use_nuopc_ndep) .or. (use_extNcycle .and. do_ndep_coupled)) then + if (use_extNcycle .and. do_ndep_coupled) then ! get N-deposition from atmosphere fatmndep = 365.*86400./mw_nitrogen ndep(:,:,:) = 0. !$omp parallel do private(i) - do j=1,kpje - do i=1,kpie + do j=1,kpje + do i=1,kpie ! convert from kgN/m2/s to climatological input file units: kmolN/m2/yr if (patmnoydep(i,j) > 0.) then ndep(i,j,idepnoy) = patmnoydep(i,j)*fatmndep @@ -229,20 +230,24 @@ subroutine get_ndep(kpie,kpje,kbnd,kplyear,kplmon,omask,ndep,patmnhxdep,patmnoyd enddo enddo !$omp end parallel do - if (mnproc == 1) then + if (mnproc == 1 .and. first_call) then write (io_stdo_bgc,*) 'iHAMOCC: getting NOy and NHx deposition from atm' endif - if (use_nuopc_ndep .and. .not. use_extNcycle) then - ! Reduced and oxidized forms will all enter the NO3 pool - !$omp parallel do private(i) - do j=1,kpje - do i=1,kpie - ndep(i,j,idepnoy) = ndep(i,j,idepnoy) + ndep(i,j,idepnhx) - enddo + else if (use_nuopc_ndep) then + + ! get N-deposition from atmosphere + fatmndep = 365.*86400./mw_nitrogen + ndep(:,:,:) = 0. + !$omp parallel do private(i) + do j=1,kpje + do i=1,kpie + ! convert from kgN/m2/s to climatological input file units: kmolN/m2/yr + ! reduced and oxidized forms will all enter the NO3 pool + ndep(i,j,idepnoy) = (patmnoydep(i,j)+patmnhxdep(i,j))*fatmndep enddo - !$omp end parallel do - end if + enddo + !$omp end parallel do else @@ -278,6 +283,7 @@ subroutine get_ndep(kpie,kpje,kbnd,kplyear,kplmon,omask,ndep,patmnhxdep,patmnoyd !$omp end parallel do endif + first_call = .false. end subroutine get_ndep end module mo_read_ndep From 6032936ab4f748e04964314cf194c77219d253f6 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Mon, 7 Oct 2024 11:54:56 +0200 Subject: [PATCH 7/8] more updates addressing comments in PR --- cime_config/config_component.xml | 32 ++++++------- cime_config/namelist_definition_blom.xml | 14 +----- cime_config/ocn_in.readme | 57 ++++++++++++------------ hamocc/mo_control_bgc.F90 | 1 - hamocc/mo_hamocc_init.F90 | 4 +- hamocc/mo_param_bgc.F90 | 3 +- hamocc/mo_read_ndep.F90 | 42 +++++++---------- 7 files changed, 65 insertions(+), 88 deletions(-) diff --git a/cime_config/config_component.xml b/cime_config/config_component.xml index 765eef22..e4214535 100644 --- a/cime_config/config_component.xml +++ b/cime_config/config_component.xml @@ -121,23 +121,24 @@ UNSET,1850,2000,hist,ssp119,ssp126,ssp245,ssp370,ssp434,ssp460,ssp534os,ssp585 1850 - hist - hist - 2000 - ssp119 - ssp126 - ssp245 - ssp370 - ssp370 - ssp370 - ssp434 - ssp460 - ssp534os - ssp585 + 1850 + 2000 + hist + hist + ssp119 + ssp126 + ssp245 + ssp370 + ssp434 + ssp460 + ssp534os + ssp585 + ssp370 run_component_blom env_run.xml - Scenario for nitrogen deposition data. Requires module ecosys + Scenario for nitrogen deposition data. Requires module ecosys. + Not used when coupling with nuopc-cmeps @@ -163,7 +164,8 @@ run_component_blom env_run.xml - Nitrogen deposition coupled from atmosphere. Requires module ecosys and extncycle + Nitrogen deposition coupled from atmosphere. Requires module ecosys and extncycle. + Not used when coupling with nuopc-cmeps diff --git a/cime_config/namelist_definition_blom.xml b/cime_config/namelist_definition_blom.xml index 1ccde94a..3030ea67 100644 --- a/cime_config/namelist_definition_blom.xml +++ b/cime_config/namelist_definition_blom.xml @@ -3847,19 +3847,7 @@ .false. .true. - if .true., use NUOPC to obtain NDEP (always imported to model) and ignore the - settings of do_ndep_coupled and ndepfile, whereas the setting of do_ndep is still used - - - - logical - bgcnml - bgcnml - - .false. - .true. - - Switch to couple nitrogen deposition. Requires do_ndep. + if .true., use NUOPC to obtain NDEP (always imported to model). diff --git a/cime_config/ocn_in.readme b/cime_config/ocn_in.readme index c3ce0150..3fa6b797 100644 --- a/cime_config/ocn_in.readme +++ b/cime_config/ocn_in.readme @@ -173,7 +173,7 @@ ! CWMI : Array of grid cell i-indices (i) ! CWMJ : Array of grid cell j-indices (i) ! CWMWTH : Array of modified grid cell widths (m) (f) -! +! !=========================================================================== ! NAMELIST FOR MERIDIONAL OVERTURNING AND FLUX DIAGNOSTICS ! @@ -188,7 +188,7 @@ ! for each region (i) ! MER_MINLAT : Minimum latitude to be considered for each region (f) ! MER_MAXLAT : Maximum latitude to be considered for each region (f) -! +! !=========================================================================== ! NAMELIST FOR SECTION TRANSPORT DIAGNOSTICS ! @@ -196,7 +196,7 @@ ! ! SEC_SIFILE : Name of file containing section specification for section ! transport computation (a) -! +! !=========================================================================== ! IO-NAMELIST FOR DIAGNOSTIC OUTPUT ! @@ -230,10 +230,10 @@ ! MSC_ - miscellanous, non-gridded fields ! ! Global parameters: -! FNAMETAG - tag used in file name (c10) -! AVEPERIO - average period in days (i) -! FILEFREQ - how often to start a new file in days (i) -! COMPFLAG - switch for compressed/uncompressed output (i) +! FNAMETAG - tag used in file name (c10) +! AVEPERIO - average period in days (i) +! FILEFREQ - how often to start a new file in days (i) +! COMPFLAG - switch for compressed/uncompressed output (i) ! NCFORMAT - netcdf format (valid arguments are 0 for classic, ! 1 for 64-bit offset and 2 for netcdf4/hdf5 format) ! @@ -380,13 +380,12 @@ ! ! ATM_CO2 : Atmospheric CO2 concentration [ppmv] ! FEDEPFILE : File name (incl. full path) for iron (dust) deposition data -! SWACLIMFILE : File name (incl. full path) for swa climatology field (needed +! SWACLIMFILE : File name (incl. full path) for swa climatology field (needed ! if bromoform scheme is activated) ! DO_RIVINPT : Logical switch to activate riverine input ! RIVINFILE : File name (incl. full path) for riverine input data ! DO_NDEP : Logical switch to activate N-deposition -! DO_NDEP_COUPLED: Logical to apply N-deposition fluxes received from the atmosphere (true=atm, false=clim), requires DO_NDEP=TRUE -! NDEPFILE : File name (incl. full path) for atmopheric N-deposition data +! NDEPFILE : File name (incl. full path) for atmopheric N-deposition data (not used for coupling to cmeps) ! DO_N2ONH3_COUPLED: Logical switch for interactive coupling of N2O and NH3 fluxes (true=atm, false=fix atmospheric value) ! DO_SEDSPINUP: Logical switch to activate sediment spin-up ! SEDSPIN_YR_S: Start year for sediment spinup @@ -398,21 +397,21 @@ ! PI_PH_FILE : File name (incl. full path) for surface PI pH input data. ! use_M4AGO : Switch for M4AGO settling scheme ! LEUPHOTIC_CYA : Switch to perform bluefix (cyanobacteria) only in the euphotic zone -! L_3DVARSEDPOR : Logical switch to enable lon-lat-depth variable sediment porosity (as opposed to default: only depth) +! L_3DVARSEDPOR : Logical switch to enable lon-lat-depth variable sediment porosity (as opposed to default: only depth) ! SEDPORFILE : File name (incl. full path) for sediment porosity ! !=========================================================================== ! NAMELIST BGCPARAMS FOR iHAMOCC-BGC PARAMETERS (DEVELOPERS ONLY) -! +! ! CONTENTS: EMPTY BY DEFAULT ! FOR ADJUSTABLE PARAMETERS, SEE CODE -! +! !=========================================================================== ! NAMELIST BGCOAFX FOR ALKALINIZATION SCENARIO ! ! CONTENTS: ! -! OALKSCEN : Name of alkalinization scenario ('const', 'ramp', or 'file') +! OALKSCEN : Name of alkalinization scenario ('const', 'ramp', or 'file') ! OALKFILE : Full path of the input file for the alkalinization scenario 'file' ! ADDALK : Pmol alkalinity/yr added in 'const' or 'ramp' scenarios ! CDRMIP_LATMAX : Max latitude where alkalinity is added in 'const' or 'ramp' scenarios @@ -434,10 +433,10 @@ ! BUR_ - 2d fields of sediment burial ! ! Global parameters: -! FNAMETAG - tag used in file name (c10) -! AVEPERIO - average period in days (i) -! FILEFREQ - how often to start a new file in days (i) -! COMPFLAG - switch for compressed/uncompressed output (i) +! FNAMETAG - tag used in file name (c10) +! AVEPERIO - average period in days (i) +! FILEFREQ - how often to start a new file in days (i) +! COMPFLAG - switch for compressed/uncompressed output (i) ! NCFORMAT - netcdf format (valid arguments are 0 for classic, ! 1 for 64-bit offset and 2 for netcdf4/hdf5 format) ! INVENTORY- how often to write an inventory of tracers to ocean @@ -487,7 +486,7 @@ ! PHOSY - Primary production (pp) [mol C m-3 s-1] ! CO3 - Carbonate ions (co3) [mol C m-3] ! N2O - Nitrous oxide concentration [mol N2O m-3] -! NITR_NH4 - nitrification rate on NH4 [mol NH4 m-3 s-1] - extended N cycle only +! NITR_NH4 - nitrification rate on NH4 [mol NH4 m-3 s-1] - extended N cycle only ! NITR_NO2 - nitrification rate on NO2 [mol NO2 m-3 s-1] - extended N cycle only ! NITR_N2O_PROD - N2O production rate during nitrification on NH4 [mol N2O m-3 s-1] - ext. N cycle only ! NITR_NH4_OM - detritus production during nitrification on NH4 [mol P m-3 s-1] - ext. N cycle only @@ -498,9 +497,9 @@ ! DNRA_NO2 - DNRA on NO2 [mol NO2 m-3 s-1] - ext. N cycle only ! ANMX_N2_PROD - anammox N2 production [mol N2 m-3 s-1] - ext. N cycle only ! ANMX_OM_PROD - anammox detritus production [mol P m-3 s-1] - ext. N cycle only -! PHOSY_NH4 - PP consumption of NH4 [mol NH4 m-3 s-1] - ext. N cycle only -! PHOSY_NO3 - PP consumption of NH4 [mol NH4 m-3 s-1] - ext. N cycle only -! REMIN_AEROB - aerob remineralization rate (sev. sources) [mol NH4 m-3 s-1] - ext. N cycle only +! PHOSY_NH4 - PP consumption of NH4 [mol NH4 m-3 s-1] - ext. N cycle only +! PHOSY_NO3 - PP consumption of NH4 [mol NH4 m-3 s-1] - ext. N cycle only +! REMIN_AEROB - aerob remineralization rate (sev. sources) [mol NH4 m-3 s-1] - ext. N cycle only ! REMIN_SULF - sulfate-based remin rate on det [mol P m-3 s-1] - ext. N cycle only ! AGG_WS - M4AGO aggregate mean settling velocity [m/d] ! DYNVIS - molecular dynamic viscosity of sea water [kg m-1 s-1] @@ -549,8 +548,8 @@ ! 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] +! 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] @@ -608,7 +607,7 @@ ! BURSSSC12 - burial fluxes of calcium carbonate [mol Ca m-2 s-1] ! BURSSSSIL - burial fluxes of silicate [mol Si m-2 s-1] ! BURSSSTER - burial fluxes of clay [g m-2 s-1] -! +! ! Sediment fields (SDM) ! POWAIC - (powdic) [mol C m-3] ! POWAAL - (powalk) [eq m-3] @@ -620,7 +619,7 @@ ! POWNH4 - (pownh4) [mol NH4 m-3] - extended N cycle only ! POWN2O - (pown2o) [mol N2O m-3] - extended N cycle only ! POWNO2 - (powno2) [mol NO2 m-3] - extended N cycle only -! NITR_NH4 - nitrification rate on NH4 [mol NH4 m-3 s-1] - extended N cycle only +! NITR_NH4 - nitrification rate on NH4 [mol NH4 m-3 s-1] - extended N cycle only ! NITR_NO2 - nitrification rate on NO2 [mol NO2 m-3 s-1] - extended N cycle only ! NITR_N2O_PROD - N2O production rate during nitrification on NH4 [mol N2O m-3 s-1] - ext. N cycle only ! NITR_NH4_OM - detritus production during nitrification on NH4 [mol P m-3 s-1] - ext. N cycle only @@ -631,9 +630,9 @@ ! DNRA_NO2 - DNRA on NO2 [mol NO2 m-3 s-1] - ext. N cycle only ! ANMX_N2_PROD - anammox N2 production [mol N2 m-3 s-1] - ext. N cycle only ! ANMX_OM_PROD - anammox detritus production [mol P m-3 s-1] - ext. N cycle only -! PHOSY_NH4 - PP consumption of NH4 [mol NH4 m-3 s-1] - ext. N cycle only -! PHOSY_NO3 - PP consumption of NH4 [mol NH4 m-3 s-1] - ext. N cycle only -! REMIN_AEROB - aerob remineralization rate (sev. sources) [mol NH4 m-3 s-1] - ext. N cycle only +! PHOSY_NH4 - PP consumption of NH4 [mol NH4 m-3 s-1] - ext. N cycle only +! PHOSY_NO3 - PP consumption of NH4 [mol NH4 m-3 s-1] - ext. N cycle only +! REMIN_AEROB - aerob remineralization rate (sev. sources) [mol NH4 m-3 s-1] - ext. N cycle only ! REMIN_SULF - sulfate-based remin rate on det [mol P m-3 s-1] - ext. N cycle only ! SSSO12 - (ssso12) [mol m-3] ! SSSSIL - (ssssil) [mol Si m-3] diff --git a/hamocc/mo_control_bgc.F90 b/hamocc/mo_control_bgc.F90 index 3235710e..c03962ac 100644 --- a/hamocc/mo_control_bgc.F90 +++ b/hamocc/mo_control_bgc.F90 @@ -54,7 +54,6 @@ module mo_control_bgc ! Variables set via namelist bgcnml logical :: l_3Dvarsedpor = .false. ! apply spatially variable sediment porosity logical :: do_ndep = .true. ! apply n-deposition - logical :: do_ndep_coupled = .false. ! for coupled simulations, use field provided by atmosphere logical :: do_n2onh3_coupled = .false. ! for coupled simulations, use field provided by atmosphere logical :: do_rivinpt = .true. ! apply riverine input logical :: do_sedspinup = .false. ! apply sediment spin-up diff --git a/hamocc/mo_hamocc_init.F90 b/hamocc/mo_hamocc_init.F90 index e1e42f8e..e3db5805 100644 --- a/hamocc/mo_hamocc_init.F90 +++ b/hamocc/mo_hamocc_init.F90 @@ -43,7 +43,7 @@ subroutine hamocc_init(read_rest,rstfnm_hamocc) do_sedspinup,sedspin_yr_s,sedspin_yr_e,sedspin_ncyc, & dtb,dtbgc,io_stdo_bgc,ldtbgc, & ldtrunbgc,ndtdaybgc,with_dmsph,l_3Dvarsedpor,use_M4AGO, & - do_ndep_coupled,lkwrbioz_off,do_n2onh3_coupled, & + lkwrbioz_off,do_n2onh3_coupled, & ocn_co2_type, use_sedbypass, use_BOXATM, use_BROMO,use_extNcycle, & use_nuopc_ndep use mo_param1_bgc, only: ks,init_por2octra_mapping @@ -82,7 +82,7 @@ subroutine hamocc_init(read_rest,rstfnm_hamocc) & do_sedspinup,sedspin_yr_s,sedspin_yr_e,sedspin_ncyc, & & inidic,inialk,inipo4,inioxy,inino3,inisil,inid13c,inid14c,swaclimfile, & & with_dmsph,pi_ph_file,l_3Dvarsedpor,sedporfile,ocn_co2_type,use_M4AGO, & - & do_ndep_coupled,do_n2onh3_coupled,lkwrbioz_off + & do_n2onh3_coupled,lkwrbioz_off ! ! --- Set io units and some control parameters ! diff --git a/hamocc/mo_param_bgc.F90 b/hamocc/mo_param_bgc.F90 index 8deac006..6cf8a78f 100644 --- a/hamocc/mo_param_bgc.F90 +++ b/hamocc/mo_param_bgc.F90 @@ -37,7 +37,7 @@ module mo_param_bgc do_ndep,do_oalk,do_rivinpt,do_sedspinup,l_3Dvarsedpor, & use_BOXATM,use_CFC,use_PBGC_CK_TIMESTEP, & use_sedbypass,with_dmsph,use_PBGC_OCNP_TIMESTEP,ocn_co2_type,use_M4AGO,& - do_ndep_coupled,do_n2onh3_coupled,use_extNcycle, & + do_n2onh3_coupled,use_extNcycle, & lkwrbioz_off use mod_xc, only: mnproc @@ -837,7 +837,6 @@ subroutine write_parambgc() call cinfo_add_entry('lkwrbioz_off', lkwrbioz_off) call cinfo_add_entry('use_M4AGO', use_M4AGO) if (use_extNcycle) then - call cinfo_add_entry('do_ndep_coupled', do_ndep_coupled) call cinfo_add_entry('do_n2onh3_coupled', do_n2onh3_coupled) endif write(io_stdo_bgc,*) '* ' diff --git a/hamocc/mo_read_ndep.F90 b/hamocc/mo_read_ndep.F90 index 2cd75bfd..e4155dee 100644 --- a/hamocc/mo_read_ndep.F90 +++ b/hamocc/mo_read_ndep.F90 @@ -75,7 +75,7 @@ subroutine ini_read_ndep(kpie,kpje) !*********************************************************************************************** use mod_xc, only: mnproc,xchalt - use mo_control_bgc, only: io_stdo_bgc,do_ndep,do_ndep_coupled,use_extNcycle + use mo_control_bgc, only: io_stdo_bgc,do_ndep,use_extNcycle use mod_dia, only: iotype use mod_nctools, only: ncfopn,ncgeti,ncfcls use mo_netcdf_bgcrw, only: read_netcdf_var @@ -96,13 +96,6 @@ subroutine ini_read_ndep(kpie,kpje) endif return endif - if (do_ndep_coupled) then - if (mnproc == 1) then - write(io_stdo_bgc,*) '' - write(io_stdo_bgc,*) 'ini_read_ndep: N deposition in interactive mode.' - endif - return - end if ! Initialise the module if (.not. lini) then @@ -182,7 +175,7 @@ subroutine get_ndep(kpie,kpje,kbnd,kplyear,kplmon,omask,ndep,patmnhxdep,patmnoyd use mod_xc, only: mnproc use netcdf, only: nf90_open,nf90_close,nf90_nowrite - use mo_control_bgc, only: io_stdo_bgc, do_ndep, use_extNcycle, do_ndep_coupled, use_nuopc_ndep + use mo_control_bgc, only: io_stdo_bgc, do_ndep, use_extNcycle, use_nuopc_ndep use mo_netcdf_bgcrw, only: read_netcdf_var use mo_param1_bgc, only: nndep,idepnoy,idepnhx use mo_chemcon, only: mw_nitrogen @@ -210,17 +203,22 @@ subroutine get_ndep(kpie,kpje,kbnd,kplyear,kplmon,omask,ndep,patmnhxdep,patmnoyd return endif - ! If use_nuopc_ndep, nitrogen deposition is ALWAYS obtained from the - ! nuopc mediator - if (use_extNcycle .and. do_ndep_coupled) then + if (use_nuopc_ndep) then + + ! If use_nuopc_ndep, nitrogen deposition is ALWAYS obtained from the + ! nuopc mediator + if (mnproc == 1 .and. first_call) then + write (io_stdo_bgc,*) 'iHAMOCC: getting NOy and NHx deposition from atm' + endif + + ! convert from kgN/m2/s to climatological input file units: kmolN/m2/yr + fatmndep = 365.*86400./mw_nitrogen + ndep(:,:,:) = 0. - ! get N-deposition from atmosphere - fatmndep = 365.*86400./mw_nitrogen - ndep(:,:,:) = 0. + if (use_extNcycle) then !$omp parallel do private(i) do j=1,kpje do i=1,kpie - ! convert from kgN/m2/s to climatological input file units: kmolN/m2/yr if (patmnoydep(i,j) > 0.) then ndep(i,j,idepnoy) = patmnoydep(i,j)*fatmndep endif @@ -230,24 +228,16 @@ subroutine get_ndep(kpie,kpje,kbnd,kplyear,kplmon,omask,ndep,patmnhxdep,patmnoyd enddo enddo !$omp end parallel do - if (mnproc == 1 .and. first_call) then - write (io_stdo_bgc,*) 'iHAMOCC: getting NOy and NHx deposition from atm' - endif - - else if (use_nuopc_ndep) then - - ! get N-deposition from atmosphere - fatmndep = 365.*86400./mw_nitrogen - ndep(:,:,:) = 0. + else !$omp parallel do private(i) do j=1,kpje do i=1,kpie - ! convert from kgN/m2/s to climatological input file units: kmolN/m2/yr ! reduced and oxidized forms will all enter the NO3 pool ndep(i,j,idepnoy) = (patmnoydep(i,j)+patmnhxdep(i,j))*fatmndep enddo enddo !$omp end parallel do + end if else From 80c8817fb630868280f40a53bdacfa83ef94f96d Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Mon, 21 Oct 2024 13:50:29 +0200 Subject: [PATCH 8/8] added line break --- hamocc/mo_param1_bgc.F90 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hamocc/mo_param1_bgc.F90 b/hamocc/mo_param1_bgc.F90 index f8d8fe29..c319be9a 100644 --- a/hamocc/mo_param1_bgc.F90 +++ b/hamocc/mo_param1_bgc.F90 @@ -242,7 +242,8 @@ subroutine init_indices() use mo_control_bgc, only: bgc_namelist,get_bgc_namelist, io_stdo_bgc use mo_control_bgc, only: use_BROMO,use_AGG,use_WLIN,use_natDIC,use_CFC,use_cisonew, & use_sedbypass,use_PBGC_OCNP_TIMESTEP,use_PBGC_CK_TIMESTEP, & - use_FB_BGC_OCE, use_BOXATM,use_extNcycle,use_pref_tracers,use_nuopc_ndep + use_FB_BGC_OCE, use_BOXATM,use_extNcycle,use_pref_tracers, & + use_nuopc_ndep integer :: iounit namelist / config_bgc / use_BROMO,use_AGG,use_WLIN,use_natDIC,use_CFC,use_cisonew, &