From fa648b78368f9f4981812115e5f96b2b15163b81 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Thu, 8 Jun 2023 13:45:42 +0200 Subject: [PATCH 01/52] first set of updates to send and receive dms fluxes --- drivers/nuopc/mod_nuopc_methods.F90 | 37 +++++++++++++++++++++++------ drivers/nuopc/ocn_comp_nuopc.F90 | 33 +++++++++++++++++++++---- 2 files changed, 59 insertions(+), 11 deletions(-) diff --git a/drivers/nuopc/mod_nuopc_methods.F90 b/drivers/nuopc/mod_nuopc_methods.F90 index 6cdd659a..b29c2306 100644 --- a/drivers/nuopc/mod_nuopc_methods.F90 +++ b/drivers/nuopc/mod_nuopc_methods.F90 @@ -42,6 +42,8 @@ module mod_nuopc_methods use mod_utility, only: util1, util2 use mod_checksum, only: csdiag, chksummsk use shr_const_mod, only: SHR_CONST_RHOSW, SHR_CONST_LATICE, SHR_CONST_TKFRZ + use mo_carbch, only: ocetra + use mo_param1_bgc, only: idms implicit none @@ -481,6 +483,7 @@ subroutine blom_importflds(fldlist_num, fldlist) index_Fioi_flxdst = - 1, & index_Foxx_rofl = - 1, & index_Foxx_rofi = - 1, & + index_Faox_dms = - 1, & index_So_duu10n = - 1, & index_Foxx_tauy = - 1, & index_Foxx_taux = - 1, & @@ -928,8 +931,9 @@ subroutine blom_exportflds(fldlist_num, fldlist) index_So_t = - 1, & index_So_s = - 1, & index_So_bldepth = - 1, & + index_So_dms = - 1, & index_Fioo_q = - 1, & - index_Faoo_fdms_ocn = - 1, & + index_Faoo_dms = - 1, & index_Faoo_fco2_ocn = - 1, & index_Faoo_fbrf_ocn = - 1 @@ -1020,18 +1024,19 @@ subroutine blom_exportflds(fldlist_num, fldlist) ! Provide DMS flux [kmol DMS m-2 s-1], if requested. ! ------------------------------------------------------------------------ - call getfldindex(fldlist_num, fldlist, 'Faoo_fdms_ocn', & - index_Faoo_fdms_ocn) + call getfldindex(fldlist_num, fldlist, 'Faoo_dms', & + index_Faoo_dms) + + if (fdms_requested .and. index_Faoo_dms > 0) then + fldlist(index_Faoo_dms)%dataptr(:) = 0._r8 - if (fbrf_requested .and. index_Faoo_fdms_ocn > 0) then - fldlist(index_Faoo_fdms_ocn)%dataptr(:) = 0._r8 !$omp parallel do private(l, i, n) do j = 1, jjcpl do l = 1, isp(j) do i = max(1, ifp(j,l)), min(ii, ilp(j,l)) n = (j - 1)*ii + i - fldlist(index_Faoo_fdms_ocn)%dataptr(n) = & - acc_fbrf(i,j)*tfac*mod2med_areacor(n) + fldlist(index_Faoo_dms)%dataptr(n) = & + acc_fdms(i,j)*tfac*mod2med_areacor(n) enddo enddo enddo @@ -1041,6 +1046,24 @@ subroutine blom_exportflds(fldlist_num, fldlist) write(lp,*) subname//': dms flux not sent to coupler' endif + call getfldindex(fldlist_num, fldlist, 'So_dms', & + index_So_dms) + + if (fdms_requested .and. index_So_dms > 0) then + fldlist(index_So_dms)%dataptr(:) = 0._r8 + + !$omp parallel do private(l, i, n) + do j = 1, jjcpl + do l = 1, isp(j) + do i = max(1, ifp(j,l)), min(ii, ilp(j,l)) + n = (j - 1)*ii + i + fldlist(index_So_dms)%dataptr(n) = ocetra(i,j,1,idms) + enddo + enddo + enddo + !$omp end parallel do + end if + ! ------------------------------------------------------------------------ ! Provide CO2 flux [kg CO2 m-2 s-1], if requested. ! ------------------------------------------------------------------------ diff --git a/drivers/nuopc/ocn_comp_nuopc.F90 b/drivers/nuopc/ocn_comp_nuopc.F90 index 086501e5..471362c1 100644 --- a/drivers/nuopc/ocn_comp_nuopc.F90 +++ b/drivers/nuopc/ocn_comp_nuopc.F90 @@ -74,10 +74,10 @@ module ocn_comp_nuopc integer :: flds_scalar_index_ny = 0 integer :: flds_scalar_index_precip_factor = 0 - logical :: ldriver_has_atm_co2_diag, ldriver_has_atm_co2_prog, & - ocn2glc_coupling + logical :: ldriver_has_atm_co2_diag, ldriver_has_atm_co2_prog + logical :: ocn2glc_coupling, flds_dms_med, flds_dms_ocn - integer :: dbug = 0 + integer :: dbug = 10 logical :: profile_memory = .false. public :: SetServices, SetVM @@ -521,6 +521,17 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) trim(cvalue), ESMF_LOGMSG_INFO) endif + ! Determine if dms will be sent to mediator (currently both flux and concentration) + call NUOPC_CompAttributeGet(gcomp, name='flds_dms_ocn', value=cvalue, rc=rc) + if (ChkErr(rc, __LINE__, u_FILE_u)) return + read(cvalue,*) flds_dms_ocn + call blom_logwrite(subname//': flds_dms_ocn = '//trim(cvalue)) + + call NUOPC_CompAttributeGet(gcomp, name='flds_dms_med', value=cvalue, rc=rc) + if (ChkErr(rc, __LINE__, u_FILE_u)) return + read(cvalue,*) flds_dms_med + call blom_logwrite(subname//': flds_dms_med = '//trim(cvalue)) + ! ------------------------------------------------------------------------ ! Advertise import fields. ! ------------------------------------------------------------------------ @@ -589,6 +600,10 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) ldriver_has_atm_co2_diag = .false. endif + if (flds_dms_med) then + call fldlist_add(fldsToOcn_num, fldsToOcn, 'Faox_dms') + end if + !TODO Determine if will get nitrogen deposition from atm do n = 1,fldsToOcn_num @@ -628,6 +643,13 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'Fioo_q') call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'Faoo_fco2_ocn') + if (flds_dms_med) then + call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'So_dms') + end if + if (flds_dms_ocn) then + call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'Faoo_dms') + end if + do n = 1,fldsFrOcn_num call NUOPC_Advertise(exportState, standardName=fldsFrOcn(n)%stdname, & TransferOfferGeomObject='will provide', rc=rc) @@ -730,15 +752,18 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) ! Realize the actively coupled fields. ! ------------------------------------------------------------------------ + write(6,*)'DEBUG: here1' call fldlist_realize(state=importState, & fldlist_num=fldsToOcn_num, fldlist=fldsToOcn, & tag=subname//':BLOM_Import', mesh=EMesh, rc=rc) if (ChkErr(rc, __LINE__, u_FILE_u)) return + write(6,*)'DEBUG: here2' call fldlist_realize(state=exportState, & fldlist_num=fldsFrOcn_num, fldlist=fldsFrOcn, & tag=subname//':BLOM_Export', mesh=EMesh, rc=rc) if (ChkErr(rc, __LINE__, u_FILE_u)) return + write(6,*)'DEBUG: here3' ! ------------------------------------------------------------------------ ! Set scalar data in export state. @@ -793,7 +818,7 @@ subroutine DataInitialize(gcomp, rc) call ESMF_StateGet(exportState, 'Faoo_fco2_ocn', itemType) fco2_requested = (itemType /= ESMF_STATEITEM_NOTFOUND) - call ESMF_StateGet(exportState, 'Faoo_fdms_ocn', itemType) + call ESMF_StateGet(exportState, 'Faoo_dms', itemType) fdms_requested = (itemType /= ESMF_STATEITEM_NOTFOUND) call ESMF_StateGet(exportState, 'Faoo_fbrf_ocn', itemType) From 47700e552b68991978364a4316650f40cfb7d232 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Mon, 12 Jun 2023 10:34:44 +0200 Subject: [PATCH 02/52] more updates to update ocetra with mediator fluxes --- drivers/nuopc/mod_nuopc_methods.F90 | 465 ++++++++++++++++++---------- drivers/nuopc/ocn_comp_nuopc.F90 | 150 +-------- hamocc/mo_control_bgc.F90 | 2 + hamocc/mo_param1_bgc.F90 | 2 + 4 files changed, 317 insertions(+), 302 deletions(-) diff --git a/drivers/nuopc/mod_nuopc_methods.F90 b/drivers/nuopc/mod_nuopc_methods.F90 index b29c2306..d962f446 100644 --- a/drivers/nuopc/mod_nuopc_methods.F90 +++ b/drivers/nuopc/mod_nuopc_methods.F90 @@ -44,6 +44,8 @@ module mod_nuopc_methods use shr_const_mod, only: SHR_CONST_RHOSW, SHR_CONST_LATICE, SHR_CONST_TKFRZ use mo_carbch, only: ocetra use mo_param1_bgc, only: idms + use mo_intfcblom, only: bgc_dp, omask + use mo_vgrid, only : dp_min implicit none @@ -58,6 +60,7 @@ module mod_nuopc_methods integer :: ungridded_ubound = 0 real(r8), dimension(:), pointer :: dataptr end type fldlist_type + integer, parameter :: fldsMax = 100 real(r8), dimension(:), allocatable :: mod2med_areacor, med2mod_areacor real(r8), dimension(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy) :: & @@ -65,20 +68,104 @@ module mod_nuopc_methods acc_fco2, acc_fdms, acc_fbrf real(r8) :: tlast_coupled integer :: jjcpl - logical :: fco2_requested, fdms_requested, fbrf_requested - public :: fldlist_type, tlast_coupled, & - fco2_requested, fdms_requested, fbrf_requested, & + public :: fldlist_type, fldsmax, tlast_coupled, & blom_logwrite, blom_getgindex, blom_checkmesh, blom_setareacor, & blom_getglobdim, blom_getprecipfact, blom_accflds, & + blom_advertise_imports, blom_advertise_exports, & blom_importflds, blom_exportflds + integer :: & + index_Si_ifrac = - 1, & + index_Fioi_melth = - 1, & + index_Fioi_meltw = - 1, & + index_Fioi_salt = - 1, & + index_Fioi_bcpho = - 1, & + index_Fioi_bcphi = - 1, & + index_Fioi_flxdst = - 1, & + index_Foxx_rofl = - 1, & + index_Foxx_rofi = - 1, & + index_Faox_dms = - 1, & + index_Faox_brf = - 1, & + index_So_duu10n = - 1, & + index_Foxx_tauy = - 1, & + index_Foxx_taux = - 1, & + index_Foxx_lat = - 1, & + index_Foxx_sen = - 1, & + index_Foxx_lwup = - 1, & + index_Foxx_evap = - 1, & + index_Foxx_swnet = - 1, & + index_Sw_lamult = - 1, & + index_Sw_ustokes = - 1, & + index_Sw_vstokes = - 1, & + index_Sw_hstokes = - 1, & + index_Faxa_lwdn = - 1, & + index_Faxa_snow = - 1, & + index_Faxa_rain = - 1, & + index_Sa_pslv = - 1, & + index_Sa_co2diag = - 1, & + index_Sa_co2prog = - 1, & + index_Sa_brfprog = - 1 + + integer :: & + index_So_omask = - 1, & + index_So_u = - 1, & + index_So_v = - 1, & + index_So_dhdx = - 1, & + index_So_dhdy = - 1, & + index_So_t = - 1, & + index_So_s = - 1, & + index_So_bldepth = - 1, & + index_So_dms = - 1, & + index_So_brf = - 1, & + index_Fioo_q = - 1, & + index_Faoo_dms = - 1, & + index_Faoo_brf = - 1, & + index_Faoo_fco2_ocn = - 1 + contains ! --------------------------------------------------------------------------- ! Private procedures. ! --------------------------------------------------------------------------- + subroutine fldlist_add(num, fldlist, stdname, index, ungridded_lbound, ungridded_ubound) + ! --------------------------------------------------------------------------- + ! Add to list of field information. + ! --------------------------------------------------------------------------- + + ! Input/output arguments. + integer , intent(inout) :: num + type(fldlist_type), intent(inout) :: fldlist(:) + character(len=*) , intent(in) :: stdname + integer , intent(out) :: index + integer, optional , intent(in) :: ungridded_lbound, ungridded_ubound + + ! Local parameters. + character(len=*), parameter :: & + subname = modname//':(fldlist_add)' + + ! Local variables. + integer :: rc + + num = num + 1 + if (num > fldsMax) then + write(lp,'(a,3i6,2(f21.13,3x),d21.5)') subname// & + ': BLOM ERROR: number of fields exceeds fldsMax for '//trim(stdname) + call xchalt(subname) + stop subname + endif + fldlist(num)%stdname = trim(stdname) + + index = num + + if (present(ungridded_lbound) .and. present(ungridded_ubound)) then + fldlist(num)%ungridded_lbound = ungridded_lbound + fldlist(num)%ungridded_ubound = ungridded_ubound + endif + + end subroutine fldlist_add + subroutine getfldindex(fldlist_num, fldlist, stdname, fldindex) ! --------------------------------------------------------------------------- ! Get index of field with given standard name. If no field has a matching @@ -95,10 +182,6 @@ subroutine getfldindex(fldlist_num, fldlist, stdname, fldindex) ! Local variables. integer :: n - if (fldindex >= 0) return - - fldindex = 0 - do n = 1, fldlist_num if (fldlist(n)%stdname == stdname) then if (associated(fldlist(n)%dataptr)) fldindex = n @@ -112,6 +195,114 @@ end subroutine getfldindex ! Public procedures. ! --------------------------------------------------------------------------- + subroutine blom_advertise_imports(flds_scalar_name, fldsToOcn_num, fldsToOcn, & + flds_co2a, flds_co2c, flds_dms_med, flds_dms_ocn) + + ! ------------------------------------------------------------------- + ! Determine fldsToOcn for import fields + ! ------------------------------------------------------------------- + + character(len=*) , intent(in) :: flds_scalar_name + integer , intent(inout) :: fldsToOcn_num + type(fldlist_type) , intent(inout), dimension(:) :: fldsToOcn + logical , intent(in) :: flds_co2a + logical , intent(in) :: flds_co2c + logical , intent(in) :: flds_dms_med + logical , intent(in) :: flds_dms_ocn + + integer :: index_scalar + + call fldlist_add(fldsToOcn_num, fldsToOcn, trim(flds_scalar_name), index_scalar) + + ! From ice: + call fldlist_add(fldsToOcn_num, fldsToOcn, 'Si_ifrac' , index_Si_ifrac ) + call fldlist_add(fldsToOcn_num, fldsToOcn, 'Fioi_melth' , index_Fioi_melth) + call fldlist_add(fldsToOcn_num, fldsToOcn, 'Fioi_meltw' , index_Fioi_meltw) + call fldlist_add(fldsToOcn_num, fldsToOcn, 'Fioi_salt' , index_Fioi_salt) + call fldlist_add(fldsToOcn_num, fldsToOcn, 'Fioi_bcpho' , index_Fioi_bcpho) + call fldlist_add(fldsToOcn_num, fldsToOcn, 'Fioi_bcphi' , index_Fioi_bcphi) + call fldlist_add(fldsToOcn_num, fldsToOcn, 'Fioi_flxdst', index_Fioi_flxdst) + + ! From river: + call fldlist_add(fldsToOcn_num, fldsToOcn, 'Foxx_rofl', index_Foxx_rofl) + call fldlist_add(fldsToOcn_num, fldsToOcn, 'Foxx_rofi', index_Foxx_rofi) + + ! From mediator: + call fldlist_add(fldsToOcn_num, fldsToOcn, 'So_duu10n' , index_So_duu10n) + call fldlist_add(fldsToOcn_num, fldsToOcn, 'Foxx_tauy' , index_Foxx_tauy) + call fldlist_add(fldsToOcn_num, fldsToOcn, 'Foxx_taux' , index_Foxx_taux) + call fldlist_add(fldsToOcn_num, fldsToOcn, 'Foxx_lat' , index_Foxx_lat) + call fldlist_add(fldsToOcn_num, fldsToOcn, 'Foxx_sen' , index_Foxx_sen) + call fldlist_add(fldsToOcn_num, fldsToOcn, 'Foxx_lwup' , index_Foxx_lwup) + call fldlist_add(fldsToOcn_num, fldsToOcn, 'Foxx_evap' , index_Foxx_evap) + call fldlist_add(fldsToOcn_num, fldsToOcn, 'Foxx_swnet' , index_Foxx_swnet) + if (flds_dms_med) then + call fldlist_add(fldsToOcn_num, fldsToOcn, 'Faox_dms', index_Faox_dms) + !call fldlist_add(fldsToOcn_num, fldsToOcn, 'Faox_brf', index_Faox_brf) + end if + + ! From wave: + call fldlist_add(fldsToOcn_num, fldsToOcn, 'Sw_lamult' , index_Sw_lamult) + call fldlist_add(fldsToOcn_num, fldsToOcn, 'Sw_ustokes' , index_Sw_ustokes) + call fldlist_add(fldsToOcn_num, fldsToOcn, 'Sw_vstokes' , index_Sw_vstokes) + call fldlist_add(fldsToOcn_num, fldsToOcn, 'Sw_hstokes' , index_Sw_hstokes) + + ! From atmosphere: + call fldlist_add(fldsToOcn_num, fldsToOcn, 'Sa_pslv' , index_Sa_pslv ) + 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) + + ! From atm co2 fields: + 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) + endif + !call getfldindex(num_imp, fldlist_imp, 'Sa_brfprog' , index_Sa_brfprog) + + end subroutine blom_advertise_imports + + subroutine blom_advertise_exports(flds_scalar_name, fldsFrOcn_num, fldsFrOcn, & + flds_dms_med, flds_dms_ocn) + + ! ------------------------------------------------------------------- + ! Determine fldsToOcn for export fields + ! ------------------------------------------------------------------- + + character(len=*) , intent(in) :: flds_scalar_name + integer , intent(inout) :: fldsFrOcn_num + type(fldlist_type), dimension(:) , intent(inout) :: fldsFrOcn + logical , intent(in) :: flds_dms_med + logical , intent(in) :: flds_dms_ocn + + integer :: index_scalar + + call fldlist_add(fldsFrOcn_num, fldsFrOcn, trim(flds_scalar_name), index_scalar) + + call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'So_omask' , index_So_omask) + call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'So_t' , index_So_t) + call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'So_u' , index_So_u) + call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'So_v' , index_So_v) + call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'So_s' , index_So_s) + call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'So_dhdx' , index_So_dhdx) + call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'So_dhdy' , index_So_dhdy) + call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'So_bldepth' , index_So_bldepth) + call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'Fioo_q' , index_Fioo_q) + call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'Faoo_fco2_ocn' , index_Faoo_fco2_ocn) + if (flds_dms_med) then + call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'So_dms', index_So_dms) + end if + if (flds_dms_ocn) then + call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'Faoo_dms', index_Faoo_dms) + end if + ! if (flds_brf_med) then + ! call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'So_brf', index_So_brf) + ! end if + ! if (flds_brf_ocn) then + ! call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'Faoo_brf', index_Faoo_brf) + ! end if + end subroutine blom_advertise_exports + subroutine blom_logwrite(msg) ! --------------------------------------------------------------------------- ! Write message string to standard out from master PE. @@ -348,7 +539,7 @@ subroutine blom_accflds k1n = 1 + nn call xctilr(sealv, 1,1, 1,1, halo_ps) - + !$omp parallel do private(l, i) do j = 1, jj do l = 1, isu(j) @@ -410,7 +601,7 @@ subroutine blom_accflds stop subname end select - if (fco2_requested) then + if (index_Faoo_fco2_ocn > 0) then !$omp parallel do private(l, i) do j = 1, jj do l = 1, isp(j) @@ -422,7 +613,7 @@ subroutine blom_accflds !$omp end parallel do endif - if (fdms_requested) then + if (index_Faoo_dms > 0) then !$omp parallel do private(l, i) do j = 1, jj do l = 1, isp(j) @@ -434,7 +625,7 @@ subroutine blom_accflds !$omp end parallel do endif - if (fbrf_requested) then + if (index_Faoo_brf) then !$omp parallel do private(l, i) do j = 1, jj do l = 1, isp(j) @@ -471,38 +662,9 @@ subroutine blom_importflds(fldlist_num, fldlist) fval = - 1.e13_r8 ! Local variables. + real(r8) :: flxdms_med real(r8) :: afac, utmp, vtmp integer :: n, i, j, l - integer, save :: & - index_Si_ifrac = - 1, & - index_Fioi_melth = - 1, & - index_Fioi_meltw = - 1, & - index_Fioi_salt = - 1, & - index_Fioi_bcpho = - 1, & - index_Fioi_bcphi = - 1, & - index_Fioi_flxdst = - 1, & - index_Foxx_rofl = - 1, & - index_Foxx_rofi = - 1, & - index_Faox_dms = - 1, & - index_So_duu10n = - 1, & - index_Foxx_tauy = - 1, & - index_Foxx_taux = - 1, & - index_Foxx_lat = - 1, & - index_Foxx_sen = - 1, & - index_Foxx_lwup = - 1, & - index_Foxx_evap = - 1, & - index_Foxx_swnet = - 1, & - index_Sw_lamult = - 1, & - index_Sw_ustokes = - 1, & - index_Sw_vstokes = - 1, & - index_Sw_hstokes = - 1, & - index_Faxa_lwdn = - 1, & - index_Faxa_snow = - 1, & - index_Faxa_rain = - 1, & - index_Sa_pslv = - 1, & - index_Sa_co2diag = - 1, & - index_Sa_co2prog = - 1, & - index_Sa_brfprog = - 1 ! Update time level indices. if (l1ci == 1 .and. l2ci == 1) then @@ -513,9 +675,6 @@ subroutine blom_importflds(fldlist_num, fldlist) l2ci = 3 - l2ci endif - call getfldindex(fldlist_num, fldlist, 'Foxx_taux', index_Foxx_taux) - call getfldindex(fldlist_num, fldlist, 'Foxx_tauy', index_Foxx_tauy) - !$omp parallel do private(i, n, afac, utmp, vtmp) do j = 1, jjcpl do i = 1, ii @@ -568,23 +727,6 @@ subroutine blom_importflds(fldlist_num, fldlist) enddo !$omp end parallel do - call getfldindex(fldlist_num, fldlist, 'Faxa_rain', index_Faxa_rain) - call getfldindex(fldlist_num, fldlist, 'Faxa_snow', index_Faxa_snow) - call getfldindex(fldlist_num, fldlist, 'Foxx_evap', index_Foxx_evap) - call getfldindex(fldlist_num, fldlist, 'Foxx_rofl', index_Foxx_rofl) - call getfldindex(fldlist_num, fldlist, 'Foxx_rofi', index_Foxx_rofi) - call getfldindex(fldlist_num, fldlist, 'Fioi_meltw', index_Fioi_meltw) - call getfldindex(fldlist_num, fldlist, 'Fioi_salt', index_Fioi_salt) - call getfldindex(fldlist_num, fldlist, 'Foxx_swnet', index_Foxx_swnet) - call getfldindex(fldlist_num, fldlist, 'Foxx_lat', index_Foxx_lat) - call getfldindex(fldlist_num, fldlist, 'Foxx_sen', index_Foxx_sen) - call getfldindex(fldlist_num, fldlist, 'Foxx_lwup', index_Foxx_lwup) - call getfldindex(fldlist_num, fldlist, 'Faxa_lwdn', index_Faxa_lwdn) - call getfldindex(fldlist_num, fldlist, 'Fioi_melth', index_Fioi_melth) - call getfldindex(fldlist_num, fldlist, 'Sa_pslv', index_Sa_pslv) - call getfldindex(fldlist_num, fldlist, 'So_duu10n', index_So_duu10n) - call getfldindex(fldlist_num, fldlist, 'Si_ifrac', index_Si_ifrac) - !$omp parallel do private(i, n, afac) do j = 1, jjcpl do i = 1, ii @@ -690,11 +832,6 @@ subroutine blom_importflds(fldlist_num, fldlist) call fill_global(mval, fval, halo_ps, abswnd_da(1-nbdy,1-nbdy,l2ci)) call fill_global(mval, fval, halo_ps, ficem_da(1-nbdy,1-nbdy,l2ci)) - call getfldindex(fldlist_num, fldlist, 'Sw_lamult', index_Sw_lamult) - call getfldindex(fldlist_num, fldlist, 'Sw_ustokes', index_Sw_ustokes) - call getfldindex(fldlist_num, fldlist, 'Sw_vstokes', index_Sw_vstokes) - call getfldindex(fldlist_num, fldlist, 'Sw_hstokes', index_Sw_hstokes) - !$omp parallel do private(i, n, utmp, vtmp) do j = 1, jjcpl do i = 1, ii @@ -753,8 +890,6 @@ subroutine blom_importflds(fldlist_num, fldlist) !$omp end parallel do #ifdef PROGCO2 - call getfldindex(fldlist_num, fldlist, 'Sa_co2prog', index_Sa_co2prog) - if (index_Sa_co2prog > 0) then !$omp parallel do private(i, n) do j = 1, jjcpl @@ -791,7 +926,6 @@ subroutine blom_importflds(fldlist_num, fldlist) endif #elif defined(DIAGCO2) - call getfldindex(fldlist_num, fldlist, 'Sa_co2diag', index_Sa_co2diag) if (index_Sa_co2diag > 0) then !$omp parallel do private(i, n) @@ -841,9 +975,7 @@ subroutine blom_importflds(fldlist_num, fldlist) !$omp end parallel do if (mnproc == 1) & write(lp,*) subname//': atmospheric co2 not read' -#endif - - call getfldindex(fldlist_num, fldlist, 'Sa_brfprog', index_Sa_brfprog) +#endif if (index_Sa_brfprog > 0) then !$omp parallel do private(i, n) @@ -880,6 +1012,32 @@ subroutine blom_importflds(fldlist_num, fldlist) write(lp,*) subname//': prog. atmospheric bromoform not read' endif + if (index_Faox_dms > 0) then + if (associated(fldlist(index_Faox_dms)%dataptr)) then + !$omp parallel do private(i, n, afac) + do j = 1, jjcpl + do i = 1, ii + n = (j - 1)*ii + i + afac = med2mod_areacor(n) + if (ip(i,j) == 0) then + flxdms_med = 0._r8 + elseif (cplmsk(i,j) == 0) then + flxdms_med = 0._r8 + else + flxdms_med = fldlist(index_Faox_dms)%dataptr(n)*afac + end if + end do + ! size of scalar grid cell [m]. + if (omask(i,j) > 0.5.and. bgc_dp(i,j,1) > dp_min) then + ocetra(i,j,1,idms) = ocetra(i,j,1,idms) - flxdms_med/bgc_dp(i,j,1) + end if + end do + !$omp end parallel do + if (mnproc == 1) & + write(lp,*) subname//': prog. dms flux obtained from mediator' + end if + end if + if (csdiag) then if (mnproc == 1) then write(lp,*) subname//':' @@ -922,20 +1080,6 @@ subroutine blom_exportflds(fldlist_num, fldlist) ! Local variables. real(r8) :: tfac, utmp, vtmp integer :: n, l, i, j - integer, save :: & - index_So_omask = - 1, & - index_So_u = - 1, & - index_So_v = - 1, & - index_So_dhdx = - 1, & - index_So_dhdy = - 1, & - index_So_t = - 1, & - index_So_s = - 1, & - index_So_bldepth = - 1, & - index_So_dms = - 1, & - index_Fioo_q = - 1, & - index_Faoo_dms = - 1, & - index_Faoo_fco2_ocn = - 1, & - index_Faoo_fbrf_ocn = - 1 tfac = 1._r8/tlast_coupled @@ -948,16 +1092,6 @@ subroutine blom_exportflds(fldlist_num, fldlist) call xctilr(acc_dhdx, 1,1, 1,1, halo_uv) call xctilr(acc_dhdy, 1,1, 1,1, halo_vv) - call getfldindex(fldlist_num, fldlist, 'So_omask', index_So_omask) - call getfldindex(fldlist_num, fldlist, 'So_u', index_So_u) - call getfldindex(fldlist_num, fldlist, 'So_v', index_So_v) - call getfldindex(fldlist_num, fldlist, 'So_dhdx', index_So_dhdx) - call getfldindex(fldlist_num, fldlist, 'So_dhdy', index_So_dhdy) - call getfldindex(fldlist_num, fldlist, 'So_t', index_So_t) - call getfldindex(fldlist_num, fldlist, 'So_s', index_So_s) - call getfldindex(fldlist_num, fldlist, 'So_bldepth', index_So_bldepth) - call getfldindex(fldlist_num, fldlist, 'Fioo_q', index_Fioo_q) - fldlist(index_So_omask)%dataptr(:) = 0._r8 fldlist(index_So_u)%dataptr(:) = 0._r8 fldlist(index_So_v)%dataptr(:) = 0._r8 @@ -1024,95 +1158,90 @@ subroutine blom_exportflds(fldlist_num, fldlist) ! Provide DMS flux [kmol DMS m-2 s-1], if requested. ! ------------------------------------------------------------------------ - call getfldindex(fldlist_num, fldlist, 'Faoo_dms', & - index_Faoo_dms) + if (index_Faoo_dms > 0) then + if (associated(fldlist(index_Faoo_dms)%dataptr)) then + fldlist(index_Faoo_dms)%dataptr(:) = 0._r8 - if (fdms_requested .and. index_Faoo_dms > 0) then - fldlist(index_Faoo_dms)%dataptr(:) = 0._r8 - - !$omp parallel do private(l, i, n) - do j = 1, jjcpl - do l = 1, isp(j) - do i = max(1, ifp(j,l)), min(ii, ilp(j,l)) - n = (j - 1)*ii + i - fldlist(index_Faoo_dms)%dataptr(n) = & - acc_fdms(i,j)*tfac*mod2med_areacor(n) - enddo + !$omp parallel do private(l, i, n) + do j = 1, jjcpl + do l = 1, isp(j) + do i = max(1, ifp(j,l)), min(ii, ilp(j,l)) + n = (j - 1)*ii + i + fldlist(index_Faoo_dms)%dataptr(n) = & + acc_fdms(i,j)*tfac*mod2med_areacor(n) + enddo + enddo enddo - enddo - !$omp end parallel do - else - if (mnproc == 1) & - write(lp,*) subname//': dms flux not sent to coupler' - endif - - call getfldindex(fldlist_num, fldlist, 'So_dms', & - index_So_dms) - - if (fdms_requested .and. index_So_dms > 0) then - fldlist(index_So_dms)%dataptr(:) = 0._r8 + !$omp end parallel do + else + if (mnproc == 1) & + write(lp,*) subname//': dms flux not sent to coupler' + endif + end if - !$omp parallel do private(l, i, n) - do j = 1, jjcpl - do l = 1, isp(j) - do i = max(1, ifp(j,l)), min(ii, ilp(j,l)) - n = (j - 1)*ii + i - fldlist(index_So_dms)%dataptr(n) = ocetra(i,j,1,idms) - enddo + if (index_So_dms > 0) then + if (associated(fldlist(index_So_dms)%dataptr)) then + fldlist(index_So_dms)%dataptr(:) = 0._r8 + !$omp parallel do private(l, i, n) + do j = 1, jjcpl + do l = 1, isp(j) + do i = max(1, ifp(j,l)), min(ii, ilp(j,l)) + n = (j - 1)*ii + i + fldlist(index_So_dms)%dataptr(n) = ocetra(i,j,1,idms) + enddo + enddo enddo - enddo - !$omp end parallel do + !$omp end parallel do + end if end if ! ------------------------------------------------------------------------ ! Provide CO2 flux [kg CO2 m-2 s-1], if requested. ! ------------------------------------------------------------------------ - call getfldindex(fldlist_num, fldlist, 'Faoo_fco2_ocn', & - index_Faoo_fco2_ocn) - - if (fco2_requested .and. index_Faoo_fco2_ocn > 0) then - fldlist(index_Faoo_fco2_ocn)%dataptr(:) = 0._r8 - !$omp parallel do private(l, i, n) - do j = 1, jjcpl - do l = 1, isp(j) - do i = max(1, ifp(j,l)), min(ii, ilp(j,l)) - n = (j - 1)*ii + i - fldlist(index_Faoo_fco2_ocn)%dataptr(n) = & - acc_fco2(i,j)*tfac*mod2med_areacor(n) - enddo + if (index_Faoo_fco2_ocn > 0) then + if (associated(fldlist(index_Faoo_fco2_ocn)%dataptr)) then + fldlist(index_Faoo_fco2_ocn)%dataptr(:) = 0._r8 + !$omp parallel do private(l, i, n) + do j = 1, jjcpl + do l = 1, isp(j) + do i = max(1, ifp(j,l)), min(ii, ilp(j,l)) + n = (j - 1)*ii + i + fldlist(index_Faoo_fco2_ocn)%dataptr(n) = & + acc_fco2(i,j)*tfac*mod2med_areacor(n) + enddo + enddo enddo - enddo - !$omp end parallel do - else - if (mnproc == 1) & - write(lp,*) subname//': co2 flux not sent to coupler' - endif + !$omp end parallel do + else + if (mnproc == 1) & + write(lp,*) subname//': co2 flux not sent to coupler' + endif + end if ! ------------------------------------------------------------------------ ! Provide bromoform flux [kg CHBr3 m-2 s-1], if requested. ! ------------------------------------------------------------------------ - call getfldindex(fldlist_num, fldlist, 'Faoo_fbrf_ocn', & - index_Faoo_fbrf_ocn) - - if (fbrf_requested .and. index_Faoo_fbrf_ocn > 0) then - fldlist(index_Faoo_fbrf_ocn)%dataptr(:) = 0._r8 - !$omp parallel do private(l, i, n) - do j = 1, jjcpl - do l = 1, isp(j) - do i = max(1, ifp(j,l)), min(ii, ilp(j,l)) - n = (j - 1)*ii + i - fldlist(index_Faoo_fbrf_ocn)%dataptr(n) = & - acc_fbrf(i,j)*tfac*mod2med_areacor(n) - enddo + if (index_Faoo_brf > 0) then + if (associated(fldlist(index_Faoo_brf)%dataptr)) then + fldlist(index_Faoo_brf)%dataptr(:) = 0._r8 + !$omp parallel do private(l, i, n) + do j = 1, jjcpl + do l = 1, isp(j) + do i = max(1, ifp(j,l)), min(ii, ilp(j,l)) + n = (j - 1)*ii + i + fldlist(index_Faoo_brf)%dataptr(n) = & + acc_fbrf(i,j)*tfac*mod2med_areacor(n) + enddo + enddo enddo - enddo - !$omp end parallel do - else - if (mnproc == 1) & - write(lp,*) subname//': bromoform flux not sent to coupler' - endif + !$omp end parallel do + else + if (mnproc == 1) & + write(lp,*) subname//': bromoform flux not sent to coupler' + endif + end if tlast_coupled = 0._r8 diff --git a/drivers/nuopc/ocn_comp_nuopc.F90 b/drivers/nuopc/ocn_comp_nuopc.F90 index 471362c1..62b5aace 100644 --- a/drivers/nuopc/ocn_comp_nuopc.F90 +++ b/drivers/nuopc/ocn_comp_nuopc.F90 @@ -41,16 +41,17 @@ module ocn_comp_nuopc use shr_file_mod, only: shr_file_getUnit, shr_file_getLogUnit, & shr_file_setLogUnit use shr_cal_mod, only : shr_cal_ymd2date - use mod_nuopc_methods, only: fldlist_type, tlast_coupled, fco2_requested, & - fdms_requested, fbrf_requested, & + use mod_nuopc_methods, only: fldlist_type, fldsMax, tlast_coupled, & blom_logwrite, blom_getgindex, blom_checkmesh, & blom_setareacor, blom_getglobdim, & blom_getprecipfact, blom_accflds, & - blom_importflds, blom_exportflds + blom_importflds, blom_exportflds, & + blom_advertise_imports, blom_advertise_exports use mod_xc, only: mpicom_external, lp, nfu use mod_cesm, only: runid_cesm, runtyp_cesm, ocn_cpl_dt_cesm use mod_config, only: inst_index, inst_name, inst_suffix use mod_time, only: blom_time + use mo_control_bgc, only : do_dmsflux_med implicit none @@ -62,7 +63,6 @@ module ocn_comp_nuopc character(len=*), parameter :: u_FILE_u = & __FILE__ - integer, parameter :: fldsMax = 100 integer :: fldsToOcn_num = 0 integer :: fldsFrOcn_num = 0 type(fldlist_type) :: fldsToOcn(fldsMax) @@ -74,7 +74,6 @@ module ocn_comp_nuopc integer :: flds_scalar_index_ny = 0 integer :: flds_scalar_index_precip_factor = 0 - logical :: ldriver_has_atm_co2_diag, ldriver_has_atm_co2_prog logical :: ocn2glc_coupling, flds_dms_med, flds_dms_ocn integer :: dbug = 10 @@ -88,42 +87,6 @@ module ocn_comp_nuopc ! Private procedures. ! --------------------------------------------------------------------------- - subroutine fldlist_add(num, fldlist, stdname, & - ungridded_lbound, ungridded_ubound) - ! --------------------------------------------------------------------------- - ! Add to list of field information. - ! --------------------------------------------------------------------------- - - ! Input/output arguments. - integer , intent(inout) :: num - type(fldlist_type), intent(inout) :: fldlist(:) - character(len=*) , intent(in) :: stdname - integer, optional , intent(in) :: ungridded_lbound, ungridded_ubound - - ! Local parameters. - character(len=*), parameter :: & - subname = modname//':(fldlist_add)' - - ! Local variables. - integer :: rc - - num = num + 1 - if (num > fldsMax) then - call ESMF_LogSetError(ESMF_RC_VAL_OUTOFRANGE, & - msg=subname//": ERROR number of field exceeded fldsMax: "// & - trim(stdname), & - line=__LINE__, file=__FILE__, rcToReturn=rc) - return - endif - fldlist(num)%stdname = trim(stdname) - - if (present(ungridded_lbound) .and. present(ungridded_ubound)) then - fldlist(num)%ungridded_lbound = ungridded_lbound - fldlist(num)%ungridded_ubound = ungridded_ubound - endif - - end subroutine fldlist_add - subroutine fldlist_realize(state, fldlist_num, fldlist, tag, mesh, rc) ! --------------------------------------------------------------------------- ! Realize list of import or export fields. @@ -387,7 +350,8 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) integer :: localPet, nthrds, shrlogunit, n character(len=cslen) :: starttype, stdname, cvalue, cname character(len=cllen) :: msg - logical :: isPresent, isSet, flds_co2a, flds_co2b, flds_co2c + logical :: isPresent, isSet + logical :: flds_co2a, flds_co2c ! Get debug flag. call NUOPC_CompAttributeGet(gcomp, name='dbug_flag', value=cvalue, & @@ -531,80 +495,28 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) if (ChkErr(rc, __LINE__, u_FILE_u)) return read(cvalue,*) flds_dms_med call blom_logwrite(subname//': flds_dms_med = '//trim(cvalue)) + if (flds_dms_med) then + do_dmsflux_med = .true. + else + do_dmsflux_med = .false. + end if ! ------------------------------------------------------------------------ ! Advertise import fields. ! ------------------------------------------------------------------------ - call fldlist_add(fldsToOcn_num, fldsToOcn, trim(flds_scalar_name)) - - ! From ice: - call fldlist_add(fldsToOcn_num, fldsToOcn, 'Si_ifrac') - call fldlist_add(fldsToOcn_num, fldsToOcn, 'Fioi_melth') - call fldlist_add(fldsToOcn_num, fldsToOcn, 'Fioi_meltw') - call fldlist_add(fldsToOcn_num, fldsToOcn, 'Fioi_salt') - call fldlist_add(fldsToOcn_num, fldsToOcn, 'Fioi_bcpho') - call fldlist_add(fldsToOcn_num, fldsToOcn, 'Fioi_bcphi') - call fldlist_add(fldsToOcn_num, fldsToOcn, 'Fioi_flxdst') - - ! From river: - call fldlist_add(fldsToOcn_num, fldsToOcn, 'Foxx_rofl') - call fldlist_add(fldsToOcn_num, fldsToOcn, 'Foxx_rofi') - - ! From mediator: - call fldlist_add(fldsToOcn_num, fldsToOcn, 'So_duu10n') - call fldlist_add(fldsToOcn_num, fldsToOcn, 'Foxx_tauy') - call fldlist_add(fldsToOcn_num, fldsToOcn, 'Foxx_taux') - call fldlist_add(fldsToOcn_num, fldsToOcn, 'Foxx_lat') - call fldlist_add(fldsToOcn_num, fldsToOcn, 'Foxx_sen') - call fldlist_add(fldsToOcn_num, fldsToOcn, 'Foxx_lwup') - call fldlist_add(fldsToOcn_num, fldsToOcn, 'Foxx_evap') - call fldlist_add(fldsToOcn_num, fldsToOcn, 'Foxx_swnet') - - ! From wave: - call fldlist_add(fldsToOcn_num, fldsToOcn, 'Sw_lamult') - call fldlist_add(fldsToOcn_num, fldsToOcn, 'Sw_ustokes') - call fldlist_add(fldsToOcn_num, fldsToOcn, 'Sw_vstokes') - call fldlist_add(fldsToOcn_num, fldsToOcn, 'Sw_hstokes') - - ! From atmosphere: - call fldlist_add(fldsToOcn_num, fldsToOcn, 'Sa_pslv') - call fldlist_add(fldsToOcn_num, fldsToOcn, 'Faxa_lwdn') - call fldlist_add(fldsToOcn_num, fldsToOcn, 'Faxa_snow') - call fldlist_add(fldsToOcn_num, fldsToOcn, 'Faxa_rain') - - ! From atm co2 fields: - call NUOPC_CompAttributeGet(gcomp, name='flds_co2a', value=cvalue, rc=rc) if (ChkErr(rc, __LINE__, u_FILE_u)) return read(cvalue,*) flds_co2a call blom_logwrite(subname//': flds_co2a = '//trim(cvalue)) - call NUOPC_CompAttributeGet(gcomp, name='flds_co2b', value=cvalue, rc=rc) - if (ChkErr(rc, __LINE__, u_FILE_u)) return - read(cvalue,*) flds_co2b - call blom_logwrite(subname//': flds_co2b = '//trim(cvalue)) - call NUOPC_CompAttributeGet(gcomp, name='flds_co2c', value=cvalue, rc=rc) if (ChkErr(rc, __LINE__, u_FILE_u)) return read(cvalue,*) flds_co2c call blom_logwrite(subname//': flds_co2c = '//trim(cvalue)) - if (flds_co2a .or. flds_co2c) then - call fldlist_add(fldsToOcn_num, fldsToOcn, 'Sa_co2diag') - call fldlist_add(fldsToOcn_num, fldsToOcn, 'Sa_co2prog') - ldriver_has_atm_co2_prog = .true. - ldriver_has_atm_co2_diag = .true. - else - ldriver_has_atm_co2_prog = .false. - ldriver_has_atm_co2_diag = .false. - endif - - if (flds_dms_med) then - call fldlist_add(fldsToOcn_num, fldsToOcn, 'Faox_dms') - end if - - !TODO Determine if will get nitrogen deposition from atm + call blom_advertise_imports(flds_scalar_name, fldsToOcn_num, fldsToOcn, & + flds_co2a, flds_co2c, flds_dms_med, flds_dms_ocn) do n = 1,fldsToOcn_num call NUOPC_Advertise(importState, standardName=fldsToOcn(n)%stdname, & @@ -631,24 +543,10 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) return endif - call fldlist_add(fldsFrOcn_num, fldsFrOcn, trim(flds_scalar_name)) - call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'So_omask') - call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'So_t') - call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'So_u') - call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'So_v') - call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'So_s') - call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'So_dhdx') - call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'So_dhdy') - call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'So_bldepth') - call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'Fioo_q') - call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'Faoo_fco2_ocn') + call blom_advertise_exports(flds_scalar_name, fldsFrOcn_num, fldsFrOcn, & + flds_dms_med, flds_dms_ocn) - if (flds_dms_med) then - call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'So_dms') - end if - if (flds_dms_ocn) then - call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'Faoo_dms') - end if + !TODO Determine if will get nitrogen deposition from atm do n = 1,fldsFrOcn_num call NUOPC_Advertise(exportState, standardName=fldsFrOcn(n)%stdname, & @@ -752,18 +650,15 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc) ! Realize the actively coupled fields. ! ------------------------------------------------------------------------ - write(6,*)'DEBUG: here1' call fldlist_realize(state=importState, & fldlist_num=fldsToOcn_num, fldlist=fldsToOcn, & tag=subname//':BLOM_Import', mesh=EMesh, rc=rc) if (ChkErr(rc, __LINE__, u_FILE_u)) return - write(6,*)'DEBUG: here2' call fldlist_realize(state=exportState, & fldlist_num=fldsFrOcn_num, fldlist=fldsFrOcn, & tag=subname//':BLOM_Export', mesh=EMesh, rc=rc) if (ChkErr(rc, __LINE__, u_FILE_u)) return - write(6,*)'DEBUG: here3' ! ------------------------------------------------------------------------ ! Set scalar data in export state. @@ -811,19 +706,6 @@ subroutine DataInitialize(gcomp, rc) call ESMF_GridCompGet(gcomp, exportState=exportState, rc=rc) if (ChkErr(rc, __LINE__, u_FILE_u)) return - ! ------------------------------------------------------------------------ - ! Check whether non-standard export fields are present. - ! ------------------------------------------------------------------------ - - call ESMF_StateGet(exportState, 'Faoo_fco2_ocn', itemType) - fco2_requested = (itemType /= ESMF_STATEITEM_NOTFOUND) - - call ESMF_StateGet(exportState, 'Faoo_dms', itemType) - fdms_requested = (itemType /= ESMF_STATEITEM_NOTFOUND) - - call ESMF_StateGet(exportState, 'Faoo_fbrf_ocn', itemType) - fbrf_requested = (itemType /= ESMF_STATEITEM_NOTFOUND) - ! ------------------------------------------------------------------------ ! TODO ! ------------------------------------------------------------------------ diff --git a/hamocc/mo_control_bgc.F90 b/hamocc/mo_control_bgc.F90 index c7058aa5..f3e4fac2 100644 --- a/hamocc/mo_control_bgc.F90 +++ b/hamocc/mo_control_bgc.F90 @@ -66,6 +66,8 @@ MODULE mo_control_bgc LOGICAL, save :: do_oalk =.false. ! apply ocean alkalinization logical, save :: with_dmsph =.false. ! apply DMS with pH dependence + logical, save :: do_dmsflux_med = .false. ! If dms flux is sent back from mediator, this will be set to .true. + contains subroutine get_bgc_namelist diff --git a/hamocc/mo_param1_bgc.F90 b/hamocc/mo_param1_bgc.F90 index 7bc0c5c7..737e3b07 100644 --- a/hamocc/mo_param1_bgc.F90 +++ b/hamocc/mo_param1_bgc.F90 @@ -261,8 +261,10 @@ subroutine init_por2octra_mapping() map_por2octra(ipowasi) = isilica ! if statements for non-base tracers +#ifdef cisonew if(ipowc13 > 0) map_por2octra(ipowc13) = isco213 if(ipowc14 > 0) map_por2octra(ipowc14) = isco214 +#endif end subroutine init_por2octra_mapping From 996903b17517293e89341272261d656a056ddef6 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Mon, 12 Jun 2023 15:42:49 +0200 Subject: [PATCH 03/52] first working version of being able to have blom use dms fluxes from mediator OR send the fluxes back --- cesm/mod_cesm.F90 | 15 +++-- drivers/nuopc/mod_nuopc_methods.F90 | 93 ++++++++++++++--------------- drivers/nuopc/ocn_comp_nuopc.F90 | 18 ++---- hamocc/carchm.F90 | 17 +++++- 4 files changed, 75 insertions(+), 68 deletions(-) diff --git a/cesm/mod_cesm.F90 b/cesm/mod_cesm.F90 index cc371c18..8124f001 100644 --- a/cesm/mod_cesm.F90 +++ b/cesm/mod_cesm.F90 @@ -29,7 +29,7 @@ module mod_cesm use mod_xc use mod_forcing, only: trxday, srxday, swa, nsf, lip, sop, eva, rnf, rfi, & fmltfz, sfl, ztx, mty, ustarw, slp, abswnd, & - lamult, lasl, ustokes, vstokes, atmco2, atmbrf + lamult, lasl, ustokes, vstokes, atmco2, atmbrf, flxdms use mod_ben02, only: initai, rdcsic, rdctsf, fnlzai use mod_seaice, only: ficem use mod_checksum, only: csdiag, chksummsk @@ -76,7 +76,8 @@ module mod_cesm ustokes_da, & ! u-component of surface Stokes drift [m s-1]. vstokes_da, & ! v-component of surface Stokes drift [m s-1]. atmco2_da, & ! Atmospheric CO2 concentration [ppm]. - atmbrf_da ! Atmospheric bromoform concentration [ppt]. + atmbrf_da, & ! Atmospheric bromoform concentration [ppt]. + flxdms_da ! dms surface flux computed by mediator [kg m-2 s-1] logical :: & smtfrc ! If true, time smooth CESM forcing fields. @@ -84,13 +85,14 @@ module mod_cesm integer :: & l1ci, l2ci ! Time-level indices for time smoothing of CESM fields. + logical :: get_flxdms_from_med + public :: runid_cesm, runtyp_cesm, ocn_cpl_dt_cesm, nstep_in_cpl, hmlt, & frzpot, mltpot, swa_da, nsf_da, hmlt_da, lip_da, sop_da, eva_da, & rnf_da, rfi_da, fmltfz_da, sfl_da, ztx_da, mty_da, ustarw_da, & - slp_da, abswnd_da, ficem_da, lamult_da, lasl_da, & + slp_da, abswnd_da, ficem_da, lamult_da, lasl_da, flxdms_da, & ustokes_da, vstokes_da, atmco2_da, atmbrf_da, smtfrc, l1ci, l2ci, & - inicon_cesm, inifrc_cesm, getfrc_cesm - + inicon_cesm, inifrc_cesm, getfrc_cesm, get_flxdms_from_med contains subroutine inicon_cesm @@ -189,6 +191,9 @@ subroutine getfrc_cesm vstokes(i, j) = w1*vstokes_da(i, j, l1ci) + w2*vstokes_da(i, j, l2ci) atmco2(i, j) = w1*atmco2_da(i, j, l1ci) + w2*atmco2_da(i, j, l2ci) atmbrf(i, j) = w1*atmbrf_da(i, j, l1ci) + w2*atmbrf_da(i, j, l2ci) + if (get_flxdms_from_med) then + flxdms(i, j) = w1*flxdms_da(i, j, l1ci) + w2*flxdms_da(i, j, l2ci) + end if enddo enddo do l = 1, isu(j) diff --git a/drivers/nuopc/mod_nuopc_methods.F90 b/drivers/nuopc/mod_nuopc_methods.F90 index d962f446..239c0347 100644 --- a/drivers/nuopc/mod_nuopc_methods.F90 +++ b/drivers/nuopc/mod_nuopc_methods.F90 @@ -38,14 +38,12 @@ module mod_nuopc_methods 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, atmbrf_da, & - l1ci, l2ci + flxdms_da, get_flxdms_from_med, l1ci, l2ci use mod_utility, only: util1, util2 use mod_checksum, only: csdiag, chksummsk use shr_const_mod, only: SHR_CONST_RHOSW, SHR_CONST_LATICE, SHR_CONST_TKFRZ use mo_carbch, only: ocetra use mo_param1_bgc, only: idms - use mo_intfcblom, only: bgc_dp, omask - use mo_vgrid, only : dp_min implicit none @@ -196,7 +194,7 @@ end subroutine getfldindex ! --------------------------------------------------------------------------- subroutine blom_advertise_imports(flds_scalar_name, fldsToOcn_num, fldsToOcn, & - flds_co2a, flds_co2c, flds_dms_med, flds_dms_ocn) + flds_co2a, flds_co2c) ! ------------------------------------------------------------------- ! Determine fldsToOcn for import fields @@ -207,8 +205,6 @@ subroutine blom_advertise_imports(flds_scalar_name, fldsToOcn_num, fldsToOcn, & type(fldlist_type) , intent(inout), dimension(:) :: fldsToOcn logical , intent(in) :: flds_co2a logical , intent(in) :: flds_co2c - logical , intent(in) :: flds_dms_med - logical , intent(in) :: flds_dms_ocn integer :: index_scalar @@ -236,7 +232,7 @@ subroutine blom_advertise_imports(flds_scalar_name, fldsToOcn_num, fldsToOcn, & call fldlist_add(fldsToOcn_num, fldsToOcn, 'Foxx_lwup' , index_Foxx_lwup) call fldlist_add(fldsToOcn_num, fldsToOcn, 'Foxx_evap' , index_Foxx_evap) call fldlist_add(fldsToOcn_num, fldsToOcn, 'Foxx_swnet' , index_Foxx_swnet) - if (flds_dms_med) then + if (get_flxdms_from_med) then call fldlist_add(fldsToOcn_num, fldsToOcn, 'Faox_dms', index_Faox_dms) !call fldlist_add(fldsToOcn_num, fldsToOcn, 'Faox_brf', index_Faox_brf) end if @@ -262,8 +258,7 @@ subroutine blom_advertise_imports(flds_scalar_name, fldsToOcn_num, fldsToOcn, & end subroutine blom_advertise_imports - subroutine blom_advertise_exports(flds_scalar_name, fldsFrOcn_num, fldsFrOcn, & - flds_dms_med, flds_dms_ocn) + subroutine blom_advertise_exports(flds_scalar_name, fldsFrOcn_num, fldsFrOcn) ! ------------------------------------------------------------------- ! Determine fldsToOcn for export fields @@ -272,8 +267,6 @@ subroutine blom_advertise_exports(flds_scalar_name, fldsFrOcn_num, fldsFrOcn, & character(len=*) , intent(in) :: flds_scalar_name integer , intent(inout) :: fldsFrOcn_num type(fldlist_type), dimension(:) , intent(inout) :: fldsFrOcn - logical , intent(in) :: flds_dms_med - logical , intent(in) :: flds_dms_ocn integer :: index_scalar @@ -289,10 +282,8 @@ subroutine blom_advertise_exports(flds_scalar_name, fldsFrOcn_num, fldsFrOcn, & call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'So_bldepth' , index_So_bldepth) call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'Fioo_q' , index_Fioo_q) call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'Faoo_fco2_ocn' , index_Faoo_fco2_ocn) - if (flds_dms_med) then - call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'So_dms', index_So_dms) - end if - if (flds_dms_ocn) then + call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'So_dms' , index_So_dms) + if (.not. get_flxdms_from_med) then call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'Faoo_dms', index_Faoo_dms) end if ! if (flds_brf_med) then @@ -613,17 +604,19 @@ subroutine blom_accflds !$omp end parallel do endif - if (index_Faoo_dms > 0) then - !$omp parallel do private(l, i) - do j = 1, jj - do l = 1, isp(j) - do i = max(1, ifp(j,l)), min(ii, ilp(j,l)) - acc_fdms(i,j) = acc_fdms(i,j) + flxdms(i,j)*baclin - enddo + if (.not. get_flxdms_from_med) then + if (index_Faoo_dms > 0) then + !$omp parallel do private(l, i) + do j = 1, jj + do l = 1, isp(j) + do i = max(1, ifp(j,l)), min(ii, ilp(j,l)) + acc_fdms(i,j) = acc_fdms(i,j) + flxdms(i,j)*baclin + enddo + enddo enddo - enddo - !$omp end parallel do - endif + !$omp end parallel do + endif + end if if (index_Faoo_brf) then !$omp parallel do private(l, i) @@ -662,7 +655,6 @@ subroutine blom_importflds(fldlist_num, fldlist) fval = - 1.e13_r8 ! Local variables. - real(r8) :: flxdms_med real(r8) :: afac, utmp, vtmp integer :: n, i, j, l @@ -1012,29 +1004,31 @@ subroutine blom_importflds(fldlist_num, fldlist) write(lp,*) subname//': prog. atmospheric bromoform not read' endif - if (index_Faox_dms > 0) then - if (associated(fldlist(index_Faox_dms)%dataptr)) then - !$omp parallel do private(i, n, afac) - do j = 1, jjcpl - do i = 1, ii - n = (j - 1)*ii + i - afac = med2mod_areacor(n) - if (ip(i,j) == 0) then - flxdms_med = 0._r8 - elseif (cplmsk(i,j) == 0) then - flxdms_med = 0._r8 - else - flxdms_med = fldlist(index_Faox_dms)%dataptr(n)*afac - end if + + if (get_flxdms_from_med) then + if (index_Faox_dms > 0) then + if (associated(fldlist(index_Faox_dms)%dataptr)) then + !$omp parallel do private(i, n, afac) + do j = 1, jjcpl + do i = 1, ii + n = (j - 1)*ii + i + afac = med2mod_areacor(n) + if (ip(i,j) == 0) then + flxdms_da(i,j,l2ci) = mval + elseif (cplmsk(i,j) == 0) then + flxdms_da(i,j,l2ci) = 0._r8 + else + flxdms_da(i,j,l2ci) = fldlist(index_Faox_dms)%dataptr(n)*afac + end if + end do end do - ! size of scalar grid cell [m]. - if (omask(i,j) > 0.5.and. bgc_dp(i,j,1) > dp_min) then - ocetra(i,j,1,idms) = ocetra(i,j,1,idms) - flxdms_med/bgc_dp(i,j,1) - end if - end do - !$omp end parallel do - if (mnproc == 1) & - write(lp,*) subname//': prog. dms flux obtained from mediator' + !$omp end parallel do + if (mnproc == 1) & + write(lp,*) subname//': prog. dms flux obtained from mediator' + end if + if (nreg == 2) then + call xctilr(flxdms_da(1-nbdy,1-nbdy,l2ci), 1,1, 0,0, halo_ps) + end if end if end if @@ -1060,6 +1054,9 @@ subroutine blom_importflds(fldlist_num, fldlist) 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(atmbrf_da(1-nbdy,1-nbdy,l2ci),ip,1,'atmbrf') + if (get_flxdms_from_med .and. index_Faox_dms > 0) then + call chksummsk(flxdms_da(1-nbdy,1-nbdy,l2ci),ip,1,'flxdms_da') + end if endif end subroutine blom_importflds diff --git a/drivers/nuopc/ocn_comp_nuopc.F90 b/drivers/nuopc/ocn_comp_nuopc.F90 index 62b5aace..f557b5a1 100644 --- a/drivers/nuopc/ocn_comp_nuopc.F90 +++ b/drivers/nuopc/ocn_comp_nuopc.F90 @@ -51,7 +51,7 @@ module ocn_comp_nuopc use mod_cesm, only: runid_cesm, runtyp_cesm, ocn_cpl_dt_cesm use mod_config, only: inst_index, inst_name, inst_suffix use mod_time, only: blom_time - use mo_control_bgc, only : do_dmsflux_med + use mod_cesm, only : get_flxdms_from_med implicit none @@ -74,7 +74,7 @@ module ocn_comp_nuopc integer :: flds_scalar_index_ny = 0 integer :: flds_scalar_index_precip_factor = 0 - logical :: ocn2glc_coupling, flds_dms_med, flds_dms_ocn + logical :: ocn2glc_coupling, flds_dms_med integer :: dbug = 10 logical :: profile_memory = .false. @@ -486,19 +486,14 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) endif ! Determine if dms will be sent to mediator (currently both flux and concentration) - call NUOPC_CompAttributeGet(gcomp, name='flds_dms_ocn', value=cvalue, rc=rc) - if (ChkErr(rc, __LINE__, u_FILE_u)) return - read(cvalue,*) flds_dms_ocn - call blom_logwrite(subname//': flds_dms_ocn = '//trim(cvalue)) - call NUOPC_CompAttributeGet(gcomp, name='flds_dms_med', value=cvalue, rc=rc) if (ChkErr(rc, __LINE__, u_FILE_u)) return read(cvalue,*) flds_dms_med call blom_logwrite(subname//': flds_dms_med = '//trim(cvalue)) if (flds_dms_med) then - do_dmsflux_med = .true. + get_flxdms_from_med = .true. else - do_dmsflux_med = .false. + get_flxdms_from_med = .false. end if ! ------------------------------------------------------------------------ @@ -516,7 +511,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) call blom_logwrite(subname//': flds_co2c = '//trim(cvalue)) call blom_advertise_imports(flds_scalar_name, fldsToOcn_num, fldsToOcn, & - flds_co2a, flds_co2c, flds_dms_med, flds_dms_ocn) + flds_co2a, flds_co2c) do n = 1,fldsToOcn_num call NUOPC_Advertise(importState, standardName=fldsToOcn(n)%stdname, & @@ -543,8 +538,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) return endif - call blom_advertise_exports(flds_scalar_name, fldsFrOcn_num, fldsFrOcn, & - flds_dms_med, flds_dms_ocn) + call blom_advertise_exports(flds_scalar_name, fldsFrOcn_num, fldsFrOcn) !TODO Determine if will get nitrogen deposition from atm diff --git a/hamocc/carchm.F90 b/hamocc/carchm.F90 index f0563983..1ae0d3c3 100644 --- a/hamocc/carchm.F90 +++ b/hamocc/carchm.F90 @@ -118,6 +118,8 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & use mo_carbch, only: atm_co2_nat,nathi,natco3,natpco2d,natomegaa,natomegac use mo_param1_bgc, only: iatmnco2,inatalkali,inatcalc,inatsco212 #endif + use mod_cesm, only : get_flxdms_from_med + use mod_forcing, only : flxdms implicit none @@ -474,8 +476,13 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & #endif ! Surface flux of dms - dmsflux = kwdms*dtbgc*ocetra(i,j,1,idms) - ocetra(i,j,1,idms)=ocetra(i,j,1,idms)-dmsflux/pddpo(i,j,1) + if (get_flxdms_from_med) then + ocetra(i,j,1,idms) = ocetra(i,j,1,idms) - flxdms(i,j)/pddpo(i,j,1) + else + dmsflux = kwdms*dtbgc*ocetra(i,j,1,idms) + ocetra(i,j,1,idms) = ocetra(i,j,1,idms) - dmsflux/pddpo(i,j,1) + end if + #ifdef BROMO ! Quack and Wallace (2003) eq. 1 ! flux = kw*(Cw - Ca/H) ; kw[m s-1]; Cw[kmol m-3]; @@ -494,7 +501,11 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & atmflx(i,j,iatmo2)=oxflux atmflx(i,j,iatmn2)=niflux atmflx(i,j,iatmn2o)=n2oflux - atmflx(i,j,iatmdms)=dmsflux ! positive to atmosphere [kmol dms m-2 timestep-1] + if (get_flxdms_from_med) then + atmflx(i,j,iatmdms)=flxdms(i,j) ! positive to atmosphere [kmol dms m-2 timestep-1] + else + atmflx(i,j,iatmdms)=dmsflux ! positive to atmosphere [kmol dms m-2 timestep-1] + end if #ifdef cisonew atmflx(i,j,iatmc13)=flux13u-flux13d atmflx(i,j,iatmc14)=flux14u-flux14d From 129e1cb0985dd9b18cf05c3c842f6e8889d8594e Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Wed, 14 Jun 2023 14:46:10 +0200 Subject: [PATCH 04/52] fixes to have dms tracer update occur correctly when dms fluxes are passed back from mediator --- cesm/mod_cesm.F90 | 2 +- drivers/nuopc/mod_nuopc_methods.F90 | 29 +++++++++++++++++------------ hamocc/carchm.F90 | 13 ++++++------- 3 files changed, 24 insertions(+), 20 deletions(-) diff --git a/cesm/mod_cesm.F90 b/cesm/mod_cesm.F90 index 8124f001..07cd0fd4 100644 --- a/cesm/mod_cesm.F90 +++ b/cesm/mod_cesm.F90 @@ -85,7 +85,7 @@ module mod_cesm integer :: & l1ci, l2ci ! Time-level indices for time smoothing of CESM fields. - logical :: get_flxdms_from_med + logical :: get_flxdms_from_med = .false. ! This ensures backwards compatiblity public :: runid_cesm, runtyp_cesm, ocn_cpl_dt_cesm, nstep_in_cpl, hmlt, & frzpot, mltpot, swa_da, nsf_da, hmlt_da, lip_da, sop_da, eva_da, & diff --git a/drivers/nuopc/mod_nuopc_methods.F90 b/drivers/nuopc/mod_nuopc_methods.F90 index 239c0347..8f37f66e 100644 --- a/drivers/nuopc/mod_nuopc_methods.F90 +++ b/drivers/nuopc/mod_nuopc_methods.F90 @@ -42,8 +42,10 @@ module mod_nuopc_methods use mod_utility, only: util1, util2 use mod_checksum, only: csdiag, chksummsk use shr_const_mod, only: SHR_CONST_RHOSW, SHR_CONST_LATICE, SHR_CONST_TKFRZ +#ifdef HAMOCC use mo_carbch, only: ocetra use mo_param1_bgc, only: idms +#endif implicit none @@ -232,10 +234,11 @@ subroutine blom_advertise_imports(flds_scalar_name, fldsToOcn_num, fldsToOcn, & call fldlist_add(fldsToOcn_num, fldsToOcn, 'Foxx_lwup' , index_Foxx_lwup) call fldlist_add(fldsToOcn_num, fldsToOcn, 'Foxx_evap' , index_Foxx_evap) call fldlist_add(fldsToOcn_num, fldsToOcn, 'Foxx_swnet' , index_Foxx_swnet) +#ifdef HAMOCC if (get_flxdms_from_med) then call fldlist_add(fldsToOcn_num, fldsToOcn, 'Faox_dms', index_Faox_dms) - !call fldlist_add(fldsToOcn_num, fldsToOcn, 'Faox_brf', index_Faox_brf) end if +#endif ! From wave: call fldlist_add(fldsToOcn_num, fldsToOcn, 'Sw_lamult' , index_Sw_lamult) @@ -282,16 +285,13 @@ subroutine blom_advertise_exports(flds_scalar_name, fldsFrOcn_num, fldsFrOcn) call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'So_bldepth' , index_So_bldepth) call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'Fioo_q' , index_Fioo_q) call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'Faoo_fco2_ocn' , index_Faoo_fco2_ocn) - call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'So_dms' , index_So_dms) - if (.not. get_flxdms_from_med) then +#ifdef HAMOCC + if (get_flxdms_from_med) then + call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'So_dms' , index_So_dms) + else call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'Faoo_dms', index_Faoo_dms) end if - ! if (flds_brf_med) then - ! call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'So_brf', index_So_brf) - ! end if - ! if (flds_brf_ocn) then - ! call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'Faoo_brf', index_Faoo_brf) - ! end if +#endif end subroutine blom_advertise_exports subroutine blom_logwrite(msg) @@ -604,6 +604,7 @@ subroutine blom_accflds !$omp end parallel do endif +#ifdef HAMOCC if (.not. get_flxdms_from_med) then if (index_Faoo_dms > 0) then !$omp parallel do private(l, i) @@ -617,6 +618,7 @@ subroutine blom_accflds !$omp end parallel do endif end if +#endif if (index_Faoo_brf) then !$omp parallel do private(l, i) @@ -1004,7 +1006,7 @@ subroutine blom_importflds(fldlist_num, fldlist) write(lp,*) subname//': prog. atmospheric bromoform not read' endif - +#ifdef HAMOCC if (get_flxdms_from_med) then if (index_Faox_dms > 0) then if (associated(fldlist(index_Faox_dms)%dataptr)) then @@ -1018,7 +1020,8 @@ subroutine blom_importflds(fldlist_num, fldlist) elseif (cplmsk(i,j) == 0) then flxdms_da(i,j,l2ci) = 0._r8 else - flxdms_da(i,j,l2ci) = fldlist(index_Faox_dms)%dataptr(n)*afac + write(6,'(a,i8,2x,i8,2x,d13.5)')'DEBUG: i,j,afac = ',i,j,afac + flxdms_da(i,j,l2ci) = fldlist(index_Faox_dms)%dataptr(n)*afac/62.13 end if end do end do @@ -1031,6 +1034,7 @@ subroutine blom_importflds(fldlist_num, fldlist) end if end if end if +#endif if (csdiag) then if (mnproc == 1) then @@ -1155,10 +1159,10 @@ subroutine blom_exportflds(fldlist_num, fldlist) ! Provide DMS flux [kmol DMS m-2 s-1], if requested. ! ------------------------------------------------------------------------ +#ifdef HAMOCC if (index_Faoo_dms > 0) then if (associated(fldlist(index_Faoo_dms)%dataptr)) then fldlist(index_Faoo_dms)%dataptr(:) = 0._r8 - !$omp parallel do private(l, i, n) do j = 1, jjcpl do l = 1, isp(j) @@ -1191,6 +1195,7 @@ subroutine blom_exportflds(fldlist_num, fldlist) !$omp end parallel do end if end if +#endif ! ------------------------------------------------------------------------ ! Provide CO2 flux [kg CO2 m-2 s-1], if requested. diff --git a/hamocc/carchm.F90 b/hamocc/carchm.F90 index 1ae0d3c3..8505d73d 100644 --- a/hamocc/carchm.F90 +++ b/hamocc/carchm.F90 @@ -477,11 +477,14 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & ! Surface flux of dms if (get_flxdms_from_med) then - ocetra(i,j,1,idms) = ocetra(i,j,1,idms) - flxdms(i,j)/pddpo(i,j,1) + ! Note that flux from mediator is downwards positive, whereas dms flux computed above + ! is upwards positive - so need a different sign + dmsflux = -dtbgc*flxdms(i,j) else + ! Note that kwdms already has the open ocean fraction in the term dmsflux = kwdms*dtbgc*ocetra(i,j,1,idms) - ocetra(i,j,1,idms) = ocetra(i,j,1,idms) - dmsflux/pddpo(i,j,1) end if + ocetra(i,j,1,idms) = ocetra(i,j,1,idms) - dmsflux/pddpo(i,j,1) #ifdef BROMO ! Quack and Wallace (2003) eq. 1 @@ -501,11 +504,7 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & atmflx(i,j,iatmo2)=oxflux atmflx(i,j,iatmn2)=niflux atmflx(i,j,iatmn2o)=n2oflux - if (get_flxdms_from_med) then - atmflx(i,j,iatmdms)=flxdms(i,j) ! positive to atmosphere [kmol dms m-2 timestep-1] - else - atmflx(i,j,iatmdms)=dmsflux ! positive to atmosphere [kmol dms m-2 timestep-1] - end if + atmflx(i,j,iatmdms)=dmsflux ! positive to atmosphere [kmol dms m-2 timestep-1] #ifdef cisonew atmflx(i,j,iatmc13)=flux13u-flux13d atmflx(i,j,iatmc14)=flux14u-flux14d From 670d3d5ee08f638fb5377d4174914d2eea96499c Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Thu, 15 Jun 2023 12:45:43 +0200 Subject: [PATCH 05/52] put in changes necessary for backwards compatibility and testing --- cime_config/buildnml | 7 +++- drivers/nuopc/ocn_comp_nuopc.F90 | 62 +++++++++++++++++--------------- 2 files changed, 40 insertions(+), 29 deletions(-) diff --git a/cime_config/buildnml b/cime_config/buildnml index 6f90c778..42bff945 100755 --- a/cime_config/buildnml +++ b/cime_config/buildnml @@ -30,6 +30,7 @@ set RUN_STARTDATE = `./xmlquery RUN_STARTDATE --value` set PIO_TYPENAME_OCN = `./xmlquery PIO_TYPENAME_OCN --value` set PIO_NETCDF_FORMAT_OCN = `./xmlquery PIO_NETCDF_FORMAT_OCN --value` set NINST_OCN = `./xmlquery NINST_OCN --value` +set TEST=`./xmlquery TEST --value` #------------------------------------------------------------------------------ # Check if HAMOCC is requested @@ -284,7 +285,11 @@ set SEDPORFILE = "''" # set DIAPHY defaults set GLB_FNAMETAG = "'hd','hm','hy'" set GLB_AVEPERIO = '1, 30, 365' -set GLB_FILEFREQ = '30, 30, 365' +if ($TEST == TRUE) then + set GLB_FILEFREQ = '1, 30, 365' +else + set GLB_FILEFREQ = '30, 30, 365' +endif set GLB_COMPFLAG = '0, 0, 0' if ($PIO_NETCDF_FORMAT_OCN == 64bit_offset) then set GLB_NCFORMAT = '1, 1, 1' diff --git a/drivers/nuopc/ocn_comp_nuopc.F90 b/drivers/nuopc/ocn_comp_nuopc.F90 index f557b5a1..bc504f14 100644 --- a/drivers/nuopc/ocn_comp_nuopc.F90 +++ b/drivers/nuopc/ocn_comp_nuopc.F90 @@ -485,21 +485,23 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) trim(cvalue), ESMF_LOGMSG_INFO) endif - ! Determine if dms will be sent to mediator (currently both flux and concentration) - call NUOPC_CompAttributeGet(gcomp, name='flds_dms_med', value=cvalue, rc=rc) + ! Determine if dms flux will be computed in mediator and sent to BLOM + call NUOPC_CompAttributeGet(gcomp, name='flds_dms_med', value=cvalue, & + isPresent=isPresent, isSet=isSet, rc=rc) if (ChkErr(rc, __LINE__, u_FILE_u)) return - read(cvalue,*) flds_dms_med - call blom_logwrite(subname//': flds_dms_med = '//trim(cvalue)) - if (flds_dms_med) then - get_flxdms_from_med = .true. - else + if (.not. isPresent .and. .not. isSet) then get_flxdms_from_med = .false. + else + read(cvalue,*) flds_dms_med + call blom_logwrite(subname//': flds_dms_med = '//trim(cvalue)) + if (flds_dms_med) then + get_flxdms_from_med = .true. + else + get_flxdms_from_med = .false. + end if end if - ! ------------------------------------------------------------------------ - ! Advertise import fields. - ! ------------------------------------------------------------------------ - + ! Determine if co2 will be imported from mediator call NUOPC_CompAttributeGet(gcomp, name='flds_co2a', value=cvalue, rc=rc) if (ChkErr(rc, __LINE__, u_FILE_u)) return read(cvalue,*) flds_co2a @@ -510,27 +512,14 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) read(cvalue,*) flds_co2c call blom_logwrite(subname//': flds_co2c = '//trim(cvalue)) - call blom_advertise_imports(flds_scalar_name, fldsToOcn_num, fldsToOcn, & - flds_co2a, flds_co2c) - - do n = 1,fldsToOcn_num - call NUOPC_Advertise(importState, standardName=fldsToOcn(n)%stdname, & - TransferOfferGeomObject='will provide', rc=rc) - if (ChkErr(rc, __LINE__, u_FILE_u)) return - enddo - - ! ------------------------------------------------------------------------ - ! Advertise export fields. - ! ------------------------------------------------------------------------ - ! Determine if ocn is sending temperature and salinity data to glc + ! If data is sent to glc will need to determine number of ocean + ! levels and ocean level indices call NUOPC_CompAttributeGet(gcomp, name="ocn2glc_coupling", value=cvalue, rc=rc) if (ChkErr(rc, __LINE__, u_FILE_u)) return read(cvalue,*) ocn2glc_coupling write(msg,'(a,l1)') subname//': ocn2glc coupling is ', ocn2glc_coupling call blom_logwrite(msg) - - ! Determine number of ocean levels and ocean level indices if (ocn2glc_coupling) then call ESMF_LogSetError(ESMF_RC_NOT_IMPL, & msg=subname//": ocn2glc coupling not implemented", & @@ -538,9 +527,26 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) return endif - call blom_advertise_exports(flds_scalar_name, fldsFrOcn_num, fldsFrOcn) + !NOTE: Nitrogen deposition is always sent from atm now (either CAM or DATM) + + ! ------------------------------------------------------------------------ + ! Advertise import fields. + ! ------------------------------------------------------------------------ + + call blom_advertise_imports(flds_scalar_name, fldsToOcn_num, fldsToOcn, & + flds_co2a, flds_co2c) + + do n = 1,fldsToOcn_num + call NUOPC_Advertise(importState, standardName=fldsToOcn(n)%stdname, & + TransferOfferGeomObject='will provide', rc=rc) + if (ChkErr(rc, __LINE__, u_FILE_u)) return + enddo - !TODO Determine if will get nitrogen deposition from atm + ! ------------------------------------------------------------------------ + ! Advertise export fields. + ! ------------------------------------------------------------------------ + + call blom_advertise_exports(flds_scalar_name, fldsFrOcn_num, fldsFrOcn) do n = 1,fldsFrOcn_num call NUOPC_Advertise(exportState, standardName=fldsFrOcn(n)%stdname, & From a8540ea2f2c8ce9911ec34ec286fd11219395610 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Thu, 15 Jun 2023 22:05:32 +0200 Subject: [PATCH 06/52] fixes for slowdown --- cime_config/buildnml | 6 +++- cime_config/config_pes.xml | 44 ++++++++++++++--------------- drivers/nuopc/mod_nuopc_methods.F90 | 42 ++++++++++++++++++--------- 3 files changed, 55 insertions(+), 37 deletions(-) diff --git a/cime_config/buildnml b/cime_config/buildnml index 42bff945..f566f249 100755 --- a/cime_config/buildnml +++ b/cime_config/buildnml @@ -465,7 +465,11 @@ set MSC_SSTGA = '0, 4, 0' # set DIABGC defaults set BGC_FNAMETAG = "'hbgcd','hbgcm','hbgcy'" set BGC_AVEPERIO = '1,30,365' -set BGC_FILEFREQ = '30,30,365' +if ($TEST == TRUE) then + set BGC_FILEFREQ = ' 1,30,365' +else + set BGC_FILEFREQ = '30,30,365' +endif set BGC_COMPFLAG = '0, 0, 0' if ($PIO_NETCDF_FORMAT_OCN == 64bit_offset) then set BGC_NCFORMAT = '1, 1, 1' diff --git a/cime_config/config_pes.xml b/cime_config/config_pes.xml index 0a59a9e5..fa49183c 100644 --- a/cime_config/config_pes.xml +++ b/cime_config/config_pes.xml @@ -118,11 +118,11 @@ none - 1 - 1 - 96 + 158 + 158 + 158 354 - 126 + 158 1 1 1 @@ -138,11 +138,11 @@ 1 - 96 - 97 - 98 + 0 + 0 + 0 0 - 126 + 158 0 0 0 @@ -155,11 +155,11 @@ none - 192 - 192 - 192 + 158 + 158 + 158 354 - 192 + 158 1 1 1 @@ -179,7 +179,7 @@ 0 0 0 - 192 + 158 0 0 0 @@ -192,11 +192,11 @@ none - 1 - 1 + 96 + 96 96 - 354 - 126 + 256 + 96 1 1 1 @@ -212,11 +212,11 @@ 1 - 96 - 97 - 98 + 0 + 0 + 0 0 - 126 + 96 0 0 0 @@ -418,7 +418,7 @@ none 128 - 16 + 128 96 156 128 diff --git a/drivers/nuopc/mod_nuopc_methods.F90 b/drivers/nuopc/mod_nuopc_methods.F90 index 8f37f66e..f2e63baa 100644 --- a/drivers/nuopc/mod_nuopc_methods.F90 +++ b/drivers/nuopc/mod_nuopc_methods.F90 @@ -498,6 +498,7 @@ subroutine blom_accflds ! Local variables. real(r8) :: q integer m, n, mm, nn, k1m, k1n, i, j, l + logical :: first_call = .true. ! ------------------------------------------------------------------------ ! Set accumulation arrays to zero if this is the first call after a @@ -586,7 +587,7 @@ subroutine blom_accflds enddo !$omp end parallel do case default - if (mnproc == 1) & + if (mnproc == 1.and. first_call) & write(lp,*) subname//': unsupported vertical coordinate!' call xcstop(subname) stop subname @@ -638,6 +639,10 @@ subroutine blom_accflds tlast_coupled = tlast_coupled + baclin + if (first_call) then + first_call = .false. + end if + end subroutine blom_accflds subroutine blom_importflds(fldlist_num, fldlist) @@ -655,6 +660,7 @@ subroutine blom_importflds(fldlist_num, fldlist) real(r8), parameter :: & mval = - 1.e12_r8, & fval = - 1.e13_r8 + logical :: first_call = .true. ! Local variables. real(r8) :: afac, utmp, vtmp @@ -901,7 +907,7 @@ subroutine blom_importflds(fldlist_num, fldlist) enddo !$omp end parallel do call fill_global(mval, fval, halo_ps, atmco2_da(1-nbdy,1-nbdy,l2ci)) - if (mnproc == 1) & + if (mnproc == 1 .and. first_call) & write(lp,*) subname//': prog. atmospheric co2 read' else !$omp parallel do private(i) @@ -915,7 +921,7 @@ subroutine blom_importflds(fldlist_num, fldlist) enddo enddo !$omp end parallel do - if (mnproc == 1) & + if (mnproc == 1 .and. first_call) & write(lp,*) subname//': prog. atmospheric co2 not read' endif @@ -938,7 +944,7 @@ subroutine blom_importflds(fldlist_num, fldlist) enddo !$omp end parallel do call fill_global(mval, fval, halo_ps, atmco2_da(1-nbdy,1-nbdy,l2ci)) - if (mnproc == 1) & + if (mnproc == 1 .and. first_call) & write(lp,*) subname//': diag. atmospheric co2 read' else !$omp parallel do private(i) @@ -952,7 +958,7 @@ subroutine blom_importflds(fldlist_num, fldlist) enddo enddo !$omp end parallel do - if (mnproc == 1) & + if (mnproc == 1 .and. first_call) & write(lp,*) subname//': diag. atmospheric co2 not read' endif #else @@ -967,7 +973,7 @@ subroutine blom_importflds(fldlist_num, fldlist) enddo enddo !$omp end parallel do - if (mnproc == 1) & + if (mnproc == 1 .and. first_call) & write(lp,*) subname//': atmospheric co2 not read' #endif @@ -988,7 +994,7 @@ subroutine blom_importflds(fldlist_num, fldlist) enddo !$omp end parallel do call fill_global(mval, fval, halo_ps, atmbrf_da(1-nbdy,1-nbdy,l2ci)) - if (mnproc == 1) & + if (mnproc == 1 .and. first_call) & write(lp,*) subname//': prog. atmospheric bromoform read' else !$omp parallel do private(i) @@ -1002,7 +1008,7 @@ subroutine blom_importflds(fldlist_num, fldlist) enddo enddo !$omp end parallel do - if (mnproc == 1) & + if (mnproc == 1 .and. first_call) & write(lp,*) subname//': prog. atmospheric bromoform not read' endif @@ -1020,13 +1026,12 @@ subroutine blom_importflds(fldlist_num, fldlist) elseif (cplmsk(i,j) == 0) then flxdms_da(i,j,l2ci) = 0._r8 else - write(6,'(a,i8,2x,i8,2x,d13.5)')'DEBUG: i,j,afac = ',i,j,afac flxdms_da(i,j,l2ci) = fldlist(index_Faox_dms)%dataptr(n)*afac/62.13 end if end do end do !$omp end parallel do - if (mnproc == 1) & + if (mnproc == 1 .and. first_call) & write(lp,*) subname//': prog. dms flux obtained from mediator' end if if (nreg == 2) then @@ -1037,7 +1042,7 @@ subroutine blom_importflds(fldlist_num, fldlist) #endif if (csdiag) then - if (mnproc == 1) then + if (mnproc == 1 .and. first_call) then write(lp,*) subname//':' endif call chksummsk(ustarw_da(1-nbdy,1-nbdy,l2ci),ip,1,'ustarw') @@ -1063,6 +1068,10 @@ subroutine blom_importflds(fldlist_num, fldlist) end if endif + if (first_call) then + first_call = .false. + end if + end subroutine blom_importflds subroutine blom_exportflds(fldlist_num, fldlist) @@ -1081,6 +1090,7 @@ subroutine blom_exportflds(fldlist_num, fldlist) ! Local variables. real(r8) :: tfac, utmp, vtmp integer :: n, l, i, j + logical, save :: first_call = .true. tfac = 1._r8/tlast_coupled @@ -1175,7 +1185,7 @@ subroutine blom_exportflds(fldlist_num, fldlist) enddo !$omp end parallel do else - if (mnproc == 1) & + if (mnproc == 1 .and. first_call) & write(lp,*) subname//': dms flux not sent to coupler' endif end if @@ -1216,7 +1226,7 @@ subroutine blom_exportflds(fldlist_num, fldlist) enddo !$omp end parallel do else - if (mnproc == 1) & + if (mnproc == 1 .and. first_call) & write(lp,*) subname//': co2 flux not sent to coupler' endif end if @@ -1240,11 +1250,15 @@ subroutine blom_exportflds(fldlist_num, fldlist) enddo !$omp end parallel do else - if (mnproc == 1) & + if (mnproc == 1 .and. first_call) & write(lp,*) subname//': bromoform flux not sent to coupler' endif end if + if (first_call) then + first_call = .false. + end if + tlast_coupled = 0._r8 end subroutine blom_exportflds From 714a4e0ecee4a293977680d8d5eee0a29c9dcfdc Mon Sep 17 00:00:00 2001 From: mvertens Date: Fri, 16 Jun 2023 14:13:25 +0200 Subject: [PATCH 07/52] minor updates --- drivers/nuopc/ocn_comp_nuopc.F90 | 2 +- hamocc/carchm.F90 | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/nuopc/ocn_comp_nuopc.F90 b/drivers/nuopc/ocn_comp_nuopc.F90 index bc504f14..1833a244 100644 --- a/drivers/nuopc/ocn_comp_nuopc.F90 +++ b/drivers/nuopc/ocn_comp_nuopc.F90 @@ -76,7 +76,7 @@ module ocn_comp_nuopc logical :: ocn2glc_coupling, flds_dms_med - integer :: dbug = 10 + integer :: dbug = 0 logical :: profile_memory = .false. public :: SetServices, SetVM diff --git a/hamocc/carchm.F90 b/hamocc/carchm.F90 index 8505d73d..efe19b9d 100644 --- a/hamocc/carchm.F90 +++ b/hamocc/carchm.F90 @@ -478,14 +478,14 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & ! Surface flux of dms if (get_flxdms_from_med) then ! Note that flux from mediator is downwards positive, whereas dms flux computed above - ! is upwards positive - so need a different sign + ! is upwards positive - so need a different sign dmsflux = -dtbgc*flxdms(i,j) else ! Note that kwdms already has the open ocean fraction in the term - dmsflux = kwdms*dtbgc*ocetra(i,j,1,idms) + dmsflux = kwdms*dtbgc*ocetra(i,j,1,idms) end if ocetra(i,j,1,idms) = ocetra(i,j,1,idms) - dmsflux/pddpo(i,j,1) - + #ifdef BROMO ! Quack and Wallace (2003) eq. 1 ! flux = kw*(Cw - Ca/H) ; kw[m s-1]; Cw[kmol m-3]; From 8c4fa29b12740b86f7338a999e4a0cb97b52886e Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Tue, 20 Jun 2023 20:17:31 +0200 Subject: [PATCH 08/52] reimplementation for PR --- cesm/mod_cesm.F90 | 10 +++++----- drivers/nuopc/mod_nuopc_methods.F90 | 8 +++++--- drivers/nuopc/ocn_comp_nuopc.F90 | 14 ++++++++++++-- hamocc/carchm.F90 | 13 +++++++------ hamocc/hamocc4bcm.F90 | 30 +++++++++++++++++++---------- hamocc/hamocc_step.F90 | 4 ++-- phy/mod_forcing.F90 | 5 ++++- 7 files changed, 55 insertions(+), 29 deletions(-) diff --git a/cesm/mod_cesm.F90 b/cesm/mod_cesm.F90 index 07cd0fd4..ede723b4 100644 --- a/cesm/mod_cesm.F90 +++ b/cesm/mod_cesm.F90 @@ -29,7 +29,8 @@ module mod_cesm use mod_xc use mod_forcing, only: trxday, srxday, swa, nsf, lip, sop, eva, rnf, rfi, & fmltfz, sfl, ztx, mty, ustarw, slp, abswnd, & - lamult, lasl, ustokes, vstokes, atmco2, atmbrf, flxdms + lamult, lasl, ustokes, vstokes, atmco2, atmbrf, flxdms, & + compute_flxdms use mod_ben02, only: initai, rdcsic, rdctsf, fnlzai use mod_seaice, only: ficem use mod_checksum, only: csdiag, chksummsk @@ -85,14 +86,12 @@ module mod_cesm integer :: & l1ci, l2ci ! Time-level indices for time smoothing of CESM fields. - logical :: get_flxdms_from_med = .false. ! This ensures backwards compatiblity - public :: runid_cesm, runtyp_cesm, ocn_cpl_dt_cesm, nstep_in_cpl, hmlt, & frzpot, mltpot, swa_da, nsf_da, hmlt_da, lip_da, sop_da, eva_da, & rnf_da, rfi_da, fmltfz_da, sfl_da, ztx_da, mty_da, ustarw_da, & slp_da, abswnd_da, ficem_da, lamult_da, lasl_da, flxdms_da, & ustokes_da, vstokes_da, atmco2_da, atmbrf_da, smtfrc, l1ci, l2ci, & - inicon_cesm, inifrc_cesm, getfrc_cesm, get_flxdms_from_med + inicon_cesm, inifrc_cesm, getfrc_cesm contains subroutine inicon_cesm @@ -191,7 +190,8 @@ subroutine getfrc_cesm vstokes(i, j) = w1*vstokes_da(i, j, l1ci) + w2*vstokes_da(i, j, l2ci) atmco2(i, j) = w1*atmco2_da(i, j, l1ci) + w2*atmco2_da(i, j, l2ci) atmbrf(i, j) = w1*atmbrf_da(i, j, l1ci) + w2*atmbrf_da(i, j, l2ci) - if (get_flxdms_from_med) then + if (.not. compute_flxdms) then + ! flxdms is obtained from the mediator flxdms(i, j) = w1*flxdms_da(i, j, l1ci) + w2*flxdms_da(i, j, l2ci) end if enddo diff --git a/drivers/nuopc/mod_nuopc_methods.F90 b/drivers/nuopc/mod_nuopc_methods.F90 index f2e63baa..86847396 100644 --- a/drivers/nuopc/mod_nuopc_methods.F90 +++ b/drivers/nuopc/mod_nuopc_methods.F90 @@ -30,7 +30,7 @@ module mod_nuopc_methods use mod_grid, only: scuy, scvx, scp2, scuxi, scvyi, plon, plat, & cosang, sinang use mod_state, only: u, v, dp, temp, saln, pbu, pbv, ubflxs, vbflxs, sealv - use mod_forcing, only: sprfac, prfac, flxco2, flxdms, flxbrf + use mod_forcing, only: sprfac, prfac, flxco2, flxdms, flxbrf, compute_flxdms use mod_difest, only: obldepth use mod_vcoord, only: vcoord_type_tag, isopyc_bulkml, cntiso_hybrid use mod_cesm, only: frzpot, mltpot, & @@ -38,7 +38,7 @@ module mod_nuopc_methods 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, atmbrf_da, & - flxdms_da, get_flxdms_from_med, l1ci, l2ci + flxdms_da, l1ci, l2ci use mod_utility, only: util1, util2 use mod_checksum, only: csdiag, chksummsk use shr_const_mod, only: SHR_CONST_RHOSW, SHR_CONST_LATICE, SHR_CONST_TKFRZ @@ -69,11 +69,13 @@ module mod_nuopc_methods real(r8) :: tlast_coupled integer :: jjcpl + logical :: get_flxdms_from_med + public :: fldlist_type, fldsmax, tlast_coupled, & blom_logwrite, blom_getgindex, blom_checkmesh, blom_setareacor, & blom_getglobdim, blom_getprecipfact, blom_accflds, & blom_advertise_imports, blom_advertise_exports, & - blom_importflds, blom_exportflds + blom_importflds, blom_exportflds, get_flxdms_from_med integer :: & index_Si_ifrac = - 1, & diff --git a/drivers/nuopc/ocn_comp_nuopc.F90 b/drivers/nuopc/ocn_comp_nuopc.F90 index 1833a244..9f6c9fe9 100644 --- a/drivers/nuopc/ocn_comp_nuopc.F90 +++ b/drivers/nuopc/ocn_comp_nuopc.F90 @@ -46,12 +46,13 @@ module ocn_comp_nuopc blom_setareacor, blom_getglobdim, & blom_getprecipfact, blom_accflds, & blom_importflds, blom_exportflds, & - blom_advertise_imports, blom_advertise_exports + blom_advertise_imports, blom_advertise_exports, & + get_flxdms_from_med use mod_xc, only: mpicom_external, lp, nfu use mod_cesm, only: runid_cesm, runtyp_cesm, ocn_cpl_dt_cesm use mod_config, only: inst_index, inst_name, inst_suffix use mod_time, only: blom_time - use mod_cesm, only : get_flxdms_from_med + use mod_forcing, only : compute_flxdms implicit none @@ -489,6 +490,8 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) call NUOPC_CompAttributeGet(gcomp, name='flds_dms_med', value=cvalue, & isPresent=isPresent, isSet=isSet, rc=rc) if (ChkErr(rc, __LINE__, u_FILE_u)) return + + ! Set the logical flag get_flxdms_from_med in mod_nuopc_methods module if (.not. isPresent .and. .not. isSet) then get_flxdms_from_med = .false. else @@ -501,6 +504,13 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) end if end if + ! Set the logical flag compute_flxdms in mod_forcing module + if (get_flxdms_from_med) then + compute_flxdms = .false. + else + compute_flxdms = .true. + end if + ! Determine if co2 will be imported from mediator call NUOPC_CompAttributeGet(gcomp, name='flds_co2a', value=cvalue, rc=rc) if (ChkErr(rc, __LINE__, u_FILE_u)) return diff --git a/hamocc/carchm.F90 b/hamocc/carchm.F90 index efe19b9d..315fddb2 100644 --- a/hamocc/carchm.F90 +++ b/hamocc/carchm.F90 @@ -20,7 +20,8 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & pdlxp,pdlyp,pddpo,prho,pglat,omask, & - psicomo,ppao,pfu10,ptho,psao) + psicomo,ppao,pfu10,ptho,psao, & + pflxdms,compute_flxdms) !****************************************************************************** ! !**** *CARCHM* - . @@ -88,6 +89,7 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & ! *REAL* *pfu10* - forcing field wind speed. ! *REAL* *ptho* - potential temperature. ! *REAL* *psao* - salinity [psu]. +! *REAL* *pflxdms* - input dms flux that is already computed ! ! Externals ! --------- @@ -118,9 +120,6 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & use mo_carbch, only: atm_co2_nat,nathi,natco3,natpco2d,natomegaa,natomegac use mo_param1_bgc, only: iatmnco2,inatalkali,inatcalc,inatsco212 #endif - use mod_cesm, only : get_flxdms_from_med - use mod_forcing, only : flxdms - implicit none INTEGER, intent(in) :: kpie,kpje,kpke,kbnd @@ -135,6 +134,8 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & REAL, intent(in) :: pfu10(1-kbnd:kpie+kbnd,1-kbnd:kpje+kbnd) REAL, intent(in) :: ptho(1-kbnd:kpie+kbnd,1-kbnd:kpje+kbnd,kpke) REAL, intent(in) :: psao(1-kbnd:kpie+kbnd,1-kbnd:kpje+kbnd,kpke) + REAL, intent(in) :: pflxdms(1-kbnd:kpie+kbnd,1-kbnd:kpje+kbnd) + LOGICAL, intent(in) :: compute_flxdms ! Local variables INTEGER :: i,j,k,l,js @@ -476,10 +477,10 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & #endif ! Surface flux of dms - if (get_flxdms_from_med) then + if (compute_flxdms) then ! Note that flux from mediator is downwards positive, whereas dms flux computed above ! is upwards positive - so need a different sign - dmsflux = -dtbgc*flxdms(i,j) + dmsflux = -dtbgc*pflxdms(i,j) else ! Note that kwdms already has the open ocean fraction in the term dmsflux = kwdms*dtbgc*ocetra(i,j,1,idms) diff --git a/hamocc/hamocc4bcm.F90 b/hamocc/hamocc4bcm.F90 index f503b524..1f130a3f 100644 --- a/hamocc/hamocc4bcm.F90 +++ b/hamocc/hamocc4bcm.F90 @@ -19,9 +19,10 @@ SUBROUTINE HAMOCC4BCM(kpie,kpje,kpke,kbnd,kplyear,kplmon,kplday,kldtday,& pdlxp,pdlyp,pddpo,prho,pglat,omask, & - dust,rivin,ndep,oafx,pi_ph, & + dust,rivin,ndep,oafx,pi_ph, & pfswr,psicomo,ppao,pfu10,ptho,psao, & - patmco2,pflxco2,pflxdms,patmbromo,pflxbromo) + patmco2,pflxco2,pflxdms,patmbromo,pflxbromo, & + compute_flxdms) !****************************************************************************** ! ! HAMOCC4BGC - main routine of iHAMOCC. @@ -125,9 +126,16 @@ SUBROUTINE HAMOCC4BCM(kpie,kpje,kpke,kbnd,kplyear,kplmon,kplday,kldtday,& REAL, intent(in) :: psao (1-kbnd:kpie+kbnd,1-kbnd:kpje+kbnd,kpke) REAL, intent(in) :: patmco2(1-kbnd:kpie+kbnd,1-kbnd:kpje+kbnd) REAL, intent(out) :: pflxco2(1-kbnd:kpie+kbnd,1-kbnd:kpje+kbnd) - REAL, intent(out) :: pflxdms(1-kbnd:kpie+kbnd,1-kbnd:kpje+kbnd) + REAL, intent(inout) :: pflxdms(1-kbnd:kpie+kbnd,1-kbnd:kpje+kbnd) REAL, intent(in) :: patmbromo(1-kbnd:kpie+kbnd,1-kbnd:kpje+kbnd) REAL, intent(out) :: pflxbromo(1-kbnd:kpie+kbnd,1-kbnd:kpje+kbnd) + logical, intent(in) :: compute_flxdms + + ! NOTE: + ! If compute_flxdms is .true. then pflxdms will be computed in + ! carch.F90 and will be intent(out) + ! If compute_flxdms is .false. then pflxdms is obtained + ! externally to blom and therefore will be intent(in) INTEGER :: i,j,k,l INTEGER :: nspin,it @@ -266,9 +274,9 @@ SUBROUTINE HAMOCC4BCM(kpie,kpje,kpke,kbnd,kplyear,kplmon,kplday,kldtday,& CALL INVENTORY_BGC(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask,0) #endif - CALL CARCHM(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,prho,pglat,omask, & - psicomo,ppao,pfu10,ptho,psao) + psicomo,ppao,pfu10,ptho,psao,& + pflxdms,compute_flxdms) #ifdef PBGC_CK_TIMESTEP IF (mnproc.eq.1) THEN @@ -404,13 +412,15 @@ SUBROUTINE HAMOCC4BCM(kpie,kpje,kpke,kbnd,kplyear,kplmon,kplday,kldtday,& !-------------------------------------------------------------------- ! Pass dms flux. Convert unit from kmol/m^2 to kg/m^2/s. + if (compute_flxdms) then !$OMP PARALLEL DO PRIVATE(i) - DO j=1,kpje - DO i=1,kpie - if(omask(i,j) .gt. 0.5) pflxdms(i,j)=-62.13*atmflx(i,j,iatmdms)/dtbgc - ENDDO - ENDDO + DO j=1,kpje + DO i=1,kpie + if(omask(i,j) .gt. 0.5) pflxdms(i,j)=-62.13*atmflx(i,j,iatmdms)/dtbgc + ENDDO + ENDDO !$OMP END PARALLEL DO + end if !-------------------------------------------------------------------- ! Pass bromoform flux. Convert unit from kmol CHBr3/m^2 to kg/m^2/s. diff --git a/hamocc/hamocc_step.F90 b/hamocc/hamocc_step.F90 index 74e12c8b..90dd7d34 100644 --- a/hamocc/hamocc_step.F90 +++ b/hamocc/hamocc_step.F90 @@ -27,7 +27,7 @@ subroutine hamocc_step(m,n,mm,nn,k1m,k1n) use mod_grid, only: plat use mod_state, only: temp,saln use mod_forcing, only: swa,slp,abswnd,atmco2,flxco2,flxdms, & - & atmbrf,flxbrf + & atmbrf,flxbrf,compute_flxdms use mod_seaice, only: ficem use mo_bgcmean, only: nbgc,bgcwrt, diagfq_bgc,diagmon_bgc, & & diagann_bgc @@ -75,7 +75,7 @@ subroutine hamocc_step(m,n,mm,nn,k1m,k1n) & dust,rivflx,ndep,oafx,pi_ph, & & swa,ficem,slp,abswnd, & & temp(1-nbdy,1-nbdy,1+nn),saln(1-nbdy,1-nbdy,1+nn), & - & atmco2,flxco2,flxdms,atmbrf,flxbrf) + & atmco2,flxco2,flxdms,atmbrf,flxbrf,compute_flxdms) ! ! --- accumulate fields and write output diff --git a/phy/mod_forcing.F90 b/phy/mod_forcing.F90 index 515009fc..3928d521 100644 --- a/phy/mod_forcing.F90 +++ b/phy/mod_forcing.F90 @@ -143,6 +143,8 @@ module mod_forcing s_rs_nonloc ! Non-local transport term that is the fraction of ! restoring salt flux passing a layer interface []. + logical :: compute_flxdms = .true. ! this ensures backwards compatibility + public :: aptflx, apsflx, ditflx, disflx, srxbal, sprfac, & trxday, srxday, trxdpt, srxdpt, trxlim, srxlim, scfile, & sref, tflxap, sflxap, tflxdi, sflxdi, nflxdi, & @@ -152,7 +154,8 @@ module mod_forcing atmco2, flxco2, flxdms, flxbrf, atmbrf, & surflx, surrlx, sswflx, salflx, brnflx, salrlx, taux, tauy, & ustar, ustarb, ustar3, buoyfl, t_sw_nonloc, t_rs_nonloc, & - s_br_nonloc, s_rs_nonloc, inivar_forcing, fwbbal + s_br_nonloc, s_rs_nonloc, inivar_forcing, fwbbal, & + compute_flxdms contains From 42d95f7ed818023d803175c91daa8457d911c02b Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Wed, 21 Jun 2023 11:08:39 +0200 Subject: [PATCH 09/52] fix compute_flxdms logic --- drivers/nuopc/ocn_comp_nuopc.F90 | 1 + hamocc/carchm.F90 | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/nuopc/ocn_comp_nuopc.F90 b/drivers/nuopc/ocn_comp_nuopc.F90 index 9f6c9fe9..6c4a4f86 100644 --- a/drivers/nuopc/ocn_comp_nuopc.F90 +++ b/drivers/nuopc/ocn_comp_nuopc.F90 @@ -510,6 +510,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) else compute_flxdms = .true. end if + write(6,*)'DEBUG: compute_flxdms = ',compute_flxdms ! Determine if co2 will be imported from mediator call NUOPC_CompAttributeGet(gcomp, name='flds_co2a', value=cvalue, rc=rc) diff --git a/hamocc/carchm.F90 b/hamocc/carchm.F90 index 315fddb2..6feb92f0 100644 --- a/hamocc/carchm.F90 +++ b/hamocc/carchm.F90 @@ -478,12 +478,13 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & ! Surface flux of dms if (compute_flxdms) then - ! Note that flux from mediator is downwards positive, whereas dms flux computed above - ! is upwards positive - so need a different sign - dmsflux = -dtbgc*pflxdms(i,j) - else ! Note that kwdms already has the open ocean fraction in the term dmsflux = kwdms*dtbgc*ocetra(i,j,1,idms) + else + ! Note that computed flux passed in is assumed to be + ! downwards positive, whereas dms flux computed above is + ! upwards positive - so need a different sign + dmsflux = -dtbgc*pflxdms(i,j) end if ocetra(i,j,1,idms) = ocetra(i,j,1,idms) - dmsflux/pddpo(i,j,1) From c4bc74584faec919ab58b060cf3e81e68a29cfc2 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Wed, 21 Jun 2023 13:10:26 +0200 Subject: [PATCH 10/52] simplification of flxdms setting --- drivers/nuopc/mod_nuopc_methods.F90 | 102 ++++++++-------------------- drivers/nuopc/ocn_comp_nuopc.F90 | 30 +------- hamocc/hamocc4bcm.F90 | 12 ++-- 3 files changed, 33 insertions(+), 111 deletions(-) diff --git a/drivers/nuopc/mod_nuopc_methods.F90 b/drivers/nuopc/mod_nuopc_methods.F90 index 86847396..0ab6646f 100644 --- a/drivers/nuopc/mod_nuopc_methods.F90 +++ b/drivers/nuopc/mod_nuopc_methods.F90 @@ -69,13 +69,11 @@ module mod_nuopc_methods real(r8) :: tlast_coupled integer :: jjcpl - logical :: get_flxdms_from_med - public :: fldlist_type, fldsmax, tlast_coupled, & blom_logwrite, blom_getgindex, blom_checkmesh, blom_setareacor, & blom_getglobdim, blom_getprecipfact, blom_accflds, & blom_advertise_imports, blom_advertise_exports, & - blom_importflds, blom_exportflds, get_flxdms_from_med + blom_importflds, blom_exportflds integer :: & index_Si_ifrac = - 1, & @@ -121,7 +119,6 @@ module mod_nuopc_methods index_So_dms = - 1, & index_So_brf = - 1, & index_Fioo_q = - 1, & - index_Faoo_dms = - 1, & index_Faoo_brf = - 1, & index_Faoo_fco2_ocn = - 1 @@ -166,6 +163,9 @@ subroutine fldlist_add(num, fldlist, stdname, index, ungridded_lbound, ungridded fldlist(num)%ungridded_ubound = ungridded_ubound endif + ! Set the logical flag compute_flxdms in mod_forcing module + compute_flxdms = .false. + end subroutine fldlist_add subroutine getfldindex(fldlist_num, fldlist, stdname, fldindex) @@ -237,9 +237,7 @@ subroutine blom_advertise_imports(flds_scalar_name, fldsToOcn_num, fldsToOcn, & call fldlist_add(fldsToOcn_num, fldsToOcn, 'Foxx_evap' , index_Foxx_evap) call fldlist_add(fldsToOcn_num, fldsToOcn, 'Foxx_swnet' , index_Foxx_swnet) #ifdef HAMOCC - if (get_flxdms_from_med) then - call fldlist_add(fldsToOcn_num, fldsToOcn, 'Faox_dms', index_Faox_dms) - end if + call fldlist_add(fldsToOcn_num, fldsToOcn, 'Faox_dms', index_Faox_dms) #endif ! From wave: @@ -288,11 +286,7 @@ subroutine blom_advertise_exports(flds_scalar_name, fldsFrOcn_num, fldsFrOcn) call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'Fioo_q' , index_Fioo_q) call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'Faoo_fco2_ocn' , index_Faoo_fco2_ocn) #ifdef HAMOCC - if (get_flxdms_from_med) then - call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'So_dms' , index_So_dms) - else - call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'Faoo_dms', index_Faoo_dms) - end if + call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'So_dms' , index_So_dms) #endif end subroutine blom_advertise_exports @@ -607,22 +601,6 @@ subroutine blom_accflds !$omp end parallel do endif -#ifdef HAMOCC - if (.not. get_flxdms_from_med) then - if (index_Faoo_dms > 0) then - !$omp parallel do private(l, i) - do j = 1, jj - do l = 1, isp(j) - do i = max(1, ifp(j,l)), min(ii, ilp(j,l)) - acc_fdms(i,j) = acc_fdms(i,j) + flxdms(i,j)*baclin - enddo - enddo - enddo - !$omp end parallel do - endif - end if -#endif - if (index_Faoo_brf) then !$omp parallel do private(l, i) do j = 1, jj @@ -1015,30 +993,28 @@ subroutine blom_importflds(fldlist_num, fldlist) endif #ifdef HAMOCC - if (get_flxdms_from_med) then - if (index_Faox_dms > 0) then - if (associated(fldlist(index_Faox_dms)%dataptr)) then - !$omp parallel do private(i, n, afac) - do j = 1, jjcpl - do i = 1, ii - n = (j - 1)*ii + i - afac = med2mod_areacor(n) - if (ip(i,j) == 0) then - flxdms_da(i,j,l2ci) = mval - elseif (cplmsk(i,j) == 0) then - flxdms_da(i,j,l2ci) = 0._r8 - else - flxdms_da(i,j,l2ci) = fldlist(index_Faox_dms)%dataptr(n)*afac/62.13 - end if - end do + if (index_Faox_dms > 0) then + if (associated(fldlist(index_Faox_dms)%dataptr)) then + !$omp parallel do private(i, n, afac) + do j = 1, jjcpl + do i = 1, ii + n = (j - 1)*ii + i + afac = med2mod_areacor(n) + if (ip(i,j) == 0) then + flxdms_da(i,j,l2ci) = mval + elseif (cplmsk(i,j) == 0) then + flxdms_da(i,j,l2ci) = 0._r8 + else + flxdms_da(i,j,l2ci) = fldlist(index_Faox_dms)%dataptr(n)*afac/62.13 + end if end do + end do !$omp end parallel do - if (mnproc == 1 .and. first_call) & - write(lp,*) subname//': prog. dms flux obtained from mediator' - end if - if (nreg == 2) then - call xctilr(flxdms_da(1-nbdy,1-nbdy,l2ci), 1,1, 0,0, halo_ps) - end if + if (mnproc == 1 .and. first_call) & + write(lp,*) subname//': prog. dms flux obtained from mediator' + end if + if (nreg == 2) then + call xctilr(flxdms_da(1-nbdy,1-nbdy,l2ci), 1,1, 0,0, halo_ps) end if end if #endif @@ -1065,7 +1041,7 @@ subroutine blom_importflds(fldlist_num, fldlist) 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(atmbrf_da(1-nbdy,1-nbdy,l2ci),ip,1,'atmbrf') - if (get_flxdms_from_med .and. index_Faox_dms > 0) then + if (index_Faox_dms > 0) then call chksummsk(flxdms_da(1-nbdy,1-nbdy,l2ci),ip,1,'flxdms_da') end if endif @@ -1167,31 +1143,7 @@ subroutine blom_exportflds(fldlist_num, fldlist) enddo !$omp end parallel do - ! ------------------------------------------------------------------------ - ! Provide DMS flux [kmol DMS m-2 s-1], if requested. - ! ------------------------------------------------------------------------ - #ifdef HAMOCC - if (index_Faoo_dms > 0) then - if (associated(fldlist(index_Faoo_dms)%dataptr)) then - fldlist(index_Faoo_dms)%dataptr(:) = 0._r8 - !$omp parallel do private(l, i, n) - do j = 1, jjcpl - do l = 1, isp(j) - do i = max(1, ifp(j,l)), min(ii, ilp(j,l)) - n = (j - 1)*ii + i - fldlist(index_Faoo_dms)%dataptr(n) = & - acc_fdms(i,j)*tfac*mod2med_areacor(n) - enddo - enddo - enddo - !$omp end parallel do - else - if (mnproc == 1 .and. first_call) & - write(lp,*) subname//': dms flux not sent to coupler' - endif - end if - if (index_So_dms > 0) then if (associated(fldlist(index_So_dms)%dataptr)) then fldlist(index_So_dms)%dataptr(:) = 0._r8 diff --git a/drivers/nuopc/ocn_comp_nuopc.F90 b/drivers/nuopc/ocn_comp_nuopc.F90 index 6c4a4f86..d7b44e3b 100644 --- a/drivers/nuopc/ocn_comp_nuopc.F90 +++ b/drivers/nuopc/ocn_comp_nuopc.F90 @@ -46,13 +46,11 @@ module ocn_comp_nuopc blom_setareacor, blom_getglobdim, & blom_getprecipfact, blom_accflds, & blom_importflds, blom_exportflds, & - blom_advertise_imports, blom_advertise_exports, & - get_flxdms_from_med + blom_advertise_imports, blom_advertise_exports use mod_xc, only: mpicom_external, lp, nfu use mod_cesm, only: runid_cesm, runtyp_cesm, ocn_cpl_dt_cesm use mod_config, only: inst_index, inst_name, inst_suffix use mod_time, only: blom_time - use mod_forcing, only : compute_flxdms implicit none @@ -486,32 +484,6 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) trim(cvalue), ESMF_LOGMSG_INFO) endif - ! Determine if dms flux will be computed in mediator and sent to BLOM - call NUOPC_CompAttributeGet(gcomp, name='flds_dms_med', value=cvalue, & - isPresent=isPresent, isSet=isSet, rc=rc) - if (ChkErr(rc, __LINE__, u_FILE_u)) return - - ! Set the logical flag get_flxdms_from_med in mod_nuopc_methods module - if (.not. isPresent .and. .not. isSet) then - get_flxdms_from_med = .false. - else - read(cvalue,*) flds_dms_med - call blom_logwrite(subname//': flds_dms_med = '//trim(cvalue)) - if (flds_dms_med) then - get_flxdms_from_med = .true. - else - get_flxdms_from_med = .false. - end if - end if - - ! Set the logical flag compute_flxdms in mod_forcing module - if (get_flxdms_from_med) then - compute_flxdms = .false. - else - compute_flxdms = .true. - end if - write(6,*)'DEBUG: compute_flxdms = ',compute_flxdms - ! Determine if co2 will be imported from mediator call NUOPC_CompAttributeGet(gcomp, name='flds_co2a', value=cvalue, rc=rc) if (ChkErr(rc, __LINE__, u_FILE_u)) return diff --git a/hamocc/hamocc4bcm.F90 b/hamocc/hamocc4bcm.F90 index 1f130a3f..1a2f0f54 100644 --- a/hamocc/hamocc4bcm.F90 +++ b/hamocc/hamocc4bcm.F90 @@ -412,15 +412,13 @@ SUBROUTINE HAMOCC4BCM(kpie,kpje,kpke,kbnd,kplyear,kplmon,kplday,kldtday,& !-------------------------------------------------------------------- ! Pass dms flux. Convert unit from kmol/m^2 to kg/m^2/s. - if (compute_flxdms) then !$OMP PARALLEL DO PRIVATE(i) - DO j=1,kpje - DO i=1,kpie - if(omask(i,j) .gt. 0.5) pflxdms(i,j)=-62.13*atmflx(i,j,iatmdms)/dtbgc - ENDDO - ENDDO + DO j=1,kpje + DO i=1,kpie + if(omask(i,j) .gt. 0.5) pflxdms(i,j)=-62.13*atmflx(i,j,iatmdms)/dtbgc + ENDDO + ENDDO !$OMP END PARALLEL DO - end if !-------------------------------------------------------------------- ! Pass bromoform flux. Convert unit from kmol CHBr3/m^2 to kg/m^2/s. From b964a51da12a3aa959e1abb5a880ccad6860a66d Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Mon, 26 Jun 2023 21:32:34 +0200 Subject: [PATCH 11/52] changed compute_flxdms to do_bgc_aofluxes --- cesm/mod_cesm.F90 | 6 +- drivers/nuopc/mod_nuopc_methods.F90 | 115 ++++++---------------------- hamocc/carchm.F90 | 7 +- hamocc/hamocc4bcm.F90 | 13 +--- hamocc/hamocc_step.F90 | 4 +- hamocc/mo_control_bgc.F90 | 2 +- phy/mod_forcing.F90 | 5 +- 7 files changed, 37 insertions(+), 115 deletions(-) diff --git a/cesm/mod_cesm.F90 b/cesm/mod_cesm.F90 index ede723b4..b74b5456 100644 --- a/cesm/mod_cesm.F90 +++ b/cesm/mod_cesm.F90 @@ -29,11 +29,11 @@ module mod_cesm use mod_xc use mod_forcing, only: trxday, srxday, swa, nsf, lip, sop, eva, rnf, rfi, & fmltfz, sfl, ztx, mty, ustarw, slp, abswnd, & - lamult, lasl, ustokes, vstokes, atmco2, atmbrf, flxdms, & - compute_flxdms + lamult, lasl, ustokes, vstokes, atmco2, atmbrf, flxdms use mod_ben02, only: initai, rdcsic, rdctsf, fnlzai use mod_seaice, only: ficem use mod_checksum, only: csdiag, chksummsk + use mo_control_bgc, only: do_bgc_aofluxes implicit none @@ -190,7 +190,7 @@ subroutine getfrc_cesm vstokes(i, j) = w1*vstokes_da(i, j, l1ci) + w2*vstokes_da(i, j, l2ci) atmco2(i, j) = w1*atmco2_da(i, j, l1ci) + w2*atmco2_da(i, j, l2ci) atmbrf(i, j) = w1*atmbrf_da(i, j, l1ci) + w2*atmbrf_da(i, j, l2ci) - if (.not. compute_flxdms) then + if (.not. do_bgc_aofluxes) then ! flxdms is obtained from the mediator flxdms(i, j) = w1*flxdms_da(i, j, l1ci) + w2*flxdms_da(i, j, l2ci) end if diff --git a/drivers/nuopc/mod_nuopc_methods.F90 b/drivers/nuopc/mod_nuopc_methods.F90 index 0ab6646f..8106f2c3 100644 --- a/drivers/nuopc/mod_nuopc_methods.F90 +++ b/drivers/nuopc/mod_nuopc_methods.F90 @@ -30,7 +30,7 @@ module mod_nuopc_methods use mod_grid, only: scuy, scvx, scp2, scuxi, scvyi, plon, plat, & cosang, sinang use mod_state, only: u, v, dp, temp, saln, pbu, pbv, ubflxs, vbflxs, sealv - use mod_forcing, only: sprfac, prfac, flxco2, flxdms, flxbrf, compute_flxdms + use mod_forcing, only: sprfac, prfac, flxco2, flxdms, flxbrf use mod_difest, only: obldepth use mod_vcoord, only: vcoord_type_tag, isopyc_bulkml, cntiso_hybrid use mod_cesm, only: frzpot, mltpot, & @@ -45,6 +45,7 @@ module mod_nuopc_methods #ifdef HAMOCC use mo_carbch, only: ocetra use mo_param1_bgc, only: idms + use mo_control_bgc, only: do_bgc_aofluxes #endif implicit none @@ -75,8 +76,10 @@ module mod_nuopc_methods blom_advertise_imports, blom_advertise_exports, & blom_importflds, blom_exportflds + ! Indices for import fields integer :: & index_Si_ifrac = - 1, & + index_So_duu10n = - 1, & index_Fioi_melth = - 1, & index_Fioi_meltw = - 1, & index_Fioi_salt = - 1, & @@ -87,7 +90,6 @@ module mod_nuopc_methods index_Foxx_rofi = - 1, & index_Faox_dms = - 1, & index_Faox_brf = - 1, & - index_So_duu10n = - 1, & index_Foxx_tauy = - 1, & index_Foxx_taux = - 1, & index_Foxx_lat = - 1, & @@ -104,9 +106,9 @@ module mod_nuopc_methods index_Faxa_rain = - 1, & index_Sa_pslv = - 1, & index_Sa_co2diag = - 1, & - index_Sa_co2prog = - 1, & - index_Sa_brfprog = - 1 + index_Sa_co2prog = - 1 + ! Indices for export fields integer :: & index_So_omask = - 1, & index_So_u = - 1, & @@ -119,7 +121,6 @@ module mod_nuopc_methods index_So_dms = - 1, & index_So_brf = - 1, & index_Fioo_q = - 1, & - index_Faoo_brf = - 1, & index_Faoo_fco2_ocn = - 1 contains @@ -163,9 +164,6 @@ subroutine fldlist_add(num, fldlist, stdname, index, ungridded_lbound, ungridded fldlist(num)%ungridded_ubound = ungridded_ubound endif - ! Set the logical flag compute_flxdms in mod_forcing module - compute_flxdms = .false. - end subroutine fldlist_add subroutine getfldindex(fldlist_num, fldlist, stdname, fldindex) @@ -212,6 +210,11 @@ subroutine blom_advertise_imports(flds_scalar_name, fldsToOcn_num, fldsToOcn, & integer :: index_scalar + ! Set the logical flag do_bgc_aofluxes to true in mo_control_bgc +#ifdef HAMOCC + do_bgc_aofluxes = .false. +#endif + call fldlist_add(fldsToOcn_num, fldsToOcn, trim(flds_scalar_name), index_scalar) ! From ice: @@ -236,9 +239,10 @@ subroutine blom_advertise_imports(flds_scalar_name, fldsToOcn_num, fldsToOcn, & call fldlist_add(fldsToOcn_num, fldsToOcn, 'Foxx_lwup' , index_Foxx_lwup) call fldlist_add(fldsToOcn_num, fldsToOcn, 'Foxx_evap' , index_Foxx_evap) call fldlist_add(fldsToOcn_num, fldsToOcn, 'Foxx_swnet' , index_Foxx_swnet) -#ifdef HAMOCC - call fldlist_add(fldsToOcn_num, fldsToOcn, 'Faox_dms', index_Faox_dms) -#endif + if (.not. do_bgc_aofluxes) then + call fldlist_add(fldsToOcn_num, fldsToOcn, 'Faox_dms', index_Faox_dms) + call fldlist_add(fldsToOcn_num, fldsToOcn, 'Faox_brf', index_Faox_brf) + end if ! From wave: call fldlist_add(fldsToOcn_num, fldsToOcn, 'Sw_lamult' , index_Sw_lamult) @@ -257,7 +261,6 @@ subroutine blom_advertise_imports(flds_scalar_name, fldsToOcn_num, fldsToOcn, & call fldlist_add(fldsToOcn_num, fldsToOcn, 'Sa_co2diag' ,index_Sa_co2diag) call fldlist_add(fldsToOcn_num, fldsToOcn, 'Sa_co2prog', index_Sa_co2prog) endif - !call getfldindex(num_imp, fldlist_imp, 'Sa_brfprog' , index_Sa_brfprog) end subroutine blom_advertise_imports @@ -285,9 +288,10 @@ subroutine blom_advertise_exports(flds_scalar_name, fldsFrOcn_num, fldsFrOcn) call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'So_bldepth' , index_So_bldepth) call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'Fioo_q' , index_Fioo_q) call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'Faoo_fco2_ocn' , index_Faoo_fco2_ocn) -#ifdef HAMOCC - call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'So_dms' , index_So_dms) -#endif + if (.not. do_bgc_aofluxes) then + call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'So_dms', index_So_dms) + call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'So_brf', index_So_brf) + end if end subroutine blom_advertise_exports subroutine blom_logwrite(msg) @@ -601,18 +605,6 @@ subroutine blom_accflds !$omp end parallel do endif - if (index_Faoo_brf) then - !$omp parallel do private(l, i) - do j = 1, jj - do l = 1, isp(j) - do i = max(1, ifp(j,l)), min(ii, ilp(j,l)) - acc_fbrf(i,j) = acc_fbrf(i,j) + flxbrf(i,j)*baclin - enddo - enddo - enddo - !$omp end parallel do - endif - ! ------------------------------------------------------------------------ ! Increment time since last coupling. ! ------------------------------------------------------------------------ @@ -957,42 +949,6 @@ subroutine blom_importflds(fldlist_num, fldlist) write(lp,*) subname//': atmospheric co2 not read' #endif - if (index_Sa_brfprog > 0) then - !$omp parallel do private(i, n) - do j = 1, jjcpl - do i = 1, ii - if (ip(i,j) == 0) then - atmbrf_da(i,j,l2ci) = mval - elseif (cplmsk(i,j) == 0) then - atmbrf_da(i,j,l2ci) = fval - else - n = (j - 1)*ii + i - ! Atmospheric bromoform concentration [ppt] - atmbrf_da(i,j,l2ci) = fldlist(index_Sa_brfprog)%dataptr(n) - endif - enddo - enddo - !$omp end parallel do - call fill_global(mval, fval, halo_ps, atmbrf_da(1-nbdy,1-nbdy,l2ci)) - if (mnproc == 1 .and. first_call) & - write(lp,*) subname//': prog. atmospheric bromoform read' - else - !$omp parallel do private(i) - do j = 1, jj - do i = 1, ii - if (ip(i,j) == 0) then - atmbrf_da(i,j,l2ci) = mval - else - atmbrf_da(i,j,l2ci) = -1 - endif - enddo - enddo - !$omp end parallel do - if (mnproc == 1 .and. first_call) & - write(lp,*) subname//': prog. atmospheric bromoform not read' - endif - -#ifdef HAMOCC if (index_Faox_dms > 0) then if (associated(fldlist(index_Faox_dms)%dataptr)) then !$omp parallel do private(i, n, afac) @@ -1017,7 +973,6 @@ subroutine blom_importflds(fldlist_num, fldlist) call xctilr(flxdms_da(1-nbdy,1-nbdy,l2ci), 1,1, 0,0, halo_ps) end if end if -#endif if (csdiag) then if (mnproc == 1 .and. first_call) then @@ -1143,7 +1098,6 @@ subroutine blom_exportflds(fldlist_num, fldlist) enddo !$omp end parallel do -#ifdef HAMOCC if (index_So_dms > 0) then if (associated(fldlist(index_So_dms)%dataptr)) then fldlist(index_So_dms)%dataptr(:) = 0._r8 @@ -1159,7 +1113,6 @@ subroutine blom_exportflds(fldlist_num, fldlist) !$omp end parallel do end if end if -#endif ! ------------------------------------------------------------------------ ! Provide CO2 flux [kg CO2 m-2 s-1], if requested. @@ -1180,32 +1133,10 @@ subroutine blom_exportflds(fldlist_num, fldlist) enddo !$omp end parallel do else - if (mnproc == 1 .and. first_call) & - write(lp,*) subname//': co2 flux not sent to coupler' - endif - end if - - ! ------------------------------------------------------------------------ - ! Provide bromoform flux [kg CHBr3 m-2 s-1], if requested. - ! ------------------------------------------------------------------------ - - if (index_Faoo_brf > 0) then - if (associated(fldlist(index_Faoo_brf)%dataptr)) then - fldlist(index_Faoo_brf)%dataptr(:) = 0._r8 - !$omp parallel do private(l, i, n) - do j = 1, jjcpl - do l = 1, isp(j) - do i = max(1, ifp(j,l)), min(ii, ilp(j,l)) - n = (j - 1)*ii + i - fldlist(index_Faoo_brf)%dataptr(n) = & - acc_fbrf(i,j)*tfac*mod2med_areacor(n) - enddo - enddo - enddo - !$omp end parallel do - else - if (mnproc == 1 .and. first_call) & - write(lp,*) subname//': bromoform flux not sent to coupler' + if (first_call) then + if (mnproc == 1 .and. first_call) & + write(lp,*) subname//': co2 flux not sent to coupler' + end if endif end if diff --git a/hamocc/carchm.F90 b/hamocc/carchm.F90 index 6feb92f0..5341826e 100644 --- a/hamocc/carchm.F90 +++ b/hamocc/carchm.F90 @@ -21,7 +21,7 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & pdlxp,pdlyp,pddpo,prho,pglat,omask, & psicomo,ppao,pfu10,ptho,psao, & - pflxdms,compute_flxdms) + pflxdms) !****************************************************************************** ! !**** *CARCHM* - . @@ -100,7 +100,7 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & 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 + use mo_control_bgc, only: dtbgc, do_bgc_aofluxes use mo_param1_bgc, only: ialkali,iatmo2,iatmco2,iatmdms,iatmn2,iatmn2o,ian2o,icalc,idicsat,idms,igasnit,ioxygen,iphosph, & & isco212,isilica use mo_vgrid, only: dp_min,kmle,kbo,ptiestu @@ -135,7 +135,6 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & REAL, intent(in) :: ptho(1-kbnd:kpie+kbnd,1-kbnd:kpje+kbnd,kpke) REAL, intent(in) :: psao(1-kbnd:kpie+kbnd,1-kbnd:kpje+kbnd,kpke) REAL, intent(in) :: pflxdms(1-kbnd:kpie+kbnd,1-kbnd:kpje+kbnd) - LOGICAL, intent(in) :: compute_flxdms ! Local variables INTEGER :: i,j,k,l,js @@ -477,7 +476,7 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & #endif ! Surface flux of dms - if (compute_flxdms) then + if (do_bgc_aofluxes) then ! Note that kwdms already has the open ocean fraction in the term dmsflux = kwdms*dtbgc*ocetra(i,j,1,idms) else diff --git a/hamocc/hamocc4bcm.F90 b/hamocc/hamocc4bcm.F90 index 1a2f0f54..47685d13 100644 --- a/hamocc/hamocc4bcm.F90 +++ b/hamocc/hamocc4bcm.F90 @@ -21,8 +21,8 @@ SUBROUTINE HAMOCC4BCM(kpie,kpje,kpke,kbnd,kplyear,kplmon,kplday,kldtday,& pdlxp,pdlyp,pddpo,prho,pglat,omask, & dust,rivin,ndep,oafx,pi_ph, & pfswr,psicomo,ppao,pfu10,ptho,psao, & - patmco2,pflxco2,pflxdms,patmbromo,pflxbromo, & - compute_flxdms) + patmco2,pflxco2,pflxdms,patmbromo,pflxbromo) + !****************************************************************************** ! ! HAMOCC4BGC - main routine of iHAMOCC. @@ -129,13 +129,8 @@ SUBROUTINE HAMOCC4BCM(kpie,kpje,kpke,kbnd,kplyear,kplmon,kplday,kldtday,& REAL, intent(inout) :: pflxdms(1-kbnd:kpie+kbnd,1-kbnd:kpje+kbnd) REAL, intent(in) :: patmbromo(1-kbnd:kpie+kbnd,1-kbnd:kpje+kbnd) REAL, intent(out) :: pflxbromo(1-kbnd:kpie+kbnd,1-kbnd:kpje+kbnd) - logical, intent(in) :: compute_flxdms - ! NOTE: - ! If compute_flxdms is .true. then pflxdms will be computed in - ! carch.F90 and will be intent(out) - ! If compute_flxdms is .false. then pflxdms is obtained - ! externally to blom and therefore will be intent(in) + ! If pflxdms is obtained externally to blom and therefore will be intent(in) INTEGER :: i,j,k,l INTEGER :: nspin,it @@ -276,7 +271,7 @@ SUBROUTINE HAMOCC4BCM(kpie,kpje,kpke,kbnd,kplyear,kplmon,kplday,kldtday,& CALL CARCHM(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,prho,pglat,omask, & psicomo,ppao,pfu10,ptho,psao,& - pflxdms,compute_flxdms) + pflxdms) #ifdef PBGC_CK_TIMESTEP IF (mnproc.eq.1) THEN diff --git a/hamocc/hamocc_step.F90 b/hamocc/hamocc_step.F90 index 90dd7d34..74e12c8b 100644 --- a/hamocc/hamocc_step.F90 +++ b/hamocc/hamocc_step.F90 @@ -27,7 +27,7 @@ subroutine hamocc_step(m,n,mm,nn,k1m,k1n) use mod_grid, only: plat use mod_state, only: temp,saln use mod_forcing, only: swa,slp,abswnd,atmco2,flxco2,flxdms, & - & atmbrf,flxbrf,compute_flxdms + & atmbrf,flxbrf use mod_seaice, only: ficem use mo_bgcmean, only: nbgc,bgcwrt, diagfq_bgc,diagmon_bgc, & & diagann_bgc @@ -75,7 +75,7 @@ subroutine hamocc_step(m,n,mm,nn,k1m,k1n) & dust,rivflx,ndep,oafx,pi_ph, & & swa,ficem,slp,abswnd, & & temp(1-nbdy,1-nbdy,1+nn),saln(1-nbdy,1-nbdy,1+nn), & - & atmco2,flxco2,flxdms,atmbrf,flxbrf,compute_flxdms) + & atmco2,flxco2,flxdms,atmbrf,flxbrf) ! ! --- accumulate fields and write output diff --git a/hamocc/mo_control_bgc.F90 b/hamocc/mo_control_bgc.F90 index f3e4fac2..e27a11ff 100644 --- a/hamocc/mo_control_bgc.F90 +++ b/hamocc/mo_control_bgc.F90 @@ -66,7 +66,7 @@ MODULE mo_control_bgc LOGICAL, save :: do_oalk =.false. ! apply ocean alkalinization logical, save :: with_dmsph =.false. ! apply DMS with pH dependence - logical, save :: do_dmsflux_med = .false. ! If dms flux is sent back from mediator, this will be set to .true. + logical, save :: do_bgc_aofluxes = .true. ! If true, atm/ocn bgc fluxes are computed within HAMOCC contains diff --git a/phy/mod_forcing.F90 b/phy/mod_forcing.F90 index 3928d521..515009fc 100644 --- a/phy/mod_forcing.F90 +++ b/phy/mod_forcing.F90 @@ -143,8 +143,6 @@ module mod_forcing s_rs_nonloc ! Non-local transport term that is the fraction of ! restoring salt flux passing a layer interface []. - logical :: compute_flxdms = .true. ! this ensures backwards compatibility - public :: aptflx, apsflx, ditflx, disflx, srxbal, sprfac, & trxday, srxday, trxdpt, srxdpt, trxlim, srxlim, scfile, & sref, tflxap, sflxap, tflxdi, sflxdi, nflxdi, & @@ -154,8 +152,7 @@ module mod_forcing atmco2, flxco2, flxdms, flxbrf, atmbrf, & surflx, surrlx, sswflx, salflx, brnflx, salrlx, taux, tauy, & ustar, ustarb, ustar3, buoyfl, t_sw_nonloc, t_rs_nonloc, & - s_br_nonloc, s_rs_nonloc, inivar_forcing, fwbbal, & - compute_flxdms + s_br_nonloc, s_rs_nonloc, inivar_forcing, fwbbal contains From 2f1cc53134341c52749ad14e8ddaa0c8449ea154 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Tue, 27 Jun 2023 14:42:11 +0200 Subject: [PATCH 12/52] these changes cause nans for Faox_dms back from mediator --- cime_config/buildnml | 9 ++++----- hamocc/accfields.F90 | 10 ---------- hamocc/aufr_bgc.F90 | 6 ------ hamocc/aufw_bgc.F90 | 6 ------ hamocc/beleg_parm.F90 | 8 -------- hamocc/beleg_vars.F90 | 4 ---- hamocc/carchm.F90 | 21 --------------------- hamocc/hamocc4bcm.F90 | 8 -------- hamocc/hamocc_init.F90 | 2 -- hamocc/inventory_bgc.F90 | 10 ---------- hamocc/mo_bgcmean.F90 | 6 ------ hamocc/mo_biomod.F90 | 6 ------ hamocc/mo_carbch.F90 | 2 -- hamocc/mo_param1_bgc.F90 | 10 ---------- hamocc/ncout_hamocc.F90 | 26 -------------------------- hamocc/ocprod.F90 | 16 ---------------- meson.build | 3 --- phy/restart_wt.F | 4 ---- 18 files changed, 4 insertions(+), 153 deletions(-) diff --git a/cime_config/buildnml b/cime_config/buildnml index 642c710d..31ac14ee 100755 --- a/cime_config/buildnml +++ b/cime_config/buildnml @@ -833,6 +833,7 @@ if ($OCN_GRID == tnx2v1) then set SEC_SIFILE = "'$DIN_LOC_ROOT/ocn/blom/grid/section_index_tnx2v1_20190826.dat'" set SCFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/sss_clim_core_tnx2v1_20130927.nc'" set FEDEPFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/dustdep_mhw2006_tnx2v1_20130506.nc'" + # TODO: need a valid SWACLIMFILE since BROMO is now turned on by default set SWACLIMFILE = "''" set SEDPORFILE = "''" if ($BLOM_RIVER_NUTRIENTS == TRUE) then @@ -856,11 +857,7 @@ else if ($OCN_GRID == tnx1v4) then set SCFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/sss_clim_core_tnx1v4_20170604.nc'" set FEDEPFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/dustdep_mhw2006_tnx1v4_20171107.nc'" set SEDPORFILE = "''" - if ($HAMOCC_VSLS == TRUE) then - set SWACLIMFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/Annual_clim_swa_tnx1v4_20210415.nc'" - else - set SWACLIMFILE = "''" - endif + set SWACLIMFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/Annual_clim_swa_tnx1v4_20210415.nc'" if ($BLOM_RIVER_NUTRIENTS == TRUE) then set RIVINFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/river_nutrients_GNEWS2000_tnx1v4_20170820.nc'" else @@ -881,6 +878,7 @@ else if ($OCN_GRID == tnx0.25v4) then set CCFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/chlorophyll_concentration_tnx0.25v4_20170623.nc'" set SCFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/sss_clim_core_tnx0.25v4_20170623.nc'" set FEDEPFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/dustdep_mhw2006_tnx0.25v4_20181004.nc'" + # TODO: need a valid SWACLIMFILE since BROMO is now turned on by default set SWACLIMFILE = "''" set SEDPORFILE = "''" if ($BLOM_RIVER_NUTRIENTS == TRUE) then @@ -903,6 +901,7 @@ else if ($OCN_GRID == tnx0.125v4) then set CCFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/chlorophyll_concentration_tnx0.125v4_20200722.nc'" set SCFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/sss_clim_core_tnx0.125v4_20200722.nc'" set FEDEPFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/dustdep_mhw2006_tnx0.125v4_20200722.nc'" + # TODO: need a valid SWACLIMFILE since BROMO is now turned on by default set SWACLIMFILE = "''" set SEDPORFILE = "''" if ($BLOM_RIVER_NUTRIENTS == TRUE) then diff --git a/hamocc/accfields.F90 b/hamocc/accfields.F90 index 3edce9a7..57a5bf41 100644 --- a/hamocc/accfields.F90 +++ b/hamocc/accfields.F90 @@ -78,11 +78,9 @@ SUBROUTINE ACCFIELDS(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask) use mo_param1_bgc, only: inos use mo_control_bgc, only: dtb #endif -#ifdef BROMO use mo_param1_bgc, only: iatmbromo,ibromo use mo_biomod, only: int_chbr3_prod,int_chbr3_uv use mo_bgcmean, only: jatmbromo,jbromo,jbromo_prod,jbromo_uv,jbromofx,jsrfbromo -#endif #ifdef CFC use mo_param1_bgc, only: iatmf11,iatmf12,iatmsf6,icfc11,icfc12,isf6 use mo_bgcmean, only: jcfc11,jcfc11fx,jcfc12,jcfc12fx,jsf6,jsf6fx @@ -208,10 +206,8 @@ SUBROUTINE ACCFIELDS(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask) #ifdef natDIC call accsrf(jnatco2fx,atmflx(1,1,iatmnco2),omask,0) #endif -#ifdef BROMO call accsrf(jatmbromo,atm(1,1,iatmbromo),omask,0) call accsrf(jbromofx,atmflx(1,1,iatmbromo),omask,0) -#endif #ifdef cisonew call accsrf(jatmc13,atm(1,1,iatmc13),omask,0) call accsrf(jatmc14,atm(1,1,iatmc14),omask,0) @@ -259,11 +255,9 @@ SUBROUTINE ACCFIELDS(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask) call accsrf(jnatpco2,natpco2d,omask,0) call accsrf(jsrfnatph,nathi(1,1,1),omask,0) #endif -#ifdef BROMO call accsrf(jsrfbromo,ocetra(1,1,1,ibromo),omask,0) call accsrf(jbromo_prod,int_chbr3_prod,omask,0) call accsrf(jbromo_uv,int_chbr3_uv,omask,0) -#endif ! Accumulate fluxes due to N-deposition, ocean alkalinization call accsrf(jndepfx,ndepflx,omask,0) @@ -362,9 +356,7 @@ SUBROUTINE ACCFIELDS(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask) call acclyr(jcfc12,ocetra(1,1,1,icfc12),pddpo,1) call acclyr(jsf6,ocetra(1,1,1,isf6),pddpo,1) #endif -#ifdef BROMO call acclyr(jbromo,ocetra(1,1,1,ibromo),pddpo,1) -#endif ! Accumulate level diagnostics @@ -437,9 +429,7 @@ SUBROUTINE ACCFIELDS(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask) call acclvl(jlvlcfc12,ocetra(1,1,1,icfc12),k,ind1,ind2,wghts) call acclvl(jlvlsf6,ocetra(1,1,1,isf6),k,ind1,ind2,wghts) #endif -#ifdef BROMO call acclvl(jlvlbromo,ocetra(1,1,1,ibromo),k,ind1,ind2,wghts) -#endif ENDDO ENDIF diff --git a/hamocc/aufr_bgc.F90 b/hamocc/aufr_bgc.F90 index 842720ad..994d93c5 100644 --- a/hamocc/aufr_bgc.F90 +++ b/hamocc/aufr_bgc.F90 @@ -119,9 +119,7 @@ SUBROUTINE AUFR_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & use mo_param1_bgc, only: iatmco2,iatmn2,iatmo2 use mo_carbch, only: atm #endif -#ifdef BROMO use mo_param1_bgc, only: ibromo -#endif #ifdef CFC use mo_param1_bgc, only: icfc11,icfc12,isf6 #endif @@ -341,7 +339,6 @@ SUBROUTINE AUFR_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & #endif ! Find out whether to restart Bromoform -#ifdef BROMO lread_bro=.true. IF(IOTYPE==0) THEN if(mnproc==1) ncstat=nf90_inq_varid(ncid,'bromo',ncvarid) @@ -358,7 +355,6 @@ SUBROUTINE AUFR_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & WRITE(io_stdo_bgc,*) 'AUFR_BGC info: Bromoform tracer not in restart file, ' WRITE(io_stdo_bgc,*) 'Initialised to 0.01 pmol L-1 (Stemmler et al., 2015).' ENDIF -#endif ! Find out whether to restart atmosphere #if defined(BOXATM) @@ -446,11 +442,9 @@ SUBROUTINE AUFR_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & CALL read_netcdf_var(ncid,'hi',nathi(1,1,1),kpke,0,iotype) ENDIF #endif -#ifdef BROMO IF(lread_bro) THEN CALL read_netcdf_var(ncid,'bromo',locetra(1,1,1,ibromo),2*kpke,0,iotype) ENDIF -#endif ! ! Read restart data : diagnostic ocean fields (needed for bit to bit reproducability) diff --git a/hamocc/aufw_bgc.F90 b/hamocc/aufw_bgc.F90 index 90949313..41207a77 100644 --- a/hamocc/aufw_bgc.F90 +++ b/hamocc/aufw_bgc.F90 @@ -112,9 +112,7 @@ SUBROUTINE AUFW_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & #ifdef BOXATM use mo_param1_bgc, only: iatmco2,iatmn2,iatmo2 #endif -#ifdef BROMO use mo_param1_bgc, only: ibromo -#endif #ifdef CFC use mo_param1_bgc, only: icfc11,icfc12,isf6 #endif @@ -574,10 +572,8 @@ SUBROUTINE AUFW_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & & 6,'mol/kg',25,'Natural calcium carbonate', & & rmissing,52,io_stdo_bgc) #endif -#ifdef BROMO CALL NETCDF_DEF_VARDB(ncid,5,'bromo',3,ncdimst,ncvarid, & & 6,'mol/kg',9,'Bromoform',rmissing,47,io_stdo_bgc) -#endif ! ! Define variables : diagnostic ocean fields @@ -858,9 +854,7 @@ SUBROUTINE AUFW_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & CALL write_netcdf_var(ncid,'natalkali',locetra(1,1,1,inatalkali),2*kpke,0) CALL write_netcdf_var(ncid,'natcalciu',locetra(1,1,1,inatcalc),2*kpke,0) #endif -#ifdef BROMO CALL write_netcdf_var(ncid,'bromo',locetra(1,1,1,ibromo),2*kpke,0) -#endif ! ! Write restart data : diagtnostic ocean fields diff --git a/hamocc/beleg_parm.F90 b/hamocc/beleg_parm.F90 index 949abea9..0c5a37f8 100644 --- a/hamocc/beleg_parm.F90 +++ b/hamocc/beleg_parm.F90 @@ -57,10 +57,8 @@ SUBROUTINE BELEG_PARM(kpie,kpje) #elif defined(WLIN) use mo_biomod, only: wmin,wmax,wlin #endif -#ifdef BROMO use mo_biomod, only: rbro use mo_carbch, only: atm_bromo,fbro1,fbro2 -#endif #ifdef cisonew use mo_biomod, only: bifr13,bifr14,c14fac,prei13,prei14,re1312,re14to use mo_carbch, only: atm_c13, atm_c14,c14_t_half,c14dec @@ -93,11 +91,9 @@ SUBROUTINE BELEG_PARM(kpie,kpje) #ifdef natDIC atm_co2_nat = 284.32 ! CMIP6 pre-industrial reference #endif -#ifdef BROMO !For now use 3.4ppt from Hense and Quack (2009; Biogeosciences) NEED TO !BE UPDATED WITH Ziska et al. (2013) climatology database atm_bromo = 3.4 -#endif #ifdef cisonew ! set standard carbon isotope ratios @@ -135,9 +131,7 @@ SUBROUTINE BELEG_PARM(kpie,kpje) atm(i,j,iatmc13) = atm_c13 atm(i,j,iatmc14) = atm_c14/c14fac #endif -#ifdef BROMO atm(i,j,iatmbromo)= atm_bromo -#endif ENDDO ENDDO @@ -236,7 +230,6 @@ SUBROUTINE BELEG_PARM(kpie,kpje) rdn2o1=2*ro2ut-2.5*rnit ! moles N2O used for remineralisation of 1 mole P rdn2o2=2*ro2ut-2*rnit ! moles N2 released for remineralisation of 1 mole P -#ifdef BROMO !Bromoform to phosphate ratio (Hense and Quack, 2009) !JT: too little production: 0.25Gmol/yr rbro=6.72e-7*rnit ! rbro=2.*6.72e-7*rnit @@ -244,7 +237,6 @@ SUBROUTINE BELEG_PARM(kpie,kpje) rbro=2.4e-6*rnit fbro1=1.0 fbro2=1.0 -#endif #ifdef AGG rcalc = 14. ! calcium carbonate to organic phosphorous production ratio diff --git a/hamocc/beleg_vars.F90 b/hamocc/beleg_vars.F90 index f7d68963..cb73bea8 100644 --- a/hamocc/beleg_vars.F90 +++ b/hamocc/beleg_vars.F90 @@ -63,9 +63,7 @@ SUBROUTINE BELEG_VARS(kpaufr,kpie,kpje,kpke,kbnd,pddpo,prho,omask, & use mo_biomod, only: cellmass,fractdim use mo_param1_bgc, only: iadust,inos #endif -#ifdef BROMO use mo_param1_bgc, only: ibromo -#endif #ifdef CFC use mo_param1_bgc, only: icfc11,icfc12,isf6 #endif @@ -209,10 +207,8 @@ SUBROUTINE BELEG_VARS(kpaufr,kpie,kpje,kpke,kbnd,pddpo,prho,omask, & ocetra(i,j,k,icalc13)=ocetra(i,j,k,icalc)*rco213 ocetra(i,j,k,icalc14)=ocetra(i,j,k,icalc)*rco214 #endif -#ifdef BROMO ! Initialise to 0,01 pmol L-1 (Stemmler et al., 2015) => mol/kg ocetra(i,j,k,ibromo)= 1.e-14/prho(i,j,k) -#endif ENDIF ! omask > 0.5 ENDDO ENDDO diff --git a/hamocc/carchm.F90 b/hamocc/carchm.F90 index 5341826e..6a549098 100644 --- a/hamocc/carchm.F90 +++ b/hamocc/carchm.F90 @@ -105,9 +105,7 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & & isco212,isilica use mo_vgrid, only: dp_min,kmle,kbo,ptiestu -#ifdef BROMO use mo_param1_bgc, only: iatmbromo,ibromo -#endif #ifdef CFC use mo_carbch, only: atm_cfc11_nh,atm_cfc11_sh,atm_cfc12_nh,atm_cfc12_sh,atm_sf6_nh,atm_sf6_sh use mo_param1_bgc, only: iatmf11,iatmf12,iatmsf6,icfc11,icfc12,isf6 @@ -169,9 +167,7 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & REAL :: atco213,atco214,pco213,pco214 REAL :: frac_k,frac_aqg,frac_dicg #endif -#ifdef BROMO REAL :: flx_bromo,sch_bromo,kw_bromo,a_bromo,atbrf,Kb1,lsub -#endif ! set variables for diagnostic output to zero atmflx (:,:,:)=0. @@ -218,9 +214,7 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & !$OMP ,atco213,atco214,rco213,rco214,pco213,pco214,frac_aqg & !$OMP ,frac_dicg,flux13d,flux13u,flux14d,flux14u,dissol13,dissol14 & #endif -#ifdef BROMO !$OMP ,flx_bromo,sch_bromo,kw_bromo,a_bromo,atbrf,Kb1,lsub & -#endif !$OMP ,j,i) DO k=1,kpke DO j=1,kpje @@ -310,11 +304,9 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & sch_12= 3828.1 - 249.86*t + 8.7603*t2 - 0.1716 *t3 + 0.001408 *t4 sch_sf= 3177.5 - 200.57*t + 6.8865*t2 - 0.13335 *t3 + 0.0010877 *t4 #endif -#ifdef BROMO ! Stemmler et al. (2015; Biogeosciences) Eq. (9); Quack and Wallace ! (2003; GBC) sch_bromo= 4662.8 - 319.45*t + 9.9012*t2 - 0.1159*t3 -#endif ! solubility of N2 (Weiss, R.F. 1970, Deep-Sea Res., 17, 721-735) for moist air ! at 1 atm; multiplication with oxyco converts to kmol/m^3/atm @@ -343,10 +335,8 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & a_12 = 1e-12 * a_12 a_sf = 1e-12 * a_sf #endif -#ifdef BROMO !Henry's law constant [dimensionless] for Bromoform from Quack and Wallace (2003; GBC) a_bromo = exp(13.16 - 4973*(1/tk)) -#endif ! Transfer (piston) velocity kw according to Wanninkhof (2014), in units of ms-1 Xconvxa = 6.97e-07 ! Wanninkhof's a=0.251 converted from [cm hr-1]/[m s-1]^2 to [ms-1]/[m s-1]^2 @@ -360,12 +350,10 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & kw_12 = (1.-psicomo(i,j)) * Xconvxa * pfu10(i,j)**2*(660./sch_12)**0.5 kw_sf = (1.-psicomo(i,j)) * Xconvxa * pfu10(i,j)**2*(660./sch_sf)**0.5 #endif -#ifdef BROMO ! Stemmler et al. (2015; Biogeosciences) Eq. (8) ! 1.e-2/3600 = conversion from [cm hr-1]/[m s-1]^2 to [ms-1]/[m s-1]^2 kw_bromo=(1.-psicomo(i,j)) * 1.e-2/3600. * & & (0.222*pfu10(i,j)**2+0.33*pfu10(i,j))*(660./sch_bromo)**0.5 -#endif atco2 = atm(i,j,iatmco2) ato2 = atm(i,j,iatmo2) @@ -374,9 +362,7 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & atco213 = atm(i,j,iatmc13) atco214 = atm(i,j,iatmc14) #endif -#ifdef BROMO atbrf = atm(i,j,iatmbromo) -#endif ! Ratio P/P_0, where P is the local SLP and P_0 is standard pressure (1 atm). This is ! used in all surface flux calculations where atmospheric concentration is given as a @@ -487,7 +473,6 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & end if ocetra(i,j,1,idms) = ocetra(i,j,1,idms) - dmsflux/pddpo(i,j,1) -#ifdef BROMO ! Quack and Wallace (2003) eq. 1 ! flux = kw*(Cw - Ca/H) ; kw[m s-1]; Cw[kmol m-3]; ! Convert Ca(atbrf) from @@ -497,8 +482,6 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & flx_bromo=kw_bromo*dtbgc* & & (atbrf/a_bromo*1e-12*ppao(i,j)*1e-5/(tk*0.083) - ocetra(i,j,1,ibromo)) ocetra(i,j,1,ibromo)=ocetra(i,j,1,ibromo)+flx_bromo/pddpo(i,j,1) -#endif - ! Save surface fluxes atmflx(i,j,iatmco2)=fluxu-fluxd @@ -518,9 +501,7 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & #ifdef natDIC atmflx(i,j,iatmnco2)=natfluxu-natfluxd #endif -#ifdef BROMO atmflx(i,j,iatmbromo)=-flx_bromo -#endif ! Save up- and downward components of carbon fluxes for output co2fxd(i,j) = fluxd @@ -547,7 +528,6 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & co2solm(i,j) = Kh ! mol/kg/atm endif ! k==1 -#ifdef BROMO ! Degradation to hydrolysis (Eq. 2-4 of Stemmler et al., 2015) ! A1=1.23e17 mol min-1 => 2.05e12 kmol sec-1 Kb1=2.05e12*exp(-1.073e5/(8.314*tk))*dtbgc @@ -555,7 +535,6 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & ! Degradation to halogen substitution (Eq. 5-6 of Stemmler et al., 2015) lsub=7.33e-10*exp(1.250713e4*(1/298.-1/tk))*dtbgc ocetra(i,j,k,ibromo)=ocetra(i,j,k,ibromo)*(1.-lsub) -#endif ! ----------------------------------------------------------------- ! Deep ocean processes diff --git a/hamocc/hamocc4bcm.F90 b/hamocc/hamocc4bcm.F90 index 47685d13..98b86b19 100644 --- a/hamocc/hamocc4bcm.F90 +++ b/hamocc/hamocc4bcm.F90 @@ -97,9 +97,7 @@ SUBROUTINE HAMOCC4BCM(kpie,kpje,kpke,kbnd,kplyear,kplmon,kplday,kldtday,& #if defined(BOXATM) use mo_boxatm, only: update_boxatm #endif -#ifdef BROMO use mo_param1_bgc, only: iatmbromo -#endif #ifdef CFC use mo_carbch, only: atm_cfc11_nh,atm_cfc11_sh,atm_cfc12_nh,atm_cfc12_sh,atm_sf6_nh,atm_sf6_sh #endif @@ -185,7 +183,6 @@ SUBROUTINE HAMOCC4BCM(kpie,kpje,kpke,kbnd,kplyear,kplmon,kplday,kldtday,& !if (mnproc.eq.1) write (io_stdo_bgc,*) 'iHAMOCC: getting co2 from atm' #endif -#ifdef BROMO !$OMP PARALLEL DO PRIVATE(i) DO j=1,kpje DO i=1,kpie @@ -196,7 +193,6 @@ SUBROUTINE HAMOCC4BCM(kpie,kpje,kpke,kbnd,kplyear,kplmon,kplday,kldtday,& ENDDO !$OMP END PARALLEL DO if (mnproc.eq.1) write (io_stdo_bgc,*) 'iHAMOCC: getting bromoform from atm' -#endif !-------------------------------------------------------------------- ! Read atmospheric cfc concentrations @@ -421,11 +417,7 @@ SUBROUTINE HAMOCC4BCM(kpie,kpje,kpke,kbnd,kplyear,kplmon,kplday,kldtday,& !$OMP PARALLEL DO PRIVATE(i) DO j=1,kpje DO i=1,kpie -#ifdef BROMO if(omask(i,j) .gt. 0.5) pflxbromo(i,j)=-252.7*atmflx(i,j,iatmbromo)/dtbgc -#else - if(omask(i,j) .gt. 0.5) pflxbromo(i,j)=0.0 -#endif ENDDO ENDDO !$OMP END PARALLEL DO diff --git a/hamocc/hamocc_init.F90 b/hamocc/hamocc_init.F90 index 110563c0..47b35559 100644 --- a/hamocc/hamocc_init.F90 +++ b/hamocc/hamocc_init.F90 @@ -196,9 +196,7 @@ subroutine hamocc_init(read_rest,rstfnm_hamocc) CALL ini_read_oafx(idm,jdm,bgc_dx,bgc_dy,plat,omask) -#ifdef BROMO CALL ini_swa_clim(idm,jdm,omask) -#endif call ini_pi_ph(idm,jdm,omask) ! diff --git a/hamocc/inventory_bgc.F90 b/hamocc/inventory_bgc.F90 index c9f104f5..17fbf34d 100644 --- a/hamocc/inventory_bgc.F90 +++ b/hamocc/inventory_bgc.F90 @@ -662,9 +662,7 @@ subroutine write_netcdf(iogrp) #ifdef AGG use mo_param1_bgc, only: iadust,inos #endif -#ifdef BROMO use mo_param1_bgc, only: ibromo -#endif #ifdef CFC use mo_param1_bgc, only: icfc11,icfc12,isf6 #endif @@ -772,9 +770,7 @@ subroutine write_netcdf(iogrp) integer :: zt_natalkali_varid, zc_natalkali_varid ! Natural alkalinity integer :: zt_natcalciu_varid, zc_natcalciu_varid ! Natural calcium carbonate #endif -#ifdef BROMO integer :: zt_bromo_varid, zc_bromo_varid ! Bromoform -#endif !--- sum of inventory integer :: totcarb_varid, totphos_varid, totsili_varid, totnitr_varid integer :: totoxyg_varid @@ -1400,7 +1396,6 @@ subroutine write_netcdf(iogrp) & 'kmol/m^3') ) #endif -#ifdef BROMO call nccheck( NF90_DEF_VAR(ncid, 'zt_bromo', NF90_DOUBLE, & & time_dimid, zt_bromo_varid) ) call nccheck( NF90_PUT_ATT(ncid, zt_bromo_varid, 'long_name', & @@ -1412,7 +1407,6 @@ subroutine write_netcdf(iogrp) call nccheck( NF90_PUT_ATT(ncid, zc_bromo_varid, 'long_name', & & 'Mean bromoform concentration') ) call nccheck( NF90_PUT_ATT(ncid, zc_bromo_varid, 'units', 'kmol/m^3') ) -#endif !--- Define variables : sum of inventory call nccheck( NF90_DEF_VAR(ncid, 'totcarb', NF90_DOUBLE, time_dimid, & @@ -1602,10 +1596,8 @@ subroutine write_netcdf(iogrp) call nccheck( NF90_INQ_VARID(ncid, "zt_natcalciu", zt_natcalciu_varid) ) call nccheck( NF90_INQ_VARID(ncid, "zc_natcalciu", zc_natcalciu_varid) ) #endif -#ifdef BROMO call nccheck( NF90_INQ_VARID(ncid, "zt_bromo", zt_bromo_varid) ) call nccheck( NF90_INQ_VARID(ncid, "zc_bromo", zc_bromo_varid) ) -#endif !--- Inquire varid : sum of inventory call nccheck( NF90_INQ_VARID(ncid, "totcarb", totcarb_varid) ) call nccheck( NF90_INQ_VARID(ncid, "totphos", totphos_varid) ) @@ -1829,12 +1821,10 @@ subroutine write_netcdf(iogrp) call nccheck( NF90_PUT_VAR(ncid, zc_natcalciu_varid, & & zocetratoc(inatcalc), start = wrstart) ) #endif -#ifdef BROMO call nccheck( NF90_PUT_VAR(ncid, zt_bromo_varid, & & zocetratot(ibromo), start = wrstart) ) call nccheck( NF90_PUT_VAR(ncid, zc_bromo_varid, & & zocetratoc(ibromo), start = wrstart) ) -#endif !--- Write data : sum of inventory call nccheck( NF90_PUT_VAR(ncid, totcarb_varid, totalcarbon, & & start = wrstart) ) diff --git a/hamocc/mo_bgcmean.F90 b/hamocc/mo_bgcmean.F90 index 08cc202f..c869905e 100644 --- a/hamocc/mo_bgcmean.F90 +++ b/hamocc/mo_bgcmean.F90 @@ -722,7 +722,6 @@ SUBROUTINE ALLOC_MEM_BGCMEAN(kpie,kpje,kpke) IF (SRF_NATPH(n).GT.0) i_bsc_m2d=i_bsc_m2d+1 jsrfnatph(n)=i_bsc_m2d*min(1,SRF_NATPH(n)) #endif -#ifdef BROMO IF (SRF_BROMO(n).GT.0) i_bsc_m2d=i_bsc_m2d+1 jsrfbromo(n)=i_bsc_m2d*min(1,SRF_BROMO(n)) IF (SRF_BROMOFX(n).GT.0) i_bsc_m2d=i_bsc_m2d+1 @@ -731,7 +730,6 @@ SUBROUTINE ALLOC_MEM_BGCMEAN(kpie,kpje,kpke) jbromo_prod(n)=i_bsc_m2d*min(1,INT_BROMOPRO(n)) IF (INT_BROMOUV(n).GT.0) i_bsc_m2d=i_bsc_m2d+1 jbromo_uv(n)=i_bsc_m2d*min(1,INT_BROMOUV(n)) -#endif ENDDO domassfluxes = any( & @@ -880,10 +878,8 @@ SUBROUTINE ALLOC_MEM_BGCMEAN(kpie,kpje,kpke) IF (LYR_NATOMEGAC(n).GT.0) i_bsc_m3d=i_bsc_m3d+1 jnatomegac(n)=i_bsc_m3d*min(1,LYR_NATOMEGAC(n)) #endif -#ifdef BROMO IF (LYR_BROMO(n).GT.0) i_bsc_m3d=i_bsc_m3d+1 jbromo(n)=i_bsc_m3d*min(1,LYR_BROMO(n)) -#endif IF (LVL_PHYTO(n).GT.0) ilvl_bsc_m3d=ilvl_bsc_m3d+1 jlvlphyto(n)=ilvl_bsc_m3d*min(1,LVL_PHYTO(n)) @@ -993,10 +989,8 @@ SUBROUTINE ALLOC_MEM_BGCMEAN(kpie,kpje,kpke) IF (LVL_NATOMEGAC(n).GT.0) ilvl_bsc_m3d=ilvl_bsc_m3d+1 jlvlnatomegac(n)=ilvl_bsc_m3d*min(1,LVL_NATOMEGAC(n)) #endif -#ifdef BROMO IF (LVL_BROMO(n).GT.0) ilvl_bsc_m3d=ilvl_bsc_m3d+1 jlvlbromo(n)=ilvl_bsc_m3d*min(1,LVL_BROMO(n)) -#endif IF (i_bsc_m3d.NE.0) checkdp(n)=1 ENDDO diff --git a/hamocc/mo_biomod.F90 b/hamocc/mo_biomod.F90 index 0703211d..aa486820 100644 --- a/hamocc/mo_biomod.F90 +++ b/hamocc/mo_biomod.F90 @@ -88,10 +88,8 @@ MODULE mo_biomod REAL, DIMENSION (:,:,:), ALLOCATABLE :: eps3d REAL, DIMENSION (:,:,:), ALLOCATABLE :: asize3d #endif -#ifdef BROMO REAL, DIMENSION (:,:), ALLOCATABLE :: int_chbr3_prod REAL, DIMENSION (:,:), ALLOCATABLE :: int_chbr3_uv -#endif REAL :: phytomi,grami,grazra,pi_alpha REAL :: remido,dyphy,zinges,epsher,spemor,gammap,gammaz,ecan @@ -115,9 +113,7 @@ MODULE mo_biomod #elif defined(WLIN) REAL :: wmin,wmax,wlin #endif -#ifdef BROMO REAL :: rbro -#endif CONTAINS @@ -371,7 +367,6 @@ SUBROUTINE ALLOC_MEM_BIOMOD(kpie,kpje,kpke) asize3d(:,:,:) = 0.0 #endif -#ifdef BROMO 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 @@ -383,7 +378,6 @@ SUBROUTINE ALLOC_MEM_BIOMOD(kpie,kpje,kpke) 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 !****************************************************************************** END SUBROUTINE ALLOC_MEM_BIOMOD diff --git a/hamocc/mo_carbch.F90 b/hamocc/mo_carbch.F90 index b2e7f0a8..55e2fb04 100644 --- a/hamocc/mo_carbch.F90 +++ b/hamocc/mo_carbch.F90 @@ -107,9 +107,7 @@ MODULE mo_carbch REAL :: atm_cfc12_nh,atm_cfc12_sh REAL :: atm_sf6_nh,atm_sf6_sh #endif -#ifdef BROMO REAL :: atm_bromo, fbro1, fbro2 -#endif CONTAINS diff --git a/hamocc/mo_param1_bgc.F90 b/hamocc/mo_param1_bgc.F90 index f18df794..301c0138 100644 --- a/hamocc/mo_param1_bgc.F90 +++ b/hamocc/mo_param1_bgc.F90 @@ -128,13 +128,8 @@ MODULE mo_param1_bgc & inatalkali = -1, & & inatcalc = -1 #endif -#ifdef BROMO INTEGER, PARAMETER :: i_bromo=1, & & ibromo=i_base+i_iso+i_cfc+i_agg+i_nat_dic+1 -#else - INTEGER, PARAMETER :: i_bromo=0, & - & ibromo=-1 -#endif ! total number of advected tracers INTEGER, PARAMETER :: nocetra=i_base+i_iso+i_cfc+i_agg+i_nat_dic & @@ -178,14 +173,9 @@ MODULE mo_param1_bgc INTEGER, PARAMETER :: i_ndic_atm = 0, & & iatmnco2 = -1 #endif -#ifdef BROMO INTEGER, PARAMETER :: i_bromo_atm=1, & & iatmbromo=i_base_atm+i_iso_atm+i_cfc_atm+ & & i_ndic_atm+1 -#else - INTEGER, PARAMETER :: i_bromo_atm=0, & - & iatmbromo=-1 -#endif ! total number of atmosphere tracers INTEGER, PARAMETER :: natm=i_base_atm+i_iso_atm+i_cfc_atm+i_ndic_atm+i_bromo_atm diff --git a/hamocc/ncout_hamocc.F90 b/hamocc/ncout_hamocc.F90 index 7d29652e..bdc71871 100644 --- a/hamocc/ncout_hamocc.F90 +++ b/hamocc/ncout_hamocc.F90 @@ -115,12 +115,10 @@ subroutine ncwrt_bgc(iogrp) & lyr_asize,lvl_nos,lvl_wphy,lvl_wnos,lvl_eps, & & lvl_asize #endif -#ifdef BROMO use mo_bgcmean, only: jbromo,jbromofx,jsrfbromo,jbromo_prod, & & jbromo_uv,jatmbromo,lvl_bromo,srf_bromofx, & & srf_bromo,int_bromopro,int_bromouv, & & srf_atmbromo,lyr_bromo -#endif #ifdef CFC use mo_bgcmean,only: jcfc11,jcfc12,jsf6,jcfc11fx,jcfc12fx,jsf6fx, & & lvl_cfc11,lvl_cfc12,lvl_sf6,srf_cfc11, & @@ -300,9 +298,7 @@ subroutine ncwrt_bgc(iogrp) call finlyr(jnatomegaa(iogrp),jdp(iogrp)) call finlyr(jnatomegac(iogrp),jdp(iogrp)) #endif -#ifdef BROMO call finlyr(jbromo(iogrp),jdp(iogrp)) -#endif ! --- Mask sea floor in mass fluxes call msksrf(jcarflx0100(iogrp),k0100) @@ -380,9 +376,7 @@ subroutine ncwrt_bgc(iogrp) call msklvl(jlvlnatomegaa(iogrp),depths) call msklvl(jlvlnatomegac(iogrp),depths) #endif -#ifdef BROMO call msklvl(jlvlbromo(iogrp),depths) -#endif ! --- Compute log10 of pH if (SRF_PH(iogrp).ne.0) call logsrf(jsrfph(iogrp),rnacc,0.) @@ -473,13 +467,11 @@ subroutine ncwrt_bgc(iogrp) call wrtsrf(jnatco2fx(iogrp), SRF_NATCO2FX(iogrp), rnacc*12./dtbgc,0.,cmpflg,'natco2fx') call wrtsrf(jsrfnatph(iogrp), SRF_NATPH(iogrp), -1., 0.,cmpflg,'srfnatph') #endif -#ifdef BROMO call wrtsrf(jbromofx(iogrp), SRF_BROMOFX(iogrp), rnacc*1e3/dtbgc,0.,cmpflg,'bromofx') call wrtsrf(jsrfbromo(iogrp), SRF_BROMO(iogrp), rnacc*1e3, 0.,cmpflg,'srfbromo') call wrtsrf(jbromo_prod(iogrp), INT_BROMOPRO(iogrp), rnacc*1e3/dtbgc,0.,cmpflg,'intbromoprod') call wrtsrf(jbromo_uv(iogrp), INT_BROMOUV(iogrp), rnacc*1e3/dtbgc,0.,cmpflg,'intbromouv') call wrtsrf(jatmbromo(iogrp), SRF_ATMBROMO(iogrp), rnacc, 0.,cmpflg,'atmbromo') -#endif call wrtsrf(jatmco2(iogrp), SRF_ATMCO2(iogrp), rnacc, 0.,cmpflg,'atmco2') #if defined(BOXATM) call wrtsrf(jatmo2(iogrp), SRF_ATMO2(iogrp), rnacc, 0.,cmpflg,'atmo2') @@ -550,9 +542,7 @@ subroutine ncwrt_bgc(iogrp) call wrtlyr(jnatomegaa(iogrp), LYR_NATOMEGAA(iogrp),1., 0.,cmpflg,'natomegaa') call wrtlyr(jnatomegac(iogrp), LYR_NATOMEGAC(iogrp),1., 0.,cmpflg,'natomegac') #endif -#ifdef BROMO call wrtlyr(jbromo(iogrp), LYR_BROMO(iogrp), 1e3, 0.,cmpflg,'bromo') -#endif ! --- Store 3d level fields call wrtlvl(jlvldic(iogrp), LVL_DIC(iogrp), rnacc*1e3, 0.,cmpflg,'dissiclvl') @@ -613,9 +603,7 @@ subroutine ncwrt_bgc(iogrp) call wrtlvl(jlvlnatomegaa(iogrp),LVL_NATOMEGAA(iogrp),rnacc, 0.,cmpflg,'natomegaalvl') call wrtlvl(jlvlnatomegac(iogrp),LVL_NATOMEGAC(iogrp),rnacc, 0.,cmpflg,'natomegaclvl') #endif -#ifdef BROMO call wrtlvl(jlvlbromo(iogrp), LVL_BROMO(iogrp), rnacc*1e3, 0.,cmpflg,'bromolvl') -#endif ! --- Store sediment fields #ifndef sedbypass @@ -720,13 +708,11 @@ subroutine ncwrt_bgc(iogrp) call inisrf(jnatco2fx(iogrp),0.) call inisrf(jsrfnatph(iogrp),0.) #endif -#ifdef BROMO call inisrf(jsrfbromo(iogrp),0.) call inisrf(jbromofx(iogrp),0.) call inisrf(jbromo_prod(iogrp),0.) call inisrf(jbromo_uv(iogrp),0.) call inisrf(jatmbromo(iogrp),0.) -#endif call inisrf(jatmco2(iogrp),0.) @@ -798,9 +784,7 @@ subroutine ncwrt_bgc(iogrp) call inilyr(jnatomegaa(iogrp),0.) call inilyr(jnatomegac(iogrp),0.) #endif -#ifdef BROMO call inilyr(jbromo(iogrp),0.) -#endif call inilvl(jlvldic(iogrp),0.) call inilvl(jlvlalkali(iogrp),0.) @@ -860,9 +844,7 @@ subroutine ncwrt_bgc(iogrp) call inilvl(jlvlnatomegaa(iogrp),0.) call inilvl(jlvlnatomegac(iogrp),0.) #endif -#ifdef BROMO call inilvl(jlvlbromo(iogrp),0.) -#endif #ifndef sedbypass call inisdm(jpowaic(iogrp),0.) @@ -922,10 +904,8 @@ subroutine hamoccvardef(iogrp,timeunits,calendar,cmpflg) use mo_bgcmean, only: srf_atmo2,srf_atmn2 #endif -#ifdef BROMO use mo_bgcmean, only:srf_bromo,srf_bromofx,int_bromopro, & & int_bromouv,srf_atmbromo,lyr_bromo,lvl_bromo -#endif #ifdef CFC use mo_bgcmean, only: srf_cfc11,srf_cfc12,srf_sf6,lyr_cfc11, & & lyr_cfc12,lyr_sf6,lvl_cfc11,lvl_cfc12,lvl_sf6 @@ -1127,7 +1107,6 @@ subroutine hamoccvardef(iogrp,timeunits,calendar,cmpflg) call ncdefvar3d(SRF_NATPH(iogrp),cmpflg,'p','srfnatph', & & 'Surface natural pH',' ','-log10([H+])',0) #endif -#ifdef BROMO call ncdefvar3d(SRF_BROMO(iogrp),cmpflg,'p','srfbromo', & & 'Surface bromoform',' ','mol CHBr3 m-3',0) call ncdefvar3d(SRF_BROMOfx(iogrp),cmpflg,'p','bromofx', & @@ -1139,7 +1118,6 @@ subroutine hamoccvardef(iogrp,timeunits,calendar,cmpflg) & 'mol CHBr3 m-2 s-1',0) call ncdefvar3d(SRF_ATMBROMO(iogrp),cmpflg,'p', & & 'atmbromo','Atmospheric bromoform',' ','ppt',0) -#endif call ncdefvar3d(SRF_ATMCO2(iogrp),cmpflg,'p', & & 'atmco2','Atmospheric CO2',' ','ppm',0) @@ -1267,10 +1245,8 @@ subroutine hamoccvardef(iogrp,timeunits,calendar,cmpflg) call ncdefvar3d(LYR_NATOMEGAC(iogrp),cmpflg,'p','natomegac', & & 'Natural OmegaC',' ','1',1) #endif -#ifdef BROMO call ncdefvar3d(LYR_BROMO(iogrp),cmpflg,'p', & & 'bromo','Bromoform',' ','mol CHBr3 m-3',1) -#endif ! --- define 3d level fields call ncdefvar3d(LVL_DIC(iogrp),cmpflg,'p', & @@ -1381,10 +1357,8 @@ subroutine hamoccvardef(iogrp,timeunits,calendar,cmpflg) call ncdefvar3d(LVL_NATOMEGAC(iogrp),cmpflg,'p', & & 'natomegaclvl','Natural OmegaC',' ','1',2) #endif -#ifdef BROMO call ncdefvar3d(LVL_BROMO(iogrp),cmpflg,'p', & & 'bromolvl','Bromoform',' ','mol CHBr3 m-3',2) -#endif ! --- define sediment fields #ifndef sedbypass diff --git a/hamocc/ocprod.F90 b/hamocc/ocprod.F90 index d98bc43c..9fe7b3ff 100644 --- a/hamocc/ocprod.F90 +++ b/hamocc/ocprod.F90 @@ -102,12 +102,10 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) #elif defined(WLIN) use mo_biomod, only: wmin,wmax,wlin #endif -#ifdef BROMO use mo_param1_bgc, only: ibromo use mo_biomod, only: int_chbr3_prod,int_chbr3_uv,rbro use mo_carbch, only: fbro1,fbro2 use mo_clim_swa, only: swa_clim -#endif #ifdef cisonew use mo_biomod, only: bifr13,bifr13_perm,bifr14,growth_co2 use mo_param1_bgc, only: icalc13,icalc14,idet13,idet14,idoc13,idoc14,iphy13,iphy14,isco213,isco214,izoo13,izoo14,safediv @@ -190,10 +188,8 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) real :: sett_agg,shear_agg,effsti,dfirst,dshagg,dsett real :: wnos,wnosd #endif -#ifdef BROMO real :: bro_beta,bro_uv real :: abs_uv(kpie,kpje,kpke) -#endif ! set variables for diagnostic output to zero @@ -221,10 +217,8 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) intdms_bac(:,:) = 0. intdms_uv (:,:) = 0. phosy3d (:,:,:) = 0. -#ifdef BROMO int_chbr3_uv (:,:) = 0. int_chbr3_prod (:,:) = 0. -#endif #ifdef AGG eps3d(:,:,:) = 0. asize3d(:,:,:) = 0. @@ -251,9 +245,7 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) ! Calculate swr absorption by water and phytoplankton abs_bgc(:,:,:) = 0. -#ifdef BROMO abs_uv(:,:,:) = 0. -#endif #ifdef FB_BGC_OCE abs_oce(:,:,:) = 0. abs_oce(:,:,1) = 1. @@ -277,9 +269,7 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) ! Average light intensity in layer k atten = atten_w + atten_c * max(0.,ocetra(i,j,k,iphy)) abs_bgc(i,j,k) = ((absorption/atten)* (1.-exp(-atten*dz)))/dz -#ifdef BROMO abs_uv(i,j,k) = ((absorption_uv/atten_uv)*(1.-exp(-atten_uv*dz)))/dz -#endif #ifdef FB_BGC_OCE abs_oce(i,j,k) = abs_oce(i,j,k) * absorption if (k == 2) then @@ -315,9 +305,7 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) !$OMP ,zoomor14,excdoc13,excdoc14,exud13,exud14,export13,export14 & !$OMP ,delcar13,delcar14,dtr13,dtr14,bifr13,bifr14 & # endif -# ifdef BROMO !$OMP ,bro_beta,bro_uv & -# endif !$OMP ,i,k) loop1: do j = 1,kpje @@ -484,7 +472,6 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) ocetra(i,j,k,iopal) = ocetra(i,j,k,iopal)+delsil-dremopal*ocetra(i,j,k,iopal) ocetra(i,j,k,iiron) = ocetra(i,j,k,iiron)+dtr*riron & & - relaxfe*MAX(ocetra(i,j,k,iiron)-fesoly,0.) -#ifdef BROMO ! Bromo source from phytoplankton production and sink to photolysis ! Hense and Quack (200) Pg537 Decay time scale is 30days =0.0333/day ! sinks owing to degradation by nitrifiers (Pg 538 of Hense and Quack, @@ -499,7 +486,6 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) bro_uv = 0.0 endif ocetra(i,j,k,ibromo) = ocetra(i,j,k,ibromo)+bro_beta*phosy-bro_uv -#endif #ifdef AGG !*********************************************************************** @@ -541,10 +527,8 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) intdmsprod(i,j) = intdmsprod(i,j)+dmsprod*dz intdms_bac(i,j) = intdms_bac(i,j)+dms_bac*dz intdms_uv(i,j) = intdms_uv (i,j)+dms_uv*dz -#ifdef BROMO int_chbr3_uv(i,j) = int_chbr3_uv (i,j) + bro_uv*dz int_chbr3_prod(i,j) = int_chbr3_prod (i,j) + bro_beta*phosy*dz -#endif intphosy(i,j) = intphosy(i,j) +phosy*rcar*dz ! primary production in kmol C m-2 phosy3d(i,j,k) = phosy*rcar ! primary production in kmol C m-3 diff --git a/meson.build b/meson.build index 9f237b7e..c2914071 100644 --- a/meson.build +++ b/meson.build @@ -120,9 +120,6 @@ if get_option('ecosys') if get_option('hamocc_boxatm') add_project_arguments('-DBOXATM', language: 'fortran') endif - if get_option('hamocc_bromo') - add_project_arguments('-DBROMO', language: 'fortran') - endif if get_option('hamocc_cfc') add_project_arguments('-DCFC', language: 'fortran') endif diff --git a/phy/restart_wt.F b/phy/restart_wt.F index 861dee7d..1ffd0a31 100644 --- a/phy/restart_wt.F +++ b/phy/restart_wt.F @@ -367,9 +367,7 @@ subroutine restart_wt call wrtrst('mltpot',trim(c5p)//' time',mltpot,ip) call wrtrst('flxco2',trim(c5p)//' time',flxco2,ip) call wrtrst('flxdms',trim(c5p)//' time',flxdms,ip) -#ifdef BROMO call wrtrst('flxbrf',trim(c5p)//' time',flxbrf,ip) -#endif endif c #ifdef TRC @@ -1015,9 +1013,7 @@ subroutine defvar_restart(c5p,c5u,c5v,c5q) call defvarrst('mltpot',trim(c5p)//' time') call defvarrst('flxco2',trim(c5p)//' time') call defvarrst('flxdms',trim(c5p)//' time') -#ifdef BROMO call defvarrst('flxbrf',trim(c5p)//' time') -#endif endif c #ifdef TRC From 3ccf919b5011228ba060eef53d5134853d09011e Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Wed, 28 Jun 2023 09:54:58 +0200 Subject: [PATCH 13/52] added bromo logic --- drivers/nuopc/mod_nuopc_methods.F90 | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/drivers/nuopc/mod_nuopc_methods.F90 b/drivers/nuopc/mod_nuopc_methods.F90 index 8106f2c3..968e94bf 100644 --- a/drivers/nuopc/mod_nuopc_methods.F90 +++ b/drivers/nuopc/mod_nuopc_methods.F90 @@ -44,7 +44,7 @@ module mod_nuopc_methods use shr_const_mod, only: SHR_CONST_RHOSW, SHR_CONST_LATICE, SHR_CONST_TKFRZ #ifdef HAMOCC use mo_carbch, only: ocetra - use mo_param1_bgc, only: idms + use mo_param1_bgc, only: idms, ibromo use mo_control_bgc, only: do_bgc_aofluxes #endif @@ -1114,6 +1114,22 @@ subroutine blom_exportflds(fldlist_num, fldlist) end if end if + if (index_So_brf > 0) then + if (associated(fldlist(index_So_brf)%dataptr)) then + fldlist(index_So_brf)%dataptr(:) = 0._r8 + !$omp parallel do private(l, i, n) + do j = 1, jjcpl + do l = 1, isp(j) + do i = max(1, ifp(j,l)), min(ii, ilp(j,l)) + n = (j - 1)*ii + i + fldlist(index_So_brf)%dataptr(n) = ocetra(i,j,1,ibromo) + enddo + enddo + enddo + !$omp end parallel do + end if + end if + ! ------------------------------------------------------------------------ ! Provide CO2 flux [kg CO2 m-2 s-1], if requested. ! ------------------------------------------------------------------------ From c18571c08846445c6bfd05b5f400f82fb876686a Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Fri, 30 Jun 2023 13:15:04 +0200 Subject: [PATCH 14/52] changes to get bromoform computed correctly by mediator --- cesm/mod_cesm.F90 | 9 ++++++--- drivers/nuopc/mod_nuopc_methods.F90 | 29 +++++++++++++++++++++++++++-- hamocc/carchm.F90 | 29 ++++++++++++++++++++--------- hamocc/hamocc4bcm.F90 | 11 ++++++----- 4 files changed, 59 insertions(+), 19 deletions(-) diff --git a/cesm/mod_cesm.F90 b/cesm/mod_cesm.F90 index b74b5456..3ae5a459 100644 --- a/cesm/mod_cesm.F90 +++ b/cesm/mod_cesm.F90 @@ -29,7 +29,8 @@ module mod_cesm use mod_xc use mod_forcing, only: trxday, srxday, swa, nsf, lip, sop, eva, rnf, rfi, & fmltfz, sfl, ztx, mty, ustarw, slp, abswnd, & - lamult, lasl, ustokes, vstokes, atmco2, atmbrf, flxdms + lamult, lasl, ustokes, vstokes, atmco2, atmbrf, & + flxdms, flxbrf use mod_ben02, only: initai, rdcsic, rdctsf, fnlzai use mod_seaice, only: ficem use mod_checksum, only: csdiag, chksummsk @@ -78,7 +79,8 @@ module mod_cesm vstokes_da, & ! v-component of surface Stokes drift [m s-1]. atmco2_da, & ! Atmospheric CO2 concentration [ppm]. atmbrf_da, & ! Atmospheric bromoform concentration [ppt]. - flxdms_da ! dms surface flux computed by mediator [kg m-2 s-1] + flxdms_da, & ! dms surface flux computed by mediator [kg m-2 s-1] + flxbrf_da ! brf surface flux computed by mediator [kg m-2 s-1] logical :: & smtfrc ! If true, time smooth CESM forcing fields. @@ -89,7 +91,7 @@ module mod_cesm public :: runid_cesm, runtyp_cesm, ocn_cpl_dt_cesm, nstep_in_cpl, hmlt, & frzpot, mltpot, swa_da, nsf_da, hmlt_da, lip_da, sop_da, eva_da, & rnf_da, rfi_da, fmltfz_da, sfl_da, ztx_da, mty_da, ustarw_da, & - slp_da, abswnd_da, ficem_da, lamult_da, lasl_da, flxdms_da, & + slp_da, abswnd_da, ficem_da, lamult_da, lasl_da, flxdms_da, flxbrf_da, & ustokes_da, vstokes_da, atmco2_da, atmbrf_da, smtfrc, l1ci, l2ci, & inicon_cesm, inifrc_cesm, getfrc_cesm contains @@ -193,6 +195,7 @@ subroutine getfrc_cesm if (.not. do_bgc_aofluxes) then ! flxdms is obtained from the mediator flxdms(i, j) = w1*flxdms_da(i, j, l1ci) + w2*flxdms_da(i, j, l2ci) + flxbrf(i, j) = w1*flxbrf_da(i, j, l1ci) + w2*flxbrf_da(i, j, l2ci) end if enddo enddo diff --git a/drivers/nuopc/mod_nuopc_methods.F90 b/drivers/nuopc/mod_nuopc_methods.F90 index 968e94bf..73430298 100644 --- a/drivers/nuopc/mod_nuopc_methods.F90 +++ b/drivers/nuopc/mod_nuopc_methods.F90 @@ -38,7 +38,7 @@ module mod_nuopc_methods 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, atmbrf_da, & - flxdms_da, l1ci, l2ci + flxdms_da, flxbrf_da, l1ci, l2ci use mod_utility, only: util1, util2 use mod_checksum, only: csdiag, chksummsk use shr_const_mod, only: SHR_CONST_RHOSW, SHR_CONST_LATICE, SHR_CONST_TKFRZ @@ -951,7 +951,7 @@ subroutine blom_importflds(fldlist_num, fldlist) if (index_Faox_dms > 0) then if (associated(fldlist(index_Faox_dms)%dataptr)) then - !$omp parallel do private(i, n, afac) + !$omp parallel do private(i, n, afac) do j = 1, jjcpl do i = 1, ii n = (j - 1)*ii + i @@ -974,6 +974,31 @@ subroutine blom_importflds(fldlist_num, fldlist) end if end if + if (index_Faox_brf > 0) then + if (associated(fldlist(index_Faox_brf)%dataptr)) then + !$omp parallel do private(i, n, afac) + do j = 1, jjcpl + do i = 1, ii + n = (j - 1)*ii + i + afac = med2mod_areacor(n) + if (ip(i,j) == 0) then + flxbrf_da(i,j,l2ci) = mval + elseif (cplmsk(i,j) == 0) then + flxbrf_da(i,j,l2ci) = 0._r8 + else + flxbrf_da(i,j,l2ci) = fldlist(index_Faox_brf)%dataptr(n)*afac/252.7 + end if + end do + end do + !$omp end parallel do + if (mnproc == 1 .and. first_call) & + write(lp,*) subname//': prog. brf flux obtained from mediator' + end if + if (nreg == 2) then + call xctilr(flxbrf_da(1-nbdy,1-nbdy,l2ci), 1,1, 0,0, halo_ps) + end if + end if + if (csdiag) then if (mnproc == 1 .and. first_call) then write(lp,*) subname//':' diff --git a/hamocc/carchm.F90 b/hamocc/carchm.F90 index 6a549098..05986309 100644 --- a/hamocc/carchm.F90 +++ b/hamocc/carchm.F90 @@ -21,7 +21,7 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & pdlxp,pdlyp,pddpo,prho,pglat,omask, & psicomo,ppao,pfu10,ptho,psao, & - pflxdms) + pflxdms,pflxbromo) !****************************************************************************** ! !**** *CARCHM* - . @@ -90,6 +90,7 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & ! *REAL* *ptho* - potential temperature. ! *REAL* *psao* - salinity [psu]. ! *REAL* *pflxdms* - input dms flux that is already computed +! *REAL* *pflxbromo* - input bromo flux that is already computed ! ! Externals ! --------- @@ -133,6 +134,7 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & REAL, intent(in) :: ptho(1-kbnd:kpie+kbnd,1-kbnd:kpje+kbnd,kpke) REAL, intent(in) :: psao(1-kbnd:kpie+kbnd,1-kbnd:kpje+kbnd,kpke) REAL, intent(in) :: pflxdms(1-kbnd:kpie+kbnd,1-kbnd:kpje+kbnd) + REAL, intent(in) :: pflxbromo(1-kbnd:kpie+kbnd,1-kbnd:kpje+kbnd) ! Local variables INTEGER :: i,j,k,l,js @@ -466,12 +468,10 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & ! Note that kwdms already has the open ocean fraction in the term dmsflux = kwdms*dtbgc*ocetra(i,j,1,idms) else - ! Note that computed flux passed in is assumed to be - ! downwards positive, whereas dms flux computed above is - ! upwards positive - so need a different sign dmsflux = -dtbgc*pflxdms(i,j) end if ocetra(i,j,1,idms) = ocetra(i,j,1,idms) - dmsflux/pddpo(i,j,1) + atmflx(i,j,iatmdms) = dmsflux ! positive to atmosphere [kmol dms m-2 timestep-1] ! Quack and Wallace (2003) eq. 1 ! flux = kw*(Cw - Ca/H) ; kw[m s-1]; Cw[kmol m-3]; @@ -479,16 +479,25 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & ! [pptv] to [ppp] by multiplying with 1e-12 (ppp = parts per part, dimensionless) ! [ppp] to [mol L-1] by multiplying with pressure[bar]/(SST[K]*R[L bar K-1 mol-1]); R=0,083 ! [mol L-1] to [kmol m-3] by multiplying with 1 - flx_bromo=kw_bromo*dtbgc* & - & (atbrf/a_bromo*1e-12*ppao(i,j)*1e-5/(tk*0.083) - ocetra(i,j,1,ibromo)) - ocetra(i,j,1,ibromo)=ocetra(i,j,1,ibromo)+flx_bromo/pddpo(i,j,1) + + if (do_bgc_aofluxes) then + flx_bromo = kw_bromo*dtbgc* & + (atbrf/a_bromo*1e-12*ppao(i,j)*1e-5/(tk*0.083) - ocetra(i,j,1,ibromo)) + else + ! Note that the external computation of fluxes is -flx_bromo/dtbgc + ! using above computation of flx_bromo + ! So need to divide by 252.7 and multiply by -dtbgc and in order to use this + ! for the tendency in the tracer update + flx_bromo = dtbgc*pflxbromo(i,j) + end if + ocetra(i,j,1,ibromo) = ocetra(i,j,1,ibromo) + flx_bromo/pddpo(i,j,1) + atmflx(i,j,iatmbromo) = -flx_bromo ! Save surface fluxes atmflx(i,j,iatmco2)=fluxu-fluxd atmflx(i,j,iatmo2)=oxflux atmflx(i,j,iatmn2)=niflux atmflx(i,j,iatmn2o)=n2oflux - atmflx(i,j,iatmdms)=dmsflux ! positive to atmosphere [kmol dms m-2 timestep-1] #ifdef cisonew atmflx(i,j,iatmc13)=flux13u-flux13d atmflx(i,j,iatmc14)=flux14u-flux14d @@ -501,7 +510,6 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & #ifdef natDIC atmflx(i,j,iatmnco2)=natfluxu-natfluxd #endif - atmflx(i,j,iatmbromo)=-flx_bromo ! Save up- and downward components of carbon fluxes for output co2fxd(i,j) = fluxd @@ -528,13 +536,16 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & co2solm(i,j) = Kh ! mol/kg/atm endif ! k==1 + ! Degradation to hydrolysis (Eq. 2-4 of Stemmler et al., 2015) ! A1=1.23e17 mol min-1 => 2.05e12 kmol sec-1 Kb1=2.05e12*exp(-1.073e5/(8.314*tk))*dtbgc ocetra(i,j,k,ibromo)=ocetra(i,j,k,ibromo)*(1.-(Kb1*Kw/ah1)) + ! Degradation to halogen substitution (Eq. 5-6 of Stemmler et al., 2015) lsub=7.33e-10*exp(1.250713e4*(1/298.-1/tk))*dtbgc ocetra(i,j,k,ibromo)=ocetra(i,j,k,ibromo)*(1.-lsub) + ! ----------------------------------------------------------------- ! Deep ocean processes diff --git a/hamocc/hamocc4bcm.F90 b/hamocc/hamocc4bcm.F90 index 98b86b19..fc1c322c 100644 --- a/hamocc/hamocc4bcm.F90 +++ b/hamocc/hamocc4bcm.F90 @@ -22,7 +22,6 @@ SUBROUTINE HAMOCC4BCM(kpie,kpje,kpke,kbnd,kplyear,kplmon,kplday,kldtday,& dust,rivin,ndep,oafx,pi_ph, & pfswr,psicomo,ppao,pfu10,ptho,psao, & patmco2,pflxco2,pflxdms,patmbromo,pflxbromo) - !****************************************************************************** ! ! HAMOCC4BGC - main routine of iHAMOCC. @@ -125,10 +124,12 @@ SUBROUTINE HAMOCC4BCM(kpie,kpje,kpke,kbnd,kplyear,kplmon,kplday,kldtday,& REAL, intent(in) :: patmco2(1-kbnd:kpie+kbnd,1-kbnd:kpje+kbnd) REAL, intent(out) :: pflxco2(1-kbnd:kpie+kbnd,1-kbnd:kpje+kbnd) REAL, intent(inout) :: pflxdms(1-kbnd:kpie+kbnd,1-kbnd:kpje+kbnd) - REAL, intent(in) :: patmbromo(1-kbnd:kpie+kbnd,1-kbnd:kpje+kbnd) - REAL, intent(out) :: pflxbromo(1-kbnd:kpie+kbnd,1-kbnd:kpje+kbnd) + REAL, intent(in) :: patmbromo(1-kbnd:kpie+kbnd,1-kbnd:kpje+kbnd) + REAL, intent(inout) :: pflxbromo(1-kbnd:kpie+kbnd,1-kbnd:kpje+kbnd) - ! If pflxdms is obtained externally to blom and therefore will be intent(in) + ! NOTE - why are some arguments intent(inout)? + ! If compute_flxdms is .true. then pflxdms will be computed in carchm.F90 + ! If compute_flxdms is .false. then pflxdms is obtained external to blom INTEGER :: i,j,k,l INTEGER :: nspin,it @@ -267,7 +268,7 @@ SUBROUTINE HAMOCC4BCM(kpie,kpje,kpke,kbnd,kplyear,kplmon,kplday,kldtday,& CALL CARCHM(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,prho,pglat,omask, & psicomo,ppao,pfu10,ptho,psao,& - pflxdms) + pflxdms,pflxbromo) #ifdef PBGC_CK_TIMESTEP IF (mnproc.eq.1) THEN From d3eb11b52c77bf94dc1fa2f2721e7ef0437c1f17 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Fri, 14 Jul 2023 14:43:22 +0200 Subject: [PATCH 15/52] first steps in refactoring buildnml --- cime_config/buildnml | 554 +----------------- cime_config/buildnml.py | 182 ++++++ cime_config/namelist_definition_blom.xml | 691 +++++++++++++++++++++++ cime_config/ocn_in.readme | 554 ++++++++++++++++++ 4 files changed, 1441 insertions(+), 540 deletions(-) mode change 100755 => 100644 cime_config/buildnml create mode 100644 cime_config/buildnml.py create mode 100644 cime_config/namelist_definition_blom.xml create mode 100644 cime_config/ocn_in.readme diff --git a/cime_config/buildnml b/cime_config/buildnml old mode 100755 new mode 100644 index e8c45153..46388741 --- a/cime_config/buildnml +++ b/cime_config/buildnml @@ -66,7 +66,9 @@ set DAY0 = `echo $RUN_STARTDATE | cut -c9-10` # Set namelist variables #------------------------------------------------------------------------------ +#------------------------------ # set LIMITS defaults +#------------------------------ set NDAY1 = 0 set NDAY2 = 0 set IDATE = $YEAR0$MONTH0$DAY0 @@ -158,7 +160,9 @@ else set IOTYPE = 0 endif +#------------------------------ # set VCOORD defaults +#------------------------------ set VCOORD_TYPE = "'$BLOM_VCOORD'" set RECONSTRUCTION_METHOD = "'ppm'" set DENSITY_LIMITING = "'monotonic'" @@ -176,7 +180,9 @@ set DPMIN_INTERIOR = .1 set DKTZU = 4 set DKTZL = 1 +#------------------------------ # set DIFFUSION defaults +#------------------------------ set EITMTH = "'gm'" set EDRITP = "'large scale'" set EDWMTH = "'smooth'" @@ -219,7 +225,9 @@ else set LTEDTP = "'neutral'" endif +#------------------------------ # set BGCNML defaults +#------------------------------ set ATM_CO2 = "$CCSM_CO2_PPMV" if ("$BLOM_RIVER_NUTRIENTS" == TRUE) then set DO_RIVINPT = .true. @@ -291,7 +299,9 @@ set L_3DVARSEDPOR = .false. set SEDPORFILE = "''" +#------------------------------ # set DIAPHY defaults +#------------------------------ set GLB_FNAMETAG = "'hd','hm','hy'" set GLB_AVEPERIO = '1, 30, 365' if ("$TEST" == TRUE) then @@ -475,7 +485,9 @@ set MSC_TEMPGA = '0, 4, 0' set MSC_SSSGA = '0, 4, 0' set MSC_SSTGA = '0, 4, 0' +#------------------------------ # set DIABGC defaults +#------------------------------ set BGC_FNAMETAG = "'hbgcd','hbgcm','hbgcy'" set BGC_AVEPERIO = '1,30,365' set BGC_FILEFREQ = '30,30,365' @@ -950,96 +962,9 @@ foreach mem ("`seq $NINST_OCN`") endif end +cp ocn_in.readme $RUNDIR/. + cat >! $RUNDIR/ocn_in$inststr << EOF -! LIMITS NAMELIST -! -! CONTENTS: -! -! NDAY1 : First day of integration (i) -! NDAY2 : Last day of integration (i) -! IDATE : Model date in YYYYMMDD (i) -! IDATE0 : Initial experiment date in YYYYMMDD (i) -! RUNID : Experiment name (a) -! EXPCNF : Experiment configuration (a) -! RUNTYP : CESM run type (a) -! GRFILE : Name of file containing grid specification (a) -! ICFILE : Name of file containing initial conditions, that is either -! a valid restart file or 'inicon.nc' if climatological based -! initial conditions are desired (a) -! PREF : Reference pressure for potential density (g/cm/s2) (f) -! BACLIN : Baroclinic time step (sec) (f) -! BATROP : Barotropic time step (sec) (f) -! MDV2HI : Laplacian diffusion velocity for momentum dissipation (cm/s) (f) -! MDV2LO : Laplacian diffusion velocity for momentum dissipation (cm/s) (f) -! MDV4HI : Biharmonic diffusion velocity for momentum dissipation (cm/s) (f) -! MDV4LO : Biharmonic diffusion velocity for momentum dissipation (cm/s) (f) -! MDC2HI : Laplacian diffusivity for momentum dissipation (cm**2/s) (f) -! MDC2LO : Laplacian diffusivity for momentum dissipation (cm**2/s) (f) -! VSC2HI : Parameter in deformation-dependent Laplacian viscosity (f) -! VSC2LO : Parameter in deformation-dependent Laplacian viscosity (f) -! VSC4HI : Parameter in deformation-dependent Biharmonic viscosity (f) -! VSC4LO : Parameter in deformation-dependent Biharmonic viscosity (f) -! CBAR : rms flow speed for linear bottom friction law (cm/s) (f) -! CB : Nondiemnsional coefficient of quadratic bottom friction (f) -! CWBDTS : Coastal wave breaking damping resiprocal time scale (1/s) (f) -! CWBDLS : Coastal wave breaking damping length scale (m) (f) -! MOMMTH : Momentum equation discretization method. Valid methods: -! 'enscon' (Sadourny (1975) enstrophy conserving), 'enecon' -! (Sadourny (1975) energy conserving), 'enedis' (Sadourny -! (1975) energy conserving with some dissipation) (a) -! BMCMTH : Baroclinic mass flux correction method. Valid methods: -! 'uc' (upstream column), 'dluc' (depth limited upstream -! column) (a) -! RMPMTH : Method of applying eddy-induced transport in the remap -! transport algorithm. Valid methods: 'eitvel', 'eitflx' (a) -! MLRTTP : Type of mixed layer restratification time scale. Valid -! types: 'variable', 'constant', 'limited' (a) -! RM0 : Efficiency factor of wind TKE generation in the Oberhuber -! (1993) TKE closure () (f) -! RM5 : Efficiency factor of TKE generation by momentum -! entrainment in the Oberhuber (1993) TKE closure () (f) -! CE : Efficiency factor for the restratification by mixed layer -! eddies (Fox-Kemper et al., 2008) () (f) -! TDFILE : Name of file containing tidal wave energy dissipation -! divided by by bottom buoyancy frequency (a) -! NIWGF : Global factor applied to the energy input by near-intertial -! motions () (f) -! NIWBF : Fraction of near-inertial energy dissipated in the boundary -! layer () (f) -! NIWLF : Fraction of near-inertial energy dissipated locally beneath -! the boundary layer () (f) -! SWAMTH : Shortwave radiation absorption method. Valid methods: -! 'top-layer', 'jerlov', 'chlorophyll' (a) -! JWTYPE : Number indicating the Jerlov (1968) water type (i) -! CHLOPT : Chlorophyll concentration option. Valid options: -! 'climatology' (a) -! CCFILE : Name of file containing chlorophyll concentration climatology (a) -! TRXDAY : e-folding time scale (days) for SST relax., if 0 no relax. (f) -! SRXDAY : e-folding time scale (days) for SSS relax., if 0 no relax. (f) -! TRXDPT : Maximum mixed layer depth for e-folding SST relaxation (m) (f) -! SRXDPT : Maximum mixed layer depth for e-folding SSS relaxation (m) (f) -! TRXLIM : Max. absolute value of SST difference in relaxation (degC) (f) -! SRXLIM : Max. absolute value of SSS difference in relaxation (psu) (f) -! APTFLX : Apply diagnosed heat flux flag (l) -! APSFLX : Apply diagnosed freshwater flux flag (l) -! DITFLX : Diagnose heat flux flag (l) -! DISFLX : Diagnose freshwater flux flag (l) -! SRXBAL : Balance the SSS relaxation (l) -! SCFILE : Name of file containing SSS climatology used for relaxation (a) -! WAVSRC : Source of wave fields. Valid source: 'none', 'param', 'extern' (a) -! SMTFRC : Smooth CESM forcing (l) -! SPRFAC : Send precipitation/runoff factor to CESM coupler (l) -! ATM_PATH : Path to forcing fields in case of EXPCNF 'ben02clim' or -! 'ben02syn' (a) -! ITEST : Global i-index of point diagnostics (i) -! JTEST : Global j-index of point diagnostics (i) -! CNSVDI : Conservation diagnostics flag (l) -! CSDIAG : Checksum diagnostics flag (l) -! RSTFRQ : Restart frequency in days (30=1month,365=1year) (i) -! RSTFMT : Format of restart file (valid arguments are 0 for classic, -! 1 for 64-bit offset and 2 for netcdf4/hdf5 format) (i) -! RSTCMP : Compression flag for restart file (i) -! IOTYPE : 0 = netcdf, 1 = pnetcdf &LIMITS NDAY1 = $NDAY1 NDAY2 = $NDAY2 @@ -1135,55 +1060,6 @@ endif cat >>! $RUNDIR/ocn_in$inststr << EOF -! NAMELIST FOR DIFFUSION PARAMETERS -! -! CONTENTS: -! -! EITMTH : Eddy-induced transport parameterization method. Valid -! methods: 'intdif', 'gm' (a) -! EDRITP : Type of Richardson number used in eddy diffusivity -! computation. Valid types: 'shear', 'large scale' (a) -! EDWMTH : Method to estimate eddy diffusivity weight as a function of -! the ration of Rossby radius of deformation to the -! horizontal grid spacing. Valid methods: 'smooth', 'step' (a) -! MLRTTP : Type of mixed layer restratification time scale. Valid -! types: 'variable', 'constant', 'limited' (a) -! EDDF2D : If true, eddy diffusivity has a 2d structure (l) -! EDSPRS : Apply eddy mixing suppression away from steering level (l) -! EGC : Parameter c in Eden and Greatbatch (2008) parameterization (f) -! EGGAM : Parameter gamma in E. & G. (2008) param. (f) -! EGLSMN : Minimum eddy length scale in E. & G. (2008) param. (cm) (f) -! EGMNDF : Minimum diffusivity in E. & G. (2008) param. (cm**2/s) (f) -! EGMXDF : Maximum diffusivity in E. & G. (2008) param. (cm**2/s) (f) -! EGIDFQ : Factor relating the isopycnal diffusivity to the layer -! interface diffusivity in the Eden and Greatbatch (2008) -! parameterization. egidfq=difint/difiso () (f) -! TBFILE : Name of file containing topographic beta parameter (a) -! RHISCF : Linear scaling parameter for topographic rhines scale () (f) -! EDANIS : If true, apply anisotropy correction to eddy diffusivity (l) -! REDI3D : If true, then isopycnal/neutral diffusion will have 3D -! structure based in the 3D structure of anisotropy (l) -! RHSCTP : If true, use the minimum of planetary and topographic beta -! to define the Rhines scale (l) -! RI0 : Critical gradient richardson number for shear driven -! vertical mixing () (f) -! BDMTYP : Type of background diapycnal mixing. If bdmtyp=1 the -! background diffusivity is a constant divided by the -! Brunt-Vaisala frequency, if bdmtyp=2 the background -! diffusivity is constant () (i) -! BDMC1 : Background diapycnal diffusivity times buoyancy frequency -! frequency (cm**2/s**2) (f) -! BDMC2 : Background diapycnal diffusivity (cm**2/s) (f) -! BDMLDP : Make the background mixing latitude dependent according to -! Gregg et al. (2003) (l) -! TKEPF : Fraction of surface TKE that penetrates beneath mixed layer -! () (f) -! SMOBLD : If true, apply lateral smoothing of CVMix estimated -! boundary layer depth (l) -! LNGMTP : Type of CVMix Langmuir turbulence parameterization. Valid -! types: 'none', 'vr12-ma', 'lf17' -! LTEDTP : Type of lateral tracer eddy diffusion: Valid methods: -! 'layer', 'neutral'. &DIFFUSION EITMTH = $EITMTH EDRITP = $EDRITP @@ -1216,17 +1092,6 @@ EOF if ($?CWMTAG) then cat >>! $RUNDIR/ocn_in$inststr << EOF -! NAMELIST FOR CHANNEL WIDTH MODIFICATIONS -! -! CONTENTS: -! -! CWMTAG : Array of geographical names of channels to be modified (a) -! CWMEDG : Array of C grid cell edges to be modified. Valid options: -! 'u' or 'v' (a) -! 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) -! &CWMOD CWMTAG = $CWMTAG CWMEDG = $CWMEDG @@ -1239,20 +1104,6 @@ endif cat >>! $RUNDIR/ocn_in$inststr << EOF -! NAMELIST FOR MERIDIONAL OVERTURNING AND FLUX DIAGNOSTICS -! -! CONTENTS: -! -! MER_ORFILE : Name of file containing ocean region specification (a) -! MER_MIFILE : Name of file containing zonal section specification for -! meridional transport computation (a) -! MER_REGNAM : Array of region names for meridional overturning and flux -! diagnostics (a) -! MER_REGFLG : Array of mask flags in ocean regions file to be included -! 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) -! &MERDIA MER_ORFILE = $MER_ORFILE MER_MIFILE = $MER_MIFILE @@ -1265,192 +1116,10 @@ cat >>! $RUNDIR/ocn_in$inststr << EOF MER_MAXLAT = 90., 90., 90., 90. / -! NAMELIST FOR SECTION TRANSPORT DIAGNOSTICS -! -! CONTENTS: -! -! SEC_SIFILE : Name of file containing section specification for section -! transport computation (a) -! &SECDIA SEC_SIFILE = $SEC_SIFILE / -! IO-NAMELIST FOR DIAGNOSTIC OUTPUT -! -! Description: -! BLOM supports multiple output groups for its diagnostic output. -! Each output group is represented by one column in the namlist and may -! have its own output format, averaging period, and file frequency. -! The maximum number of output groups is currently limited to 10 but -! can be changed easily in mod_dia.F. -! -! The output precision can be choosen on a per-variable basis. -! -! Multiple time-slices can be written to the same output file -! provided that no variable is written in packed data format -! (i.e. as int2 with scale factor and offset). -! -! Compression of the output (i.e. storage of only wet points) -! and the file format can be choosen on a per-file basis. -! -! All time periods are specified in number of days for positive -! integer values and fraction of day for negative integer values. -! The length of the actual calendar month is used if 30 is written. -! The length of the actual calendar year is used if 365 is written. -! A variable is not written when 0 is specified. -! -! Namelist acronyms: -! GLB_ - global parameters i.e. valid for entire output group -! H2D_ - 2d fields with the horizontal dimensions -! LYR_ - 3d fields with sigma layers as vertical coordinate -! LVL_ - 3d fields with levitus leves as vertical coordinate -! 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) -! NCFORMAT - netcdf format (valid arguments are 0 for classic, -! 1 for 64-bit offset and 2 for netcdf4/hdf5 format) -! -! Arguments for diagnostic variables: -! 0 - variable is not written -! 2 - variable is written as int2 with scale factor and offset -! 4 - variable is written as real4 -! 8 - variable is written as real8 -! -! Output variables: -! ABSWND - absolute wind speed [m s-1] -! ALB - surface albedo [] -! BTMSTR - Barotropic mass streamfunction [kg s-1] -! BRNFLX - brine flux [kg m-2 s-1] -! BRNPD - brine plume depth [m] -! DFL - non-solar heat flux derivative [W m-2 K-1] -! EVA - evaporation [kg m-2 s-1] -! FICE - ice concentration [%] -! FMLTFZ - fresh water flux due to melting/freezing [kg m-2 s-1] -! HICE - ice thickness [m] -! HMLTFZ - heat flux due to melting/freezing [W m-2] -! HSNW - snow depth [m] -! IAGE - ice age [d] -! IDKEDT - mixed layer inertial kinetic energy tendency [kg s-3] -! LAMULT - Langmuir enhancement factor [] -! LASL - Surface layer averaged Langmuir number [] -! LIP - liquid precipitation [kg m-2 s-1] -! MAXMLD - maximum mixed layer depth [m] -! MLD - mixed layer depth [m] -! MLTS - mixed layer thickness using "sigma-t" criterion [m] -! MLTSMN - minimum mixed layer thickness using "sigma-t" criterion [m] -! MLTSMX - maximum mixed layer thickness using "sigma-t" criterion [m] -! MLTSSQ - mixed layer thickness squared using "sigma-t" criterion [m2] -! MTKEUS - mixed layer TKE tendency related to friction velocity [kg s-3] -! MTKENI - mixed layer TKE tendency related to near inertial mot. [kg s-3] -! MTKEBF - mixed layer TKE tendency related to buoyancy forcing [kg s-3] -! MTKERS - mixed layer TKE tendency related to eddy restrat. [kg s-3] -! MTKEPE - mixed layer TKE tendency related to pot. energy change [kg s-3] -! MTKEKE - mixed layer TKE tendency related to kin. energy change [kg s-3] -! MTY - wind stress y-component [N m-2] -! NSF - non-solar heat flux [W m-2] -! PBOT - bottom pressure [Pa] -! PSRF - surface pressure [Pa] -! RFIFLX - frozen runoff [kg m-2 s-1] -! RNFFLX - liquid runoff [kg m-2 s-1] -! SALFLX - salt flux received by ocean [kg m-2 s-1] -! SALRLX - restoring salt flux received by ocean [kg m-2 s-1] -! SBOT - bottom salinity [g kg-1] -! SEALV - sea level [m] -! SLVSQ - sea level squared [m2] -! SFL - salt flux [kg m-2 s-1] -! SOP - solid precipitation [kg m-2 s-1] -! SIGMX - mixed layer density [kg m-3] -! SSS - ocean surface salinity [g kg-1] -! SSSSQ - ocean surface salinity squared [g2 kg-2] -! SST - ocean surface temperature [degC] -! SSTSQ - ocean surface temperature squared [degC2] -! SURFLX - heat flux received by ocean [W m-2] -! SURRLX - restoring heat flux received by ocean [W m-2] -! SWA - short-wave heat flux [W m-2] -! T20D - 20C isoterm depth [m] -! TAUX - momentum flux received by ocean x-component [N m-2] -! TAUY - momentum flux received by ocean y-component [N m-2] -! TBOT - bottom temperature [degC] -! TICE - ice temperature [degC] -! TSRF - surface temperature [degC] -! UB - barotropic velocity x-component [m s-1] -! UICE - ice velocity x-component [m s-1] -! USTAR - friction velocity [m s-1] -! USTAR3 - friction velocity cubed [m3 s-3] -! USTOKES - surface Stokes drift x-componen [m s-1] -! VB - barotropic velocity y-component [m s-1] -! VICE - ice velocity y-component [m s-1] -! VSTOKES - surface Stokes drift y-componen [m s-1] -! ZTX - wind stress x-component [N m-2] -! BFSQ - buoyancy frequency squared [s-1] -! DIFDIA - vertical diffusivity [log10(m2 s-1)|m2 s-1] -! DIFVMO - vertical momentum diffusivity [log10(m2 s-1)|m2 s-1] -! DIFVHO - vertical heat diffusivity [log10(m2 s-1)|m2 s-1] -! DIFVSO - vertical salt diffusivity [log10(m2 s-1)|m2 s-1] -! DIFINT - layer interface diffusivity [log10(m2 s-1)] -! DIFISO - isopycnal diffusivity [log10(m2 s-1)] -! DP - layer pressure thickness [Pa] -! DZ - layer thickness [m] -! SALN - salinity [g kg-1] -! TEMP - temperature [degC] -! TRC - tracer [] -! UFLX - mass flux in x-direction [kg s-1] -! UTFLX - heat flux in x-direction [W] -! USFLX - salt flux in x-direction [kg s-1] -! UMFLTD - mass flux due to thickness diffusion in x-direction [kg s-1] -! UMFLSM - mass flux due to submesoscale transport in x-direction [kg s-1] -! UTFLTD - heat flux due to thickness diffusion in x-direction [W] -! UTFLSM - heat flux due to submesoscale transport in x-direction [W] -! UTFLLD - heat flux due to lateral diffusion in x-direction [W] -! USFLTD - salt flux due to thickness diffusion in x-direction [kg s-1] -! USFLSM - salt flux due to submesoscale transport in x-direction [kg s-1] -! USFLLD - salt flux due to lateral diffusion in x-direction [kg s-1] -! UVEL - velocity x-component [m s-1] -! VFLX - mass flux in y-direction [kg s-1] -! VTFLX - heat flux in y-direction [W] -! VSFLX - salt flux in y-direction [kg s-1] -! VMFLTD - mass flux due to thickness diffusion in y-direction [kg s-1] -! VMFLSM - mass flux due to submesoscale transport in y-direction [kg s-1] -! VTFLTD - heat flux due to thickness diffusion in y-direction [W] -! VTFLSM - heat flux due to submesoscale transport in y-direction [W] -! VTFLLD - heat flux due to lateral diffusion in y-direction [W] -! VSFLTD - salt flux due to thickness diffusion in y-direction [kg s-1] -! VSFLSM - salt flux due to submesoscale transport in y-direction [kg s-1] -! VSFLLD - salt flux due to lateral diffusion in y-direction [kg s-1] -! VVEL - velocity x-component [m s-1] -! WFLX - vertical mass flux [kg s-1] -! WFLX2 - vertical mass flux squared [kg2 s-2] -! PV - potential vorticity [m-1 s-1] -! TKE - turbulent kinetic energy [m2 s-2] -! GLS_PSI - generic length scale [m2 s-3] -! IDLAGE - ideal age [year] -! MMFLXL - meridional overturning circ. (MOC) on isopycnic layers [kg s-1] -! MMFLXD - MOC on z-levels [kg s-1] -! MMFTDL - MOC due to thickness diffusion on isopycnic layers [kg s-1] -! MMFSML - MOC due to submesoscale transport on isopycnic layers [kg s-1] -! MMFTDD - MOC due to thickness diffusion on z-levels [kg s-1] -! MMFSMD - MOC due to submesoscale transport on z-levels [kg s-1] -! MHFLX - meridional heat flux [W] -! MHFTD - meridional heat flux due to thickness diffusion [W] -! MHFSM - meridional heat flux due to submesoscale transport [W] -! MHFLD - meridional heat flux due to lateral diffusion [W] -! MSFLX - meridional salt flux [kg s-1] -! MSFTD - meridional salt flux due to thickness diffusion [kg s-1] -! MSFSM - meridional salt flux due to submesoscale transport [kg s-1] -! MSFLD - meridional salt flux due to lateral diffusion [kg s-1] -! VOLTR - section transports [kg s-1] -! MASSGS - global sum of mass [kg] -! VOLGS - global sum of volume [m3] -! SALNGA - global average temperature [degC] -! TEMPGA - global average temperature [degC] -! SSSGA - global average sea surface salinity [g kg-1] -! SSTGA - global average sea surface temperature [degC] -! &DIAPHY GLB_FNAMETAG = $GLB_FNAMETAG GLB_AVEPERIO = $GLB_AVEPERIO @@ -1632,28 +1301,6 @@ EOF if ("$ecosys" == TRUE) then cat >>! $RUNDIR/ocn_in$inststr << EOF -! NAMELIST FOR iHAMOCC OPTIONS -! -! CONTENTS: -! -! 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 -! 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 -! NDEPFILE : File name (incl. full path) for atmopheric N-deposition data -! DO_SEDSPINUP: Logical switch to activate sediment spin-up -! SEDSPIN_YR_S: Start year for sediment spinup -! SEDSPIN_YR_E: End year for sediment spinup -! SEDSPIN_NCYC: Number of subcyles per time-step for sediment spinup -! INIXXX : Initial condition file for iHAMOCC, where XXX=DIC, ALK, PO4, -! OXY, NO3, SIL, D13C, and D14C -! WITH_DMSPH : Logical switch to activate DMS calculation as function of pH -! PI_PH_FILE : File name (incl. full path) for surface PI pH input data. -! 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 &BGCNML ATM_CO2 = $CCSM_CO2_PPMV FEDEPFILE = $FEDEPFILE @@ -1681,17 +1328,6 @@ cat >>! $RUNDIR/ocn_in$inststr << EOF SEDPORFILE = $SEDPORFILE / -! NAMELIST FOR ALKALINIZATION SCENARIO -! -! CONTENTS: -! -! 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 -! CDRMIP_LATMIN : Min latitude where alkalinity is added in 'const' or 'ramp' scenarios -! RAMP_START : Start year for ramp up in 'ramp' scenario -! RAMP_END : End year for ramp up in 'ramp' scenario &BGCOAFX OALKSCEN = $BGCOAFX_OALKSCEN OALKFILE = $BGCOAFX_OALKFILE @@ -1702,168 +1338,6 @@ cat >>! $RUNDIR/ocn_in$inststr << EOF RAMP_END = $BGCOAFX_RAMP_END / -! IO-NAMELIST FOR DIAGNOSTIC iHAMOCC OUTPUT -! -! Namelist acronyms: -! GLB_ - global parameters i.e. valid for entire output group -! SRF_ - surface variables (includes some non-surface 2d fields) -! FLX_ - interior ocean particle fuxes at different depth (2d) -! INT_ - vertically integrated fields (2d) -! LYR_ - 3d fields with sigma layers as vertical coordinate -! LVL_ - 3d fields with levitus levels as vertical coordinate -! SDM_ - 3d sediment fields -! 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) -! 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 -! output file: -! 0 : no output -! 1 : write inventory to standard output (log file) -! 2 : write output to inventory netCDF file -! -! Arguments for diagnostic variables: -! 0 - variable is not written -! 2 - variable is written as int2 with scale factor and offset -! 4 - variable is written as real4 -! 8 - variable is written as real8 -! -! Output variables: -! -! Main BGC tracer fields (SFR, LYR or LVL) -! DIC - Dissolved carbon (dissic) [mol C m-3] -! ALKALI - Alkalinity (talk) [eq m-3] -! OXYGEN - Oxygen (o2) [mol O2 m-3] -! ANO3 - Nitrate (no3) [mol N m-3] -! PHOSPH - Phosphorus (po4) [mol P m-3] -! IRON - Dissolved iron (dfe) [mol Fe m-3] -! SILICA - Silicate (si) [mol Si m-3] -! PHYTO - Phytoplankton (phyc) [mol C m-3] -! PH - pH (ph) [-log10([h+])] -! NATDIC - Natural dissolved carbon (natdissic) [mol C m-3] -! NATALKALI - Natural alkalinity (nattalk) [eq m-3] -! NATPH - Natural pH (natph) [-log10([h+])] -! -! Other 3d tracer or diagnostic variables (LYR or LVL) -! DP - Layer thickness (pddpo) [m] -! PREFO2 - preformed oxygen (p_o2) [mol O2 m-3] -! O2SAT - Saturated oxygen (satoxy) [mol O2 m-3] -! PREFPO4 - preformed phosphate (p_po4) [mol PO4 m-3] -! PREFALK - preformed alkalinity (p_talk) [eq m-3] -! PREFDIC - preformed DIC (p_dic) [mol C m-3] -! DICSAT - saturated DIC (dic_sat) [mol C m-3] -! POC - Detrius (detoc) [mol C m-3] -! CALC - CaCO3 shells (calc) [mol C m-3] -! OPAL - Opal shells (opal) [mol Si m-3] -! DOC - Dissolved organic carbon (dissoc) [mol C m-3] -! GRAZER - Zooplankton (zooc) [mol C m-3] -! 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] -! OMEGAA - Aragonite saturation state (omegaa) [1] -! OMEGAC - Calcite saturation state (omegac) [1] -! NATDIC - Natural dissolved carbon (natdissic) [mol C m-3] -! NATALKALI - Natural alkalinity (nattalk) [eq m-3] -! NATCO3 - Natural carbonate ion concentration (natco3) [mol C m-3] -! NATCALC - Natural CaCO3 shells (natcalc) [mol C m-3] -! NATOMEGAA - Natural aragonite saturation state (natomegaa) [1] -! NATOMEGAC - Natural calcite saturation state (natomegac) [1] -! DIC13 - Dissolved C13 (dissic13) [mol C m-3] -! DIC14 - Dissolved C14 (dissic14) [mol C m-3] -! D13C - delta 13C of DIC [1] -! D14C - delta 14C of DIC [1] -! BIGD14C - Delta 14C of DIC [1] -! POC13 - Particulate organic carbon 13 (detoc13) [mol C m-3] -! DOC13 - Dissolved organic carbon 13 (dissoc13) [mol C m-3] -! CALC13 - Particulate inorganic carbon 13 (calc13) [mol C m-3] -! PHYTO13 - 13C of phytoplankton biomass (phyc13) [mol C m-3] -! GRAZER13 - 13C of zootoplankton biomass (zooc13) [mol C m-3] -! CFC11 - CFC11 concentration [mol CFC11 m-3] -! CFC12 - CFC12 concentration [mol CFC12 m-3] -! SF6 - SF6 concentration [mol SF6 m-3] -! NOS - Number of sinking particles (aggregate scheme, nos) [cm-3] -! WPHY - Mass sinking velocity (aggregate scheme) [m d-1] -! WNOS - Number sinking velocity (aggregate scheme) [m d-1] -! EPS - Epsilon exponent (aggregate scheme) [1] -! ASIZE - Average particle size (aggregate scheme) -! -! 2d-fields (SFR) -! EXPORT - Export production (epc100) [mol C m-2 s-1] -! 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] -! 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] -! OXFLUX - Oxygen flux (fgo2) [mol O2 m-2 s-1] -! N2OFX - Nitrous oxide flux [mol N2O m-2 s-1] -! DMSFLUX - DMS flux (dmsflux) [mol DMS m-2 s-1] -! DMS - surface DMS concentration (dms) [mol DMS m-3] -! DMSPROD - DMS production (dmsprod) [mol DMS m-2 s-1] -! DMS_BAC - DMS bacterial consuption (dms_bac) [mol DMS m-2 s-1] -! DMS_UV - DMS decomposition by UV (dms_uv) [mol DMS m-2 s-1] -! ATMCO2 - Atmospheric CO2 (atmco2) [ppm] -! ATMO2 - Atmospheric O2 (atmo2) [ppm] -! ATMN2 - Atmospheric N2 (atmn2) [ppm] -! NATPCO2 - Natural surface PCO2 (spco2) [uatm] -! NATCO2FX - Natural net CO2 flux (natco2fx) [kg C m-2 s-1] -! CO213FXD - Downward 13CO2 flux (co213fxd) [kg C m-2 s-1] -! CO213FXU - Upward 13CO2 flux (co213fxu) [kg C m-2 s-1] -! CO214FXD - Downward 14CO2 flux (co214fxd) [kg C m-2 s-1] -! CO214FXU - Upward 14CO2 flux (co214fxu) [kg C m-2 s-1] -! CFC11 - CFC11 flux [mol CFC11 m-2 s-1] -! CFC12 - CFC12 flux [mol CFC12 m-2 s-1] -! SF6 - SF6 flux [mol SF6 m-2 s-1] -! -! Vertically integrated fields (INT) -! PHOSY - Vertically integrated primary production [mol C m-3 s-1] -! NFIX - Vertically integrated nitrogen fixation -! DNIT - Vertically integrated denitrification -! -! Particle fluxes (FLX, e.g CARFLX****, where ****=0100,0500,1000,2000,4000, or _BOT), -! diffusive fluxes at the sediment - water-column interface (SEDIFF*), and other fluxes -! NDEP - Nitrogen deposition flux [mol N m-2 s-1] -! OALK - Flux of alkalinity due to ocean alkalinization [mol N m-2 s-1] -! CARFLX**** - POC flux at **** metres depth [mol C m-2 s-1] -! BSIFLX**** - Biogenic silica flux at **** metres depth [mol Si m-2 s-1] -! CALFLX**** - Calcium carbonate flux at **** metres depth [mol C m-2 s-1] -! SEDIFFIC - sediment - water-column diffusive flux of DIC [mol C m-2 s-1] -! SEDIFFAL - sediment - water-column diffusive flux of alkalinity [mol m-2 s-1] -! SEDIFFPH - sediment - water-column diffusive flux of phosphate [mol PO3 m-2 s-1] -! SEDIFFOX - sediment - water-column diffusive flux of oxygen [mol O2 m-2 s-1] -! SEDIFFN2 - sediment - water-column diffusive flux of N2 [mol N2 m-2 s-1] -! SEDIFFNO3 - sediment - water-column diffusive flux of nitrate [mol NO3 m-2 s-1] -! SEDIFFSI - sediment - water-column diffusive flux of silica [mol Si m-2 s-1] -! -! Sediment fields (SDM) -! POWAIC - (powdic) [mol C m-3] -! POWAAL - (powalk) [eq m-3] -! POWAPH - (powpho) [eq m-3] -! POWAOX - (powox) [mol O2 m-3] -! POWN2 - (pown2) [mol N2 m-3] -! POWNO3 - (powno3)[mol N m-3] -! POWASI - (powsi) [mol Si m-3] -! SSSO12 - (ssso12) [mol m-3] -! SSSSIL - (ssssil) [mol Si m-3] -! SSSC12 - (sssc12) [mol C m-3] -! SSSTER - (ssster) [mol m-3] -! -! Burial fields (BUR) -! SSSO12 - Solid sediment organic carbon [mol P m-2] -! SSSSIL - Solid sediment silica [mol Si m-2] -! SSSC12 - Solid sediment inorganic carbon [mol C m-2] -! SSSTER - -! &DIABGC GLB_FNAMETAG = $BGC_FNAMETAG GLB_AVEPERIO = $BGC_AVEPERIO diff --git a/cime_config/buildnml.py b/cime_config/buildnml.py new file mode 100644 index 00000000..27924f2e --- /dev/null +++ b/cime_config/buildnml.py @@ -0,0 +1,182 @@ +#!/usr/bin/env python3 + +"""BLOM namelist creator +""" + +# Typically ignore this. +# pylint: disable=invalid-name + +# Disable these because this is our standard setup +# pylint: disable=wildcard-import,unused-wildcard-import,wrong-import-position + +import os, shutil, sys, glob, filecmp, imp, re + +CIMEROOT = os.environ.get("CIMEROOT") +if CIMEROOT is None: + raise SystemExit("ERROR: must set CIMEROOT environment variable") +sys.path.append(os.path.join(CIMEROOT, "CIME", "Tools")) + +from standard_script_setup import * +from CIME.case import Case +from CIME.nmlgen import NamelistGenerator +from CIME.utils import expect +from CIME.utils import run_cmd_no_fail, expect +from CIME.utils import run_cmd +from CIME.buildnml import create_namelist_infile, parse_input + +import glob, shutil +logger = logging.getLogger(__name__) + +# pylint: disable=too-many-arguments,too-many-locals,too-many-branches,too-many-statements +#################################################################################### +def _create_namelists(case, confdir, infile, nmlgen): +#################################################################################### + + """Write out the namelist for this component. + + Most arguments are the same as those for `NamelistGenerator`. + The `confdir` argument is used to specify the directory in which output files will be placed. + """ + + CASEROOT = case.get_value("CASEROOT") + OCN_GRID = case.get_value("OCN_GRID") + BLOM_VCOORD = case.get_value("BLOM_VCOORD") + BLOM_UNIT = case.get_value("BLOM_UNIT") + DIN_LOC_ROOT = case.get_value("DIN_LOC_ROOT") + RUN_TYPE = case.get_value("RUN_TYPE") + CONTINUE_RUN = case.get_value("CONTINUE_RUN") + CASEBUILD = case.get_value("CASEBUILD") + CCSM_CO2_PPMV = case.get_value("CCSM_CO2_PPMV") + OCN_NCPL = case.get_value("OCN_NCPL") + BLOM_COUPLING = case.get_value("BLOM_COUPLING") + RUNDIR = case.get_value("RUNDIR") + BLOM_TRACER_MODULES = case.get_value("BLOM_TRACER_MODULES") + BLOM_RIVER_NUTRIENTS = case.get_value("BLOM_RIVER_NUTRIENTS") + BLOM_N_DEPOSITION = case.get_value("BLOM_N_DEPOSITION") + BLOM_NDEP_SCENARIO = case.get_value("BLOM_NDEP_SCENARIO") + HAMOCC_VSLS = case.get_value("HAMOCC_VSLS") + HAMOCC_CISO = case.get_value("HAMOCC_CISO") + HAMOCC_SEDSPINUP = case.get_value("HAMOCC_SEDSPINUP") + HAMOCC_SEDSPINUP_YR_START = case.get_value("HAMOCC_SEDSPINUP_YR_START") + HAMOCC_SEDSPINUP_YR_END = case.get_value("HAMOCC_SEDSPINUP_YR_END") + HAMOCC_SEDSPINUP_NCYCLE = case.get_value("HAMOCC_SEDSPINUP_NCYCLE") + RUN_STARTDATE = case.get_value("RUN_STARTDATE") + PIO_TYPENAME_OCN = case.get_value("PIO_TYPENAME_OCN") + PIO_NETCDF_FORMAT_OCN = case.get_value("PIO_NETCDF_FORMAT_OCN") + NINST_OCN = case.get_value("NINST_OCN") + TEST = case.get_value("TEST") + + config['ocn_comp'] = case.get_value("COMP_OCN") + + YEAR0 = `echo $RUN_STARTDATE | cut -c1-4 ` + MONTH0 = `echo $RUN_STARTDATE | cut -c6-7 ` + DAY0 = `echo $RUN_STARTDATE | cut -c9-10` + + #---------------------------------------------------- + # Initialize namelist defaults + #---------------------------------------------------- + nmlgen.init_defaults(infile, config) + + #---------------------------------------------------- + # Write out namelist groups + #---------------------------------------------------- + groups=['limit'] + + namelist_file = os.path.join(confdir, "ocn_in") + nmlgen.write_output_file(namelist_file, data_list_path, groups=groups, sorted_groups=False) + + #logger.debug("blom: grid is %s" %(hgrid)) + #logger.debug("blom: physics is %s "%phys) + +############################################################################### +def buildnml(case, caseroot, compname): +############################################################################### + """Build the blom namelist """ + + # Build the component namelist + if compname != "blom": + raise AttributeError + comp_root_dir_ocn = case.get_value("COMP_ROOT_DIR_OCN") + srcroot = case.get_value("SRCROOT") + rundir = case.get_value("RUNDIR") + ninst = case.get_value("NINST_OCN") + + #---------------------------------------------------- + # Construct the namelist generator + #---------------------------------------------------- + # determine directory for user modified namelist_definitions.xml and namelist_defaults.xml + user_xml_dir = os.path.join(caseroot, "SourceMods", "src.blom") + expect (os.path.isdir(user_xml_dir), + "user_xml_dir %s does not exist " %user_xml_dir) + + # user definition *replaces* existing definition. + namelist_xml_dir = os.path.join(comp_root_dir_ocn, "cime_config") + definition_file = [os.path.join(namelist_xml_dir, "namelist_definition_blom.xml")] + user_definition = os.path.join(user_xml_dir, "namelist_definition_blom.xml") + if os.path.isfile(user_definition): + definition_file = [user_definition] + for file_ in definition_file: + expect(os.path.isfile(file_), "Namelist XML file %s not found!" % file_) + + # Create the namelist generator object - independent of instance + nmlgen = NamelistGenerator(case, definition_file) + + #---------------------------------------------------- + # Loop over instances + #---------------------------------------------------- + for inst_counter in range(1, ninst+1): + + # determine instance string + inst_string = "" + if ninst > 1: + inst_string = '_' + '%04d' % inst_counter + + # If multi-instance case does not have restart file, use + # single-case restart for each instance + rpointer = "rpointer.ice" + if (os.path.isfile(os.path.join(rundir,rpointer)) and + (not os.path.isfile(os.path.join(rundir,rpointer + inst_string)))): + shutil.copy(os.path.join(rundir, rpointer), + os.path.join(rundir, rpointer + inst_string)) + + inst_string_label = inst_string + if not inst_string_label: + inst_string_label = "\"\"" + + # create namelist_infile using user_nl_file as input + user_nl_file = os.path.join(caseroot, "user_nl_blom" + inst_string) + expect(os.path.isfile(user_nl_file), + "Missing required user_nl_file %s " %(user_nl_file)) + infile = os.path.join(confdir, "namelist_infile") + create_namelist_infile(case, user_nl_file, infile) + namelist_infile = [infile] + + # create namelist + _create_namelists(case, confdir, namelist_infile, nmlgen) + + # copy namelist files to rundir + if os.path.isdir(rundir): + file1 = os.path.join(confdir, "ice_in") + file2 = os.path.join(rundir, "ice_in") + if inst_string: + file2 += inst_string + logger.debug("BLOM namelist copy: file1 %s file2 %s " %(file1, file2)) + shutil.copy2(file1, file2) + +def _strip_comments(fh, token="!"): + ''' strip anything after token in each line of fh ''' + for line in fh: + s = line.split(token, 1)[0].strip() + if s: + yield s + + +############################################################################### +def _main_func(): + + caseroot = parse_input(sys.argv) + with Case(caseroot, read_only=False) as case: + buildnml(case, caseroot, "blom") + +if __name__ == "__main__": + _main_func() diff --git a/cime_config/namelist_definition_blom.xml b/cime_config/namelist_definition_blom.xml new file mode 100644 index 00000000..e237bb9d --- /dev/null +++ b/cime_config/namelist_definition_blom.xml @@ -0,0 +1,691 @@ + + + + + + + + + + integer + limits + limits + + 0 + + + + + + integer + limits + limits + + 0 + + + + + + integer + limits + limits + + 9999999 + + + + + + integer + limits + limits + + 9999999 + + + + + + limits + limits + + unset + + + char + + + + char + limits + limits + + cesm + + + + + + char + limits + limits + + initial + + + + + + char + limits + limits + + unset + + + + + + char + limits + limits + + unset + + + + + + real + limits + limits + + 2000.e4 + 2000.e5 + + + + + + real + limits + limits + + 1800. + + + + + + real + limits + limits + + 36. + + + + + + real + limits + limits + + .02 + 2. + + + + + + real + limits + limits + + .004 + .4 + + + + + + real + limits + limits + + 0. + 0. + + + + + + real + limits + limits + + 0. + 0. + + + + + + real + limits + limits + + 5000. + 5000.e4 + + + + + + real + limits + limits + + 300. + 300.e4 + + + + + + real + limits + limits + + .5 + + + + + + real + limits + limits + + .5 + + + + + + real + limits + limits + + 0. + + + + + + real + limits + limits + + 0. + + + + + + real + limits + limits + + .05 + 5. + + + + + + real + limits + limits + + .002 + + + + + + real + limits + limits + + 5.e-5 + + + + + + real + limits + limits + + 25. + + + + + + char + limits + limits + + enscon + + + + + + char + limits + limits + + uc + + + + + + char + limits + limits + + eitvel + + + + + + char + limits + limits + + constant + + + + + + real + limits + limits + + 1.2 + + + + + + real + limits + limits + + 0. + + + + + + real + limits + limits + + .06 + + + + + + char + limits + limits + + unset + + + + + + real + limits + limits + + 0. + + + + + + real + limits + limits + + .35 + + + + + + real + limits + limits + + .5 + + + + + + char + limits + limits + + jerlov + + + + + + integer + limits + limits + + 3 + + + + + + char + limits + limits + + climatology + + + + + + char + limits + limits + + unset + + + + + + real + limits + limits + + 0. + + + + + + real + limits + limits + + 0. + + + + + + real + limits + limits + + 1. + + + + + + real + limits + limits + + 1. + + + + + + real + limits + limits + + 1.5 + + + + + + real + limits + limits + + .5 + + + + + + logical + limits + limits + + .false. + + + + + + logical + limits + limits + + .false. + + + + + + logical + limits + limits + + .false. + + + + + + logical + limits + limits + + .false. + + + + + + logical + limits + limits + + .false. + + + + + + char + limits + limits + + unset + + + + + + char + limits + limits + + none + + + + + + logical + limits + limits + + .true. + + + + + + logical + limits + limits + + .false. + + + + + + char + limits + limits + + unset + + + + + + integer + limits + limits + + 60 + + + + + + integer + limits + limits + + 60 + + + + + + logical + limits + limits + + .false. + + + + + + logical + limits + limits + + .false. + + + + + + integer + limits + limits + + 1 + + + + + + integer + limits + limits + + 0 + 1 + + + + + + integer + limits + limits + + 0 + + + + + + integer + limits + limits + + 0 + 1 + + + + + diff --git a/cime_config/ocn_in.readme b/cime_config/ocn_in.readme new file mode 100644 index 00000000..8750f450 --- /dev/null +++ b/cime_config/ocn_in.readme @@ -0,0 +1,554 @@ +!=========================================================================== +! LIMITS NAMELIST +! +! CONTENTS: +! +! NDAY1 : First day of integration (i) +! NDAY2 : Last day of integration (i) +! IDATE : Model date in YYYYMMDD (i) +! IDATE0 : Initial experiment date in YYYYMMDD (i) +! RUNID : Experiment name (a) +! EXPCNF : Experiment configuration (a) +! RUNTYP : CESM run type (a) +! GRFILE : Name of file containing grid specification (a) +! ICFILE : Name of file containing initial conditions, that is either +! a valid restart file or 'inicon.nc' if climatological based +! initial conditions are desired (a) +! PREF : Reference pressure for potential density (g/cm/s2) (f) +! BACLIN : Baroclinic time step (sec) (f) +! BATROP : Barotropic time step (sec) (f) +! MDV2HI : Laplacian diffusion velocity for momentum dissipation (cm/s) (f) +! MDV2LO : Laplacian diffusion velocity for momentum dissipation (cm/s) (f) +! MDV4HI : Biharmonic diffusion velocity for momentum dissipation (cm/s) (f) +! MDV4LO : Biharmonic diffusion velocity for momentum dissipation (cm/s) (f) +! MDC2HI : Laplacian diffusivity for momentum dissipation (cm**2/s) (f) +! MDC2LO : Laplacian diffusivity for momentum dissipation (cm**2/s) (f) +! VSC2HI : Parameter in deformation-dependent Laplacian viscosity (f) +! VSC2LO : Parameter in deformation-dependent Laplacian viscosity (f) +! VSC4HI : Parameter in deformation-dependent Biharmonic viscosity (f) +! VSC4LO : Parameter in deformation-dependent Biharmonic viscosity (f) +! CBAR : rms flow speed for linear bottom friction law (cm/s) (f) +! CB : Nondiemnsional coefficient of quadratic bottom friction (f) +! CWBDTS : Coastal wave breaking damping resiprocal time scale (1/s) (f) +! CWBDLS : Coastal wave breaking damping length scale (m) (f) +! MOMMTH : Momentum equation discretization method. Valid methods: +! 'enscon' (Sadourny (1975) enstrophy conserving), 'enecon' +! (Sadourny (1975) energy conserving), 'enedis' (Sadourny +! (1975) energy conserving with some dissipation) (a) +! BMCMTH : Baroclinic mass flux correction method. Valid methods: +! 'uc' (upstream column), 'dluc' (depth limited upstream +! column) (a) +! RMPMTH : Method of applying eddy-induced transport in the remap +! transport algorithm. Valid methods: 'eitvel', 'eitflx' (a) +! MLRTTP : Type of mixed layer restratification time scale. Valid +! types: 'variable', 'constant', 'limited' (a) +! RM0 : Efficiency factor of wind TKE generation in the Oberhuber +! (1993) TKE closure () (f) +! RM5 : Efficiency factor of TKE generation by momentum +! entrainment in the Oberhuber (1993) TKE closure () (f) +! CE : Efficiency factor for the restratification by mixed layer +! eddies (Fox-Kemper et al., 2008) () (f) +! TDFILE : Name of file containing tidal wave energy dissipation +! divided by by bottom buoyancy frequency (a) +! NIWGF : Global factor applied to the energy input by near-intertial +! motions () (f) +! NIWBF : Fraction of near-inertial energy dissipated in the boundary +! layer () (f) +! NIWLF : Fraction of near-inertial energy dissipated locally beneath +! the boundary layer () (f) +! SWAMTH : Shortwave radiation absorption method. Valid methods: +! 'top-layer', 'jerlov', 'chlorophyll' (a) +! JWTYPE : Number indicating the Jerlov (1968) water type (i) +! CHLOPT : Chlorophyll concentration option. Valid options: +! 'climatology' (a) +! CCFILE : Name of file containing chlorophyll concentration climatology (a) +! TRXDAY : e-folding time scale (days) for SST relax., if 0 no relax. (f) +! SRXDAY : e-folding time scale (days) for SSS relax., if 0 no relax. (f) +! TRXDPT : Maximum mixed layer depth for e-folding SST relaxation (m) (f) +! SRXDPT : Maximum mixed layer depth for e-folding SSS relaxation (m) (f) +! TRXLIM : Max. absolute value of SST difference in relaxation (degC) (f) +! SRXLIM : Max. absolute value of SSS difference in relaxation (psu) (f) +! APTFLX : Apply diagnosed heat flux flag (l) +! APSFLX : Apply diagnosed freshwater flux flag (l) +! DITFLX : Diagnose heat flux flag (l) +! DISFLX : Diagnose freshwater flux flag (l) +! SRXBAL : Balance the SSS relaxation (l) +! SCFILE : Name of file containing SSS climatology used for relaxation (a) +! WAVSRC : Source of wave fields. Valid source: 'none', 'param', 'extern' (a) +! SMTFRC : Smooth CESM forcing (l) +! SPRFAC : Send precipitation/runoff factor to CESM coupler (l) +! ATM_PATH : Path to forcing fields in case of EXPCNF 'ben02clim' or +! 'ben02syn' (a) +! ITEST : Global i-index of point diagnostics (i) +! JTEST : Global j-index of point diagnostics (i) +! CNSVDI : Conservation diagnostics flag (l) +! CSDIAG : Checksum diagnostics flag (l) +! RSTFRQ : Restart frequency in days (30=1month,365=1year) (i) +! RSTFMT : Format of restart file (valid arguments are 0 for classic, +! 1 for 64-bit offset and 2 for netcdf4/hdf5 format) (i) +! RSTCMP : Compression flag for restart file (i) +! IOTYPE : 0 = netcdf, 1 = pnetcdf + +!=========================================================================== +! NAMELIST FOR DIFFUSION PARAMETERS +! +! CONTENTS: +! +! EITMTH : Eddy-induced transport parameterization method. Valid +! methods: 'intdif', 'gm' (a) +! EDRITP : Type of Richardson number used in eddy diffusivity +! computation. Valid types: 'shear', 'large scale' (a) +! EDWMTH : Method to estimate eddy diffusivity weight as a function of +! the ration of Rossby radius of deformation to the +! horizontal grid spacing. Valid methods: 'smooth', 'step' (a) +! MLRTTP : Type of mixed layer restratification time scale. Valid +! types: 'variable', 'constant', 'limited' (a) +! EDDF2D : If true, eddy diffusivity has a 2d structure (l) +! EDSPRS : Apply eddy mixing suppression away from steering level (l) +! EGC : Parameter c in Eden and Greatbatch (2008) parameterization (f) +! EGGAM : Parameter gamma in E. & G. (2008) param. (f) +! EGLSMN : Minimum eddy length scale in E. & G. (2008) param. (cm) (f) +! EGMNDF : Minimum diffusivity in E. & G. (2008) param. (cm**2/s) (f) +! EGMXDF : Maximum diffusivity in E. & G. (2008) param. (cm**2/s) (f) +! EGIDFQ : Factor relating the isopycnal diffusivity to the layer +! interface diffusivity in the Eden and Greatbatch (2008) +! parameterization. egidfq=difint/difiso () (f) +! TBFILE : Name of file containing topographic beta parameter (a) +! RHISCF : Linear scaling parameter for topographic rhines scale () (f) +! EDANIS : If true, apply anisotropy correction to eddy diffusivity (l) +! REDI3D : If true, then isopycnal/neutral diffusion will have 3D +! structure based in the 3D structure of anisotropy (l) +! RHSCTP : If true, use the minimum of planetary and topographic beta +! to define the Rhines scale (l) +! RI0 : Critical gradient richardson number for shear driven +! vertical mixing () (f) +! BDMTYP : Type of background diapycnal mixing. If bdmtyp=1 the +! background diffusivity is a constant divided by the +! Brunt-Vaisala frequency, if bdmtyp=2 the background +! diffusivity is constant () (i) +! BDMC1 : Background diapycnal diffusivity times buoyancy frequency +! frequency (cm**2/s**2) (f) +! BDMC2 : Background diapycnal diffusivity (cm**2/s) (f) +! BDMLDP : Make the background mixing latitude dependent according to +! Gregg et al. (2003) (l) +! TKEPF : Fraction of surface TKE that penetrates beneath mixed layer +! () (f) +! SMOBLD : If true, apply lateral smoothing of CVMix estimated +! boundary layer depth (l) +! LNGMTP : Type of CVMix Langmuir turbulence parameterization. Valid +! types: 'none', 'vr12-ma', 'lf17' +! LTEDTP : Type of lateral tracer eddy diffusion: Valid methods: +! 'layer', 'neutral'. + +!=========================================================================== +! NAMELIST FOR CHANNEL WIDTH MODIFICATIONS +! +! CONTENTS: +! +! CWMTAG : Array of geographical names of channels to be modified (a) +! CWMEDG : Array of C grid cell edges to be modified. Valid options: +! 'u' or 'v' (a) +! 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 +! +! CONTENTS: +! +! MER_ORFILE : Name of file containing ocean region specification (a) +! MER_MIFILE : Name of file containing zonal section specification for +! meridional transport computation (a) +! MER_REGNAM : Array of region names for meridional overturning and flux +! diagnostics (a) +! MER_REGFLG : Array of mask flags in ocean regions file to be included +! 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 +! +! CONTENTS: +! +! SEC_SIFILE : Name of file containing section specification for section +! transport computation (a) +! +!=========================================================================== +! IO-NAMELIST FOR DIAGNOSTIC OUTPUT +! +! Description: +! BLOM supports multiple output groups for its diagnostic output. +! Each output group is represented by one column in the namlist and may +! have its own output format, averaging period, and file frequency. +! The maximum number of output groups is currently limited to 10 but +! can be changed easily in mod_dia.F. +! +! The output precision can be choosen on a per-variable basis. +! +! Multiple time-slices can be written to the same output file +! provided that no variable is written in packed data format +! (i.e. as int2 with scale factor and offset). +! +! Compression of the output (i.e. storage of only wet points) +! and the file format can be choosen on a per-file basis. +! +! All time periods are specified in number of days for positive +! integer values and fraction of day for negative integer values. +! The length of the actual calendar month is used if 30 is written. +! The length of the actual calendar year is used if 365 is written. +! A variable is not written when 0 is specified. +! +! Namelist acronyms: +! GLB_ - global parameters i.e. valid for entire output group +! H2D_ - 2d fields with the horizontal dimensions +! LYR_ - 3d fields with sigma layers as vertical coordinate +! LVL_ - 3d fields with levitus leves as vertical coordinate +! 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) +! NCFORMAT - netcdf format (valid arguments are 0 for classic, +! 1 for 64-bit offset and 2 for netcdf4/hdf5 format) +! +! Arguments for diagnostic variables: +! 0 - variable is not written +! 2 - variable is written as int2 with scale factor and offset +! 4 - variable is written as real4 +! 8 - variable is written as real8 +! +! Output variables: +! ABSWND - absolute wind speed [m s-1] +! ALB - surface albedo [] +! BTMSTR - Barotropic mass streamfunction [kg s-1] +! BRNFLX - brine flux [kg m-2 s-1] +! BRNPD - brine plume depth [m] +! DFL - non-solar heat flux derivative [W m-2 K-1] +! EVA - evaporation [kg m-2 s-1] +! FICE - ice concentration [%] +! FMLTFZ - fresh water flux due to melting/freezing [kg m-2 s-1] +! HICE - ice thickness [m] +! HMLTFZ - heat flux due to melting/freezing [W m-2] +! HSNW - snow depth [m] +! IAGE - ice age [d] +! IDKEDT - mixed layer inertial kinetic energy tendency [kg s-3] +! LAMULT - Langmuir enhancement factor [] +! LASL - Surface layer averaged Langmuir number [] +! LIP - liquid precipitation [kg m-2 s-1] +! MAXMLD - maximum mixed layer depth [m] +! MLD - mixed layer depth [m] +! MLTS - mixed layer thickness using "sigma-t" criterion [m] +! MLTSMN - minimum mixed layer thickness using "sigma-t" criterion [m] +! MLTSMX - maximum mixed layer thickness using "sigma-t" criterion [m] +! MLTSSQ - mixed layer thickness squared using "sigma-t" criterion [m2] +! MTKEUS - mixed layer TKE tendency related to friction velocity [kg s-3] +! MTKENI - mixed layer TKE tendency related to near inertial mot. [kg s-3] +! MTKEBF - mixed layer TKE tendency related to buoyancy forcing [kg s-3] +! MTKERS - mixed layer TKE tendency related to eddy restrat. [kg s-3] +! MTKEPE - mixed layer TKE tendency related to pot. energy change [kg s-3] +! MTKEKE - mixed layer TKE tendency related to kin. energy change [kg s-3] +! MTY - wind stress y-component [N m-2] +! NSF - non-solar heat flux [W m-2] +! PBOT - bottom pressure [Pa] +! PSRF - surface pressure [Pa] +! RFIFLX - frozen runoff [kg m-2 s-1] +! RNFFLX - liquid runoff [kg m-2 s-1] +! SALFLX - salt flux received by ocean [kg m-2 s-1] +! SALRLX - restoring salt flux received by ocean [kg m-2 s-1] +! SBOT - bottom salinity [g kg-1] +! SEALV - sea level [m] +! SLVSQ - sea level squared [m2] +! SFL - salt flux [kg m-2 s-1] +! SOP - solid precipitation [kg m-2 s-1] +! SIGMX - mixed layer density [kg m-3] +! SSS - ocean surface salinity [g kg-1] +! SSSSQ - ocean surface salinity squared [g2 kg-2] +! SST - ocean surface temperature [degC] +! SSTSQ - ocean surface temperature squared [degC2] +! SURFLX - heat flux received by ocean [W m-2] +! SURRLX - restoring heat flux received by ocean [W m-2] +! SWA - short-wave heat flux [W m-2] +! T20D - 20C isoterm depth [m] +! TAUX - momentum flux received by ocean x-component [N m-2] +! TAUY - momentum flux received by ocean y-component [N m-2] +! TBOT - bottom temperature [degC] +! TICE - ice temperature [degC] +! TSRF - surface temperature [degC] +! UB - barotropic velocity x-component [m s-1] +! UICE - ice velocity x-component [m s-1] +! USTAR - friction velocity [m s-1] +! USTAR3 - friction velocity cubed [m3 s-3] +! USTOKES - surface Stokes drift x-componen [m s-1] +! VB - barotropic velocity y-component [m s-1] +! VICE - ice velocity y-component [m s-1] +! VSTOKES - surface Stokes drift y-componen [m s-1] +! ZTX - wind stress x-component [N m-2] +! BFSQ - buoyancy frequency squared [s-1] +! DIFDIA - vertical diffusivity [log10(m2 s-1)|m2 s-1] +! DIFVMO - vertical momentum diffusivity [log10(m2 s-1)|m2 s-1] +! DIFVHO - vertical heat diffusivity [log10(m2 s-1)|m2 s-1] +! DIFVSO - vertical salt diffusivity [log10(m2 s-1)|m2 s-1] +! DIFINT - layer interface diffusivity [log10(m2 s-1)] +! DIFISO - isopycnal diffusivity [log10(m2 s-1)] +! DP - layer pressure thickness [Pa] +! DZ - layer thickness [m] +! SALN - salinity [g kg-1] +! TEMP - temperature [degC] +! TRC - tracer [] +! UFLX - mass flux in x-direction [kg s-1] +! UTFLX - heat flux in x-direction [W] +! USFLX - salt flux in x-direction [kg s-1] +! UMFLTD - mass flux due to thickness diffusion in x-direction [kg s-1] +! UMFLSM - mass flux due to submesoscale transport in x-direction [kg s-1] +! UTFLTD - heat flux due to thickness diffusion in x-direction [W] +! UTFLSM - heat flux due to submesoscale transport in x-direction [W] +! UTFLLD - heat flux due to lateral diffusion in x-direction [W] +! USFLTD - salt flux due to thickness diffusion in x-direction [kg s-1] +! USFLSM - salt flux due to submesoscale transport in x-direction [kg s-1] +! USFLLD - salt flux due to lateral diffusion in x-direction [kg s-1] +! UVEL - velocity x-component [m s-1] +! VFLX - mass flux in y-direction [kg s-1] +! VTFLX - heat flux in y-direction [W] +! VSFLX - salt flux in y-direction [kg s-1] +! VMFLTD - mass flux due to thickness diffusion in y-direction [kg s-1] +! VMFLSM - mass flux due to submesoscale transport in y-direction [kg s-1] +! VTFLTD - heat flux due to thickness diffusion in y-direction [W] +! VTFLSM - heat flux due to submesoscale transport in y-direction [W] +! VTFLLD - heat flux due to lateral diffusion in y-direction [W] +! VSFLTD - salt flux due to thickness diffusion in y-direction [kg s-1] +! VSFLSM - salt flux due to submesoscale transport in y-direction [kg s-1] +! VSFLLD - salt flux due to lateral diffusion in y-direction [kg s-1] +! VVEL - velocity x-component [m s-1] +! WFLX - vertical mass flux [kg s-1] +! WFLX2 - vertical mass flux squared [kg2 s-2] +! PV - potential vorticity [m-1 s-1] +! TKE - turbulent kinetic energy [m2 s-2] +! GLS_PSI - generic length scale [m2 s-3] +! IDLAGE - ideal age [year] +! MMFLXL - meridional overturning circ. (MOC) on isopycnic layers [kg s-1] +! MMFLXD - MOC on z-levels [kg s-1] +! MMFTDL - MOC due to thickness diffusion on isopycnic layers [kg s-1] +! MMFSML - MOC due to submesoscale transport on isopycnic layers [kg s-1] +! MMFTDD - MOC due to thickness diffusion on z-levels [kg s-1] +! MMFSMD - MOC due to submesoscale transport on z-levels [kg s-1] +! MHFLX - meridional heat flux [W] +! MHFTD - meridional heat flux due to thickness diffusion [W] +! MHFSM - meridional heat flux due to submesoscale transport [W] +! MHFLD - meridional heat flux due to lateral diffusion [W] +! MSFLX - meridional salt flux [kg s-1] +! MSFTD - meridional salt flux due to thickness diffusion [kg s-1] +! MSFSM - meridional salt flux due to submesoscale transport [kg s-1] +! MSFLD - meridional salt flux due to lateral diffusion [kg s-1] +! VOLTR - section transports [kg s-1] +! MASSGS - global sum of mass [kg] +! VOLGS - global sum of volume [m3] +! SALNGA - global average temperature [degC] +! TEMPGA - global average temperature [degC] +! SSSGA - global average sea surface salinity [g kg-1] +! SSTGA - global average sea surface temperature [degC] +! +!=========================================================================== +! NAMELIST FOR iHAMOCC OPTIONS +! +! CONTENTS: +! +! 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 +! 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 +! NDEPFILE : File name (incl. full path) for atmopheric N-deposition data +! DO_SEDSPINUP: Logical switch to activate sediment spin-up +! SEDSPIN_YR_S: Start year for sediment spinup +! SEDSPIN_YR_E: End year for sediment spinup +! SEDSPIN_NCYC: Number of subcyles per time-step for sediment spinup +! INIXXX : Initial condition file for iHAMOCC, where XXX=DIC, ALK, PO4, +! OXY, NO3, SIL, D13C, and D14C +! WITH_DMSPH : Logical switch to activate DMS calculation as function of pH +! PI_PH_FILE : File name (incl. full path) for surface PI pH input data. +! 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 FOR ALKALINIZATION SCENARIO +! +! CONTENTS: +! +! 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 +! CDRMIP_LATMIN : Min latitude where alkalinity is added in 'const' or 'ramp' scenarios +! RAMP_START : Start year for ramp up in 'ramp' scenario +! RAMP_END : End year for ramp up in 'ramp' scenario +! +!=========================================================================== +! IO-NAMELIST FOR DIAGNOSTIC iHAMOCC OUTPUT +! +! Namelist acronyms: +! GLB_ - global parameters i.e. valid for entire output group +! SRF_ - surface variables (includes some non-surface 2d fields) +! FLX_ - interior ocean particle fuxes at different depth (2d) +! INT_ - vertically integrated fields (2d) +! LYR_ - 3d fields with sigma layers as vertical coordinate +! LVL_ - 3d fields with levitus levels as vertical coordinate +! SDM_ - 3d sediment fields +! 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) +! 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 +! output file: +! 0 : no output +! 1 : write inventory to standard output (log file) +! 2 : write output to inventory netCDF file +! +! Arguments for diagnostic variables: +! 0 - variable is not written +! 2 - variable is written as int2 with scale factor and offset +! 4 - variable is written as real4 +! 8 - variable is written as real8 +! +! Output variables: +! +! Main BGC tracer fields (SFR, LYR or LVL) +! DIC - Dissolved carbon (dissic) [mol C m-3] +! ALKALI - Alkalinity (talk) [eq m-3] +! OXYGEN - Oxygen (o2) [mol O2 m-3] +! ANO3 - Nitrate (no3) [mol N m-3] +! PHOSPH - Phosphorus (po4) [mol P m-3] +! IRON - Dissolved iron (dfe) [mol Fe m-3] +! SILICA - Silicate (si) [mol Si m-3] +! PHYTO - Phytoplankton (phyc) [mol C m-3] +! PH - pH (ph) [-log10([h+])] +! NATDIC - Natural dissolved carbon (natdissic) [mol C m-3] +! NATALKALI - Natural alkalinity (nattalk) [eq m-3] +! NATPH - Natural pH (natph) [-log10([h+])] +! +! Other 3d tracer or diagnostic variables (LYR or LVL) +! DP - Layer thickness (pddpo) [m] +! PREFO2 - preformed oxygen (p_o2) [mol O2 m-3] +! O2SAT - Saturated oxygen (satoxy) [mol O2 m-3] +! PREFPO4 - preformed phosphate (p_po4) [mol PO4 m-3] +! PREFALK - preformed alkalinity (p_talk) [eq m-3] +! PREFDIC - preformed DIC (p_dic) [mol C m-3] +! DICSAT - saturated DIC (dic_sat) [mol C m-3] +! POC - Detrius (detoc) [mol C m-3] +! CALC - CaCO3 shells (calc) [mol C m-3] +! OPAL - Opal shells (opal) [mol Si m-3] +! DOC - Dissolved organic carbon (dissoc) [mol C m-3] +! GRAZER - Zooplankton (zooc) [mol C m-3] +! 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] +! OMEGAA - Aragonite saturation state (omegaa) [1] +! OMEGAC - Calcite saturation state (omegac) [1] +! NATDIC - Natural dissolved carbon (natdissic) [mol C m-3] +! NATALKALI - Natural alkalinity (nattalk) [eq m-3] +! NATCO3 - Natural carbonate ion concentration (natco3) [mol C m-3] +! NATCALC - Natural CaCO3 shells (natcalc) [mol C m-3] +! NATOMEGAA - Natural aragonite saturation state (natomegaa) [1] +! NATOMEGAC - Natural calcite saturation state (natomegac) [1] +! DIC13 - Dissolved C13 (dissic13) [mol C m-3] +! DIC14 - Dissolved C14 (dissic14) [mol C m-3] +! D13C - delta 13C of DIC [1] +! D14C - delta 14C of DIC [1] +! BIGD14C - Delta 14C of DIC [1] +! POC13 - Particulate organic carbon 13 (detoc13) [mol C m-3] +! DOC13 - Dissolved organic carbon 13 (dissoc13) [mol C m-3] +! CALC13 - Particulate inorganic carbon 13 (calc13) [mol C m-3] +! PHYTO13 - 13C of phytoplankton biomass (phyc13) [mol C m-3] +! GRAZER13 - 13C of zootoplankton biomass (zooc13) [mol C m-3] +! CFC11 - CFC11 concentration [mol CFC11 m-3] +! CFC12 - CFC12 concentration [mol CFC12 m-3] +! SF6 - SF6 concentration [mol SF6 m-3] +! NOS - Number of sinking particles (aggregate scheme, nos) [cm-3] +! WPHY - Mass sinking velocity (aggregate scheme) [m d-1] +! WNOS - Number sinking velocity (aggregate scheme) [m d-1] +! EPS - Epsilon exponent (aggregate scheme) [1] +! ASIZE - Average particle size (aggregate scheme) +! +! 2d-fields (SFR) +! EXPORT - Export production (epc100) [mol C m-2 s-1] +! 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] +! 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] +! OXFLUX - Oxygen flux (fgo2) [mol O2 m-2 s-1] +! N2OFX - Nitrous oxide flux [mol N2O m-2 s-1] +! DMSFLUX - DMS flux (dmsflux) [mol DMS m-2 s-1] +! DMS - surface DMS concentration (dms) [mol DMS m-3] +! DMSPROD - DMS production (dmsprod) [mol DMS m-2 s-1] +! DMS_BAC - DMS bacterial consuption (dms_bac) [mol DMS m-2 s-1] +! DMS_UV - DMS decomposition by UV (dms_uv) [mol DMS m-2 s-1] +! ATMCO2 - Atmospheric CO2 (atmco2) [ppm] +! ATMO2 - Atmospheric O2 (atmo2) [ppm] +! ATMN2 - Atmospheric N2 (atmn2) [ppm] +! NATPCO2 - Natural surface PCO2 (spco2) [uatm] +! NATCO2FX - Natural net CO2 flux (natco2fx) [kg C m-2 s-1] +! CO213FXD - Downward 13CO2 flux (co213fxd) [kg C m-2 s-1] +! CO213FXU - Upward 13CO2 flux (co213fxu) [kg C m-2 s-1] +! CO214FXD - Downward 14CO2 flux (co214fxd) [kg C m-2 s-1] +! CO214FXU - Upward 14CO2 flux (co214fxu) [kg C m-2 s-1] +! CFC11 - CFC11 flux [mol CFC11 m-2 s-1] +! CFC12 - CFC12 flux [mol CFC12 m-2 s-1] +! SF6 - SF6 flux [mol SF6 m-2 s-1] +! +! Vertically integrated fields (INT) +! PHOSY - Vertically integrated primary production [mol C m-3 s-1] +! NFIX - Vertically integrated nitrogen fixation +! DNIT - Vertically integrated denitrification +! +! Particle fluxes (FLX, e.g CARFLX****, where ****=0100,0500,1000,2000,4000, or _BOT), +! diffusive fluxes at the sediment - water-column interface (SEDIFF*), and other fluxes +! NDEP - Nitrogen deposition flux [mol N m-2 s-1] +! OALK - Flux of alkalinity due to ocean alkalinization [mol N m-2 s-1] +! CARFLX**** - POC flux at **** metres depth [mol C m-2 s-1] +! BSIFLX**** - Biogenic silica flux at **** metres depth [mol Si m-2 s-1] +! CALFLX**** - Calcium carbonate flux at **** metres depth [mol C m-2 s-1] +! SEDIFFIC - sediment - water-column diffusive flux of DIC [mol C m-2 s-1] +! SEDIFFAL - sediment - water-column diffusive flux of alkalinity [mol m-2 s-1] +! SEDIFFPH - sediment - water-column diffusive flux of phosphate [mol PO3 m-2 s-1] +! SEDIFFOX - sediment - water-column diffusive flux of oxygen [mol O2 m-2 s-1] +! SEDIFFN2 - sediment - water-column diffusive flux of N2 [mol N2 m-2 s-1] +! SEDIFFNO3 - sediment - water-column diffusive flux of nitrate [mol NO3 m-2 s-1] +! SEDIFFSI - sediment - water-column diffusive flux of silica [mol Si m-2 s-1] +! +! Sediment fields (SDM) +! POWAIC - (powdic) [mol C m-3] +! POWAAL - (powalk) [eq m-3] +! POWAPH - (powpho) [eq m-3] +! POWAOX - (powox) [mol O2 m-3] +! POWN2 - (pown2) [mol N2 m-3] +! POWNO3 - (powno3)[mol N m-3] +! POWASI - (powsi) [mol Si m-3] +! SSSO12 - (ssso12) [mol m-3] +! SSSSIL - (ssssil) [mol Si m-3] +! SSSC12 - (sssc12) [mol C m-3] +! SSSTER - (ssster) [mol m-3] +! +! Burial fields (BUR) +! SSSO12 - Solid sediment organic carbon [mol P m-2] +! SSSSIL - Solid sediment silica [mol Si m-2] +! SSSC12 - Solid sediment inorganic carbon [mol C m-2] +! SSSTER - +! +!=========================================================================== From 5957d2c25a31705778a6fb7dae06e8d0513139e4 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Fri, 14 Jul 2023 15:34:57 +0200 Subject: [PATCH 16/52] updates to refactor addition of bromo --- .github/workflows/ci.yml | 157 -------------------------------------- cesm/mod_cesm.F90 | 10 ++- hamocc/accfields.F90 | 27 ++++--- hamocc/aufr_bgc.F90 | 6 +- hamocc/aufw_bgc.F90 | 6 +- hamocc/beleg_vars.F90 | 4 +- hamocc/carchm.F90 | 50 +++++++----- hamocc/hamocc4bcm.F90 | 13 +++- hamocc/hamocc_init.F90 | 4 +- hamocc/inventory_bgc.F90 | 11 ++- hamocc/mo_bgcmean.F90 | 7 ++ hamocc/mo_biomod.F90 | 26 ++++--- hamocc/mo_control_bgc.F90 | 3 + hamocc/ncout_hamocc.F90 | 26 ++++++- hamocc/ocprod.F90 | 19 ++++- phy/restart_rd.F | 3 + phy/restart_wt.F | 18 ++++- 17 files changed, 174 insertions(+), 216 deletions(-) delete mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 8938e2c3..00000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,157 +0,0 @@ -name: Continuous Integration testing -on: [push, pull_request] - -env: - # This version of Meson should be available as an EasyBuild on Fram and Betzy - MESON_VERSION: '0.55.1' -jobs: - build: - name: Build BLOM on Github provided OS - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, macos-latest] - mpi: [true, false] - openmp: ['enabled', 'disabled'] - exclude: - # Do not build on macOS with MPI as that is having some dependency issues - - os: macos-latest - mpi: true - steps: - - name: Install dependencies - Ubuntu - run: | - sudo apt update - sudo apt install -y libnetcdff-dev mpi-default-dev ninja-build - if: runner.os == 'Linux' - - - name: Install dependencies - macOS - run: brew install netcdf-fortran open-mpi ninja - env: - HOMEBREW_NO_INSTALL_CLEANUP: 1 - if: runner.os == 'macOS' - - - name: Setup Python for newer version of Meson - uses: actions/setup-python@v2 - - - name: Install Meson - run: python -m pip install meson==${{ env.MESON_VERSION }} - - - name: Checkout code - uses: actions/checkout@v2 - with: - submodules: 'recursive' - - - name: Build - env: - CC: gcc-12 - FC: gfortran-12 - run: | - meson setup builddir -Dmpi=${{ matrix.mpi }} -Dopenmp=${{ matrix.openmp }} --buildtype=debugoptimized - meson compile -C builddir - - - name: Test code - if: ${{ matrix.mpi == false }} - run: | - ulimit -s 65532 - meson test -C builddir - - - name: Upload test log - if: ${{ matrix.mpi == false }} - uses: actions/upload-artifact@v2 - with: - name: testlog-${{ runner.os }}-gcc - path: builddir/meson-logs/testlog.txt - - intel: - name: Build BLOM using Intel compilers - runs-on: ubuntu-20.04 - strategy: - fail-fast: false - matrix: - mpi: [true, false] - openmp: ['enabled', 'disabled'] - # Tell Meson to use Intel compilers - env: - CC: icc - FC: ifort - NFDIR: '/opt/netcdf' - steps: - - name: Install dependencies - run: | - sudo apt update - sudo apt install -y ninja-build libnetcdf-dev - - name: Cache Intel setup - id: cache-intel - uses: actions/cache@v2 - with: - path: /opt/intel/ - key: intel-${{ runner.os }}-compiler - - - name: Setup Intel compiler - if: steps.cache-intel.outputs.cache-hit != 'true' - run: | - wget -q https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB - sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB - sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main" - sudo apt update - sudo apt install -y\ - intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic\ - intel-oneapi-compiler-fortran intel-oneapi-mpi-devel - - - name: Cache netCDF install - id: cache-netcdf - uses: actions/cache@v2 - with: - path: ${{ env.NFDIR }} - key: netcdf-4.5.2-${{ runner.os }}-intel - - - name: Checkout netCDF for compiling with Intel - if: steps.cache-netcdf.outputs.cache-hit != 'true' - uses: actions/checkout@v2 - with: - repository: 'Unidata/netcdf-fortran' - ref: 'v4.5.2' - - - name: Compile and install custom netCDF - if: steps.cache-netcdf.outputs.cache-hit != 'true' - run: | - source /opt/intel/oneapi/setvars.sh - ./configure --prefix="$NFDIR" - make - sudo make install - - - name: Setup netCDF environment - run: | - echo "${NFDIR}/bin" >> $GITHUB_PATH - echo "PKG_CONFIG_PATH=${NFDIR}/lib/pkgconfig" >> $GITHUB_ENV - - - name: Setup Python for newer version of Meson - uses: actions/setup-python@v2 - - - name: Install Meson - run: python -m pip install meson==${{ env.MESON_VERSION }} - - - name: Checkout code - uses: actions/checkout@v2 - with: - submodules: 'recursive' - - - name: Build with Intel compilers - run: | - source /opt/intel/oneapi/setvars.sh - meson setup builddir -Dmpi=${{ matrix.mpi }} -Dopenmp=${{ matrix.openmp }} --buildtype=debugoptimized - meson compile -C builddir - - - name: Test code - if: ${{ matrix.mpi == false }} - run: | - source /opt/intel/oneapi/setvars.sh - meson test -C builddir - - - name: Upload test log - uses: actions/upload-artifact@v2 - if: ${{ matrix.mpi == false }} - with: - name: testlog-${{ runner.os }}-intel - path: builddir/meson-logs/testlog.txt diff --git a/cesm/mod_cesm.F90 b/cesm/mod_cesm.F90 index 3ae5a459..fc83bc7c 100644 --- a/cesm/mod_cesm.F90 +++ b/cesm/mod_cesm.F90 @@ -34,7 +34,9 @@ module mod_cesm use mod_ben02, only: initai, rdcsic, rdctsf, fnlzai use mod_seaice, only: ficem use mod_checksum, only: csdiag, chksummsk - use mo_control_bgc, only: do_bgc_aofluxes +#ifdef HAMOCC + use mo_control_bgc, only: do_bgc_aofluxes,do_bromo +#endif implicit none @@ -192,11 +194,15 @@ subroutine getfrc_cesm vstokes(i, j) = w1*vstokes_da(i, j, l1ci) + w2*vstokes_da(i, j, l2ci) atmco2(i, j) = w1*atmco2_da(i, j, l1ci) + w2*atmco2_da(i, j, l2ci) atmbrf(i, j) = w1*atmbrf_da(i, j, l1ci) + w2*atmbrf_da(i, j, l2ci) +#ifdef HAMOCC if (.not. do_bgc_aofluxes) then ! flxdms is obtained from the mediator flxdms(i, j) = w1*flxdms_da(i, j, l1ci) + w2*flxdms_da(i, j, l2ci) - flxbrf(i, j) = w1*flxbrf_da(i, j, l1ci) + w2*flxbrf_da(i, j, l2ci) + if (do_bromo) then + flxbrf(i, j) = w1*flxbrf_da(i, j, l1ci) + w2*flxbrf_da(i, j, l2ci) + end if end if +#endif enddo enddo do l = 1, isu(j) diff --git a/hamocc/accfields.F90 b/hamocc/accfields.F90 index 57a5bf41..1f3be3ae 100644 --- a/hamocc/accfields.F90 +++ b/hamocc/accfields.F90 @@ -68,10 +68,10 @@ SUBROUTINE ACCFIELDS(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask) & jco2kh,jph,jphosph,jphosy,jphyto,jpoc,jprefalk,jprefdic,jprefo2,jprefpo4,jsilica,jsrfalkali, & & jsrfano3,jsrfdic,jsrfiron,jsrfoxygen,jsrfphosph,jsrfphyto,jsrfsilica,jsrfph,jwnos,jwphy,jndepfx, & & joalkfx,nbgc,nacc_bgc,bgcwrt,glb_inventory,bgct2d,acclvl,acclyr,accsrf,bgczlv - use mo_control_bgc, only: io_stdo_bgc + use mo_control_bgc, only: io_stdo_bgc,do_bromo 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, & - & irdin,irdip,irsi,iralk,iriron,irdoc,irdet + & irdin,irdip,irsi,iralk,iriron,irdoc,irdet #ifdef AGG use mo_biomod, only: asize3d,eps3d,wnumb,wmass @@ -206,8 +206,10 @@ SUBROUTINE ACCFIELDS(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask) #ifdef natDIC call accsrf(jnatco2fx,atmflx(1,1,iatmnco2),omask,0) #endif - call accsrf(jatmbromo,atm(1,1,iatmbromo),omask,0) - call accsrf(jbromofx,atmflx(1,1,iatmbromo),omask,0) + if (do_bromo) then + call accsrf(jatmbromo,atm(1,1,iatmbromo),omask,0) + call accsrf(jbromofx,atmflx(1,1,iatmbromo),omask,0) + endif #ifdef cisonew call accsrf(jatmc13,atm(1,1,iatmc13),omask,0) call accsrf(jatmc14,atm(1,1,iatmc14),omask,0) @@ -255,9 +257,11 @@ SUBROUTINE ACCFIELDS(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask) call accsrf(jnatpco2,natpco2d,omask,0) call accsrf(jsrfnatph,nathi(1,1,1),omask,0) #endif - call accsrf(jsrfbromo,ocetra(1,1,1,ibromo),omask,0) - call accsrf(jbromo_prod,int_chbr3_prod,omask,0) - call accsrf(jbromo_uv,int_chbr3_uv,omask,0) + if (do_bromo) then + call accsrf(jsrfbromo,ocetra(1,1,1,ibromo),omask,0) + call accsrf(jbromo_prod,int_chbr3_prod,omask,0) + call accsrf(jbromo_uv,int_chbr3_uv,omask,0) + end if ! Accumulate fluxes due to N-deposition, ocean alkalinization call accsrf(jndepfx,ndepflx,omask,0) @@ -356,8 +360,9 @@ SUBROUTINE ACCFIELDS(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask) call acclyr(jcfc12,ocetra(1,1,1,icfc12),pddpo,1) call acclyr(jsf6,ocetra(1,1,1,isf6),pddpo,1) #endif - call acclyr(jbromo,ocetra(1,1,1,ibromo),pddpo,1) - + if (do_bromo) then + call acclyr(jbromo,ocetra(1,1,1,ibromo),pddpo,1) + end if ! Accumulate level diagnostics IF (SUM(jlvlphyto+jlvlgrazer+jlvlphosph+jlvloxygen+jlvliron+ & @@ -429,7 +434,9 @@ SUBROUTINE ACCFIELDS(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask) call acclvl(jlvlcfc12,ocetra(1,1,1,icfc12),k,ind1,ind2,wghts) call acclvl(jlvlsf6,ocetra(1,1,1,isf6),k,ind1,ind2,wghts) #endif - call acclvl(jlvlbromo,ocetra(1,1,1,ibromo),k,ind1,ind2,wghts) + if (do_bromo) then + call acclvl(jlvlbromo,ocetra(1,1,1,ibromo),k,ind1,ind2,wghts) + end if ENDDO ENDIF diff --git a/hamocc/aufr_bgc.F90 b/hamocc/aufr_bgc.F90 index 994d93c5..8fe4dd5b 100644 --- a/hamocc/aufr_bgc.F90 +++ b/hamocc/aufr_bgc.F90 @@ -104,7 +104,7 @@ SUBROUTINE AUFR_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & use netcdf, only: nf90_global,nf90_noerr,nf90_nowrite,nf90_close,nf90_open,nf90_get_att,nf90_inq_varid use mo_carbch, only: co2star,co3,hi,satoxy - use mo_control_bgc, only: io_stdo_bgc,ldtbgc + use mo_control_bgc, only: io_stdo_bgc,ldtbgc,do_bromo use mo_param1_bgc, only: ialkali,ian2o,iano3,icalc,idet,idicsat,idms,idoc,ifdust,igasnit,iiron,iopal,ioxygen,iphosph,iphy,& & iprefalk,iprefdic,iprefo2,iprefpo4,isco212,isilica,izoo,nocetra use mo_vgrid, only: kbo @@ -339,6 +339,7 @@ SUBROUTINE AUFR_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & #endif ! Find out whether to restart Bromoform + if (do_bromo) then lread_bro=.true. IF(IOTYPE==0) THEN if(mnproc==1) ncstat=nf90_inq_varid(ncid,'bromo',ncvarid) @@ -355,6 +356,7 @@ SUBROUTINE AUFR_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & WRITE(io_stdo_bgc,*) 'AUFR_BGC info: Bromoform tracer not in restart file, ' WRITE(io_stdo_bgc,*) 'Initialised to 0.01 pmol L-1 (Stemmler et al., 2015).' ENDIF + endif ! Find out whether to restart atmosphere #if defined(BOXATM) @@ -442,9 +444,11 @@ SUBROUTINE AUFR_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & CALL read_netcdf_var(ncid,'hi',nathi(1,1,1),kpke,0,iotype) ENDIF #endif + if (do_bromo) then IF(lread_bro) THEN CALL read_netcdf_var(ncid,'bromo',locetra(1,1,1,ibromo),2*kpke,0,iotype) ENDIF + endif ! ! Read restart data : diagnostic ocean fields (needed for bit to bit reproducability) diff --git a/hamocc/aufw_bgc.F90 b/hamocc/aufw_bgc.F90 index 41207a77..8fe5a281 100644 --- a/hamocc/aufw_bgc.F90 +++ b/hamocc/aufw_bgc.F90 @@ -99,7 +99,7 @@ SUBROUTINE AUFW_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & use netcdf, only: nf90_64bit_offset,nf90_global,nf90_noerr,nf90_nofill,nf90_def_dim,nf90_enddef,nf90_close, & & nf90_create,nf90_put_att,nf90_set_fill use mo_carbch, only: co2star,co3, hi,satoxy - use mo_control_bgc, only: io_stdo_bgc,ldtbgc,rmasko + use mo_control_bgc, only: io_stdo_bgc,ldtbgc,rmasko,do_bromo use mo_param1_bgc, only: ialkali, ian2o,iano3,icalc,idet,idicsat,idms,idoc,ifdust,igasnit,iiron,iopal,ioxygen,iphosph,iphy, & & iprefalk,iprefdic,iprefo2,iprefpo4,isco212,isilica,izoo,ks,nocetra use mo_sedmnt, only: sedhpl @@ -572,8 +572,10 @@ SUBROUTINE AUFW_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & & 6,'mol/kg',25,'Natural calcium carbonate', & & rmissing,52,io_stdo_bgc) #endif + if (do_bromo) then CALL NETCDF_DEF_VARDB(ncid,5,'bromo',3,ncdimst,ncvarid, & & 6,'mol/kg',9,'Bromoform',rmissing,47,io_stdo_bgc) + endif ! ! Define variables : diagnostic ocean fields @@ -854,7 +856,9 @@ SUBROUTINE AUFW_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & CALL write_netcdf_var(ncid,'natalkali',locetra(1,1,1,inatalkali),2*kpke,0) CALL write_netcdf_var(ncid,'natcalciu',locetra(1,1,1,inatcalc),2*kpke,0) #endif + if (do_bromo) then CALL write_netcdf_var(ncid,'bromo',locetra(1,1,1,ibromo),2*kpke,0) + endif ! ! Write restart data : diagtnostic ocean fields diff --git a/hamocc/beleg_vars.F90 b/hamocc/beleg_vars.F90 index cb73bea8..b375d9d3 100644 --- a/hamocc/beleg_vars.F90 +++ b/hamocc/beleg_vars.F90 @@ -54,7 +54,7 @@ SUBROUTINE BELEG_VARS(kpaufr,kpie,kpje,kpke,kbnd,pddpo,prho,omask, & use mo_carbch, only: co2star,co3,hi,ocetra use mo_biomod, only: fesoly - use mo_control_bgc, only: rmasks + use mo_control_bgc, only: rmasks,do_bromo use mo_param1_bgc, only: ialkali,ian2o,iano3,icalc,idet,idicsat,idms,idoc,ifdust,igasnit,iiron,iopal,ioxygen,iphosph,iphy, & & iprefalk,iprefdic,iprefo2,iprefpo4,isco212,isilica,izoo use mo_vgrid, only: kmle,kbo @@ -207,8 +207,10 @@ SUBROUTINE BELEG_VARS(kpaufr,kpie,kpje,kpke,kbnd,pddpo,prho,omask, & ocetra(i,j,k,icalc13)=ocetra(i,j,k,icalc)*rco213 ocetra(i,j,k,icalc14)=ocetra(i,j,k,icalc)*rco214 #endif + if (do_bromo) then ! Initialise to 0,01 pmol L-1 (Stemmler et al., 2015) => mol/kg ocetra(i,j,k,ibromo)= 1.e-14/prho(i,j,k) + endif ENDIF ! omask > 0.5 ENDDO ENDDO diff --git a/hamocc/carchm.F90 b/hamocc/carchm.F90 index 05986309..8888365e 100644 --- a/hamocc/carchm.F90 +++ b/hamocc/carchm.F90 @@ -101,7 +101,7 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & 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, do_bgc_aofluxes + use mo_control_bgc, only: dtbgc,do_bgc_aofluxes,do_bromo use mo_param1_bgc, only: ialkali,iatmo2,iatmco2,iatmdms,iatmn2,iatmn2o,ian2o,icalc,idicsat,idms,igasnit,ioxygen,iphosph, & & isco212,isilica use mo_vgrid, only: dp_min,kmle,kbo,ptiestu @@ -308,7 +308,9 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & #endif ! Stemmler et al. (2015; Biogeosciences) Eq. (9); Quack and Wallace ! (2003; GBC) - sch_bromo= 4662.8 - 319.45*t + 9.9012*t2 - 0.1159*t3 + if (do_bromo) then + sch_bromo= 4662.8 - 319.45*t + 9.9012*t2 - 0.1159*t3 + end if ! solubility of N2 (Weiss, R.F. 1970, Deep-Sea Res., 17, 721-735) for moist air ! at 1 atm; multiplication with oxyco converts to kmol/m^3/atm @@ -338,7 +340,9 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & a_sf = 1e-12 * a_sf #endif !Henry's law constant [dimensionless] for Bromoform from Quack and Wallace (2003; GBC) - a_bromo = exp(13.16 - 4973*(1/tk)) + if (do_bromo) then + a_bromo = exp(13.16 - 4973*(1/tk)) + end if ! Transfer (piston) velocity kw according to Wanninkhof (2014), in units of ms-1 Xconvxa = 6.97e-07 ! Wanninkhof's a=0.251 converted from [cm hr-1]/[m s-1]^2 to [ms-1]/[m s-1]^2 @@ -354,8 +358,10 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & #endif ! Stemmler et al. (2015; Biogeosciences) Eq. (8) ! 1.e-2/3600 = conversion from [cm hr-1]/[m s-1]^2 to [ms-1]/[m s-1]^2 - kw_bromo=(1.-psicomo(i,j)) * 1.e-2/3600. * & - & (0.222*pfu10(i,j)**2+0.33*pfu10(i,j))*(660./sch_bromo)**0.5 + if (do_bromo) then + kw_bromo=(1.-psicomo(i,j)) * 1.e-2/3600. * & + & (0.222*pfu10(i,j)**2+0.33*pfu10(i,j))*(660./sch_bromo)**0.5 + end if atco2 = atm(i,j,iatmco2) ato2 = atm(i,j,iatmo2) @@ -364,7 +370,9 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & atco213 = atm(i,j,iatmc13) atco214 = atm(i,j,iatmc14) #endif - atbrf = atm(i,j,iatmbromo) + if (do_bromo) then + atbrf = atm(i,j,iatmbromo) + end if ! Ratio P/P_0, where P is the local SLP and P_0 is standard pressure (1 atm). This is ! used in all surface flux calculations where atmospheric concentration is given as a @@ -480,18 +488,20 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & ! [ppp] to [mol L-1] by multiplying with pressure[bar]/(SST[K]*R[L bar K-1 mol-1]); R=0,083 ! [mol L-1] to [kmol m-3] by multiplying with 1 - if (do_bgc_aofluxes) then - flx_bromo = kw_bromo*dtbgc* & - (atbrf/a_bromo*1e-12*ppao(i,j)*1e-5/(tk*0.083) - ocetra(i,j,1,ibromo)) - else - ! Note that the external computation of fluxes is -flx_bromo/dtbgc - ! using above computation of flx_bromo - ! So need to divide by 252.7 and multiply by -dtbgc and in order to use this - ! for the tendency in the tracer update - flx_bromo = dtbgc*pflxbromo(i,j) + if (do_bromo) then + if (do_bgc_aofluxes) then + flx_bromo = kw_bromo*dtbgc* & + (atbrf/a_bromo*1e-12*ppao(i,j)*1e-5/(tk*0.083) - ocetra(i,j,1,ibromo)) + else + ! Note that the external computation of fluxes is -flx_bromo/dtbgc + ! using above computation of flx_bromo + ! So need to divide by 252.7 and multiply by -dtbgc and in order to use this + ! for the tendency in the tracer update + flx_bromo = dtbgc*pflxbromo(i,j) + end if + ocetra(i,j,1,ibromo) = ocetra(i,j,1,ibromo) + flx_bromo/pddpo(i,j,1) + atmflx(i,j,iatmbromo) = -flx_bromo end if - ocetra(i,j,1,ibromo) = ocetra(i,j,1,ibromo) + flx_bromo/pddpo(i,j,1) - atmflx(i,j,iatmbromo) = -flx_bromo ! Save surface fluxes atmflx(i,j,iatmco2)=fluxu-fluxd @@ -539,8 +549,10 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & ! Degradation to hydrolysis (Eq. 2-4 of Stemmler et al., 2015) ! A1=1.23e17 mol min-1 => 2.05e12 kmol sec-1 - Kb1=2.05e12*exp(-1.073e5/(8.314*tk))*dtbgc - ocetra(i,j,k,ibromo)=ocetra(i,j,k,ibromo)*(1.-(Kb1*Kw/ah1)) + if (do_bromo) then + Kb1=2.05e12*exp(-1.073e5/(8.314*tk))*dtbgc + ocetra(i,j,k,ibromo)=ocetra(i,j,k,ibromo)*(1.-(Kb1*Kw/ah1)) + end if ! Degradation to halogen substitution (Eq. 5-6 of Stemmler et al., 2015) lsub=7.33e-10*exp(1.250713e4*(1/298.-1/tk))*dtbgc diff --git a/hamocc/hamocc4bcm.F90 b/hamocc/hamocc4bcm.F90 index fc1c322c..c37bdeb8 100644 --- a/hamocc/hamocc4bcm.F90 +++ b/hamocc/hamocc4bcm.F90 @@ -86,7 +86,8 @@ SUBROUTINE HAMOCC4BCM(kpie,kpje,kpke,kbnd,kplyear,kplmon,kplday,kldtday,& use mo_carbch, only: atmflx,ocetra,atm 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 + do_sedspinup,sedspin_yr_s,sedspin_yr_e,sedspin_ncyc, & + do_bromo use mo_param1_bgc, only: iatmco2,iatmdms,nocetra,nriv use mo_vgrid, only: set_vgrid use mo_apply_fedep, only: apply_fedep @@ -184,6 +185,7 @@ SUBROUTINE HAMOCC4BCM(kpie,kpje,kpke,kbnd,kplyear,kplmon,kplday,kldtday,& !if (mnproc.eq.1) write (io_stdo_bgc,*) 'iHAMOCC: getting co2 from atm' #endif + if (do_bromo) then !$OMP PARALLEL DO PRIVATE(i) DO j=1,kpje DO i=1,kpie @@ -194,6 +196,7 @@ SUBROUTINE HAMOCC4BCM(kpie,kpje,kpke,kbnd,kplyear,kplmon,kplday,kldtday,& ENDDO !$OMP END PARALLEL DO if (mnproc.eq.1) write (io_stdo_bgc,*) 'iHAMOCC: getting bromoform from atm' + endif !-------------------------------------------------------------------- ! Read atmospheric cfc concentrations @@ -418,7 +421,13 @@ SUBROUTINE HAMOCC4BCM(kpie,kpje,kpke,kbnd,kplyear,kplmon,kplday,kldtday,& !$OMP PARALLEL DO PRIVATE(i) DO j=1,kpje DO i=1,kpie - if(omask(i,j) .gt. 0.5) pflxbromo(i,j)=-252.7*atmflx(i,j,iatmbromo)/dtbgc + if(omask(i,j) .gt. 0.5) then + if (do_bromo) then + pflxbromo(i,j)=-252.7*atmflx(i,j,iatmbromo)/dtbgc + else + pflxbromo(i,j)=0.0 + end if + endif ENDDO ENDDO !$OMP END PARALLEL DO diff --git a/hamocc/hamocc_init.F90 b/hamocc/hamocc_init.F90 index 47b35559..4d06749d 100644 --- a/hamocc/hamocc_init.F90 +++ b/hamocc/hamocc_init.F90 @@ -46,7 +46,7 @@ subroutine hamocc_init(read_rest,rstfnm_hamocc) & 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 + & ldtrunbgc,ndtdaybgc,with_dmsph,l_3Dvarsedpor,do_bromo use mo_param1_bgc, only: ks,init_por2octra_mapping use mo_carbch, only: alloc_mem_carbch,ocetra,atm,atm_co2 use mo_biomod, only: alloc_mem_biomod @@ -196,7 +196,9 @@ subroutine hamocc_init(read_rest,rstfnm_hamocc) CALL ini_read_oafx(idm,jdm,bgc_dx,bgc_dy,plat,omask) + if (do_bromo) then CALL ini_swa_clim(idm,jdm,omask) + endif call ini_pi_ph(idm,jdm,omask) ! diff --git a/hamocc/inventory_bgc.F90 b/hamocc/inventory_bgc.F90 index 17fbf34d..8541e4e9 100644 --- a/hamocc/inventory_bgc.F90 +++ b/hamocc/inventory_bgc.F90 @@ -56,15 +56,15 @@ SUBROUTINE INVENTORY_BGC(kpie,kpje,kpke,dlxp,dlyp,ddpo,omask,iogrp) 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_control_bgc, only: do_ndep,do_rivinpt,io_stdo_bgc,do_bromo 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, & & irdin,irdip,irsi,iralk,irdoc,irdet,nocetra,npowtra,nsedtra,nriv use mo_vgrid, only: dp_min -# ifndef sedbypass use mo_param1_bgc, only: ks +#ifndef sedbypass use mo_sedmnt, only: porwat,seddw,sedlay,burial,sedhpl,powtra,porsol #endif @@ -1396,6 +1396,7 @@ subroutine write_netcdf(iogrp) & 'kmol/m^3') ) #endif + if (do_bromo) then call nccheck( NF90_DEF_VAR(ncid, 'zt_bromo', NF90_DOUBLE, & & time_dimid, zt_bromo_varid) ) call nccheck( NF90_PUT_ATT(ncid, zt_bromo_varid, 'long_name', & @@ -1407,6 +1408,7 @@ subroutine write_netcdf(iogrp) call nccheck( NF90_PUT_ATT(ncid, zc_bromo_varid, 'long_name', & & 'Mean bromoform concentration') ) call nccheck( NF90_PUT_ATT(ncid, zc_bromo_varid, 'units', 'kmol/m^3') ) + end if !--- Define variables : sum of inventory call nccheck( NF90_DEF_VAR(ncid, 'totcarb', NF90_DOUBLE, time_dimid, & @@ -1596,8 +1598,11 @@ subroutine write_netcdf(iogrp) call nccheck( NF90_INQ_VARID(ncid, "zt_natcalciu", zt_natcalciu_varid) ) call nccheck( NF90_INQ_VARID(ncid, "zc_natcalciu", zc_natcalciu_varid) ) #endif + if (do_bromo) then call nccheck( NF90_INQ_VARID(ncid, "zt_bromo", zt_bromo_varid) ) call nccheck( NF90_INQ_VARID(ncid, "zc_bromo", zc_bromo_varid) ) + end if + !--- Inquire varid : sum of inventory call nccheck( NF90_INQ_VARID(ncid, "totcarb", totcarb_varid) ) call nccheck( NF90_INQ_VARID(ncid, "totphos", totphos_varid) ) @@ -1821,10 +1826,12 @@ subroutine write_netcdf(iogrp) call nccheck( NF90_PUT_VAR(ncid, zc_natcalciu_varid, & & zocetratoc(inatcalc), start = wrstart) ) #endif + if (do_bromo) then call nccheck( NF90_PUT_VAR(ncid, zt_bromo_varid, & & zocetratot(ibromo), start = wrstart) ) call nccheck( NF90_PUT_VAR(ncid, zc_bromo_varid, & & zocetratoc(ibromo), start = wrstart) ) + endif !--- Write data : sum of inventory call nccheck( NF90_PUT_VAR(ncid, totcarb_varid, totalcarbon, & & start = wrstart) ) diff --git a/hamocc/mo_bgcmean.F90 b/hamocc/mo_bgcmean.F90 index c869905e..0601cf7a 100644 --- a/hamocc/mo_bgcmean.F90 +++ b/hamocc/mo_bgcmean.F90 @@ -58,6 +58,7 @@ MODULE mo_bgcmean use mod_nctools, only: ncpack,nccomp,nccopa,ncwrtr use netcdf, only: nf90_fill_double use mo_param1_bgc, only: ks + use mo_control_bgc, only: do_bromo IMPLICIT NONE @@ -722,6 +723,7 @@ SUBROUTINE ALLOC_MEM_BGCMEAN(kpie,kpje,kpke) IF (SRF_NATPH(n).GT.0) i_bsc_m2d=i_bsc_m2d+1 jsrfnatph(n)=i_bsc_m2d*min(1,SRF_NATPH(n)) #endif + if (do_bromo) then IF (SRF_BROMO(n).GT.0) i_bsc_m2d=i_bsc_m2d+1 jsrfbromo(n)=i_bsc_m2d*min(1,SRF_BROMO(n)) IF (SRF_BROMOFX(n).GT.0) i_bsc_m2d=i_bsc_m2d+1 @@ -730,6 +732,7 @@ SUBROUTINE ALLOC_MEM_BGCMEAN(kpie,kpje,kpke) jbromo_prod(n)=i_bsc_m2d*min(1,INT_BROMOPRO(n)) IF (INT_BROMOUV(n).GT.0) i_bsc_m2d=i_bsc_m2d+1 jbromo_uv(n)=i_bsc_m2d*min(1,INT_BROMOUV(n)) + end if ENDDO domassfluxes = any( & @@ -878,8 +881,10 @@ SUBROUTINE ALLOC_MEM_BGCMEAN(kpie,kpje,kpke) IF (LYR_NATOMEGAC(n).GT.0) i_bsc_m3d=i_bsc_m3d+1 jnatomegac(n)=i_bsc_m3d*min(1,LYR_NATOMEGAC(n)) #endif + if (do_bromo) then IF (LYR_BROMO(n).GT.0) i_bsc_m3d=i_bsc_m3d+1 jbromo(n)=i_bsc_m3d*min(1,LYR_BROMO(n)) + end if IF (LVL_PHYTO(n).GT.0) ilvl_bsc_m3d=ilvl_bsc_m3d+1 jlvlphyto(n)=ilvl_bsc_m3d*min(1,LVL_PHYTO(n)) @@ -989,8 +994,10 @@ SUBROUTINE ALLOC_MEM_BGCMEAN(kpie,kpje,kpke) IF (LVL_NATOMEGAC(n).GT.0) ilvl_bsc_m3d=ilvl_bsc_m3d+1 jlvlnatomegac(n)=ilvl_bsc_m3d*min(1,LVL_NATOMEGAC(n)) #endif + if (do_bromo) then IF (LVL_BROMO(n).GT.0) ilvl_bsc_m3d=ilvl_bsc_m3d+1 jlvlbromo(n)=ilvl_bsc_m3d*min(1,LVL_BROMO(n)) + end if IF (i_bsc_m3d.NE.0) checkdp(n)=1 ENDDO diff --git a/hamocc/mo_biomod.F90 b/hamocc/mo_biomod.F90 index aa486820..9990c56c 100644 --- a/hamocc/mo_biomod.F90 +++ b/hamocc/mo_biomod.F90 @@ -123,7 +123,7 @@ 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: io_stdo_bgc,do_bromo INTEGER, intent(in) :: kpie,kpje,kpke INTEGER :: errstat @@ -367,17 +367,19 @@ SUBROUTINE ALLOC_MEM_BIOMOD(kpie,kpje,kpke) asize3d(:,:,:) = 0.0 #endif - 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 + if (do_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 + end if !****************************************************************************** END SUBROUTINE ALLOC_MEM_BIOMOD diff --git a/hamocc/mo_control_bgc.F90 b/hamocc/mo_control_bgc.F90 index e27a11ff..32dad8f9 100644 --- a/hamocc/mo_control_bgc.F90 +++ b/hamocc/mo_control_bgc.F90 @@ -67,6 +67,9 @@ MODULE mo_control_bgc logical, save :: with_dmsph =.false. ! apply DMS with pH dependence logical, save :: do_bgc_aofluxes = .true. ! If true, atm/ocn bgc fluxes are computed within HAMOCC +#ifdef BROMO + logical, save :: do_bromo = .true. +#endif contains diff --git a/hamocc/ncout_hamocc.F90 b/hamocc/ncout_hamocc.F90 index bdc71871..a6b3a311 100644 --- a/hamocc/ncout_hamocc.F90 +++ b/hamocc/ncout_hamocc.F90 @@ -29,7 +29,7 @@ subroutine ncwrt_bgc(iogrp) use mod_grid, only: depths use mod_dia, only: diafnm,sigmar1,iotype,ddm,depthslev, & & depthslev_bnds - use mo_control_bgc, only: dtbgc + use mo_control_bgc, only: dtbgc,do_bromo use mo_vgrid, only: k0100,k0500,k1000,k2000,k4000 use mo_param1_bgc, only: ks use mod_nctools, only: ncwrt1,ncdims,nctime,ncfcls,ncfopn, & @@ -298,7 +298,9 @@ subroutine ncwrt_bgc(iogrp) call finlyr(jnatomegaa(iogrp),jdp(iogrp)) call finlyr(jnatomegac(iogrp),jdp(iogrp)) #endif + if (do_bromo) then call finlyr(jbromo(iogrp),jdp(iogrp)) + end if ! --- Mask sea floor in mass fluxes call msksrf(jcarflx0100(iogrp),k0100) @@ -376,7 +378,9 @@ subroutine ncwrt_bgc(iogrp) call msklvl(jlvlnatomegaa(iogrp),depths) call msklvl(jlvlnatomegac(iogrp),depths) #endif + if (do_bromo) then call msklvl(jlvlbromo(iogrp),depths) + end if ! --- Compute log10 of pH if (SRF_PH(iogrp).ne.0) call logsrf(jsrfph(iogrp),rnacc,0.) @@ -467,11 +471,13 @@ subroutine ncwrt_bgc(iogrp) call wrtsrf(jnatco2fx(iogrp), SRF_NATCO2FX(iogrp), rnacc*12./dtbgc,0.,cmpflg,'natco2fx') call wrtsrf(jsrfnatph(iogrp), SRF_NATPH(iogrp), -1., 0.,cmpflg,'srfnatph') #endif + if (do_bromo) then call wrtsrf(jbromofx(iogrp), SRF_BROMOFX(iogrp), rnacc*1e3/dtbgc,0.,cmpflg,'bromofx') call wrtsrf(jsrfbromo(iogrp), SRF_BROMO(iogrp), rnacc*1e3, 0.,cmpflg,'srfbromo') call wrtsrf(jbromo_prod(iogrp), INT_BROMOPRO(iogrp), rnacc*1e3/dtbgc,0.,cmpflg,'intbromoprod') call wrtsrf(jbromo_uv(iogrp), INT_BROMOUV(iogrp), rnacc*1e3/dtbgc,0.,cmpflg,'intbromouv') call wrtsrf(jatmbromo(iogrp), SRF_ATMBROMO(iogrp), rnacc, 0.,cmpflg,'atmbromo') + end if call wrtsrf(jatmco2(iogrp), SRF_ATMCO2(iogrp), rnacc, 0.,cmpflg,'atmco2') #if defined(BOXATM) call wrtsrf(jatmo2(iogrp), SRF_ATMO2(iogrp), rnacc, 0.,cmpflg,'atmo2') @@ -542,7 +548,9 @@ subroutine ncwrt_bgc(iogrp) call wrtlyr(jnatomegaa(iogrp), LYR_NATOMEGAA(iogrp),1., 0.,cmpflg,'natomegaa') call wrtlyr(jnatomegac(iogrp), LYR_NATOMEGAC(iogrp),1., 0.,cmpflg,'natomegac') #endif + if (do_bromo) then call wrtlyr(jbromo(iogrp), LYR_BROMO(iogrp), 1e3, 0.,cmpflg,'bromo') + end if ! --- Store 3d level fields call wrtlvl(jlvldic(iogrp), LVL_DIC(iogrp), rnacc*1e3, 0.,cmpflg,'dissiclvl') @@ -603,7 +611,9 @@ subroutine ncwrt_bgc(iogrp) call wrtlvl(jlvlnatomegaa(iogrp),LVL_NATOMEGAA(iogrp),rnacc, 0.,cmpflg,'natomegaalvl') call wrtlvl(jlvlnatomegac(iogrp),LVL_NATOMEGAC(iogrp),rnacc, 0.,cmpflg,'natomegaclvl') #endif + if (do_bromo) then call wrtlvl(jlvlbromo(iogrp), LVL_BROMO(iogrp), rnacc*1e3, 0.,cmpflg,'bromolvl') + end if ! --- Store sediment fields #ifndef sedbypass @@ -708,11 +718,13 @@ subroutine ncwrt_bgc(iogrp) call inisrf(jnatco2fx(iogrp),0.) call inisrf(jsrfnatph(iogrp),0.) #endif + if (do_bromo) then call inisrf(jsrfbromo(iogrp),0.) call inisrf(jbromofx(iogrp),0.) call inisrf(jbromo_prod(iogrp),0.) call inisrf(jbromo_uv(iogrp),0.) call inisrf(jatmbromo(iogrp),0.) + end if call inisrf(jatmco2(iogrp),0.) @@ -784,7 +796,9 @@ subroutine ncwrt_bgc(iogrp) call inilyr(jnatomegaa(iogrp),0.) call inilyr(jnatomegac(iogrp),0.) #endif + if (do_bromo) then call inilyr(jbromo(iogrp),0.) + end if call inilvl(jlvldic(iogrp),0.) call inilvl(jlvlalkali(iogrp),0.) @@ -844,7 +858,9 @@ subroutine ncwrt_bgc(iogrp) call inilvl(jlvlnatomegaa(iogrp),0.) call inilvl(jlvlnatomegac(iogrp),0.) #endif + if (do_bromo) then call inilvl(jlvlbromo(iogrp),0.) + end if #ifndef sedbypass call inisdm(jpowaic(iogrp),0.) @@ -903,7 +919,6 @@ subroutine hamoccvardef(iogrp,timeunits,calendar,cmpflg) #if defined(BOXATM) use mo_bgcmean, only: srf_atmo2,srf_atmn2 #endif - use mo_bgcmean, only:srf_bromo,srf_bromofx,int_bromopro, & & int_bromouv,srf_atmbromo,lyr_bromo,lvl_bromo #ifdef CFC @@ -931,6 +946,7 @@ subroutine hamoccvardef(iogrp,timeunits,calendar,cmpflg) & sdm_sssc12,sdm_ssster,bur_ssso12,bur_sssc12,bur_ssssil, & & bur_ssster #endif + use mo_control_bgc, only: do_bromo implicit none integer iogrp,cmpflg @@ -1107,6 +1123,7 @@ subroutine hamoccvardef(iogrp,timeunits,calendar,cmpflg) call ncdefvar3d(SRF_NATPH(iogrp),cmpflg,'p','srfnatph', & & 'Surface natural pH',' ','-log10([H+])',0) #endif + if (do_bromo) then call ncdefvar3d(SRF_BROMO(iogrp),cmpflg,'p','srfbromo', & & 'Surface bromoform',' ','mol CHBr3 m-3',0) call ncdefvar3d(SRF_BROMOfx(iogrp),cmpflg,'p','bromofx', & @@ -1118,6 +1135,7 @@ subroutine hamoccvardef(iogrp,timeunits,calendar,cmpflg) & 'mol CHBr3 m-2 s-1',0) call ncdefvar3d(SRF_ATMBROMO(iogrp),cmpflg,'p', & & 'atmbromo','Atmospheric bromoform',' ','ppt',0) + end if call ncdefvar3d(SRF_ATMCO2(iogrp),cmpflg,'p', & & 'atmco2','Atmospheric CO2',' ','ppm',0) @@ -1245,8 +1263,10 @@ subroutine hamoccvardef(iogrp,timeunits,calendar,cmpflg) call ncdefvar3d(LYR_NATOMEGAC(iogrp),cmpflg,'p','natomegac', & & 'Natural OmegaC',' ','1',1) #endif + if (do_bromo) then call ncdefvar3d(LYR_BROMO(iogrp),cmpflg,'p', & & 'bromo','Bromoform',' ','mol CHBr3 m-3',1) + end if ! --- define 3d level fields call ncdefvar3d(LVL_DIC(iogrp),cmpflg,'p', & @@ -1357,8 +1377,10 @@ subroutine hamoccvardef(iogrp,timeunits,calendar,cmpflg) call ncdefvar3d(LVL_NATOMEGAC(iogrp),cmpflg,'p', & & 'natomegaclvl','Natural OmegaC',' ','1',2) #endif + if (do_bromo) then call ncdefvar3d(LVL_BROMO(iogrp),cmpflg,'p', & & 'bromolvl','Bromoform',' ','mol CHBr3 m-3',2) + end if ! --- define sediment fields #ifndef sedbypass diff --git a/hamocc/ocprod.F90 b/hamocc/ocprod.F90 index 9fe7b3ff..01032b12 100644 --- a/hamocc/ocprod.F90 +++ b/hamocc/ocprod.F90 @@ -90,7 +90,7 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) & riron,rnit,strahl,rnoi,ro2ut,ropal,spemor,wcal,wdust,wopal,wpoc,zinges use mo_param1_bgc, only: ialkali,ian2o,iano3,icalc,idet,idms,idoc,ifdust,igasnit,iiron,iopal,ioxygen,iphosph,iphy,isco212, & & isilica,izoo - use mo_control_bgc, only: dtb,io_stdo_bgc,with_dmsph + use mo_control_bgc, only: dtb,io_stdo_bgc,with_dmsph,do_bromo use mo_vgrid, only: dp_min,dp_min_sink,k0100,k0500,k1000,k2000,k4000,kwrbioz,ptiestu use mod_xc, only: mnproc @@ -217,8 +217,10 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) intdms_bac(:,:) = 0. intdms_uv (:,:) = 0. phosy3d (:,:,:) = 0. + if (do_bromo) then int_chbr3_uv (:,:) = 0. int_chbr3_prod (:,:) = 0. + end if #ifdef AGG eps3d(:,:,:) = 0. asize3d(:,:,:) = 0. @@ -245,7 +247,9 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) ! Calculate swr absorption by water and phytoplankton abs_bgc(:,:,:) = 0. + if (do_bromo) then abs_uv(:,:,:) = 0. + end if #ifdef FB_BGC_OCE abs_oce(:,:,:) = 0. abs_oce(:,:,1) = 1. @@ -269,7 +273,9 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) ! Average light intensity in layer k atten = atten_w + atten_c * max(0.,ocetra(i,j,k,iphy)) abs_bgc(i,j,k) = ((absorption/atten)* (1.-exp(-atten*dz)))/dz - abs_uv(i,j,k) = ((absorption_uv/atten_uv)*(1.-exp(-atten_uv*dz)))/dz + if (do_bromo) then + abs_uv(i,j,k) = ((absorption_uv/atten_uv)*(1.-exp(-atten_uv*dz)))/dz + end if #ifdef FB_BGC_OCE abs_oce(i,j,k) = abs_oce(i,j,k) * absorption if (k == 2) then @@ -472,6 +478,7 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) ocetra(i,j,k,iopal) = ocetra(i,j,k,iopal)+delsil-dremopal*ocetra(i,j,k,iopal) ocetra(i,j,k,iiron) = ocetra(i,j,k,iiron)+dtr*riron & & - relaxfe*MAX(ocetra(i,j,k,iiron)-fesoly,0.) + ! Bromo source from phytoplankton production and sink to photolysis ! Hense and Quack (200) Pg537 Decay time scale is 30days =0.0333/day ! sinks owing to degradation by nitrifiers (Pg 538 of Hense and Quack, @@ -479,13 +486,15 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) ! than sink through halide substitution & hydrolysis (Fig. 3) ! Assume that only 30% of incoming radiation are UV (i.e. 50% of non-PAR ! radiation; PAR radiationis assume to be 40% of incoming radiation) + if (do_bromo) then bro_beta = rbro*(fbro1*avsil/(avsil+bkopal)+fbro2*bkopal/(avsil+bkopal)) if (swa_clim(i,j,1) > 0.) then - bro_uv = 0.0333*dtb*0.3*(strahl(i,j)/swa_clim(i,j,1))*abs_uv(i,j,k)*ocetra(i,j,k,ibromo) + bro_uv = 0.0333*dtb*0.3*(strahl(i,j)/swa_clim(i,j,1))*abs_uv(i,j,k)*ocetra(i,j,k,ibromo) else - bro_uv = 0.0 + bro_uv = 0.0 endif ocetra(i,j,k,ibromo) = ocetra(i,j,k,ibromo)+bro_beta*phosy-bro_uv + end if #ifdef AGG !*********************************************************************** @@ -527,8 +536,10 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) intdmsprod(i,j) = intdmsprod(i,j)+dmsprod*dz intdms_bac(i,j) = intdms_bac(i,j)+dms_bac*dz intdms_uv(i,j) = intdms_uv (i,j)+dms_uv*dz + if (do_bromo) then int_chbr3_uv(i,j) = int_chbr3_uv (i,j) + bro_uv*dz int_chbr3_prod(i,j) = int_chbr3_prod (i,j) + bro_beta*phosy*dz + end if intphosy(i,j) = intphosy(i,j) +phosy*rcar*dz ! primary production in kmol C m-2 phosy3d(i,j,k) = phosy*rcar ! primary production in kmol C m-3 diff --git a/phy/restart_rd.F b/phy/restart_rd.F index 83af8266..02625f6e 100644 --- a/phy/restart_rd.F +++ b/phy/restart_rd.F @@ -68,6 +68,9 @@ subroutine restart_rd use mod_tke, only: L_scale # endif #endif +#ifdef HAMOCC + use mo_control_bgc, only: do_bromo +#endif c implicit none c diff --git a/phy/restart_wt.F b/phy/restart_wt.F index 1ffd0a31..767addf4 100644 --- a/phy/restart_wt.F +++ b/phy/restart_wt.F @@ -65,6 +65,9 @@ subroutine restart_wt use mod_tke, only: L_scale # endif #endif +#ifdef HAMOCC + use mo_control_bgc, only: do_bromo +#endif c implicit none c @@ -366,8 +369,12 @@ subroutine restart_wt call wrtrst('frzpot',trim(c5p)//' time',frzpot,ip) call wrtrst('mltpot',trim(c5p)//' time',mltpot,ip) call wrtrst('flxco2',trim(c5p)//' time',flxco2,ip) +#ifdef HAMOCC call wrtrst('flxdms',trim(c5p)//' time',flxdms,ip) - call wrtrst('flxbrf',trim(c5p)//' time',flxbrf,ip) + if (do_bromo) then + call wrtrst('flxbrf',trim(c5p)//' time',flxbrf,ip) + end if +#endif endif c #ifdef TRC @@ -870,6 +877,9 @@ subroutine defvar_restart(c5p,c5u,c5v,c5q) c --- ------------------------------------------------------------------ use mod_dia use mod_forcing, only: sprfac +#ifdef HAMOCC + use mo_control_bgc, only: do_bromo +#endif c implicit none c @@ -1012,8 +1022,12 @@ subroutine defvar_restart(c5p,c5u,c5v,c5q) call defvarrst('frzpot',trim(c5p)//' time') call defvarrst('mltpot',trim(c5p)//' time') call defvarrst('flxco2',trim(c5p)//' time') +#ifdef HAMOCC call defvarrst('flxdms',trim(c5p)//' time') - call defvarrst('flxbrf',trim(c5p)//' time') + if (do_bromo) then + call defvarrst('flxbrf',trim(c5p)//' time') + end if +#endif endif c #ifdef TRC From b396a60a9a409a6a7129afa4e75c2b18457ee3d9 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Fri, 14 Jul 2023 16:17:00 +0200 Subject: [PATCH 17/52] rename files --- cime_config/buildnml | 1818 ++++---------------------------------- cime_config/buildnml.csh | 1636 ++++++++++++++++++++++++++++++++++ cime_config/buildnml.py | 182 ---- 3 files changed, 1818 insertions(+), 1818 deletions(-) create mode 100644 cime_config/buildnml.csh delete mode 100644 cime_config/buildnml.py diff --git a/cime_config/buildnml b/cime_config/buildnml index 46388741..27924f2e 100644 --- a/cime_config/buildnml +++ b/cime_config/buildnml @@ -1,1636 +1,182 @@ -#! /bin/csh -f - -#------------------------------------------------------------------------------ -# Get variables from Case XML-files -#------------------------------------------------------------------------------ - -set CASEROOT = `./xmlquery CASEROOT --value` -set OCN_GRID = `./xmlquery OCN_GRID --value` -set BLOM_VCOORD = `./xmlquery BLOM_VCOORD --value` -set BLOM_UNIT = `./xmlquery BLOM_UNIT --value` -set DIN_LOC_ROOT = `./xmlquery DIN_LOC_ROOT --value` -set RUN_TYPE = `./xmlquery RUN_TYPE --value` -set CONTINUE_RUN = `./xmlquery CONTINUE_RUN --value` -set CASEBUILD = `./xmlquery CASEBUILD --value` -set CCSM_CO2_PPMV = `./xmlquery CCSM_CO2_PPMV --value` -set OCN_NCPL = `./xmlquery OCN_NCPL --value` -set BLOM_COUPLING = `./xmlquery BLOM_COUPLING --value` -set RUNDIR = `./xmlquery RUNDIR --value` -set BLOM_TRACER_MODULES = `./xmlquery BLOM_TRACER_MODULES --value` -set BLOM_RIVER_NUTRIENTS = `./xmlquery BLOM_RIVER_NUTRIENTS --value` -set BLOM_N_DEPOSITION = `./xmlquery BLOM_N_DEPOSITION --value` -set BLOM_NDEP_SCENARIO = `./xmlquery BLOM_NDEP_SCENARIO --value` -set HAMOCC_VSLS = `./xmlquery HAMOCC_VSLS --value` -set HAMOCC_CISO = `./xmlquery HAMOCC_CISO --value` -set HAMOCC_SEDSPINUP = `./xmlquery HAMOCC_SEDSPINUP --value` -set HAMOCC_SEDSPINUP_YR_START = `./xmlquery HAMOCC_SEDSPINUP_YR_START --value` -set HAMOCC_SEDSPINUP_YR_END = `./xmlquery HAMOCC_SEDSPINUP_YR_END --value` -set HAMOCC_SEDSPINUP_NCYCLE = `./xmlquery HAMOCC_SEDSPINUP_NCYCLE --value` -set RUN_STARTDATE = `./xmlquery RUN_STARTDATE --value` -set PIO_TYPENAME_OCN = `./xmlquery PIO_TYPENAME_OCN --value` -set PIO_NETCDF_FORMAT_OCN = `./xmlquery PIO_NETCDF_FORMAT_OCN --value` -set NINST_OCN = `./xmlquery NINST_OCN --value` -set TEST=`./xmlquery TEST --value` - -#------------------------------------------------------------------------------ -# Check if HAMOCC is requested -#------------------------------------------------------------------------------ - -set ecosys = FALSE -set tracers = (`echo $BLOM_TRACER_MODULES`) -if ($#tracers != 0) then - foreach module ($tracers) - if ($module == ecosys) then - set ecosys = TRUE - endif - end -endif - -#------------------------------------------------------------------------------ -# Set RUN_TYPE to 'continue' if CONTINUE_RUN equals TRUE -#------------------------------------------------------------------------------ - -if ("$CONTINUE_RUN" == TRUE) then - set RUN_TYPE = continue -endif - -#------------------------------------------------------------------------------ -# Get start date -#------------------------------------------------------------------------------ - -set YEAR0 = `echo $RUN_STARTDATE | cut -c1-4 ` -set MONTH0 = `echo $RUN_STARTDATE | cut -c6-7 ` -set DAY0 = `echo $RUN_STARTDATE | cut -c9-10` - -#------------------------------------------------------------------------------ -# Set namelist variables -#------------------------------------------------------------------------------ - -#------------------------------ -# set LIMITS defaults -#------------------------------ -set NDAY1 = 0 -set NDAY2 = 0 -set IDATE = $YEAR0$MONTH0$DAY0 -set IDATE0 = $YEAR0$MONTH0$DAY0 -set RUNID = "'unset'" -set EXPCNF = "'cesm'" -set RUNTYP = "'$RUN_TYPE'" -set GRFILE = "'unset'" -set ICFILE = "'unset'" -if ("$BLOM_UNIT" == cgs) then - set PREF = 2000.e5 -else - set PREF = 2000.e4 -endif -set BACLIN = 1800. -set BATROP = 36. -if ("$BLOM_UNIT" == cgs) then - set MDV2HI = 2. - set MDV2LO = .4 - set MDV4HI = 0. - set MDV4LO = 0. - set MDC2HI = 5000.e4 - set MDC2LO = 300.e4 -else - set MDV2HI = .02 - set MDV2LO = .004 - set MDV4HI = 0. - set MDV4LO = 0. - set MDC2HI = 5000. - set MDC2LO = 300. -endif -set VSC2HI = .5 -set VSC2LO = .5 -set VSC4HI = 0. -set VSC4LO = 0. -if ("$BLOM_UNIT" == cgs) then - set CBAR = 5. -else - set CBAR = .05 -endif -set CB = .002 -set CWBDTS = 5.e-5 -set CWBDLS = 25. -set MOMMTH = "'enscon'" -set BMCMTH = "'uc'" -set RMPMTH = "'eitvel'" -set MLRTTP = "'constant'" -set RM0 = 1.2 -set RM5 = 0. -set CE = .06 -set TDFILE = "'unset'" -set NIWGF = 0. -set NIWBF = .35 -set NIWLF = .5 -set SWAMTH = "'jerlov'" -set JWTYPE = 3 -set CHLOPT = "'climatology'" -set CCFILE = "'unset'" -set TRXDAY = 0. -set SRXDAY = 0. -set TRXDPT = 1. -set SRXDPT = 1. -set TRXLIM = 1.5 -set SRXLIM = .5 -set APTFLX = .false. -set APSFLX = .false. -set DITFLX = .false. -set DISFLX = .false. -set SRXBAL = .false. -set SCFILE = "'unset'" -set WAVSRC = "'none'" -set SMTFRC = .true. -set SPRFAC = .false. -set ATM_PATH = "'unset'" -set ITEST = 60 -set JTEST = 60 -set CNSVDI = .false. -set CSDIAG = .false. -set RSTFRQ = 1 -if ("$PIO_NETCDF_FORMAT_OCN" == 64bit_offset) then - set RSTFMT = 1 -else - set RSTFMT = 0 -endif -set RSTCMP = 0 -if ("$PIO_TYPENAME_OCN" == pnetcdf) then - set IOTYPE = 1 -else - set IOTYPE = 0 -endif - -#------------------------------ -# set VCOORD defaults -#------------------------------ -set VCOORD_TYPE = "'$BLOM_VCOORD'" -set RECONSTRUCTION_METHOD = "'ppm'" -set DENSITY_LIMITING = "'monotonic'" -set TRACER_LIMITING = "'non_oscillatory'" -set VELOCITY_LIMITING = "'non_oscillatory'" -set DENSITY_PC_UPPER_BNDR = .false. -set DENSITY_PC_LOWER_BNDR = .false. -set TRACER_PC_UPPER_BNDR = .true. -set TRACER_PC_LOWER_BNDR = .false. -set VELOCITY_PC_UPPER_BNDR = .true. -set VELOCITY_PC_LOWER_BNDR = .false. -set DPMIN_SURFACE = 2.5 -set DPMIN_INFLATION_FACTOR = 1.08 -set DPMIN_INTERIOR = .1 -set DKTZU = 4 -set DKTZL = 1 - -#------------------------------ -# set DIFFUSION defaults -#------------------------------ -set EITMTH = "'gm'" -set EDRITP = "'large scale'" -set EDWMTH = "'smooth'" -set EDDF2D = .false. -set EDSPRS = .true. -set EGC = 0.85 -set EGGAM = 200. -if ("$BLOM_UNIT" == cgs) then - set EGLSMN = 4000.e2 - set EGMNDF = 100.e4 - set EGMXDF = 1500.e4 -else - set EGLSMN = 4000. - set EGMNDF = 100. - set EGMXDF = 1500. -endif -set EGIDFQ = 1. -set TBFILE = "'unset'" -set RHISCF = 0. -set EDANIS = .false. -set REDI3D = .false. -set RHSCTP = .false. -set RI0 = 1.2 -set BDMTYP = 2 -if ("$BLOM_UNIT" == cgs) then - set BDMC1 = 5.e-4 - set BDMC2 = .1 -else - set BDMC1 = 5.e-8 - set BDMC2 = 1.e-5 -endif -set TKEPF = .006 -set SMOBLD = .true. -set LNGMTP = "'none'" -if ("$BLOM_VCOORD" == isopyc_bulkml) then - set BDMLDP = .true. - set LTEDTP = "'layer'" -else - set BDMLDP = .false. - set LTEDTP = "'neutral'" -endif - -#------------------------------ -# set BGCNML defaults -#------------------------------ -set ATM_CO2 = "$CCSM_CO2_PPMV" -if ("$BLOM_RIVER_NUTRIENTS" == TRUE) then - set DO_RIVINPT = .true. -else - set DO_RIVINPT = .false. -endif -if ("$BLOM_N_DEPOSITION" == TRUE) then - set DO_NDEP = .true. - if( "$BLOM_NDEP_SCENARIO" == 1850 && "$OCN_GRID" == tnx2v1) then - set NDEPFNAME = ndep_1850_CMIP6_tnx2v1_20180321.nc - else if( "$BLOM_NDEP_SCENARIO" == 1850 && "$OCN_GRID" == tnx1v4) then - set NDEPFNAME = ndep_1850_CMIP6_tnx1v4_20171106.nc - else if( "$BLOM_NDEP_SCENARIO" == 1850 && "$OCN_GRID" == tnx0.25v4) then - set NDEPFNAME = ndep_1850_CMIP6_tnx0.25v4_20190912.nc - else if( "$BLOM_NDEP_SCENARIO" == 1850 && "$OCN_GRID" == tnx0.125v4) then - set NDEPFNAME = ndep_1850_CMIP6_tnx0.125v4_20221013.nc - else if( "$BLOM_NDEP_SCENARIO" == 2000 && "$OCN_GRID" == tnx2v1) then - set NDEPFNAME = ndep_2000_CMIP6_tnx2v1_20200826.nc - else if( "$BLOM_NDEP_SCENARIO" == 2000 && "$OCN_GRID" == tnx1v4) then - set NDEPFNAME = ndep_2000_CMIP6_tnx1v4_20200826.nc - else if( "$BLOM_NDEP_SCENARIO" == 2000 && "$OCN_GRID" == tnx0.25v4) then - set NDEPFNAME = ndep_2000_CMIP6_tnx0.25v4_20200826.nc - else if( "$BLOM_NDEP_SCENARIO" == hist && "$OCN_GRID" == tnx2v1) then - set NDEPFNAME = ndep_185001-201412_tnx2v1_20190702.nc - else if( "$BLOM_NDEP_SCENARIO" == hist && "$OCN_GRID" == tnx1v4) then - set NDEPFNAME = ndep_185001-201412_tnx1v4_20180613.nc - else if( "$BLOM_NDEP_SCENARIO" == hist && "$OCN_GRID" == tnx0.25v4) then - set NDEPFNAME = ndep_185001-201412_tnx0.25v4_20190705.nc - else if( `echo $BLOM_NDEP_SCENARIO | cut -c1-3` == ssp && "$OCN_GRID" == tnx1v4) then - set NDEPFNAME = ndep_201501-210012-${BLOM_NDEP_SCENARIO}_tnx1v4_20191112.nc - else if( "$BLOM_NDEP_SCENARIO" == UNSET ) then - set DO_NDEP = .false. - set NDEPFNAME = "''" - endif -else - set DO_NDEP = .false. - set NDEPFNAME = "''" -endif -if ("$HAMOCC_SEDSPINUP" == TRUE) then - set DO_SEDSPINUP = .true. - set SEDSPIN_YR_S = $HAMOCC_SEDSPINUP_YR_START - set SEDSPIN_YR_E = $HAMOCC_SEDSPINUP_YR_END - set SEDSPIN_NCYC = $HAMOCC_SEDSPINUP_NCYCLE -else - set DO_SEDSPINUP = .false. - set SEDSPIN_YR_S = -1 - set SEDSPIN_YR_E = -1 - set SEDSPIN_NCYC = -1 -endif -# VSLS is currently only available for the tnx1v4 grid, since a climatlogy file for -# short wave radiation is needed. -if ("$HAMOCC_VSLS" == TRUE && "$OCN_GRID" != tnx1v4) then - echo "$0 ERROR: HAMOCC_VSLS == TRUE not possible with this grid resolution (no swa-climatology available) " - exit -1 -endif -# For the following options, there are currently no switches in Case-XML files. -# These options can be activated by expert users via user namelist. -set DO_OALK = .false. -set BGCOAFX_OALKSCEN = "''" -set BGCOAFX_OALKFILE = "''" -set BGCOAFX_ADDALK = 0.135 -set BGCOAFX_CDRMIP_LATMAX = 70.0 -set BGCOAFX_CDRMIP_LATMIN = -60.0 -set BGCOAFX_RAMP_START = 2025 -set BGCOAFX_RAMP_END = 2035 -set WITH_DMSPH = .false. -set PI_PH_FILE = "''" -set L_3DVARSEDPOR = .false. -set SEDPORFILE = "''" - - -#------------------------------ -# set DIAPHY defaults -#------------------------------ -set GLB_FNAMETAG = "'hd','hm','hy'" -set GLB_AVEPERIO = '1, 30, 365' -if ("$TEST" == TRUE) then - set GLB_FILEFREQ = '1, 30, 365' -else - set GLB_FILEFREQ = '30, 30, 365' -endif -set GLB_COMPFLAG = '0, 0, 0' -if ("$PIO_NETCDF_FORMAT_OCN" == 64bit_offset) then - set GLB_NCFORMAT = '1, 1, 1' -else - set GLB_NCFORMAT = '0, 0, 0' -endif -set H2D_ABSWND = '0, 4, 0' -set H2D_ALB = '0, 0, 0' -set H2D_BTMSTR = '0, 4, 0' -set H2D_BRNFLX = '0, 4, 0' -set H2D_BRNPD = '0, 4, 0' -set H2D_DFL = '0, 0, 0' -set H2D_EVA = '0, 4, 0' -set H2D_FICE = '0, 4, 0' -set H2D_FMLTFZ = '0, 4, 0' -set H2D_HICE = '0, 0, 0' -set H2D_HMLTFZ = '0, 4, 0' -set H2D_HSNW = '0, 0, 0' -set H2D_IAGE = '0, 0, 0' -set H2D_IDKEDT = '0, 4, 0' -set H2D_LAMULT = '0, 4, 0' -set H2D_LASL = '0, 4, 0' -set H2D_LIP = '0, 4, 0' -set H2D_MAXMLD = '4, 4, 0' -set H2D_MLD = '0, 4, 0' -set H2D_MLTS = '4, 4, 0' -set H2D_MLTSMN = '0, 4, 0' -set H2D_MLTSMX = '0, 4, 0' -set H2D_MLTSSQ = '0, 4, 0' -set H2D_MTKEUS = '0, 4, 0' -set H2D_MTKENI = '0, 4, 0' -set H2D_MTKEBF = '0, 4, 0' -set H2D_MTKERS = '0, 4, 0' -set H2D_MTKEPE = '0, 4, 0' -set H2D_MTKEKE = '0, 4, 0' -set H2D_MTY = '0, 4, 0' -set H2D_NSF = '0, 4, 0' -set H2D_PBOT = '0, 4, 0' -set H2D_PSRF = '0, 4, 0' -set H2D_RFIFLX = '0, 4, 0' -set H2D_RNFFLX = '0, 4, 0' -set H2D_SALFLX = '0, 4, 0' -set H2D_SALRLX = '0, 4, 0' -set H2D_SBOT = '0, 4, 0' -set H2D_SEALV = '4, 4, 0' -set H2D_SLVSQ = '0, 4, 0' -set H2D_SFL = '0, 4, 0' -set H2D_SOP = '0, 4, 0' -set H2D_SIGMX = '0, 4, 0' -set H2D_SSS = '4, 4, 0' -set H2D_SSSSQ = '4, 4, 0' -set H2D_SST = '4, 4, 0' -set H2D_SSTSQ = '4, 4, 0' -set H2D_SURFLX = '0, 4, 0' -set H2D_SURRLX = '0, 4, 0' -set H2D_SWA = '0, 4, 0' -set H2D_T20D = '4, 4, 0' -set H2D_TAUX = '0, 4, 0' -set H2D_TAUY = '0, 4, 0' -set H2D_TBOT = '0, 4, 0' -set H2D_TICE = '0, 0, 0' -set H2D_TSRF = '0, 0, 0' -set H2D_UB = '0, 4, 0' -set H2D_UICE = '0, 0, 0' -set H2D_USTAR = '0, 4, 0' -set H2D_USTAR3 = '0, 4, 0' -set H2D_USTOKES = '0, 0, 0' -set H2D_VB = '0, 4, 0' -set H2D_VICE = '0, 0, 0' -set H2D_VSTOKES = '0, 0, 0' -set H2D_ZTX = '0, 4, 0' -set LYR_BFSQ = '0, 4, 0' -set LYR_DIFDIA = '0, 4, 0' -set LYR_DIFVMO = '0, 4, 0' -set LYR_DIFVHO = '0, 4, 0' -set LYR_DIFVSO = '0, 4, 0' -set LYR_DIFINT = '0, 4, 0' -set LYR_DIFISO = '0, 4, 0' -set LYR_DP = '0, 4, 0' -set LYR_DZ = '0, 4, 0' -set LYR_SALN = '0, 4, 0' -set LYR_TEMP = '0, 4, 0' -set LYR_TRC = '0, 0, 0' -set LYR_UFLX = '0, 4, 0' -set LYR_UTFLX = '0, 4, 0' -set LYR_USFLX = '0, 4, 0' -set LYR_UMFLTD = '0, 0, 4' -set LYR_UMFLSM = '0, 0, 4' -set LYR_UTFLTD = '0, 0, 4' -set LYR_UTFLSM = '0, 0, 4' -set LYR_UTFLLD = '0, 0, 4' -set LYR_USFLTD = '0, 0, 4' -set LYR_USFLSM = '0, 0, 4' -set LYR_USFLLD = '0, 0, 4' -set LYR_UVEL = '0, 4, 0' -set LYR_VFLX = '0, 4, 0' -set LYR_VTFLX = '0, 4, 0' -set LYR_VSFLX = '0, 4, 0' -set LYR_VMFLTD = '0, 0, 4' -set LYR_VMFLSM = '0, 0, 4' -set LYR_VTFLTD = '0, 0, 4' -set LYR_VTFLSM = '0, 0, 4' -set LYR_VTFLLD = '0, 0, 4' -set LYR_VSFLTD = '0, 0, 4' -set LYR_VSFLSM = '0, 0, 4' -set LYR_VSFLLD = '0, 0, 4' -set LYR_VVEL = '0, 4, 0' -set LYR_WFLX = '0, 4, 0' -set LYR_WFLX2 = '0, 4, 0' -set LYR_PV = '0, 4, 0' -set LYR_TKE = '0, 4, 0' -set LYR_GLS_PSI = '0, 4, 0' -set LYR_IDLAGE = '0, 4, 0' -set LVL_BFSQ = '0, 4, 0' -set LVL_DIFDIA = '0, 4, 0' -set LVL_DIFVMO = '0, 4, 0' -set LVL_DIFVHO = '0, 4, 0' -set LVL_DIFVSO = '0, 4, 0' -set LVL_DIFINT = '0, 4, 0' -set LVL_DIFISO = '0, 4, 0' -set LVL_DZ = '0, 4, 0' -set LVL_SALN = '0, 4, 0' -set LVL_TEMP = '0, 4, 0' -set LVL_TRC = '0, 0, 0' -set LVL_UFLX = '0, 4, 0' -set LVL_UTFLX = '0, 4, 0' -set LVL_USFLX = '0, 4, 0' -set LVL_UMFLTD = '0, 0, 4' -set LVL_UMFLSM = '0, 0, 4' -set LVL_UTFLTD = '0, 0, 4' -set LVL_UTFLSM = '0, 0, 4' -set LVL_UTFLLD = '0, 0, 4' -set LVL_USFLTD = '0, 0, 4' -set LVL_USFLSM = '0, 0, 4' -set LVL_USFLLD = '0, 0, 4' -set LVL_UVEL = '0, 4, 0' -set LVL_VFLX = '0, 4, 0' -set LVL_VTFLX = '0, 4, 0' -set LVL_VSFLX = '0, 4, 0' -set LVL_VMFLTD = '0, 0, 4' -set LVL_VMFLSM = '0, 0, 4' -set LVL_VTFLTD = '0, 0, 4' -set LVL_VTFLSM = '0, 0, 4' -set LVL_VTFLLD = '0, 0, 4' -set LVL_VSFLTD = '0, 0, 4' -set LVL_VSFLSM = '0, 0, 4' -set LVL_VSFLLD = '0, 0, 4' -set LVL_VVEL = '0, 4, 0' -set LVL_WFLX = '0, 4, 0' -set LVL_WFLX2 = '0, 4, 0' -set LVL_PV = '0, 4, 0' -set LVL_TKE = '0, 4, 0' -set LVL_GLS_PSI = '0, 4, 0' -set LVL_IDLAGE = '0, 4, 0' -set MSC_MMFLXL = '0, 4, 0' -set MSC_MMFLXD = '0, 4, 0' -set MSC_MMFTDL = '0, 4, 0' -set MSC_MMFSML = '0, 4, 0' -set MSC_MMFTDD = '0, 4, 0' -set MSC_MMFSMD = '0, 4, 0' -set MSC_MHFLX = '0, 4, 0' -set MSC_MHFTD = '0, 4, 0' -set MSC_MHFSM = '0, 4, 0' -set MSC_MHFLD = '0, 4, 0' -set MSC_MSFLX = '0, 4, 0' -set MSC_MSFTD = '0, 4, 0' -set MSC_MSFSM = '0, 4, 0' -set MSC_MSFLD = '0, 4, 0' -set MSC_VOLTR = '0, 4, 0' -set MSC_MASSGS = '0, 4, 0' -set MSC_VOLGS = '0, 4, 0' -set MSC_SALNGA = '0, 4, 0' -set MSC_TEMPGA = '0, 4, 0' -set MSC_SSSGA = '0, 4, 0' -set MSC_SSTGA = '0, 4, 0' - -#------------------------------ -# set DIABGC defaults -#------------------------------ -set BGC_FNAMETAG = "'hbgcd','hbgcm','hbgcy'" -set BGC_AVEPERIO = '1,30,365' -set BGC_FILEFREQ = '30,30,365' -if ("$TEST" == TRUE) then - set BGC_FILEFREQ = ' 1,30,365' -else - set BGC_FILEFREQ = '30,30,365' -endif -set BGC_COMPFLAG = '0, 0, 0' -if ("$PIO_NETCDF_FORMAT_OCN" == 64bit_offset) then - set BGC_NCFORMAT = '1, 1, 1' -else - set BGC_NCFORMAT = '0, 0, 0' -endif -set BGC_INVENTORY = '0, 1, 0' -set SRF_PHOSPH = '0, 2, 2' -set SRF_OXYGEN = '0, 2, 2' -set SRF_IRON = '0, 2, 2' -set SRF_ANO3 = '0, 2, 2' -set SRF_ALKALI = '4, 2, 2' -set SRF_SILICA = '0, 2, 2' -set SRF_DIC = '4, 2, 2' -set SRF_PHYTO = '4, 2, 2' -set SRF_PH = '0, 2, 2' -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' -set SRF_NIFLUX = '0, 2, 2' -set SRF_N2OFX = '0, 0, 2' -set SRF_DMSFLUX = '0, 2, 2' -set SRF_DMS = '0, 2, 2' -set SRF_DMSPROD = '0, 2, 2' -set SRF_DMS_BAC = '0, 2, 2' -set SRF_DMS_UV = '0, 2, 2' -set SRF_ATMCO2 = '0, 2, 2' -set SRF_ATMO2 = '0, 2, 2' -set SRF_ATMN2 = '0, 2, 2' -set SRF_NATDIC = '0, 2, 2' -set SRF_NATALKALI = '0, 2, 2' -set SRF_NATPH = '0, 2, 2' -set SRF_NATPCO2 = '0, 2, 2' -set SRF_NATCO2FX = '0, 2, 2' -set SRF_CO213FXD = '0, 2, 2' -set SRF_CO213FXU = '0, 2, 2' -set SRF_CO214FXD = '0, 2, 2' -set SRF_CO214FXU = '0, 2, 2' -set SRF_CFC11 = '0, 2, 2' -set SRF_CFC12 = '0, 2, 2' -set SRF_SF6 = '0, 2, 2' -set SRF_BROMO = '0, 2, 2' -set SRF_BROMOFX = '0, 2, 2' -set INT_BROMOPRO = '0, 2, 2' -set INT_BROMOUV = '0, 2, 2' -set INT_PHOSY = '4, 2, 2' -set INT_NFIX = '0, 2, 2' -set INT_DNIT = '0, 2, 2' -if ("$BLOM_N_DEPOSITION" == TRUE) then -set FLX_NDEP = '0, 2, 2' -else -set FLX_NDEP = '0, 0, 0' -endif -set FLX_OALK = '0, 0, 0' -set FLX_CAR0100 = '0, 2, 2' -set FLX_CAR0500 = '0, 2, 2' -set FLX_CAR1000 = '0, 2, 2' -set FLX_CAR2000 = '0, 2, 2' -set FLX_CAR4000 = '0, 2, 2' -set FLX_CAR_BOT = '0, 2, 2' -set FLX_BSI0100 = '0, 2, 2' -set FLX_BSI0500 = '0, 2, 2' -set FLX_BSI1000 = '0, 2, 2' -set FLX_BSI2000 = '0, 2, 2' -set FLX_BSI4000 = '0, 2, 2' -set FLX_BSI_BOT = '0, 2, 2' -set FLX_CAL0100 = '0, 2, 2' -set FLX_CAL0500 = '0, 2, 2' -set FLX_CAL1000 = '0, 2, 2' -set FLX_CAL2000 = '0, 2, 2' -set FLX_CAL4000 = '0, 2, 2' -set FLX_CAL_BOT = '0, 2, 2' -set LYR_PHYTO = '0, 0, 2' -set LYR_GRAZER = '0, 0, 2' -set LYR_DOC = '0, 0, 2' -set LYR_PHOSY = '0, 0, 2' -set LYR_PHOSPH = '0, 0, 2' -set LYR_OXYGEN = '0, 0, 4' -set LYR_IRON = '0, 0, 2' -set LYR_ANO3 = '0, 0, 2' -set LYR_ALKALI = '0, 0, 2' -set LYR_SILICA = '0, 0, 2' -set LYR_DIC = '0, 0, 2' -set LYR_POC = '0, 0, 2' -set LYR_CALC = '0, 0, 2' -set LYR_OPAL = '0, 0, 2' -set LYR_CO3 = '0, 0, 2' -set LYR_N2O = '0, 0, 0' -set LYR_PH = '0, 0, 2' -set LYR_OMEGAC = '0, 0, 2' -set LYR_OMEGAA = '0, 0, 2' -set LYR_PREFO2 = '0, 0, 4' -set LYR_O2SAT = '0, 0, 4' -set LYR_PREFPO4 = '0, 0, 2' -set LYR_PREFALK = '0, 0, 2' -set LYR_PREFDIC = '0, 0, 2' -set LYR_DICSAT = '0, 0, 2' -set LYR_NATDIC = '0, 0, 2' -set LYR_NATALKALI = '0, 0, 2' -set LYR_NATCO3 = '0, 0, 2' -set LYR_NATCALC = '0, 0, 2' -set LYR_NATPH = '0, 0, 2' -set LYR_NATOMEGAC = '0, 0, 2' -set LYR_NATOMEGAA = '0, 0, 2' -set LYR_DIC13 = '0, 0, 2' -set LYR_DIC14 = '0, 0, 2' -set LYR_D13C = '0, 0, 2' -set LYR_D14C = '0, 0, 2' -set LYR_BIGD14C = '0, 0, 2' -set LYR_POC13 = '0, 0, 2' -set LYR_DOC13 = '0, 0, 2' -set LYR_CALC13 = '0, 0, 2' -set LYR_PHYTO13 = '0, 0, 2' -set LYR_GRAZER13 = '0, 0, 2' -set LYR_CFC11 = '0, 0, 2' -set LYR_CFC12 = '0, 0, 2' -set LYR_SF6 = '0, 0, 2' -set LYR_NOS = '0, 0, 2' -set LYR_WPHY = '0, 0, 2' -set LYR_WNOS = '0, 0, 2' -set LYR_EPS = '0, 0, 0' -set LYR_ASIZE = '0, 0, 0' -set LYR_BROMO = '0, 0, 2' -set BGC_DP = '0, 2, 2' -set LVL_PHYTO = '0, 2, 2' -set LVL_GRAZER = '0, 2, 2' -set LVL_DOC = '0, 2, 2' -set LVL_PHOSY = '0, 2, 2' -set LVL_PHOSPH = '0, 2, 2' -set LVL_OXYGEN = '0, 4, 4' -set LVL_IRON = '0, 2, 2' -set LVL_ANO3 = '0, 2, 2' -set LVL_ALKALI = '0, 2, 2' -set LVL_SILICA = '0, 2, 2' -set LVL_DIC = '0, 2, 2' -set LVL_POC = '0, 2, 2' -set LVL_CALC = '0, 2, 2' -set LVL_OPAL = '0, 2, 2' -set LVL_CO3 = '0, 2, 2' -set LVL_N2O = '0, 0, 2' -set LVL_PH = '0, 2, 2' -set LVL_OMEGAC = '0, 2, 2' -set LVL_OMEGAA = '0, 2, 2' -set LVL_PREFO2 = '0, 4, 4' -set LVL_O2SAT = '0, 4, 4' -set LVL_PREFPO4 = '0, 2, 2' -set LVL_PREFALK = '0, 2, 2' -set LVL_PREFDIC = '0, 2, 2' -set LVL_DICSAT = '0, 2, 2' -set LVL_NATDIC = '0, 2, 2' -set LVL_NATALKALI = '0, 2, 2' -set LVL_NATCO3 = '0, 2, 2' -set LVL_NATCALC = '0, 2, 2' -set LVL_NATPH = '0, 2, 2' -set LVL_NATOMEGAC = '0, 2, 2' -set LVL_NATOMEGAA = '0, 2, 2' -set LVL_DIC13 = '0, 2, 2' -set LVL_DIC14 = '0, 2, 2' -set LVL_D13C = '0, 2, 2' -set LVL_POC13 = '0, 2, 2' -set LVL_DOC13 = '0, 2, 2' -set LVL_CALC13 = '0, 2, 2' -set LVL_PHYTO13 = '0, 2, 2' -set LVL_GRAZER13 = '0, 2, 2' -set LVL_CFC11 = '0, 2, 2' -set LVL_CFC12 = '0, 2, 2' -set LVL_SF6 = '0, 2, 2' -set LVL_NOS = '0, 2, 2' -set LVL_WPHY = '0, 2, 2' -set LVL_WNOS = '0, 2, 2' -set LVL_EPS = '0, 0, 0' -set LVL_ASIZE = '0, 0, 0' -set LVL_BROMO = '0, 2, 2' -set FLX_SEDIFFIC = '0, 0, 2' -set FLX_SEDIFFAL = '0, 0, 2' -set FLX_SEDIFFPH = '0, 0, 2' -set FLX_SEDIFFOX = '0, 0, 2' -set FLX_SEDIFFN2 = '0, 0, 2' -set FLX_SEDIFFNO3 = '0, 0, 2' -set FLX_SEDIFFSI = '0, 0, 2' -set SDM_POWAIC = '0, 0, 2' -set SDM_POWAAL = '0, 0, 2' -set SDM_POWAPH = '0, 0, 2' -set SDM_POWAOX = '0, 0, 2' -set SDM_POWN2 = '0, 0, 2' -set SDM_POWNO3 = '0, 0, 2' -set SDM_POWASI = '0, 0, 2' -set SDM_SSSO12 = '0, 0, 2' -set SDM_SSSSIL = '0, 0, 2' -set SDM_SSSC12 = '0, 0, 2' -set SDM_SSSTER = '0, 0, 2' -set BUR_SSSO12 = '0, 0, 2' -set BUR_SSSSIL = '0, 0, 2' -set BUR_SSSC12 = '0, 0, 2' -set BUR_SSSTER = '0, 0, 2' - -# if partial coupling, enable SSS relaxation -if ("$BLOM_COUPLING" =~ *partial*) then - if ("$BLOM_VCOORD" == isopyc_bulkml) then - set SRXDAY = 6. - else - set SRXDAY = 60. - set SRXDPT = 10. - endif - set SPRFAC = .true. - set SRXBAL = .true. -endif - -# set grid dependent parameters -if ("$OCN_GRID" == gx1v5 || "$OCN_GRID" == gx1v6) then - set BACLIN = 1800. - set BATROP = 36. -else if ("$OCN_GRID" == gx3v7) then - set BACLIN = 3600. - set BATROP = 72. -else if ("$OCN_GRID" == tnx2v1 ) then - set BACLIN = 4800. - set BATROP = 96. - set EGC = 0.5 - if ("$BLOM_UNIT" == cgs) then - set EGMXDF = 1000.e4 - else - set EGMXDF = 1000. - endif - set CWMTAG = "'Gibraltar','Gibraltar'" - set CWMEDG = " 'u', 'u'" - set CWMI = " 53, 54" - set CWMJ = " 137, 137" - set CWMWTH = " 30.e3, 30.e3" -else if ("$OCN_GRID" == tnx1.5v1 ) then - set BACLIN = 4800. - set BATROP = 96. - set EGC = 0.5 - if ("$BLOM_UNIT" == cgs) then - set EGMXDF = 1000.e4 - else - set EGMXDF = 1000. - endif -else if ("$OCN_GRID" == tnx1v1 || "$OCN_GRID" == tnx1v3 || "$OCN_GRID" == tnx1v4) then - if ("$OCN_NCPL" == 24) then - set BACLIN = 3600. - set BATROP = 60. - set CWBDTS = .75e-4 - set NIWGF = .4 - set SMTFRC = .false. - if ("$BLOM_VCOORD" == isopyc_bulkml) then - set CE = .5 - endif - else - set BACLIN = 3200. - set BATROP = 64. - endif - set CWMTAG = "'Gibraltar','Gibraltar'" - set CWMEDG = " 'u', 'u'" - set CWMI = " 105, 106" - set CWMJ = " 273, 273" - set CWMWTH = " 30.e3, 30.e3" -else if ("$OCN_GRID" == tnx0.25v1 || "$OCN_GRID" == tnx0.25v3 || "$OCN_GRID" == tnx0.25v4) then - set BACLIN = 900. - set BATROP = 15. - if ("$BLOM_UNIT" == cgs) then - set MDV2HI = .15 - set MDV2LO = .15 - set MDV4HI = 0. - set MDV4LO = 0. - set MDC2HI = 300.e4 - set MDC2LO = 300.e4 - else - set MDV2HI = .0015 - set MDV2LO = .0015 - set MDV4HI = 0. - set MDV4LO = 0. - set MDC2HI = 300. - set MDC2LO = 300. - endif - set VSC2HI = .15 - set VSC2LO = .15 - set VSC4HI = 0.0625 - set VSC4LO = 0.0625 - set CWBDTS = 0.75e-4 - set CWBDLS = 25. - set EDWMTH = "'step'" - set EGC = 0.85 - if ("$BLOM_UNIT" == cgs) then - set EGMXDF = 1500.e4 - else - set EGMXDF = 1500. - endif - if ("$BLOM_VCOORD" == isopyc_bulkml) then - set CE = 1.0 - endif -else if ("$OCN_GRID" == tnx0.125v4) then - set BACLIN = 300. - set BATROP = 6. - set EGMNDF = 0. - set EGMXDF = 0. - set EDWMTH = "'step'" - set CWBDTS = .75e-4 - set CWBDLS = 25 - if ("$BLOM_UNIT" == cgs) then - set MDV2HI = .1 - set MDV2LO = .1 - set MDV4HI = 0. - set MDV4LO = 0. - set MDC2HI = 300.e4 - set MDC2LO = 100.e4 - else - set MDV2HI = .001 - set MDV2LO = .001 - set MDV4HI = 0. - set MDV4LO = 0. - set MDC2HI = 300. - set MDC2LO = 100. - endif - set VSC2HI = 0. - set VSC2LO = 0. - set VSC4HI = .06 - set VSC4LO = .06 - set LTEDTP = "'layer'" -else - echo "OCN_GRID is $OCN_GRID \n" - echo "$0 ERROR: Cannot deal with GRID equal to $OCN_GRID " - exit -1 -endif - -# set grid independent input files (iHAMOCC initial conditions) -set INIDIC = "'$DIN_LOC_ROOT/ocn/blom/inicon/glodapv2_Ct_preind_OMIPinit_20171107.nc'" -set INIALK = "'$DIN_LOC_ROOT/ocn/blom/inicon/glodapv2_At_OMIPinit_20171107.nc'" -set INIPO4 = "'$DIN_LOC_ROOT/ocn/blom/inicon/woa13_phosphate_OMIPinit_20171107.nc'" -set INIOXY = "'$DIN_LOC_ROOT/ocn/blom/inicon/woa13_oxygen_OMIPinit_20171107.nc'" -set ININO3 = "'$DIN_LOC_ROOT/ocn/blom/inicon/woa13_nitrate_OMIPinit_20171107.nc'" -set INISIL = "'$DIN_LOC_ROOT/ocn/blom/inicon/woa13_silicate_OMIPinit_20171107.nc'" -if ("$HAMOCC_CISO" == TRUE) then -set INID13C = "'$DIN_LOC_ROOT/ocn/blom/inicon/d13C_permil_20180609.nc'" -set INID14C = "'$DIN_LOC_ROOT/ocn/blom/inicon/d14C_permil_20180609.nc'" -else -set INID13C = "''" -set INID14C = "''" -endif - -# set grid dependent input files -if ("$OCN_GRID" == tnx2v1) then - set GRFILE = "'$DIN_LOC_ROOT/ocn/blom/grid/grid_tnx2v1_20130206.nc'" - set ICFILE = "'$DIN_LOC_ROOT/ocn/blom/inicon/inicon_tnx2v1_20130419.nc'" - set TDFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/tidal_dissipation_tnx2v1_20130419.nc'" - set MER_ORFILE = "'$DIN_LOC_ROOT/ocn/blom/grid/ocean_regions_tnx2v1_20190826.nc'" - set MER_MIFILE = "'$DIN_LOC_ROOT/ocn/blom/grid/mertra_index_tnx2v1_20190826.dat'" - set SEC_SIFILE = "'$DIN_LOC_ROOT/ocn/blom/grid/section_index_tnx2v1_20190826.dat'" - set SCFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/sss_clim_core_tnx2v1_20130927.nc'" - set FEDEPFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/dustdep_mhw2006_tnx2v1_20130506.nc'" - set SWACLIMFILE = "''" - set SEDPORFILE = "''" - if ("$BLOM_RIVER_NUTRIENTS" == TRUE) then - set RIVINFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/river_nutrients_GNEWS2000_tnx2v1_20170915.nc'" - else - set RIVINFILE = "''" - endif - if ("$BLOM_N_DEPOSITION" == TRUE) then - set NDEPFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/$NDEPFNAME'" - else - set NDEPFILE = "''" - endif -else if ("$OCN_GRID" == tnx1v4) then - set GRFILE = "'$DIN_LOC_ROOT/ocn/blom/grid/grid_tnx1v4_20170622.nc'" - set ICFILE = "'$DIN_LOC_ROOT/ocn/blom/inicon/inicon_tnx1v4_20170622.nc'" - set TDFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/tidal_dissipation_tnx1v4_20170605.nc'" - set MER_ORFILE = "'$DIN_LOC_ROOT/ocn/blom/grid/ocean_regions_tnx1v4_20190729.nc'" - set MER_MIFILE = "'$DIN_LOC_ROOT/ocn/blom/grid/mertra_index_tnx1v4_20190615.dat'" - set SEC_SIFILE = "'$DIN_LOC_ROOT/ocn/blom/grid/section_index_tnx1v4_20190611.dat'" - set CCFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/chlorophyll_concentration_tnx1v4_20170608.nc'" - set SCFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/sss_clim_core_tnx1v4_20170604.nc'" - set FEDEPFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/dustdep_mhw2006_tnx1v4_20171107.nc'" - set SEDPORFILE = "''" - if ("$HAMOCC_VSLS" == TRUE) then - set SWACLIMFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/Annual_clim_swa_tnx1v4_20210415.nc'" - else - set SWACLIMFILE = "''" - endif - if ("$BLOM_RIVER_NUTRIENTS" == TRUE) then - set RIVINFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/river_nutrients_GNEWS2000_tnx1v4_20170820.nc'" - else - set RIVINFILE = "''" - endif - if ("$BLOM_N_DEPOSITION" == TRUE) then - set NDEPFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/$NDEPFNAME'" - else - set NDEPFILE = "''" - endif -else if ("$OCN_GRID" == tnx0.25v4) then - set GRFILE = "'$DIN_LOC_ROOT/ocn/blom/grid/grid_tnx0.25v4_20170622.nc'" - set ICFILE = "'$DIN_LOC_ROOT/ocn/blom/inicon/inicon_tnx0.25v4_20170623.nc'" - set TDFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/tidal_dissipation_tnx0.25v4_20170626.nc'" - set MER_ORFILE = "'$DIN_LOC_ROOT/ocn/blom/grid/ocean_regions_tnx0.25v4_20190612.nc'" - set MER_MIFILE = "'$DIN_LOC_ROOT/ocn/blom/grid/mertra_index_tnx0.25v4_20190701.dat'" - set SEC_SIFILE = "'$DIN_LOC_ROOT/ocn/blom/grid/section_index_tnx0.25v4_20190612.dat'" - set CCFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/chlorophyll_concentration_tnx0.25v4_20170623.nc'" - set SCFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/sss_clim_core_tnx0.25v4_20170623.nc'" - set FEDEPFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/dustdep_mhw2006_tnx0.25v4_20181004.nc'" - set SWACLIMFILE = "''" - set SEDPORFILE = "''" - if ("$BLOM_RIVER_NUTRIENTS" == TRUE) then - set RIVINFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/river_nutrients_GNEWS2000_tnx0.25v4_20170821.nc'" - else - set RIVINFILE = "''" - endif - if ("$BLOM_N_DEPOSITION" == TRUE) then - set NDEPFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/$NDEPFNAME'" - else - set NDEPFILE = "''" - endif -else if ("$OCN_GRID" == tnx0.125v4) then - set GRFILE = "'$DIN_LOC_ROOT/ocn/blom/grid/grid_tnx0.125v4_20221013.nc'" - set ICFILE = "'$DIN_LOC_ROOT/ocn/blom/inicon/inicon_tnx0.125v4_20230318.nc'" - set TDFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/tidal_dissipation_tnx0.125v4_20221013.nc'" - set MER_ORFILE = "'$DIN_LOC_ROOT/ocn/blom/grid/ocean_regions_tnx0.125v4_20221013.nc'" - set MER_MIFILE = "'$DIN_LOC_ROOT/ocn/blom/grid/mertra_index_tnx0.125v4_20221013.dat'" - set SEC_SIFILE = "'$DIN_LOC_ROOT/ocn/blom/grid/section_index_tnx0.125v4_20221013.dat'" - set CCFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/chlorophyll_concentration_tnx0.125v4_20221013.nc'" - set SCFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/sss_clim_core_tnx0.125v4_20221013.nc'" - set FEDEPFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/dustdep_mhw2006_tnx0.125v4_20221013.nc'" - set SWACLIMFILE = "''" - set SEDPORFILE = "''" - if ("$BLOM_RIVER_NUTRIENTS" == TRUE) then - set RIVINFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/river_nutrients_GNEWS2000_tnx0.125v4_20221013.nc'" - else - set RIVINFILE = "''" - endif - if ("$BLOM_N_DEPOSITION" == TRUE) then - set NDEPFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/$NDEPFNAME'" - else - set NDEPFILE = "''" - endif -else - echo "$0 ERROR: Cannot deal with GRID = $OCN_GRID " - exit -1 -endif - - -#------------------------------------------------------------------------------ -# Create resolved namelist -#------------------------------------------------------------------------------ -foreach mem ("`seq $NINST_OCN`") - if ( ${NINST_OCN} == '1' ) then - set inststr = '' - else - set inststr = ("`printf '_%4.4d' $mem`") - endif - - # modify namelist variables as specified in user_nl_blom - foreach line ("`grep = $CASEROOT/user_nl_blom$inststr`") - if (`echo "$line" | tr -d ' ' | cut -c -1` != '#') then - set var = `echo "$line" | sed 's/=.*//' | tr '[a-z]' '[A-Z]'` - set val = `echo "$line" | sed 's/.*=//'` - eval 'set $var = "$val"' - endif - end - -cp ocn_in.readme $RUNDIR/. - -cat >! $RUNDIR/ocn_in$inststr << EOF -&LIMITS - NDAY1 = $NDAY1 - NDAY2 = $NDAY2 - IDATE = $IDATE - IDATE0 = $IDATE0 - RUNID = $RUNID - EXPCNF = $EXPCNF - RUNTYP = $RUNTYP - GRFILE = $GRFILE - ICFILE = $ICFILE - PREF = $PREF - BACLIN = $BACLIN - BATROP = $BATROP - MDV2HI = $MDV2HI - MDV2LO = $MDV2LO - MDV4HI = $MDV4HI - MDV4LO = $MDV4LO - MDC2HI = $MDC2HI - MDC2LO = $MDC2LO - VSC2HI = $VSC2HI - VSC2LO = $VSC2LO - VSC4HI = $VSC4HI - VSC4LO = $VSC4LO - CBAR = $CBAR - CB = $CB - CWBDTS = $CWBDTS - CWBDLS = $CWBDLS - MOMMTH = $MOMMTH - BMCMTH = $BMCMTH - RMPMTH = $RMPMTH - MLRTTP = $MLRTTP - RM0 = $RM0 - RM5 = $RM5 - CE = $CE - TDFILE = $TDFILE - NIWGF = $NIWGF - NIWBF = $NIWBF - NIWLF = $NIWLF - SWAMTH = $SWAMTH - JWTYPE = $JWTYPE - CHLOPT = $CHLOPT - CCFILE = $CCFILE - TRXDAY = $TRXDAY - SRXDAY = $SRXDAY - TRXDPT = $TRXDPT - SRXDPT = $SRXDPT - TRXLIM = $TRXLIM - SRXLIM = $SRXLIM - APTFLX = $APTFLX - APSFLX = $APSFLX - DITFLX = $DITFLX - DISFLX = $DISFLX - SRXBAL = $SRXBAL - SCFILE = $SCFILE - WAVSRC = $WAVSRC - SMTFRC = $SMTFRC - SPRFAC = $SPRFAC - ATM_PATH = $ATM_PATH - ITEST = $ITEST - JTEST = $JTEST - CNSVDI = $CNSVDI - CSDIAG = $CSDIAG - RSTFRQ = $RSTFRQ - RSTFMT = $RSTFMT - RSTCMP = $RSTCMP - IOTYPE = $IOTYPE -/ -EOF - -if ("$BLOM_VCOORD" == cntiso_hybrid) then -cat >>! $RUNDIR/ocn_in$inststr << EOF - -&VCOORD - VCOORD_TYPE = $VCOORD_TYPE - RECONSTRUCTION_METHOD = $RECONSTRUCTION_METHOD - DENSITY_LIMITING = $DENSITY_LIMITING - TRACER_LIMITING = $TRACER_LIMITING - VELOCITY_LIMITING = $VELOCITY_LIMITING - DENSITY_PC_UPPER_BNDR = $DENSITY_PC_UPPER_BNDR - DENSITY_PC_LOWER_BNDR = $DENSITY_PC_LOWER_BNDR - TRACER_PC_UPPER_BNDR = $TRACER_PC_UPPER_BNDR - TRACER_PC_LOWER_BNDR = $TRACER_PC_LOWER_BNDR - VELOCITY_PC_UPPER_BNDR = $VELOCITY_PC_UPPER_BNDR - VELOCITY_PC_LOWER_BNDR = $VELOCITY_PC_LOWER_BNDR - DPMIN_SURFACE = $DPMIN_SURFACE - DPMIN_INFLATION_FACTOR = $DPMIN_INFLATION_FACTOR - DPMIN_INTERIOR = $DPMIN_INTERIOR - DKTZU = $DKTZU - DKTZL = $DKTZL -/ -EOF -endif - -cat >>! $RUNDIR/ocn_in$inststr << EOF - -&DIFFUSION - EITMTH = $EITMTH - EDRITP = $EDRITP - EDWMTH = $EDWMTH - EDDF2D = $EDDF2D - EDSPRS = $EDSPRS - EGC = $EGC - EGGAM = $EGGAM - EGLSMN = $EGLSMN - EGMNDF = $EGMNDF - EGMXDF = $EGMXDF - EGIDFQ = $EGIDFQ - TBFILE = $TBFILE - RHISCF = $RHISCF - EDANIS = $EDANIS - REDI3D = $REDI3D - RHSCTP = $RHSCTP - RI0 = $RI0 - BDMTYP = $BDMTYP - BDMC1 = $BDMC1 - BDMC2 = $BDMC2 - BDMLDP = $BDMLDP - TKEPF = $TKEPF - SMOBLD = $SMOBLD - LNGMTP = $LNGMTP - LTEDTP = $LTEDTP -/ -EOF - -if ($?CWMTAG) then -cat >>! $RUNDIR/ocn_in$inststr << EOF - -&CWMOD - CWMTAG = $CWMTAG - CWMEDG = $CWMEDG - CWMI = $CWMI - CWMJ = $CWMJ - CWMWTH = $CWMWTH -/ -EOF -endif - -cat >>! $RUNDIR/ocn_in$inststr << EOF - -&MERDIA - MER_ORFILE = $MER_ORFILE - MER_MIFILE = $MER_MIFILE - MER_REGNAM = 'atlantic_arctic_ocean', 'atlantic_arctic_extended_ocean', 'indian_pacific_ocean', 'global_ocean' - MER_REGFLG(1,:) = 2, 4 - MER_REGFLG(2,:) = 2, 4, 6, 7, 8, 9 - MER_REGFLG(3,:) = 3, 5 - MER_REGFLG(4,:) = 0 - MER_MINLAT = -34., -34., -34., -90. - MER_MAXLAT = 90., 90., 90., 90. -/ - -&SECDIA - SEC_SIFILE = $SEC_SIFILE -/ - -&DIAPHY - GLB_FNAMETAG = $GLB_FNAMETAG - GLB_AVEPERIO = $GLB_AVEPERIO - GLB_FILEFREQ = $GLB_FILEFREQ - GLB_COMPFLAG = $GLB_COMPFLAG - GLB_NCFORMAT = $GLB_NCFORMAT - H2D_ABSWND = $H2D_ABSWND - H2D_ALB = $H2D_ALB - H2D_BTMSTR = $H2D_BTMSTR - H2D_BRNFLX = $H2D_BRNFLX - H2D_BRNPD = $H2D_BRNPD - H2D_DFL = $H2D_DFL - H2D_EVA = $H2D_EVA - H2D_FICE = $H2D_FICE - H2D_FMLTFZ = $H2D_FMLTFZ - H2D_HICE = $H2D_HICE - H2D_HMLTFZ = $H2D_HMLTFZ - H2D_HSNW = $H2D_HSNW - H2D_IAGE = $H2D_IAGE - H2D_IDKEDT = $H2D_IDKEDT - H2D_LAMULT = $H2D_LAMULT - H2D_LASL = $H2D_LASL - H2D_LIP = $H2D_LIP - H2D_MAXMLD = $H2D_MAXMLD - H2D_MLD = $H2D_MLD - H2D_MLTS = $H2D_MLTS - H2D_MLTSMN = $H2D_MLTSMN - H2D_MLTSMX = $H2D_MLTSMX - H2D_MLTSSQ = $H2D_MLTSSQ - H2D_MTKEUS = $H2D_MTKEUS - H2D_MTKENI = $H2D_MTKENI - H2D_MTKEBF = $H2D_MTKEBF - H2D_MTKERS = $H2D_MTKERS - H2D_MTKEPE = $H2D_MTKEPE - H2D_MTKEKE = $H2D_MTKEKE - H2D_MTY = $H2D_MTY - H2D_NSF = $H2D_NSF - H2D_PBOT = $H2D_PBOT - H2D_PSRF = $H2D_PSRF - H2D_RFIFLX = $H2D_RFIFLX - H2D_RNFFLX = $H2D_RNFFLX - H2D_SALFLX = $H2D_SALFLX - H2D_SALRLX = $H2D_SALRLX - H2D_SBOT = $H2D_SBOT - H2D_SEALV = $H2D_SEALV - H2D_SLVSQ = $H2D_SLVSQ - H2D_SFL = $H2D_SFL - H2D_SOP = $H2D_SOP - H2D_SIGMX = $H2D_SIGMX - H2D_SSS = $H2D_SSS - H2D_SSSSQ = $H2D_SSSSQ - H2D_SST = $H2D_SST - H2D_SSTSQ = $H2D_SSTSQ - H2D_SURFLX = $H2D_SURFLX - H2D_SURRLX = $H2D_SURRLX - H2D_SWA = $H2D_SWA - H2D_T20D = $H2D_T20D - H2D_TAUX = $H2D_TAUX - H2D_TAUY = $H2D_TAUY - H2D_TBOT = $H2D_TBOT - H2D_TICE = $H2D_TICE - H2D_TSRF = $H2D_TSRF - H2D_UB = $H2D_UB - H2D_UICE = $H2D_UICE - H2D_USTAR = $H2D_USTAR - H2D_USTAR3 = $H2D_USTAR3 - H2D_USTOKES = $H2D_USTOKES - H2D_VB = $H2D_VB - H2D_VICE = $H2D_VICE - H2D_VSTOKES = $H2D_VSTOKES - H2D_ZTX = $H2D_ZTX - LYR_BFSQ = $LYR_BFSQ - LYR_DIFDIA = $LYR_DIFDIA - LYR_DIFVMO = $LYR_DIFVMO - LYR_DIFVHO = $LYR_DIFVHO - LYR_DIFVSO = $LYR_DIFVSO - LYR_DIFINT = $LYR_DIFINT - LYR_DIFISO = $LYR_DIFISO - LYR_DP = $LYR_DP - LYR_DZ = $LYR_DZ - LYR_SALN = $LYR_SALN - LYR_TEMP = $LYR_TEMP - LYR_TRC = $LYR_TRC - LYR_UFLX = $LYR_UFLX - LYR_UTFLX = $LYR_UTFLX - LYR_USFLX = $LYR_USFLX - LYR_UMFLTD = $LYR_UMFLTD - LYR_UMFLSM = $LYR_UMFLSM - LYR_UTFLTD = $LYR_UTFLTD - LYR_UTFLSM = $LYR_UTFLSM - LYR_UTFLLD = $LYR_UTFLLD - LYR_USFLTD = $LYR_USFLTD - LYR_USFLSM = $LYR_USFLSM - LYR_USFLLD = $LYR_USFLLD - LYR_UVEL = $LYR_UVEL - LYR_VFLX = $LYR_VFLX - LYR_VTFLX = $LYR_VTFLX - LYR_VSFLX = $LYR_VSFLX - LYR_VMFLTD = $LYR_VMFLTD - LYR_VMFLSM = $LYR_VMFLSM - LYR_VTFLTD = $LYR_VTFLTD - LYR_VTFLSM = $LYR_VTFLSM - LYR_VTFLLD = $LYR_VTFLLD - LYR_VSFLTD = $LYR_VSFLTD - LYR_VSFLSM = $LYR_VSFLSM - LYR_VSFLLD = $LYR_VSFLLD - LYR_VVEL = $LYR_VVEL - LYR_WFLX = $LYR_WFLX - LYR_WFLX2 = $LYR_WFLX2 - LYR_PV = $LYR_PV - LYR_TKE = $LYR_TKE - LYR_GLS_PSI = $LYR_GLS_PSI - LYR_IDLAGE = $LYR_IDLAGE - LVL_BFSQ = $LVL_BFSQ - LVL_DIFDIA = $LVL_DIFDIA - LVL_DIFVMO = $LVL_DIFVMO - LVL_DIFVHO = $LVL_DIFVHO - LVL_DIFVSO = $LVL_DIFVSO - LVL_DIFINT = $LVL_DIFINT - LVL_DIFISO = $LVL_DIFISO - LVL_DZ = $LVL_DZ - LVL_SALN = $LVL_SALN - LVL_TEMP = $LVL_TEMP - LVL_TRC = $LVL_TRC - LVL_UFLX = $LVL_UFLX - LVL_UTFLX = $LVL_UTFLX - LVL_USFLX = $LVL_USFLX - LVL_UMFLTD = $LVL_UMFLTD - LVL_UMFLSM = $LVL_UMFLSM - LVL_UTFLTD = $LVL_UTFLTD - LVL_UTFLSM = $LVL_UTFLSM - LVL_UTFLLD = $LVL_UTFLLD - LVL_USFLTD = $LVL_USFLTD - LVL_USFLSM = $LVL_USFLSM - LVL_USFLLD = $LVL_USFLLD - LVL_UVEL = $LVL_UVEL - LVL_VFLX = $LVL_VFLX - LVL_VTFLX = $LVL_VTFLX - LVL_VSFLX = $LVL_VSFLX - LVL_VMFLTD = $LVL_VMFLTD - LVL_VMFLSM = $LVL_VMFLSM - LVL_VTFLTD = $LVL_VTFLTD - LVL_VTFLSM = $LVL_VTFLSM - LVL_VTFLLD = $LVL_VTFLLD - LVL_VSFLTD = $LVL_VSFLTD - LVL_VSFLSM = $LVL_VSFLSM - LVL_VSFLLD = $LVL_VSFLLD - LVL_VVEL = $LVL_VVEL - LVL_WFLX = $LVL_WFLX - LVL_WFLX2 = $LVL_WFLX2 - LVL_PV = $LVL_PV - LVL_TKE = $LVL_TKE - LVL_GLS_PSI = $LVL_GLS_PSI - LVL_IDLAGE = $LVL_IDLAGE - MSC_MMFLXL = $MSC_MMFLXL - MSC_MMFLXD = $MSC_MMFLXD - MSC_MMFTDL = $MSC_MMFTDL - MSC_MMFSML = $MSC_MMFSML - MSC_MMFTDD = $MSC_MMFTDD - MSC_MMFSMD = $MSC_MMFSMD - MSC_MHFLX = $MSC_MHFLX - MSC_MHFTD = $MSC_MHFTD - MSC_MHFSM = $MSC_MHFSM - MSC_MHFLD = $MSC_MHFLD - MSC_MSFLX = $MSC_MSFLX - MSC_MSFTD = $MSC_MSFTD - MSC_MSFSM = $MSC_MSFSM - MSC_MSFLD = $MSC_MSFLD - MSC_VOLTR = $MSC_VOLTR - MSC_MASSGS = $MSC_MASSGS - MSC_VOLGS = $MSC_VOLGS - MSC_SALNGA = $MSC_SALNGA - MSC_TEMPGA = $MSC_TEMPGA - MSC_SSSGA = $MSC_SSSGA - MSC_SSTGA = $MSC_SSTGA -/ -EOF - -if ("$ecosys" == TRUE) then -cat >>! $RUNDIR/ocn_in$inststr << EOF - -&BGCNML - ATM_CO2 = $CCSM_CO2_PPMV - FEDEPFILE = $FEDEPFILE - SWACLIMFILE = $SWACLIMFILE - DO_RIVINPT = $DO_RIVINPT - RIVINFILE = $RIVINFILE - DO_NDEP = $DO_NDEP - NDEPFILE = $NDEPFILE - DO_OALK = $DO_OALK - DO_SEDSPINUP = $DO_SEDSPINUP - SEDSPIN_YR_S = $SEDSPIN_YR_S - SEDSPIN_YR_E = $SEDSPIN_YR_E - SEDSPIN_NCYC = $SEDSPIN_NCYC - INIDIC = $INIDIC - INIALK = $INIALK - INIPO4 = $INIPO4 - INIOXY = $INIOXY - ININO3 = $ININO3 - INISIL = $INISIL - INID13C = $INID13C - INID14C = $INID14C - WITH_DMSPH = $WITH_DMSPH - PI_PH_FILE = $PI_PH_FILE - L_3DVARSEDPOR = $L_3DVARSEDPOR - SEDPORFILE = $SEDPORFILE -/ - -&BGCOAFX - OALKSCEN = $BGCOAFX_OALKSCEN - OALKFILE = $BGCOAFX_OALKFILE - ADDALK = $BGCOAFX_ADDALK - CDRMIP_LATMAX = $BGCOAFX_CDRMIP_LATMAX - CDRMIP_LATMIN = $BGCOAFX_CDRMIP_LATMIN - RAMP_START = $BGCOAFX_RAMP_START - RAMP_END = $BGCOAFX_RAMP_END -/ - -&DIABGC - GLB_FNAMETAG = $BGC_FNAMETAG - GLB_AVEPERIO = $BGC_AVEPERIO - GLB_FILEFREQ = $BGC_FILEFREQ - GLB_COMPFLAG = $BGC_COMPFLAG - GLB_NCFORMAT = $BGC_NCFORMAT - GLB_INVENTORY = $BGC_INVENTORY - SRF_PHOSPH = $SRF_PHOSPH - SRF_OXYGEN = $SRF_OXYGEN - SRF_IRON = $SRF_IRON - SRF_ANO3 = $SRF_ANO3 - SRF_ALKALI = $SRF_ALKALI - SRF_SILICA = $SRF_SILICA - SRF_DIC = $SRF_DIC - SRF_PHYTO = $SRF_PHYTO - SRF_PH = $SRF_PH - SRF_EXPORT = $SRF_EXPORT - 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 - SRF_NIFLUX = $SRF_NIFLUX - SRF_N2OFX = $SRF_N2OFX - SRF_DMSFLUX = $SRF_DMSFLUX - SRF_DMS = $SRF_DMS - SRF_DMSPROD = $SRF_DMSPROD - SRF_DMS_BAC = $SRF_DMS_BAC - SRF_DMS_UV = $SRF_DMS_UV - SRF_ATMCO2 = $SRF_ATMCO2 - SRF_ATMO2 = $SRF_ATMO2 - SRF_ATMN2 = $SRF_ATMN2 - SRF_NATDIC = $SRF_NATDIC - SRF_NATALKALI = $SRF_NATALKALI - SRF_NATPH = $SRF_NATPH - SRF_NATPCO2 = $SRF_NATPCO2 - SRF_NATCO2FX = $SRF_NATCO2FX - SRF_CO213FXD = $SRF_CO213FXD - SRF_CO213FXU = $SRF_CO213FXU - SRF_CO214FXD = $SRF_CO214FXD - SRF_CO214FXU = $SRF_CO214FXU - SRF_CFC11 = $SRF_CFC11 - SRF_CFC12 = $SRF_CFC12 - SRF_SF6 = $SRF_SF6 - SRF_BROMO = $SRF_BROMO - SRF_BROMOFX = $SRF_BROMOFX - INT_BROMOPRO = $INT_BROMOPRO - INT_BROMOUV = $INT_BROMOUV - INT_PHOSY = $INT_PHOSY - INT_NFIX = $INT_NFIX - INT_DNIT = $INT_DNIT - FLX_NDEP = $FLX_NDEP - FLX_OALK = $FLX_OALK - FLX_CAR0100 = $FLX_CAR0100 - FLX_CAR0500 = $FLX_CAR0500 - FLX_CAR1000 = $FLX_CAR1000 - FLX_CAR2000 = $FLX_CAR2000 - FLX_CAR4000 = $FLX_CAR4000 - FLX_CAR_BOT = $FLX_CAR_BOT - FLX_BSI0100 = $FLX_BSI0100 - FLX_BSI0500 = $FLX_BSI0500 - FLX_BSI1000 = $FLX_BSI1000 - FLX_BSI2000 = $FLX_BSI2000 - FLX_BSI4000 = $FLX_BSI4000 - FLX_BSI_BOT = $FLX_BSI_BOT - FLX_CAL0100 = $FLX_CAL0100 - FLX_CAL0500 = $FLX_CAL0500 - FLX_CAL1000 = $FLX_CAL1000 - FLX_CAL2000 = $FLX_CAL2000 - FLX_CAL4000 = $FLX_CAL4000 - FLX_CAL_BOT = $FLX_CAL_BOT - LYR_PHYTO = $LYR_PHYTO - LYR_GRAZER = $LYR_GRAZER - LYR_DOC = $LYR_DOC - LYR_PHOSY = $LYR_PHOSY - LYR_PHOSPH = $LYR_PHOSPH - LYR_OXYGEN = $LYR_OXYGEN - LYR_IRON = $LYR_IRON - LYR_ANO3 = $LYR_ANO3 - LYR_ALKALI = $LYR_ALKALI - LYR_SILICA = $LYR_SILICA - LYR_DIC = $LYR_DIC - LYR_POC = $LYR_POC - LYR_CALC = $LYR_CALC - LYR_OPAL = $LYR_OPAL - LYR_CO3 = $LYR_CO3 - LYR_N2O = $LYR_N2O - LYR_PH = $LYR_PH - LYR_OMEGAC = $LYR_OMEGAC - LYR_OMEGAA = $LYR_OMEGAA - LYR_PREFO2 = $LYR_PREFO2 - LYR_O2SAT = $LYR_O2SAT - LYR_PREFPO4 = $LYR_PREFPO4 - LYR_PREFALK = $LYR_PREFALK - LYR_PREFDIC = $LYR_PREFDIC - LYR_DICSAT = $LYR_DICSAT - LYR_NATDIC = $LYR_NATDIC - LYR_NATALKALI = $LYR_NATALKALI - LYR_NATCO3 = $LYR_NATCO3 - LYR_NATCALC = $LYR_NATCALC - LYR_NATPH = $LYR_NATPH - LYR_NATOMEGAC = $LYR_NATOMEGAC - LYR_NATOMEGAA = $LYR_NATOMEGAA - LYR_DIC13 = $LYR_DIC13 - LYR_DIC14 = $LYR_DIC14 - LYR_D13C = $LYR_D13C - LYR_D14C = $LYR_D14C - LYR_BIGD14C = $LYR_BIGD14C - LYR_POC13 = $LYR_POC13 - LYR_DOC13 = $LYR_DOC13 - LYR_CALC13 = $LYR_CALC13 - LYR_PHYTO13 = $LYR_PHYTO13 - LYR_GRAZER13 = $LYR_GRAZER13 - LYR_CFC11 = $LYR_CFC11 - LYR_CFC12 = $LYR_CFC12 - LYR_SF6 = $LYR_SF6 - LYR_NOS = $LYR_NOS - LYR_WPHY = $LYR_WPHY - LYR_WNOS = $LYR_WNOS - LYR_EPS = $LYR_EPS - LYR_ASIZE = $LYR_ASIZE - LYR_DP = $BGC_DP - LYR_BROMO = $LYR_BROMO - LVL_PHYTO = $LVL_PHYTO - LVL_GRAZER = $LVL_GRAZER - LVL_DOC = $LVL_DOC - LVL_PHOSY = $LVL_PHOSY - LVL_PHOSPH = $LVL_PHOSPH - LVL_OXYGEN = $LVL_OXYGEN - LVL_IRON = $LVL_IRON - LVL_ANO3 = $LVL_ANO3 - LVL_ALKALI = $LVL_ALKALI - LVL_SILICA = $LVL_SILICA - LVL_DIC = $LVL_DIC - LVL_POC = $LVL_POC - LVL_CALC = $LVL_CALC - LVL_OPAL = $LVL_OPAL - LVL_CO3 = $LVL_CO3 - LVL_N2O = $LVL_N2O - LVL_PH = $LVL_PH - LVL_OMEGAC = $LVL_OMEGAC - LVL_OMEGAA = $LVL_OMEGAA - LVL_PREFO2 = $LVL_PREFO2 - LVL_O2SAT = $LVL_O2SAT - LVL_PREFPO4 = $LVL_PREFPO4 - LVL_PREFALK = $LVL_PREFALK - LVL_PREFDIC = $LVL_PREFDIC - LVL_DICSAT = $LVL_DICSAT - LVL_NATDIC = $LVL_NATDIC - LVL_NATALKALI = $LVL_NATALKALI - LVL_NATCO3 = $LVL_NATCO3 - LVL_NATCALC = $LVL_NATCALC - LVL_NATPH = $LVL_NATPH - LVL_NATOMEGAC = $LVL_NATOMEGAC - LVL_NATOMEGAA = $LVL_NATOMEGAA - LVL_DIC13 = $LVL_DIC13 - LVL_DIC14 = $LVL_DIC14 - LVL_D13C = $LVL_D13C - LVL_POC13 = $LVL_POC13 - LVL_DOC13 = $LVL_DOC13 - LVL_CALC13 = $LVL_CALC13 - LVL_PHYTO13 = $LVL_PHYTO13 - LVL_GRAZER13 = $LVL_GRAZER13 - LVL_CFC11 = $LVL_CFC11 - LVL_CFC12 = $LVL_CFC12 - LVL_SF6 = $LVL_SF6 - LVL_NOS = $LVL_NOS - LVL_WPHY = $LVL_WPHY - LVL_WNOS = $LVL_WNOS - LVL_EPS = $LVL_EPS - LVL_ASIZE = $LVL_ASIZE - LVL_BROMO = $LVL_BROMO - FLX_SEDIFFIC = $FLX_SEDIFFIC - FLX_SEDIFFAL = $FLX_SEDIFFAL - FLX_SEDIFFPH = $FLX_SEDIFFPH - FLX_SEDIFFOX = $FLX_SEDIFFOX - FLX_SEDIFFN2 = $FLX_SEDIFFN2 - FLX_SEDIFFNO3 = $FLX_SEDIFFNO3 - FLX_SEDIFFSI = $FLX_SEDIFFSI - SDM_POWAIC = $SDM_POWAIC - SDM_POWAAL = $SDM_POWAAL - SDM_POWAPH = $SDM_POWAPH - SDM_POWAOX = $SDM_POWAOX - SDM_POWN2 = $SDM_POWN2 - SDM_POWNO3 = $SDM_POWNO3 - SDM_POWASI = $SDM_POWASI - SDM_SSSO12 = $SDM_SSSO12 - SDM_SSSSIL = $SDM_SSSSIL - SDM_SSSC12 = $SDM_SSSC12 - SDM_SSSTER = $SDM_SSSTER - BUR_SSSO12 = $BUR_SSSO12 - BUR_SSSSIL = $BUR_SSSSIL - BUR_SSSC12 = $BUR_SSSC12 - BUR_SSSTER = $BUR_SSSTER -/ -EOF -endif - -end ## foreach mem ("`seq $NINST_OCN`") - -#------------------------------------------------------------------------------ -# Generate blom.input_data_list -#------------------------------------------------------------------------------ - -cat > $CASEBUILD/blom.input_data_list << EOF -grid_file = `echo $GRFILE | tr -d '"' | tr -d "'"` -meridional_transport_index_file = `echo $MER_MIFILE | tr -d '"' | tr -d "'"` -meridional_transport_basin_file = `echo $MER_ORFILE | tr -d '"' | tr -d "'"` -section_index_file = `echo $SEC_SIFILE | tr -d '"' | tr -d "'"` -tidal_dissipation_file = `echo $TDFILE | tr -d '"' | tr -d "'"` -EOF -if ($SWAMTH == "'chlorophyll'") then -cat >> $CASEBUILD/blom.input_data_list << EOF -chlorophyll_concentration_file = `echo $CCFILE | tr -d '"' | tr -d "'"` -EOF -endif -if ($SRXDAY != "0.") then -cat >> $CASEBUILD/blom.input_data_list << EOF -sss_climatology_file = `echo $SCFILE | tr -d '"' | tr -d "'"` -EOF -endif - -# iHAMOCC boundary conditions -if ($ecosys == TRUE) then -cat >> $CASEBUILD/blom.input_data_list << EOF -dust_file = `echo $FEDEPFILE | tr -d '"' | tr -d "'"` -EOF - if ($BLOM_RIVER_NUTRIENTS == TRUE) then -cat >> $CASEBUILD/blom.input_data_list << EOF -river_file = `echo $RIVINFILE | tr -d '"' | tr -d "'"` -EOF - endif - if ($BLOM_N_DEPOSITION == TRUE) then -cat >> $CASEBUILD/blom.input_data_list << EOF -n_deposition_file = `echo $NDEPFILE | tr -d '"' | tr -d "'"` -EOF - endif - if ($BGCOAFX_OALKFILE != "''") then -cat >> $CASEBUILD/blom.input_data_list << EOF -oafx_file = `echo $BGCOAFX_OALKFILE | tr -d '"' | tr -d "'"` -EOF - endif - if ($HAMOCC_VSLS == TRUE) then -cat >> $CASEBUILD/blom.input_data_list << EOF -swa_clim_file = `echo $SWACLIMFILE | tr -d '"' | tr -d "'"` -EOF - endif - if ($L_3DVARSEDPOR == TRUE) then -cat >> $CASEBUILD/blom.input_data_list << EOF -sed_porosity_file = `echo $SEDPORFILE | tr -d '"' | tr -d "'"` -EOF - endif -endif - -# BLOM initial conditions -cat >> $CASEBUILD/blom.input_data_list << EOF -inicon_file = `echo $ICFILE | tr -d '"' | tr -d "'"` -EOF - - -# iHAMOCC initial conditions -if ($ecosys == TRUE) then -cat >> $CASEBUILD/blom.input_data_list << EOF -inidic_file = `echo $INIDIC | tr -d '"' | tr -d "'"` -inialk_file = `echo $INIALK | tr -d '"' | tr -d "'"` -inipo4_file = `echo $INIPO4 | tr -d '"' | tr -d "'"` -inioxy_file = `echo $INIOXY | tr -d '"' | tr -d "'"` -inino3_file = `echo $ININO3 | tr -d '"' | tr -d "'"` -inisil_file = `echo $INISIL | tr -d '"' | tr -d "'"` -EOF - if ($HAMOCC_CISO == TRUE) then -cat >> $CASEBUILD/blom.input_data_list << EOF -inic13_file = `echo $INID13C | tr -d '"' | tr -d "'"` -inic14_file = `echo $INID14C | tr -d '"' | tr -d "'"` -EOF - endif - if ($RUN_TYPE == startup) then - if ($ICFILE =~ *.blom.r.*) then -cat >> $CASEBUILD/blom.input_data_list << EOF -inicon_bgc_file = `echo $ICFILE | sed 's/.blom.r./.blom.rbgc./' | tr -d '"' | tr -d "'"` -EOF - else if ($ICFILE =~ *.micom.r.*) then -cat >> $CASEBUILD/blom.input_data_list << EOF -inicon_bgc_file = `echo $ICFILE | sed 's/.micom.r./.micom.rbgc./' | tr -d '"' | tr -d "'"` -EOF - endif - endif -endif - - +#!/usr/bin/env python3 + +"""BLOM namelist creator +""" + +# Typically ignore this. +# pylint: disable=invalid-name + +# Disable these because this is our standard setup +# pylint: disable=wildcard-import,unused-wildcard-import,wrong-import-position + +import os, shutil, sys, glob, filecmp, imp, re + +CIMEROOT = os.environ.get("CIMEROOT") +if CIMEROOT is None: + raise SystemExit("ERROR: must set CIMEROOT environment variable") +sys.path.append(os.path.join(CIMEROOT, "CIME", "Tools")) + +from standard_script_setup import * +from CIME.case import Case +from CIME.nmlgen import NamelistGenerator +from CIME.utils import expect +from CIME.utils import run_cmd_no_fail, expect +from CIME.utils import run_cmd +from CIME.buildnml import create_namelist_infile, parse_input + +import glob, shutil +logger = logging.getLogger(__name__) + +# pylint: disable=too-many-arguments,too-many-locals,too-many-branches,too-many-statements +#################################################################################### +def _create_namelists(case, confdir, infile, nmlgen): +#################################################################################### + + """Write out the namelist for this component. + + Most arguments are the same as those for `NamelistGenerator`. + The `confdir` argument is used to specify the directory in which output files will be placed. + """ + + CASEROOT = case.get_value("CASEROOT") + OCN_GRID = case.get_value("OCN_GRID") + BLOM_VCOORD = case.get_value("BLOM_VCOORD") + BLOM_UNIT = case.get_value("BLOM_UNIT") + DIN_LOC_ROOT = case.get_value("DIN_LOC_ROOT") + RUN_TYPE = case.get_value("RUN_TYPE") + CONTINUE_RUN = case.get_value("CONTINUE_RUN") + CASEBUILD = case.get_value("CASEBUILD") + CCSM_CO2_PPMV = case.get_value("CCSM_CO2_PPMV") + OCN_NCPL = case.get_value("OCN_NCPL") + BLOM_COUPLING = case.get_value("BLOM_COUPLING") + RUNDIR = case.get_value("RUNDIR") + BLOM_TRACER_MODULES = case.get_value("BLOM_TRACER_MODULES") + BLOM_RIVER_NUTRIENTS = case.get_value("BLOM_RIVER_NUTRIENTS") + BLOM_N_DEPOSITION = case.get_value("BLOM_N_DEPOSITION") + BLOM_NDEP_SCENARIO = case.get_value("BLOM_NDEP_SCENARIO") + HAMOCC_VSLS = case.get_value("HAMOCC_VSLS") + HAMOCC_CISO = case.get_value("HAMOCC_CISO") + HAMOCC_SEDSPINUP = case.get_value("HAMOCC_SEDSPINUP") + HAMOCC_SEDSPINUP_YR_START = case.get_value("HAMOCC_SEDSPINUP_YR_START") + HAMOCC_SEDSPINUP_YR_END = case.get_value("HAMOCC_SEDSPINUP_YR_END") + HAMOCC_SEDSPINUP_NCYCLE = case.get_value("HAMOCC_SEDSPINUP_NCYCLE") + RUN_STARTDATE = case.get_value("RUN_STARTDATE") + PIO_TYPENAME_OCN = case.get_value("PIO_TYPENAME_OCN") + PIO_NETCDF_FORMAT_OCN = case.get_value("PIO_NETCDF_FORMAT_OCN") + NINST_OCN = case.get_value("NINST_OCN") + TEST = case.get_value("TEST") + + config['ocn_comp'] = case.get_value("COMP_OCN") + + YEAR0 = `echo $RUN_STARTDATE | cut -c1-4 ` + MONTH0 = `echo $RUN_STARTDATE | cut -c6-7 ` + DAY0 = `echo $RUN_STARTDATE | cut -c9-10` + + #---------------------------------------------------- + # Initialize namelist defaults + #---------------------------------------------------- + nmlgen.init_defaults(infile, config) + + #---------------------------------------------------- + # Write out namelist groups + #---------------------------------------------------- + groups=['limit'] + + namelist_file = os.path.join(confdir, "ocn_in") + nmlgen.write_output_file(namelist_file, data_list_path, groups=groups, sorted_groups=False) + + #logger.debug("blom: grid is %s" %(hgrid)) + #logger.debug("blom: physics is %s "%phys) + +############################################################################### +def buildnml(case, caseroot, compname): +############################################################################### + """Build the blom namelist """ + + # Build the component namelist + if compname != "blom": + raise AttributeError + comp_root_dir_ocn = case.get_value("COMP_ROOT_DIR_OCN") + srcroot = case.get_value("SRCROOT") + rundir = case.get_value("RUNDIR") + ninst = case.get_value("NINST_OCN") + + #---------------------------------------------------- + # Construct the namelist generator + #---------------------------------------------------- + # determine directory for user modified namelist_definitions.xml and namelist_defaults.xml + user_xml_dir = os.path.join(caseroot, "SourceMods", "src.blom") + expect (os.path.isdir(user_xml_dir), + "user_xml_dir %s does not exist " %user_xml_dir) + + # user definition *replaces* existing definition. + namelist_xml_dir = os.path.join(comp_root_dir_ocn, "cime_config") + definition_file = [os.path.join(namelist_xml_dir, "namelist_definition_blom.xml")] + user_definition = os.path.join(user_xml_dir, "namelist_definition_blom.xml") + if os.path.isfile(user_definition): + definition_file = [user_definition] + for file_ in definition_file: + expect(os.path.isfile(file_), "Namelist XML file %s not found!" % file_) + + # Create the namelist generator object - independent of instance + nmlgen = NamelistGenerator(case, definition_file) + + #---------------------------------------------------- + # Loop over instances + #---------------------------------------------------- + for inst_counter in range(1, ninst+1): + + # determine instance string + inst_string = "" + if ninst > 1: + inst_string = '_' + '%04d' % inst_counter + + # If multi-instance case does not have restart file, use + # single-case restart for each instance + rpointer = "rpointer.ice" + if (os.path.isfile(os.path.join(rundir,rpointer)) and + (not os.path.isfile(os.path.join(rundir,rpointer + inst_string)))): + shutil.copy(os.path.join(rundir, rpointer), + os.path.join(rundir, rpointer + inst_string)) + + inst_string_label = inst_string + if not inst_string_label: + inst_string_label = "\"\"" + + # create namelist_infile using user_nl_file as input + user_nl_file = os.path.join(caseroot, "user_nl_blom" + inst_string) + expect(os.path.isfile(user_nl_file), + "Missing required user_nl_file %s " %(user_nl_file)) + infile = os.path.join(confdir, "namelist_infile") + create_namelist_infile(case, user_nl_file, infile) + namelist_infile = [infile] + + # create namelist + _create_namelists(case, confdir, namelist_infile, nmlgen) + + # copy namelist files to rundir + if os.path.isdir(rundir): + file1 = os.path.join(confdir, "ice_in") + file2 = os.path.join(rundir, "ice_in") + if inst_string: + file2 += inst_string + logger.debug("BLOM namelist copy: file1 %s file2 %s " %(file1, file2)) + shutil.copy2(file1, file2) + +def _strip_comments(fh, token="!"): + ''' strip anything after token in each line of fh ''' + for line in fh: + s = line.split(token, 1)[0].strip() + if s: + yield s + + +############################################################################### +def _main_func(): + + caseroot = parse_input(sys.argv) + with Case(caseroot, read_only=False) as case: + buildnml(case, caseroot, "blom") + +if __name__ == "__main__": + _main_func() diff --git a/cime_config/buildnml.csh b/cime_config/buildnml.csh new file mode 100644 index 00000000..46388741 --- /dev/null +++ b/cime_config/buildnml.csh @@ -0,0 +1,1636 @@ +#! /bin/csh -f + +#------------------------------------------------------------------------------ +# Get variables from Case XML-files +#------------------------------------------------------------------------------ + +set CASEROOT = `./xmlquery CASEROOT --value` +set OCN_GRID = `./xmlquery OCN_GRID --value` +set BLOM_VCOORD = `./xmlquery BLOM_VCOORD --value` +set BLOM_UNIT = `./xmlquery BLOM_UNIT --value` +set DIN_LOC_ROOT = `./xmlquery DIN_LOC_ROOT --value` +set RUN_TYPE = `./xmlquery RUN_TYPE --value` +set CONTINUE_RUN = `./xmlquery CONTINUE_RUN --value` +set CASEBUILD = `./xmlquery CASEBUILD --value` +set CCSM_CO2_PPMV = `./xmlquery CCSM_CO2_PPMV --value` +set OCN_NCPL = `./xmlquery OCN_NCPL --value` +set BLOM_COUPLING = `./xmlquery BLOM_COUPLING --value` +set RUNDIR = `./xmlquery RUNDIR --value` +set BLOM_TRACER_MODULES = `./xmlquery BLOM_TRACER_MODULES --value` +set BLOM_RIVER_NUTRIENTS = `./xmlquery BLOM_RIVER_NUTRIENTS --value` +set BLOM_N_DEPOSITION = `./xmlquery BLOM_N_DEPOSITION --value` +set BLOM_NDEP_SCENARIO = `./xmlquery BLOM_NDEP_SCENARIO --value` +set HAMOCC_VSLS = `./xmlquery HAMOCC_VSLS --value` +set HAMOCC_CISO = `./xmlquery HAMOCC_CISO --value` +set HAMOCC_SEDSPINUP = `./xmlquery HAMOCC_SEDSPINUP --value` +set HAMOCC_SEDSPINUP_YR_START = `./xmlquery HAMOCC_SEDSPINUP_YR_START --value` +set HAMOCC_SEDSPINUP_YR_END = `./xmlquery HAMOCC_SEDSPINUP_YR_END --value` +set HAMOCC_SEDSPINUP_NCYCLE = `./xmlquery HAMOCC_SEDSPINUP_NCYCLE --value` +set RUN_STARTDATE = `./xmlquery RUN_STARTDATE --value` +set PIO_TYPENAME_OCN = `./xmlquery PIO_TYPENAME_OCN --value` +set PIO_NETCDF_FORMAT_OCN = `./xmlquery PIO_NETCDF_FORMAT_OCN --value` +set NINST_OCN = `./xmlquery NINST_OCN --value` +set TEST=`./xmlquery TEST --value` + +#------------------------------------------------------------------------------ +# Check if HAMOCC is requested +#------------------------------------------------------------------------------ + +set ecosys = FALSE +set tracers = (`echo $BLOM_TRACER_MODULES`) +if ($#tracers != 0) then + foreach module ($tracers) + if ($module == ecosys) then + set ecosys = TRUE + endif + end +endif + +#------------------------------------------------------------------------------ +# Set RUN_TYPE to 'continue' if CONTINUE_RUN equals TRUE +#------------------------------------------------------------------------------ + +if ("$CONTINUE_RUN" == TRUE) then + set RUN_TYPE = continue +endif + +#------------------------------------------------------------------------------ +# Get start date +#------------------------------------------------------------------------------ + +set YEAR0 = `echo $RUN_STARTDATE | cut -c1-4 ` +set MONTH0 = `echo $RUN_STARTDATE | cut -c6-7 ` +set DAY0 = `echo $RUN_STARTDATE | cut -c9-10` + +#------------------------------------------------------------------------------ +# Set namelist variables +#------------------------------------------------------------------------------ + +#------------------------------ +# set LIMITS defaults +#------------------------------ +set NDAY1 = 0 +set NDAY2 = 0 +set IDATE = $YEAR0$MONTH0$DAY0 +set IDATE0 = $YEAR0$MONTH0$DAY0 +set RUNID = "'unset'" +set EXPCNF = "'cesm'" +set RUNTYP = "'$RUN_TYPE'" +set GRFILE = "'unset'" +set ICFILE = "'unset'" +if ("$BLOM_UNIT" == cgs) then + set PREF = 2000.e5 +else + set PREF = 2000.e4 +endif +set BACLIN = 1800. +set BATROP = 36. +if ("$BLOM_UNIT" == cgs) then + set MDV2HI = 2. + set MDV2LO = .4 + set MDV4HI = 0. + set MDV4LO = 0. + set MDC2HI = 5000.e4 + set MDC2LO = 300.e4 +else + set MDV2HI = .02 + set MDV2LO = .004 + set MDV4HI = 0. + set MDV4LO = 0. + set MDC2HI = 5000. + set MDC2LO = 300. +endif +set VSC2HI = .5 +set VSC2LO = .5 +set VSC4HI = 0. +set VSC4LO = 0. +if ("$BLOM_UNIT" == cgs) then + set CBAR = 5. +else + set CBAR = .05 +endif +set CB = .002 +set CWBDTS = 5.e-5 +set CWBDLS = 25. +set MOMMTH = "'enscon'" +set BMCMTH = "'uc'" +set RMPMTH = "'eitvel'" +set MLRTTP = "'constant'" +set RM0 = 1.2 +set RM5 = 0. +set CE = .06 +set TDFILE = "'unset'" +set NIWGF = 0. +set NIWBF = .35 +set NIWLF = .5 +set SWAMTH = "'jerlov'" +set JWTYPE = 3 +set CHLOPT = "'climatology'" +set CCFILE = "'unset'" +set TRXDAY = 0. +set SRXDAY = 0. +set TRXDPT = 1. +set SRXDPT = 1. +set TRXLIM = 1.5 +set SRXLIM = .5 +set APTFLX = .false. +set APSFLX = .false. +set DITFLX = .false. +set DISFLX = .false. +set SRXBAL = .false. +set SCFILE = "'unset'" +set WAVSRC = "'none'" +set SMTFRC = .true. +set SPRFAC = .false. +set ATM_PATH = "'unset'" +set ITEST = 60 +set JTEST = 60 +set CNSVDI = .false. +set CSDIAG = .false. +set RSTFRQ = 1 +if ("$PIO_NETCDF_FORMAT_OCN" == 64bit_offset) then + set RSTFMT = 1 +else + set RSTFMT = 0 +endif +set RSTCMP = 0 +if ("$PIO_TYPENAME_OCN" == pnetcdf) then + set IOTYPE = 1 +else + set IOTYPE = 0 +endif + +#------------------------------ +# set VCOORD defaults +#------------------------------ +set VCOORD_TYPE = "'$BLOM_VCOORD'" +set RECONSTRUCTION_METHOD = "'ppm'" +set DENSITY_LIMITING = "'monotonic'" +set TRACER_LIMITING = "'non_oscillatory'" +set VELOCITY_LIMITING = "'non_oscillatory'" +set DENSITY_PC_UPPER_BNDR = .false. +set DENSITY_PC_LOWER_BNDR = .false. +set TRACER_PC_UPPER_BNDR = .true. +set TRACER_PC_LOWER_BNDR = .false. +set VELOCITY_PC_UPPER_BNDR = .true. +set VELOCITY_PC_LOWER_BNDR = .false. +set DPMIN_SURFACE = 2.5 +set DPMIN_INFLATION_FACTOR = 1.08 +set DPMIN_INTERIOR = .1 +set DKTZU = 4 +set DKTZL = 1 + +#------------------------------ +# set DIFFUSION defaults +#------------------------------ +set EITMTH = "'gm'" +set EDRITP = "'large scale'" +set EDWMTH = "'smooth'" +set EDDF2D = .false. +set EDSPRS = .true. +set EGC = 0.85 +set EGGAM = 200. +if ("$BLOM_UNIT" == cgs) then + set EGLSMN = 4000.e2 + set EGMNDF = 100.e4 + set EGMXDF = 1500.e4 +else + set EGLSMN = 4000. + set EGMNDF = 100. + set EGMXDF = 1500. +endif +set EGIDFQ = 1. +set TBFILE = "'unset'" +set RHISCF = 0. +set EDANIS = .false. +set REDI3D = .false. +set RHSCTP = .false. +set RI0 = 1.2 +set BDMTYP = 2 +if ("$BLOM_UNIT" == cgs) then + set BDMC1 = 5.e-4 + set BDMC2 = .1 +else + set BDMC1 = 5.e-8 + set BDMC2 = 1.e-5 +endif +set TKEPF = .006 +set SMOBLD = .true. +set LNGMTP = "'none'" +if ("$BLOM_VCOORD" == isopyc_bulkml) then + set BDMLDP = .true. + set LTEDTP = "'layer'" +else + set BDMLDP = .false. + set LTEDTP = "'neutral'" +endif + +#------------------------------ +# set BGCNML defaults +#------------------------------ +set ATM_CO2 = "$CCSM_CO2_PPMV" +if ("$BLOM_RIVER_NUTRIENTS" == TRUE) then + set DO_RIVINPT = .true. +else + set DO_RIVINPT = .false. +endif +if ("$BLOM_N_DEPOSITION" == TRUE) then + set DO_NDEP = .true. + if( "$BLOM_NDEP_SCENARIO" == 1850 && "$OCN_GRID" == tnx2v1) then + set NDEPFNAME = ndep_1850_CMIP6_tnx2v1_20180321.nc + else if( "$BLOM_NDEP_SCENARIO" == 1850 && "$OCN_GRID" == tnx1v4) then + set NDEPFNAME = ndep_1850_CMIP6_tnx1v4_20171106.nc + else if( "$BLOM_NDEP_SCENARIO" == 1850 && "$OCN_GRID" == tnx0.25v4) then + set NDEPFNAME = ndep_1850_CMIP6_tnx0.25v4_20190912.nc + else if( "$BLOM_NDEP_SCENARIO" == 1850 && "$OCN_GRID" == tnx0.125v4) then + set NDEPFNAME = ndep_1850_CMIP6_tnx0.125v4_20221013.nc + else if( "$BLOM_NDEP_SCENARIO" == 2000 && "$OCN_GRID" == tnx2v1) then + set NDEPFNAME = ndep_2000_CMIP6_tnx2v1_20200826.nc + else if( "$BLOM_NDEP_SCENARIO" == 2000 && "$OCN_GRID" == tnx1v4) then + set NDEPFNAME = ndep_2000_CMIP6_tnx1v4_20200826.nc + else if( "$BLOM_NDEP_SCENARIO" == 2000 && "$OCN_GRID" == tnx0.25v4) then + set NDEPFNAME = ndep_2000_CMIP6_tnx0.25v4_20200826.nc + else if( "$BLOM_NDEP_SCENARIO" == hist && "$OCN_GRID" == tnx2v1) then + set NDEPFNAME = ndep_185001-201412_tnx2v1_20190702.nc + else if( "$BLOM_NDEP_SCENARIO" == hist && "$OCN_GRID" == tnx1v4) then + set NDEPFNAME = ndep_185001-201412_tnx1v4_20180613.nc + else if( "$BLOM_NDEP_SCENARIO" == hist && "$OCN_GRID" == tnx0.25v4) then + set NDEPFNAME = ndep_185001-201412_tnx0.25v4_20190705.nc + else if( `echo $BLOM_NDEP_SCENARIO | cut -c1-3` == ssp && "$OCN_GRID" == tnx1v4) then + set NDEPFNAME = ndep_201501-210012-${BLOM_NDEP_SCENARIO}_tnx1v4_20191112.nc + else if( "$BLOM_NDEP_SCENARIO" == UNSET ) then + set DO_NDEP = .false. + set NDEPFNAME = "''" + endif +else + set DO_NDEP = .false. + set NDEPFNAME = "''" +endif +if ("$HAMOCC_SEDSPINUP" == TRUE) then + set DO_SEDSPINUP = .true. + set SEDSPIN_YR_S = $HAMOCC_SEDSPINUP_YR_START + set SEDSPIN_YR_E = $HAMOCC_SEDSPINUP_YR_END + set SEDSPIN_NCYC = $HAMOCC_SEDSPINUP_NCYCLE +else + set DO_SEDSPINUP = .false. + set SEDSPIN_YR_S = -1 + set SEDSPIN_YR_E = -1 + set SEDSPIN_NCYC = -1 +endif +# VSLS is currently only available for the tnx1v4 grid, since a climatlogy file for +# short wave radiation is needed. +if ("$HAMOCC_VSLS" == TRUE && "$OCN_GRID" != tnx1v4) then + echo "$0 ERROR: HAMOCC_VSLS == TRUE not possible with this grid resolution (no swa-climatology available) " + exit -1 +endif +# For the following options, there are currently no switches in Case-XML files. +# These options can be activated by expert users via user namelist. +set DO_OALK = .false. +set BGCOAFX_OALKSCEN = "''" +set BGCOAFX_OALKFILE = "''" +set BGCOAFX_ADDALK = 0.135 +set BGCOAFX_CDRMIP_LATMAX = 70.0 +set BGCOAFX_CDRMIP_LATMIN = -60.0 +set BGCOAFX_RAMP_START = 2025 +set BGCOAFX_RAMP_END = 2035 +set WITH_DMSPH = .false. +set PI_PH_FILE = "''" +set L_3DVARSEDPOR = .false. +set SEDPORFILE = "''" + + +#------------------------------ +# set DIAPHY defaults +#------------------------------ +set GLB_FNAMETAG = "'hd','hm','hy'" +set GLB_AVEPERIO = '1, 30, 365' +if ("$TEST" == TRUE) then + set GLB_FILEFREQ = '1, 30, 365' +else + set GLB_FILEFREQ = '30, 30, 365' +endif +set GLB_COMPFLAG = '0, 0, 0' +if ("$PIO_NETCDF_FORMAT_OCN" == 64bit_offset) then + set GLB_NCFORMAT = '1, 1, 1' +else + set GLB_NCFORMAT = '0, 0, 0' +endif +set H2D_ABSWND = '0, 4, 0' +set H2D_ALB = '0, 0, 0' +set H2D_BTMSTR = '0, 4, 0' +set H2D_BRNFLX = '0, 4, 0' +set H2D_BRNPD = '0, 4, 0' +set H2D_DFL = '0, 0, 0' +set H2D_EVA = '0, 4, 0' +set H2D_FICE = '0, 4, 0' +set H2D_FMLTFZ = '0, 4, 0' +set H2D_HICE = '0, 0, 0' +set H2D_HMLTFZ = '0, 4, 0' +set H2D_HSNW = '0, 0, 0' +set H2D_IAGE = '0, 0, 0' +set H2D_IDKEDT = '0, 4, 0' +set H2D_LAMULT = '0, 4, 0' +set H2D_LASL = '0, 4, 0' +set H2D_LIP = '0, 4, 0' +set H2D_MAXMLD = '4, 4, 0' +set H2D_MLD = '0, 4, 0' +set H2D_MLTS = '4, 4, 0' +set H2D_MLTSMN = '0, 4, 0' +set H2D_MLTSMX = '0, 4, 0' +set H2D_MLTSSQ = '0, 4, 0' +set H2D_MTKEUS = '0, 4, 0' +set H2D_MTKENI = '0, 4, 0' +set H2D_MTKEBF = '0, 4, 0' +set H2D_MTKERS = '0, 4, 0' +set H2D_MTKEPE = '0, 4, 0' +set H2D_MTKEKE = '0, 4, 0' +set H2D_MTY = '0, 4, 0' +set H2D_NSF = '0, 4, 0' +set H2D_PBOT = '0, 4, 0' +set H2D_PSRF = '0, 4, 0' +set H2D_RFIFLX = '0, 4, 0' +set H2D_RNFFLX = '0, 4, 0' +set H2D_SALFLX = '0, 4, 0' +set H2D_SALRLX = '0, 4, 0' +set H2D_SBOT = '0, 4, 0' +set H2D_SEALV = '4, 4, 0' +set H2D_SLVSQ = '0, 4, 0' +set H2D_SFL = '0, 4, 0' +set H2D_SOP = '0, 4, 0' +set H2D_SIGMX = '0, 4, 0' +set H2D_SSS = '4, 4, 0' +set H2D_SSSSQ = '4, 4, 0' +set H2D_SST = '4, 4, 0' +set H2D_SSTSQ = '4, 4, 0' +set H2D_SURFLX = '0, 4, 0' +set H2D_SURRLX = '0, 4, 0' +set H2D_SWA = '0, 4, 0' +set H2D_T20D = '4, 4, 0' +set H2D_TAUX = '0, 4, 0' +set H2D_TAUY = '0, 4, 0' +set H2D_TBOT = '0, 4, 0' +set H2D_TICE = '0, 0, 0' +set H2D_TSRF = '0, 0, 0' +set H2D_UB = '0, 4, 0' +set H2D_UICE = '0, 0, 0' +set H2D_USTAR = '0, 4, 0' +set H2D_USTAR3 = '0, 4, 0' +set H2D_USTOKES = '0, 0, 0' +set H2D_VB = '0, 4, 0' +set H2D_VICE = '0, 0, 0' +set H2D_VSTOKES = '0, 0, 0' +set H2D_ZTX = '0, 4, 0' +set LYR_BFSQ = '0, 4, 0' +set LYR_DIFDIA = '0, 4, 0' +set LYR_DIFVMO = '0, 4, 0' +set LYR_DIFVHO = '0, 4, 0' +set LYR_DIFVSO = '0, 4, 0' +set LYR_DIFINT = '0, 4, 0' +set LYR_DIFISO = '0, 4, 0' +set LYR_DP = '0, 4, 0' +set LYR_DZ = '0, 4, 0' +set LYR_SALN = '0, 4, 0' +set LYR_TEMP = '0, 4, 0' +set LYR_TRC = '0, 0, 0' +set LYR_UFLX = '0, 4, 0' +set LYR_UTFLX = '0, 4, 0' +set LYR_USFLX = '0, 4, 0' +set LYR_UMFLTD = '0, 0, 4' +set LYR_UMFLSM = '0, 0, 4' +set LYR_UTFLTD = '0, 0, 4' +set LYR_UTFLSM = '0, 0, 4' +set LYR_UTFLLD = '0, 0, 4' +set LYR_USFLTD = '0, 0, 4' +set LYR_USFLSM = '0, 0, 4' +set LYR_USFLLD = '0, 0, 4' +set LYR_UVEL = '0, 4, 0' +set LYR_VFLX = '0, 4, 0' +set LYR_VTFLX = '0, 4, 0' +set LYR_VSFLX = '0, 4, 0' +set LYR_VMFLTD = '0, 0, 4' +set LYR_VMFLSM = '0, 0, 4' +set LYR_VTFLTD = '0, 0, 4' +set LYR_VTFLSM = '0, 0, 4' +set LYR_VTFLLD = '0, 0, 4' +set LYR_VSFLTD = '0, 0, 4' +set LYR_VSFLSM = '0, 0, 4' +set LYR_VSFLLD = '0, 0, 4' +set LYR_VVEL = '0, 4, 0' +set LYR_WFLX = '0, 4, 0' +set LYR_WFLX2 = '0, 4, 0' +set LYR_PV = '0, 4, 0' +set LYR_TKE = '0, 4, 0' +set LYR_GLS_PSI = '0, 4, 0' +set LYR_IDLAGE = '0, 4, 0' +set LVL_BFSQ = '0, 4, 0' +set LVL_DIFDIA = '0, 4, 0' +set LVL_DIFVMO = '0, 4, 0' +set LVL_DIFVHO = '0, 4, 0' +set LVL_DIFVSO = '0, 4, 0' +set LVL_DIFINT = '0, 4, 0' +set LVL_DIFISO = '0, 4, 0' +set LVL_DZ = '0, 4, 0' +set LVL_SALN = '0, 4, 0' +set LVL_TEMP = '0, 4, 0' +set LVL_TRC = '0, 0, 0' +set LVL_UFLX = '0, 4, 0' +set LVL_UTFLX = '0, 4, 0' +set LVL_USFLX = '0, 4, 0' +set LVL_UMFLTD = '0, 0, 4' +set LVL_UMFLSM = '0, 0, 4' +set LVL_UTFLTD = '0, 0, 4' +set LVL_UTFLSM = '0, 0, 4' +set LVL_UTFLLD = '0, 0, 4' +set LVL_USFLTD = '0, 0, 4' +set LVL_USFLSM = '0, 0, 4' +set LVL_USFLLD = '0, 0, 4' +set LVL_UVEL = '0, 4, 0' +set LVL_VFLX = '0, 4, 0' +set LVL_VTFLX = '0, 4, 0' +set LVL_VSFLX = '0, 4, 0' +set LVL_VMFLTD = '0, 0, 4' +set LVL_VMFLSM = '0, 0, 4' +set LVL_VTFLTD = '0, 0, 4' +set LVL_VTFLSM = '0, 0, 4' +set LVL_VTFLLD = '0, 0, 4' +set LVL_VSFLTD = '0, 0, 4' +set LVL_VSFLSM = '0, 0, 4' +set LVL_VSFLLD = '0, 0, 4' +set LVL_VVEL = '0, 4, 0' +set LVL_WFLX = '0, 4, 0' +set LVL_WFLX2 = '0, 4, 0' +set LVL_PV = '0, 4, 0' +set LVL_TKE = '0, 4, 0' +set LVL_GLS_PSI = '0, 4, 0' +set LVL_IDLAGE = '0, 4, 0' +set MSC_MMFLXL = '0, 4, 0' +set MSC_MMFLXD = '0, 4, 0' +set MSC_MMFTDL = '0, 4, 0' +set MSC_MMFSML = '0, 4, 0' +set MSC_MMFTDD = '0, 4, 0' +set MSC_MMFSMD = '0, 4, 0' +set MSC_MHFLX = '0, 4, 0' +set MSC_MHFTD = '0, 4, 0' +set MSC_MHFSM = '0, 4, 0' +set MSC_MHFLD = '0, 4, 0' +set MSC_MSFLX = '0, 4, 0' +set MSC_MSFTD = '0, 4, 0' +set MSC_MSFSM = '0, 4, 0' +set MSC_MSFLD = '0, 4, 0' +set MSC_VOLTR = '0, 4, 0' +set MSC_MASSGS = '0, 4, 0' +set MSC_VOLGS = '0, 4, 0' +set MSC_SALNGA = '0, 4, 0' +set MSC_TEMPGA = '0, 4, 0' +set MSC_SSSGA = '0, 4, 0' +set MSC_SSTGA = '0, 4, 0' + +#------------------------------ +# set DIABGC defaults +#------------------------------ +set BGC_FNAMETAG = "'hbgcd','hbgcm','hbgcy'" +set BGC_AVEPERIO = '1,30,365' +set BGC_FILEFREQ = '30,30,365' +if ("$TEST" == TRUE) then + set BGC_FILEFREQ = ' 1,30,365' +else + set BGC_FILEFREQ = '30,30,365' +endif +set BGC_COMPFLAG = '0, 0, 0' +if ("$PIO_NETCDF_FORMAT_OCN" == 64bit_offset) then + set BGC_NCFORMAT = '1, 1, 1' +else + set BGC_NCFORMAT = '0, 0, 0' +endif +set BGC_INVENTORY = '0, 1, 0' +set SRF_PHOSPH = '0, 2, 2' +set SRF_OXYGEN = '0, 2, 2' +set SRF_IRON = '0, 2, 2' +set SRF_ANO3 = '0, 2, 2' +set SRF_ALKALI = '4, 2, 2' +set SRF_SILICA = '0, 2, 2' +set SRF_DIC = '4, 2, 2' +set SRF_PHYTO = '4, 2, 2' +set SRF_PH = '0, 2, 2' +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' +set SRF_NIFLUX = '0, 2, 2' +set SRF_N2OFX = '0, 0, 2' +set SRF_DMSFLUX = '0, 2, 2' +set SRF_DMS = '0, 2, 2' +set SRF_DMSPROD = '0, 2, 2' +set SRF_DMS_BAC = '0, 2, 2' +set SRF_DMS_UV = '0, 2, 2' +set SRF_ATMCO2 = '0, 2, 2' +set SRF_ATMO2 = '0, 2, 2' +set SRF_ATMN2 = '0, 2, 2' +set SRF_NATDIC = '0, 2, 2' +set SRF_NATALKALI = '0, 2, 2' +set SRF_NATPH = '0, 2, 2' +set SRF_NATPCO2 = '0, 2, 2' +set SRF_NATCO2FX = '0, 2, 2' +set SRF_CO213FXD = '0, 2, 2' +set SRF_CO213FXU = '0, 2, 2' +set SRF_CO214FXD = '0, 2, 2' +set SRF_CO214FXU = '0, 2, 2' +set SRF_CFC11 = '0, 2, 2' +set SRF_CFC12 = '0, 2, 2' +set SRF_SF6 = '0, 2, 2' +set SRF_BROMO = '0, 2, 2' +set SRF_BROMOFX = '0, 2, 2' +set INT_BROMOPRO = '0, 2, 2' +set INT_BROMOUV = '0, 2, 2' +set INT_PHOSY = '4, 2, 2' +set INT_NFIX = '0, 2, 2' +set INT_DNIT = '0, 2, 2' +if ("$BLOM_N_DEPOSITION" == TRUE) then +set FLX_NDEP = '0, 2, 2' +else +set FLX_NDEP = '0, 0, 0' +endif +set FLX_OALK = '0, 0, 0' +set FLX_CAR0100 = '0, 2, 2' +set FLX_CAR0500 = '0, 2, 2' +set FLX_CAR1000 = '0, 2, 2' +set FLX_CAR2000 = '0, 2, 2' +set FLX_CAR4000 = '0, 2, 2' +set FLX_CAR_BOT = '0, 2, 2' +set FLX_BSI0100 = '0, 2, 2' +set FLX_BSI0500 = '0, 2, 2' +set FLX_BSI1000 = '0, 2, 2' +set FLX_BSI2000 = '0, 2, 2' +set FLX_BSI4000 = '0, 2, 2' +set FLX_BSI_BOT = '0, 2, 2' +set FLX_CAL0100 = '0, 2, 2' +set FLX_CAL0500 = '0, 2, 2' +set FLX_CAL1000 = '0, 2, 2' +set FLX_CAL2000 = '0, 2, 2' +set FLX_CAL4000 = '0, 2, 2' +set FLX_CAL_BOT = '0, 2, 2' +set LYR_PHYTO = '0, 0, 2' +set LYR_GRAZER = '0, 0, 2' +set LYR_DOC = '0, 0, 2' +set LYR_PHOSY = '0, 0, 2' +set LYR_PHOSPH = '0, 0, 2' +set LYR_OXYGEN = '0, 0, 4' +set LYR_IRON = '0, 0, 2' +set LYR_ANO3 = '0, 0, 2' +set LYR_ALKALI = '0, 0, 2' +set LYR_SILICA = '0, 0, 2' +set LYR_DIC = '0, 0, 2' +set LYR_POC = '0, 0, 2' +set LYR_CALC = '0, 0, 2' +set LYR_OPAL = '0, 0, 2' +set LYR_CO3 = '0, 0, 2' +set LYR_N2O = '0, 0, 0' +set LYR_PH = '0, 0, 2' +set LYR_OMEGAC = '0, 0, 2' +set LYR_OMEGAA = '0, 0, 2' +set LYR_PREFO2 = '0, 0, 4' +set LYR_O2SAT = '0, 0, 4' +set LYR_PREFPO4 = '0, 0, 2' +set LYR_PREFALK = '0, 0, 2' +set LYR_PREFDIC = '0, 0, 2' +set LYR_DICSAT = '0, 0, 2' +set LYR_NATDIC = '0, 0, 2' +set LYR_NATALKALI = '0, 0, 2' +set LYR_NATCO3 = '0, 0, 2' +set LYR_NATCALC = '0, 0, 2' +set LYR_NATPH = '0, 0, 2' +set LYR_NATOMEGAC = '0, 0, 2' +set LYR_NATOMEGAA = '0, 0, 2' +set LYR_DIC13 = '0, 0, 2' +set LYR_DIC14 = '0, 0, 2' +set LYR_D13C = '0, 0, 2' +set LYR_D14C = '0, 0, 2' +set LYR_BIGD14C = '0, 0, 2' +set LYR_POC13 = '0, 0, 2' +set LYR_DOC13 = '0, 0, 2' +set LYR_CALC13 = '0, 0, 2' +set LYR_PHYTO13 = '0, 0, 2' +set LYR_GRAZER13 = '0, 0, 2' +set LYR_CFC11 = '0, 0, 2' +set LYR_CFC12 = '0, 0, 2' +set LYR_SF6 = '0, 0, 2' +set LYR_NOS = '0, 0, 2' +set LYR_WPHY = '0, 0, 2' +set LYR_WNOS = '0, 0, 2' +set LYR_EPS = '0, 0, 0' +set LYR_ASIZE = '0, 0, 0' +set LYR_BROMO = '0, 0, 2' +set BGC_DP = '0, 2, 2' +set LVL_PHYTO = '0, 2, 2' +set LVL_GRAZER = '0, 2, 2' +set LVL_DOC = '0, 2, 2' +set LVL_PHOSY = '0, 2, 2' +set LVL_PHOSPH = '0, 2, 2' +set LVL_OXYGEN = '0, 4, 4' +set LVL_IRON = '0, 2, 2' +set LVL_ANO3 = '0, 2, 2' +set LVL_ALKALI = '0, 2, 2' +set LVL_SILICA = '0, 2, 2' +set LVL_DIC = '0, 2, 2' +set LVL_POC = '0, 2, 2' +set LVL_CALC = '0, 2, 2' +set LVL_OPAL = '0, 2, 2' +set LVL_CO3 = '0, 2, 2' +set LVL_N2O = '0, 0, 2' +set LVL_PH = '0, 2, 2' +set LVL_OMEGAC = '0, 2, 2' +set LVL_OMEGAA = '0, 2, 2' +set LVL_PREFO2 = '0, 4, 4' +set LVL_O2SAT = '0, 4, 4' +set LVL_PREFPO4 = '0, 2, 2' +set LVL_PREFALK = '0, 2, 2' +set LVL_PREFDIC = '0, 2, 2' +set LVL_DICSAT = '0, 2, 2' +set LVL_NATDIC = '0, 2, 2' +set LVL_NATALKALI = '0, 2, 2' +set LVL_NATCO3 = '0, 2, 2' +set LVL_NATCALC = '0, 2, 2' +set LVL_NATPH = '0, 2, 2' +set LVL_NATOMEGAC = '0, 2, 2' +set LVL_NATOMEGAA = '0, 2, 2' +set LVL_DIC13 = '0, 2, 2' +set LVL_DIC14 = '0, 2, 2' +set LVL_D13C = '0, 2, 2' +set LVL_POC13 = '0, 2, 2' +set LVL_DOC13 = '0, 2, 2' +set LVL_CALC13 = '0, 2, 2' +set LVL_PHYTO13 = '0, 2, 2' +set LVL_GRAZER13 = '0, 2, 2' +set LVL_CFC11 = '0, 2, 2' +set LVL_CFC12 = '0, 2, 2' +set LVL_SF6 = '0, 2, 2' +set LVL_NOS = '0, 2, 2' +set LVL_WPHY = '0, 2, 2' +set LVL_WNOS = '0, 2, 2' +set LVL_EPS = '0, 0, 0' +set LVL_ASIZE = '0, 0, 0' +set LVL_BROMO = '0, 2, 2' +set FLX_SEDIFFIC = '0, 0, 2' +set FLX_SEDIFFAL = '0, 0, 2' +set FLX_SEDIFFPH = '0, 0, 2' +set FLX_SEDIFFOX = '0, 0, 2' +set FLX_SEDIFFN2 = '0, 0, 2' +set FLX_SEDIFFNO3 = '0, 0, 2' +set FLX_SEDIFFSI = '0, 0, 2' +set SDM_POWAIC = '0, 0, 2' +set SDM_POWAAL = '0, 0, 2' +set SDM_POWAPH = '0, 0, 2' +set SDM_POWAOX = '0, 0, 2' +set SDM_POWN2 = '0, 0, 2' +set SDM_POWNO3 = '0, 0, 2' +set SDM_POWASI = '0, 0, 2' +set SDM_SSSO12 = '0, 0, 2' +set SDM_SSSSIL = '0, 0, 2' +set SDM_SSSC12 = '0, 0, 2' +set SDM_SSSTER = '0, 0, 2' +set BUR_SSSO12 = '0, 0, 2' +set BUR_SSSSIL = '0, 0, 2' +set BUR_SSSC12 = '0, 0, 2' +set BUR_SSSTER = '0, 0, 2' + +# if partial coupling, enable SSS relaxation +if ("$BLOM_COUPLING" =~ *partial*) then + if ("$BLOM_VCOORD" == isopyc_bulkml) then + set SRXDAY = 6. + else + set SRXDAY = 60. + set SRXDPT = 10. + endif + set SPRFAC = .true. + set SRXBAL = .true. +endif + +# set grid dependent parameters +if ("$OCN_GRID" == gx1v5 || "$OCN_GRID" == gx1v6) then + set BACLIN = 1800. + set BATROP = 36. +else if ("$OCN_GRID" == gx3v7) then + set BACLIN = 3600. + set BATROP = 72. +else if ("$OCN_GRID" == tnx2v1 ) then + set BACLIN = 4800. + set BATROP = 96. + set EGC = 0.5 + if ("$BLOM_UNIT" == cgs) then + set EGMXDF = 1000.e4 + else + set EGMXDF = 1000. + endif + set CWMTAG = "'Gibraltar','Gibraltar'" + set CWMEDG = " 'u', 'u'" + set CWMI = " 53, 54" + set CWMJ = " 137, 137" + set CWMWTH = " 30.e3, 30.e3" +else if ("$OCN_GRID" == tnx1.5v1 ) then + set BACLIN = 4800. + set BATROP = 96. + set EGC = 0.5 + if ("$BLOM_UNIT" == cgs) then + set EGMXDF = 1000.e4 + else + set EGMXDF = 1000. + endif +else if ("$OCN_GRID" == tnx1v1 || "$OCN_GRID" == tnx1v3 || "$OCN_GRID" == tnx1v4) then + if ("$OCN_NCPL" == 24) then + set BACLIN = 3600. + set BATROP = 60. + set CWBDTS = .75e-4 + set NIWGF = .4 + set SMTFRC = .false. + if ("$BLOM_VCOORD" == isopyc_bulkml) then + set CE = .5 + endif + else + set BACLIN = 3200. + set BATROP = 64. + endif + set CWMTAG = "'Gibraltar','Gibraltar'" + set CWMEDG = " 'u', 'u'" + set CWMI = " 105, 106" + set CWMJ = " 273, 273" + set CWMWTH = " 30.e3, 30.e3" +else if ("$OCN_GRID" == tnx0.25v1 || "$OCN_GRID" == tnx0.25v3 || "$OCN_GRID" == tnx0.25v4) then + set BACLIN = 900. + set BATROP = 15. + if ("$BLOM_UNIT" == cgs) then + set MDV2HI = .15 + set MDV2LO = .15 + set MDV4HI = 0. + set MDV4LO = 0. + set MDC2HI = 300.e4 + set MDC2LO = 300.e4 + else + set MDV2HI = .0015 + set MDV2LO = .0015 + set MDV4HI = 0. + set MDV4LO = 0. + set MDC2HI = 300. + set MDC2LO = 300. + endif + set VSC2HI = .15 + set VSC2LO = .15 + set VSC4HI = 0.0625 + set VSC4LO = 0.0625 + set CWBDTS = 0.75e-4 + set CWBDLS = 25. + set EDWMTH = "'step'" + set EGC = 0.85 + if ("$BLOM_UNIT" == cgs) then + set EGMXDF = 1500.e4 + else + set EGMXDF = 1500. + endif + if ("$BLOM_VCOORD" == isopyc_bulkml) then + set CE = 1.0 + endif +else if ("$OCN_GRID" == tnx0.125v4) then + set BACLIN = 300. + set BATROP = 6. + set EGMNDF = 0. + set EGMXDF = 0. + set EDWMTH = "'step'" + set CWBDTS = .75e-4 + set CWBDLS = 25 + if ("$BLOM_UNIT" == cgs) then + set MDV2HI = .1 + set MDV2LO = .1 + set MDV4HI = 0. + set MDV4LO = 0. + set MDC2HI = 300.e4 + set MDC2LO = 100.e4 + else + set MDV2HI = .001 + set MDV2LO = .001 + set MDV4HI = 0. + set MDV4LO = 0. + set MDC2HI = 300. + set MDC2LO = 100. + endif + set VSC2HI = 0. + set VSC2LO = 0. + set VSC4HI = .06 + set VSC4LO = .06 + set LTEDTP = "'layer'" +else + echo "OCN_GRID is $OCN_GRID \n" + echo "$0 ERROR: Cannot deal with GRID equal to $OCN_GRID " + exit -1 +endif + +# set grid independent input files (iHAMOCC initial conditions) +set INIDIC = "'$DIN_LOC_ROOT/ocn/blom/inicon/glodapv2_Ct_preind_OMIPinit_20171107.nc'" +set INIALK = "'$DIN_LOC_ROOT/ocn/blom/inicon/glodapv2_At_OMIPinit_20171107.nc'" +set INIPO4 = "'$DIN_LOC_ROOT/ocn/blom/inicon/woa13_phosphate_OMIPinit_20171107.nc'" +set INIOXY = "'$DIN_LOC_ROOT/ocn/blom/inicon/woa13_oxygen_OMIPinit_20171107.nc'" +set ININO3 = "'$DIN_LOC_ROOT/ocn/blom/inicon/woa13_nitrate_OMIPinit_20171107.nc'" +set INISIL = "'$DIN_LOC_ROOT/ocn/blom/inicon/woa13_silicate_OMIPinit_20171107.nc'" +if ("$HAMOCC_CISO" == TRUE) then +set INID13C = "'$DIN_LOC_ROOT/ocn/blom/inicon/d13C_permil_20180609.nc'" +set INID14C = "'$DIN_LOC_ROOT/ocn/blom/inicon/d14C_permil_20180609.nc'" +else +set INID13C = "''" +set INID14C = "''" +endif + +# set grid dependent input files +if ("$OCN_GRID" == tnx2v1) then + set GRFILE = "'$DIN_LOC_ROOT/ocn/blom/grid/grid_tnx2v1_20130206.nc'" + set ICFILE = "'$DIN_LOC_ROOT/ocn/blom/inicon/inicon_tnx2v1_20130419.nc'" + set TDFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/tidal_dissipation_tnx2v1_20130419.nc'" + set MER_ORFILE = "'$DIN_LOC_ROOT/ocn/blom/grid/ocean_regions_tnx2v1_20190826.nc'" + set MER_MIFILE = "'$DIN_LOC_ROOT/ocn/blom/grid/mertra_index_tnx2v1_20190826.dat'" + set SEC_SIFILE = "'$DIN_LOC_ROOT/ocn/blom/grid/section_index_tnx2v1_20190826.dat'" + set SCFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/sss_clim_core_tnx2v1_20130927.nc'" + set FEDEPFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/dustdep_mhw2006_tnx2v1_20130506.nc'" + set SWACLIMFILE = "''" + set SEDPORFILE = "''" + if ("$BLOM_RIVER_NUTRIENTS" == TRUE) then + set RIVINFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/river_nutrients_GNEWS2000_tnx2v1_20170915.nc'" + else + set RIVINFILE = "''" + endif + if ("$BLOM_N_DEPOSITION" == TRUE) then + set NDEPFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/$NDEPFNAME'" + else + set NDEPFILE = "''" + endif +else if ("$OCN_GRID" == tnx1v4) then + set GRFILE = "'$DIN_LOC_ROOT/ocn/blom/grid/grid_tnx1v4_20170622.nc'" + set ICFILE = "'$DIN_LOC_ROOT/ocn/blom/inicon/inicon_tnx1v4_20170622.nc'" + set TDFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/tidal_dissipation_tnx1v4_20170605.nc'" + set MER_ORFILE = "'$DIN_LOC_ROOT/ocn/blom/grid/ocean_regions_tnx1v4_20190729.nc'" + set MER_MIFILE = "'$DIN_LOC_ROOT/ocn/blom/grid/mertra_index_tnx1v4_20190615.dat'" + set SEC_SIFILE = "'$DIN_LOC_ROOT/ocn/blom/grid/section_index_tnx1v4_20190611.dat'" + set CCFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/chlorophyll_concentration_tnx1v4_20170608.nc'" + set SCFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/sss_clim_core_tnx1v4_20170604.nc'" + set FEDEPFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/dustdep_mhw2006_tnx1v4_20171107.nc'" + set SEDPORFILE = "''" + if ("$HAMOCC_VSLS" == TRUE) then + set SWACLIMFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/Annual_clim_swa_tnx1v4_20210415.nc'" + else + set SWACLIMFILE = "''" + endif + if ("$BLOM_RIVER_NUTRIENTS" == TRUE) then + set RIVINFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/river_nutrients_GNEWS2000_tnx1v4_20170820.nc'" + else + set RIVINFILE = "''" + endif + if ("$BLOM_N_DEPOSITION" == TRUE) then + set NDEPFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/$NDEPFNAME'" + else + set NDEPFILE = "''" + endif +else if ("$OCN_GRID" == tnx0.25v4) then + set GRFILE = "'$DIN_LOC_ROOT/ocn/blom/grid/grid_tnx0.25v4_20170622.nc'" + set ICFILE = "'$DIN_LOC_ROOT/ocn/blom/inicon/inicon_tnx0.25v4_20170623.nc'" + set TDFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/tidal_dissipation_tnx0.25v4_20170626.nc'" + set MER_ORFILE = "'$DIN_LOC_ROOT/ocn/blom/grid/ocean_regions_tnx0.25v4_20190612.nc'" + set MER_MIFILE = "'$DIN_LOC_ROOT/ocn/blom/grid/mertra_index_tnx0.25v4_20190701.dat'" + set SEC_SIFILE = "'$DIN_LOC_ROOT/ocn/blom/grid/section_index_tnx0.25v4_20190612.dat'" + set CCFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/chlorophyll_concentration_tnx0.25v4_20170623.nc'" + set SCFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/sss_clim_core_tnx0.25v4_20170623.nc'" + set FEDEPFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/dustdep_mhw2006_tnx0.25v4_20181004.nc'" + set SWACLIMFILE = "''" + set SEDPORFILE = "''" + if ("$BLOM_RIVER_NUTRIENTS" == TRUE) then + set RIVINFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/river_nutrients_GNEWS2000_tnx0.25v4_20170821.nc'" + else + set RIVINFILE = "''" + endif + if ("$BLOM_N_DEPOSITION" == TRUE) then + set NDEPFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/$NDEPFNAME'" + else + set NDEPFILE = "''" + endif +else if ("$OCN_GRID" == tnx0.125v4) then + set GRFILE = "'$DIN_LOC_ROOT/ocn/blom/grid/grid_tnx0.125v4_20221013.nc'" + set ICFILE = "'$DIN_LOC_ROOT/ocn/blom/inicon/inicon_tnx0.125v4_20230318.nc'" + set TDFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/tidal_dissipation_tnx0.125v4_20221013.nc'" + set MER_ORFILE = "'$DIN_LOC_ROOT/ocn/blom/grid/ocean_regions_tnx0.125v4_20221013.nc'" + set MER_MIFILE = "'$DIN_LOC_ROOT/ocn/blom/grid/mertra_index_tnx0.125v4_20221013.dat'" + set SEC_SIFILE = "'$DIN_LOC_ROOT/ocn/blom/grid/section_index_tnx0.125v4_20221013.dat'" + set CCFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/chlorophyll_concentration_tnx0.125v4_20221013.nc'" + set SCFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/sss_clim_core_tnx0.125v4_20221013.nc'" + set FEDEPFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/dustdep_mhw2006_tnx0.125v4_20221013.nc'" + set SWACLIMFILE = "''" + set SEDPORFILE = "''" + if ("$BLOM_RIVER_NUTRIENTS" == TRUE) then + set RIVINFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/river_nutrients_GNEWS2000_tnx0.125v4_20221013.nc'" + else + set RIVINFILE = "''" + endif + if ("$BLOM_N_DEPOSITION" == TRUE) then + set NDEPFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/$NDEPFNAME'" + else + set NDEPFILE = "''" + endif +else + echo "$0 ERROR: Cannot deal with GRID = $OCN_GRID " + exit -1 +endif + + +#------------------------------------------------------------------------------ +# Create resolved namelist +#------------------------------------------------------------------------------ +foreach mem ("`seq $NINST_OCN`") + if ( ${NINST_OCN} == '1' ) then + set inststr = '' + else + set inststr = ("`printf '_%4.4d' $mem`") + endif + + # modify namelist variables as specified in user_nl_blom + foreach line ("`grep = $CASEROOT/user_nl_blom$inststr`") + if (`echo "$line" | tr -d ' ' | cut -c -1` != '#') then + set var = `echo "$line" | sed 's/=.*//' | tr '[a-z]' '[A-Z]'` + set val = `echo "$line" | sed 's/.*=//'` + eval 'set $var = "$val"' + endif + end + +cp ocn_in.readme $RUNDIR/. + +cat >! $RUNDIR/ocn_in$inststr << EOF +&LIMITS + NDAY1 = $NDAY1 + NDAY2 = $NDAY2 + IDATE = $IDATE + IDATE0 = $IDATE0 + RUNID = $RUNID + EXPCNF = $EXPCNF + RUNTYP = $RUNTYP + GRFILE = $GRFILE + ICFILE = $ICFILE + PREF = $PREF + BACLIN = $BACLIN + BATROP = $BATROP + MDV2HI = $MDV2HI + MDV2LO = $MDV2LO + MDV4HI = $MDV4HI + MDV4LO = $MDV4LO + MDC2HI = $MDC2HI + MDC2LO = $MDC2LO + VSC2HI = $VSC2HI + VSC2LO = $VSC2LO + VSC4HI = $VSC4HI + VSC4LO = $VSC4LO + CBAR = $CBAR + CB = $CB + CWBDTS = $CWBDTS + CWBDLS = $CWBDLS + MOMMTH = $MOMMTH + BMCMTH = $BMCMTH + RMPMTH = $RMPMTH + MLRTTP = $MLRTTP + RM0 = $RM0 + RM5 = $RM5 + CE = $CE + TDFILE = $TDFILE + NIWGF = $NIWGF + NIWBF = $NIWBF + NIWLF = $NIWLF + SWAMTH = $SWAMTH + JWTYPE = $JWTYPE + CHLOPT = $CHLOPT + CCFILE = $CCFILE + TRXDAY = $TRXDAY + SRXDAY = $SRXDAY + TRXDPT = $TRXDPT + SRXDPT = $SRXDPT + TRXLIM = $TRXLIM + SRXLIM = $SRXLIM + APTFLX = $APTFLX + APSFLX = $APSFLX + DITFLX = $DITFLX + DISFLX = $DISFLX + SRXBAL = $SRXBAL + SCFILE = $SCFILE + WAVSRC = $WAVSRC + SMTFRC = $SMTFRC + SPRFAC = $SPRFAC + ATM_PATH = $ATM_PATH + ITEST = $ITEST + JTEST = $JTEST + CNSVDI = $CNSVDI + CSDIAG = $CSDIAG + RSTFRQ = $RSTFRQ + RSTFMT = $RSTFMT + RSTCMP = $RSTCMP + IOTYPE = $IOTYPE +/ +EOF + +if ("$BLOM_VCOORD" == cntiso_hybrid) then +cat >>! $RUNDIR/ocn_in$inststr << EOF + +&VCOORD + VCOORD_TYPE = $VCOORD_TYPE + RECONSTRUCTION_METHOD = $RECONSTRUCTION_METHOD + DENSITY_LIMITING = $DENSITY_LIMITING + TRACER_LIMITING = $TRACER_LIMITING + VELOCITY_LIMITING = $VELOCITY_LIMITING + DENSITY_PC_UPPER_BNDR = $DENSITY_PC_UPPER_BNDR + DENSITY_PC_LOWER_BNDR = $DENSITY_PC_LOWER_BNDR + TRACER_PC_UPPER_BNDR = $TRACER_PC_UPPER_BNDR + TRACER_PC_LOWER_BNDR = $TRACER_PC_LOWER_BNDR + VELOCITY_PC_UPPER_BNDR = $VELOCITY_PC_UPPER_BNDR + VELOCITY_PC_LOWER_BNDR = $VELOCITY_PC_LOWER_BNDR + DPMIN_SURFACE = $DPMIN_SURFACE + DPMIN_INFLATION_FACTOR = $DPMIN_INFLATION_FACTOR + DPMIN_INTERIOR = $DPMIN_INTERIOR + DKTZU = $DKTZU + DKTZL = $DKTZL +/ +EOF +endif + +cat >>! $RUNDIR/ocn_in$inststr << EOF + +&DIFFUSION + EITMTH = $EITMTH + EDRITP = $EDRITP + EDWMTH = $EDWMTH + EDDF2D = $EDDF2D + EDSPRS = $EDSPRS + EGC = $EGC + EGGAM = $EGGAM + EGLSMN = $EGLSMN + EGMNDF = $EGMNDF + EGMXDF = $EGMXDF + EGIDFQ = $EGIDFQ + TBFILE = $TBFILE + RHISCF = $RHISCF + EDANIS = $EDANIS + REDI3D = $REDI3D + RHSCTP = $RHSCTP + RI0 = $RI0 + BDMTYP = $BDMTYP + BDMC1 = $BDMC1 + BDMC2 = $BDMC2 + BDMLDP = $BDMLDP + TKEPF = $TKEPF + SMOBLD = $SMOBLD + LNGMTP = $LNGMTP + LTEDTP = $LTEDTP +/ +EOF + +if ($?CWMTAG) then +cat >>! $RUNDIR/ocn_in$inststr << EOF + +&CWMOD + CWMTAG = $CWMTAG + CWMEDG = $CWMEDG + CWMI = $CWMI + CWMJ = $CWMJ + CWMWTH = $CWMWTH +/ +EOF +endif + +cat >>! $RUNDIR/ocn_in$inststr << EOF + +&MERDIA + MER_ORFILE = $MER_ORFILE + MER_MIFILE = $MER_MIFILE + MER_REGNAM = 'atlantic_arctic_ocean', 'atlantic_arctic_extended_ocean', 'indian_pacific_ocean', 'global_ocean' + MER_REGFLG(1,:) = 2, 4 + MER_REGFLG(2,:) = 2, 4, 6, 7, 8, 9 + MER_REGFLG(3,:) = 3, 5 + MER_REGFLG(4,:) = 0 + MER_MINLAT = -34., -34., -34., -90. + MER_MAXLAT = 90., 90., 90., 90. +/ + +&SECDIA + SEC_SIFILE = $SEC_SIFILE +/ + +&DIAPHY + GLB_FNAMETAG = $GLB_FNAMETAG + GLB_AVEPERIO = $GLB_AVEPERIO + GLB_FILEFREQ = $GLB_FILEFREQ + GLB_COMPFLAG = $GLB_COMPFLAG + GLB_NCFORMAT = $GLB_NCFORMAT + H2D_ABSWND = $H2D_ABSWND + H2D_ALB = $H2D_ALB + H2D_BTMSTR = $H2D_BTMSTR + H2D_BRNFLX = $H2D_BRNFLX + H2D_BRNPD = $H2D_BRNPD + H2D_DFL = $H2D_DFL + H2D_EVA = $H2D_EVA + H2D_FICE = $H2D_FICE + H2D_FMLTFZ = $H2D_FMLTFZ + H2D_HICE = $H2D_HICE + H2D_HMLTFZ = $H2D_HMLTFZ + H2D_HSNW = $H2D_HSNW + H2D_IAGE = $H2D_IAGE + H2D_IDKEDT = $H2D_IDKEDT + H2D_LAMULT = $H2D_LAMULT + H2D_LASL = $H2D_LASL + H2D_LIP = $H2D_LIP + H2D_MAXMLD = $H2D_MAXMLD + H2D_MLD = $H2D_MLD + H2D_MLTS = $H2D_MLTS + H2D_MLTSMN = $H2D_MLTSMN + H2D_MLTSMX = $H2D_MLTSMX + H2D_MLTSSQ = $H2D_MLTSSQ + H2D_MTKEUS = $H2D_MTKEUS + H2D_MTKENI = $H2D_MTKENI + H2D_MTKEBF = $H2D_MTKEBF + H2D_MTKERS = $H2D_MTKERS + H2D_MTKEPE = $H2D_MTKEPE + H2D_MTKEKE = $H2D_MTKEKE + H2D_MTY = $H2D_MTY + H2D_NSF = $H2D_NSF + H2D_PBOT = $H2D_PBOT + H2D_PSRF = $H2D_PSRF + H2D_RFIFLX = $H2D_RFIFLX + H2D_RNFFLX = $H2D_RNFFLX + H2D_SALFLX = $H2D_SALFLX + H2D_SALRLX = $H2D_SALRLX + H2D_SBOT = $H2D_SBOT + H2D_SEALV = $H2D_SEALV + H2D_SLVSQ = $H2D_SLVSQ + H2D_SFL = $H2D_SFL + H2D_SOP = $H2D_SOP + H2D_SIGMX = $H2D_SIGMX + H2D_SSS = $H2D_SSS + H2D_SSSSQ = $H2D_SSSSQ + H2D_SST = $H2D_SST + H2D_SSTSQ = $H2D_SSTSQ + H2D_SURFLX = $H2D_SURFLX + H2D_SURRLX = $H2D_SURRLX + H2D_SWA = $H2D_SWA + H2D_T20D = $H2D_T20D + H2D_TAUX = $H2D_TAUX + H2D_TAUY = $H2D_TAUY + H2D_TBOT = $H2D_TBOT + H2D_TICE = $H2D_TICE + H2D_TSRF = $H2D_TSRF + H2D_UB = $H2D_UB + H2D_UICE = $H2D_UICE + H2D_USTAR = $H2D_USTAR + H2D_USTAR3 = $H2D_USTAR3 + H2D_USTOKES = $H2D_USTOKES + H2D_VB = $H2D_VB + H2D_VICE = $H2D_VICE + H2D_VSTOKES = $H2D_VSTOKES + H2D_ZTX = $H2D_ZTX + LYR_BFSQ = $LYR_BFSQ + LYR_DIFDIA = $LYR_DIFDIA + LYR_DIFVMO = $LYR_DIFVMO + LYR_DIFVHO = $LYR_DIFVHO + LYR_DIFVSO = $LYR_DIFVSO + LYR_DIFINT = $LYR_DIFINT + LYR_DIFISO = $LYR_DIFISO + LYR_DP = $LYR_DP + LYR_DZ = $LYR_DZ + LYR_SALN = $LYR_SALN + LYR_TEMP = $LYR_TEMP + LYR_TRC = $LYR_TRC + LYR_UFLX = $LYR_UFLX + LYR_UTFLX = $LYR_UTFLX + LYR_USFLX = $LYR_USFLX + LYR_UMFLTD = $LYR_UMFLTD + LYR_UMFLSM = $LYR_UMFLSM + LYR_UTFLTD = $LYR_UTFLTD + LYR_UTFLSM = $LYR_UTFLSM + LYR_UTFLLD = $LYR_UTFLLD + LYR_USFLTD = $LYR_USFLTD + LYR_USFLSM = $LYR_USFLSM + LYR_USFLLD = $LYR_USFLLD + LYR_UVEL = $LYR_UVEL + LYR_VFLX = $LYR_VFLX + LYR_VTFLX = $LYR_VTFLX + LYR_VSFLX = $LYR_VSFLX + LYR_VMFLTD = $LYR_VMFLTD + LYR_VMFLSM = $LYR_VMFLSM + LYR_VTFLTD = $LYR_VTFLTD + LYR_VTFLSM = $LYR_VTFLSM + LYR_VTFLLD = $LYR_VTFLLD + LYR_VSFLTD = $LYR_VSFLTD + LYR_VSFLSM = $LYR_VSFLSM + LYR_VSFLLD = $LYR_VSFLLD + LYR_VVEL = $LYR_VVEL + LYR_WFLX = $LYR_WFLX + LYR_WFLX2 = $LYR_WFLX2 + LYR_PV = $LYR_PV + LYR_TKE = $LYR_TKE + LYR_GLS_PSI = $LYR_GLS_PSI + LYR_IDLAGE = $LYR_IDLAGE + LVL_BFSQ = $LVL_BFSQ + LVL_DIFDIA = $LVL_DIFDIA + LVL_DIFVMO = $LVL_DIFVMO + LVL_DIFVHO = $LVL_DIFVHO + LVL_DIFVSO = $LVL_DIFVSO + LVL_DIFINT = $LVL_DIFINT + LVL_DIFISO = $LVL_DIFISO + LVL_DZ = $LVL_DZ + LVL_SALN = $LVL_SALN + LVL_TEMP = $LVL_TEMP + LVL_TRC = $LVL_TRC + LVL_UFLX = $LVL_UFLX + LVL_UTFLX = $LVL_UTFLX + LVL_USFLX = $LVL_USFLX + LVL_UMFLTD = $LVL_UMFLTD + LVL_UMFLSM = $LVL_UMFLSM + LVL_UTFLTD = $LVL_UTFLTD + LVL_UTFLSM = $LVL_UTFLSM + LVL_UTFLLD = $LVL_UTFLLD + LVL_USFLTD = $LVL_USFLTD + LVL_USFLSM = $LVL_USFLSM + LVL_USFLLD = $LVL_USFLLD + LVL_UVEL = $LVL_UVEL + LVL_VFLX = $LVL_VFLX + LVL_VTFLX = $LVL_VTFLX + LVL_VSFLX = $LVL_VSFLX + LVL_VMFLTD = $LVL_VMFLTD + LVL_VMFLSM = $LVL_VMFLSM + LVL_VTFLTD = $LVL_VTFLTD + LVL_VTFLSM = $LVL_VTFLSM + LVL_VTFLLD = $LVL_VTFLLD + LVL_VSFLTD = $LVL_VSFLTD + LVL_VSFLSM = $LVL_VSFLSM + LVL_VSFLLD = $LVL_VSFLLD + LVL_VVEL = $LVL_VVEL + LVL_WFLX = $LVL_WFLX + LVL_WFLX2 = $LVL_WFLX2 + LVL_PV = $LVL_PV + LVL_TKE = $LVL_TKE + LVL_GLS_PSI = $LVL_GLS_PSI + LVL_IDLAGE = $LVL_IDLAGE + MSC_MMFLXL = $MSC_MMFLXL + MSC_MMFLXD = $MSC_MMFLXD + MSC_MMFTDL = $MSC_MMFTDL + MSC_MMFSML = $MSC_MMFSML + MSC_MMFTDD = $MSC_MMFTDD + MSC_MMFSMD = $MSC_MMFSMD + MSC_MHFLX = $MSC_MHFLX + MSC_MHFTD = $MSC_MHFTD + MSC_MHFSM = $MSC_MHFSM + MSC_MHFLD = $MSC_MHFLD + MSC_MSFLX = $MSC_MSFLX + MSC_MSFTD = $MSC_MSFTD + MSC_MSFSM = $MSC_MSFSM + MSC_MSFLD = $MSC_MSFLD + MSC_VOLTR = $MSC_VOLTR + MSC_MASSGS = $MSC_MASSGS + MSC_VOLGS = $MSC_VOLGS + MSC_SALNGA = $MSC_SALNGA + MSC_TEMPGA = $MSC_TEMPGA + MSC_SSSGA = $MSC_SSSGA + MSC_SSTGA = $MSC_SSTGA +/ +EOF + +if ("$ecosys" == TRUE) then +cat >>! $RUNDIR/ocn_in$inststr << EOF + +&BGCNML + ATM_CO2 = $CCSM_CO2_PPMV + FEDEPFILE = $FEDEPFILE + SWACLIMFILE = $SWACLIMFILE + DO_RIVINPT = $DO_RIVINPT + RIVINFILE = $RIVINFILE + DO_NDEP = $DO_NDEP + NDEPFILE = $NDEPFILE + DO_OALK = $DO_OALK + DO_SEDSPINUP = $DO_SEDSPINUP + SEDSPIN_YR_S = $SEDSPIN_YR_S + SEDSPIN_YR_E = $SEDSPIN_YR_E + SEDSPIN_NCYC = $SEDSPIN_NCYC + INIDIC = $INIDIC + INIALK = $INIALK + INIPO4 = $INIPO4 + INIOXY = $INIOXY + ININO3 = $ININO3 + INISIL = $INISIL + INID13C = $INID13C + INID14C = $INID14C + WITH_DMSPH = $WITH_DMSPH + PI_PH_FILE = $PI_PH_FILE + L_3DVARSEDPOR = $L_3DVARSEDPOR + SEDPORFILE = $SEDPORFILE +/ + +&BGCOAFX + OALKSCEN = $BGCOAFX_OALKSCEN + OALKFILE = $BGCOAFX_OALKFILE + ADDALK = $BGCOAFX_ADDALK + CDRMIP_LATMAX = $BGCOAFX_CDRMIP_LATMAX + CDRMIP_LATMIN = $BGCOAFX_CDRMIP_LATMIN + RAMP_START = $BGCOAFX_RAMP_START + RAMP_END = $BGCOAFX_RAMP_END +/ + +&DIABGC + GLB_FNAMETAG = $BGC_FNAMETAG + GLB_AVEPERIO = $BGC_AVEPERIO + GLB_FILEFREQ = $BGC_FILEFREQ + GLB_COMPFLAG = $BGC_COMPFLAG + GLB_NCFORMAT = $BGC_NCFORMAT + GLB_INVENTORY = $BGC_INVENTORY + SRF_PHOSPH = $SRF_PHOSPH + SRF_OXYGEN = $SRF_OXYGEN + SRF_IRON = $SRF_IRON + SRF_ANO3 = $SRF_ANO3 + SRF_ALKALI = $SRF_ALKALI + SRF_SILICA = $SRF_SILICA + SRF_DIC = $SRF_DIC + SRF_PHYTO = $SRF_PHYTO + SRF_PH = $SRF_PH + SRF_EXPORT = $SRF_EXPORT + 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 + SRF_NIFLUX = $SRF_NIFLUX + SRF_N2OFX = $SRF_N2OFX + SRF_DMSFLUX = $SRF_DMSFLUX + SRF_DMS = $SRF_DMS + SRF_DMSPROD = $SRF_DMSPROD + SRF_DMS_BAC = $SRF_DMS_BAC + SRF_DMS_UV = $SRF_DMS_UV + SRF_ATMCO2 = $SRF_ATMCO2 + SRF_ATMO2 = $SRF_ATMO2 + SRF_ATMN2 = $SRF_ATMN2 + SRF_NATDIC = $SRF_NATDIC + SRF_NATALKALI = $SRF_NATALKALI + SRF_NATPH = $SRF_NATPH + SRF_NATPCO2 = $SRF_NATPCO2 + SRF_NATCO2FX = $SRF_NATCO2FX + SRF_CO213FXD = $SRF_CO213FXD + SRF_CO213FXU = $SRF_CO213FXU + SRF_CO214FXD = $SRF_CO214FXD + SRF_CO214FXU = $SRF_CO214FXU + SRF_CFC11 = $SRF_CFC11 + SRF_CFC12 = $SRF_CFC12 + SRF_SF6 = $SRF_SF6 + SRF_BROMO = $SRF_BROMO + SRF_BROMOFX = $SRF_BROMOFX + INT_BROMOPRO = $INT_BROMOPRO + INT_BROMOUV = $INT_BROMOUV + INT_PHOSY = $INT_PHOSY + INT_NFIX = $INT_NFIX + INT_DNIT = $INT_DNIT + FLX_NDEP = $FLX_NDEP + FLX_OALK = $FLX_OALK + FLX_CAR0100 = $FLX_CAR0100 + FLX_CAR0500 = $FLX_CAR0500 + FLX_CAR1000 = $FLX_CAR1000 + FLX_CAR2000 = $FLX_CAR2000 + FLX_CAR4000 = $FLX_CAR4000 + FLX_CAR_BOT = $FLX_CAR_BOT + FLX_BSI0100 = $FLX_BSI0100 + FLX_BSI0500 = $FLX_BSI0500 + FLX_BSI1000 = $FLX_BSI1000 + FLX_BSI2000 = $FLX_BSI2000 + FLX_BSI4000 = $FLX_BSI4000 + FLX_BSI_BOT = $FLX_BSI_BOT + FLX_CAL0100 = $FLX_CAL0100 + FLX_CAL0500 = $FLX_CAL0500 + FLX_CAL1000 = $FLX_CAL1000 + FLX_CAL2000 = $FLX_CAL2000 + FLX_CAL4000 = $FLX_CAL4000 + FLX_CAL_BOT = $FLX_CAL_BOT + LYR_PHYTO = $LYR_PHYTO + LYR_GRAZER = $LYR_GRAZER + LYR_DOC = $LYR_DOC + LYR_PHOSY = $LYR_PHOSY + LYR_PHOSPH = $LYR_PHOSPH + LYR_OXYGEN = $LYR_OXYGEN + LYR_IRON = $LYR_IRON + LYR_ANO3 = $LYR_ANO3 + LYR_ALKALI = $LYR_ALKALI + LYR_SILICA = $LYR_SILICA + LYR_DIC = $LYR_DIC + LYR_POC = $LYR_POC + LYR_CALC = $LYR_CALC + LYR_OPAL = $LYR_OPAL + LYR_CO3 = $LYR_CO3 + LYR_N2O = $LYR_N2O + LYR_PH = $LYR_PH + LYR_OMEGAC = $LYR_OMEGAC + LYR_OMEGAA = $LYR_OMEGAA + LYR_PREFO2 = $LYR_PREFO2 + LYR_O2SAT = $LYR_O2SAT + LYR_PREFPO4 = $LYR_PREFPO4 + LYR_PREFALK = $LYR_PREFALK + LYR_PREFDIC = $LYR_PREFDIC + LYR_DICSAT = $LYR_DICSAT + LYR_NATDIC = $LYR_NATDIC + LYR_NATALKALI = $LYR_NATALKALI + LYR_NATCO3 = $LYR_NATCO3 + LYR_NATCALC = $LYR_NATCALC + LYR_NATPH = $LYR_NATPH + LYR_NATOMEGAC = $LYR_NATOMEGAC + LYR_NATOMEGAA = $LYR_NATOMEGAA + LYR_DIC13 = $LYR_DIC13 + LYR_DIC14 = $LYR_DIC14 + LYR_D13C = $LYR_D13C + LYR_D14C = $LYR_D14C + LYR_BIGD14C = $LYR_BIGD14C + LYR_POC13 = $LYR_POC13 + LYR_DOC13 = $LYR_DOC13 + LYR_CALC13 = $LYR_CALC13 + LYR_PHYTO13 = $LYR_PHYTO13 + LYR_GRAZER13 = $LYR_GRAZER13 + LYR_CFC11 = $LYR_CFC11 + LYR_CFC12 = $LYR_CFC12 + LYR_SF6 = $LYR_SF6 + LYR_NOS = $LYR_NOS + LYR_WPHY = $LYR_WPHY + LYR_WNOS = $LYR_WNOS + LYR_EPS = $LYR_EPS + LYR_ASIZE = $LYR_ASIZE + LYR_DP = $BGC_DP + LYR_BROMO = $LYR_BROMO + LVL_PHYTO = $LVL_PHYTO + LVL_GRAZER = $LVL_GRAZER + LVL_DOC = $LVL_DOC + LVL_PHOSY = $LVL_PHOSY + LVL_PHOSPH = $LVL_PHOSPH + LVL_OXYGEN = $LVL_OXYGEN + LVL_IRON = $LVL_IRON + LVL_ANO3 = $LVL_ANO3 + LVL_ALKALI = $LVL_ALKALI + LVL_SILICA = $LVL_SILICA + LVL_DIC = $LVL_DIC + LVL_POC = $LVL_POC + LVL_CALC = $LVL_CALC + LVL_OPAL = $LVL_OPAL + LVL_CO3 = $LVL_CO3 + LVL_N2O = $LVL_N2O + LVL_PH = $LVL_PH + LVL_OMEGAC = $LVL_OMEGAC + LVL_OMEGAA = $LVL_OMEGAA + LVL_PREFO2 = $LVL_PREFO2 + LVL_O2SAT = $LVL_O2SAT + LVL_PREFPO4 = $LVL_PREFPO4 + LVL_PREFALK = $LVL_PREFALK + LVL_PREFDIC = $LVL_PREFDIC + LVL_DICSAT = $LVL_DICSAT + LVL_NATDIC = $LVL_NATDIC + LVL_NATALKALI = $LVL_NATALKALI + LVL_NATCO3 = $LVL_NATCO3 + LVL_NATCALC = $LVL_NATCALC + LVL_NATPH = $LVL_NATPH + LVL_NATOMEGAC = $LVL_NATOMEGAC + LVL_NATOMEGAA = $LVL_NATOMEGAA + LVL_DIC13 = $LVL_DIC13 + LVL_DIC14 = $LVL_DIC14 + LVL_D13C = $LVL_D13C + LVL_POC13 = $LVL_POC13 + LVL_DOC13 = $LVL_DOC13 + LVL_CALC13 = $LVL_CALC13 + LVL_PHYTO13 = $LVL_PHYTO13 + LVL_GRAZER13 = $LVL_GRAZER13 + LVL_CFC11 = $LVL_CFC11 + LVL_CFC12 = $LVL_CFC12 + LVL_SF6 = $LVL_SF6 + LVL_NOS = $LVL_NOS + LVL_WPHY = $LVL_WPHY + LVL_WNOS = $LVL_WNOS + LVL_EPS = $LVL_EPS + LVL_ASIZE = $LVL_ASIZE + LVL_BROMO = $LVL_BROMO + FLX_SEDIFFIC = $FLX_SEDIFFIC + FLX_SEDIFFAL = $FLX_SEDIFFAL + FLX_SEDIFFPH = $FLX_SEDIFFPH + FLX_SEDIFFOX = $FLX_SEDIFFOX + FLX_SEDIFFN2 = $FLX_SEDIFFN2 + FLX_SEDIFFNO3 = $FLX_SEDIFFNO3 + FLX_SEDIFFSI = $FLX_SEDIFFSI + SDM_POWAIC = $SDM_POWAIC + SDM_POWAAL = $SDM_POWAAL + SDM_POWAPH = $SDM_POWAPH + SDM_POWAOX = $SDM_POWAOX + SDM_POWN2 = $SDM_POWN2 + SDM_POWNO3 = $SDM_POWNO3 + SDM_POWASI = $SDM_POWASI + SDM_SSSO12 = $SDM_SSSO12 + SDM_SSSSIL = $SDM_SSSSIL + SDM_SSSC12 = $SDM_SSSC12 + SDM_SSSTER = $SDM_SSSTER + BUR_SSSO12 = $BUR_SSSO12 + BUR_SSSSIL = $BUR_SSSSIL + BUR_SSSC12 = $BUR_SSSC12 + BUR_SSSTER = $BUR_SSSTER +/ +EOF +endif + +end ## foreach mem ("`seq $NINST_OCN`") + +#------------------------------------------------------------------------------ +# Generate blom.input_data_list +#------------------------------------------------------------------------------ + +cat > $CASEBUILD/blom.input_data_list << EOF +grid_file = `echo $GRFILE | tr -d '"' | tr -d "'"` +meridional_transport_index_file = `echo $MER_MIFILE | tr -d '"' | tr -d "'"` +meridional_transport_basin_file = `echo $MER_ORFILE | tr -d '"' | tr -d "'"` +section_index_file = `echo $SEC_SIFILE | tr -d '"' | tr -d "'"` +tidal_dissipation_file = `echo $TDFILE | tr -d '"' | tr -d "'"` +EOF +if ($SWAMTH == "'chlorophyll'") then +cat >> $CASEBUILD/blom.input_data_list << EOF +chlorophyll_concentration_file = `echo $CCFILE | tr -d '"' | tr -d "'"` +EOF +endif +if ($SRXDAY != "0.") then +cat >> $CASEBUILD/blom.input_data_list << EOF +sss_climatology_file = `echo $SCFILE | tr -d '"' | tr -d "'"` +EOF +endif + +# iHAMOCC boundary conditions +if ($ecosys == TRUE) then +cat >> $CASEBUILD/blom.input_data_list << EOF +dust_file = `echo $FEDEPFILE | tr -d '"' | tr -d "'"` +EOF + if ($BLOM_RIVER_NUTRIENTS == TRUE) then +cat >> $CASEBUILD/blom.input_data_list << EOF +river_file = `echo $RIVINFILE | tr -d '"' | tr -d "'"` +EOF + endif + if ($BLOM_N_DEPOSITION == TRUE) then +cat >> $CASEBUILD/blom.input_data_list << EOF +n_deposition_file = `echo $NDEPFILE | tr -d '"' | tr -d "'"` +EOF + endif + if ($BGCOAFX_OALKFILE != "''") then +cat >> $CASEBUILD/blom.input_data_list << EOF +oafx_file = `echo $BGCOAFX_OALKFILE | tr -d '"' | tr -d "'"` +EOF + endif + if ($HAMOCC_VSLS == TRUE) then +cat >> $CASEBUILD/blom.input_data_list << EOF +swa_clim_file = `echo $SWACLIMFILE | tr -d '"' | tr -d "'"` +EOF + endif + if ($L_3DVARSEDPOR == TRUE) then +cat >> $CASEBUILD/blom.input_data_list << EOF +sed_porosity_file = `echo $SEDPORFILE | tr -d '"' | tr -d "'"` +EOF + endif +endif + +# BLOM initial conditions +cat >> $CASEBUILD/blom.input_data_list << EOF +inicon_file = `echo $ICFILE | tr -d '"' | tr -d "'"` +EOF + + +# iHAMOCC initial conditions +if ($ecosys == TRUE) then +cat >> $CASEBUILD/blom.input_data_list << EOF +inidic_file = `echo $INIDIC | tr -d '"' | tr -d "'"` +inialk_file = `echo $INIALK | tr -d '"' | tr -d "'"` +inipo4_file = `echo $INIPO4 | tr -d '"' | tr -d "'"` +inioxy_file = `echo $INIOXY | tr -d '"' | tr -d "'"` +inino3_file = `echo $ININO3 | tr -d '"' | tr -d "'"` +inisil_file = `echo $INISIL | tr -d '"' | tr -d "'"` +EOF + if ($HAMOCC_CISO == TRUE) then +cat >> $CASEBUILD/blom.input_data_list << EOF +inic13_file = `echo $INID13C | tr -d '"' | tr -d "'"` +inic14_file = `echo $INID14C | tr -d '"' | tr -d "'"` +EOF + endif + if ($RUN_TYPE == startup) then + if ($ICFILE =~ *.blom.r.*) then +cat >> $CASEBUILD/blom.input_data_list << EOF +inicon_bgc_file = `echo $ICFILE | sed 's/.blom.r./.blom.rbgc./' | tr -d '"' | tr -d "'"` +EOF + else if ($ICFILE =~ *.micom.r.*) then +cat >> $CASEBUILD/blom.input_data_list << EOF +inicon_bgc_file = `echo $ICFILE | sed 's/.micom.r./.micom.rbgc./' | tr -d '"' | tr -d "'"` +EOF + endif + endif +endif + + diff --git a/cime_config/buildnml.py b/cime_config/buildnml.py deleted file mode 100644 index 27924f2e..00000000 --- a/cime_config/buildnml.py +++ /dev/null @@ -1,182 +0,0 @@ -#!/usr/bin/env python3 - -"""BLOM namelist creator -""" - -# Typically ignore this. -# pylint: disable=invalid-name - -# Disable these because this is our standard setup -# pylint: disable=wildcard-import,unused-wildcard-import,wrong-import-position - -import os, shutil, sys, glob, filecmp, imp, re - -CIMEROOT = os.environ.get("CIMEROOT") -if CIMEROOT is None: - raise SystemExit("ERROR: must set CIMEROOT environment variable") -sys.path.append(os.path.join(CIMEROOT, "CIME", "Tools")) - -from standard_script_setup import * -from CIME.case import Case -from CIME.nmlgen import NamelistGenerator -from CIME.utils import expect -from CIME.utils import run_cmd_no_fail, expect -from CIME.utils import run_cmd -from CIME.buildnml import create_namelist_infile, parse_input - -import glob, shutil -logger = logging.getLogger(__name__) - -# pylint: disable=too-many-arguments,too-many-locals,too-many-branches,too-many-statements -#################################################################################### -def _create_namelists(case, confdir, infile, nmlgen): -#################################################################################### - - """Write out the namelist for this component. - - Most arguments are the same as those for `NamelistGenerator`. - The `confdir` argument is used to specify the directory in which output files will be placed. - """ - - CASEROOT = case.get_value("CASEROOT") - OCN_GRID = case.get_value("OCN_GRID") - BLOM_VCOORD = case.get_value("BLOM_VCOORD") - BLOM_UNIT = case.get_value("BLOM_UNIT") - DIN_LOC_ROOT = case.get_value("DIN_LOC_ROOT") - RUN_TYPE = case.get_value("RUN_TYPE") - CONTINUE_RUN = case.get_value("CONTINUE_RUN") - CASEBUILD = case.get_value("CASEBUILD") - CCSM_CO2_PPMV = case.get_value("CCSM_CO2_PPMV") - OCN_NCPL = case.get_value("OCN_NCPL") - BLOM_COUPLING = case.get_value("BLOM_COUPLING") - RUNDIR = case.get_value("RUNDIR") - BLOM_TRACER_MODULES = case.get_value("BLOM_TRACER_MODULES") - BLOM_RIVER_NUTRIENTS = case.get_value("BLOM_RIVER_NUTRIENTS") - BLOM_N_DEPOSITION = case.get_value("BLOM_N_DEPOSITION") - BLOM_NDEP_SCENARIO = case.get_value("BLOM_NDEP_SCENARIO") - HAMOCC_VSLS = case.get_value("HAMOCC_VSLS") - HAMOCC_CISO = case.get_value("HAMOCC_CISO") - HAMOCC_SEDSPINUP = case.get_value("HAMOCC_SEDSPINUP") - HAMOCC_SEDSPINUP_YR_START = case.get_value("HAMOCC_SEDSPINUP_YR_START") - HAMOCC_SEDSPINUP_YR_END = case.get_value("HAMOCC_SEDSPINUP_YR_END") - HAMOCC_SEDSPINUP_NCYCLE = case.get_value("HAMOCC_SEDSPINUP_NCYCLE") - RUN_STARTDATE = case.get_value("RUN_STARTDATE") - PIO_TYPENAME_OCN = case.get_value("PIO_TYPENAME_OCN") - PIO_NETCDF_FORMAT_OCN = case.get_value("PIO_NETCDF_FORMAT_OCN") - NINST_OCN = case.get_value("NINST_OCN") - TEST = case.get_value("TEST") - - config['ocn_comp'] = case.get_value("COMP_OCN") - - YEAR0 = `echo $RUN_STARTDATE | cut -c1-4 ` - MONTH0 = `echo $RUN_STARTDATE | cut -c6-7 ` - DAY0 = `echo $RUN_STARTDATE | cut -c9-10` - - #---------------------------------------------------- - # Initialize namelist defaults - #---------------------------------------------------- - nmlgen.init_defaults(infile, config) - - #---------------------------------------------------- - # Write out namelist groups - #---------------------------------------------------- - groups=['limit'] - - namelist_file = os.path.join(confdir, "ocn_in") - nmlgen.write_output_file(namelist_file, data_list_path, groups=groups, sorted_groups=False) - - #logger.debug("blom: grid is %s" %(hgrid)) - #logger.debug("blom: physics is %s "%phys) - -############################################################################### -def buildnml(case, caseroot, compname): -############################################################################### - """Build the blom namelist """ - - # Build the component namelist - if compname != "blom": - raise AttributeError - comp_root_dir_ocn = case.get_value("COMP_ROOT_DIR_OCN") - srcroot = case.get_value("SRCROOT") - rundir = case.get_value("RUNDIR") - ninst = case.get_value("NINST_OCN") - - #---------------------------------------------------- - # Construct the namelist generator - #---------------------------------------------------- - # determine directory for user modified namelist_definitions.xml and namelist_defaults.xml - user_xml_dir = os.path.join(caseroot, "SourceMods", "src.blom") - expect (os.path.isdir(user_xml_dir), - "user_xml_dir %s does not exist " %user_xml_dir) - - # user definition *replaces* existing definition. - namelist_xml_dir = os.path.join(comp_root_dir_ocn, "cime_config") - definition_file = [os.path.join(namelist_xml_dir, "namelist_definition_blom.xml")] - user_definition = os.path.join(user_xml_dir, "namelist_definition_blom.xml") - if os.path.isfile(user_definition): - definition_file = [user_definition] - for file_ in definition_file: - expect(os.path.isfile(file_), "Namelist XML file %s not found!" % file_) - - # Create the namelist generator object - independent of instance - nmlgen = NamelistGenerator(case, definition_file) - - #---------------------------------------------------- - # Loop over instances - #---------------------------------------------------- - for inst_counter in range(1, ninst+1): - - # determine instance string - inst_string = "" - if ninst > 1: - inst_string = '_' + '%04d' % inst_counter - - # If multi-instance case does not have restart file, use - # single-case restart for each instance - rpointer = "rpointer.ice" - if (os.path.isfile(os.path.join(rundir,rpointer)) and - (not os.path.isfile(os.path.join(rundir,rpointer + inst_string)))): - shutil.copy(os.path.join(rundir, rpointer), - os.path.join(rundir, rpointer + inst_string)) - - inst_string_label = inst_string - if not inst_string_label: - inst_string_label = "\"\"" - - # create namelist_infile using user_nl_file as input - user_nl_file = os.path.join(caseroot, "user_nl_blom" + inst_string) - expect(os.path.isfile(user_nl_file), - "Missing required user_nl_file %s " %(user_nl_file)) - infile = os.path.join(confdir, "namelist_infile") - create_namelist_infile(case, user_nl_file, infile) - namelist_infile = [infile] - - # create namelist - _create_namelists(case, confdir, namelist_infile, nmlgen) - - # copy namelist files to rundir - if os.path.isdir(rundir): - file1 = os.path.join(confdir, "ice_in") - file2 = os.path.join(rundir, "ice_in") - if inst_string: - file2 += inst_string - logger.debug("BLOM namelist copy: file1 %s file2 %s " %(file1, file2)) - shutil.copy2(file1, file2) - -def _strip_comments(fh, token="!"): - ''' strip anything after token in each line of fh ''' - for line in fh: - s = line.split(token, 1)[0].strip() - if s: - yield s - - -############################################################################### -def _main_func(): - - caseroot = parse_input(sys.argv) - with Case(caseroot, read_only=False) as case: - buildnml(case, caseroot, "blom") - -if __name__ == "__main__": - _main_func() From 8638c67af5f78babf69874a006fd774b027c479d Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Sun, 16 Jul 2023 12:05:03 +0200 Subject: [PATCH 18/52] updates for python namelist generation --- cime_config/buildnml | 130 +- cime_config/namelist_definition_blom.xml | 2566 +++++++++++++++++++++- 2 files changed, 2633 insertions(+), 63 deletions(-) mode change 100644 => 100755 cime_config/buildnml diff --git a/cime_config/buildnml b/cime_config/buildnml old mode 100644 new mode 100755 index 27924f2e..0bdd8fd7 --- a/cime_config/buildnml +++ b/cime_config/buildnml @@ -38,53 +38,104 @@ def _create_namelists(case, confdir, infile, nmlgen): The `confdir` argument is used to specify the directory in which output files will be placed. """ - CASEROOT = case.get_value("CASEROOT") - OCN_GRID = case.get_value("OCN_GRID") - BLOM_VCOORD = case.get_value("BLOM_VCOORD") - BLOM_UNIT = case.get_value("BLOM_UNIT") - DIN_LOC_ROOT = case.get_value("DIN_LOC_ROOT") - RUN_TYPE = case.get_value("RUN_TYPE") - CONTINUE_RUN = case.get_value("CONTINUE_RUN") - CASEBUILD = case.get_value("CASEBUILD") - CCSM_CO2_PPMV = case.get_value("CCSM_CO2_PPMV") - OCN_NCPL = case.get_value("OCN_NCPL") - BLOM_COUPLING = case.get_value("BLOM_COUPLING") - RUNDIR = case.get_value("RUNDIR") - BLOM_TRACER_MODULES = case.get_value("BLOM_TRACER_MODULES") - BLOM_RIVER_NUTRIENTS = case.get_value("BLOM_RIVER_NUTRIENTS") - BLOM_N_DEPOSITION = case.get_value("BLOM_N_DEPOSITION") - BLOM_NDEP_SCENARIO = case.get_value("BLOM_NDEP_SCENARIO") - HAMOCC_VSLS = case.get_value("HAMOCC_VSLS") - HAMOCC_CISO = case.get_value("HAMOCC_CISO") - HAMOCC_SEDSPINUP = case.get_value("HAMOCC_SEDSPINUP") - HAMOCC_SEDSPINUP_YR_START = case.get_value("HAMOCC_SEDSPINUP_YR_START") - HAMOCC_SEDSPINUP_YR_END = case.get_value("HAMOCC_SEDSPINUP_YR_END") - HAMOCC_SEDSPINUP_NCYCLE = case.get_value("HAMOCC_SEDSPINUP_NCYCLE") - RUN_STARTDATE = case.get_value("RUN_STARTDATE") - PIO_TYPENAME_OCN = case.get_value("PIO_TYPENAME_OCN") - PIO_NETCDF_FORMAT_OCN = case.get_value("PIO_NETCDF_FORMAT_OCN") - NINST_OCN = case.get_value("NINST_OCN") - TEST = case.get_value("TEST") - - config['ocn_comp'] = case.get_value("COMP_OCN") - - YEAR0 = `echo $RUN_STARTDATE | cut -c1-4 ` - MONTH0 = `echo $RUN_STARTDATE | cut -c6-7 ` - DAY0 = `echo $RUN_STARTDATE | cut -c9-10` + CASEROOT = case.get_value("CASEROOT") + RUN_TYPE = case.get_value("RUN_TYPE") + CONTINUE_RUN = case.get_value("CONTINUE_RUN") + CASEBUILD = case.get_value("CASEBUILD") + CCSM_CO2_PPMV = case.get_value("CCSM_CO2_PPMV") + NINST_OCN = case.get_value("NINST_OCN") + + ocn_grid = case.get_value("OCN_GRID") + ocn_ncpl = case.get_value("OCN_NCPL") + blom_unit = case.get_value("BLOM_UNIT") + blom_vcoord = case.get_value("BLOM_VCOORD") + pio_typename_ocn = case.get_value("PIO_TYPENAME_OCN") + pio_netcdf_format_ocn = case.get_value("PIO_NETCDF_FORMAT_OCN") + is_test = case.get_value("TEST") + blom_river_nutrients = case.get_value("BLOM_RIVER_NUTRIENTS") + blom_n_deposition = case.get_value("BLOM_N_DEPOSITION") + blom_ndep_scenario = case.get_value("BLOM_NDEP_SCENARIO") + blom_coupling = case.get_value("BLOM_COUPLING") + blom_tracer_modules = case.get_value("BLOM_TRACER_MODULES") + hamocc_vsls = case.get_value("HAMOCC_VSLS") + hamocc_ciso = case.get_value("HAMOCC_CISO") + hamocc_sedspinup = case.get_value("HAMOCC_SEDSPINUP") + hamocc_sedspinup_yr_start = case.get_value("HAMOCC_SEDSPINUP_YR_START") + hamocc_sedspinup_yr_end = case.get_value("HAMOCC_SEDSPINUP_YR_END") + hamocc_sedspinup_ncycle = case.get_value("HAMOCC_SEDSPINUP_NCYCLE") + + config = {} + config['ocn_grid'] = ocn_grid + config['ocn_ncpl'] = str(ocn_ncpl) + print (f"DEBUG: ocn_ncpl is {ocn_ncpl}") + config['pio_typename_ocn'] = pio_typename_ocn + config['pio_netcdf_format_ocn'] = pio_netcdf_format_ocn + config["is_test"] = "yes" if is_test else "no" + + config['blom_unit'] = blom_unit if blom_unit else "unset" + config['blom_vcoord'] = blom_vcoord + config["blom_river_nutrients"] = "yes" if blom_river_nutrients else "no" + config["blom_ndep_scenario"] = "ssp" if "ssp" in blom_ndep_scenario else blom_ndep_scenario + config["blom_n_deposition"] = "yes" if blom_n_deposition else "no" + config["blom_coupling"] = blom_coupling + config["blom_tracer_modules"] = blom_tracer_modules + + config["hamocc_vsls"] = "yes" if hamocc_vsls else "no" + config["hamocc_ciso"] = "yes" if hamocc_ciso else "no" + config["hamocc_sedspinup"] = "yes" if hamocc_sedspinup else "no" + config["hamocc_sedspinup_yr_start"] = hamocc_sedspinup_yr_start + config["hamocc_sedspinup_yr_end"] = hamocc_sedspinup_yr_end + config["hamocc_sedspinup_ncycle"] = hamocc_sedspinup_ncycle #---------------------------------------------------- - # Initialize namelist defaults + # initialize namelist defaults #---------------------------------------------------- nmlgen.init_defaults(infile, config) + if nmlgen.get_value('SWACLIMFILE') == 'UNSET': + nmlgen.set_value('SWACLIMFILE', value="") + + run_startdate = case.get_value("RUN_STARTDATE") + idate = run_startdate.replace('-','') + nmlgen.set_value("IDATE", idate) + nmlgen.set_value("IDATE0", idate) + #---------------------------------------------------- # Write out namelist groups #---------------------------------------------------- - groups=['limit'] + groups=['limits','diffusion'] + + cwmtag = nmlgen.get_default('CWMTAG', config=config) + if cwmtag != 'UNSET': + groups.append('cwmod') + + groups.append('merdia') + groups.append('secdia') + groups.append('diaphy') + + if case.get_value("BLOM_VCOORD") == "cntiso_hybrid": + groups.append('vcoord') + + blom_tracer_modules = case.get_value("BLOM_TRACER_MODULES") + ecosys_on = "ecosys" in blom_tracer_modules + print (f"DEBUG: ecosos is {ecosys_on}") + groups.append("bgcnml") + + data_list_path = os.path.join(case.get_case_root(), "Buildconf", "blom.input_data_list") + if os.path.exists(data_list_path): + os.remove(data_list_path) namelist_file = os.path.join(confdir, "ocn_in") nmlgen.write_output_file(namelist_file, data_list_path, groups=groups, sorted_groups=False) + # replace MER_REGFLAG1 -> MER_REGFLAG4 with array syntax + from pathlib import Path + file = Path(namelist_file) + file.write_text(file.read_text().replace('MER_REGFLG1','MER_REGFLG(1,:)')) + file.write_text(file.read_text().replace('MER_REGFLG2','MER_REGFLG(2,:)')) + file.write_text(file.read_text().replace('MER_REGFLG3','MER_REGFLG(3,:)')) + file.write_text(file.read_text().replace('MER_REGFLG4','MER_REGFLG(4,:)')) + #logger.debug("blom: grid is %s" %(hgrid)) #logger.debug("blom: physics is %s "%phys) @@ -101,6 +152,11 @@ def buildnml(case, caseroot, compname): rundir = case.get_value("RUNDIR") ninst = case.get_value("NINST_OCN") + # determine the confdir directory + confdir = os.path.join(caseroot,"Buildconf","blomconf") + if not os.path.isdir(confdir): + os.makedirs(confdir) + #---------------------------------------------------- # Construct the namelist generator #---------------------------------------------------- @@ -156,8 +212,8 @@ def buildnml(case, caseroot, compname): # copy namelist files to rundir if os.path.isdir(rundir): - file1 = os.path.join(confdir, "ice_in") - file2 = os.path.join(rundir, "ice_in") + file1 = os.path.join(confdir, "ocn_in") + file2 = os.path.join(rundir, "ocn_in") if inst_string: file2 += inst_string logger.debug("BLOM namelist copy: file1 %s file2 %s " %(file1, file2)) diff --git a/cime_config/namelist_definition_blom.xml b/cime_config/namelist_definition_blom.xml index e237bb9d..43166294 100644 --- a/cime_config/namelist_definition_blom.xml +++ b/cime_config/namelist_definition_blom.xml @@ -5,29 +5,45 @@ + + + + + + + + + + + + + + + + integer limits @@ -103,8 +119,13 @@ limits limits - unset + UNSET + $DIN_LOC_ROOT/ocn/blom/grid/grid_tnx2v1_20130206.nc + $DIN_LOC_ROOT/ocn/blom/grid/grid_tnx1v4_20170622.nc + $DIN_LOC_ROOT/ocn/blom/grid/grid_tnx0.25v4_20170622.nc + $DIN_LOC_ROOT/ocn/blom/grid/grid_tnx0.125v4_20221013.nc + abs @@ -113,8 +134,13 @@ limits limits - unset + UNSET + $DIN_LOC_ROOT/ocn/blom/inicon/inicon_tnx2v1_20130419.nc + $DIN_LOC_ROOT/ocn/blom/inicon/inicon_tnx1v4_20170622.nc + $DIN_LOC_ROOT/ocn/blom/inicon/inicon_tnx0.25v4_20170623.nc + $DIN_LOC_ROOT/ocn/blom/inicon/inicon_tnx0.125v4_20230318.nc + abs @@ -135,6 +161,11 @@ limits 1800. + 3600. + 4800. + 4800. + 3200. + 3600. @@ -145,6 +176,12 @@ limits 36. + 72. + 96. + 96. + 64. + 900. + 60. @@ -371,8 +408,13 @@ limits limits - unset + UNSET + $DIN_LOC_ROOT/ocn/blom/bndcon/tidal_dissipation_tnx2v1_20130419.nc + $DIN_LOC_ROOT/ocn/blom/bndcon/tidal_dissipation_tnx1v4_20170605.nc + $DIN_LOC_ROOT/ocn/blom/bndcon/tidal_dissipation_tnx0.25v4_20170626.nc + $DIN_LOC_ROOT/ocn/blom/bndcon/tidal_dissipation_tnx0.125v4_20221013.nc + abs @@ -441,8 +483,12 @@ limits limits - unset + UNSET + $DIN_LOC_ROOT/ocn/blom/bndcon/chlorophyll_concentration_tnx1v4_20170608.nc + $DIN_LOC_ROOT/ocn/blom/bndcon/chlorophyll_concentration_tnx0.25v4_20170623.nc + $DIN_LOC_ROOT/ocn/blom/bndcon/chlorophyll_concentration_tnx0.125v4_20221013.nc + abs @@ -561,8 +607,13 @@ limits limits - unset + UNSET + $DIN_LOC_ROOT/ocn/blom/bndcon/sss_clim_core_tnx2v1_20130927.nc + $DIN_LOC_ROOT/ocn/blom/bndcon/sss_clim_core_tnx1v4_20170604.nc + $DIN_LOC_ROOT/ocn/blom/bndcon/sss_clim_core_tnx0.25v4_20170623.nc + $DIN_LOC_ROOT/ocn/blom/bndcon/sss_clim_core_tnx0.125v4_20221013.nc + abs @@ -688,4 +739,2467 @@ + + + + + + + + + + + + + char + vcoord + vcoord + + $BLOM_VCOORD + + + + + + char + vcoord + vcoord + + ppm + + + + + + char + vcoord + vcoord + + monotonic + + + + + + char + vcoord + vcoord + + non_oscillatory + + + + + + char + vcoord + vcoord + + non_oscillatory + + + + + + logical + vcoord + vcoord + + .false. + + + + + + logical + vcoord + vcoord + + .false. + + + + + + logical + vcoord + vcoord + + .true. + + + + + + logical + vcoord + vcoord + + .false. + + + + + + logical + vcoord + vcoord + + .true. + + + + + + logical + vcoord + vcoord + + .false. + + + + + + real + vcoord + vcoord + + 2.5 + + + + + + real + vcoord + vcoord + + 1.08 + + + + + + real + vcoord + vcoord + + .1 + + + + + + integer + vcoord + vcoord + + 4 + + + + + + integer + vcoord + vcoord + + 1 + + + + + + + + + + char + diffusion + diffusion + + gm + + + + + + char + diffusion + diffusion + + "large scale" + + + + + + char + diffusion + diffusion + + smooth + + + + + + logical + diffusion + diffusion + + .false. + + + + + + logical + diffusion + diffusion + + .true. + + + + + + real + diffusion + diffusion + + 0.85 + 0.5 + + + + + + real + diffusion + diffusion + + 200. + + + + + + real + diffusion + diffusion + + 4000. + 4000.e2 + + + + + + real + diffusion + diffusion + + 100. + 100.e4 + + + + + + real + diffusion + diffusion + + 1500. + 1000. + 1000.e4 + + + + + + real + diffusion + diffusion + + 1. + + + + + + char + diffusion + diffusion + + UNSET + + + + + + real + diffusion + diffusion + + 0. + + + + + + logical + diffusion + diffusion + + .false. + + + + + + logical + diffusion + diffusion + + .false. + + + + + + logical + diffusion + diffusion + + .false. + + + + + + real + diffusion + diffusion + + + + + + + + integer + diffusion + diffusion + + 2 + + + + + + real + diffusion + diffusion + + 5.e-8 + 5.e-4 + + + + + + real + diffusion + diffusion + + 1.e-5 + .1 + + + + + + logical + diffusion + diffusion + + .false. + .true. + + + + + + real + diffusion + diffusion + + .006 + + + + + + logical + diffusion + diffusion + + .true. + + + + + + char + diffusion + diffusion + + none + + + + + + char + diffusion + diffusion + + layer + neutral + + + + + + + + + + char(2) + cwmod + cwmod + + UNSET + 'Gibraltar','Gibraltar' + 'Gibraltar','Gibraltar' + 'Gibraltar','Gibraltar' + 'Gibraltar','Gibraltar' + + + + + + char(2) + cwmod + cwmod + + 'u','u' + + + + + + integer(2) + cwmod + cwmod + + 53,54 + + + + + + integer(2) + cwmod + cwmod + + 137,137 + + + + + + real(2) + cwmod + cwmod + + 30.e3,30.e3 + + + + + + + + + + char + secdia + secdia + + UNSET + $DIN_LOC_ROOT/ocn/blom/grid/section_index_tnx2v1_20190826.dat + $DIN_LOC_ROOT/ocn/blom/grid/section_index_tnx1v4_20190611.dat + $DIN_LOC_ROOT/ocn/blom/grid/section_index_tnx0.25v4_20190612.dat + $DIN_LOC_ROOT/ocn/blom/grid/section_index_tnx0.125v4_20221013.dat + + abs + + + + + + + + + + char(3) + diaphy + diaphy + + 'hd','hm','hy' + + + + + + integer(3) + diaphy + diaphy + + 1,30,365 + + + + + + integer(3) + diaphy + diaphy + + 30,30,365 + 1,30,365 + + + + + + integer(3) + diaphy + diaphy + + 0,0,0 + + + + + + integer(3) + diaphy + diaphy + + 0,0,0 + 1,1,1 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,0,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,0,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,0,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,0,0 + + + + + + integer(3) + diaphy + diaphy + + 0,0,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 4,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 4,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 4,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 4,4,0 + + + + + + integer(3) + diaphy + diaphy + + 4,4,0 + + + + + + integer(3) + diaphy + diaphy + + 4,4,0 + + + + + + integer(3) + diaphy + diaphy + + 4,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 4,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,0,0 + + + + + + integer(3) + diaphy + diaphy + + 0,0,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,0,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,0,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,0,0 + + + + + + integer(3) + diaphy + diaphy + + 0,0,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,0,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,0,4 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,0,4 + + + + + + integer(3) + diaphy + diaphy + + 0,0,4 + + + + + + integer(3) + diaphy + diaphy + + 0,0,4 + + + + + + integer(3) + diaphy + diaphy + + 0,0,4 + + + + + + integer(3) + diaphy + diaphy + + 0,0,4 + + + + + + integer(3) + diaphy + diaphy + + 0,0,4 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,0,4 + + + + + + integer(3) + diaphy + diaphy + + 0,0,4 + + + + + + integer(3) + diaphy + diaphy + + 0,0,4 + + + + + + integer(3) + diaphy + diaphy + + 0,0,4 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,0,4 + + + + + + integer(3) + diaphy + diaphy + + 0,0,4 + + + + + + integer(3) + diaphy + diaphy + + 0,0,4 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,0,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,0,4 + + + + + + integer(3) + diaphy + diaphy + + 0,0,4 + + + + + + integer(3) + diaphy + diaphy + + 0,0,4 + + + + + + integer(3) + diaphy + diaphy + + 0,0,4 + + + + + + integer(3) + diaphy + diaphy + + 0,0,4 + + + + + + integer(3) + diaphy + diaphy + + 0,0,4 + + + + + + integer(3) + diaphy + diaphy + + 0,0,4 + + + + + + integer(3) + diaphy + diaphy + + 0,0,4 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,0,4 + + + + + + integer(3) + diaphy + diaphy + + 0,0,4 + + + + + + integer(3) + diaphy + diaphy + + 0,0,4 + + + + + + integer(3) + diaphy + diaphy + + 0,0,4 + + + + + + integer(3) + diaphy + diaphy + + 0,0,4 + + + + + + integer(3) + diaphy + diaphy + + 0,0,4 + + + + + + integer(3) + diaphy + diaphy + + 0,0,4 + + + + + + integer(3) + diaphy + diaphy + + 0,0,4 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + integer(3) + diaphy + diaphy + + 0,4,0 + + + + + + + + + + + char + merdia + merdia + + UNSET + $DIN_LOC_ROOT/ocn/blom/grid/ocean_regions_tnx2v1_20190826.nc + $DIN_LOC_ROOT/ocn/blom/grid/ocean_regions_tnx1v4_20190729.nc + $DIN_LOC_ROOT/ocn/blom/grid/ocean_regions_tnx0.25v4_20190612.nc + $DIN_LOC_ROOT/ocn/blom/grid/ocean_regions_tnx0.125v4_20221013.nc + + abs + + + + + char + merdia + merdia + + UNSET + $DIN_LOC_ROOT/ocn/blom/grid/mertra_index_tnx2v1_20190826.dat + $DIN_LOC_ROOT/ocn/blom/grid/mertra_index_tnx1v4_20190615.dat + $DIN_LOC_ROOT/ocn/blom/grid/mertra_index_tnx0.25v4_20190701.dat + $DIN_LOC_ROOT/ocn/blom/grid/mertra_index_tnx0.125v4_20221013.dat + + abs + + + + + char(4) + merdia + merdia + + 'atlantic_arctic_ocean','atlantic_arctic_extended_ocean','indian_pacific_ocean','global_ocean' + + + + + + integer(20) + merdia + merdia + + 2, 4 + + Array of mask flags in ocean regions file to be included for region (1) + + + integer(20) + merdia + merdia + + 2,4,6,7,8,9 + + Array of mask flags in ocean regions file to be included for region (2) + + + integer(20) + merdia + merdia + + 3,5 + + Array of mask flags in ocean regions file to be included for region (3) + + + integer(20) + merdia + merdia + + 0 + + Array of mask flags in ocean regions file to be included for region (4) + + + + real(4) + merdia + merdia + + -34.,-34.,-34.,-90. + + Minimum latitude to be considered for each region (f) + + + + real(4) + merdia + merdia + + 90.,90.,90.,90. + + Maximum latitude to be considered for each region (f) + + + + + + + + real + bgcnml + bgcnml + + $CCSM_CO2_PPMV + + Atmospheric CO2 concentration [ppmv] + + + + char + bgcnml + bgcnml + + ' ' + $DIN_LOC_ROOT/ocn/blom/bndcon/dustdep_mhw2006_tnx2v1_20130506.nc + $DIN_LOC_ROOT/ocn/blom/bndcon/dustdep_mhw2006_tnx1v4_20171107.nc + $DIN_LOC_ROOT/ocn/blom/bndcon/dustdep_mhw2006_tnx0.25v4_20181004.nc + $DIN_LOC_ROOT/ocn/blom/bndcon/dustdep_mhw2006_tnx0.125v4_20221013.nc + + abs + 'File name (incl. full path) for iron (dust) deposition data' + + + + char + bgcnml + bgcnml + + UNSET + $DIN_LOC_ROOT/ocn/blom/bndcon/Annual_clim_swa_tnx1v4_20210415.nc + + abs + File name (incl. full path) for swa climatology field (needed if bromoform scheme is activated) + + + + logical + bgcnml + bgcnml + + .false. + .true. + + Logical switch to activate riverine input + + + + char + bgcnml + bgcnml + + ' ' + $DIN_LOC_ROOT/ocn/blom/bndcon/river_nutrients_GNEWS2000_tnx2v1_20170915.nc + $DIN_LOC_ROOT/ocn/blom/bndcon/river_nutrients_GNEWS2000_tnx1v4_20170820.nc + $DIN_LOC_ROOT/ocn/blom/bndcon/river_nutrients_GNEWS2000_tnx0.25v4_20170821.nc + $DIN_LOC_ROOT/ocn/blom/bndcon/river_nutrients_GNEWS2000_tnx0.125v4_20221013.nc + + abs + File name (incl. full path) for riverine input data + + + + + + logical + bgcnml + bgcnml + + .false. + .true. + .false. + + Logical switch to activate N-deposition + + + + char + bgcnml + bgcnml + + ' ' + $DIN_LOC_ROOT/ocn/blom/bndcon/ndep_1850_cmip6_tnx2v1_20180321.nc + $DIN_LOC_ROOT/ocn/blom/bndcon/ndep_1850_cmip6_tnx1v4_20171106.nc + $DIN_LOC_ROOT/ocn/blom/bndcon/ndep_1850_cmip6_tnx0.25v4_20190912.nc + $DIN_LOC_ROOT/ocn/blom/bndcon/ndep_1850_cmip6_tnx0.125v4_20221013.nc + $DIN_LOC_ROOT/ocn/blom/bndcon/ndep_2000_cmip6_tnx2v1_20200826.nc + $DIN_LOC_ROOT/ocn/blom/bndcon/ndep_2000_cmip6_tnx1v4_20200826.nc + $DIN_LOC_ROOT/ocn/blom/bndcon/ndep_2000_cmip6_tnx0.25v4_20200826.nc + $DIN_LOC_ROOT/ocn/blom/bndcon/ndep_185001-201412_tnx2v1_20190702.nc + $DIN_LOC_ROOT/ocn/blom/bndcon/ndep_185001-201412_tnx1v4_20180613.nc + $DIN_LOC_ROOT/ocn/blom/bndcon/ndep_185001-201412_tnx0.25v4_20190705.nc + $DIN_LOC_ROOT/ocn/blom/bndcon/ndep_201501-210012-${BLOM_NDEP_SCENARIO}_tnx1v4_20191112.nc + + abs + File name (incl. full path) for atmopheric N-deposition data + + From 46bfd6a2c95fb5623f4b3723aefe1a58c5fbce57 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Sun, 16 Jul 2023 12:05:44 +0200 Subject: [PATCH 19/52] more updates --- cime_config/buildnml | 1 - 1 file changed, 1 deletion(-) diff --git a/cime_config/buildnml b/cime_config/buildnml index 0bdd8fd7..163ea8df 100755 --- a/cime_config/buildnml +++ b/cime_config/buildnml @@ -67,7 +67,6 @@ def _create_namelists(case, confdir, infile, nmlgen): config = {} config['ocn_grid'] = ocn_grid config['ocn_ncpl'] = str(ocn_ncpl) - print (f"DEBUG: ocn_ncpl is {ocn_ncpl}") config['pio_typename_ocn'] = pio_typename_ocn config['pio_netcdf_format_ocn'] = pio_netcdf_format_ocn config["is_test"] = "yes" if is_test else "no" From 4da982e7e6c7bfa061428b95dee448bcdc7fe192 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Sun, 16 Jul 2023 12:06:05 +0200 Subject: [PATCH 20/52] more cleanup --- cime_config/buildnml.csh | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/cime_config/buildnml.csh b/cime_config/buildnml.csh index 46388741..caf1f533 100644 --- a/cime_config/buildnml.csh +++ b/cime_config/buildnml.csh @@ -316,25 +316,37 @@ else set GLB_NCFORMAT = '0, 0, 0' endif set H2D_ABSWND = '0, 4, 0' + set H2D_ALB = '0, 0, 0' + set H2D_BTMSTR = '0, 4, 0' set H2D_BRNFLX = '0, 4, 0' set H2D_BRNPD = '0, 4, 0' + set H2D_DFL = '0, 0, 0' + set H2D_EVA = '0, 4, 0' set H2D_FICE = '0, 4, 0' set H2D_FMLTFZ = '0, 4, 0' + set H2D_HICE = '0, 0, 0' + set H2D_HMLTFZ = '0, 4, 0' + set H2D_HSNW = '0, 0, 0' set H2D_IAGE = '0, 0, 0' + set H2D_IDKEDT = '0, 4, 0' set H2D_LAMULT = '0, 4, 0' set H2D_LASL = '0, 4, 0' set H2D_LIP = '0, 4, 0' + set H2D_MAXMLD = '4, 4, 0' + set H2D_MLD = '0, 4, 0' + set H2D_MLTS = '4, 4, 0' + set H2D_MLTSMN = '0, 4, 0' set H2D_MLTSMX = '0, 4, 0' set H2D_MLTSSQ = '0, 4, 0' @@ -353,32 +365,46 @@ set H2D_RNFFLX = '0, 4, 0' set H2D_SALFLX = '0, 4, 0' set H2D_SALRLX = '0, 4, 0' set H2D_SBOT = '0, 4, 0' + set H2D_SEALV = '4, 4, 0' + set H2D_SLVSQ = '0, 4, 0' set H2D_SFL = '0, 4, 0' set H2D_SOP = '0, 4, 0' set H2D_SIGMX = '0, 4, 0' + set H2D_SSS = '4, 4, 0' set H2D_SSSSQ = '4, 4, 0' set H2D_SST = '4, 4, 0' set H2D_SSTSQ = '4, 4, 0' + set H2D_SURFLX = '0, 4, 0' set H2D_SURRLX = '0, 4, 0' set H2D_SWA = '0, 4, 0' + set H2D_T20D = '4, 4, 0' + set H2D_TAUX = '0, 4, 0' set H2D_TAUY = '0, 4, 0' set H2D_TBOT = '0, 4, 0' + set H2D_TICE = '0, 0, 0' set H2D_TSRF = '0, 0, 0' + set H2D_UB = '0, 4, 0' + set H2D_UICE = '0, 0, 0' + set H2D_USTAR = '0, 4, 0' set H2D_USTAR3 = '0, 4, 0' + set H2D_USTOKES = '0, 0, 0' + set H2D_VB = '0, 4, 0' + set H2D_VICE = '0, 0, 0' set H2D_VSTOKES = '0, 0, 0' + set H2D_ZTX = '0, 4, 0' set LYR_BFSQ = '0, 4, 0' set LYR_DIFDIA = '0, 4, 0' @@ -391,10 +417,13 @@ set LYR_DP = '0, 4, 0' set LYR_DZ = '0, 4, 0' set LYR_SALN = '0, 4, 0' set LYR_TEMP = '0, 4, 0' + set LYR_TRC = '0, 0, 0' + set LYR_UFLX = '0, 4, 0' set LYR_UTFLX = '0, 4, 0' set LYR_USFLX = '0, 4, 0' + set LYR_UMFLTD = '0, 0, 4' set LYR_UMFLSM = '0, 0, 4' set LYR_UTFLTD = '0, 0, 4' @@ -403,10 +432,12 @@ set LYR_UTFLLD = '0, 0, 4' set LYR_USFLTD = '0, 0, 4' set LYR_USFLSM = '0, 0, 4' set LYR_USFLLD = '0, 0, 4' + set LYR_UVEL = '0, 4, 0' set LYR_VFLX = '0, 4, 0' set LYR_VTFLX = '0, 4, 0' set LYR_VSFLX = '0, 4, 0' + set LYR_VMFLTD = '0, 0, 4' set LYR_VMFLSM = '0, 0, 4' set LYR_VTFLTD = '0, 0, 4' @@ -415,6 +446,7 @@ set LYR_VTFLLD = '0, 0, 4' set LYR_VSFLTD = '0, 0, 4' set LYR_VSFLSM = '0, 0, 4' set LYR_VSFLLD = '0, 0, 4' + set LYR_VVEL = '0, 4, 0' set LYR_WFLX = '0, 4, 0' set LYR_WFLX2 = '0, 4, 0' @@ -432,10 +464,13 @@ set LVL_DIFISO = '0, 4, 0' set LVL_DZ = '0, 4, 0' set LVL_SALN = '0, 4, 0' set LVL_TEMP = '0, 4, 0' + set LVL_TRC = '0, 0, 0' + set LVL_UFLX = '0, 4, 0' set LVL_UTFLX = '0, 4, 0' set LVL_USFLX = '0, 4, 0' + set LVL_UMFLTD = '0, 0, 4' set LVL_UMFLSM = '0, 0, 4' set LVL_UTFLTD = '0, 0, 4' @@ -444,10 +479,12 @@ set LVL_UTFLLD = '0, 0, 4' set LVL_USFLTD = '0, 0, 4' set LVL_USFLSM = '0, 0, 4' set LVL_USFLLD = '0, 0, 4' + set LVL_UVEL = '0, 4, 0' set LVL_VFLX = '0, 4, 0' set LVL_VTFLX = '0, 4, 0' set LVL_VSFLX = '0, 4, 0' + set LVL_VMFLTD = '0, 0, 4' set LVL_VMFLSM = '0, 0, 4' set LVL_VTFLTD = '0, 0, 4' @@ -456,6 +493,7 @@ set LVL_VTFLLD = '0, 0, 4' set LVL_VSFLTD = '0, 0, 4' set LVL_VSFLSM = '0, 0, 4' set LVL_VSFLLD = '0, 0, 4' + set LVL_VVEL = '0, 4, 0' set LVL_WFLX = '0, 4, 0' set LVL_WFLX2 = '0, 4, 0' From e99c590186d53410e6145083c42439687321c120 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Sun, 16 Jul 2023 12:17:06 +0200 Subject: [PATCH 21/52] udpates for bgcnml --- cime_config/buildnml | 6 + cime_config/namelist_definition_blom.xml | 185 ++++++++++++++++++++++- 2 files changed, 189 insertions(+), 2 deletions(-) diff --git a/cime_config/buildnml b/cime_config/buildnml index 163ea8df..4f88e5c4 100755 --- a/cime_config/buildnml +++ b/cime_config/buildnml @@ -94,6 +94,12 @@ def _create_namelists(case, confdir, infile, nmlgen): if nmlgen.get_value('SWACLIMFILE') == 'UNSET': nmlgen.set_value('SWACLIMFILE', value="") + if nmlgen.get_value('INID13C') == 'UNSET': + nmlgen.set_value('INID13C', value="") + + if nmlgen.get_value('INID14C') == 'UNSET': + nmlgen.set_value('INID14C', value="") + run_startdate = case.get_value("RUN_STARTDATE") idate = run_startdate.replace('-','') nmlgen.set_value("IDATE", idate) diff --git a/cime_config/namelist_definition_blom.xml b/cime_config/namelist_definition_blom.xml index 43166294..d0dc8489 100644 --- a/cime_config/namelist_definition_blom.xml +++ b/cime_config/namelist_definition_blom.xml @@ -3166,8 +3166,6 @@ File name (incl. full path) for riverine input data - - logical bgcnml @@ -3202,4 +3200,187 @@ File name (incl. full path) for atmopheric N-deposition data + + logical + bgcnml + bgcnml + + .false. + + + + + + logical + bgcnml + bgcnml + + .false. + .true. + + Logical switch to activate sediment spin-up + + + + integer + bgcnml + bgcnml + + -1 + $HAMOCC_SEDSPINUP_YR_START + + + + + + integer + bgcnml + bgcnml + + -1 + $HAMOCC_SEDSPINUP_YR_END + + + + + + integer + bgcnml + bgcnml + + -1 + + + + + + char + bgcnml + bgcnml + + $DIN_LOC_ROOT/ocn/blom/inicon/glodapv2_Ct_preind_OMIPinit_20171107.nc + + abs + + + + + char + bgcnml + bgcnml + + $DIN_LOC_ROOT/ocn/blom/inicon/glodapv2_At_OMIPinit_20171107.nc + + abs + + + + + char + bgcnml + bgcnml + + $DIN_LOC_ROOT/ocn/blom/inicon/woa13_phosphate_OMIPinit_20171107.nc + + abs + + + + + char + bgcnml + bgcnml + + $DIN_LOC_ROOT/ocn/blom/inicon/woa13_oxygen_OMIPinit_20171107.nc + + abs + + + + + char + bgcnml + bgcnml + + $DIN_LOC_ROOT/ocn/blom/inicon/woa13_nitrate_OMIPinit_20171107.nc + + abs + + + + + char + bgcnml + bgcnml + + $DIN_LOC_ROOT/ocn/blom/inicon/woa13_silicate_OMIPinit_20171107.nc + + abs + + + + + char + bgcnml + bgcnml + + UNSET + $DIN_LOC_ROOT/ocn/blom/inicon/d13C_permil_20180609.nc + + abs + + + + + char + bgcnml + bgcnml + + UNSET + $DIN_LOC_ROOT/ocn/blom/inicon/d14C_permil_20180609.nc + + abs + + + + + logical + bgcnml + bgcnml + + .false. + + + + + + char + bgcnml + bgcnml + + ' ' + + + + + + logical + bgcnml + bgcnml + + .false. + + + + + + char + bgcnml + bgcnml + + ' ' + + + + From c7c6c6e78f3f46e27e45f8b04513f91f54bf799d Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Sun, 16 Jul 2023 16:49:22 +0200 Subject: [PATCH 22/52] more extensions --- cime_config/buildnml | 4 + cime_config/namelist_definition_blom.xml | 122 +++++++++++++++-------- 2 files changed, 84 insertions(+), 42 deletions(-) diff --git a/cime_config/buildnml b/cime_config/buildnml index 4f88e5c4..ca1cf6bf 100755 --- a/cime_config/buildnml +++ b/cime_config/buildnml @@ -64,6 +64,10 @@ def _create_namelists(case, confdir, infile, nmlgen): hamocc_sedspinup_yr_end = case.get_value("HAMOCC_SEDSPINUP_YR_END") hamocc_sedspinup_ncycle = case.get_value("HAMOCC_SEDSPINUP_NCYCLE") + if hamocc_vsls and ocn_grid != "tnx1v4": + expect(False, + "HAMOCC_VSLS is not supported at this grid resolution (no swa-climatology available)") + config = {} config['ocn_grid'] = ocn_grid config['ocn_ncpl'] = str(ocn_ncpl) diff --git a/cime_config/namelist_definition_blom.xml b/cime_config/namelist_definition_blom.xml index d0dc8489..66269cc6 100644 --- a/cime_config/namelist_definition_blom.xml +++ b/cime_config/namelist_definition_blom.xml @@ -121,8 +121,8 @@ UNSET $DIN_LOC_ROOT/ocn/blom/grid/grid_tnx2v1_20130206.nc - $DIN_LOC_ROOT/ocn/blom/grid/grid_tnx1v4_20170622.nc - $DIN_LOC_ROOT/ocn/blom/grid/grid_tnx0.25v4_20170622.nc + $DIN_LOC_ROOT/ocn/blom/grid/grid_tnx1v4_20170622.nc + $DIN_LOC_ROOT/ocn/blom/grid/grid_tnx0.25v4_20170622.nc $DIN_LOC_ROOT/ocn/blom/grid/grid_tnx0.125v4_20221013.nc abs @@ -136,8 +136,8 @@ UNSET $DIN_LOC_ROOT/ocn/blom/inicon/inicon_tnx2v1_20130419.nc - $DIN_LOC_ROOT/ocn/blom/inicon/inicon_tnx1v4_20170622.nc - $DIN_LOC_ROOT/ocn/blom/inicon/inicon_tnx0.25v4_20170623.nc + $DIN_LOC_ROOT/ocn/blom/inicon/inicon_tnx1v4_20170622.nc + $DIN_LOC_ROOT/ocn/blom/inicon/inicon_tnx0.25v4_20170623.nc $DIN_LOC_ROOT/ocn/blom/inicon/inicon_tnx0.125v4_20230318.nc abs @@ -161,11 +161,11 @@ limits 1800. - 3600. 4800. 4800. - 3200. - 3600. + 3200. + 900. + 300. @@ -176,12 +176,12 @@ limits 36. - 72. 96. 96. - 64. - 900. - 60. + 64. + 60. + 15. + 6. @@ -193,6 +193,10 @@ .02 2. + .0015 + .15 + .001 + .1 @@ -204,6 +208,10 @@ .004 .4 + .0015 + .15 + .001 + .1 @@ -214,7 +222,6 @@ limits 0. - 0. @@ -225,7 +232,6 @@ limits 0. - 0. @@ -237,6 +243,8 @@ 5000. 5000.e4 + 300. + 300.e4 @@ -248,6 +256,8 @@ 300. 300.e4 + 300. + 300.e4 @@ -258,6 +268,8 @@ limits .5 + .15 + 0. @@ -268,6 +280,8 @@ limits .5 + .15 + 0. @@ -278,6 +292,8 @@ limits 0. + 0.0625 + 0.06 @@ -288,6 +304,8 @@ limits 0. + 0.0625 + 0.06 @@ -319,6 +337,9 @@ limits 5.e-5 + 0.75e-4 + 0.75e-4 + 0.75e-4 @@ -399,6 +420,8 @@ limits .06 + .5 + 1.0 @@ -410,8 +433,8 @@ UNSET $DIN_LOC_ROOT/ocn/blom/bndcon/tidal_dissipation_tnx2v1_20130419.nc - $DIN_LOC_ROOT/ocn/blom/bndcon/tidal_dissipation_tnx1v4_20170605.nc - $DIN_LOC_ROOT/ocn/blom/bndcon/tidal_dissipation_tnx0.25v4_20170626.nc + $DIN_LOC_ROOT/ocn/blom/bndcon/tidal_dissipation_tnx1v4_20170605.nc + $DIN_LOC_ROOT/ocn/blom/bndcon/tidal_dissipation_tnx0.25v4_20170626.nc $DIN_LOC_ROOT/ocn/blom/bndcon/tidal_dissipation_tnx0.125v4_20221013.nc abs @@ -424,6 +447,7 @@ limits 0. + .4 @@ -483,9 +507,9 @@ limits limits - UNSET - $DIN_LOC_ROOT/ocn/blom/bndcon/chlorophyll_concentration_tnx1v4_20170608.nc - $DIN_LOC_ROOT/ocn/blom/bndcon/chlorophyll_concentration_tnx0.25v4_20170623.nc + unset + $DIN_LOC_ROOT/ocn/blom/bndcon/chlorophyll_concentration_tnx1v4_20170608.nc + $DIN_LOC_ROOT/ocn/blom/bndcon/chlorophyll_concentration_tnx0.25v4_20170623.nc $DIN_LOC_ROOT/ocn/blom/bndcon/chlorophyll_concentration_tnx0.125v4_20221013.nc abs @@ -607,10 +631,10 @@ limits limits - UNSET + unset $DIN_LOC_ROOT/ocn/blom/bndcon/sss_clim_core_tnx2v1_20130927.nc - $DIN_LOC_ROOT/ocn/blom/bndcon/sss_clim_core_tnx1v4_20170604.nc - $DIN_LOC_ROOT/ocn/blom/bndcon/sss_clim_core_tnx0.25v4_20170623.nc + $DIN_LOC_ROOT/ocn/blom/bndcon/sss_clim_core_tnx1v4_20170604.nc + $DIN_LOC_ROOT/ocn/blom/bndcon/sss_clim_core_tnx0.25v4_20170623.nc $DIN_LOC_ROOT/ocn/blom/bndcon/sss_clim_core_tnx0.125v4_20221013.nc abs @@ -633,6 +657,7 @@ limits .true. + .false. @@ -940,6 +965,8 @@ diffusion smooth + step + step @@ -971,6 +998,7 @@ 0.85 0.5 + 0.5 @@ -1003,6 +1031,7 @@ 100. 100.e4 + 0. @@ -1013,8 +1042,12 @@ diffusion 1500. + 1500.e4 1000. 1000.e4 + 1000. + 1000.e4 + 0. @@ -1167,8 +1200,10 @@ diffusion diffusion - layer - neutral + neutral + layer + layer + layer @@ -1184,8 +1219,6 @@ UNSET 'Gibraltar','Gibraltar' - 'Gibraltar','Gibraltar' - 'Gibraltar','Gibraltar' 'Gibraltar','Gibraltar' @@ -1196,7 +1229,8 @@ cwmod cwmod - 'u','u' + 'u','u' + 'u','u' @@ -1206,7 +1240,8 @@ cwmod cwmod - 53,54 + 53,54 + 105,106 @@ -1216,7 +1251,8 @@ cwmod cwmod - 137,137 + 137,137 + 273,273 @@ -1226,7 +1262,9 @@ cwmod cwmod - 30.e3,30.e3 + 30.e3,30.e3 + 30.e3,30.e3 + @@ -1240,10 +1278,10 @@ secdia secdia - UNSET + unset $DIN_LOC_ROOT/ocn/blom/grid/section_index_tnx2v1_20190826.dat - $DIN_LOC_ROOT/ocn/blom/grid/section_index_tnx1v4_20190611.dat - $DIN_LOC_ROOT/ocn/blom/grid/section_index_tnx0.25v4_20190612.dat + $DIN_LOC_ROOT/ocn/blom/grid/section_index_tnx1v4_20190611.dat + $DIN_LOC_ROOT/ocn/blom/grid/section_index_tnx0.25v4_20190612.dat $DIN_LOC_ROOT/ocn/blom/grid/section_index_tnx0.125v4_20221013.dat abs @@ -3009,8 +3047,8 @@ UNSET $DIN_LOC_ROOT/ocn/blom/grid/ocean_regions_tnx2v1_20190826.nc - $DIN_LOC_ROOT/ocn/blom/grid/ocean_regions_tnx1v4_20190729.nc - $DIN_LOC_ROOT/ocn/blom/grid/ocean_regions_tnx0.25v4_20190612.nc + $DIN_LOC_ROOT/ocn/blom/grid/ocean_regions_tnx1v4_20190729.nc + $DIN_LOC_ROOT/ocn/blom/grid/ocean_regions_tnx0.25v4_20190612.nc $DIN_LOC_ROOT/ocn/blom/grid/ocean_regions_tnx0.125v4_20221013.nc abs @@ -3024,8 +3062,8 @@ UNSET $DIN_LOC_ROOT/ocn/blom/grid/mertra_index_tnx2v1_20190826.dat - $DIN_LOC_ROOT/ocn/blom/grid/mertra_index_tnx1v4_20190615.dat - $DIN_LOC_ROOT/ocn/blom/grid/mertra_index_tnx0.25v4_20190701.dat + $DIN_LOC_ROOT/ocn/blom/grid/mertra_index_tnx1v4_20190615.dat + $DIN_LOC_ROOT/ocn/blom/grid/mertra_index_tnx0.25v4_20190701.dat $DIN_LOC_ROOT/ocn/blom/grid/mertra_index_tnx0.125v4_20221013.dat abs @@ -3188,16 +3226,16 @@ $DIN_LOC_ROOT/ocn/blom/bndcon/ndep_1850_cmip6_tnx1v4_20171106.nc $DIN_LOC_ROOT/ocn/blom/bndcon/ndep_1850_cmip6_tnx0.25v4_20190912.nc $DIN_LOC_ROOT/ocn/blom/bndcon/ndep_1850_cmip6_tnx0.125v4_20221013.nc - $DIN_LOC_ROOT/ocn/blom/bndcon/ndep_2000_cmip6_tnx2v1_20200826.nc - $DIN_LOC_ROOT/ocn/blom/bndcon/ndep_2000_cmip6_tnx1v4_20200826.nc + $DIN_LOC_ROOT/ocn/blom/bndcon/ndep_2000_cmip6_tnx2v1_20200826.nc + $DIN_LOC_ROOT/ocn/blom/bndcon/ndep_2000_cmip6_tnx1v4_20200826.nc $DIN_LOC_ROOT/ocn/blom/bndcon/ndep_2000_cmip6_tnx0.25v4_20200826.nc - $DIN_LOC_ROOT/ocn/blom/bndcon/ndep_185001-201412_tnx2v1_20190702.nc - $DIN_LOC_ROOT/ocn/blom/bndcon/ndep_185001-201412_tnx1v4_20180613.nc + $DIN_LOC_ROOT/ocn/blom/bndcon/ndep_185001-201412_tnx2v1_20190702.nc + $DIN_LOC_ROOT/ocn/blom/bndcon/ndep_185001-201412_tnx1v4_20180613.nc $DIN_LOC_ROOT/ocn/blom/bndcon/ndep_185001-201412_tnx0.25v4_20190705.nc - $DIN_LOC_ROOT/ocn/blom/bndcon/ndep_201501-210012-${BLOM_NDEP_SCENARIO}_tnx1v4_20191112.nc + $DIN_LOC_ROOT/ocn/blom/bndcon/ndep_201501-210012-${BLOM_NDEP_SCENARIO}_tnx1v4_20191112.nc abs - File name (incl. full path) for atmopheric N-deposition data + File name (incl. full path) for atmopheric N-deposition data From ab237bde8cc7155bf5d9fb9ca1d09715ece2d33c Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Sun, 16 Jul 2023 18:46:27 +0200 Subject: [PATCH 23/52] update for bgc diag output --- cime_config/buildnml | 12 +- cime_config/namelist_definition_blom.xml | 2069 +++++++++++++++++++++- 2 files changed, 2076 insertions(+), 5 deletions(-) diff --git a/cime_config/buildnml b/cime_config/buildnml index ca1cf6bf..868d6a61 100755 --- a/cime_config/buildnml +++ b/cime_config/buildnml @@ -127,8 +127,13 @@ def _create_namelists(case, confdir, infile, nmlgen): blom_tracer_modules = case.get_value("BLOM_TRACER_MODULES") ecosys_on = "ecosys" in blom_tracer_modules - print (f"DEBUG: ecosos is {ecosys_on}") - groups.append("bgcnml") + # DEBUG + ecosys_on = True + # DEBUG + if ecosys_on: + groups.append("bgcnml") + groups.append("bgcoafx") + groups.append("diabgc") data_list_path = os.path.join(case.get_case_root(), "Buildconf", "blom.input_data_list") if os.path.exists(data_list_path): @@ -145,8 +150,7 @@ def _create_namelists(case, confdir, infile, nmlgen): file.write_text(file.read_text().replace('MER_REGFLG3','MER_REGFLG(3,:)')) file.write_text(file.read_text().replace('MER_REGFLG4','MER_REGFLG(4,:)')) - #logger.debug("blom: grid is %s" %(hgrid)) - #logger.debug("blom: physics is %s "%phys) + logger.debug(f"blom: grid is {ocn_grid}") ############################################################################### def buildnml(case, caseroot, compname): diff --git a/cime_config/namelist_definition_blom.xml b/cime_config/namelist_definition_blom.xml index 66269cc6..8b39c987 100644 --- a/cime_config/namelist_definition_blom.xml +++ b/cime_config/namelist_definition_blom.xml @@ -532,6 +532,8 @@ limits 0. + 60. + 6. @@ -552,6 +554,8 @@ limits 1. + 1. + 10. @@ -622,6 +626,7 @@ limits .false. + .true. @@ -668,6 +673,7 @@ limits .false. + .true. @@ -3362,7 +3368,7 @@ bgcnml bgcnml - UNSET + UNSET $DIN_LOC_ROOT/ocn/blom/inicon/d13C_permil_20180609.nc abs @@ -3421,4 +3427,2065 @@ + + + + + + char + bgcoafx + bgcoafx + + ' ' + + + + + + char + bgcoafx + bgcoafx + + ' ' + + + + + + real + bgcoafx + bgcoafx + + 0.135 + + + + + + real + bgcoafx + bgcoafx + + 70.0 + + + + + + real + bgcoafx + bgcoafx + + -60.0 + + + + + + real + bgcoafx + bgcoafx + + 2025 + + + + + + real + bgcoafx + bgcoafx + + 2035 + + + + + + + + + + char(3) + diabgc + diabgc + + 'hbgcd','hbgcm','hbgcy' + + + + + + integer(3) + diabgc + diabgc + + 30,30,365 + 1,30,365 + + + + + + integer(3) + diabgc + diabgc + + 0,0,0 + + + + + + integer(3) + diaphy + diaphy + + 0,0,0 + 1,1,1 + + + + + + integer(3) + diabgc + diabgc + + 0, 1, 0 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 4, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 4, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 4, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 4, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 4, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 4, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0,0,0 + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 0 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 4 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 0 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 4 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 4 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 0 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 0 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 4, 4 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 4, 4 + + + + + + integer(3) + diabgc + diabgc + + 0, 4, 4 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 0 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 0 + + + + + + integer(3) + diabgc + diabgc + + 0, 2, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + + + integer(3) + diabgc + diabgc + + 0, 0, 2 + + + + From 4bac767f3f608998edcd20bc1b5b9c40462dcb44 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Mon, 17 Jul 2023 10:05:11 +0200 Subject: [PATCH 24/52] updates for user_nl_blom and copy of ocn_in.readme --- cime_config/buildcpp | 3 +- cime_config/buildnml | 69 +- cime_config/namelist_definition_blom.xml | 1094 +++++++++++----------- cime_config/user_nl_blom | 32 +- 4 files changed, 619 insertions(+), 579 deletions(-) diff --git a/cime_config/buildcpp b/cime_config/buildcpp index dc6cd8e8..4799052a 100644 --- a/cime_config/buildcpp +++ b/cime_config/buildcpp @@ -91,7 +91,8 @@ def buildcpp(case): blom_unit = case.get_value("BLOM_UNIT") pio_typename = case.get_value("PIO_TYPENAME", subgroup="OCN") - expect(blom_vcoord != "cntiso_hybrid" or not turbclo, "BLOM_VCOORD == {} and BLOM_TURBULENT_CLOSURE == {} is not a valid combination".format(blom_vcoord, turbclo)) + expect(blom_vcoord != "cntiso_hybrid" or not turbclo, + f"BLOM_VCOORD == {blom_vcoord} and BLOM_TURBULENT_CLOSURE == {turblo} is not a valid combination") blom_cppdefs = "" diff --git a/cime_config/buildnml b/cime_config/buildnml index 868d6a61..81df75cb 100755 --- a/cime_config/buildnml +++ b/cime_config/buildnml @@ -37,14 +37,10 @@ def _create_namelists(case, confdir, infile, nmlgen): Most arguments are the same as those for `NamelistGenerator`. The `confdir` argument is used to specify the directory in which output files will be placed. """ - - CASEROOT = case.get_value("CASEROOT") - RUN_TYPE = case.get_value("RUN_TYPE") - CONTINUE_RUN = case.get_value("CONTINUE_RUN") - CASEBUILD = case.get_value("CASEBUILD") - CCSM_CO2_PPMV = case.get_value("CCSM_CO2_PPMV") - NINST_OCN = case.get_value("NINST_OCN") - + rundir = case.get_value("RUNDIR") + srcroot = case.get_value("SRCROOT") + caseroot = case.get_value("CASEROOT") + continue_run = case.get_value("CONTINUE_RUN") ocn_grid = case.get_value("OCN_GRID") ocn_ncpl = case.get_value("OCN_NCPL") blom_unit = case.get_value("BLOM_UNIT") @@ -64,15 +60,19 @@ def _create_namelists(case, confdir, infile, nmlgen): hamocc_sedspinup_yr_end = case.get_value("HAMOCC_SEDSPINUP_YR_END") hamocc_sedspinup_ncycle = case.get_value("HAMOCC_SEDSPINUP_NCYCLE") + # error checks if hamocc_vsls and ocn_grid != "tnx1v4": expect(False, "HAMOCC_VSLS is not supported at this grid resolution (no swa-climatology available)") + # create config dictionary - used in namelist_definition_blom.xml config = {} + config['ocn_grid'] = ocn_grid config['ocn_ncpl'] = str(ocn_ncpl) config['pio_typename_ocn'] = pio_typename_ocn config['pio_netcdf_format_ocn'] = pio_netcdf_format_ocn + config["continue_run"] = "yes" if continue_run else "no" config["is_test"] = "yes" if is_test else "no" config['blom_unit'] = blom_unit if blom_unit else "unset" @@ -95,26 +95,26 @@ def _create_namelists(case, confdir, infile, nmlgen): #---------------------------------------------------- nmlgen.init_defaults(infile, config) - if nmlgen.get_value('SWACLIMFILE') == 'UNSET': - nmlgen.set_value('SWACLIMFILE', value="") + if nmlgen.get_value('swaclimfile') == 'UNSET': + nmlgen.set_value('swaclimfile', value="") - if nmlgen.get_value('INID13C') == 'UNSET': - nmlgen.set_value('INID13C', value="") + if nmlgen.get_value('inid13c') == 'UNSET': + nmlgen.set_value('inid13c', value="") - if nmlgen.get_value('INID14C') == 'UNSET': - nmlgen.set_value('INID14C', value="") + if nmlgen.get_value('inid14c') == 'UNSET': + nmlgen.set_value('inid14c', value="") run_startdate = case.get_value("RUN_STARTDATE") idate = run_startdate.replace('-','') - nmlgen.set_value("IDATE", idate) - nmlgen.set_value("IDATE0", idate) + nmlgen.set_value("idate", idate) + nmlgen.set_value("idate0", idate) #---------------------------------------------------- # Write out namelist groups #---------------------------------------------------- groups=['limits','diffusion'] - cwmtag = nmlgen.get_default('CWMTAG', config=config) + cwmtag = nmlgen.get_default('cwmtag', config=config) if cwmtag != 'UNSET': groups.append('cwmod') @@ -127,9 +127,6 @@ def _create_namelists(case, confdir, infile, nmlgen): blom_tracer_modules = case.get_value("BLOM_TRACER_MODULES") ecosys_on = "ecosys" in blom_tracer_modules - # DEBUG - ecosys_on = True - # DEBUG if ecosys_on: groups.append("bgcnml") groups.append("bgcoafx") @@ -145,12 +142,34 @@ def _create_namelists(case, confdir, infile, nmlgen): # replace MER_REGFLAG1 -> MER_REGFLAG4 with array syntax from pathlib import Path file = Path(namelist_file) - file.write_text(file.read_text().replace('MER_REGFLG1','MER_REGFLG(1,:)')) - file.write_text(file.read_text().replace('MER_REGFLG2','MER_REGFLG(2,:)')) - file.write_text(file.read_text().replace('MER_REGFLG3','MER_REGFLG(3,:)')) - file.write_text(file.read_text().replace('MER_REGFLG4','MER_REGFLG(4,:)')) + file.write_text(file.read_text().replace('mer_regflg1','mer_regflg(1,:)')) + file.write_text(file.read_text().replace('mer_regflg2','mer_regflg(2,:)')) + file.write_text(file.read_text().replace('mer_regflg3','mer_regflg(3,:)')) + file.write_text(file.read_text().replace('mer_regflg4','mer_regflg(4,:)')) - logger.debug(f"blom: grid is {ocn_grid}") + namelist_file_temp = os.path.join(confdir, "ocn_in_temp") + fread = open(namelist_file, "r") + fwrite = open(namelist_file_temp, "w") + for line in fread: + if '=' in line: + x = line.split() + x[0] = x[0].upper() + line = " " + ' '.join(x) + '\n' + elif '&' in line or '/' in line: + x = line.split() + line = x[0].upper() + '\n' + fwrite.write(line) + fread.close() + fwrite.close() + shutil.move(namelist_file_temp, namelist_file) + + src_filename = os.path.join(srcroot,"components","blom","cime_config","ocn_in.readme") + dst_filename = os.path.join(rundir,"ocn_in.readme") + + if not os.path.exists(dst_filename): + shutil.copy(src_filename, dst_filename) + + #logger.debug(f"blom: grid is {ocn_grid}") ############################################################################### def buildnml(case, caseroot, compname): diff --git a/cime_config/namelist_definition_blom.xml b/cime_config/namelist_definition_blom.xml index 8b39c987..66defd0f 100644 --- a/cime_config/namelist_definition_blom.xml +++ b/cime_config/namelist_definition_blom.xml @@ -28,23 +28,11 @@ that have only a small number of allowed values. --> - - - - - - - - - - - - - + integer limits limits @@ -54,7 +42,7 @@ - + integer limits limits @@ -64,7 +52,7 @@ - + integer limits limits @@ -74,7 +62,7 @@ - + integer limits limits @@ -84,7 +72,7 @@ - + limits limits @@ -94,7 +82,7 @@ char - + char limits limits @@ -104,17 +92,18 @@ - + char limits limits - initial + $RUN_TYPE + continue - + char limits limits @@ -129,7 +118,7 @@ - + char limits limits @@ -144,7 +133,7 @@ - + real limits limits @@ -155,7 +144,7 @@ - + real limits limits @@ -164,13 +153,14 @@ 4800. 4800. 3200. + 3600. 900. 300. - + real limits limits @@ -186,7 +176,7 @@ - + real limits limits @@ -201,7 +191,7 @@ - + real limits limits @@ -216,7 +206,7 @@ - + real limits limits @@ -226,7 +216,7 @@ - + real limits limits @@ -236,7 +226,7 @@ - + real limits limits @@ -249,7 +239,7 @@ - + real limits limits @@ -262,7 +252,7 @@ - + real limits limits @@ -274,7 +264,7 @@ - + real limits limits @@ -286,7 +276,7 @@ - + real limits limits @@ -298,7 +288,7 @@ - + real limits limits @@ -310,7 +300,7 @@ - + real limits limits @@ -321,7 +311,7 @@ - + real limits limits @@ -331,20 +321,20 @@ - + real limits limits 5.e-5 - 0.75e-4 + .75e-4 0.75e-4 0.75e-4 - + real limits limits @@ -354,7 +344,7 @@ - + char limits limits @@ -364,7 +354,7 @@ - + char limits limits @@ -374,7 +364,7 @@ - + char limits limits @@ -384,7 +374,7 @@ - + char limits limits @@ -394,7 +384,7 @@ - + real limits limits @@ -404,7 +394,7 @@ - + real limits limits @@ -414,19 +404,19 @@ - + real limits limits .06 - .5 - 1.0 + .5 + 1.0 - + char limits limits @@ -441,7 +431,7 @@ - + real limits limits @@ -452,7 +442,7 @@ - + real limits limits @@ -462,7 +452,7 @@ - + real limits limits @@ -472,7 +462,7 @@ - + char limits limits @@ -482,7 +472,7 @@ - + integer limits limits @@ -492,7 +482,7 @@ - + char limits limits @@ -502,7 +492,7 @@ - + char limits limits @@ -516,7 +506,7 @@ - + real limits limits @@ -526,7 +516,7 @@ - + real limits limits @@ -538,7 +528,7 @@ - + real limits limits @@ -548,7 +538,7 @@ - + real limits limits @@ -560,7 +550,7 @@ - + real limits limits @@ -570,7 +560,7 @@ - + real limits limits @@ -580,7 +570,7 @@ - + logical limits limits @@ -590,7 +580,7 @@ - + logical limits limits @@ -600,7 +590,7 @@ - + logical limits limits @@ -610,7 +600,7 @@ - + logical limits limits @@ -620,7 +610,7 @@ - + logical limits limits @@ -631,7 +621,7 @@ - + char limits limits @@ -646,7 +636,7 @@ - + char limits limits @@ -656,7 +646,7 @@ - + logical limits limits @@ -667,7 +657,7 @@ - + logical limits limits @@ -678,7 +668,7 @@ - + char limits limits @@ -688,7 +678,7 @@ - + integer limits limits @@ -698,7 +688,7 @@ - + integer limits limits @@ -708,7 +698,7 @@ - + logical limits limits @@ -718,7 +708,7 @@ - + logical limits limits @@ -728,7 +718,7 @@ - + integer limits limits @@ -738,7 +728,7 @@ - + integer limits limits @@ -749,7 +739,7 @@ - + integer limits limits @@ -759,7 +749,7 @@ - + integer limits limits @@ -781,7 +771,7 @@ - + char vcoord vcoord @@ -791,7 +781,7 @@ - + char vcoord vcoord @@ -801,7 +791,7 @@ - + char vcoord vcoord @@ -811,7 +801,7 @@ - + char vcoord vcoord @@ -821,7 +811,7 @@ - + char vcoord vcoord @@ -831,7 +821,7 @@ - + logical vcoord vcoord @@ -841,7 +831,7 @@ - + logical vcoord vcoord @@ -851,7 +841,7 @@ - + logical vcoord vcoord @@ -861,7 +851,7 @@ - + logical vcoord vcoord @@ -871,7 +861,7 @@ - + logical vcoord vcoord @@ -881,7 +871,7 @@ - + logical vcoord vcoord @@ -891,7 +881,7 @@ - + real vcoord vcoord @@ -901,7 +891,7 @@ - + real vcoord vcoord @@ -911,7 +901,7 @@ - + real vcoord vcoord @@ -921,7 +911,7 @@ - + integer vcoord vcoord @@ -931,7 +921,7 @@ - + integer vcoord vcoord @@ -945,7 +935,7 @@ - + char diffusion diffusion @@ -955,7 +945,7 @@ - + char diffusion diffusion @@ -965,7 +955,7 @@ - + char diffusion diffusion @@ -977,7 +967,7 @@ - + logical diffusion diffusion @@ -987,7 +977,7 @@ - + logical diffusion diffusion @@ -997,7 +987,7 @@ - + real diffusion diffusion @@ -1009,7 +999,7 @@ - + real diffusion diffusion @@ -1019,7 +1009,7 @@ - + real diffusion diffusion @@ -1030,7 +1020,7 @@ - + real diffusion diffusion @@ -1042,7 +1032,7 @@ - + real diffusion diffusion @@ -1058,7 +1048,7 @@ - + real diffusion diffusion @@ -1068,17 +1058,17 @@ - + char diffusion diffusion - UNSET + unset - + real diffusion diffusion @@ -1088,7 +1078,7 @@ - + logical diffusion diffusion @@ -1098,7 +1088,7 @@ - + logical diffusion diffusion @@ -1108,7 +1098,7 @@ - + logical diffusion diffusion @@ -1118,17 +1108,17 @@ - + real diffusion diffusion - + 1.2 - + integer diffusion diffusion @@ -1138,7 +1128,7 @@ - + real diffusion diffusion @@ -1149,7 +1139,7 @@ - + real diffusion diffusion @@ -1160,7 +1150,7 @@ - + logical diffusion diffusion @@ -1171,7 +1161,7 @@ - + real diffusion diffusion @@ -1181,7 +1171,7 @@ - + logical diffusion diffusion @@ -1191,7 +1181,7 @@ - + char diffusion diffusion @@ -1201,7 +1191,7 @@ - + char diffusion diffusion @@ -1218,7 +1208,7 @@ - + char(2) cwmod cwmod @@ -1230,7 +1220,7 @@ - + char(2) cwmod cwmod @@ -1241,7 +1231,7 @@ - + integer(2) cwmod cwmod @@ -1252,7 +1242,7 @@ - + integer(2) cwmod cwmod @@ -1263,7 +1253,7 @@ - + real(2) cwmod cwmod @@ -1279,7 +1269,7 @@ - + char secdia secdia @@ -1299,7 +1289,7 @@ - + char(3) diaphy diaphy @@ -1309,7 +1299,7 @@ - + integer(3) diaphy diaphy @@ -1319,7 +1309,7 @@ - + integer(3) diaphy diaphy @@ -1330,7 +1320,7 @@ - + integer(3) diaphy diaphy @@ -1340,7 +1330,7 @@ - + integer(3) diaphy diaphy @@ -1351,7 +1341,7 @@ - + integer(3) diaphy diaphy @@ -1361,7 +1351,7 @@ - + integer(3) diaphy diaphy @@ -1371,7 +1361,7 @@ - + integer(3) diaphy diaphy @@ -1381,7 +1371,7 @@ - + integer(3) diaphy diaphy @@ -1391,7 +1381,7 @@ - + integer(3) diaphy diaphy @@ -1401,7 +1391,7 @@ - + integer(3) diaphy diaphy @@ -1411,7 +1401,7 @@ - + integer(3) diaphy diaphy @@ -1421,7 +1411,7 @@ - + integer(3) diaphy diaphy @@ -1431,7 +1421,7 @@ - + integer(3) diaphy diaphy @@ -1441,7 +1431,7 @@ - + integer(3) diaphy diaphy @@ -1451,7 +1441,7 @@ - + integer(3) diaphy diaphy @@ -1461,7 +1451,7 @@ - + integer(3) diaphy diaphy @@ -1471,7 +1461,7 @@ - + integer(3) diaphy diaphy @@ -1481,7 +1471,7 @@ - + integer(3) diaphy diaphy @@ -1491,7 +1481,7 @@ - + integer(3) diaphy diaphy @@ -1501,7 +1491,7 @@ - + integer(3) diaphy diaphy @@ -1511,7 +1501,7 @@ - + integer(3) diaphy diaphy @@ -1521,7 +1511,7 @@ - + integer(3) diaphy diaphy @@ -1531,7 +1521,7 @@ - + integer(3) diaphy diaphy @@ -1541,7 +1531,7 @@ - + integer(3) diaphy diaphy @@ -1551,7 +1541,7 @@ - + integer(3) diaphy diaphy @@ -1561,7 +1551,7 @@ - + integer(3) diaphy diaphy @@ -1571,7 +1561,7 @@ - + integer(3) diaphy diaphy @@ -1581,7 +1571,7 @@ - + integer(3) diaphy diaphy @@ -1591,7 +1581,7 @@ - + integer(3) diaphy diaphy @@ -1601,7 +1591,7 @@ - + integer(3) diaphy diaphy @@ -1611,7 +1601,7 @@ - + integer(3) diaphy diaphy @@ -1621,7 +1611,7 @@ - + integer(3) diaphy diaphy @@ -1631,7 +1621,7 @@ - + integer(3) diaphy diaphy @@ -1641,7 +1631,7 @@ - + integer(3) diaphy diaphy @@ -1651,7 +1641,7 @@ - + integer(3) diaphy diaphy @@ -1661,7 +1651,7 @@ - + integer(3) diaphy diaphy @@ -1671,7 +1661,7 @@ - + integer(3) diaphy diaphy @@ -1681,7 +1671,7 @@ - + integer(3) diaphy diaphy @@ -1691,7 +1681,7 @@ - + integer(3) diaphy diaphy @@ -1701,7 +1691,7 @@ - + integer(3) diaphy diaphy @@ -1711,7 +1701,7 @@ - + integer(3) diaphy diaphy @@ -1721,7 +1711,7 @@ - + integer(3) diaphy diaphy @@ -1731,7 +1721,7 @@ - + integer(3) diaphy diaphy @@ -1741,7 +1731,7 @@ - + integer(3) diaphy diaphy @@ -1751,7 +1741,7 @@ - + integer(3) diaphy diaphy @@ -1761,7 +1751,7 @@ - + integer(3) diaphy diaphy @@ -1771,7 +1761,7 @@ - + integer(3) diaphy diaphy @@ -1781,7 +1771,7 @@ - + integer(3) diaphy diaphy @@ -1791,7 +1781,7 @@ - + integer(3) diaphy diaphy @@ -1801,7 +1791,7 @@ - + integer(3) diaphy diaphy @@ -1811,7 +1801,7 @@ - + integer(3) diaphy diaphy @@ -1821,7 +1811,7 @@ - + integer(3) diaphy diaphy @@ -1831,7 +1821,7 @@ - + integer(3) diaphy diaphy @@ -1841,7 +1831,7 @@ - + integer(3) diaphy diaphy @@ -1851,7 +1841,7 @@ - + integer(3) diaphy diaphy @@ -1861,7 +1851,7 @@ - + integer(3) diaphy diaphy @@ -1871,7 +1861,7 @@ - + integer(3) diaphy diaphy @@ -1881,7 +1871,7 @@ - + integer(3) diaphy diaphy @@ -1891,7 +1881,7 @@ - + integer(3) diaphy diaphy @@ -1901,7 +1891,7 @@ - + integer(3) diaphy diaphy @@ -1911,7 +1901,7 @@ - + integer(3) diaphy diaphy @@ -1921,7 +1911,7 @@ - + integer(3) diaphy diaphy @@ -1931,7 +1921,7 @@ - + integer(3) diaphy diaphy @@ -1941,7 +1931,7 @@ - + integer(3) diaphy diaphy @@ -1951,7 +1941,7 @@ - + integer(3) diaphy diaphy @@ -1961,7 +1951,7 @@ - + integer(3) diaphy diaphy @@ -1971,7 +1961,7 @@ - + integer(3) diaphy diaphy @@ -1981,7 +1971,7 @@ - + integer(3) diaphy diaphy @@ -1991,7 +1981,7 @@ - + integer(3) diaphy diaphy @@ -2001,7 +1991,7 @@ - + integer(3) diaphy diaphy @@ -2011,7 +2001,7 @@ - + integer(3) diaphy diaphy @@ -2021,7 +2011,7 @@ - + integer(3) diaphy diaphy @@ -2031,7 +2021,7 @@ - + integer(3) diaphy diaphy @@ -2041,7 +2031,7 @@ - + integer(3) diaphy diaphy @@ -2051,7 +2041,7 @@ - + integer(3) diaphy diaphy @@ -2061,7 +2051,7 @@ - + integer(3) diaphy diaphy @@ -2071,7 +2061,7 @@ - + integer(3) diaphy diaphy @@ -2081,7 +2071,7 @@ - + integer(3) diaphy diaphy @@ -2091,7 +2081,7 @@ - + integer(3) diaphy diaphy @@ -2101,7 +2091,7 @@ - + integer(3) diaphy diaphy @@ -2111,7 +2101,7 @@ - + integer(3) diaphy diaphy @@ -2121,7 +2111,7 @@ - + integer(3) diaphy diaphy @@ -2131,7 +2121,7 @@ - + integer(3) diaphy diaphy @@ -2141,7 +2131,7 @@ - + integer(3) diaphy diaphy @@ -2151,7 +2141,7 @@ - + integer(3) diaphy diaphy @@ -2161,17 +2151,17 @@ - + integer(3) diaphy diaphy - 0,4,0 + 0,0,4 - + integer(3) diaphy diaphy @@ -2181,7 +2171,7 @@ - + integer(3) diaphy diaphy @@ -2191,7 +2181,7 @@ - + integer(3) diaphy diaphy @@ -2201,7 +2191,7 @@ - + integer(3) diaphy diaphy @@ -2211,7 +2201,7 @@ - + integer(3) diaphy diaphy @@ -2221,7 +2211,7 @@ - + integer(3) diaphy diaphy @@ -2231,7 +2221,7 @@ - + integer(3) diaphy diaphy @@ -2241,7 +2231,7 @@ - + integer(3) diaphy diaphy @@ -2251,7 +2241,7 @@ - + integer(3) diaphy diaphy @@ -2261,7 +2251,7 @@ - + integer(3) diaphy diaphy @@ -2271,7 +2261,7 @@ - + integer(3) diaphy diaphy @@ -2281,7 +2271,7 @@ - + integer(3) diaphy diaphy @@ -2291,7 +2281,7 @@ - + integer(3) diaphy diaphy @@ -2301,7 +2291,7 @@ - + integer(3) diaphy diaphy @@ -2311,17 +2301,17 @@ - + integer(3) diaphy diaphy - 0,4,0 + 0,0,4 - + integer(3) diaphy diaphy @@ -2331,7 +2321,7 @@ - + integer(3) diaphy diaphy @@ -2341,7 +2331,7 @@ - + integer(3) diaphy diaphy @@ -2351,7 +2341,7 @@ - + integer(3) diaphy diaphy @@ -2361,7 +2351,7 @@ - + integer(3) diaphy diaphy @@ -2371,7 +2361,7 @@ - + integer(3) diaphy diaphy @@ -2381,7 +2371,7 @@ - + integer(3) diaphy diaphy @@ -2391,7 +2381,7 @@ - + integer(3) diaphy diaphy @@ -2401,7 +2391,7 @@ - + integer(3) diaphy diaphy @@ -2411,7 +2401,7 @@ - + integer(3) diaphy diaphy @@ -2421,7 +2411,7 @@ - + integer(3) diaphy diaphy @@ -2431,7 +2421,7 @@ - + integer(3) diaphy diaphy @@ -2441,7 +2431,7 @@ - + integer(3) diaphy diaphy @@ -2451,7 +2441,7 @@ - + integer(3) diaphy diaphy @@ -2461,7 +2451,7 @@ - + integer(3) diaphy diaphy @@ -2471,7 +2461,7 @@ - + integer(3) diaphy diaphy @@ -2481,7 +2471,7 @@ - + integer(3) diaphy diaphy @@ -2491,7 +2481,7 @@ - + integer(3) diaphy diaphy @@ -2501,7 +2491,7 @@ - + integer(3) diaphy diaphy @@ -2511,7 +2501,7 @@ - + integer(3) diaphy diaphy @@ -2521,7 +2511,7 @@ - + integer(3) diaphy diaphy @@ -2531,7 +2521,7 @@ - + integer(3) diaphy diaphy @@ -2541,7 +2531,7 @@ - + integer(3) diaphy diaphy @@ -2551,7 +2541,7 @@ - + integer(3) diaphy diaphy @@ -2561,7 +2551,7 @@ - + integer(3) diaphy diaphy @@ -2571,7 +2561,7 @@ - + integer(3) diaphy diaphy @@ -2581,7 +2571,7 @@ - + integer(3) diaphy diaphy @@ -2591,7 +2581,7 @@ - + integer(3) diaphy diaphy @@ -2601,7 +2591,7 @@ - + integer(3) diaphy diaphy @@ -2611,7 +2601,7 @@ - + integer(3) diaphy diaphy @@ -2621,7 +2611,7 @@ - + integer(3) diaphy diaphy @@ -2631,7 +2621,7 @@ - + integer(3) diaphy diaphy @@ -2641,7 +2631,7 @@ - + integer(3) diaphy diaphy @@ -2651,7 +2641,7 @@ - + integer(3) diaphy diaphy @@ -2661,7 +2651,7 @@ - + integer(3) diaphy diaphy @@ -2671,7 +2661,7 @@ - + integer(3) diaphy diaphy @@ -2681,7 +2671,7 @@ - + integer(3) diaphy diaphy @@ -2691,7 +2681,7 @@ - + integer(3) diaphy diaphy @@ -2701,7 +2691,7 @@ - + integer(3) diaphy diaphy @@ -2711,7 +2701,7 @@ - + integer(3) diaphy diaphy @@ -2721,7 +2711,7 @@ - + integer(3) diaphy diaphy @@ -2731,7 +2721,7 @@ - + integer(3) diaphy diaphy @@ -2741,7 +2731,7 @@ - + integer(3) diaphy diaphy @@ -2751,7 +2741,7 @@ - + integer(3) diaphy diaphy @@ -2761,7 +2751,7 @@ - + integer(3) diaphy diaphy @@ -2771,7 +2761,7 @@ - + integer(3) diaphy diaphy @@ -2781,7 +2771,7 @@ - + integer(3) diaphy diaphy @@ -2791,7 +2781,7 @@ - + integer(3) diaphy diaphy @@ -2801,7 +2791,7 @@ - + integer(3) diaphy diaphy @@ -2811,7 +2801,7 @@ - + integer(3) diaphy diaphy @@ -2821,7 +2811,7 @@ - + integer(3) diaphy diaphy @@ -2831,7 +2821,7 @@ - + integer(3) diaphy diaphy @@ -2841,7 +2831,7 @@ - + integer(3) diaphy diaphy @@ -2851,7 +2841,7 @@ - + integer(3) diaphy diaphy @@ -2861,7 +2851,7 @@ - + integer(3) diaphy diaphy @@ -2871,7 +2861,7 @@ - + integer(3) diaphy diaphy @@ -2881,7 +2871,7 @@ - + integer(3) diaphy diaphy @@ -2891,7 +2881,7 @@ - + integer(3) diaphy diaphy @@ -2901,7 +2891,7 @@ - + integer(3) diaphy diaphy @@ -2911,7 +2901,7 @@ - + integer(3) diaphy diaphy @@ -2921,7 +2911,7 @@ - + integer(3) diaphy diaphy @@ -2931,7 +2921,7 @@ - + integer(3) diaphy diaphy @@ -2941,7 +2931,7 @@ - + integer(3) diaphy diaphy @@ -2951,7 +2941,7 @@ - + integer(3) diaphy diaphy @@ -2961,7 +2951,7 @@ - + integer(3) diaphy diaphy @@ -2971,7 +2961,7 @@ - + integer(3) diaphy diaphy @@ -2981,7 +2971,7 @@ - + integer(3) diaphy diaphy @@ -2991,7 +2981,7 @@ - + integer(3) diaphy diaphy @@ -3001,7 +2991,7 @@ - + integer(3) diaphy diaphy @@ -3011,7 +3001,7 @@ - + integer(3) diaphy diaphy @@ -3021,7 +3011,7 @@ - + integer(3) diaphy diaphy @@ -3031,7 +3021,7 @@ - + integer(3) diaphy diaphy @@ -3046,7 +3036,7 @@ - + char merdia merdia @@ -3061,7 +3051,7 @@ - + char merdia merdia @@ -3076,7 +3066,7 @@ - + char(4) merdia merdia @@ -3086,7 +3076,7 @@ - + integer(20) merdia merdia @@ -3095,7 +3085,7 @@ Array of mask flags in ocean regions file to be included for region (1) - + integer(20) merdia merdia @@ -3104,7 +3094,7 @@ Array of mask flags in ocean regions file to be included for region (2) - + integer(20) merdia merdia @@ -3113,7 +3103,7 @@ Array of mask flags in ocean regions file to be included for region (3) - + integer(20) merdia merdia @@ -3123,7 +3113,7 @@ Array of mask flags in ocean regions file to be included for region (4) - + real(4) merdia merdia @@ -3133,7 +3123,7 @@ Minimum latitude to be considered for each region (f) - + real(4) merdia merdia @@ -3147,7 +3137,7 @@ - + real bgcnml bgcnml @@ -3157,7 +3147,7 @@ Atmospheric CO2 concentration [ppmv] - + char bgcnml bgcnml @@ -3172,7 +3162,7 @@ 'File name (incl. full path) for iron (dust) deposition data' - + char bgcnml bgcnml @@ -3184,7 +3174,7 @@ File name (incl. full path) for swa climatology field (needed if bromoform scheme is activated) - + logical bgcnml bgcnml @@ -3195,7 +3185,7 @@ Logical switch to activate riverine input - + char bgcnml bgcnml @@ -3210,7 +3200,7 @@ File name (incl. full path) for riverine input data - + logical bgcnml bgcnml @@ -3222,14 +3212,14 @@ Logical switch to activate N-deposition - + char bgcnml bgcnml ' ' $DIN_LOC_ROOT/ocn/blom/bndcon/ndep_1850_cmip6_tnx2v1_20180321.nc - $DIN_LOC_ROOT/ocn/blom/bndcon/ndep_1850_cmip6_tnx1v4_20171106.nc + $DIN_LOC_ROOT/ocn/blom/bndcon/ndep_1850_CMIP6_tnx1v4_20171106.nc $DIN_LOC_ROOT/ocn/blom/bndcon/ndep_1850_cmip6_tnx0.25v4_20190912.nc $DIN_LOC_ROOT/ocn/blom/bndcon/ndep_1850_cmip6_tnx0.125v4_20221013.nc $DIN_LOC_ROOT/ocn/blom/bndcon/ndep_2000_cmip6_tnx2v1_20200826.nc @@ -3244,7 +3234,7 @@ File name (incl. full path) for atmopheric N-deposition data - + logical bgcnml bgcnml @@ -3254,7 +3244,7 @@ - + logical bgcnml bgcnml @@ -3265,7 +3255,7 @@ Logical switch to activate sediment spin-up - + integer bgcnml bgcnml @@ -3276,7 +3266,7 @@ - + integer bgcnml bgcnml @@ -3287,7 +3277,7 @@ - + integer bgcnml bgcnml @@ -3297,7 +3287,7 @@ - + char bgcnml bgcnml @@ -3308,7 +3298,7 @@ - + char bgcnml bgcnml @@ -3319,7 +3309,7 @@ - + char bgcnml bgcnml @@ -3330,7 +3320,7 @@ - + char bgcnml bgcnml @@ -3341,7 +3331,7 @@ - + char bgcnml bgcnml @@ -3352,7 +3342,7 @@ - + char bgcnml bgcnml @@ -3363,7 +3353,7 @@ - + char bgcnml bgcnml @@ -3375,7 +3365,7 @@ - + char bgcnml bgcnml @@ -3387,7 +3377,7 @@ - + logical bgcnml bgcnml @@ -3397,7 +3387,7 @@ - + char bgcnml bgcnml @@ -3407,7 +3397,7 @@ - + logical bgcnml bgcnml @@ -3417,7 +3407,7 @@ - + char bgcnml bgcnml @@ -3431,7 +3421,7 @@ - + char bgcoafx bgcoafx @@ -3441,7 +3431,7 @@ - + char bgcoafx bgcoafx @@ -3451,7 +3441,7 @@ - + real bgcoafx bgcoafx @@ -3461,7 +3451,7 @@ - + real bgcoafx bgcoafx @@ -3471,7 +3461,7 @@ - + real bgcoafx bgcoafx @@ -3481,7 +3471,7 @@ - + real bgcoafx bgcoafx @@ -3491,7 +3481,7 @@ - + real bgcoafx bgcoafx @@ -3505,7 +3495,7 @@ - + char(3) diabgc diabgc @@ -3515,7 +3505,17 @@ - + + integer(3) + diabgc + diabgc + + 1,30,365 + + + + + integer(3) diabgc diabgc @@ -3526,7 +3526,7 @@ - + integer(3) diabgc diabgc @@ -3536,10 +3536,10 @@ - + integer(3) - diaphy - diaphy + diabgc + diabgc 0,0,0 1,1,1 @@ -3547,7 +3547,7 @@ - + integer(3) diabgc diabgc @@ -3557,7 +3557,7 @@ - + integer(3) diabgc diabgc @@ -3567,7 +3567,7 @@ - + integer(3) diabgc diabgc @@ -3577,7 +3577,7 @@ - + integer(3) diabgc diabgc @@ -3587,7 +3587,7 @@ - + integer(3) diabgc diabgc @@ -3597,7 +3597,7 @@ - + integer(3) diabgc diabgc @@ -3607,7 +3607,7 @@ - + integer(3) diabgc diabgc @@ -3617,7 +3617,7 @@ - + integer(3) diabgc diabgc @@ -3627,7 +3627,7 @@ - + integer(3) diabgc diabgc @@ -3637,7 +3637,7 @@ - + integer(3) diabgc diabgc @@ -3647,7 +3647,7 @@ - + integer(3) diabgc diabgc @@ -3657,7 +3657,7 @@ - + integer(3) diabgc diabgc @@ -3667,7 +3667,7 @@ - + integer(3) diabgc diabgc @@ -3677,7 +3677,7 @@ - + integer(3) diabgc diabgc @@ -3687,7 +3687,7 @@ - + integer(3) diabgc diabgc @@ -3697,7 +3697,7 @@ - + integer(3) diabgc diabgc @@ -3707,7 +3707,7 @@ - + integer(3) diabgc diabgc @@ -3717,7 +3717,7 @@ - + integer(3) diabgc diabgc @@ -3727,7 +3727,7 @@ - + integer(3) diabgc diabgc @@ -3737,7 +3737,7 @@ - + integer(3) diabgc diabgc @@ -3747,7 +3747,7 @@ - + integer(3) diabgc diabgc @@ -3757,7 +3757,7 @@ - + integer(3) diabgc diabgc @@ -3767,7 +3767,7 @@ - + integer(3) diabgc diabgc @@ -3777,7 +3777,7 @@ - + integer(3) diabgc diabgc @@ -3787,7 +3787,7 @@ - + integer(3) diabgc diabgc @@ -3797,7 +3797,7 @@ - + integer(3) diabgc diabgc @@ -3807,7 +3807,7 @@ - + integer(3) diabgc diabgc @@ -3817,7 +3817,7 @@ - + integer(3) diabgc diabgc @@ -3827,7 +3827,7 @@ - + integer(3) diabgc diabgc @@ -3837,7 +3837,7 @@ - + integer(3) diabgc diabgc @@ -3847,7 +3847,7 @@ - + integer(3) diabgc diabgc @@ -3857,7 +3857,7 @@ - + integer(3) diabgc diabgc @@ -3867,7 +3867,7 @@ - + integer(3) diabgc diabgc @@ -3877,7 +3877,7 @@ - + integer(3) diabgc diabgc @@ -3887,7 +3887,7 @@ - + integer(3) diabgc diabgc @@ -3897,7 +3897,7 @@ - + integer(3) diabgc diabgc @@ -3907,7 +3907,7 @@ - + integer(3) diabgc diabgc @@ -3917,7 +3917,7 @@ - + integer(3) diabgc diabgc @@ -3927,7 +3927,7 @@ - + integer(3) diabgc diabgc @@ -3937,7 +3937,7 @@ - + integer(3) diabgc diabgc @@ -3947,7 +3947,7 @@ - + integer(3) diabgc diabgc @@ -3957,7 +3957,7 @@ - + integer(3) diabgc diabgc @@ -3967,7 +3967,7 @@ - + integer(3) diabgc diabgc @@ -3977,7 +3977,7 @@ - + integer(3) diabgc diabgc @@ -3987,7 +3987,7 @@ - + integer(3) diabgc diabgc @@ -3997,7 +3997,7 @@ - + integer(3) diabgc diabgc @@ -4007,7 +4007,7 @@ - + integer(3) diabgc diabgc @@ -4017,7 +4017,7 @@ - + integer(3) diabgc diabgc @@ -4027,7 +4027,7 @@ - + integer(3) diabgc diabgc @@ -4037,7 +4037,7 @@ - + integer(3) diabgc diabgc @@ -4047,7 +4047,7 @@ - + integer(3) diabgc diabgc @@ -4057,7 +4057,7 @@ - + integer(3) diabgc diabgc @@ -4068,7 +4068,7 @@ - + integer(3) diabgc diabgc @@ -4078,7 +4078,7 @@ - + integer(3) diabgc diabgc @@ -4088,7 +4088,7 @@ - + integer(3) diabgc diabgc @@ -4098,7 +4098,7 @@ - + integer(3) diabgc diabgc @@ -4108,7 +4108,7 @@ - + integer(3) diabgc diabgc @@ -4118,7 +4118,7 @@ - + integer(3) diabgc diabgc @@ -4128,7 +4128,7 @@ - + integer(3) diabgc diabgc @@ -4138,7 +4138,7 @@ - + integer(3) diabgc diabgc @@ -4148,7 +4148,7 @@ - + integer(3) diabgc diabgc @@ -4158,7 +4158,7 @@ - + integer(3) diabgc diabgc @@ -4168,7 +4168,7 @@ - + integer(3) diabgc diabgc @@ -4178,7 +4178,7 @@ - + integer(3) diabgc diabgc @@ -4188,7 +4188,7 @@ - + integer(3) diabgc diabgc @@ -4198,7 +4198,7 @@ - + integer(3) diabgc diabgc @@ -4208,7 +4208,7 @@ - + integer(3) diabgc diabgc @@ -4218,7 +4218,7 @@ - + integer(3) diabgc diabgc @@ -4228,7 +4228,7 @@ - + integer(3) diabgc diabgc @@ -4238,7 +4238,7 @@ - + integer(3) diabgc diabgc @@ -4248,7 +4248,7 @@ - + integer(3) diabgc diabgc @@ -4258,7 +4258,7 @@ - + integer(3) diabgc diabgc @@ -4268,7 +4268,7 @@ - + integer(3) diabgc diabgc @@ -4278,7 +4278,7 @@ - + integer(3) diabgc diabgc @@ -4288,7 +4288,7 @@ - + integer(3) diabgc diabgc @@ -4298,7 +4298,7 @@ - + integer(3) diabgc diabgc @@ -4308,7 +4308,7 @@ - + integer(3) diabgc diabgc @@ -4318,7 +4318,7 @@ - + integer(3) diabgc diabgc @@ -4328,7 +4328,7 @@ - + integer(3) diabgc diabgc @@ -4338,7 +4338,7 @@ - + integer(3) diabgc diabgc @@ -4348,7 +4348,7 @@ - + integer(3) diabgc diabgc @@ -4358,7 +4358,7 @@ - + integer(3) diabgc diabgc @@ -4368,7 +4368,7 @@ - + integer(3) diabgc diabgc @@ -4378,7 +4378,7 @@ - + integer(3) diabgc diabgc @@ -4388,7 +4388,7 @@ - + integer(3) diabgc diabgc @@ -4398,7 +4398,7 @@ - + integer(3) diabgc diabgc @@ -4408,7 +4408,7 @@ - + integer(3) diabgc diabgc @@ -4418,7 +4418,7 @@ - + integer(3) diabgc diabgc @@ -4428,7 +4428,7 @@ - + integer(3) diabgc diabgc @@ -4438,7 +4438,7 @@ - + integer(3) diabgc diabgc @@ -4448,7 +4448,7 @@ - + integer(3) diabgc diabgc @@ -4458,7 +4458,7 @@ - + integer(3) diabgc diabgc @@ -4468,7 +4468,7 @@ - + integer(3) diabgc diabgc @@ -4478,7 +4478,7 @@ - + integer(3) diabgc diabgc @@ -4488,7 +4488,7 @@ - + integer(3) diabgc diabgc @@ -4498,7 +4498,7 @@ - + integer(3) diabgc diabgc @@ -4508,7 +4508,7 @@ - + integer(3) diabgc diabgc @@ -4518,7 +4518,7 @@ - + integer(3) diabgc diabgc @@ -4528,7 +4528,7 @@ - + integer(3) diabgc diabgc @@ -4538,7 +4538,7 @@ - + integer(3) diabgc diabgc @@ -4548,7 +4548,7 @@ - + integer(3) diabgc diabgc @@ -4558,7 +4558,7 @@ - + integer(3) diabgc diabgc @@ -4568,7 +4568,7 @@ - + integer(3) diabgc diabgc @@ -4578,7 +4578,7 @@ - + integer(3) diabgc diabgc @@ -4588,7 +4588,7 @@ - + integer(3) diabgc diabgc @@ -4598,7 +4598,7 @@ - + integer(3) diabgc diabgc @@ -4608,7 +4608,7 @@ - + integer(3) diabgc diabgc @@ -4618,7 +4618,7 @@ - + integer(3) diabgc diabgc @@ -4628,7 +4628,7 @@ - + integer(3) diabgc diabgc @@ -4638,7 +4638,7 @@ - + integer(3) diabgc diabgc @@ -4648,7 +4648,7 @@ - + integer(3) diabgc diabgc @@ -4658,7 +4658,7 @@ - + integer(3) diabgc diabgc @@ -4668,7 +4668,7 @@ - + integer(3) diabgc diabgc @@ -4678,7 +4678,7 @@ - + integer(3) diabgc diabgc @@ -4688,7 +4688,7 @@ - + integer(3) diabgc diabgc @@ -4698,7 +4698,7 @@ - + integer(3) diabgc diabgc @@ -4708,7 +4708,7 @@ - + integer(3) diabgc diabgc @@ -4718,7 +4718,7 @@ - + integer(3) diabgc diabgc @@ -4728,7 +4728,7 @@ - + integer(3) diabgc diabgc @@ -4738,7 +4738,7 @@ - + integer(3) diabgc diabgc @@ -4748,7 +4748,7 @@ - + integer(3) diabgc diabgc @@ -4758,7 +4758,7 @@ - + integer(3) diabgc diabgc @@ -4768,7 +4768,7 @@ - + integer(3) diabgc diabgc @@ -4778,7 +4778,7 @@ - + integer(3) diabgc diabgc @@ -4788,7 +4788,7 @@ - + integer(3) diabgc diabgc @@ -4798,7 +4798,7 @@ - + integer(3) diabgc diabgc @@ -4808,7 +4808,7 @@ - + integer(3) diabgc diabgc @@ -4818,7 +4818,7 @@ - + integer(3) diabgc diabgc @@ -4828,7 +4828,7 @@ - + integer(3) diabgc diabgc @@ -4838,7 +4838,7 @@ - + integer(3) diabgc diabgc @@ -4848,7 +4848,7 @@ - + integer(3) diabgc diabgc @@ -4858,7 +4858,7 @@ - + integer(3) diabgc diabgc @@ -4868,7 +4868,7 @@ - + integer(3) diabgc diabgc @@ -4878,7 +4878,7 @@ - + integer(3) diabgc diabgc @@ -4888,7 +4888,7 @@ - + integer(3) diabgc diabgc @@ -4898,7 +4898,7 @@ - + integer(3) diabgc diabgc @@ -4908,7 +4908,7 @@ - + integer(3) diabgc diabgc @@ -4918,7 +4918,7 @@ - + integer(3) diabgc diabgc @@ -4928,7 +4928,7 @@ - + integer(3) diabgc diabgc @@ -4938,7 +4938,7 @@ - + integer(3) diabgc diabgc @@ -4948,7 +4948,7 @@ - + integer(3) diabgc diabgc @@ -4958,7 +4958,7 @@ - + integer(3) diabgc diabgc @@ -4968,7 +4968,7 @@ - + integer(3) diabgc diabgc @@ -4978,7 +4978,7 @@ - + integer(3) diabgc diabgc @@ -4988,7 +4988,7 @@ - + integer(3) diabgc diabgc @@ -4998,7 +4998,7 @@ - + integer(3) diabgc diabgc @@ -5008,7 +5008,7 @@ - + integer(3) diabgc diabgc @@ -5018,7 +5018,7 @@ - + integer(3) diabgc diabgc @@ -5028,7 +5028,7 @@ - + integer(3) diabgc diabgc @@ -5038,7 +5038,7 @@ - + integer(3) diabgc diabgc @@ -5048,7 +5048,7 @@ - + integer(3) diabgc diabgc @@ -5058,7 +5058,7 @@ - + integer(3) diabgc diabgc @@ -5068,7 +5068,7 @@ - + integer(3) diabgc diabgc @@ -5078,7 +5078,7 @@ - + integer(3) diabgc diabgc @@ -5088,7 +5088,7 @@ - + integer(3) diabgc diabgc @@ -5098,7 +5098,7 @@ - + integer(3) diabgc diabgc @@ -5108,7 +5108,7 @@ - + integer(3) diabgc diabgc @@ -5118,7 +5118,7 @@ - + integer(3) diabgc diabgc @@ -5128,7 +5128,7 @@ - + integer(3) diabgc diabgc @@ -5138,7 +5138,7 @@ - + integer(3) diabgc diabgc @@ -5148,7 +5148,7 @@ - + integer(3) diabgc diabgc @@ -5158,7 +5158,7 @@ - + integer(3) diabgc diabgc @@ -5168,7 +5168,7 @@ - + integer(3) diabgc diabgc @@ -5178,7 +5178,7 @@ - + integer(3) diabgc diabgc @@ -5188,7 +5188,7 @@ - + integer(3) diabgc diabgc @@ -5198,7 +5198,7 @@ - + integer(3) diabgc diabgc @@ -5208,7 +5208,7 @@ - + integer(3) diabgc diabgc @@ -5218,7 +5218,7 @@ - + integer(3) diabgc diabgc @@ -5228,7 +5228,7 @@ - + integer(3) diabgc diabgc @@ -5238,7 +5238,7 @@ - + integer(3) diabgc diabgc @@ -5248,7 +5248,7 @@ - + integer(3) diabgc diabgc @@ -5258,7 +5258,7 @@ - + integer(3) diabgc diabgc @@ -5268,7 +5268,7 @@ - + integer(3) diabgc diabgc @@ -5278,7 +5278,7 @@ - + integer(3) diabgc diabgc @@ -5288,7 +5288,7 @@ - + integer(3) diabgc diabgc @@ -5298,7 +5298,7 @@ - + integer(3) diabgc diabgc @@ -5308,7 +5308,7 @@ - + integer(3) diabgc diabgc @@ -5318,7 +5318,7 @@ - + integer(3) diabgc diabgc @@ -5328,7 +5328,7 @@ - + integer(3) diabgc diabgc @@ -5338,7 +5338,7 @@ - + integer(3) diabgc diabgc @@ -5348,7 +5348,7 @@ - + integer(3) diabgc diabgc @@ -5358,7 +5358,7 @@ - + integer(3) diabgc diabgc @@ -5368,7 +5368,7 @@ - + integer(3) diabgc diabgc @@ -5378,7 +5378,7 @@ - + integer(3) diabgc diabgc @@ -5388,7 +5388,7 @@ - + integer(3) diabgc diabgc @@ -5398,7 +5398,7 @@ - + integer(3) diabgc diabgc @@ -5408,7 +5408,7 @@ - + integer(3) diabgc diabgc @@ -5418,7 +5418,7 @@ - + integer(3) diabgc diabgc @@ -5428,7 +5428,7 @@ - + integer(3) diabgc diabgc @@ -5438,7 +5438,7 @@ - + integer(3) diabgc diabgc @@ -5448,7 +5448,7 @@ - + integer(3) diabgc diabgc @@ -5458,7 +5458,7 @@ - + integer(3) diabgc diabgc @@ -5468,7 +5468,7 @@ - + integer(3) diabgc diabgc @@ -5478,7 +5478,7 @@ - + integer(3) diabgc diabgc diff --git a/cime_config/user_nl_blom b/cime_config/user_nl_blom index bdfa712d..15d43301 100644 --- a/cime_config/user_nl_blom +++ b/cime_config/user_nl_blom @@ -1,7 +1,27 @@ -#---------------------------------------------------------------------------------- -# Users should add all user specific namelist changes below in the form of -# namelist_var = new_namelist_value -# Note - that it does not matter what namelist group the namelist_var belongs to -#---------------------------------------------------------------------------------- - +!---------------------------------------------------------------------------------- +! Users should add all user specific namelist changes below in the form of +! namelist_var = new_namelist_value +! +! Note: that it does not matter what namelist group the namelist_var belongs to +! EXCEPT for when a variable appears in more than one namelist +! There are a few history variables that have the same name in both diaphy and diabgc +! For those variables an @diaphy or @diabgc to be appendend for the namelist_var +! GLB_FNAMETAG@diaphy +! GLB_AVEPERIO@diaphy +! GLB_FILEFREQ@diaphy +! GLB_COMPFLAG@diaphy +! GLB_NCFORMAT@diaphy +! LYR_DP@diaphy"> +! GLB_FNAMETAG@diabgc +! GLB_AVEPERIO@diabgc +! GLB_FILEFREQ@diabgc +! GLB_COMPFLAG@diabgc +! GLB_NCFORMAT@diabgc +! LYR_DP@diabgc"> +! +! For example: +! GLB_FNAMETAG@diaphy = 'hd','hd','hd' +! +! To see a full documentation of the namelist variables - see $RUNDIR/ocn_in.readme +!---------------------------------------------------------------------------------- From 183bbf89ed309f4a8cb889e06e9b8fd501babaff Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Mon, 17 Jul 2023 10:18:18 +0200 Subject: [PATCH 25/52] cleanup of python code --- cime_config/buildnml | 32 ++++++++++---------------------- cime_config/user_nl_blom | 9 ++++++++- 2 files changed, 18 insertions(+), 23 deletions(-) diff --git a/cime_config/buildnml b/cime_config/buildnml index 81df75cb..3d6304aa 100755 --- a/cime_config/buildnml +++ b/cime_config/buildnml @@ -148,19 +148,15 @@ def _create_namelists(case, confdir, infile, nmlgen): file.write_text(file.read_text().replace('mer_regflg4','mer_regflg(4,:)')) namelist_file_temp = os.path.join(confdir, "ocn_in_temp") - fread = open(namelist_file, "r") - fwrite = open(namelist_file_temp, "w") - for line in fread: - if '=' in line: - x = line.split() - x[0] = x[0].upper() - line = " " + ' '.join(x) + '\n' - elif '&' in line or '/' in line: - x = line.split() - line = x[0].upper() + '\n' - fwrite.write(line) - fread.close() - fwrite.close() + with open(namelist_file, "r") as fread: + with open(namelist_file_temp, "w") as fwrite: + for line in fread: + tokens = line.split('=',maxsplit=1) + if len(tokens) == 2: + fwrite.write(f" {tokens[0].upper().strip()} = {tokens[1].strip()}\n") + else: + fwrite.write(line) + shutil.move(namelist_file_temp, namelist_file) src_filename = os.path.join(srcroot,"components","blom","cime_config","ocn_in.readme") @@ -169,7 +165,7 @@ def _create_namelists(case, confdir, infile, nmlgen): if not os.path.exists(dst_filename): shutil.copy(src_filename, dst_filename) - #logger.debug(f"blom: grid is {ocn_grid}") + logger.debug(f"blom: grid is {ocn_grid}") ############################################################################### def buildnml(case, caseroot, compname): @@ -251,14 +247,6 @@ def buildnml(case, caseroot, compname): logger.debug("BLOM namelist copy: file1 %s file2 %s " %(file1, file2)) shutil.copy2(file1, file2) -def _strip_comments(fh, token="!"): - ''' strip anything after token in each line of fh ''' - for line in fh: - s = line.split(token, 1)[0].strip() - if s: - yield s - - ############################################################################### def _main_func(): diff --git a/cime_config/user_nl_blom b/cime_config/user_nl_blom index 15d43301..00abb174 100644 --- a/cime_config/user_nl_blom +++ b/cime_config/user_nl_blom @@ -2,10 +2,11 @@ ! Users should add all user specific namelist changes below in the form of ! namelist_var = new_namelist_value ! -! Note: that it does not matter what namelist group the namelist_var belongs to +! NOTE: that it does not matter what namelist group the namelist_var belongs to ! EXCEPT for when a variable appears in more than one namelist ! There are a few history variables that have the same name in both diaphy and diabgc ! For those variables an @diaphy or @diabgc to be appendend for the namelist_var +! ! GLB_FNAMETAG@diaphy ! GLB_AVEPERIO@diaphy ! GLB_FILEFREQ@diaphy @@ -22,6 +23,12 @@ ! For example: ! GLB_FNAMETAG@diaphy = 'hd','hd','hd' ! +! NOTE: the array sections for MER_REGFLG must be entered as +! MER_REGFLG1 - sets MER_REGFLG(1,:) +! MER_REGFLG2 - sets MER_REGFLG(2,:) +! MER_REGFLG3 - sets MER_REGFLG(3,:) +! MER_REGFLG4 - sets MER_REGFLG(4,:) + ! To see a full documentation of the namelist variables - see $RUNDIR/ocn_in.readme !---------------------------------------------------------------------------------- From 9f2e8030c53bdc0f869896b170e3480d4acc90cd Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Tue, 25 Jul 2023 10:49:03 +0200 Subject: [PATCH 26/52] replaced double with single quotes --- cime_config/buildnml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cime_config/buildnml b/cime_config/buildnml index 3d6304aa..0b4e2d91 100755 --- a/cime_config/buildnml +++ b/cime_config/buildnml @@ -150,7 +150,11 @@ def _create_namelists(case, confdir, infile, nmlgen): namelist_file_temp = os.path.join(confdir, "ocn_in_temp") with open(namelist_file, "r") as fread: with open(namelist_file_temp, "w") as fwrite: - for line in fread: + for line_read in fread: + # replace single quote with double quote to generate same namelist as using + # csh buildnml + line = line_read.replace('"',"'") + # make all namelists upper case to generate same namelist as using csh buildnml tokens = line.split('=',maxsplit=1) if len(tokens) == 2: fwrite.write(f" {tokens[0].upper().strip()} = {tokens[1].strip()}\n") From 417923e2cb4a5a4ed74de72f05e495bc7f696772 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Tue, 25 Jul 2023 14:20:18 +0200 Subject: [PATCH 27/52] updates as part of testing --- cime_config/buildnml | 2 +- cime_config/namelist_definition_blom.xml | 77 ++++++++++++++---------- 2 files changed, 45 insertions(+), 34 deletions(-) diff --git a/cime_config/buildnml b/cime_config/buildnml index 0b4e2d91..d93e35a5 100755 --- a/cime_config/buildnml +++ b/cime_config/buildnml @@ -115,7 +115,7 @@ def _create_namelists(case, confdir, infile, nmlgen): groups=['limits','diffusion'] cwmtag = nmlgen.get_default('cwmtag', config=config) - if cwmtag != 'UNSET': + if cwmtag[0] != 'unset': groups.append('cwmod') groups.append('merdia') diff --git a/cime_config/namelist_definition_blom.xml b/cime_config/namelist_definition_blom.xml index 66defd0f..bcf121e7 100644 --- a/cime_config/namelist_definition_blom.xml +++ b/cime_config/namelist_definition_blom.xml @@ -108,7 +108,7 @@ limits limits - UNSET + unset $DIN_LOC_ROOT/ocn/blom/grid/grid_tnx2v1_20130206.nc $DIN_LOC_ROOT/ocn/blom/grid/grid_tnx1v4_20170622.nc $DIN_LOC_ROOT/ocn/blom/grid/grid_tnx0.25v4_20170622.nc @@ -123,7 +123,7 @@ limits limits - UNSET + unset $DIN_LOC_ROOT/ocn/blom/inicon/inicon_tnx2v1_20130419.nc $DIN_LOC_ROOT/ocn/blom/inicon/inicon_tnx1v4_20170622.nc $DIN_LOC_ROOT/ocn/blom/inicon/inicon_tnx0.25v4_20170623.nc @@ -183,10 +183,10 @@ .02 2. - .0015 - .15 - .001 - .1 + .15 + .0015 + .1 + .001 @@ -198,10 +198,10 @@ .004 .4 - .0015 - .15 - .001 + .15 + .0015 .1 + .001 @@ -233,8 +233,10 @@ 5000. 5000.e4 - 300. - 300.e4 + 300.e4 + 300. + 300.e4 + 300. @@ -246,8 +248,10 @@ 300. 300.e4 - 300. - 300.e4 + 300.e4 + 300. + 100.e4 + 100. @@ -327,9 +331,9 @@ limits 5.e-5 - .75e-4 - 0.75e-4 - 0.75e-4 + .75e-4 + 0.75e-4 + .75e-4 @@ -410,7 +414,7 @@ limits .06 - .5 + .5 1.0 @@ -437,7 +441,7 @@ limits 0. - .4 + .4 @@ -652,7 +656,7 @@ limits .true. - .false. + .false. @@ -1027,7 +1031,8 @@ 100. 100.e4 - 0. + 0. + 0. @@ -1043,7 +1048,8 @@ 1000.e4 1000. 1000.e4 - 0. + 0. + 0. @@ -1213,7 +1219,7 @@ cwmod cwmod - UNSET + unset 'Gibraltar','Gibraltar' 'Gibraltar','Gibraltar' @@ -1225,8 +1231,10 @@ cwmod cwmod + 'unset','unset' 'u','u' 'u','u' + @@ -1236,6 +1244,7 @@ cwmod cwmod + -999,-999 53,54 105,106 @@ -1247,6 +1256,7 @@ cwmod cwmod + -999,-999 137,137 273,273 @@ -1258,6 +1268,7 @@ cwmod cwmod + 1.e36,1.e36 30.e3,30.e3 30.e3,30.e3 @@ -3059,7 +3070,7 @@ UNSET $DIN_LOC_ROOT/ocn/blom/grid/mertra_index_tnx2v1_20190826.dat $DIN_LOC_ROOT/ocn/blom/grid/mertra_index_tnx1v4_20190615.dat - $DIN_LOC_ROOT/ocn/blom/grid/mertra_index_tnx0.25v4_20190701.dat + $DIN_LOC_ROOT/ocn/blom/grid/mertra_index_tnx0.25v4_20190701.dat $DIN_LOC_ROOT/ocn/blom/grid/mertra_index_tnx0.125v4_20221013.dat abs @@ -3218,17 +3229,17 @@ bgcnml ' ' - $DIN_LOC_ROOT/ocn/blom/bndcon/ndep_1850_cmip6_tnx2v1_20180321.nc + $DIN_LOC_ROOT/ocn/blom/bndcon/ndep_1850_CMIP6_tnx2v1_20180321.nc + $DIN_LOC_ROOT/ocn/blom/bndcon/ndep_2000_CMIP6_tnx2v1_20200826.nc + $DIN_LOC_ROOT/ocn/blom/bndcon/ndep_185001-201412_tnx2v1_20190702.nc $DIN_LOC_ROOT/ocn/blom/bndcon/ndep_1850_CMIP6_tnx1v4_20171106.nc - $DIN_LOC_ROOT/ocn/blom/bndcon/ndep_1850_cmip6_tnx0.25v4_20190912.nc - $DIN_LOC_ROOT/ocn/blom/bndcon/ndep_1850_cmip6_tnx0.125v4_20221013.nc - $DIN_LOC_ROOT/ocn/blom/bndcon/ndep_2000_cmip6_tnx2v1_20200826.nc - $DIN_LOC_ROOT/ocn/blom/bndcon/ndep_2000_cmip6_tnx1v4_20200826.nc - $DIN_LOC_ROOT/ocn/blom/bndcon/ndep_2000_cmip6_tnx0.25v4_20200826.nc - $DIN_LOC_ROOT/ocn/blom/bndcon/ndep_185001-201412_tnx2v1_20190702.nc - $DIN_LOC_ROOT/ocn/blom/bndcon/ndep_185001-201412_tnx1v4_20180613.nc - $DIN_LOC_ROOT/ocn/blom/bndcon/ndep_185001-201412_tnx0.25v4_20190705.nc - $DIN_LOC_ROOT/ocn/blom/bndcon/ndep_201501-210012-${BLOM_NDEP_SCENARIO}_tnx1v4_20191112.nc + $DIN_LOC_ROOT/ocn/blom/bndcon/ndep_2000_CMIP6_tnx1v4_20200826.nc + $DIN_LOC_ROOT/ocn/blom/bndcon/ndep_185001-201412_tnx1v4_20180613.nc + $DIN_LOC_ROOT/ocn/blom/bndcon/ndep_201501-210012-${BLOM_NDEP_SCENARIO}_tnx1v4_20191112.nc + $DIN_LOC_ROOT/ocn/blom/bndcon/ndep_1850_CMIP6_tnx0.25v4_20190912.nc + $DIN_LOC_ROOT/ocn/blom/bndcon/ndep_2000_CMIP6_tnx0.25v4_20200826.nc + $DIN_LOC_ROOT/ocn/blom/bndcon/ndep_185001-201412_tnx0.25v4_20190705.nc + $DIN_LOC_ROOT/ocn/blom/bndcon/ndep_1850_CMIP6_tnx0.125v4_20221013.nc abs File name (incl. full path) for atmopheric N-deposition data From bfdf804347299df093dc73b05cdf46b31ddcc178 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Tue, 25 Jul 2023 18:02:04 +0200 Subject: [PATCH 28/52] more bug fixes from testing --- cime_config/buildnml | 16 ++++-- cime_config/namelist_definition_blom.xml | 62 ++++++++++++++++-------- 2 files changed, 54 insertions(+), 24 deletions(-) diff --git a/cime_config/buildnml b/cime_config/buildnml index d93e35a5..b5842523 100755 --- a/cime_config/buildnml +++ b/cime_config/buildnml @@ -39,6 +39,7 @@ def _create_namelists(case, confdir, infile, nmlgen): """ rundir = case.get_value("RUNDIR") srcroot = case.get_value("SRCROOT") + din_loc_root = case.get_value("DIN_LOC_ROOT") caseroot = case.get_value("CASEROOT") continue_run = case.get_value("CONTINUE_RUN") ocn_grid = case.get_value("OCN_GRID") @@ -125,9 +126,7 @@ def _create_namelists(case, confdir, infile, nmlgen): if case.get_value("BLOM_VCOORD") == "cntiso_hybrid": groups.append('vcoord') - blom_tracer_modules = case.get_value("BLOM_TRACER_MODULES") - ecosys_on = "ecosys" in blom_tracer_modules - if ecosys_on: + if "ecosys" in case.get_value("BLOM_TRACER_MODULES"): groups.append("bgcnml") groups.append("bgcoafx") groups.append("diabgc") @@ -136,10 +135,11 @@ def _create_namelists(case, confdir, infile, nmlgen): if os.path.exists(data_list_path): os.remove(data_list_path) + # Create initial ocn_in namelist_file = os.path.join(confdir, "ocn_in") nmlgen.write_output_file(namelist_file, data_list_path, groups=groups, sorted_groups=False) - # replace MER_REGFLAG1 -> MER_REGFLAG4 with array syntax + # Replace MER_REGFLAG1 -> MER_REGFLAG4 with array syntax in ocn_in from pathlib import Path file = Path(namelist_file) file.write_text(file.read_text().replace('mer_regflg1','mer_regflg(1,:)')) @@ -147,6 +147,9 @@ def _create_namelists(case, confdir, infile, nmlgen): file.write_text(file.read_text().replace('mer_regflg3','mer_regflg(3,:)')) file.write_text(file.read_text().replace('mer_regflg4','mer_regflg(4,:)')) + # To compare with previous namelist generation, make namelist variable uppercase and + # use single quotes instead of back quotes and make sure that file variables set to UNSET + # get changed to blank quotes namelist_file_temp = os.path.join(confdir, "ocn_in_temp") with open(namelist_file, "r") as fread: with open(namelist_file_temp, "w") as fwrite: @@ -157,12 +160,15 @@ def _create_namelists(case, confdir, infile, nmlgen): # make all namelists upper case to generate same namelist as using csh buildnml tokens = line.split('=',maxsplit=1) if len(tokens) == 2: + # Change UNSET values for files to lower case + if 'UNSET' in tokens[1]: + tokens[1] = "'unset'" fwrite.write(f" {tokens[0].upper().strip()} = {tokens[1].strip()}\n") else: fwrite.write(line) - shutil.move(namelist_file_temp, namelist_file) + # Copy ocn_in.readme to $RUNDIR src_filename = os.path.join(srcroot,"components","blom","cime_config","ocn_in.readme") dst_filename = os.path.join(rundir,"ocn_in.readme") diff --git a/cime_config/namelist_definition_blom.xml b/cime_config/namelist_definition_blom.xml index bcf121e7..bb63d0fa 100644 --- a/cime_config/namelist_definition_blom.xml +++ b/cime_config/namelist_definition_blom.xml @@ -115,7 +115,7 @@ $DIN_LOC_ROOT/ocn/blom/grid/grid_tnx0.125v4_20221013.nc abs - + Name of file containing grid specification @@ -130,7 +130,11 @@ $DIN_LOC_ROOT/ocn/blom/inicon/inicon_tnx0.125v4_20230318.nc abs - + + Name of file containing initial conditions, that is either a + valid restart file or 'inicon.nc' if climatological based + initial conditions are desired. + @@ -432,7 +436,10 @@ $DIN_LOC_ROOT/ocn/blom/bndcon/tidal_dissipation_tnx0.125v4_20221013.nc abs - + + Name of file containing tidal wave energy dissipation divided by + by bottom buoyancy frequency + @@ -507,7 +514,9 @@ $DIN_LOC_ROOT/ocn/blom/bndcon/chlorophyll_concentration_tnx0.125v4_20221013.nc abs - + + Name of file containing chlorophyll concentration climatology + @@ -637,7 +646,9 @@ $DIN_LOC_ROOT/ocn/blom/bndcon/sss_clim_core_tnx0.125v4_20221013.nc abs - + + Name of file containing SSS climatology used for relaxation + @@ -1069,9 +1080,10 @@ diffusion diffusion - unset + UNSET - + abs + Name of file containing topographic beta parameter @@ -1292,7 +1304,10 @@ $DIN_LOC_ROOT/ocn/blom/grid/section_index_tnx0.125v4_20221013.dat abs - + + Name of file containing section specification for section + transport computation + @@ -3046,7 +3061,6 @@ - char merdia @@ -3163,7 +3177,7 @@ bgcnml bgcnml - ' ' + UNSET $DIN_LOC_ROOT/ocn/blom/bndcon/dustdep_mhw2006_tnx2v1_20130506.nc $DIN_LOC_ROOT/ocn/blom/bndcon/dustdep_mhw2006_tnx1v4_20171107.nc $DIN_LOC_ROOT/ocn/blom/bndcon/dustdep_mhw2006_tnx0.25v4_20181004.nc @@ -3201,7 +3215,7 @@ bgcnml bgcnml - ' ' + UNSET $DIN_LOC_ROOT/ocn/blom/bndcon/river_nutrients_GNEWS2000_tnx2v1_20170915.nc $DIN_LOC_ROOT/ocn/blom/bndcon/river_nutrients_GNEWS2000_tnx1v4_20170820.nc $DIN_LOC_ROOT/ocn/blom/bndcon/river_nutrients_GNEWS2000_tnx0.25v4_20170821.nc @@ -3228,7 +3242,7 @@ bgcnml bgcnml - ' ' + UNSET $DIN_LOC_ROOT/ocn/blom/bndcon/ndep_1850_CMIP6_tnx2v1_20180321.nc $DIN_LOC_ROOT/ocn/blom/bndcon/ndep_2000_CMIP6_tnx2v1_20200826.nc $DIN_LOC_ROOT/ocn/blom/bndcon/ndep_185001-201412_tnx2v1_20190702.nc @@ -3403,9 +3417,12 @@ bgcnml bgcnml - ' ' + UNSET - + abs + + File name (incl. full path) for surface PI pH input data. + @@ -3423,13 +3440,17 @@ bgcnml bgcnml - ' ' + UNSET - + abs + + File name (incl. full path) for sediment porosity + + @@ -3437,7 +3458,7 @@ bgcoafx bgcoafx - ' ' + UNSET @@ -3447,9 +3468,12 @@ bgcoafx bgcoafx - ' ' + UNSET - + abs + + Full path of the input file for the alkalinization scenario 'file' + From 39eabb37620efc3ac1f124b4f0ebf238590c0fd8 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Tue, 25 Jul 2023 21:11:46 +0200 Subject: [PATCH 29/52] added descriptions --- cime_config/namelist_definition_blom.xml | 680 +++++++++++------------ cime_config/ocn_in.readme | 4 +- 2 files changed, 340 insertions(+), 344 deletions(-) diff --git a/cime_config/namelist_definition_blom.xml b/cime_config/namelist_definition_blom.xml index bb63d0fa..6038454c 100644 --- a/cime_config/namelist_definition_blom.xml +++ b/cime_config/namelist_definition_blom.xml @@ -39,7 +39,7 @@ 0 - + First day of integration (i) @@ -49,7 +49,7 @@ 0 - + Last day of integration (i) @@ -59,7 +59,7 @@ 9999999 - + Model date in YYYYMMDD (i) @@ -69,7 +69,7 @@ 9999999 - + Initial experiment date in YYYYMMDD (i) @@ -78,7 +78,7 @@ unset - + Experiment name (a) char @@ -89,7 +89,7 @@ cesm - + Experiment configuration (a) @@ -100,7 +100,7 @@ $RUN_TYPE continue - + run type (a) @@ -115,7 +115,7 @@ $DIN_LOC_ROOT/ocn/blom/grid/grid_tnx0.125v4_20221013.nc abs - Name of file containing grid specification + Name of file containing grid specification (a)Name of file containing grid specification @@ -145,7 +145,7 @@ 2000.e4 2000.e5 - + Reference pressure for potential density (g/cm/s2) (f) @@ -161,7 +161,7 @@ 900. 300. - + Baroclinic time step (sec) (f) @@ -177,7 +177,7 @@ 15. 6. - + Barotropic time step (sec) (f) @@ -192,7 +192,7 @@ .1 .001 - + Laplacian diffusion velocity for momentum dissipation (cm/s) (f) @@ -207,7 +207,7 @@ .1 .001 - + Laplacian diffusion velocity for momentum dissipation (cm/s) (f) @@ -217,7 +217,7 @@ 0. - + Biharmonic diffusion velocity for momentum dissipation (cm/s) (f) @@ -227,7 +227,7 @@ 0. - + Biharmonic diffusion velocity for momentum dissipation (cm/s) (f) @@ -242,7 +242,7 @@ 300.e4 300. - + Laplacian diffusivity for momentum dissipation (cm**2/s) (f) @@ -257,7 +257,7 @@ 100.e4 100. - + Laplacian diffusivity for momentum dissipation (cm**2/s) (f) @@ -269,7 +269,7 @@ .15 0. - + Parameter in deformation-dependent Laplacian viscosity (f) @@ -281,7 +281,7 @@ .15 0. - + Parameter in deformation-dependent Laplacian viscosity (f) @@ -293,7 +293,7 @@ 0.0625 0.06 - + Parameter in deformation-dependent Biharmonic viscosity (f) @@ -305,7 +305,7 @@ 0.0625 0.06 - + Parameter in deformation-dependent Biharmonic viscosity (f) @@ -316,7 +316,7 @@ .05 5. - + rms flow speed for linear bottom friction law (cm/s) (f) @@ -326,7 +326,7 @@ .002 - + Nondiemnsional coefficient of quadratic bottom friction (f) @@ -339,7 +339,7 @@ 0.75e-4 .75e-4 - + Coastal wave breaking damping resiprocal time scale (1/s) (f) @@ -349,7 +349,7 @@ 25. - + Coastal wave breaking damping length scale (m) (f) @@ -359,7 +359,7 @@ enscon - + Momentum equation discretization method. Valid methods: @@ -369,7 +369,7 @@ uc - + Baroclinic mass flux correction method. Valid methods: @@ -379,7 +379,7 @@ eitvel - + Method of applying eddy-induced transport in the remap @@ -389,7 +389,7 @@ constant - + Type of mixed layer restratification time scale. Valid @@ -399,7 +399,7 @@ 1.2 - + Efficiency factor of wind TKE generation in the Oberhuber @@ -409,7 +409,7 @@ 0. - + Efficiency factor of TKE generation by momentum @@ -421,7 +421,7 @@ .5 1.0 - + Efficiency factor for the restratification by mixed layer @@ -450,7 +450,7 @@ 0. .4 - + Global factor applied to the energy input by near-intertial @@ -460,7 +460,7 @@ .35 - + Fraction of near-inertial energy dissipated in the boundary @@ -470,7 +470,7 @@ .5 - + Fraction of near-inertial energy dissipated locally beneath @@ -480,7 +480,7 @@ jerlov - + Shortwave radiation absorption method. Valid methods: @@ -490,7 +490,7 @@ 3 - + Number indicating the Jerlov (1968) water type (i) @@ -500,7 +500,7 @@ climatology - + Chlorophyll concentration option. Valid options: @@ -526,7 +526,7 @@ 0. - + e-folding time scale (days) for SST relax., if 0 no relax. (f) @@ -538,7 +538,7 @@ 60. 6. - + e-folding time scale (days) for SSS relax., if 0 no relax. (f) @@ -548,7 +548,7 @@ 1. - + Maximum mixed layer depth for e-folding SST relaxation (m) (f) @@ -560,7 +560,7 @@ 1. 10. - + Maximum mixed layer depth for e-folding SSS relaxation (m) (f) @@ -570,7 +570,7 @@ 1.5 - + Max. absolute value of SST difference in relaxation (degC) (f) @@ -580,7 +580,7 @@ .5 - + Max. absolute value of SSS difference in relaxation (psu) (f) @@ -590,7 +590,7 @@ .false. - + Apply diagnosed heat flux flag (l) @@ -600,7 +600,7 @@ .false. - + Apply diagnosed freshwater flux flag (l) @@ -610,7 +610,7 @@ .false. - + Diagnose heat flux flag (l) @@ -620,7 +620,7 @@ .false. - + Diagnose freshwater flux flag (l) @@ -631,7 +631,7 @@ .false. .true. - + Balance the SSS relaxation (l) @@ -646,7 +646,7 @@ $DIN_LOC_ROOT/ocn/blom/bndcon/sss_clim_core_tnx0.125v4_20221013.nc abs - + Name of file containing SSS climatology used for relaxation (a) Name of file containing SSS climatology used for relaxation @@ -658,7 +658,7 @@ none - + Source of wave fields. Valid source: 'none', 'param', 'extern' (a) @@ -669,7 +669,7 @@ .true. .false. - + Smooth NorESM forcing (l) @@ -680,7 +680,7 @@ .false. .true. - + Send precipitation/runoff factor to NorESM coupler (l) @@ -690,7 +690,7 @@ unset - + Path to forcing fields in case of EXPCNF 'ben02clim' or @@ -700,7 +700,7 @@ 60 - + Global i-index of point diagnostics (i) @@ -710,7 +710,7 @@ 60 - + Global j-index of point diagnostics (i) @@ -720,7 +720,7 @@ .false. - + Conservation diagnostics flag (l) @@ -730,7 +730,7 @@ .false. - + Checksum diagnostics flag (l) @@ -740,7 +740,7 @@ 1 - + Restart frequency in days (30=1month,365=1year) (i) @@ -751,7 +751,7 @@ 0 1 - + Format of restart file (valid arguments are 0 for classic, @@ -761,7 +761,7 @@ 0 - + Compression flag for restart file (i) @@ -772,20 +772,13 @@ 0 1 - + 0 = netcdf, 1 = pnetcdf - - - - - - - char vcoord @@ -957,7 +950,7 @@ gm - + Eddy-induced transport parameterization method. Valid @@ -967,7 +960,7 @@ "large scale" - + Type of Richardson number used in eddy diffusivity @@ -979,7 +972,7 @@ step step - + Method to estimate eddy diffusivity weight as a function of @@ -989,7 +982,7 @@ .false. - + If true, eddy diffusivity has a 2d structure (l) @@ -999,7 +992,7 @@ .true. - + Apply eddy mixing suppression away from steering level (l) @@ -1011,7 +1004,7 @@ 0.5 0.5 - + Parameter c in Eden and Greatbatch (2008) parameterization (f) @@ -1021,7 +1014,7 @@ 200. - + Parameter gamma in E. and G. (2008) param. (f) @@ -1032,7 +1025,7 @@ 4000. 4000.e2 - + Minimum eddy length scale in E. and G. (2008) param. (cm) (f) @@ -1045,7 +1038,7 @@ 0. 0. - + Minimum diffusivity in E. and G. (2008) param. (cm**2/s) (f) @@ -1062,7 +1055,7 @@ 0. 0. - + Maximum diffusivity in E. and G. (2008) param. (cm**2/s) (f) @@ -1072,7 +1065,7 @@ 1. - + Factor relating the isopycnal diffusivity to the layer @@ -1083,7 +1076,7 @@ UNSET abs - Name of file containing topographic beta parameter + Name of file containing topographic beta parameter (a)Name of file containing topographic beta parameter @@ -1093,7 +1086,7 @@ 0. - + Linear scaling parameter for topographic rhines scale () (f) @@ -1103,7 +1096,7 @@ .false. - + If true, apply anisotropy correction to eddy diffusivity (l) @@ -1113,7 +1106,7 @@ .false. - + If true, then isopycnal/neutral diffusion will have 3D @@ -1123,7 +1116,7 @@ .false. - + If true, use the minimum of planetary and topographic beta @@ -1133,7 +1126,7 @@ 1.2 - + Critical gradient richardson number for shear driven @@ -1143,7 +1136,7 @@ 2 - + Type of background diapycnal mixing. If bdmtyp=1 the @@ -1154,7 +1147,7 @@ 5.e-8 5.e-4 - + Background diapycnal diffusivity times buoyancy frequency @@ -1165,7 +1158,7 @@ 1.e-5 .1 - + Background diapycnal diffusivity (cm**2/s) (f) @@ -1176,7 +1169,7 @@ .false. .true. - + Make the background mixing latitude dependent according to @@ -1186,7 +1179,7 @@ .006 - + Fraction of surface TKE that penetrates beneath mixed layer @@ -1196,7 +1189,7 @@ .true. - + If true, apply lateral smoothing of CVMix estimated @@ -1206,7 +1199,7 @@ none - + Type of CVMix Langmuir turbulence parameterization. Valid @@ -1219,7 +1212,7 @@ layer layer - + Type of lateral tracer eddy diffusion: Valid methods: @@ -1235,7 +1228,7 @@ 'Gibraltar','Gibraltar' 'Gibraltar','Gibraltar' - + Array of geographical names of channels to be modified (a) @@ -1248,7 +1241,7 @@ 'u','u' - + Array of C grid cell edges to be modified. Valid options: @@ -1256,11 +1249,11 @@ cwmod cwmod - -999,-999 + -999,-999 53,54 105,106 - + Array of grid cell i-indices (i) @@ -1272,7 +1265,7 @@ 137,137 273,273 - + Array of grid cell j-indices (i) @@ -1285,7 +1278,7 @@ 30.e3,30.e3 - + Array of modified grid cell widths (m) (f) @@ -1322,7 +1315,7 @@ 'hd','hm','hy' - + tag used in file name (c10) @@ -1332,7 +1325,7 @@ 1,30,365 - + average period in days @@ -1343,7 +1336,7 @@ 30,30,365 1,30,365 - + how often to start a new file in days @@ -1353,7 +1346,7 @@ 0,0,0 - + switch for compressed/uncompressed output @@ -1364,7 +1357,10 @@ 0,0,0 1,1,1 - + + netcdf format (valid arguments are 0 for classic, 1 for 64-bit + offset and 2 for netcdf4/hdf5 format) + @@ -1374,7 +1370,7 @@ 0,4,0 - + absolute wind speed [m s-1] @@ -1384,7 +1380,7 @@ 0,0,0 - + surface albedo [] @@ -1394,7 +1390,7 @@ 0,4,0 - + Barotropic mass streamfunction [kg s-1] @@ -1404,7 +1400,7 @@ 0,4,0 - + brine flux [kg m-2 s-1] @@ -1414,7 +1410,7 @@ 0,4,0 - + brine plume depth [m] @@ -1424,7 +1420,7 @@ 0,0,0 - + non-solar heat flux derivative [W m-2 K-1] @@ -1434,7 +1430,7 @@ 0,4,0 - + evaporation [kg m-2 s-1] @@ -1444,7 +1440,7 @@ 0,4,0 - + ice concentration [%] @@ -1454,7 +1450,7 @@ 0,4,0 - + fresh water flux due to melting/freezing [kg m-2 s-1] @@ -1464,7 +1460,7 @@ 0,0,0 - + ice thickness [m] @@ -1474,7 +1470,7 @@ 0,4,0 - + heat flux due to melting/freezing [W m-2] @@ -1484,7 +1480,7 @@ 0,0,0 - + snow depth [m] @@ -1494,7 +1490,7 @@ 0,0,0 - + ice age [d] @@ -1504,7 +1500,7 @@ 0,4,0 - + mixed layer inertial kinetic energy tendency [kg s-3] @@ -1514,7 +1510,7 @@ 0,4,0 - + Langmuir enhancement factor [] @@ -1524,7 +1520,7 @@ 0,4,0 - + Surface layer averaged Langmuir number [] @@ -1534,7 +1530,7 @@ 0,4,0 - + liquid precipitation [kg m-2 s-1] @@ -1544,7 +1540,7 @@ 4,4,0 - + maximum mixed layer depth [m] @@ -1554,7 +1550,7 @@ 0,4,0 - + mixed layer depth [m] @@ -1564,7 +1560,7 @@ 4,4,0 - + mixed layer thickness using "sigma-t" criterion [m] @@ -1574,7 +1570,7 @@ 0,4,0 - + minimum mixed layer thickness using "sigma-t" criterion [m] @@ -1584,7 +1580,7 @@ 0,4,0 - + maximum mixed layer thickness using "sigma-t" criterion [m] @@ -1594,7 +1590,7 @@ 0,4,0 - + mixed layer thickness squared using "sigma-t" criterion [m2] @@ -1604,7 +1600,7 @@ 0,4,0 - + mixed layer TKE tendency related to friction velocity [kg s-3] @@ -1614,7 +1610,7 @@ 0,4,0 - + mixed layer TKE tendency related to near inertial mot. [kg s-3] @@ -1624,7 +1620,7 @@ 0,4,0 - + mixed layer TKE tendency related to buoyancy forcing [kg s-3] @@ -1634,7 +1630,7 @@ 0,4,0 - + mixed layer TKE tendency related to eddy restrat. [kg s-3] @@ -1644,7 +1640,7 @@ 0,4,0 - + mixed layer TKE tendency related to pot. energy change [kg s-3] @@ -1654,7 +1650,7 @@ 0,4,0 - + mixed layer TKE tendency related to kin. energy change [kg s-3] @@ -1664,7 +1660,7 @@ 0,4,0 - + wind stress y-component [N m-2] @@ -1674,7 +1670,7 @@ 0,4,0 - + non-solar heat flux [W m-2] @@ -1684,7 +1680,7 @@ 0,4,0 - + bottom pressure [Pa] @@ -1694,7 +1690,7 @@ 0,4,0 - + surface pressure [Pa] @@ -1704,7 +1700,7 @@ 0,4,0 - + frozen runoff [kg m-2 s-1] @@ -1714,7 +1710,7 @@ 0,4,0 - + liquid runoff [kg m-2 s-1] @@ -1724,7 +1720,7 @@ 0,4,0 - + salt flux received by ocean [kg m-2 s-1] @@ -1734,7 +1730,7 @@ 0,4,0 - + restoring salt flux received by ocean [kg m-2 s-1] @@ -1744,7 +1740,7 @@ 0,4,0 - + bottom salinity [g kg-1] @@ -1754,7 +1750,7 @@ 4,4,0 - + sea level [m] @@ -1764,7 +1760,7 @@ 0,4,0 - + sea level squared [m2] @@ -1774,7 +1770,7 @@ 0,4,0 - + salt flux [kg m-2 s-1] @@ -1784,7 +1780,7 @@ 0,4,0 - + solid precipitation [kg m-2 s-1] @@ -1794,7 +1790,7 @@ 0,4,0 - + mixed layer density [kg m-3] @@ -1804,7 +1800,7 @@ 4,4,0 - + ocean surface salinity [g kg-1] @@ -1814,7 +1810,7 @@ 4,4,0 - + ocean surface salinity squared [g2 kg-2] @@ -1824,7 +1820,7 @@ 4,4,0 - + ocean surface temperature [degC] @@ -1834,7 +1830,7 @@ 4,4,0 - + ocean surface temperature squared [degC2] @@ -1844,7 +1840,7 @@ 0,4,0 - + heat flux received by ocean [W m-2] @@ -1854,7 +1850,7 @@ 0,4,0 - + restoring heat flux received by ocean [W m-2] @@ -1864,7 +1860,7 @@ 0,4,0 - + short-wave heat flux [W m-2] @@ -1874,7 +1870,7 @@ 4,4,0 - + 20C isoterm depth [m] @@ -1884,7 +1880,7 @@ 0,4,0 - + momentum flux received by ocean x-component [N m-2] @@ -1894,7 +1890,7 @@ 0,4,0 - + momentum flux received by ocean y-component [N m-2] @@ -1904,7 +1900,7 @@ 0,4,0 - + bottom temperature [degC] @@ -1914,7 +1910,7 @@ 0,0,0 - + ice temperature [degC] @@ -1924,7 +1920,7 @@ 0,0,0 - + surface temperature [degC] @@ -1934,7 +1930,7 @@ 0,4,0 - + barotropic velocity x-component [m s-1] @@ -1944,7 +1940,7 @@ 0,0,0 - + ice velocity x-component [m s-1] @@ -1954,7 +1950,7 @@ 0,4,0 - + friction velocity [m s-1] @@ -1964,7 +1960,7 @@ 0,4,0 - + friction velocity cubed [m3 s-3] @@ -1974,7 +1970,7 @@ 0,0,0 - + surface Stokes drift x-componen [m s-1] @@ -1984,7 +1980,7 @@ 0,4,0 - + barotropic velocity y-component [m s-1] @@ -1994,7 +1990,7 @@ 0,0,0 - + ice velocity y-component [m s-1] @@ -2004,7 +2000,7 @@ 0,0,0 - + surface Stokes drift y-componen [m s-1] @@ -2014,7 +2010,7 @@ 0,4,0 - + wind stress x-component [N m-2] @@ -2024,7 +2020,7 @@ 0,4,0 - + buoyancy frequency squared [s-1] @@ -2034,7 +2030,7 @@ 0,4,0 - + vertical diffusivity [log10(m2 s-1)|m2 s-1] @@ -2044,7 +2040,7 @@ 0,4,0 - + vertical momentum diffusivity [log10(m2 s-1)|m2 s-1] @@ -2054,7 +2050,7 @@ 0,4,0 - + vertical heat diffusivity [log10(m2 s-1)|m2 s-1] @@ -2064,7 +2060,7 @@ 0,4,0 - + vertical salt diffusivity [log10(m2 s-1)|m2 s-1] @@ -2074,7 +2070,7 @@ 0,4,0 - + layer interface diffusivity [log10(m2 s-1)] @@ -2084,7 +2080,7 @@ 0,4,0 - + isopycnal diffusivity [log10(m2 s-1)] @@ -3073,7 +3069,7 @@ $DIN_LOC_ROOT/ocn/blom/grid/ocean_regions_tnx0.125v4_20221013.nc abs - + Name of file containing ocean region specification (a) @@ -3088,7 +3084,7 @@ $DIN_LOC_ROOT/ocn/blom/grid/mertra_index_tnx0.125v4_20221013.dat abs - + Name of file containing zonal section specification for @@ -3098,7 +3094,7 @@ 'atlantic_arctic_ocean','atlantic_arctic_extended_ocean','indian_pacific_ocean','global_ocean' - + Array of region names for meridional overturning and flux @@ -3277,7 +3273,7 @@ .false. .true. - Logical switch to activate sediment spin-up + Logical switch to activate sediment spin-upLogical switch to activate sediment spin-up @@ -3288,7 +3284,7 @@ -1 $HAMOCC_SEDSPINUP_YR_START - + Start year for sediment spinup @@ -3299,7 +3295,7 @@ -1 $HAMOCC_SEDSPINUP_YR_END - + End year for sediment spinup @@ -3309,7 +3305,7 @@ -1 - + Number of subcyles per time-step for sediment spinup @@ -3460,7 +3456,7 @@ UNSET - + Name of alkalinization scenario ('const', 'ramp', or 'file') @@ -3483,7 +3479,7 @@ 0.135 - + Pmol alkalinity/yr added in 'const' or 'ramp' scenarios @@ -3493,7 +3489,7 @@ 70.0 - + Max latitude where alkalinity is added in 'const' or 'ramp' scenarios @@ -3503,7 +3499,7 @@ -60.0 - + Min latitude where alkalinity is added in 'const' or 'ramp' scenarios @@ -3513,7 +3509,7 @@ 2025 - + Start year for ramp up in 'ramp' scenario @@ -3523,7 +3519,7 @@ 2035 - + End year for ramp up in 'ramp' scenario @@ -3599,7 +3595,7 @@ 0, 2, 2 - + Phosphorus (po4) [mol P m-3] @@ -3609,7 +3605,7 @@ 0, 2, 2 - + Oxygen (o2) [mol O2 m-3] @@ -3619,7 +3615,7 @@ 0, 2, 2 - + Dissolved iron (dfe) [mol Fe m-3] @@ -3629,7 +3625,7 @@ 0, 2, 2 - + Nitrate (no3) [mol N m-3] @@ -3639,7 +3635,7 @@ 4, 2, 2 - + Natural alkalinity (nattalk) [eq m-3] @@ -3659,7 +3655,7 @@ 4, 2, 2 - + Dissolved carbon (dissic) [mol C m-3] @@ -3669,7 +3665,7 @@ 4, 2, 2 - + Phytoplankton (phyc) [mol C m-3] @@ -3679,7 +3675,7 @@ 0, 2, 2 - + pH (ph) [-log10([h+])] @@ -3689,7 +3685,7 @@ 0, 2, 2 - + Export production (epc100) [mol C m-2 s-1] @@ -3699,7 +3695,7 @@ 0, 2, 2 - + Si export production (epsi100) [mol Si m-2 s-1] @@ -3709,7 +3705,7 @@ 0, 2, 2 - + Ca export production (epcalc100) [mol Ca m-2 s-1] @@ -3719,7 +3715,7 @@ 0, 2, 2 - + Piston velocity (kwco2) [m s-1] @@ -3729,7 +3725,7 @@ 0, 2, 2 - + Piston velocity times solubility (kwco2*kh; moist air) [m s-1 mol kg-1 uatm-1] @@ -3739,7 +3735,7 @@ 0, 2, 2 - + Piston velocity times solubility (kwco2*kh; moist air) [m s-1 mol kg-1 uatm-1] @@ -3749,7 +3745,7 @@ 0, 2, 2 - + CO2 solubility under moist air assumption (kh) [mol kg-1 atm-1] @@ -3759,7 +3755,7 @@ 0, 2, 2 - + Natural surface PCO2 (spco2) [uatm] @@ -3769,7 +3765,7 @@ 0, 2, 2 - + Surface PCO2 under moist air assumption [uatm] @@ -3779,7 +3775,7 @@ 4, 2, 2 - + Downward CO2 flux (co2fxd) [kg C m-2 s-1] @@ -3789,7 +3785,7 @@ 4, 2, 2 - + Upward CO2 flux (co2fxu) [kg C m-2 s-1] @@ -3799,7 +3795,7 @@ 0, 2, 2 - + Oxygen flux (fgo2) [mol O2 m-2 s-1] @@ -3809,7 +3805,7 @@ 0, 2, 2 - + Nitrogen flux (fgn2) [mol N2 m-2 s-1] @@ -3819,7 +3815,7 @@ 0, 0, 2 - + Nitrous oxide flux [mol N2O m-2 s-1] @@ -3829,7 +3825,7 @@ 0, 2, 2 - + DMS flux (dmsflux) [mol DMS m-2 s-1] @@ -3839,7 +3835,7 @@ 0, 2, 2 - + surface DMS concentration (dms) [mol DMS m-3] @@ -3849,7 +3845,7 @@ 0, 2, 2 - + DMS production (dmsprod) [mol DMS m-2 s-1] @@ -3859,7 +3855,7 @@ 0, 2, 2 - + DMS bacterial consuption (dms_bac) [mol DMS m-2 s-1] @@ -3869,7 +3865,7 @@ 0, 2, 2 - + DMS decomposition by UV (dms_uv) [mol DMS m-2 s-1] @@ -3879,7 +3875,7 @@ 0, 2, 2 - + Atmospheric CO2 (atmco2) [ppm] @@ -3889,7 +3885,7 @@ 0, 2, 2 - + Atmospheric O2 (atmo2) [ppm] @@ -3899,7 +3895,7 @@ 0, 2, 2 - + Atmospheric N2 (atmn2) [ppm] @@ -3909,7 +3905,7 @@ 0, 2, 2 - + Natural dissolved carbon (natdissic) [mol C m-3] @@ -3919,7 +3915,7 @@ 0, 2, 2 - + Natural alkalinity (nattalk) [eq m-3] @@ -3929,7 +3925,7 @@ 0, 2, 2 - + Natural pH (natph) [-log10([h+])] @@ -3939,7 +3935,7 @@ 0, 2, 2 - + Natural surface PCO2 (spco2) [uatm] @@ -3949,7 +3945,7 @@ 0, 2, 2 - + Natural net CO2 flux (natco2fx) [kg C m-2 s-1] @@ -3959,7 +3955,7 @@ 0, 2, 2 - + Downward 13CO2 flux (co213fxd) [kg C m-2 s-1] @@ -3969,7 +3965,7 @@ 0, 2, 2 - + Upward 13CO2 flux (co213fxu) [kg C m-2 s-1] @@ -3979,7 +3975,7 @@ 0, 2, 2 - + Downward 14CO2 flux (co214fxd) [kg C m-2 s-1] @@ -3989,7 +3985,7 @@ 0, 2, 2 - + Upward 14CO2 flux (co214fxu) [kg C m-2 s-1] @@ -3999,7 +3995,7 @@ 0, 2, 2 - + CFC11 flux [mol CFC11 m-2 s-1] @@ -4009,7 +4005,7 @@ 0, 2, 2 - + CFC12 flux [mol CFC12 m-2 s-1] @@ -4019,7 +4015,7 @@ 0, 2, 2 - + SF6 flux [mol SF6 m-2 s-1] @@ -4069,7 +4065,7 @@ 4, 2, 2 - + Primary production (pp) [mol C m-3 s-1] @@ -4079,7 +4075,7 @@ 0, 2, 2 - + Vertically integrated nitrogen fixation @@ -4089,7 +4085,7 @@ 0, 2, 2 - + Vertically integrated denitrification @@ -4100,7 +4096,7 @@ 0,0,0 0, 2, 2 - + Nitrogen deposition flux [mol N m-2 s-1] @@ -4110,7 +4106,7 @@ 0, 0, 0 - + AMELIST FOR DIAGNOSTIC iHAMOCC OUTPUT @@ -4340,7 +4336,7 @@ 0, 0, 2 - + Phosphorus (po4) [mol P m-3] @@ -4350,7 +4346,7 @@ 0, 0, 4 - + Oxygen (o2) [mol O2 m-3] @@ -4360,7 +4356,7 @@ 0, 0, 2 - + Dissolved iron (dfe) [mol Fe m-3] @@ -4420,7 +4416,7 @@ 0, 0, 2 - + CaCO3 shells (calc) [mol C m-3] @@ -4430,7 +4426,7 @@ 0, 0, 2 - + Opal shells (opal) [mol Si m-3] @@ -4440,7 +4436,7 @@ 0, 0, 2 - + Carbonate ions (co3) [mol C m-3] @@ -4450,7 +4446,7 @@ 0, 0, 0 - + Nitrous oxide concentration [mol N2O m-3] @@ -4470,7 +4466,7 @@ 0, 0, 2 - + Calcite saturation state (omegac) [1] @@ -4480,7 +4476,7 @@ 0, 0, 2 - + Natural aragonite saturation state (natomegaa) [1] @@ -4490,7 +4486,7 @@ 0, 0, 4 - + preformed oxygen (p_o2) [mol O2 m-3] @@ -4500,7 +4496,7 @@ 0, 0, 4 - + Saturated oxygen (satoxy) [mol O2 m-3] @@ -4520,7 +4516,7 @@ 0, 0, 2 - + preformed alkalinity (p_talk) [eq m-3] @@ -4530,7 +4526,7 @@ 0, 0, 2 - + preformed DIC (p_dic) [mol C m-3] @@ -4540,7 +4536,7 @@ 0, 0, 2 - + saturated DIC (dic_sat) [mol C m-3] @@ -4550,7 +4546,7 @@ 0, 0, 2 - + Natural dissolved carbon (natdissic) [mol C m-3] @@ -4560,7 +4556,7 @@ 0, 0, 2 - + Natural alkalinity (nattalk) [eq m-3] @@ -4570,7 +4566,7 @@ 0, 0, 2 - + Natural carbonate ion concentration (natco3) [mol C m-3] @@ -4580,7 +4576,7 @@ 0, 0, 2 - + Natural CaCO3 shells (natcalc) [mol C m-3] @@ -4590,7 +4586,7 @@ 0, 0, 2 - + Natural pH (natph) [-log10([h+])] @@ -4600,7 +4596,7 @@ 0, 0, 2 - + Natural calcite saturation state (natomegac) [1] @@ -4610,7 +4606,7 @@ 0, 0, 2 - + Natural aragonite saturation state (natomegaa) [1] @@ -4620,7 +4616,7 @@ 0, 0, 2 - + Dissolved C13 (dissic13) [mol C m-3] @@ -4630,7 +4626,7 @@ 0, 0, 2 - + Dissolved C14 (dissic14) [mol C m-3] @@ -4640,7 +4636,7 @@ 0, 0, 2 - + at-depth variable sediment porosity (as opposed to default: only depth) @@ -4650,7 +4646,7 @@ 0, 0, 2 - + delta 14C of DIC [1] @@ -4660,7 +4656,7 @@ 0, 0, 2 - + Delta 14C of DIC [1] @@ -4670,7 +4666,7 @@ 0, 0, 2 - + Particulate organic carbon 13 (detoc13) [mol C m-3] @@ -4680,7 +4676,7 @@ 0, 0, 2 - + Dissolved organic carbon 13 (dissoc13) [mol C m-3] @@ -4690,7 +4686,7 @@ 0, 0, 2 - + Particulate inorganic carbon 13 (calc13) [mol C m-3] @@ -4700,7 +4696,7 @@ 0, 0, 2 - + 13C of phytoplankton biomass (phyc13) [mol C m-3] @@ -4710,7 +4706,7 @@ 0, 0, 2 - + 13C of zootoplankton biomass (zooc13) [mol C m-3] @@ -4720,7 +4716,7 @@ 0, 0, 2 - + CFC11 concentration [mol CFC11 m-3] @@ -4730,7 +4726,7 @@ 0, 0, 2 - + CFC12 concentration [mol CFC12 m-3] @@ -4740,7 +4736,7 @@ 0, 0, 2 - + SF6 concentration [mol SF6 m-3] @@ -4750,7 +4746,7 @@ 0, 0, 2 - + ndex of point diagnostics (i) @@ -4760,7 +4756,7 @@ 0, 0, 2 - + Mass sinking velocity (aggregate scheme) [m d-1] @@ -4770,7 +4766,7 @@ 0, 0, 2 - + Number sinking velocity (aggregate scheme) [m d-1] @@ -4780,7 +4776,7 @@ 0, 0, 0 - + Epsilon exponent (aggregate scheme) [1] @@ -4790,7 +4786,7 @@ 0, 0, 0 - + Average particle size (aggregate scheme) @@ -4820,7 +4816,7 @@ 0, 2, 2 - + Phytoplankton (phyc) [mol C m-3] @@ -4830,7 +4826,7 @@ 0, 2, 2 - + Zooplankton (zooc) [mol C m-3] @@ -4840,7 +4836,7 @@ 0, 2, 2 - + Dissolved organic carbon (dissoc) [mol C m-3] @@ -4850,7 +4846,7 @@ 0, 2, 2 - + Primary production (pp) [mol C m-3 s-1] @@ -4860,7 +4856,7 @@ 0, 2, 2 - + Phosphorus (po4) [mol P m-3] @@ -4870,7 +4866,7 @@ 0, 4, 4 - + Oxygen (o2) [mol O2 m-3] @@ -4880,7 +4876,7 @@ 0, 2, 2 - + eposition @@ -4890,7 +4886,7 @@ 0, 2, 2 - + Nitrate (no3) [mol N m-3] @@ -4900,7 +4896,7 @@ 0, 2, 2 - + Alkalinity (talk) [eq m-3] @@ -4910,7 +4906,7 @@ 0, 2, 2 - + Silicate (si) [mol Si m-3] @@ -4920,7 +4916,7 @@ 0, 2, 2 - + Dissolved carbon (dissic) [mol C m-3] @@ -4930,7 +4926,7 @@ 0, 2, 2 - + Detrius (detoc) [mol C m-3] @@ -4940,7 +4936,7 @@ 0, 2, 2 - + CaCO3 shells (calc) [mol C m-3] @@ -4950,7 +4946,7 @@ 0, 2, 2 - + Opal shells (opal) [mol Si m-3] @@ -4960,7 +4956,7 @@ 0, 2, 2 - + ] @@ -4970,7 +4966,7 @@ 0, 0, 2 - + Nitrous oxide concentration [mol N2O m-3] @@ -4990,7 +4986,7 @@ 0, 2, 2 - + Calcite saturation state (omegac) [1] @@ -5000,7 +4996,7 @@ 0, 2, 2 - + Aragonite saturation state (omegaa) [1] @@ -5010,7 +5006,7 @@ 0, 4, 4 - + preformed oxygen (p_o2) [mol O2 m-3] @@ -5020,7 +5016,7 @@ 0, 4, 4 - + Saturated oxygen (satoxy) [mol O2 m-3] @@ -5030,7 +5026,7 @@ 0, 2, 2 - + preformed phosphate (p_po4) [mol PO4 m-3] @@ -5040,7 +5036,7 @@ 0, 2, 2 - + preformed alkalinity (p_talk) [eq m-3] @@ -5050,7 +5046,7 @@ 0, 2, 2 - + preformed DIC (p_dic) [mol C m-3] @@ -5060,7 +5056,7 @@ 0, 2, 2 - + saturated DIC (dic_sat) [mol C m-3] @@ -5070,7 +5066,7 @@ 0, 2, 2 - + Natural dissolved carbon (natdissic) [mol C m-3] @@ -5080,7 +5076,7 @@ 0, 2, 2 - + Natural alkalinity (nattalk) [eq m-3] @@ -5090,7 +5086,7 @@ 0, 2, 2 - + Natural carbonate ion concentration (natco3) [mol C m-3] @@ -5100,7 +5096,7 @@ 0, 2, 2 - + Natural CaCO3 shells (natcalc) [mol C m-3] @@ -5110,7 +5106,7 @@ 0, 2, 2 - + Natural pH (natph) [-log10([h+])] @@ -5120,7 +5116,7 @@ 0, 2, 2 - + Natural calcite saturation state (natomegac) [1] @@ -5130,7 +5126,7 @@ 0, 2, 2 - + Natural aragonite saturation state (natomegaa) [1] @@ -5140,7 +5136,7 @@ 0, 2, 2 - + Dissolved C13 (dissic13) [mol C m-3] @@ -5150,7 +5146,7 @@ 0, 2, 2 - + Dissolved C14 (dissic14) [mol C m-3] @@ -5160,7 +5156,7 @@ 0, 2, 2 - + delta 13C of DIC [1] @@ -5170,7 +5166,7 @@ 0, 2, 2 - + Particulate organic carbon 13 (detoc13) [mol C m-3] @@ -5180,7 +5176,7 @@ 0, 2, 2 - + Dissolved organic carbon 13 (dissoc13) [mol C m-3] @@ -5190,7 +5186,7 @@ 0, 2, 2 - + Particulate inorganic carbon 13 (calc13) [mol C m-3] @@ -5200,7 +5196,7 @@ 0, 2, 2 - + 13C of phytoplankton biomass (phyc13) [mol C m-3] @@ -5210,7 +5206,7 @@ 0, 2, 2 - + 13C of zootoplankton biomass (zooc13) [mol C m-3] @@ -5220,7 +5216,7 @@ 0, 2, 2 - + CFC11 concentration [mol CFC11 m-3] @@ -5230,7 +5226,7 @@ 0, 2, 2 - + CFC12 concentration [mol CFC12 m-3] @@ -5240,7 +5236,7 @@ 0, 2, 2 - + SF6 concentration [mol SF6 m-3] @@ -5250,7 +5246,7 @@ 0, 2, 2 - + Number of sinking particles (aggregate scheme, nos) [cm-3] @@ -5260,7 +5256,7 @@ 0, 2, 2 - + Mass sinking velocity (aggregate scheme) [m d-1] @@ -5270,7 +5266,7 @@ 0, 2, 2 - + Number sinking velocity (aggregate scheme) [m d-1] @@ -5280,7 +5276,7 @@ 0, 0, 0 - + Epsilon exponent (aggregate scheme) [1] @@ -5290,7 +5286,7 @@ 0, 0, 0 - + Average particle size (aggregate scheme) @@ -5340,7 +5336,7 @@ 0, 0, 2 - + sediment - water-column diffusive flux of oxygen [mol O2 m-2 s-1] @@ -5350,7 +5346,7 @@ 0, 0, 2 - + sediment - water-column diffusive flux of N2 [mol N2 m-2 s-1] @@ -5360,7 +5356,7 @@ 0, 0, 2 - + sediment - water-column diffusive flux of nitrate [mol NO3 m-2 s-1] @@ -5370,7 +5366,7 @@ 0, 0, 2 - + sediment - water-column diffusive flux of silica [mol Si m-2 s-1] @@ -5380,7 +5376,7 @@ 0, 0, 2 - + (powdic) [mol C m-3] @@ -5390,7 +5386,7 @@ 0, 0, 2 - + (powalk) [eq m-3] @@ -5400,7 +5396,7 @@ 0, 0, 2 - + (powpho) [eq m-3] @@ -5410,7 +5406,7 @@ 0, 0, 2 - + (powox) [mol O2 m-3] @@ -5420,7 +5416,7 @@ 0, 0, 2 - + (pown2) [mol N2 m-3] @@ -5430,7 +5426,7 @@ 0, 0, 2 - + (powno3)[mol N m-3] @@ -5440,7 +5436,7 @@ 0, 0, 2 - + (powsi) [mol Si m-3] @@ -5450,7 +5446,7 @@ 0, 0, 2 - + (ssso12) [mol m-3] @@ -5460,7 +5456,7 @@ 0, 0, 2 - + (ssssil) [mol Si m-3] @@ -5470,7 +5466,7 @@ 0, 0, 2 - + (sssc12) [mol C m-3] @@ -5480,7 +5476,7 @@ 0, 0, 2 - + (ssster) [mol m-3] @@ -5490,7 +5486,7 @@ 0, 0, 2 - + (ssso12) [mol m-3] @@ -5500,7 +5496,7 @@ 0, 0, 2 - + (ssssil) [mol Si m-3] @@ -5510,7 +5506,7 @@ 0, 0, 2 - + (sssc12) [mol C m-3] @@ -5520,7 +5516,7 @@ 0, 0, 2 - + (ssster) [mol m-3] diff --git a/cime_config/ocn_in.readme b/cime_config/ocn_in.readme index 8750f450..56d98527 100644 --- a/cime_config/ocn_in.readme +++ b/cime_config/ocn_in.readme @@ -75,8 +75,8 @@ ! SRXBAL : Balance the SSS relaxation (l) ! SCFILE : Name of file containing SSS climatology used for relaxation (a) ! WAVSRC : Source of wave fields. Valid source: 'none', 'param', 'extern' (a) -! SMTFRC : Smooth CESM forcing (l) -! SPRFAC : Send precipitation/runoff factor to CESM coupler (l) +! SMTFRC : Smooth NorESM forcing (l) +! SPRFAC : Send precipitation/runoff factor to NorESM coupler (l) ! ATM_PATH : Path to forcing fields in case of EXPCNF 'ben02clim' or ! 'ben02syn' (a) ! ITEST : Global i-index of point diagnostics (i) From 7cf92673d5613f75ddaa577077d72c3891587b05 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Thu, 27 Jul 2023 13:27:59 +0200 Subject: [PATCH 30/52] wav update to mod_nuopc_methods.F90 --- drivers/nuopc/mod_nuopc_methods.F90 | 270 +++++++++++++++------------- 1 file changed, 146 insertions(+), 124 deletions(-) diff --git a/drivers/nuopc/mod_nuopc_methods.F90 b/drivers/nuopc/mod_nuopc_methods.F90 index 73430298..17314dc2 100644 --- a/drivers/nuopc/mod_nuopc_methods.F90 +++ b/drivers/nuopc/mod_nuopc_methods.F90 @@ -30,7 +30,8 @@ module mod_nuopc_methods use mod_grid, only: scuy, scvx, scp2, scuxi, scvyi, plon, plat, & cosang, sinang use mod_state, only: u, v, dp, temp, saln, pbu, pbv, ubflxs, vbflxs, sealv - use mod_forcing, only: sprfac, prfac, flxco2, flxdms, flxbrf + use mod_forcing, only: wavsrc_opt, wavsrc_extern, sprfac, prfac, flxco2, & + flxdms, flxbrf use mod_difest, only: obldepth use mod_vcoord, only: vcoord_type_tag, isopyc_bulkml, cntiso_hybrid use mod_cesm, only: frzpot, mltpot, & @@ -123,6 +124,17 @@ module mod_nuopc_methods index_Fioo_q = - 1, & index_Faoo_fco2_ocn = - 1 +#ifdef PROGCO2 + logical :: progco2 = .true. +#else + logical :: progco2 = .false. +#endif +#ifdef DIAGCO2 + logical :: diagco2 = .true. +#else + logical :: diagco2 = .false. +#endif + contains ! --------------------------------------------------------------------------- @@ -245,10 +257,12 @@ subroutine blom_advertise_imports(flds_scalar_name, fldsToOcn_num, fldsToOcn, & end if ! From wave: - call fldlist_add(fldsToOcn_num, fldsToOcn, 'Sw_lamult' , index_Sw_lamult) - call fldlist_add(fldsToOcn_num, fldsToOcn, 'Sw_ustokes' , index_Sw_ustokes) - call fldlist_add(fldsToOcn_num, fldsToOcn, 'Sw_vstokes' , index_Sw_vstokes) - call fldlist_add(fldsToOcn_num, fldsToOcn, 'Sw_hstokes' , index_Sw_hstokes) + if (wavsrc_opt == wavsrc_extern) then + call fldlist_add(fldsToOcn_num, fldsToOcn, 'Sw_lamult' , index_Sw_lamult) + call fldlist_add(fldsToOcn_num, fldsToOcn, 'Sw_ustokes' , index_Sw_ustokes) + call fldlist_add(fldsToOcn_num, fldsToOcn, 'Sw_vstokes' , index_Sw_vstokes) + call fldlist_add(fldsToOcn_num, fldsToOcn, 'Sw_hstokes' , index_Sw_hstokes) + end if ! From atmosphere: call fldlist_add(fldsToOcn_num, fldsToOcn, 'Sa_pslv' , index_Sa_pslv ) @@ -804,122 +818,142 @@ subroutine blom_importflds(fldlist_num, fldlist) call fill_global(mval, fval, halo_ps, abswnd_da(1-nbdy,1-nbdy,l2ci)) call fill_global(mval, fval, halo_ps, ficem_da(1-nbdy,1-nbdy,l2ci)) - !$omp parallel do private(i, n, utmp, vtmp) - do j = 1, jjcpl - do i = 1, ii - if (ip(i,j) == 0) then - util1(i,j) = mval - util2(i,j) = mval - lamult_da(i,j,l2ci) = mval - lasl_da(i,j,l2ci) = mval - elseif (cplmsk(i,j) == 0) then - util1(i,j) = fval - util2(i,j) = fval - lamult_da(i,j,l2ci) = fval - lasl_da(i,j,l2ci) = fval - else - n = (j - 1)*ii + i - - utmp = fldlist(index_Sw_ustokes)%dataptr(n) - vtmp = fldlist(index_Sw_vstokes)%dataptr(n) - util1(i,j) = utmp*cosang(i,j) + vtmp*sinang(i,j) - util2(i,j) = - utmp*sinang(i,j) + vtmp*cosang(i,j) - - ! Langmuir enhancement factor []. - lamult_da(i,j,l2ci) = fldlist(index_Sw_lamult)%dataptr(n) - - ! Surface layer averaged Langmuir number []. - lasl_da(i,j,l2ci) = fldlist(index_Sw_hstokes)%dataptr(n) - - endif - enddo - enddo - !$omp end parallel do - - call fill_global(mval, fval, halo_pv, util1) - call fill_global(mval, fval, halo_pv, util2) - call fill_global(mval, fval, halo_ps, lamult_da(1-nbdy,1-nbdy,l2ci)) - call fill_global(mval, fval, halo_ps, lasl_da(1-nbdy,1-nbdy,l2ci)) - - call xctilr(util1, 1,1, 1,1, halo_pv) - call xctilr(util2, 1,1, 1,1, halo_pv) - - !$omp parallel do private(l, i) - do j = 1, jj - do l = 1, isu(j) - do i = max(1,ifu(j,l)), min(ii,ilu(j,l)) - ! x-component of surface Stokes drift [m s-1]. - ustokes_da(i,j,l2ci) = .5_r8*(util1(i-1,j) + util1(i,j)) - enddo - enddo - do l = 1,isv(j) - do i = max(1,ifv(j,l)), min(ii,ilv(j,l)) - ! y-component of surface Stokes drift [m s-1]. - vstokes_da(i,j,l2ci) = .5_r8*(util2(i,j-1) + util2(i,j)) - enddo - enddo - enddo - !$omp end parallel do - -#ifdef PROGCO2 - if (index_Sa_co2prog > 0) then - !$omp parallel do private(i, n) + if (wavsrc_opt == wavsrc_extern) then + !$omp parallel do private(i, n, utmp, vtmp) do j = 1, jjcpl do i = 1, ii if (ip(i,j) == 0) then - atmco2_da(i,j,l2ci) = mval + util1(i,j) = mval + util2(i,j) = mval + lamult_da(i,j,l2ci) = mval + lasl_da(i,j,l2ci) = mval elseif (cplmsk(i,j) == 0) then - atmco2_da(i,j,l2ci) = fval + util1(i,j) = fval + util2(i,j) = fval + lamult_da(i,j,l2ci) = fval + lasl_da(i,j,l2ci) = fval else n = (j - 1)*ii + i - ! Atmospheric co2 concentration [ppmv?] - atmco2_da(i,j,l2ci) = fldlist(index_Sa_co2prog)%dataptr(n) + + utmp = fldlist(index_Sw_ustokes)%dataptr(n) + vtmp = fldlist(index_Sw_vstokes)%dataptr(n) + util1(i,j) = utmp*cosang(i,j) + vtmp*sinang(i,j) + util2(i,j) = - utmp*sinang(i,j) + vtmp*cosang(i,j) + + ! Langmuir enhancement factor []. + lamult_da(i,j,l2ci) = fldlist(index_Sw_lamult)%dataptr(n) + + ! Surface layer averaged Langmuir number []. + lasl_da(i,j,l2ci) = fldlist(index_Sw_hstokes)%dataptr(n) + endif enddo enddo - !$omp end parallel do - call fill_global(mval, fval, halo_ps, atmco2_da(1-nbdy,1-nbdy,l2ci)) - if (mnproc == 1 .and. first_call) & - write(lp,*) subname//': prog. atmospheric co2 read' - else - !$omp parallel do private(i) + !$omp end parallel do + + call fill_global(mval, fval, halo_pv, util1) + call fill_global(mval, fval, halo_pv, util2) + call fill_global(mval, fval, halo_ps, lamult_da(1-nbdy,1-nbdy,l2ci)) + call fill_global(mval, fval, halo_ps, lasl_da(1-nbdy,1-nbdy,l2ci)) + + call xctilr(util1, 1,1, 1,1, halo_pv) + call xctilr(util2, 1,1, 1,1, halo_pv) + + !$omp parallel do private(l, i) do j = 1, jj - do i = 1, ii - if (ip(i,j) == 0) then - atmco2_da(i,j,l2ci) = mval - else - atmco2_da(i,j,l2ci) = -1 - endif + do l = 1, isu(j) + do i = max(1,ifu(j,l)), min(ii,ilu(j,l)) + ! x-component of surface Stokes drift [m s-1]. + ustokes_da(i,j,l2ci) = .5_r8*(util1(i-1,j) + util1(i,j)) + enddo + enddo + do l = 1,isv(j) + do i = max(1,ifv(j,l)), min(ii,ilv(j,l)) + ! y-component of surface Stokes drift [m s-1]. + vstokes_da(i,j,l2ci) = .5_r8*(util2(i,j-1) + util2(i,j)) + enddo enddo enddo - !$omp end parallel do - if (mnproc == 1 .and. first_call) & - write(lp,*) subname//': prog. atmospheric co2 not read' - endif + !$omp end parallel do -#elif defined(DIAGCO2) + end if - if (index_Sa_co2diag > 0) then - !$omp parallel do private(i, n) - do j = 1, jjcpl - do i = 1, ii - if (ip(i,j) == 0) then - atmco2_da(i,j,l2ci) = mval - elseif (cplmsk(i,j) == 0) then - atmco2_da(i,j,l2ci) = fval - else - n = (j - 1)*ii + i - ! Atmospheric co2 concentration [ppmv?] - atmco2_da(i,j,l2ci) = fldlist(index_Sa_co2diag)%dataptr(n) - endif + ! CO2 flux + + if (progco2) then + if (index_Sa_co2prog > 0) then + !$omp parallel do private(i, n) + do j = 1, jjcpl + do i = 1, ii + if (ip(i,j) == 0) then + atmco2_da(i,j,l2ci) = mval + elseif (cplmsk(i,j) == 0) then + atmco2_da(i,j,l2ci) = fval + else + n = (j - 1)*ii + i + ! Atmospheric co2 concentration [ppmv?] + atmco2_da(i,j,l2ci) = fldlist(index_Sa_co2prog)%dataptr(n) + endif + enddo enddo - enddo - !$omp end parallel do - call fill_global(mval, fval, halo_ps, atmco2_da(1-nbdy,1-nbdy,l2ci)) - if (mnproc == 1 .and. first_call) & - write(lp,*) subname//': diag. atmospheric co2 read' + !$omp end parallel do + call fill_global(mval, fval, halo_ps, atmco2_da(1-nbdy,1-nbdy,l2ci)) + if (mnproc == 1 .and. first_call) & + write(lp,*) subname//': prog. atmospheric co2 read' + else + !$omp parallel do private(i) + do j = 1, jj + do i = 1, ii + if (ip(i,j) == 0) then + atmco2_da(i,j,l2ci) = mval + else + atmco2_da(i,j,l2ci) = -1 + endif + enddo + enddo + !$omp end parallel do + if (mnproc == 1 .and. first_call) & + write(lp,*) subname//': prog. atmospheric co2 not read' + endif + + else if (diagco2) then + + if (index_Sa_co2diag > 0) then + !$omp parallel do private(i, n) + do j = 1, jjcpl + do i = 1, ii + if (ip(i,j) == 0) then + atmco2_da(i,j,l2ci) = mval + elseif (cplmsk(i,j) == 0) then + atmco2_da(i,j,l2ci) = fval + else + n = (j - 1)*ii + i + ! Atmospheric co2 concentration [ppmv?] + atmco2_da(i,j,l2ci) = fldlist(index_Sa_co2diag)%dataptr(n) + endif + enddo + enddo + !$omp end parallel do + call fill_global(mval, fval, halo_ps, atmco2_da(1-nbdy,1-nbdy,l2ci)) + if (mnproc == 1 .and. first_call) & + write(lp,*) subname//': diag. atmospheric co2 read' + else + !$omp parallel do private(i) + do j = 1, jj + do i = 1, ii + if (ip(i,j) == 0) then + atmco2_da(i,j,l2ci) = mval + else + atmco2_da(i,j,l2ci) = -1 + endif + enddo + enddo + !$omp end parallel do + if (mnproc == 1 .and. first_call) & + write(lp,*) subname//': diag. atmospheric co2 not read' + endif else - !$omp parallel do private(i) + !$omp parallel do private(i) do j = 1, jj do i = 1, ii if (ip(i,j) == 0) then @@ -929,25 +963,13 @@ subroutine blom_importflds(fldlist_num, fldlist) endif enddo enddo - !$omp end parallel do - if (mnproc == 1 .and. first_call) & - write(lp,*) subname//': diag. atmospheric co2 not read' - endif -#else - !$omp parallel do private(i) - do j = 1, jj - do i = 1, ii - if (ip(i,j) == 0) then - atmco2_da(i,j,l2ci) = mval - else - atmco2_da(i,j,l2ci) = -1 - endif - enddo - enddo - !$omp end parallel do - if (mnproc == 1 .and. first_call) & - write(lp,*) subname//': atmospheric co2 not read' -#endif + !$omp end parallel do + if (mnproc == 1 .and. first_call) then + write(lp,*) subname//': atmospheric co2 not read' + end if + end if + + ! DMS flux if (index_Faox_dms > 0) then if (associated(fldlist(index_Faox_dms)%dataptr)) then From e44a6f9479209b45facdeb6335fad5d17e700e2f Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Fri, 28 Jul 2023 13:15:32 +0200 Subject: [PATCH 31/52] bring back #BROMO ifdefs and also fix name of daily file --- cesm/mod_cesm.F90 | 15 ++- cime_config/buildcpp | 5 +- cime_config/buildnml | 18 ++-- cime_config/config_component.xml | 2 +- drivers/nuopc/mod_nuopc_methods.F90 | 157 +++++++++------------------- hamocc/accfields.F90 | 37 ++++--- hamocc/aufr_bgc.F90 | 12 ++- hamocc/aufw_bgc.F90 | 12 ++- hamocc/beleg_parm.F90 | 8 ++ hamocc/beleg_vars.F90 | 8 +- hamocc/carchm.F90 | 64 ++++++------ hamocc/hamocc4bcm.F90 | 20 ++-- hamocc/hamocc_init.F90 | 6 +- hamocc/inventory_bgc.F90 | 21 ++-- hamocc/mo_bgcmean.F90 | 13 ++- hamocc/mo_biomod.F90 | 32 +++--- hamocc/mo_carbch.F90 | 2 + hamocc/mo_control_bgc.F90 | 5 +- hamocc/mo_param1_bgc.F90 | 10 ++ hamocc/ncout_hamocc.F90 | 52 ++++----- hamocc/ocprod.F90 | 35 ++++--- meson.build | 3 + phy/mod_dia.F | 4 +- phy/restart_rd.F | 3 - phy/restart_wt.F | 18 +--- 25 files changed, 271 insertions(+), 291 deletions(-) diff --git a/cesm/mod_cesm.F90 b/cesm/mod_cesm.F90 index fc83bc7c..ac2955d7 100644 --- a/cesm/mod_cesm.F90 +++ b/cesm/mod_cesm.F90 @@ -35,7 +35,7 @@ module mod_cesm use mod_seaice, only: ficem use mod_checksum, only: csdiag, chksummsk #ifdef HAMOCC - use mo_control_bgc, only: do_bgc_aofluxes,do_bromo + use mo_control_bgc, only: do_bgc_aofluxes #endif implicit none @@ -90,6 +90,12 @@ module mod_cesm integer :: & l1ci, l2ci ! Time-level indices for time smoothing of CESM fields. +#ifdef BROMO + logical :: do_bromo = .true. +#else + logical :: do_bromo = .false. +#endif + public :: runid_cesm, runtyp_cesm, ocn_cpl_dt_cesm, nstep_in_cpl, hmlt, & frzpot, mltpot, swa_da, nsf_da, hmlt_da, lip_da, sop_da, eva_da, & rnf_da, rfi_da, fmltfz_da, sfl_da, ztx_da, mty_da, ustarw_da, & @@ -197,9 +203,10 @@ subroutine getfrc_cesm #ifdef HAMOCC if (.not. do_bgc_aofluxes) then ! flxdms is obtained from the mediator - flxdms(i, j) = w1*flxdms_da(i, j, l1ci) + w2*flxdms_da(i, j, l2ci) + flxdms(i, j) = w1*flxdms_da(i, j, l1ci) + w2*flxdms_da(i, j, l2ci) if (do_bromo) then - flxbrf(i, j) = w1*flxbrf_da(i, j, l1ci) + w2*flxbrf_da(i, j, l2ci) + ! flxbrf is obtained from the mediator + flxbrf(i, j) = w1*flxbrf_da(i, j, l1ci) + w2*flxbrf_da(i, j, l2ci) end if end if #endif @@ -222,7 +229,7 @@ subroutine getfrc_cesm call ncfopn('getfrc_cesm.nc', 'w', 'c', 1, iotype) call ncdims('x', itdm) call ncdims('y', jtdm) - call ncdefvar('ustarw_da', 'x y', ndouble, 8) + call ncdefvar('ustarw_da', 'x y', ndouble, 8) call ncdefvar('lip_da', 'x y', ndouble, 8) call ncdefvar('sop_da', 'x y', ndouble, 8) call ncdefvar('eva_da', 'x y', ndouble, 8) diff --git a/cime_config/buildcpp b/cime_config/buildcpp index dc6cd8e8..d1c46180 100644 --- a/cime_config/buildcpp +++ b/cime_config/buildcpp @@ -141,7 +141,8 @@ def buildcpp(case): if hamocc_sedbypass: blom_cppdefs = blom_cppdefs + " -Dsedbypass" if hamocc_ciso: - expect(hamocc_sedbypass, "HAMOCC C-isotopes currently not supported in the sediment module. Use HAMOCC_SEDBYPASS=TRUE") + expect(hamocc_sedbypass, + "HAMOCC C-isotopes currently not supported in the sediment module. Use HAMOCC_SEDBYPASS=TRUE") blom_cppdefs = blom_cppdefs + " -Dcisonew" if hamocc_vsls: blom_cppdefs = blom_cppdefs + " -DBROMO" @@ -162,7 +163,7 @@ def buildcpp(case): blom_cppdefs = "-DMPI" + blom_cppdefs # update the xml variable BLOM_CPPDEFS with the above definition - #case.set_value("BLOM_CPPDEFS", blom_cppdefs) + # case.set_value("BLOM_CPPDEFS", blom_cppdefs) return blom_cppdefs diff --git a/cime_config/buildnml b/cime_config/buildnml index caf1f533..fbe8b022 100755 --- a/cime_config/buildnml +++ b/cime_config/buildnml @@ -564,11 +564,11 @@ set SRF_CO2FXU = '4, 2, 2' set SRF_OXFLUX = '0, 2, 2' set SRF_NIFLUX = '0, 2, 2' set SRF_N2OFX = '0, 0, 2' -set SRF_DMSFLUX = '0, 2, 2' -set SRF_DMS = '0, 2, 2' -set SRF_DMSPROD = '0, 2, 2' -set SRF_DMS_BAC = '0, 2, 2' -set SRF_DMS_UV = '0, 2, 2' +set SRF_DMSFLUX = '2, 2, 2' +set SRF_DMS = '2, 2, 2' +set SRF_DMSPROD = '2, 2, 2' +set SRF_DMS_BAC = '2, 2, 2' +set SRF_DMS_UV = '2, 2, 2' set SRF_ATMCO2 = '0, 2, 2' set SRF_ATMO2 = '0, 2, 2' set SRF_ATMN2 = '0, 2, 2' @@ -584,10 +584,10 @@ set SRF_CO214FXU = '0, 2, 2' set SRF_CFC11 = '0, 2, 2' set SRF_CFC12 = '0, 2, 2' set SRF_SF6 = '0, 2, 2' -set SRF_BROMO = '0, 2, 2' -set SRF_BROMOFX = '0, 2, 2' -set INT_BROMOPRO = '0, 2, 2' -set INT_BROMOUV = '0, 2, 2' +set SRF_BROMO = '4, 2, 2' +set SRF_BROMOFX = '4, 2, 2' +set INT_BROMOPRO = '2, 2, 2' +set INT_BROMOUV = '2, 2, 2' set INT_PHOSY = '4, 2, 2' set INT_NFIX = '0, 2, 2' set INT_DNIT = '0, 2, 2' diff --git a/cime_config/config_component.xml b/cime_config/config_component.xml index 8ed52757..a38225a8 100644 --- a/cime_config/config_component.xml +++ b/cime_config/config_component.xml @@ -211,7 +211,7 @@ TRUE,FALSE FALSE - TRUE + TRUE build_component_blom env_build.xml diff --git a/drivers/nuopc/mod_nuopc_methods.F90 b/drivers/nuopc/mod_nuopc_methods.F90 index 17314dc2..001d4852 100644 --- a/drivers/nuopc/mod_nuopc_methods.F90 +++ b/drivers/nuopc/mod_nuopc_methods.F90 @@ -124,6 +124,18 @@ module mod_nuopc_methods index_Fioo_q = - 1, & index_Faoo_fco2_ocn = - 1 + + ! Set logicals for CPP variables +#ifdef HAMOCC + ! Set the logical flag do_bgc_aofluxes to true in mo_control_bgc + logical :: do_bgc_aofluxes = .false. + !logical :: do_bgc_aofluxes = .true. !DEBUG +#endif +#ifdef BROMO + logical :: do_bromo = .true. +#else + logical :: do_bromo = .false. +#endif #ifdef PROGCO2 logical :: progco2 = .true. #else @@ -165,7 +177,7 @@ subroutine fldlist_add(num, fldlist, stdname, index, ungridded_lbound, ungridded write(lp,'(a,3i6,2(f21.13,3x),d21.5)') subname// & ': BLOM ERROR: number of fields exceeds fldsMax for '//trim(stdname) call xchalt(subname) - stop subname + stop subname endif fldlist(num)%stdname = trim(stdname) @@ -178,31 +190,6 @@ subroutine fldlist_add(num, fldlist, stdname, index, ungridded_lbound, ungridded end subroutine fldlist_add - subroutine getfldindex(fldlist_num, fldlist, stdname, fldindex) - ! --------------------------------------------------------------------------- - ! Get index of field with given standard name. If no field has a matching - ! name or a field with matching name has an unassociated data pointer, set - ! index to zero. - ! --------------------------------------------------------------------------- - - ! Input/output arguments. - integer, intent(in) :: fldlist_num - type(fldlist_type), dimension(:), intent(in) :: fldlist - character(len=*), intent(in) :: stdname - integer, intent(inout) :: fldindex - - ! Local variables. - integer :: n - - do n = 1, fldlist_num - if (fldlist(n)%stdname == stdname) then - if (associated(fldlist(n)%dataptr)) fldindex = n - return - endif - enddo - - end subroutine getfldindex - ! --------------------------------------------------------------------------- ! Public procedures. ! --------------------------------------------------------------------------- @@ -222,11 +209,6 @@ subroutine blom_advertise_imports(flds_scalar_name, fldsToOcn_num, fldsToOcn, & integer :: index_scalar - ! Set the logical flag do_bgc_aofluxes to true in mo_control_bgc -#ifdef HAMOCC - do_bgc_aofluxes = .false. -#endif - call fldlist_add(fldsToOcn_num, fldsToOcn, trim(flds_scalar_name), index_scalar) ! From ice: @@ -242,7 +224,7 @@ subroutine blom_advertise_imports(flds_scalar_name, fldsToOcn_num, fldsToOcn, & call fldlist_add(fldsToOcn_num, fldsToOcn, 'Foxx_rofl', index_Foxx_rofl) call fldlist_add(fldsToOcn_num, fldsToOcn, 'Foxx_rofi', index_Foxx_rofi) - ! From mediator: + ! From fields computed mediator: call fldlist_add(fldsToOcn_num, fldsToOcn, 'So_duu10n' , index_So_duu10n) call fldlist_add(fldsToOcn_num, fldsToOcn, 'Foxx_tauy' , index_Foxx_tauy) call fldlist_add(fldsToOcn_num, fldsToOcn, 'Foxx_taux' , index_Foxx_taux) @@ -253,7 +235,9 @@ subroutine blom_advertise_imports(flds_scalar_name, fldsToOcn_num, fldsToOcn, & call fldlist_add(fldsToOcn_num, fldsToOcn, 'Foxx_swnet' , index_Foxx_swnet) if (.not. do_bgc_aofluxes) then call fldlist_add(fldsToOcn_num, fldsToOcn, 'Faox_dms', index_Faox_dms) - call fldlist_add(fldsToOcn_num, fldsToOcn, 'Faox_brf', index_Faox_brf) + if (do_bromo) then + call fldlist_add(fldsToOcn_num, fldsToOcn, 'Faox_brf', index_Faox_brf) + end if end if ! From wave: @@ -304,7 +288,9 @@ subroutine blom_advertise_exports(flds_scalar_name, fldsFrOcn_num, fldsFrOcn) call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'Faoo_fco2_ocn' , index_Faoo_fco2_ocn) if (.not. do_bgc_aofluxes) then call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'So_dms', index_So_dms) - call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'So_brf', index_So_brf) + if (do_bromo) then + call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'So_brf', index_So_brf) + end if end if end subroutine blom_advertise_exports @@ -651,6 +637,7 @@ subroutine blom_importflds(fldlist_num, fldlist) ! Local variables. real(r8) :: afac, utmp, vtmp integer :: n, i, j, l + integer :: index_co2 ! Update time level indices. if (l1ci == 1 .and. l2ci == 1) then @@ -880,78 +867,34 @@ subroutine blom_importflds(fldlist_num, fldlist) ! CO2 flux - if (progco2) then - if (index_Sa_co2prog > 0) then - !$omp parallel do private(i, n) - do j = 1, jjcpl - do i = 1, ii - if (ip(i,j) == 0) then - atmco2_da(i,j,l2ci) = mval - elseif (cplmsk(i,j) == 0) then - atmco2_da(i,j,l2ci) = fval - else - n = (j - 1)*ii + i - ! Atmospheric co2 concentration [ppmv?] - atmco2_da(i,j,l2ci) = fldlist(index_Sa_co2prog)%dataptr(n) - endif - enddo - enddo - !$omp end parallel do - call fill_global(mval, fval, halo_ps, atmco2_da(1-nbdy,1-nbdy,l2ci)) - if (mnproc == 1 .and. first_call) & - write(lp,*) subname//': prog. atmospheric co2 read' - else - !$omp parallel do private(i) - do j = 1, jj - do i = 1, ii - if (ip(i,j) == 0) then - atmco2_da(i,j,l2ci) = mval - else - atmco2_da(i,j,l2ci) = -1 - endif - enddo - enddo - !$omp end parallel do - if (mnproc == 1 .and. first_call) & - write(lp,*) subname//': prog. atmospheric co2 not read' - endif - - else if (diagco2) then + if (diagco2 .and. index_Sa_co2diag > 0) then + index_co2 = index_Sa_co2diag + else if (progco2 .and. index_Sa_co2prog > 0) then + index_co2 = index_Sa_co2prog + else + index_co2 = -1 + end if - if (index_Sa_co2diag > 0) then - !$omp parallel do private(i, n) - do j = 1, jjcpl - do i = 1, ii - if (ip(i,j) == 0) then - atmco2_da(i,j,l2ci) = mval - elseif (cplmsk(i,j) == 0) then - atmco2_da(i,j,l2ci) = fval - else - n = (j - 1)*ii + i - ! Atmospheric co2 concentration [ppmv?] - atmco2_da(i,j,l2ci) = fldlist(index_Sa_co2diag)%dataptr(n) - endif - enddo - enddo - !$omp end parallel do - call fill_global(mval, fval, halo_ps, atmco2_da(1-nbdy,1-nbdy,l2ci)) - if (mnproc == 1 .and. first_call) & - write(lp,*) subname//': diag. atmospheric co2 read' - else - !$omp parallel do private(i) - do j = 1, jj - do i = 1, ii - if (ip(i,j) == 0) then - atmco2_da(i,j,l2ci) = mval - else - atmco2_da(i,j,l2ci) = -1 - endif - enddo + if (index_co2 > 0) then + !$omp parallel do private(i, n) + do j = 1, jjcpl + do i = 1, ii + if (ip(i,j) == 0) then + atmco2_da(i,j,l2ci) = mval + elseif (cplmsk(i,j) == 0) then + atmco2_da(i,j,l2ci) = fval + else + n = (j - 1)*ii + i + ! Atmospheric co2 concentration [ppmv?] + atmco2_da(i,j,l2ci) = fldlist(index_co2)%dataptr(n) + endif enddo - !$omp end parallel do - if (mnproc == 1 .and. first_call) & - write(lp,*) subname//': diag. atmospheric co2 not read' - endif + enddo + !$omp end parallel do + call fill_global(mval, fval, halo_ps, atmco2_da(1-nbdy,1-nbdy,l2ci)) + if (mnproc == 1 .and. first_call) then + write(lp,*) subname//': atmospheric co2 obtained from mediator' + end if else !$omp parallel do private(i) do j = 1, jj @@ -964,9 +907,9 @@ subroutine blom_importflds(fldlist_num, fldlist) enddo enddo !$omp end parallel do - if (mnproc == 1 .and. first_call) then - write(lp,*) subname//': atmospheric co2 not read' - end if + if (mnproc == 1 .and. first_call) then + write(lp,*) subname//': atmospheric co2 not obtained from mediator' + endif end if ! DMS flux diff --git a/hamocc/accfields.F90 b/hamocc/accfields.F90 index 1f3be3ae..3edce9a7 100644 --- a/hamocc/accfields.F90 +++ b/hamocc/accfields.F90 @@ -68,19 +68,21 @@ SUBROUTINE ACCFIELDS(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask) & jco2kh,jph,jphosph,jphosy,jphyto,jpoc,jprefalk,jprefdic,jprefo2,jprefpo4,jsilica,jsrfalkali, & & jsrfano3,jsrfdic,jsrfiron,jsrfoxygen,jsrfphosph,jsrfphyto,jsrfsilica,jsrfph,jwnos,jwphy,jndepfx, & & joalkfx,nbgc,nacc_bgc,bgcwrt,glb_inventory,bgct2d,acclvl,acclyr,accsrf,bgczlv - use mo_control_bgc, only: io_stdo_bgc,do_bromo + 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, & - & irdin,irdip,irsi,iralk,iriron,irdoc,irdet + & irdin,irdip,irsi,iralk,iriron,irdoc,irdet #ifdef AGG use mo_biomod, only: asize3d,eps3d,wnumb,wmass use mo_param1_bgc, only: inos use mo_control_bgc, only: dtb #endif +#ifdef BROMO use mo_param1_bgc, only: iatmbromo,ibromo use mo_biomod, only: int_chbr3_prod,int_chbr3_uv use mo_bgcmean, only: jatmbromo,jbromo,jbromo_prod,jbromo_uv,jbromofx,jsrfbromo +#endif #ifdef CFC use mo_param1_bgc, only: iatmf11,iatmf12,iatmsf6,icfc11,icfc12,isf6 use mo_bgcmean, only: jcfc11,jcfc11fx,jcfc12,jcfc12fx,jsf6,jsf6fx @@ -206,10 +208,10 @@ SUBROUTINE ACCFIELDS(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask) #ifdef natDIC call accsrf(jnatco2fx,atmflx(1,1,iatmnco2),omask,0) #endif - if (do_bromo) then - call accsrf(jatmbromo,atm(1,1,iatmbromo),omask,0) - call accsrf(jbromofx,atmflx(1,1,iatmbromo),omask,0) - endif +#ifdef BROMO + call accsrf(jatmbromo,atm(1,1,iatmbromo),omask,0) + call accsrf(jbromofx,atmflx(1,1,iatmbromo),omask,0) +#endif #ifdef cisonew call accsrf(jatmc13,atm(1,1,iatmc13),omask,0) call accsrf(jatmc14,atm(1,1,iatmc14),omask,0) @@ -257,11 +259,11 @@ SUBROUTINE ACCFIELDS(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask) call accsrf(jnatpco2,natpco2d,omask,0) call accsrf(jsrfnatph,nathi(1,1,1),omask,0) #endif - if (do_bromo) then - call accsrf(jsrfbromo,ocetra(1,1,1,ibromo),omask,0) - call accsrf(jbromo_prod,int_chbr3_prod,omask,0) - call accsrf(jbromo_uv,int_chbr3_uv,omask,0) - end if +#ifdef BROMO + call accsrf(jsrfbromo,ocetra(1,1,1,ibromo),omask,0) + call accsrf(jbromo_prod,int_chbr3_prod,omask,0) + call accsrf(jbromo_uv,int_chbr3_uv,omask,0) +#endif ! Accumulate fluxes due to N-deposition, ocean alkalinization call accsrf(jndepfx,ndepflx,omask,0) @@ -360,9 +362,10 @@ SUBROUTINE ACCFIELDS(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask) call acclyr(jcfc12,ocetra(1,1,1,icfc12),pddpo,1) call acclyr(jsf6,ocetra(1,1,1,isf6),pddpo,1) #endif - if (do_bromo) then - call acclyr(jbromo,ocetra(1,1,1,ibromo),pddpo,1) - end if +#ifdef BROMO + call acclyr(jbromo,ocetra(1,1,1,ibromo),pddpo,1) +#endif + ! Accumulate level diagnostics IF (SUM(jlvlphyto+jlvlgrazer+jlvlphosph+jlvloxygen+jlvliron+ & @@ -434,9 +437,9 @@ SUBROUTINE ACCFIELDS(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask) call acclvl(jlvlcfc12,ocetra(1,1,1,icfc12),k,ind1,ind2,wghts) call acclvl(jlvlsf6,ocetra(1,1,1,isf6),k,ind1,ind2,wghts) #endif - if (do_bromo) then - call acclvl(jlvlbromo,ocetra(1,1,1,ibromo),k,ind1,ind2,wghts) - end if +#ifdef BROMO + call acclvl(jlvlbromo,ocetra(1,1,1,ibromo),k,ind1,ind2,wghts) +#endif ENDDO ENDIF diff --git a/hamocc/aufr_bgc.F90 b/hamocc/aufr_bgc.F90 index 8fe4dd5b..842720ad 100644 --- a/hamocc/aufr_bgc.F90 +++ b/hamocc/aufr_bgc.F90 @@ -104,7 +104,7 @@ SUBROUTINE AUFR_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & use netcdf, only: nf90_global,nf90_noerr,nf90_nowrite,nf90_close,nf90_open,nf90_get_att,nf90_inq_varid use mo_carbch, only: co2star,co3,hi,satoxy - use mo_control_bgc, only: io_stdo_bgc,ldtbgc,do_bromo + use mo_control_bgc, only: io_stdo_bgc,ldtbgc use mo_param1_bgc, only: ialkali,ian2o,iano3,icalc,idet,idicsat,idms,idoc,ifdust,igasnit,iiron,iopal,ioxygen,iphosph,iphy,& & iprefalk,iprefdic,iprefo2,iprefpo4,isco212,isilica,izoo,nocetra use mo_vgrid, only: kbo @@ -119,7 +119,9 @@ SUBROUTINE AUFR_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & use mo_param1_bgc, only: iatmco2,iatmn2,iatmo2 use mo_carbch, only: atm #endif +#ifdef BROMO use mo_param1_bgc, only: ibromo +#endif #ifdef CFC use mo_param1_bgc, only: icfc11,icfc12,isf6 #endif @@ -339,7 +341,7 @@ SUBROUTINE AUFR_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & #endif ! Find out whether to restart Bromoform - if (do_bromo) then +#ifdef BROMO lread_bro=.true. IF(IOTYPE==0) THEN if(mnproc==1) ncstat=nf90_inq_varid(ncid,'bromo',ncvarid) @@ -356,7 +358,7 @@ SUBROUTINE AUFR_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & WRITE(io_stdo_bgc,*) 'AUFR_BGC info: Bromoform tracer not in restart file, ' WRITE(io_stdo_bgc,*) 'Initialised to 0.01 pmol L-1 (Stemmler et al., 2015).' ENDIF - endif +#endif ! Find out whether to restart atmosphere #if defined(BOXATM) @@ -444,11 +446,11 @@ SUBROUTINE AUFR_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & CALL read_netcdf_var(ncid,'hi',nathi(1,1,1),kpke,0,iotype) ENDIF #endif - if (do_bromo) then +#ifdef BROMO IF(lread_bro) THEN CALL read_netcdf_var(ncid,'bromo',locetra(1,1,1,ibromo),2*kpke,0,iotype) ENDIF - endif +#endif ! ! Read restart data : diagnostic ocean fields (needed for bit to bit reproducability) diff --git a/hamocc/aufw_bgc.F90 b/hamocc/aufw_bgc.F90 index 8fe5a281..90949313 100644 --- a/hamocc/aufw_bgc.F90 +++ b/hamocc/aufw_bgc.F90 @@ -99,7 +99,7 @@ SUBROUTINE AUFW_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & use netcdf, only: nf90_64bit_offset,nf90_global,nf90_noerr,nf90_nofill,nf90_def_dim,nf90_enddef,nf90_close, & & nf90_create,nf90_put_att,nf90_set_fill use mo_carbch, only: co2star,co3, hi,satoxy - use mo_control_bgc, only: io_stdo_bgc,ldtbgc,rmasko,do_bromo + use mo_control_bgc, only: io_stdo_bgc,ldtbgc,rmasko use mo_param1_bgc, only: ialkali, ian2o,iano3,icalc,idet,idicsat,idms,idoc,ifdust,igasnit,iiron,iopal,ioxygen,iphosph,iphy, & & iprefalk,iprefdic,iprefo2,iprefpo4,isco212,isilica,izoo,ks,nocetra use mo_sedmnt, only: sedhpl @@ -112,7 +112,9 @@ SUBROUTINE AUFW_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & #ifdef BOXATM use mo_param1_bgc, only: iatmco2,iatmn2,iatmo2 #endif +#ifdef BROMO use mo_param1_bgc, only: ibromo +#endif #ifdef CFC use mo_param1_bgc, only: icfc11,icfc12,isf6 #endif @@ -572,10 +574,10 @@ SUBROUTINE AUFW_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & & 6,'mol/kg',25,'Natural calcium carbonate', & & rmissing,52,io_stdo_bgc) #endif - if (do_bromo) then +#ifdef BROMO CALL NETCDF_DEF_VARDB(ncid,5,'bromo',3,ncdimst,ncvarid, & & 6,'mol/kg',9,'Bromoform',rmissing,47,io_stdo_bgc) - endif +#endif ! ! Define variables : diagnostic ocean fields @@ -856,9 +858,9 @@ SUBROUTINE AUFW_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & CALL write_netcdf_var(ncid,'natalkali',locetra(1,1,1,inatalkali),2*kpke,0) CALL write_netcdf_var(ncid,'natcalciu',locetra(1,1,1,inatcalc),2*kpke,0) #endif - if (do_bromo) then +#ifdef BROMO CALL write_netcdf_var(ncid,'bromo',locetra(1,1,1,ibromo),2*kpke,0) - endif +#endif ! ! Write restart data : diagtnostic ocean fields diff --git a/hamocc/beleg_parm.F90 b/hamocc/beleg_parm.F90 index 0c5a37f8..949abea9 100644 --- a/hamocc/beleg_parm.F90 +++ b/hamocc/beleg_parm.F90 @@ -57,8 +57,10 @@ SUBROUTINE BELEG_PARM(kpie,kpje) #elif defined(WLIN) use mo_biomod, only: wmin,wmax,wlin #endif +#ifdef BROMO use mo_biomod, only: rbro use mo_carbch, only: atm_bromo,fbro1,fbro2 +#endif #ifdef cisonew use mo_biomod, only: bifr13,bifr14,c14fac,prei13,prei14,re1312,re14to use mo_carbch, only: atm_c13, atm_c14,c14_t_half,c14dec @@ -91,9 +93,11 @@ SUBROUTINE BELEG_PARM(kpie,kpje) #ifdef natDIC atm_co2_nat = 284.32 ! CMIP6 pre-industrial reference #endif +#ifdef BROMO !For now use 3.4ppt from Hense and Quack (2009; Biogeosciences) NEED TO !BE UPDATED WITH Ziska et al. (2013) climatology database atm_bromo = 3.4 +#endif #ifdef cisonew ! set standard carbon isotope ratios @@ -131,7 +135,9 @@ SUBROUTINE BELEG_PARM(kpie,kpje) atm(i,j,iatmc13) = atm_c13 atm(i,j,iatmc14) = atm_c14/c14fac #endif +#ifdef BROMO atm(i,j,iatmbromo)= atm_bromo +#endif ENDDO ENDDO @@ -230,6 +236,7 @@ SUBROUTINE BELEG_PARM(kpie,kpje) rdn2o1=2*ro2ut-2.5*rnit ! moles N2O used for remineralisation of 1 mole P rdn2o2=2*ro2ut-2*rnit ! moles N2 released for remineralisation of 1 mole P +#ifdef BROMO !Bromoform to phosphate ratio (Hense and Quack, 2009) !JT: too little production: 0.25Gmol/yr rbro=6.72e-7*rnit ! rbro=2.*6.72e-7*rnit @@ -237,6 +244,7 @@ SUBROUTINE BELEG_PARM(kpie,kpje) rbro=2.4e-6*rnit fbro1=1.0 fbro2=1.0 +#endif #ifdef AGG rcalc = 14. ! calcium carbonate to organic phosphorous production ratio diff --git a/hamocc/beleg_vars.F90 b/hamocc/beleg_vars.F90 index b375d9d3..f7d68963 100644 --- a/hamocc/beleg_vars.F90 +++ b/hamocc/beleg_vars.F90 @@ -54,7 +54,7 @@ SUBROUTINE BELEG_VARS(kpaufr,kpie,kpje,kpke,kbnd,pddpo,prho,omask, & use mo_carbch, only: co2star,co3,hi,ocetra use mo_biomod, only: fesoly - use mo_control_bgc, only: rmasks,do_bromo + use mo_control_bgc, only: rmasks use mo_param1_bgc, only: ialkali,ian2o,iano3,icalc,idet,idicsat,idms,idoc,ifdust,igasnit,iiron,iopal,ioxygen,iphosph,iphy, & & iprefalk,iprefdic,iprefo2,iprefpo4,isco212,isilica,izoo use mo_vgrid, only: kmle,kbo @@ -63,7 +63,9 @@ SUBROUTINE BELEG_VARS(kpaufr,kpie,kpje,kpke,kbnd,pddpo,prho,omask, & use mo_biomod, only: cellmass,fractdim use mo_param1_bgc, only: iadust,inos #endif +#ifdef BROMO use mo_param1_bgc, only: ibromo +#endif #ifdef CFC use mo_param1_bgc, only: icfc11,icfc12,isf6 #endif @@ -207,10 +209,10 @@ SUBROUTINE BELEG_VARS(kpaufr,kpie,kpje,kpke,kbnd,pddpo,prho,omask, & ocetra(i,j,k,icalc13)=ocetra(i,j,k,icalc)*rco213 ocetra(i,j,k,icalc14)=ocetra(i,j,k,icalc)*rco214 #endif - if (do_bromo) then +#ifdef BROMO ! Initialise to 0,01 pmol L-1 (Stemmler et al., 2015) => mol/kg ocetra(i,j,k,ibromo)= 1.e-14/prho(i,j,k) - endif +#endif ENDIF ! omask > 0.5 ENDDO ENDDO diff --git a/hamocc/carchm.F90 b/hamocc/carchm.F90 index 8888365e..6fdcddd3 100644 --- a/hamocc/carchm.F90 +++ b/hamocc/carchm.F90 @@ -101,7 +101,7 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & 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,do_bgc_aofluxes,do_bromo + use mo_control_bgc, only: dtbgc,do_bgc_aofluxes use mo_param1_bgc, only: ialkali,iatmo2,iatmco2,iatmdms,iatmn2,iatmn2o,ian2o,icalc,idicsat,idms,igasnit,ioxygen,iphosph, & & isco212,isilica use mo_vgrid, only: dp_min,kmle,kbo,ptiestu @@ -306,11 +306,11 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & sch_12= 3828.1 - 249.86*t + 8.7603*t2 - 0.1716 *t3 + 0.001408 *t4 sch_sf= 3177.5 - 200.57*t + 6.8865*t2 - 0.13335 *t3 + 0.0010877 *t4 #endif +#ifdef BROMO ! Stemmler et al. (2015; Biogeosciences) Eq. (9); Quack and Wallace ! (2003; GBC) - if (do_bromo) then - sch_bromo= 4662.8 - 319.45*t + 9.9012*t2 - 0.1159*t3 - end if + sch_bromo= 4662.8 - 319.45*t + 9.9012*t2 - 0.1159*t3 +#endif ! solubility of N2 (Weiss, R.F. 1970, Deep-Sea Res., 17, 721-735) for moist air ! at 1 atm; multiplication with oxyco converts to kmol/m^3/atm @@ -339,10 +339,10 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & a_12 = 1e-12 * a_12 a_sf = 1e-12 * a_sf #endif +#ifdef BROMO !Henry's law constant [dimensionless] for Bromoform from Quack and Wallace (2003; GBC) - if (do_bromo) then - a_bromo = exp(13.16 - 4973*(1/tk)) - end if + a_bromo = exp(13.16 - 4973*(1/tk)) +#endif ! Transfer (piston) velocity kw according to Wanninkhof (2014), in units of ms-1 Xconvxa = 6.97e-07 ! Wanninkhof's a=0.251 converted from [cm hr-1]/[m s-1]^2 to [ms-1]/[m s-1]^2 @@ -356,12 +356,12 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & kw_12 = (1.-psicomo(i,j)) * Xconvxa * pfu10(i,j)**2*(660./sch_12)**0.5 kw_sf = (1.-psicomo(i,j)) * Xconvxa * pfu10(i,j)**2*(660./sch_sf)**0.5 #endif +#ifdef BROMO ! Stemmler et al. (2015; Biogeosciences) Eq. (8) ! 1.e-2/3600 = conversion from [cm hr-1]/[m s-1]^2 to [ms-1]/[m s-1]^2 - if (do_bromo) then - kw_bromo=(1.-psicomo(i,j)) * 1.e-2/3600. * & - & (0.222*pfu10(i,j)**2+0.33*pfu10(i,j))*(660./sch_bromo)**0.5 - end if + kw_bromo=(1.-psicomo(i,j)) * 1.e-2/3600. * & + & (0.222*pfu10(i,j)**2+0.33*pfu10(i,j))*(660./sch_bromo)**0.5 +#endif atco2 = atm(i,j,iatmco2) ato2 = atm(i,j,iatmo2) @@ -370,9 +370,9 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & atco213 = atm(i,j,iatmc13) atco214 = atm(i,j,iatmc14) #endif - if (do_bromo) then - atbrf = atm(i,j,iatmbromo) - end if +#ifdef BROMO + atbrf = atm(i,j,iatmbromo) +#endif ! Ratio P/P_0, where P is the local SLP and P_0 is standard pressure (1 atm). This is ! used in all surface flux calculations where atmospheric concentration is given as a @@ -481,6 +481,7 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & ocetra(i,j,1,idms) = ocetra(i,j,1,idms) - dmsflux/pddpo(i,j,1) atmflx(i,j,iatmdms) = dmsflux ! positive to atmosphere [kmol dms m-2 timestep-1] +#ifdef BROMO ! Quack and Wallace (2003) eq. 1 ! flux = kw*(Cw - Ca/H) ; kw[m s-1]; Cw[kmol m-3]; ! Convert Ca(atbrf) from @@ -488,20 +489,19 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & ! [ppp] to [mol L-1] by multiplying with pressure[bar]/(SST[K]*R[L bar K-1 mol-1]); R=0,083 ! [mol L-1] to [kmol m-3] by multiplying with 1 - if (do_bromo) then - if (do_bgc_aofluxes) then - flx_bromo = kw_bromo*dtbgc* & - (atbrf/a_bromo*1e-12*ppao(i,j)*1e-5/(tk*0.083) - ocetra(i,j,1,ibromo)) - else - ! Note that the external computation of fluxes is -flx_bromo/dtbgc - ! using above computation of flx_bromo - ! So need to divide by 252.7 and multiply by -dtbgc and in order to use this - ! for the tendency in the tracer update - flx_bromo = dtbgc*pflxbromo(i,j) - end if - ocetra(i,j,1,ibromo) = ocetra(i,j,1,ibromo) + flx_bromo/pddpo(i,j,1) - atmflx(i,j,iatmbromo) = -flx_bromo + if (do_bgc_aofluxes) then + flx_bromo = kw_bromo*dtbgc* & + (atbrf/a_bromo*1e-12*ppao(i,j)*1e-5/(tk*0.083) - ocetra(i,j,1,ibromo)) + else + ! Note that the external computation of fluxes is -flx_bromo/dtbgc + ! using above computation of flx_bromo + ! So need to divide by 252.7 and multiply by -dtbgc and in order to use this + ! for the tendency in the tracer update + flx_bromo = dtbgc*pflxbromo(i,j) end if + ocetra(i,j,1,ibromo) = ocetra(i,j,1,ibromo) + flx_bromo/pddpo(i,j,1) + atmflx(i,j,iatmbromo) = -flx_bromo +#endif ! Save surface fluxes atmflx(i,j,iatmco2)=fluxu-fluxd @@ -547,17 +547,15 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & endif ! k==1 +#ifdef BROMO ! Degradation to hydrolysis (Eq. 2-4 of Stemmler et al., 2015) ! A1=1.23e17 mol min-1 => 2.05e12 kmol sec-1 - if (do_bromo) then - Kb1=2.05e12*exp(-1.073e5/(8.314*tk))*dtbgc - ocetra(i,j,k,ibromo)=ocetra(i,j,k,ibromo)*(1.-(Kb1*Kw/ah1)) - end if - + Kb1=2.05e12*exp(-1.073e5/(8.314*tk))*dtbgc + ocetra(i,j,k,ibromo)=ocetra(i,j,k,ibromo)*(1.-(Kb1*Kw/ah1)) ! Degradation to halogen substitution (Eq. 5-6 of Stemmler et al., 2015) lsub=7.33e-10*exp(1.250713e4*(1/298.-1/tk))*dtbgc ocetra(i,j,k,ibromo)=ocetra(i,j,k,ibromo)*(1.-lsub) - +#endif ! ----------------------------------------------------------------- ! Deep ocean processes diff --git a/hamocc/hamocc4bcm.F90 b/hamocc/hamocc4bcm.F90 index c37bdeb8..e4d2760a 100644 --- a/hamocc/hamocc4bcm.F90 +++ b/hamocc/hamocc4bcm.F90 @@ -86,8 +86,7 @@ SUBROUTINE HAMOCC4BCM(kpie,kpje,kpke,kbnd,kplyear,kplmon,kplday,kldtday,& use mo_carbch, only: atmflx,ocetra,atm 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, & - do_bromo + do_sedspinup,sedspin_yr_s,sedspin_yr_e,sedspin_ncyc use mo_param1_bgc, only: iatmco2,iatmdms,nocetra,nriv use mo_vgrid, only: set_vgrid use mo_apply_fedep, only: apply_fedep @@ -97,7 +96,9 @@ SUBROUTINE HAMOCC4BCM(kpie,kpje,kpke,kbnd,kplyear,kplmon,kplday,kldtday,& #if defined(BOXATM) use mo_boxatm, only: update_boxatm #endif +#ifdef BROMO use mo_param1_bgc, only: iatmbromo +#endif #ifdef CFC use mo_carbch, only: atm_cfc11_nh,atm_cfc11_sh,atm_cfc12_nh,atm_cfc12_sh,atm_sf6_nh,atm_sf6_sh #endif @@ -185,7 +186,7 @@ SUBROUTINE HAMOCC4BCM(kpie,kpje,kpke,kbnd,kplyear,kplmon,kplday,kldtday,& !if (mnproc.eq.1) write (io_stdo_bgc,*) 'iHAMOCC: getting co2 from atm' #endif - if (do_bromo) then +#ifdef BROMO !$OMP PARALLEL DO PRIVATE(i) DO j=1,kpje DO i=1,kpie @@ -197,6 +198,7 @@ SUBROUTINE HAMOCC4BCM(kpie,kpje,kpke,kbnd,kplyear,kplmon,kplday,kldtday,& !$OMP END PARALLEL DO if (mnproc.eq.1) write (io_stdo_bgc,*) 'iHAMOCC: getting bromoform from atm' endif +#endif !-------------------------------------------------------------------- ! Read atmospheric cfc concentrations @@ -421,13 +423,11 @@ SUBROUTINE HAMOCC4BCM(kpie,kpje,kpke,kbnd,kplyear,kplmon,kplday,kldtday,& !$OMP PARALLEL DO PRIVATE(i) DO j=1,kpje DO i=1,kpie - if(omask(i,j) .gt. 0.5) then - if (do_bromo) then - pflxbromo(i,j)=-252.7*atmflx(i,j,iatmbromo)/dtbgc - else - pflxbromo(i,j)=0.0 - end if - endif +#ifdef BROMO + if(omask(i,j) .gt. 0.5) pflxbromo(i,j)=-252.7*atmflx(i,j,iatmbromo)/dtbgc +#else + if(omask(i,j) .gt. 0.5) pflxbromo(i,j)=0.0 +#endif ENDDO ENDDO !$OMP END PARALLEL DO diff --git a/hamocc/hamocc_init.F90 b/hamocc/hamocc_init.F90 index 4d06749d..110563c0 100644 --- a/hamocc/hamocc_init.F90 +++ b/hamocc/hamocc_init.F90 @@ -46,7 +46,7 @@ subroutine hamocc_init(read_rest,rstfnm_hamocc) & 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,do_bromo + & ldtrunbgc,ndtdaybgc,with_dmsph,l_3Dvarsedpor use mo_param1_bgc, only: ks,init_por2octra_mapping use mo_carbch, only: alloc_mem_carbch,ocetra,atm,atm_co2 use mo_biomod, only: alloc_mem_biomod @@ -196,9 +196,9 @@ subroutine hamocc_init(read_rest,rstfnm_hamocc) CALL ini_read_oafx(idm,jdm,bgc_dx,bgc_dy,plat,omask) - if (do_bromo) then +#ifdef BROMO CALL ini_swa_clim(idm,jdm,omask) - endif +#endif call ini_pi_ph(idm,jdm,omask) ! diff --git a/hamocc/inventory_bgc.F90 b/hamocc/inventory_bgc.F90 index 8541e4e9..c9f104f5 100644 --- a/hamocc/inventory_bgc.F90 +++ b/hamocc/inventory_bgc.F90 @@ -56,15 +56,15 @@ SUBROUTINE INVENTORY_BGC(kpie,kpje,kpke,dlxp,dlyp,ddpo,omask,iogrp) 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,do_bromo + 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, & & irdin,irdip,irsi,iralk,irdoc,irdet,nocetra,npowtra,nsedtra,nriv use mo_vgrid, only: dp_min +# ifndef sedbypass use mo_param1_bgc, only: ks -#ifndef sedbypass use mo_sedmnt, only: porwat,seddw,sedlay,burial,sedhpl,powtra,porsol #endif @@ -662,7 +662,9 @@ subroutine write_netcdf(iogrp) #ifdef AGG use mo_param1_bgc, only: iadust,inos #endif +#ifdef BROMO use mo_param1_bgc, only: ibromo +#endif #ifdef CFC use mo_param1_bgc, only: icfc11,icfc12,isf6 #endif @@ -770,7 +772,9 @@ subroutine write_netcdf(iogrp) integer :: zt_natalkali_varid, zc_natalkali_varid ! Natural alkalinity integer :: zt_natcalciu_varid, zc_natcalciu_varid ! Natural calcium carbonate #endif +#ifdef BROMO integer :: zt_bromo_varid, zc_bromo_varid ! Bromoform +#endif !--- sum of inventory integer :: totcarb_varid, totphos_varid, totsili_varid, totnitr_varid integer :: totoxyg_varid @@ -1396,7 +1400,7 @@ subroutine write_netcdf(iogrp) & 'kmol/m^3') ) #endif - if (do_bromo) then +#ifdef BROMO call nccheck( NF90_DEF_VAR(ncid, 'zt_bromo', NF90_DOUBLE, & & time_dimid, zt_bromo_varid) ) call nccheck( NF90_PUT_ATT(ncid, zt_bromo_varid, 'long_name', & @@ -1408,7 +1412,7 @@ subroutine write_netcdf(iogrp) call nccheck( NF90_PUT_ATT(ncid, zc_bromo_varid, 'long_name', & & 'Mean bromoform concentration') ) call nccheck( NF90_PUT_ATT(ncid, zc_bromo_varid, 'units', 'kmol/m^3') ) - end if +#endif !--- Define variables : sum of inventory call nccheck( NF90_DEF_VAR(ncid, 'totcarb', NF90_DOUBLE, time_dimid, & @@ -1598,11 +1602,10 @@ subroutine write_netcdf(iogrp) call nccheck( NF90_INQ_VARID(ncid, "zt_natcalciu", zt_natcalciu_varid) ) call nccheck( NF90_INQ_VARID(ncid, "zc_natcalciu", zc_natcalciu_varid) ) #endif - if (do_bromo) then +#ifdef BROMO call nccheck( NF90_INQ_VARID(ncid, "zt_bromo", zt_bromo_varid) ) call nccheck( NF90_INQ_VARID(ncid, "zc_bromo", zc_bromo_varid) ) - end if - +#endif !--- Inquire varid : sum of inventory call nccheck( NF90_INQ_VARID(ncid, "totcarb", totcarb_varid) ) call nccheck( NF90_INQ_VARID(ncid, "totphos", totphos_varid) ) @@ -1826,12 +1829,12 @@ subroutine write_netcdf(iogrp) call nccheck( NF90_PUT_VAR(ncid, zc_natcalciu_varid, & & zocetratoc(inatcalc), start = wrstart) ) #endif - if (do_bromo) then +#ifdef BROMO call nccheck( NF90_PUT_VAR(ncid, zt_bromo_varid, & & zocetratot(ibromo), start = wrstart) ) call nccheck( NF90_PUT_VAR(ncid, zc_bromo_varid, & & zocetratoc(ibromo), start = wrstart) ) - endif +#endif !--- Write data : sum of inventory call nccheck( NF90_PUT_VAR(ncid, totcarb_varid, totalcarbon, & & start = wrstart) ) diff --git a/hamocc/mo_bgcmean.F90 b/hamocc/mo_bgcmean.F90 index 0601cf7a..08cc202f 100644 --- a/hamocc/mo_bgcmean.F90 +++ b/hamocc/mo_bgcmean.F90 @@ -58,7 +58,6 @@ MODULE mo_bgcmean use mod_nctools, only: ncpack,nccomp,nccopa,ncwrtr use netcdf, only: nf90_fill_double use mo_param1_bgc, only: ks - use mo_control_bgc, only: do_bromo IMPLICIT NONE @@ -723,7 +722,7 @@ SUBROUTINE ALLOC_MEM_BGCMEAN(kpie,kpje,kpke) IF (SRF_NATPH(n).GT.0) i_bsc_m2d=i_bsc_m2d+1 jsrfnatph(n)=i_bsc_m2d*min(1,SRF_NATPH(n)) #endif - if (do_bromo) then +#ifdef BROMO IF (SRF_BROMO(n).GT.0) i_bsc_m2d=i_bsc_m2d+1 jsrfbromo(n)=i_bsc_m2d*min(1,SRF_BROMO(n)) IF (SRF_BROMOFX(n).GT.0) i_bsc_m2d=i_bsc_m2d+1 @@ -732,7 +731,7 @@ SUBROUTINE ALLOC_MEM_BGCMEAN(kpie,kpje,kpke) jbromo_prod(n)=i_bsc_m2d*min(1,INT_BROMOPRO(n)) IF (INT_BROMOUV(n).GT.0) i_bsc_m2d=i_bsc_m2d+1 jbromo_uv(n)=i_bsc_m2d*min(1,INT_BROMOUV(n)) - end if +#endif ENDDO domassfluxes = any( & @@ -881,10 +880,10 @@ SUBROUTINE ALLOC_MEM_BGCMEAN(kpie,kpje,kpke) IF (LYR_NATOMEGAC(n).GT.0) i_bsc_m3d=i_bsc_m3d+1 jnatomegac(n)=i_bsc_m3d*min(1,LYR_NATOMEGAC(n)) #endif - if (do_bromo) then +#ifdef BROMO IF (LYR_BROMO(n).GT.0) i_bsc_m3d=i_bsc_m3d+1 jbromo(n)=i_bsc_m3d*min(1,LYR_BROMO(n)) - end if +#endif IF (LVL_PHYTO(n).GT.0) ilvl_bsc_m3d=ilvl_bsc_m3d+1 jlvlphyto(n)=ilvl_bsc_m3d*min(1,LVL_PHYTO(n)) @@ -994,10 +993,10 @@ SUBROUTINE ALLOC_MEM_BGCMEAN(kpie,kpje,kpke) IF (LVL_NATOMEGAC(n).GT.0) ilvl_bsc_m3d=ilvl_bsc_m3d+1 jlvlnatomegac(n)=ilvl_bsc_m3d*min(1,LVL_NATOMEGAC(n)) #endif - if (do_bromo) then +#ifdef BROMO IF (LVL_BROMO(n).GT.0) ilvl_bsc_m3d=ilvl_bsc_m3d+1 jlvlbromo(n)=ilvl_bsc_m3d*min(1,LVL_BROMO(n)) - end if +#endif IF (i_bsc_m3d.NE.0) checkdp(n)=1 ENDDO diff --git a/hamocc/mo_biomod.F90 b/hamocc/mo_biomod.F90 index 9990c56c..0703211d 100644 --- a/hamocc/mo_biomod.F90 +++ b/hamocc/mo_biomod.F90 @@ -88,8 +88,10 @@ MODULE mo_biomod REAL, DIMENSION (:,:,:), ALLOCATABLE :: eps3d REAL, DIMENSION (:,:,:), ALLOCATABLE :: asize3d #endif +#ifdef BROMO REAL, DIMENSION (:,:), ALLOCATABLE :: int_chbr3_prod REAL, DIMENSION (:,:), ALLOCATABLE :: int_chbr3_uv +#endif REAL :: phytomi,grami,grazra,pi_alpha REAL :: remido,dyphy,zinges,epsher,spemor,gammap,gammaz,ecan @@ -113,7 +115,9 @@ MODULE mo_biomod #elif defined(WLIN) REAL :: wmin,wmax,wlin #endif +#ifdef BROMO REAL :: rbro +#endif CONTAINS @@ -123,7 +127,7 @@ 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,do_bromo + use mo_control_bgc, only: io_stdo_bgc INTEGER, intent(in) :: kpie,kpje,kpke INTEGER :: errstat @@ -367,19 +371,19 @@ SUBROUTINE ALLOC_MEM_BIOMOD(kpie,kpje,kpke) asize3d(:,:,:) = 0.0 #endif - if (do_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 - end if +#ifdef BROMO + 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 !****************************************************************************** END SUBROUTINE ALLOC_MEM_BIOMOD diff --git a/hamocc/mo_carbch.F90 b/hamocc/mo_carbch.F90 index 55e2fb04..b2e7f0a8 100644 --- a/hamocc/mo_carbch.F90 +++ b/hamocc/mo_carbch.F90 @@ -107,7 +107,9 @@ MODULE mo_carbch REAL :: atm_cfc12_nh,atm_cfc12_sh REAL :: atm_sf6_nh,atm_sf6_sh #endif +#ifdef BROMO REAL :: atm_bromo, fbro1, fbro2 +#endif CONTAINS diff --git a/hamocc/mo_control_bgc.F90 b/hamocc/mo_control_bgc.F90 index 32dad8f9..f15b6b45 100644 --- a/hamocc/mo_control_bgc.F90 +++ b/hamocc/mo_control_bgc.F90 @@ -66,10 +66,7 @@ MODULE mo_control_bgc LOGICAL, save :: do_oalk =.false. ! apply ocean alkalinization logical, save :: with_dmsph =.false. ! apply DMS with pH dependence - logical, save :: do_bgc_aofluxes = .true. ! If true, atm/ocn bgc fluxes are computed within HAMOCC -#ifdef BROMO - logical, save :: do_bromo = .true. -#endif + logical, save :: do_bgc_aofluxes = .true. ! If true, atm/ocn bgc fluxes are computed within HAMOCC contains diff --git a/hamocc/mo_param1_bgc.F90 b/hamocc/mo_param1_bgc.F90 index 301c0138..f18df794 100644 --- a/hamocc/mo_param1_bgc.F90 +++ b/hamocc/mo_param1_bgc.F90 @@ -128,8 +128,13 @@ MODULE mo_param1_bgc & inatalkali = -1, & & inatcalc = -1 #endif +#ifdef BROMO INTEGER, PARAMETER :: i_bromo=1, & & ibromo=i_base+i_iso+i_cfc+i_agg+i_nat_dic+1 +#else + INTEGER, PARAMETER :: i_bromo=0, & + & ibromo=-1 +#endif ! total number of advected tracers INTEGER, PARAMETER :: nocetra=i_base+i_iso+i_cfc+i_agg+i_nat_dic & @@ -173,9 +178,14 @@ MODULE mo_param1_bgc INTEGER, PARAMETER :: i_ndic_atm = 0, & & iatmnco2 = -1 #endif +#ifdef BROMO INTEGER, PARAMETER :: i_bromo_atm=1, & & iatmbromo=i_base_atm+i_iso_atm+i_cfc_atm+ & & i_ndic_atm+1 +#else + INTEGER, PARAMETER :: i_bromo_atm=0, & + & iatmbromo=-1 +#endif ! total number of atmosphere tracers INTEGER, PARAMETER :: natm=i_base_atm+i_iso_atm+i_cfc_atm+i_ndic_atm+i_bromo_atm diff --git a/hamocc/ncout_hamocc.F90 b/hamocc/ncout_hamocc.F90 index a6b3a311..7d29652e 100644 --- a/hamocc/ncout_hamocc.F90 +++ b/hamocc/ncout_hamocc.F90 @@ -29,7 +29,7 @@ subroutine ncwrt_bgc(iogrp) use mod_grid, only: depths use mod_dia, only: diafnm,sigmar1,iotype,ddm,depthslev, & & depthslev_bnds - use mo_control_bgc, only: dtbgc,do_bromo + use mo_control_bgc, only: dtbgc use mo_vgrid, only: k0100,k0500,k1000,k2000,k4000 use mo_param1_bgc, only: ks use mod_nctools, only: ncwrt1,ncdims,nctime,ncfcls,ncfopn, & @@ -115,10 +115,12 @@ subroutine ncwrt_bgc(iogrp) & lyr_asize,lvl_nos,lvl_wphy,lvl_wnos,lvl_eps, & & lvl_asize #endif +#ifdef BROMO use mo_bgcmean, only: jbromo,jbromofx,jsrfbromo,jbromo_prod, & & jbromo_uv,jatmbromo,lvl_bromo,srf_bromofx, & & srf_bromo,int_bromopro,int_bromouv, & & srf_atmbromo,lyr_bromo +#endif #ifdef CFC use mo_bgcmean,only: jcfc11,jcfc12,jsf6,jcfc11fx,jcfc12fx,jsf6fx, & & lvl_cfc11,lvl_cfc12,lvl_sf6,srf_cfc11, & @@ -298,9 +300,9 @@ subroutine ncwrt_bgc(iogrp) call finlyr(jnatomegaa(iogrp),jdp(iogrp)) call finlyr(jnatomegac(iogrp),jdp(iogrp)) #endif - if (do_bromo) then +#ifdef BROMO call finlyr(jbromo(iogrp),jdp(iogrp)) - end if +#endif ! --- Mask sea floor in mass fluxes call msksrf(jcarflx0100(iogrp),k0100) @@ -378,9 +380,9 @@ subroutine ncwrt_bgc(iogrp) call msklvl(jlvlnatomegaa(iogrp),depths) call msklvl(jlvlnatomegac(iogrp),depths) #endif - if (do_bromo) then +#ifdef BROMO call msklvl(jlvlbromo(iogrp),depths) - end if +#endif ! --- Compute log10 of pH if (SRF_PH(iogrp).ne.0) call logsrf(jsrfph(iogrp),rnacc,0.) @@ -471,13 +473,13 @@ subroutine ncwrt_bgc(iogrp) call wrtsrf(jnatco2fx(iogrp), SRF_NATCO2FX(iogrp), rnacc*12./dtbgc,0.,cmpflg,'natco2fx') call wrtsrf(jsrfnatph(iogrp), SRF_NATPH(iogrp), -1., 0.,cmpflg,'srfnatph') #endif - if (do_bromo) then +#ifdef BROMO call wrtsrf(jbromofx(iogrp), SRF_BROMOFX(iogrp), rnacc*1e3/dtbgc,0.,cmpflg,'bromofx') call wrtsrf(jsrfbromo(iogrp), SRF_BROMO(iogrp), rnacc*1e3, 0.,cmpflg,'srfbromo') call wrtsrf(jbromo_prod(iogrp), INT_BROMOPRO(iogrp), rnacc*1e3/dtbgc,0.,cmpflg,'intbromoprod') call wrtsrf(jbromo_uv(iogrp), INT_BROMOUV(iogrp), rnacc*1e3/dtbgc,0.,cmpflg,'intbromouv') call wrtsrf(jatmbromo(iogrp), SRF_ATMBROMO(iogrp), rnacc, 0.,cmpflg,'atmbromo') - end if +#endif call wrtsrf(jatmco2(iogrp), SRF_ATMCO2(iogrp), rnacc, 0.,cmpflg,'atmco2') #if defined(BOXATM) call wrtsrf(jatmo2(iogrp), SRF_ATMO2(iogrp), rnacc, 0.,cmpflg,'atmo2') @@ -548,9 +550,9 @@ subroutine ncwrt_bgc(iogrp) call wrtlyr(jnatomegaa(iogrp), LYR_NATOMEGAA(iogrp),1., 0.,cmpflg,'natomegaa') call wrtlyr(jnatomegac(iogrp), LYR_NATOMEGAC(iogrp),1., 0.,cmpflg,'natomegac') #endif - if (do_bromo) then +#ifdef BROMO call wrtlyr(jbromo(iogrp), LYR_BROMO(iogrp), 1e3, 0.,cmpflg,'bromo') - end if +#endif ! --- Store 3d level fields call wrtlvl(jlvldic(iogrp), LVL_DIC(iogrp), rnacc*1e3, 0.,cmpflg,'dissiclvl') @@ -611,9 +613,9 @@ subroutine ncwrt_bgc(iogrp) call wrtlvl(jlvlnatomegaa(iogrp),LVL_NATOMEGAA(iogrp),rnacc, 0.,cmpflg,'natomegaalvl') call wrtlvl(jlvlnatomegac(iogrp),LVL_NATOMEGAC(iogrp),rnacc, 0.,cmpflg,'natomegaclvl') #endif - if (do_bromo) then +#ifdef BROMO call wrtlvl(jlvlbromo(iogrp), LVL_BROMO(iogrp), rnacc*1e3, 0.,cmpflg,'bromolvl') - end if +#endif ! --- Store sediment fields #ifndef sedbypass @@ -718,13 +720,13 @@ subroutine ncwrt_bgc(iogrp) call inisrf(jnatco2fx(iogrp),0.) call inisrf(jsrfnatph(iogrp),0.) #endif - if (do_bromo) then +#ifdef BROMO call inisrf(jsrfbromo(iogrp),0.) call inisrf(jbromofx(iogrp),0.) call inisrf(jbromo_prod(iogrp),0.) call inisrf(jbromo_uv(iogrp),0.) call inisrf(jatmbromo(iogrp),0.) - end if +#endif call inisrf(jatmco2(iogrp),0.) @@ -796,9 +798,9 @@ subroutine ncwrt_bgc(iogrp) call inilyr(jnatomegaa(iogrp),0.) call inilyr(jnatomegac(iogrp),0.) #endif - if (do_bromo) then +#ifdef BROMO call inilyr(jbromo(iogrp),0.) - end if +#endif call inilvl(jlvldic(iogrp),0.) call inilvl(jlvlalkali(iogrp),0.) @@ -858,9 +860,9 @@ subroutine ncwrt_bgc(iogrp) call inilvl(jlvlnatomegaa(iogrp),0.) call inilvl(jlvlnatomegac(iogrp),0.) #endif - if (do_bromo) then +#ifdef BROMO call inilvl(jlvlbromo(iogrp),0.) - end if +#endif #ifndef sedbypass call inisdm(jpowaic(iogrp),0.) @@ -919,8 +921,11 @@ subroutine hamoccvardef(iogrp,timeunits,calendar,cmpflg) #if defined(BOXATM) use mo_bgcmean, only: srf_atmo2,srf_atmn2 #endif + +#ifdef BROMO use mo_bgcmean, only:srf_bromo,srf_bromofx,int_bromopro, & & int_bromouv,srf_atmbromo,lyr_bromo,lvl_bromo +#endif #ifdef CFC use mo_bgcmean, only: srf_cfc11,srf_cfc12,srf_sf6,lyr_cfc11, & & lyr_cfc12,lyr_sf6,lvl_cfc11,lvl_cfc12,lvl_sf6 @@ -946,7 +951,6 @@ subroutine hamoccvardef(iogrp,timeunits,calendar,cmpflg) & sdm_sssc12,sdm_ssster,bur_ssso12,bur_sssc12,bur_ssssil, & & bur_ssster #endif - use mo_control_bgc, only: do_bromo implicit none integer iogrp,cmpflg @@ -1123,7 +1127,7 @@ subroutine hamoccvardef(iogrp,timeunits,calendar,cmpflg) call ncdefvar3d(SRF_NATPH(iogrp),cmpflg,'p','srfnatph', & & 'Surface natural pH',' ','-log10([H+])',0) #endif - if (do_bromo) then +#ifdef BROMO call ncdefvar3d(SRF_BROMO(iogrp),cmpflg,'p','srfbromo', & & 'Surface bromoform',' ','mol CHBr3 m-3',0) call ncdefvar3d(SRF_BROMOfx(iogrp),cmpflg,'p','bromofx', & @@ -1135,7 +1139,7 @@ subroutine hamoccvardef(iogrp,timeunits,calendar,cmpflg) & 'mol CHBr3 m-2 s-1',0) call ncdefvar3d(SRF_ATMBROMO(iogrp),cmpflg,'p', & & 'atmbromo','Atmospheric bromoform',' ','ppt',0) - end if +#endif call ncdefvar3d(SRF_ATMCO2(iogrp),cmpflg,'p', & & 'atmco2','Atmospheric CO2',' ','ppm',0) @@ -1263,10 +1267,10 @@ subroutine hamoccvardef(iogrp,timeunits,calendar,cmpflg) call ncdefvar3d(LYR_NATOMEGAC(iogrp),cmpflg,'p','natomegac', & & 'Natural OmegaC',' ','1',1) #endif - if (do_bromo) then +#ifdef BROMO call ncdefvar3d(LYR_BROMO(iogrp),cmpflg,'p', & & 'bromo','Bromoform',' ','mol CHBr3 m-3',1) - end if +#endif ! --- define 3d level fields call ncdefvar3d(LVL_DIC(iogrp),cmpflg,'p', & @@ -1377,10 +1381,10 @@ subroutine hamoccvardef(iogrp,timeunits,calendar,cmpflg) call ncdefvar3d(LVL_NATOMEGAC(iogrp),cmpflg,'p', & & 'natomegaclvl','Natural OmegaC',' ','1',2) #endif - if (do_bromo) then +#ifdef BROMO call ncdefvar3d(LVL_BROMO(iogrp),cmpflg,'p', & & 'bromolvl','Bromoform',' ','mol CHBr3 m-3',2) - end if +#endif ! --- define sediment fields #ifndef sedbypass diff --git a/hamocc/ocprod.F90 b/hamocc/ocprod.F90 index 01032b12..d98bc43c 100644 --- a/hamocc/ocprod.F90 +++ b/hamocc/ocprod.F90 @@ -90,7 +90,7 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) & riron,rnit,strahl,rnoi,ro2ut,ropal,spemor,wcal,wdust,wopal,wpoc,zinges use mo_param1_bgc, only: ialkali,ian2o,iano3,icalc,idet,idms,idoc,ifdust,igasnit,iiron,iopal,ioxygen,iphosph,iphy,isco212, & & isilica,izoo - use mo_control_bgc, only: dtb,io_stdo_bgc,with_dmsph,do_bromo + use mo_control_bgc, only: dtb,io_stdo_bgc,with_dmsph use mo_vgrid, only: dp_min,dp_min_sink,k0100,k0500,k1000,k2000,k4000,kwrbioz,ptiestu use mod_xc, only: mnproc @@ -102,10 +102,12 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) #elif defined(WLIN) use mo_biomod, only: wmin,wmax,wlin #endif +#ifdef BROMO use mo_param1_bgc, only: ibromo use mo_biomod, only: int_chbr3_prod,int_chbr3_uv,rbro use mo_carbch, only: fbro1,fbro2 use mo_clim_swa, only: swa_clim +#endif #ifdef cisonew use mo_biomod, only: bifr13,bifr13_perm,bifr14,growth_co2 use mo_param1_bgc, only: icalc13,icalc14,idet13,idet14,idoc13,idoc14,iphy13,iphy14,isco213,isco214,izoo13,izoo14,safediv @@ -188,8 +190,10 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) real :: sett_agg,shear_agg,effsti,dfirst,dshagg,dsett real :: wnos,wnosd #endif +#ifdef BROMO real :: bro_beta,bro_uv real :: abs_uv(kpie,kpje,kpke) +#endif ! set variables for diagnostic output to zero @@ -217,10 +221,10 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) intdms_bac(:,:) = 0. intdms_uv (:,:) = 0. phosy3d (:,:,:) = 0. - if (do_bromo) then +#ifdef BROMO int_chbr3_uv (:,:) = 0. int_chbr3_prod (:,:) = 0. - end if +#endif #ifdef AGG eps3d(:,:,:) = 0. asize3d(:,:,:) = 0. @@ -247,9 +251,9 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) ! Calculate swr absorption by water and phytoplankton abs_bgc(:,:,:) = 0. - if (do_bromo) then +#ifdef BROMO abs_uv(:,:,:) = 0. - end if +#endif #ifdef FB_BGC_OCE abs_oce(:,:,:) = 0. abs_oce(:,:,1) = 1. @@ -273,9 +277,9 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) ! Average light intensity in layer k atten = atten_w + atten_c * max(0.,ocetra(i,j,k,iphy)) abs_bgc(i,j,k) = ((absorption/atten)* (1.-exp(-atten*dz)))/dz - if (do_bromo) then - abs_uv(i,j,k) = ((absorption_uv/atten_uv)*(1.-exp(-atten_uv*dz)))/dz - end if +#ifdef BROMO + abs_uv(i,j,k) = ((absorption_uv/atten_uv)*(1.-exp(-atten_uv*dz)))/dz +#endif #ifdef FB_BGC_OCE abs_oce(i,j,k) = abs_oce(i,j,k) * absorption if (k == 2) then @@ -311,7 +315,9 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) !$OMP ,zoomor14,excdoc13,excdoc14,exud13,exud14,export13,export14 & !$OMP ,delcar13,delcar14,dtr13,dtr14,bifr13,bifr14 & # endif +# ifdef BROMO !$OMP ,bro_beta,bro_uv & +# endif !$OMP ,i,k) loop1: do j = 1,kpje @@ -478,7 +484,7 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) ocetra(i,j,k,iopal) = ocetra(i,j,k,iopal)+delsil-dremopal*ocetra(i,j,k,iopal) ocetra(i,j,k,iiron) = ocetra(i,j,k,iiron)+dtr*riron & & - relaxfe*MAX(ocetra(i,j,k,iiron)-fesoly,0.) - +#ifdef BROMO ! Bromo source from phytoplankton production and sink to photolysis ! Hense and Quack (200) Pg537 Decay time scale is 30days =0.0333/day ! sinks owing to degradation by nitrifiers (Pg 538 of Hense and Quack, @@ -486,15 +492,14 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) ! than sink through halide substitution & hydrolysis (Fig. 3) ! Assume that only 30% of incoming radiation are UV (i.e. 50% of non-PAR ! radiation; PAR radiationis assume to be 40% of incoming radiation) - if (do_bromo) then bro_beta = rbro*(fbro1*avsil/(avsil+bkopal)+fbro2*bkopal/(avsil+bkopal)) if (swa_clim(i,j,1) > 0.) then - bro_uv = 0.0333*dtb*0.3*(strahl(i,j)/swa_clim(i,j,1))*abs_uv(i,j,k)*ocetra(i,j,k,ibromo) + bro_uv = 0.0333*dtb*0.3*(strahl(i,j)/swa_clim(i,j,1))*abs_uv(i,j,k)*ocetra(i,j,k,ibromo) else - bro_uv = 0.0 + bro_uv = 0.0 endif ocetra(i,j,k,ibromo) = ocetra(i,j,k,ibromo)+bro_beta*phosy-bro_uv - end if +#endif #ifdef AGG !*********************************************************************** @@ -536,10 +541,10 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) intdmsprod(i,j) = intdmsprod(i,j)+dmsprod*dz intdms_bac(i,j) = intdms_bac(i,j)+dms_bac*dz intdms_uv(i,j) = intdms_uv (i,j)+dms_uv*dz - if (do_bromo) then +#ifdef BROMO int_chbr3_uv(i,j) = int_chbr3_uv (i,j) + bro_uv*dz int_chbr3_prod(i,j) = int_chbr3_prod (i,j) + bro_beta*phosy*dz - end if +#endif intphosy(i,j) = intphosy(i,j) +phosy*rcar*dz ! primary production in kmol C m-2 phosy3d(i,j,k) = phosy*rcar ! primary production in kmol C m-3 diff --git a/meson.build b/meson.build index 3cdb64b2..20b496d4 100644 --- a/meson.build +++ b/meson.build @@ -120,6 +120,9 @@ if get_option('ecosys') if get_option('hamocc_boxatm') add_project_arguments('-DBOXATM', language: 'fortran') endif + if get_option('hamocc_bromo') + add_project_arguments('-DBROMO', language: 'fortran') + endif if get_option('hamocc_cfc') add_project_arguments('-DCFC', language: 'fortran') endif diff --git a/phy/mod_dia.F b/phy/mod_dia.F index f06e4f03..6e63f492 100644 --- a/phy/mod_dia.F +++ b/phy/mod_dia.F @@ -369,7 +369,7 @@ subroutine diafnm(ctag,diagfq,diagmon,diagann,fname) . date_tmp%year,sep2,date_tmp%month,'.nc' else write(fname,'(4a,i4.4,a,i2.2,a,i2.2,a)') - . trim(runid),sep1,trim(ctag),sep1, + . trim(prefix),sep1,trim(ctag),sep1, . date_tmp%year,sep2,date_tmp%month,sep2,date_tmp%day,'.nc' endif else @@ -386,7 +386,7 @@ subroutine diafnm(ctag,diagfq,diagmon,diagann,fname) endif ns=86400*(mod(nstep-1,nstep_in_day)+1)/nstep_in_day write(fname,'(4a,i4.4,a,i2.2,a,i2.2,a,i5.5,a)') - . trim(runid),sep1,trim(ctag),sep1, + . trim(prefix),sep1,trim(ctag),sep1, . date_tmp%year,sep2,date_tmp%month,sep2,date_tmp%day,sep2,ns, . '.nc' endif diff --git a/phy/restart_rd.F b/phy/restart_rd.F index d96b2168..b8a3eeb9 100644 --- a/phy/restart_rd.F +++ b/phy/restart_rd.F @@ -69,9 +69,6 @@ subroutine restart_rd use mod_tke, only: L_scale # endif #endif -#ifdef HAMOCC - use mo_control_bgc, only: do_bromo -#endif c implicit none c diff --git a/phy/restart_wt.F b/phy/restart_wt.F index 4c2021a3..77faa50b 100644 --- a/phy/restart_wt.F +++ b/phy/restart_wt.F @@ -66,9 +66,6 @@ subroutine restart_wt use mod_tke, only: L_scale # endif #endif -#ifdef HAMOCC - use mo_control_bgc, only: do_bromo -#endif c implicit none c @@ -372,11 +369,9 @@ subroutine restart_wt call wrtrst('frzpot',trim(c5p)//' time',frzpot,ip) call wrtrst('mltpot',trim(c5p)//' time',mltpot,ip) call wrtrst('flxco2',trim(c5p)//' time',flxco2,ip) -#ifdef HAMOCC call wrtrst('flxdms',trim(c5p)//' time',flxdms,ip) - if (do_bromo) then - call wrtrst('flxbrf',trim(c5p)//' time',flxbrf,ip) - end if +#ifdef BROMO + call wrtrst('flxbrf',trim(c5p)//' time',flxbrf,ip) #endif endif c @@ -906,9 +901,6 @@ subroutine defvar_restart(c5p,c5u,c5v,c5q) c --- ------------------------------------------------------------------ use mod_dia use mod_forcing, only: sprfac -#ifdef HAMOCC - use mo_control_bgc, only: do_bromo -#endif c implicit none c @@ -1053,11 +1045,9 @@ subroutine defvar_restart(c5p,c5u,c5v,c5q) call defvarrst('frzpot',trim(c5p)//' time') call defvarrst('mltpot',trim(c5p)//' time') call defvarrst('flxco2',trim(c5p)//' time') -#ifdef HAMOCC call defvarrst('flxdms',trim(c5p)//' time') - if (do_bromo) then - call defvarrst('flxbrf',trim(c5p)//' time') - end if +#ifdef BROMO + call defvarrst('flxbrf',trim(c5p)//' time') #endif endif c From ed6a639cedaee97a9e9063d8a3f8a9ea28139b3d Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Fri, 28 Jul 2023 13:17:53 +0200 Subject: [PATCH 32/52] updated name of daily history file --- phy/mod_dia.F | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phy/mod_dia.F b/phy/mod_dia.F index f06e4f03..6e63f492 100644 --- a/phy/mod_dia.F +++ b/phy/mod_dia.F @@ -369,7 +369,7 @@ subroutine diafnm(ctag,diagfq,diagmon,diagann,fname) . date_tmp%year,sep2,date_tmp%month,'.nc' else write(fname,'(4a,i4.4,a,i2.2,a,i2.2,a)') - . trim(runid),sep1,trim(ctag),sep1, + . trim(prefix),sep1,trim(ctag),sep1, . date_tmp%year,sep2,date_tmp%month,sep2,date_tmp%day,'.nc' endif else @@ -386,7 +386,7 @@ subroutine diafnm(ctag,diagfq,diagmon,diagann,fname) endif ns=86400*(mod(nstep-1,nstep_in_day)+1)/nstep_in_day write(fname,'(4a,i4.4,a,i2.2,a,i2.2,a,i5.5,a)') - . trim(runid),sep1,trim(ctag),sep1, + . trim(prefix),sep1,trim(ctag),sep1, . date_tmp%year,sep2,date_tmp%month,sep2,date_tmp%day,sep2,ns, . '.nc' endif From 397160da899d70c04569e443e56cce234421768c Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Fri, 28 Jul 2023 15:58:57 +0200 Subject: [PATCH 33/52] change defaults for history file handling for testing --- cime_config/buildcpp | 3 +- cime_config/buildnml | 3 + cime_config/namelist_definition_blom.xml | 722 +++++++++++++++++++++++ cime_config/testdefs/testlist_blom.xml | 8 +- 4 files changed, 730 insertions(+), 6 deletions(-) diff --git a/cime_config/buildcpp b/cime_config/buildcpp index 4799052a..dc6cd8e8 100644 --- a/cime_config/buildcpp +++ b/cime_config/buildcpp @@ -91,8 +91,7 @@ def buildcpp(case): blom_unit = case.get_value("BLOM_UNIT") pio_typename = case.get_value("PIO_TYPENAME", subgroup="OCN") - expect(blom_vcoord != "cntiso_hybrid" or not turbclo, - f"BLOM_VCOORD == {blom_vcoord} and BLOM_TURBULENT_CLOSURE == {turblo} is not a valid combination") + expect(blom_vcoord != "cntiso_hybrid" or not turbclo, "BLOM_VCOORD == {} and BLOM_TURBULENT_CLOSURE == {} is not a valid combination".format(blom_vcoord, turbclo)) blom_cppdefs = "" diff --git a/cime_config/buildnml b/cime_config/buildnml index b5842523..8d6efefd 100755 --- a/cime_config/buildnml +++ b/cime_config/buildnml @@ -75,6 +75,9 @@ def _create_namelists(case, confdir, infile, nmlgen): config['pio_netcdf_format_ocn'] = pio_netcdf_format_ocn config["continue_run"] = "yes" if continue_run else "no" config["is_test"] = "yes" if is_test else "no" + if is_test: + testcase = case.get_value("TESTCASE") + config["is_test_pfs"] = "yes" if testcase == "PFS" else "no" config['blom_unit'] = blom_unit if blom_unit else "unset" config['blom_vcoord'] = blom_vcoord diff --git a/cime_config/namelist_definition_blom.xml b/cime_config/namelist_definition_blom.xml index 6038454c..6e83ac18 100644 --- a/cime_config/namelist_definition_blom.xml +++ b/cime_config/namelist_definition_blom.xml @@ -1335,6 +1335,7 @@ 30,30,365 1,30,365 + 30,30,365 how often to start a new file in days @@ -1369,6 +1370,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 absolute wind speed [m s-1] @@ -1379,6 +1382,7 @@ diaphy 0,0,0 + 0,0,0 surface albedo [] @@ -1389,6 +1393,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 Barotropic mass streamfunction [kg s-1] @@ -1399,6 +1405,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 brine flux [kg m-2 s-1] @@ -1409,6 +1417,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 brine plume depth [m] @@ -1419,6 +1429,8 @@ diaphy 0,0,0 + 0,0,0 + 0,0,0 non-solar heat flux derivative [W m-2 K-1] @@ -1429,6 +1441,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 evaporation [kg m-2 s-1] @@ -1439,6 +1453,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 ice concentration [%] @@ -1449,6 +1465,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 fresh water flux due to melting/freezing [kg m-2 s-1] @@ -1459,6 +1477,8 @@ diaphy 0,0,0 + 0,0,0 + 0,0,0 ice thickness [m] @@ -1469,6 +1489,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 heat flux due to melting/freezing [W m-2] @@ -1479,6 +1501,8 @@ diaphy 0,0,0 + 0,0,0 + 0,0,0 snow depth [m] @@ -1489,6 +1513,8 @@ diaphy 0,0,0 + 0,0,0 + 0,0,0 ice age [d] @@ -1499,6 +1525,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 mixed layer inertial kinetic energy tendency [kg s-3] @@ -1509,6 +1537,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 Langmuir enhancement factor [] @@ -1519,6 +1549,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 Surface layer averaged Langmuir number [] @@ -1529,6 +1561,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 liquid precipitation [kg m-2 s-1] @@ -1539,6 +1573,8 @@ diaphy 4,4,0 + 4,4,0 + 0,0,0 maximum mixed layer depth [m] @@ -1549,6 +1585,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 mixed layer depth [m] @@ -1559,6 +1597,8 @@ diaphy 4,4,0 + 4,4,0 + 0,0,0 mixed layer thickness using "sigma-t" criterion [m] @@ -1569,6 +1609,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 minimum mixed layer thickness using "sigma-t" criterion [m] @@ -1579,6 +1621,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 maximum mixed layer thickness using "sigma-t" criterion [m] @@ -1589,6 +1633,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 mixed layer thickness squared using "sigma-t" criterion [m2] @@ -1599,6 +1645,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 mixed layer TKE tendency related to friction velocity [kg s-3] @@ -1609,6 +1657,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 mixed layer TKE tendency related to near inertial mot. [kg s-3] @@ -1619,6 +1669,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 mixed layer TKE tendency related to buoyancy forcing [kg s-3] @@ -1629,6 +1681,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 mixed layer TKE tendency related to eddy restrat. [kg s-3] @@ -1639,6 +1693,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 mixed layer TKE tendency related to pot. energy change [kg s-3] @@ -1649,6 +1705,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 mixed layer TKE tendency related to kin. energy change [kg s-3] @@ -1659,6 +1717,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 wind stress y-component [N m-2] @@ -1669,6 +1729,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 non-solar heat flux [W m-2] @@ -1679,6 +1741,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 bottom pressure [Pa] @@ -1689,6 +1753,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 surface pressure [Pa] @@ -1699,6 +1765,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 frozen runoff [kg m-2 s-1] @@ -1709,6 +1777,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 liquid runoff [kg m-2 s-1] @@ -1719,6 +1789,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 salt flux received by ocean [kg m-2 s-1] @@ -1729,6 +1801,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 restoring salt flux received by ocean [kg m-2 s-1] @@ -1739,6 +1813,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 bottom salinity [g kg-1] @@ -1749,6 +1825,8 @@ diaphy 4,4,0 + 4,4,0 + 0,0,0 sea level [m] @@ -1759,6 +1837,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 sea level squared [m2] @@ -1769,6 +1849,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 salt flux [kg m-2 s-1] @@ -1779,6 +1861,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 solid precipitation [kg m-2 s-1] @@ -1789,6 +1873,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 mixed layer density [kg m-3] @@ -1799,6 +1885,8 @@ diaphy 4,4,0 + 4,4,0 + 0,0,0 ocean surface salinity [g kg-1] @@ -1809,6 +1897,8 @@ diaphy 4,4,0 + 4,4,0 + 0,0,0 ocean surface salinity squared [g2 kg-2] @@ -1819,6 +1909,8 @@ diaphy 4,4,0 + 4,4,0 + 0,0,0 ocean surface temperature [degC] @@ -1829,6 +1921,8 @@ diaphy 4,4,0 + 4,4,0 + 0,0,0 ocean surface temperature squared [degC2] @@ -1839,6 +1933,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 heat flux received by ocean [W m-2] @@ -1849,6 +1945,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 restoring heat flux received by ocean [W m-2] @@ -1859,6 +1957,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 short-wave heat flux [W m-2] @@ -1869,6 +1969,8 @@ diaphy 4,4,0 + 4,4,0 + 0,0,0 20C isoterm depth [m] @@ -1879,6 +1981,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 momentum flux received by ocean x-component [N m-2] @@ -1889,6 +1993,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 momentum flux received by ocean y-component [N m-2] @@ -1899,6 +2005,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 bottom temperature [degC] @@ -1909,6 +2017,8 @@ diaphy 0,0,0 + 0,0,0 + 0,0,0 ice temperature [degC] @@ -1919,6 +2029,8 @@ diaphy 0,0,0 + 0,0,0 + 0,0,0 surface temperature [degC] @@ -1929,6 +2041,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 barotropic velocity x-component [m s-1] @@ -1939,6 +2053,8 @@ diaphy 0,0,0 + 0,0,0 + 0,0,0 ice velocity x-component [m s-1] @@ -1949,6 +2065,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 friction velocity [m s-1] @@ -1959,6 +2077,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 friction velocity cubed [m3 s-3] @@ -1969,6 +2089,8 @@ diaphy 0,0,0 + 0,0,0 + 0,0,0 surface Stokes drift x-componen [m s-1] @@ -1979,6 +2101,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 barotropic velocity y-component [m s-1] @@ -1989,6 +2113,8 @@ diaphy 0,0,0 + 0,0,0 + 0,0,0 ice velocity y-component [m s-1] @@ -1999,6 +2125,8 @@ diaphy 0,0,0 + 0,0,0 + 0,0,0 surface Stokes drift y-componen [m s-1] @@ -2009,6 +2137,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 wind stress x-component [N m-2] @@ -2019,6 +2149,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 buoyancy frequency squared [s-1] @@ -2029,6 +2161,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 vertical diffusivity [log10(m2 s-1)|m2 s-1] @@ -2039,6 +2173,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 vertical momentum diffusivity [log10(m2 s-1)|m2 s-1] @@ -2049,6 +2185,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 vertical heat diffusivity [log10(m2 s-1)|m2 s-1] @@ -2059,6 +2197,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 vertical salt diffusivity [log10(m2 s-1)|m2 s-1] @@ -2069,6 +2209,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 layer interface diffusivity [log10(m2 s-1)] @@ -2079,6 +2221,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 isopycnal diffusivity [log10(m2 s-1)] @@ -2089,6 +2233,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 @@ -2099,6 +2245,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 @@ -2109,6 +2257,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 @@ -2119,6 +2269,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 @@ -2129,6 +2281,8 @@ diaphy 0,0,0 + 0,0,0 + 0,0,0 @@ -2139,6 +2293,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 @@ -2149,6 +2305,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 @@ -2159,6 +2317,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 @@ -2169,6 +2329,8 @@ diaphy 0,0,4 + 0,0,4 + 0,0,0 @@ -2179,6 +2341,8 @@ diaphy 0,0,4 + 0,0,4 + 0,0,0 @@ -2189,6 +2353,8 @@ diaphy 0,0,4 + 0,0,4 + 0,0,0 @@ -2199,6 +2365,8 @@ diaphy 0,0,4 + 0,0,4 + 0,0,0 @@ -2209,6 +2377,8 @@ diaphy 0,0,4 + 0,0,4 + 0,0,0 @@ -2219,6 +2389,8 @@ diaphy 0,0,4 + 0,0,4 + 0,0,0 @@ -2229,6 +2401,8 @@ diaphy 0,0,4 + 0,0,4 + 0,0,0 @@ -2239,6 +2413,8 @@ diaphy 0,0,4 + 0,0,4 + 0,0,0 @@ -2249,6 +2425,8 @@ diaphy 0,4,0 + 0,0,4 + 0,0,0 @@ -2259,6 +2437,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 @@ -2269,6 +2449,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 @@ -2279,6 +2461,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 @@ -2289,6 +2473,8 @@ diaphy 0,0,4 + 4,4,0 + 0,0,0 @@ -2299,6 +2485,8 @@ diaphy 0,0,4 + 0,0,4 + 0,0,0 @@ -2309,6 +2497,8 @@ diaphy 0,0,4 + 0,0,4 + 0,0,0 @@ -2319,6 +2509,8 @@ diaphy 0,0,4 + 0,0,4 + 0,0,0 @@ -2329,6 +2521,8 @@ diaphy 0,0,4 + 0,0,4 + 0,0,0 @@ -2339,6 +2533,8 @@ diaphy 0,0,4 + 0,0,4 + 0,0,0 @@ -2349,6 +2545,8 @@ diaphy 0,0,4 + 0,0,4 + 0,0,0 @@ -2359,6 +2557,8 @@ diaphy 0,0,4 + 0,0,4 + 0,0,0 @@ -2369,6 +2569,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 @@ -2379,6 +2581,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 @@ -2389,6 +2593,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 @@ -2399,6 +2605,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 @@ -2409,6 +2617,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 @@ -2419,6 +2629,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 @@ -2429,6 +2641,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 @@ -2439,6 +2653,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 @@ -2449,6 +2665,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 @@ -2459,6 +2677,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 @@ -2469,6 +2689,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 @@ -2479,6 +2701,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 @@ -2489,6 +2713,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 @@ -2499,6 +2725,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 @@ -2509,6 +2737,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 @@ -2519,6 +2749,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 @@ -2529,6 +2761,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 @@ -2539,6 +2773,8 @@ diaphy 0,0,0 + 0,0,0 + 0,0,0 @@ -2549,6 +2785,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 @@ -2559,6 +2797,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 @@ -2569,6 +2809,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 @@ -2579,6 +2821,8 @@ diaphy 0,0,4 + 0,0,4 + 0,0,0 @@ -2589,6 +2833,8 @@ diaphy 0,0,4 + 0,0,4 + 0,0,0 @@ -2599,6 +2845,8 @@ diaphy 0,0,4 + 0,0,4 + 0,0,0 @@ -2609,6 +2857,8 @@ diaphy 0,0,4 + 0,0,4 + 0,0,0 @@ -2619,6 +2869,8 @@ diaphy 0,0,4 + 0,0,4 + 0,0,0 @@ -2629,6 +2881,8 @@ diaphy 0,0,4 + 0,0,4 + 0,0,0 @@ -2639,6 +2893,8 @@ diaphy 0,0,4 + 0,0,4 + 0,0,0 @@ -2649,6 +2905,8 @@ diaphy 0,0,4 + 0,0,4 + 0,0,0 @@ -2659,6 +2917,8 @@ diaphy 0,4,0 + 0,0,4 + 0,0,0 @@ -2669,6 +2929,8 @@ diaphy 0,4,0 + 0,0,4 + 0,0,0 @@ -2679,6 +2941,10 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 + 4,4,0 + 0,0,0 @@ -2689,6 +2955,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 @@ -2699,6 +2967,8 @@ diaphy 0,0,4 + 0,0,4 + 0,0,0 @@ -2709,6 +2979,8 @@ diaphy 0,0,4 + 0,0,4 + 0,0,0 @@ -2719,6 +2991,8 @@ diaphy 0,0,4 + 0,0,4 + 0,0,0 @@ -2729,6 +3003,8 @@ diaphy 0,0,4 + 0,0,4 + 0,0,0 @@ -2739,6 +3015,8 @@ diaphy 0,0,4 + 0,0,4 + 0,0,0 @@ -2749,6 +3027,8 @@ diaphy 0,0,4 + 0,0,4 + 0,0,0 @@ -2759,6 +3039,8 @@ diaphy 0,0,4 + 0,0,4 + 0,0,0 @@ -2769,6 +3051,8 @@ diaphy 0,0,4 + 0,0,4 + 0,0,0 @@ -2779,6 +3063,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 @@ -2789,6 +3075,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 @@ -2799,6 +3087,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 @@ -2809,6 +3099,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 @@ -2819,6 +3111,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 @@ -2829,6 +3123,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 @@ -2839,6 +3135,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 @@ -2849,6 +3147,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 @@ -2859,6 +3159,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 @@ -2869,6 +3171,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 @@ -2879,6 +3183,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 @@ -2889,6 +3195,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 @@ -2899,6 +3207,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 @@ -2909,6 +3219,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 @@ -2919,6 +3231,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 @@ -2929,6 +3243,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 @@ -2939,6 +3255,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 @@ -2949,6 +3267,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 @@ -2959,6 +3279,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 @@ -2969,6 +3291,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 @@ -2979,6 +3303,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 @@ -2989,6 +3315,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 @@ -2999,6 +3327,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 @@ -3009,6 +3339,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 @@ -3019,6 +3351,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 @@ -3029,6 +3363,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 @@ -3039,6 +3375,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 @@ -3049,6 +3387,8 @@ diaphy 0,4,0 + 4,4,0 + 0,0,0 @@ -3553,6 +3893,7 @@ 30,30,365 1,30,365 + 0,0,0 @@ -3594,6 +3935,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 Phosphorus (po4) [mol P m-3] @@ -3604,6 +3947,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 Oxygen (o2) [mol O2 m-3] @@ -3614,6 +3959,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 Dissolved iron (dfe) [mol Fe m-3] @@ -3624,6 +3971,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 Nitrate (no3) [mol N m-3] @@ -3634,6 +3983,8 @@ diabgc 4, 2, 2 + 4, 2, 2 + 0,0,0 Natural alkalinity (nattalk) [eq m-3] @@ -3644,6 +3995,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 @@ -3654,6 +4007,8 @@ diabgc 4, 2, 2 + 4, 2, 2 + 0,0,0 Dissolved carbon (dissic) [mol C m-3] @@ -3664,6 +4019,8 @@ diabgc 4, 2, 2 + 4, 2, 2 + 0,0,0 Phytoplankton (phyc) [mol C m-3] @@ -3674,6 +4031,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 pH (ph) [-log10([h+])] @@ -3684,6 +4043,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 Export production (epc100) [mol C m-2 s-1] @@ -3694,6 +4055,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 Si export production (epsi100) [mol Si m-2 s-1] @@ -3704,6 +4067,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 Ca export production (epcalc100) [mol Ca m-2 s-1] @@ -3714,6 +4079,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 Piston velocity (kwco2) [m s-1] @@ -3724,6 +4091,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 Piston velocity times solubility (kwco2*kh; moist air) [m s-1 mol kg-1 uatm-1] @@ -3734,6 +4103,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 Piston velocity times solubility (kwco2*kh; moist air) [m s-1 mol kg-1 uatm-1] @@ -3744,6 +4115,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 CO2 solubility under moist air assumption (kh) [mol kg-1 atm-1] @@ -3754,6 +4127,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 Natural surface PCO2 (spco2) [uatm] @@ -3764,6 +4139,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 Surface PCO2 under moist air assumption [uatm] @@ -3774,6 +4151,8 @@ diabgc 4, 2, 2 + 2, 2, 2 + 0,0,0 Downward CO2 flux (co2fxd) [kg C m-2 s-1] @@ -3784,6 +4163,8 @@ diabgc 4, 2, 2 + 2, 2, 2 + 0,0,0 Upward CO2 flux (co2fxu) [kg C m-2 s-1] @@ -3794,6 +4175,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 Oxygen flux (fgo2) [mol O2 m-2 s-1] @@ -3804,6 +4187,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 Nitrogen flux (fgn2) [mol N2 m-2 s-1] @@ -3814,6 +4199,8 @@ diabgc 0, 0, 2 + 2, 2, 2 + 0,0,0 Nitrous oxide flux [mol N2O m-2 s-1] @@ -3824,6 +4211,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 DMS flux (dmsflux) [mol DMS m-2 s-1] @@ -3834,6 +4223,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 surface DMS concentration (dms) [mol DMS m-3] @@ -3844,6 +4235,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 DMS production (dmsprod) [mol DMS m-2 s-1] @@ -3854,6 +4247,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 DMS bacterial consuption (dms_bac) [mol DMS m-2 s-1] @@ -3864,6 +4259,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 DMS decomposition by UV (dms_uv) [mol DMS m-2 s-1] @@ -3874,6 +4271,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 Atmospheric CO2 (atmco2) [ppm] @@ -3884,6 +4283,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 Atmospheric O2 (atmo2) [ppm] @@ -3894,6 +4295,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 Atmospheric N2 (atmn2) [ppm] @@ -3904,6 +4307,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 Natural dissolved carbon (natdissic) [mol C m-3] @@ -3914,6 +4319,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 Natural alkalinity (nattalk) [eq m-3] @@ -3924,6 +4331,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 Natural pH (natph) [-log10([h+])] @@ -3934,6 +4343,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 Natural surface PCO2 (spco2) [uatm] @@ -3944,6 +4355,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 Natural net CO2 flux (natco2fx) [kg C m-2 s-1] @@ -3954,6 +4367,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 Downward 13CO2 flux (co213fxd) [kg C m-2 s-1] @@ -3964,6 +4379,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 Upward 13CO2 flux (co213fxu) [kg C m-2 s-1] @@ -3974,6 +4391,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 Downward 14CO2 flux (co214fxd) [kg C m-2 s-1] @@ -3984,6 +4403,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 Upward 14CO2 flux (co214fxu) [kg C m-2 s-1] @@ -3994,6 +4415,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 CFC11 flux [mol CFC11 m-2 s-1] @@ -4004,6 +4427,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 CFC12 flux [mol CFC12 m-2 s-1] @@ -4014,6 +4439,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 SF6 flux [mol SF6 m-2 s-1] @@ -4024,6 +4451,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 @@ -4034,6 +4463,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 @@ -4044,6 +4475,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 @@ -4054,6 +4487,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 @@ -4064,6 +4499,8 @@ diabgc 4, 2, 2 + 2, 2, 2 + 0,0,0 Primary production (pp) [mol C m-3 s-1] @@ -4074,6 +4511,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 Vertically integrated nitrogen fixation @@ -4084,6 +4523,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 Vertically integrated denitrification @@ -4095,6 +4536,7 @@ 0,0,0 0, 2, 2 + 2, 2, 2 Nitrogen deposition flux [mol N m-2 s-1] @@ -4105,6 +4547,8 @@ diabgc 0, 0, 0 + 0, 0, 0 + 0,0,0 AMELIST FOR DIAGNOSTIC iHAMOCC OUTPUT @@ -4115,6 +4559,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 @@ -4125,6 +4571,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 @@ -4135,6 +4583,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 @@ -4145,6 +4595,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 @@ -4155,6 +4607,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 @@ -4165,6 +4619,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 @@ -4175,6 +4631,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 @@ -4185,6 +4643,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 @@ -4195,6 +4655,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 @@ -4205,6 +4667,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 @@ -4215,6 +4679,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 @@ -4225,6 +4691,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 @@ -4235,6 +4703,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 @@ -4245,6 +4715,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 @@ -4255,6 +4727,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 @@ -4265,6 +4739,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 @@ -4275,6 +4751,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 @@ -4285,6 +4763,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 @@ -4295,6 +4775,8 @@ diabgc 0, 0, 2 + 2, 2, 2 + 0,0,0 @@ -4305,6 +4787,8 @@ diabgc 0, 0, 2 + 2, 2, 2 + 0,0,0 @@ -4315,6 +4799,8 @@ diabgc 0, 0, 2 + 2, 2, 2 + 0,0,0 @@ -4325,6 +4811,8 @@ diabgc 0, 0, 2 + 2, 2, 2 + 0,0,0 @@ -4335,6 +4823,8 @@ diabgc 0, 0, 2 + 2, 2, 2 + 0,0,0 Phosphorus (po4) [mol P m-3] @@ -4345,6 +4835,8 @@ diabgc 0, 0, 4 + 4, 0, 4 + 0,0,0 Oxygen (o2) [mol O2 m-3] @@ -4355,6 +4847,8 @@ diabgc 0, 0, 2 + 2, 0, 2 + 0,0,0 Dissolved iron (dfe) [mol Fe m-3] @@ -4365,6 +4859,8 @@ diabgc 0, 0, 2 + 2, 0, 2 + 0,0,0 @@ -4375,6 +4871,8 @@ diabgc 0, 0, 2 + 2, 0, 2 + 0,0,0 @@ -4385,6 +4883,8 @@ diabgc 0, 0, 2 + 2, 0, 2 + 0,0,0 @@ -4395,6 +4895,8 @@ diabgc 0, 0, 2 + 2, 0, 2 + 0,0,0 @@ -4405,6 +4907,8 @@ diabgc 0, 0, 2 + 2, 0, 2 + 0,0,0 @@ -4415,6 +4919,8 @@ diabgc 0, 0, 2 + 2, 0, 2 + 0,0,0 CaCO3 shells (calc) [mol C m-3] @@ -4425,6 +4931,8 @@ diabgc 0, 0, 2 + 2, 0, 2 + 0,0,0 Opal shells (opal) [mol Si m-3] @@ -4435,6 +4943,8 @@ diabgc 0, 0, 2 + 2, 0, 2 + 0,0,0 Carbonate ions (co3) [mol C m-3] @@ -4445,6 +4955,8 @@ diabgc 0, 0, 0 + 0, 0, 0 + 0,0,0 Nitrous oxide concentration [mol N2O m-3] @@ -4455,6 +4967,8 @@ diabgc 0, 0, 2 + 2, 0, 2 + 0,0,0 @@ -4465,6 +4979,8 @@ diabgc 0, 0, 2 + 2, 0, 2 + 0,0,0 Calcite saturation state (omegac) [1] @@ -4475,6 +4991,8 @@ diabgc 0, 0, 2 + 2, 0, 2 + 0,0,0 Natural aragonite saturation state (natomegaa) [1] @@ -4485,6 +5003,8 @@ diabgc 0, 0, 4 + 4, 0, 4 + 0,0,0 preformed oxygen (p_o2) [mol O2 m-3] @@ -4495,6 +5015,8 @@ diabgc 0, 0, 4 + 4, 0, 4 + 0,0,0 Saturated oxygen (satoxy) [mol O2 m-3] @@ -4505,6 +5027,8 @@ diabgc 0, 0, 2 + 2, 0, 2 + 0,0,0 @@ -4515,6 +5039,8 @@ diabgc 0, 0, 2 + 2, 0, 2 + 0,0,0 preformed alkalinity (p_talk) [eq m-3] @@ -4525,6 +5051,8 @@ diabgc 0, 0, 2 + 2, 0, 2 + 0,0,0 preformed DIC (p_dic) [mol C m-3] @@ -4535,6 +5063,8 @@ diabgc 0, 0, 2 + 2, 0, 2 + 0,0,0 saturated DIC (dic_sat) [mol C m-3] @@ -4545,6 +5075,8 @@ diabgc 0, 0, 2 + 2, 0, 2 + 0,0,0 Natural dissolved carbon (natdissic) [mol C m-3] @@ -4555,6 +5087,8 @@ diabgc 0, 0, 2 + 2, 0, 2 + 0,0,0 Natural alkalinity (nattalk) [eq m-3] @@ -4565,6 +5099,8 @@ diabgc 0, 0, 2 + 2, 0, 2 + 0,0,0 Natural carbonate ion concentration (natco3) [mol C m-3] @@ -4575,6 +5111,8 @@ diabgc 0, 0, 2 + 2, 0, 2 + 0,0,0 Natural CaCO3 shells (natcalc) [mol C m-3] @@ -4585,6 +5123,8 @@ diabgc 0, 0, 2 + 2, 0, 2 + 0,0,0 Natural pH (natph) [-log10([h+])] @@ -4595,6 +5135,8 @@ diabgc 0, 0, 2 + 2, 0, 2 + 0,0,0 Natural calcite saturation state (natomegac) [1] @@ -4605,6 +5147,8 @@ diabgc 0, 0, 2 + 2, 0, 2 + 0,0,0 Natural aragonite saturation state (natomegaa) [1] @@ -4615,6 +5159,8 @@ diabgc 0, 0, 2 + 2, 0, 2 + 0,0,0 Dissolved C13 (dissic13) [mol C m-3] @@ -4625,6 +5171,8 @@ diabgc 0, 0, 2 + 2, 0, 2 + 0,0,0 Dissolved C14 (dissic14) [mol C m-3] @@ -4635,6 +5183,8 @@ diabgc 0, 0, 2 + 2, 0, 2 + 0,0,0 at-depth variable sediment porosity (as opposed to default: only depth) @@ -4645,6 +5195,8 @@ diabgc 0, 0, 2 + 2, 0, 2 + 0,0,0 delta 14C of DIC [1] @@ -4655,6 +5207,8 @@ diabgc 0, 0, 2 + 2, 0, 2 + 0,0,0 Delta 14C of DIC [1] @@ -4665,6 +5219,8 @@ diabgc 0, 0, 2 + 2, 0, 2 + 0,0,0 Particulate organic carbon 13 (detoc13) [mol C m-3] @@ -4675,6 +5231,8 @@ diabgc 0, 0, 2 + 2, 0, 2 + 0,0,0 Dissolved organic carbon 13 (dissoc13) [mol C m-3] @@ -4685,6 +5243,8 @@ diabgc 0, 0, 2 + 2, 0, 2 + 0,0,0 Particulate inorganic carbon 13 (calc13) [mol C m-3] @@ -4695,6 +5255,8 @@ diabgc 0, 0, 2 + 2, 0, 2 + 0,0,0 13C of phytoplankton biomass (phyc13) [mol C m-3] @@ -4705,6 +5267,8 @@ diabgc 0, 0, 2 + 2, 0, 2 + 0,0,0 13C of zootoplankton biomass (zooc13) [mol C m-3] @@ -4715,6 +5279,8 @@ diabgc 0, 0, 2 + 2, 0, 2 + 0,0,0 CFC11 concentration [mol CFC11 m-3] @@ -4725,6 +5291,8 @@ diabgc 0, 0, 2 + 2, 0, 2 + 0,0,0 CFC12 concentration [mol CFC12 m-3] @@ -4735,6 +5303,8 @@ diabgc 0, 0, 2 + 2, 0, 2 + 0,0,0 SF6 concentration [mol SF6 m-3] @@ -4745,6 +5315,8 @@ diabgc 0, 0, 2 + 2, 0, 2 + 0,0,0 ndex of point diagnostics (i) @@ -4755,6 +5327,8 @@ diabgc 0, 0, 2 + 2, 0, 2 + 0,0,0 Mass sinking velocity (aggregate scheme) [m d-1] @@ -4765,6 +5339,8 @@ diabgc 0, 0, 2 + 2, 0, 2 + 0,0,0 Number sinking velocity (aggregate scheme) [m d-1] @@ -4775,6 +5351,8 @@ diabgc 0, 0, 0 + 0, 0, 0 + 0,0,0 Epsilon exponent (aggregate scheme) [1] @@ -4785,6 +5363,8 @@ diabgc 0, 0, 0 + 0, 0, 0 + 0,0,0 Average particle size (aggregate scheme) @@ -4805,6 +5385,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 @@ -4815,6 +5397,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 Phytoplankton (phyc) [mol C m-3] @@ -4825,6 +5409,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 Zooplankton (zooc) [mol C m-3] @@ -4835,6 +5421,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 Dissolved organic carbon (dissoc) [mol C m-3] @@ -4845,6 +5433,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 Primary production (pp) [mol C m-3 s-1] @@ -4855,6 +5445,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 Phosphorus (po4) [mol P m-3] @@ -4865,6 +5457,8 @@ diabgc 0, 4, 4 + 4, 4, 4 + 0,0,0 Oxygen (o2) [mol O2 m-3] @@ -4875,6 +5469,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 eposition @@ -4885,6 +5481,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 Nitrate (no3) [mol N m-3] @@ -4895,6 +5493,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 Alkalinity (talk) [eq m-3] @@ -4905,6 +5505,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 Silicate (si) [mol Si m-3] @@ -4915,6 +5517,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 Dissolved carbon (dissic) [mol C m-3] @@ -4925,6 +5529,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 Detrius (detoc) [mol C m-3] @@ -4935,6 +5541,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 CaCO3 shells (calc) [mol C m-3] @@ -4945,6 +5553,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 Opal shells (opal) [mol Si m-3] @@ -4955,6 +5565,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 ] @@ -4965,6 +5577,8 @@ diabgc 0, 0, 2 + 2, 2, 2 + 0,0,0 Nitrous oxide concentration [mol N2O m-3] @@ -4975,6 +5589,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 @@ -4985,6 +5601,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 Calcite saturation state (omegac) [1] @@ -4995,6 +5613,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 Aragonite saturation state (omegaa) [1] @@ -5005,6 +5625,8 @@ diabgc 0, 4, 4 + 4, 4, 4 + 0,0,0 preformed oxygen (p_o2) [mol O2 m-3] @@ -5025,6 +5647,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 preformed phosphate (p_po4) [mol PO4 m-3] @@ -5035,6 +5659,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 preformed alkalinity (p_talk) [eq m-3] @@ -5045,6 +5671,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 preformed DIC (p_dic) [mol C m-3] @@ -5055,6 +5683,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 saturated DIC (dic_sat) [mol C m-3] @@ -5065,6 +5695,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 Natural dissolved carbon (natdissic) [mol C m-3] @@ -5075,6 +5707,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 Natural alkalinity (nattalk) [eq m-3] @@ -5085,6 +5719,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 Natural carbonate ion concentration (natco3) [mol C m-3] @@ -5095,6 +5731,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 Natural CaCO3 shells (natcalc) [mol C m-3] @@ -5105,6 +5743,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 Natural pH (natph) [-log10([h+])] @@ -5115,6 +5755,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 Natural calcite saturation state (natomegac) [1] @@ -5125,6 +5767,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 Natural aragonite saturation state (natomegaa) [1] @@ -5135,6 +5779,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 Dissolved C13 (dissic13) [mol C m-3] @@ -5145,6 +5791,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 Dissolved C14 (dissic14) [mol C m-3] @@ -5155,6 +5803,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 delta 13C of DIC [1] @@ -5165,6 +5815,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 Particulate organic carbon 13 (detoc13) [mol C m-3] @@ -5175,6 +5827,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 Dissolved organic carbon 13 (dissoc13) [mol C m-3] @@ -5185,6 +5839,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 Particulate inorganic carbon 13 (calc13) [mol C m-3] @@ -5195,6 +5851,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 13C of phytoplankton biomass (phyc13) [mol C m-3] @@ -5205,6 +5863,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 13C of zootoplankton biomass (zooc13) [mol C m-3] @@ -5215,6 +5875,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 CFC11 concentration [mol CFC11 m-3] @@ -5225,6 +5887,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 CFC12 concentration [mol CFC12 m-3] @@ -5235,6 +5899,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 SF6 concentration [mol SF6 m-3] @@ -5245,6 +5911,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 Number of sinking particles (aggregate scheme, nos) [cm-3] @@ -5255,6 +5923,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 Mass sinking velocity (aggregate scheme) [m d-1] @@ -5265,6 +5935,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 Number sinking velocity (aggregate scheme) [m d-1] @@ -5275,6 +5947,8 @@ diabgc 0, 0, 0 + 0, 0, 0 + 0,0,0 Epsilon exponent (aggregate scheme) [1] @@ -5285,6 +5959,8 @@ diabgc 0, 0, 0 + 0, 0, 0 + 0,0,0 Average particle size (aggregate scheme) @@ -5295,6 +5971,8 @@ diabgc 0, 2, 2 + 2, 2, 2 + 0,0,0 @@ -5305,6 +5983,8 @@ diabgc 0, 0, 2 + 2, 0, 2 + 0,0,0 @@ -5315,6 +5995,8 @@ diabgc 0, 0, 2 + 2, 0, 2 + 0,0,0 @@ -5325,6 +6007,8 @@ diabgc 0, 0, 2 + 2, 0, 2 + 0,0,0 @@ -5335,6 +6019,8 @@ diabgc 0, 0, 2 + 2, 0, 2 + 0,0,0 sediment - water-column diffusive flux of oxygen [mol O2 m-2 s-1] @@ -5345,6 +6031,8 @@ diabgc 0, 0, 2 + 2, 0, 2 + 0,0,0 sediment - water-column diffusive flux of N2 [mol N2 m-2 s-1] @@ -5355,6 +6043,8 @@ diabgc 0, 0, 2 + 2, 0, 2 + 0,0,0 sediment - water-column diffusive flux of nitrate [mol NO3 m-2 s-1] @@ -5365,6 +6055,8 @@ diabgc 0, 0, 2 + 2, 0, 2 + 0,0,0 sediment - water-column diffusive flux of silica [mol Si m-2 s-1] @@ -5375,6 +6067,8 @@ diabgc 0, 0, 2 + 2, 0, 2 + 0,0,0 (powdic) [mol C m-3] @@ -5385,6 +6079,8 @@ diabgc 0, 0, 2 + 2, 0, 2 + 0,0,0 (powalk) [eq m-3] @@ -5395,6 +6091,8 @@ diabgc 0, 0, 2 + 2, 0, 2 + 0,0,0 (powpho) [eq m-3] @@ -5405,6 +6103,8 @@ diabgc 0, 0, 2 + 2, 0, 2 + 0,0,0 (powox) [mol O2 m-3] @@ -5415,6 +6115,8 @@ diabgc 0, 0, 2 + 2, 0, 2 + 0,0,0 (pown2) [mol N2 m-3] @@ -5425,6 +6127,8 @@ diabgc 0, 0, 2 + 2, 0, 2 + 0,0,0 (powno3)[mol N m-3] @@ -5435,6 +6139,8 @@ diabgc 0, 0, 2 + 2, 0, 2 + 0,0,0 (powsi) [mol Si m-3] @@ -5445,6 +6151,8 @@ diabgc 0, 0, 2 + 2, 0, 2 + 0,0,0 (ssso12) [mol m-3] @@ -5455,6 +6163,8 @@ diabgc 0, 0, 2 + 2, 0, 2 + 0,0,0 (ssssil) [mol Si m-3] @@ -5465,6 +6175,8 @@ diabgc 0, 0, 2 + 2, 0, 2 + 0,0,0 (sssc12) [mol C m-3] @@ -5475,6 +6187,8 @@ diabgc 0, 0, 2 + 2, 0, 2 + 0,0,0 (ssster) [mol m-3] @@ -5485,6 +6199,8 @@ diabgc 0, 0, 2 + 2, 0, 2 + 0,0,0 (ssso12) [mol m-3] @@ -5495,6 +6211,8 @@ diabgc 0, 0, 2 + 2, 0, 2 + 0,0,0 (ssssil) [mol Si m-3] @@ -5505,6 +6223,8 @@ diabgc 0, 0, 2 + 2, 0, 2 + 0,0,0 (sssc12) [mol C m-3] @@ -5515,6 +6235,8 @@ diabgc 0, 0, 2 + 2, 0, 2 + 0,0,0 (ssster) [mol m-3] diff --git a/cime_config/testdefs/testlist_blom.xml b/cime_config/testdefs/testlist_blom.xml index f54c99eb..cdddf99a 100644 --- a/cime_config/testdefs/testlist_blom.xml +++ b/cime_config/testdefs/testlist_blom.xml @@ -5,22 +5,22 @@ - + - + - + - + From 54b181b528ae3c25f037ba69070da42468eae849 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Mon, 31 Jul 2023 14:28:07 +0200 Subject: [PATCH 34/52] fixes for testing --- cime_config/buildcpp | 8 +- cime_config/config_component.xml | 12 - cime_config/namelist_definition_blom.xml | 778 +++++++++++------------ hamocc/hamocc4bcm.F90 | 1 - 4 files changed, 393 insertions(+), 406 deletions(-) diff --git a/cime_config/buildcpp b/cime_config/buildcpp index d1c46180..cc830111 100644 --- a/cime_config/buildcpp +++ b/cime_config/buildcpp @@ -141,10 +141,10 @@ def buildcpp(case): if hamocc_sedbypass: blom_cppdefs = blom_cppdefs + " -Dsedbypass" if hamocc_ciso: - expect(hamocc_sedbypass, - "HAMOCC C-isotopes currently not supported in the sediment module. Use HAMOCC_SEDBYPASS=TRUE") + expect(hamocc_sedbypass, "HAMOCC C-isotopes currently not supported in the sediment module. Use HAMOCC_SEDBYPASS=TRUE") blom_cppdefs = blom_cppdefs + " -Dcisonew" - if hamocc_vsls: + if ocn_grid in ["tnx1v4"]: + # HAMOCC will always compute bromoform flux and dms flux and send to the mediator blom_cppdefs = blom_cppdefs + " -DBROMO" if co2type == "prognostic": blom_cppdefs = blom_cppdefs + " -DPROGCO2" @@ -163,7 +163,7 @@ def buildcpp(case): blom_cppdefs = "-DMPI" + blom_cppdefs # update the xml variable BLOM_CPPDEFS with the above definition - # case.set_value("BLOM_CPPDEFS", blom_cppdefs) + #case.set_value("BLOM_CPPDEFS", blom_cppdefs) return blom_cppdefs diff --git a/cime_config/config_component.xml b/cime_config/config_component.xml index a38225a8..d1743b17 100644 --- a/cime_config/config_component.xml +++ b/cime_config/config_component.xml @@ -206,18 +206,6 @@ Set preprocessor option to activate the debugging mode for iHAMOCC. Requires module ecosys - - logical - TRUE,FALSE - FALSE - - TRUE - - build_component_blom - env_build.xml - Set preprocessor option to activate the VSLS-Bromoform tracer code. Requires module ecosys - - char diff --git a/cime_config/namelist_definition_blom.xml b/cime_config/namelist_definition_blom.xml index 6e83ac18..2c5720df 100644 --- a/cime_config/namelist_definition_blom.xml +++ b/cime_config/namelist_definition_blom.xml @@ -3442,7 +3442,7 @@ merdia merdia - 2, 4 + 2,4 Array of mask flags in ocean regions file to be included for region (1) @@ -3529,7 +3529,7 @@ bgcnml UNSET - $DIN_LOC_ROOT/ocn/blom/bndcon/Annual_clim_swa_tnx1v4_20210415.nc + $DIN_LOC_ROOT/ocn/blom/bndcon/Annual_clim_swa_tnx1v4_20210415.nc abs File name (incl. full path) for swa climatology field (needed if bromoform scheme is activated) @@ -3924,7 +3924,7 @@ diabgc diabgc - 0, 1, 0 + 0,1,0 @@ -3934,8 +3934,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 Phosphorus (po4) [mol P m-3] @@ -3946,8 +3946,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 Oxygen (o2) [mol O2 m-3] @@ -3958,8 +3958,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 Dissolved iron (dfe) [mol Fe m-3] @@ -3970,8 +3970,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 Nitrate (no3) [mol N m-3] @@ -3982,8 +3982,8 @@ diabgc diabgc - 4, 2, 2 - 4, 2, 2 + 4,2,2 + 4,2,2 0,0,0 Natural alkalinity (nattalk) [eq m-3] @@ -3994,8 +3994,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 @@ -4006,8 +4006,8 @@ diabgc diabgc - 4, 2, 2 - 4, 2, 2 + 4,2,2 + 4,2,2 0,0,0 Dissolved carbon (dissic) [mol C m-3] @@ -4018,8 +4018,8 @@ diabgc diabgc - 4, 2, 2 - 4, 2, 2 + 4,2,2 + 4,2,2 0,0,0 Phytoplankton (phyc) [mol C m-3] @@ -4030,8 +4030,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 pH (ph) [-log10([h+])] @@ -4042,8 +4042,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 Export production (epc100) [mol C m-2 s-1] @@ -4054,8 +4054,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 Si export production (epsi100) [mol Si m-2 s-1] @@ -4066,8 +4066,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 Ca export production (epcalc100) [mol Ca m-2 s-1] @@ -4078,8 +4078,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 Piston velocity (kwco2) [m s-1] @@ -4090,8 +4090,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 Piston velocity times solubility (kwco2*kh; moist air) [m s-1 mol kg-1 uatm-1] @@ -4102,8 +4102,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 Piston velocity times solubility (kwco2*kh; moist air) [m s-1 mol kg-1 uatm-1] @@ -4114,8 +4114,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 CO2 solubility under moist air assumption (kh) [mol kg-1 atm-1] @@ -4126,8 +4126,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 Natural surface PCO2 (spco2) [uatm] @@ -4138,8 +4138,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 Surface PCO2 under moist air assumption [uatm] @@ -4150,8 +4150,8 @@ diabgc diabgc - 4, 2, 2 - 2, 2, 2 + 4,2,2 + 4,2,2 0,0,0 Downward CO2 flux (co2fxd) [kg C m-2 s-1] @@ -4162,8 +4162,8 @@ diabgc diabgc - 4, 2, 2 - 2, 2, 2 + 4,2,2 + 4,2,2 0,0,0 Upward CO2 flux (co2fxu) [kg C m-2 s-1] @@ -4174,8 +4174,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 Oxygen flux (fgo2) [mol O2 m-2 s-1] @@ -4186,8 +4186,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 Nitrogen flux (fgn2) [mol N2 m-2 s-1] @@ -4198,8 +4198,8 @@ diabgc diabgc - 0, 0, 2 - 2, 2, 2 + 0,0,2 + 4,2,2 0,0,0 Nitrous oxide flux [mol N2O m-2 s-1] @@ -4210,8 +4210,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 DMS flux (dmsflux) [mol DMS m-2 s-1] @@ -4222,8 +4222,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 surface DMS concentration (dms) [mol DMS m-3] @@ -4234,8 +4234,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 DMS production (dmsprod) [mol DMS m-2 s-1] @@ -4246,8 +4246,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 DMS bacterial consuption (dms_bac) [mol DMS m-2 s-1] @@ -4258,8 +4258,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 DMS decomposition by UV (dms_uv) [mol DMS m-2 s-1] @@ -4270,8 +4270,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 Atmospheric CO2 (atmco2) [ppm] @@ -4282,8 +4282,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 Atmospheric O2 (atmo2) [ppm] @@ -4294,8 +4294,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 Atmospheric N2 (atmn2) [ppm] @@ -4306,8 +4306,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 Natural dissolved carbon (natdissic) [mol C m-3] @@ -4318,8 +4318,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 Natural alkalinity (nattalk) [eq m-3] @@ -4330,8 +4330,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 Natural pH (natph) [-log10([h+])] @@ -4342,8 +4342,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 Natural surface PCO2 (spco2) [uatm] @@ -4354,8 +4354,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 Natural net CO2 flux (natco2fx) [kg C m-2 s-1] @@ -4366,8 +4366,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 0,2,2 0,0,0 Downward 13CO2 flux (co213fxd) [kg C m-2 s-1] @@ -4378,8 +4378,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 0,2,2 0,0,0 Upward 13CO2 flux (co213fxu) [kg C m-2 s-1] @@ -4390,8 +4390,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 Downward 14CO2 flux (co214fxd) [kg C m-2 s-1] @@ -4402,8 +4402,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 Upward 14CO2 flux (co214fxu) [kg C m-2 s-1] @@ -4414,8 +4414,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 CFC11 flux [mol CFC11 m-2 s-1] @@ -4426,8 +4426,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 CFC12 flux [mol CFC12 m-2 s-1] @@ -4438,8 +4438,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 SF6 flux [mol SF6 m-2 s-1] @@ -4450,8 +4450,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 @@ -4462,8 +4462,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 @@ -4474,8 +4474,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 @@ -4486,8 +4486,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 @@ -4498,8 +4498,8 @@ diabgc diabgc - 4, 2, 2 - 2, 2, 2 + 4,2,2 + 4,2,2 0,0,0 Primary production (pp) [mol C m-3 s-1] @@ -4510,8 +4510,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 Vertically integrated nitrogen fixation @@ -4522,8 +4522,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 Vertically integrated denitrification @@ -4535,8 +4535,8 @@ diabgc 0,0,0 - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 Nitrogen deposition flux [mol N m-2 s-1] @@ -4546,8 +4546,8 @@ diabgc diabgc - 0, 0, 0 - 0, 0, 0 + 0,0,0 + 0,0,0 0,0,0 AMELIST FOR DIAGNOSTIC iHAMOCC OUTPUT @@ -4558,8 +4558,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 @@ -4570,8 +4570,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 @@ -4582,8 +4582,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 @@ -4594,8 +4594,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 @@ -4606,8 +4606,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 @@ -4618,8 +4618,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 @@ -4630,8 +4630,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 @@ -4642,8 +4642,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 @@ -4654,8 +4654,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 @@ -4666,8 +4666,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 @@ -4678,8 +4678,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 @@ -4690,8 +4690,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 @@ -4702,8 +4702,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 @@ -4714,8 +4714,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 @@ -4726,8 +4726,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 @@ -4738,8 +4738,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 @@ -4750,8 +4750,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 @@ -4762,8 +4762,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 @@ -4774,8 +4774,8 @@ diabgc diabgc - 0, 0, 2 - 2, 2, 2 + 0,0,2 + 4,2,2 0,0,0 @@ -4786,8 +4786,8 @@ diabgc diabgc - 0, 0, 2 - 2, 2, 2 + 0,0,2 + 4,2,2 0,0,0 @@ -4798,8 +4798,8 @@ diabgc diabgc - 0, 0, 2 - 2, 2, 2 + 0,0,2 + 4,2,2 0,0,0 @@ -4810,8 +4810,8 @@ diabgc diabgc - 0, 0, 2 - 2, 2, 2 + 0,0,2 + 4,2,2 0,0,0 @@ -4822,8 +4822,8 @@ diabgc diabgc - 0, 0, 2 - 2, 2, 2 + 0,0,2 + 4,2,2 0,0,0 Phosphorus (po4) [mol P m-3] @@ -4834,8 +4834,8 @@ diabgc diabgc - 0, 0, 4 - 4, 0, 4 + 0,0,4 + 4,0,4 0,0,0 Oxygen (o2) [mol O2 m-3] @@ -4846,8 +4846,8 @@ diabgc diabgc - 0, 0, 2 - 2, 0, 2 + 0,0,2 + 2,0,2 0,0,0 Dissolved iron (dfe) [mol Fe m-3] @@ -4858,8 +4858,8 @@ diabgc diabgc - 0, 0, 2 - 2, 0, 2 + 0,0,2 + 2,0,2 0,0,0 @@ -4870,8 +4870,8 @@ diabgc diabgc - 0, 0, 2 - 2, 0, 2 + 0,0,2 + 2,0,2 0,0,0 @@ -4882,8 +4882,8 @@ diabgc diabgc - 0, 0, 2 - 2, 0, 2 + 0,0,2 + 2,0,2 0,0,0 @@ -4894,8 +4894,8 @@ diabgc diabgc - 0, 0, 2 - 2, 0, 2 + 0,0,2 + 2,0,2 0,0,0 @@ -4906,8 +4906,8 @@ diabgc diabgc - 0, 0, 2 - 2, 0, 2 + 0,0,2 + 2,0,2 0,0,0 @@ -4918,8 +4918,8 @@ diabgc diabgc - 0, 0, 2 - 2, 0, 2 + 0,0,2 + 2,0,2 0,0,0 CaCO3 shells (calc) [mol C m-3] @@ -4930,8 +4930,8 @@ diabgc diabgc - 0, 0, 2 - 2, 0, 2 + 0,0,2 + 2,0,2 0,0,0 Opal shells (opal) [mol Si m-3] @@ -4942,8 +4942,8 @@ diabgc diabgc - 0, 0, 2 - 2, 0, 2 + 0,0,2 + 2,0,2 0,0,0 Carbonate ions (co3) [mol C m-3] @@ -4954,8 +4954,8 @@ diabgc diabgc - 0, 0, 0 - 0, 0, 0 + 0,0,0 + 0,0,0 0,0,0 Nitrous oxide concentration [mol N2O m-3] @@ -4966,8 +4966,8 @@ diabgc diabgc - 0, 0, 2 - 2, 0, 2 + 0,0,2 + 2,0,2 0,0,0 @@ -4978,8 +4978,8 @@ diabgc diabgc - 0, 0, 2 - 2, 0, 2 + 0,0,2 + 2,0,2 0,0,0 Calcite saturation state (omegac) [1] @@ -4990,8 +4990,8 @@ diabgc diabgc - 0, 0, 2 - 2, 0, 2 + 0,0,2 + 2,0,2 0,0,0 Natural aragonite saturation state (natomegaa) [1] @@ -5002,8 +5002,8 @@ diabgc diabgc - 0, 0, 4 - 4, 0, 4 + 0,0,4 + 4,0,4 0,0,0 preformed oxygen (p_o2) [mol O2 m-3] @@ -5014,8 +5014,8 @@ diabgc diabgc - 0, 0, 4 - 4, 0, 4 + 0,0,4 + 4,0,4 0,0,0 Saturated oxygen (satoxy) [mol O2 m-3] @@ -5026,8 +5026,8 @@ diabgc diabgc - 0, 0, 2 - 2, 0, 2 + 0,0,2 + 2,0,2 0,0,0 @@ -5038,8 +5038,8 @@ diabgc diabgc - 0, 0, 2 - 2, 0, 2 + 0,0,2 + 2,0,2 0,0,0 preformed alkalinity (p_talk) [eq m-3] @@ -5050,8 +5050,8 @@ diabgc diabgc - 0, 0, 2 - 2, 0, 2 + 0,0,2 + 2,0,2 0,0,0 preformed DIC (p_dic) [mol C m-3] @@ -5062,8 +5062,8 @@ diabgc diabgc - 0, 0, 2 - 2, 0, 2 + 0,0,2 + 2,0,2 0,0,0 saturated DIC (dic_sat) [mol C m-3] @@ -5074,8 +5074,8 @@ diabgc diabgc - 0, 0, 2 - 2, 0, 2 + 0,0,2 + 2,0,2 0,0,0 Natural dissolved carbon (natdissic) [mol C m-3] @@ -5086,8 +5086,8 @@ diabgc diabgc - 0, 0, 2 - 2, 0, 2 + 0,0,2 + 2,0,2 0,0,0 Natural alkalinity (nattalk) [eq m-3] @@ -5098,8 +5098,8 @@ diabgc diabgc - 0, 0, 2 - 2, 0, 2 + 0,0,2 + 2,0,2 0,0,0 Natural carbonate ion concentration (natco3) [mol C m-3] @@ -5110,8 +5110,8 @@ diabgc diabgc - 0, 0, 2 - 2, 0, 2 + 0,0,2 + 2,0,2 0,0,0 Natural CaCO3 shells (natcalc) [mol C m-3] @@ -5122,8 +5122,8 @@ diabgc diabgc - 0, 0, 2 - 2, 0, 2 + 0,0,2 + 2,0,2 0,0,0 Natural pH (natph) [-log10([h+])] @@ -5134,8 +5134,8 @@ diabgc diabgc - 0, 0, 2 - 2, 0, 2 + 0,0,2 + 2,0,2 0,0,0 Natural calcite saturation state (natomegac) [1] @@ -5146,8 +5146,8 @@ diabgc diabgc - 0, 0, 2 - 2, 0, 2 + 0,0,2 + 2,0,2 0,0,0 Natural aragonite saturation state (natomegaa) [1] @@ -5158,8 +5158,8 @@ diabgc diabgc - 0, 0, 2 - 2, 0, 2 + 0,0,2 + 2,0,2 0,0,0 Dissolved C13 (dissic13) [mol C m-3] @@ -5170,8 +5170,8 @@ diabgc diabgc - 0, 0, 2 - 2, 0, 2 + 0,0,2 + 2,0,2 0,0,0 Dissolved C14 (dissic14) [mol C m-3] @@ -5182,8 +5182,8 @@ diabgc diabgc - 0, 0, 2 - 2, 0, 2 + 0,0,2 + 0,0,2 0,0,0 at-depth variable sediment porosity (as opposed to default: only depth) @@ -5194,8 +5194,8 @@ diabgc diabgc - 0, 0, 2 - 2, 0, 2 + 0,0,2 + 0,0,2 0,0,0 delta 14C of DIC [1] @@ -5206,8 +5206,8 @@ diabgc diabgc - 0, 0, 2 - 2, 0, 2 + 0,0,2 + 0,0,2 0,0,0 Delta 14C of DIC [1] @@ -5218,8 +5218,8 @@ diabgc diabgc - 0, 0, 2 - 2, 0, 2 + 0,0,2 + 0,0,2 0,0,0 Particulate organic carbon 13 (detoc13) [mol C m-3] @@ -5230,8 +5230,8 @@ diabgc diabgc - 0, 0, 2 - 2, 0, 2 + 0,0,2 + 0,0,2 0,0,0 Dissolved organic carbon 13 (dissoc13) [mol C m-3] @@ -5242,8 +5242,8 @@ diabgc diabgc - 0, 0, 2 - 2, 0, 2 + 0,0,2 + 0,0,2 0,0,0 Particulate inorganic carbon 13 (calc13) [mol C m-3] @@ -5254,8 +5254,8 @@ diabgc diabgc - 0, 0, 2 - 2, 0, 2 + 0,0,2 + 0,0,2 0,0,0 13C of phytoplankton biomass (phyc13) [mol C m-3] @@ -5266,8 +5266,8 @@ diabgc diabgc - 0, 0, 2 - 2, 0, 2 + 0,0,2 + 0,0,2 0,0,0 13C of zootoplankton biomass (zooc13) [mol C m-3] @@ -5278,8 +5278,8 @@ diabgc diabgc - 0, 0, 2 - 2, 0, 2 + 0,0,2 + 0,0,2 0,0,0 CFC11 concentration [mol CFC11 m-3] @@ -5290,8 +5290,8 @@ diabgc diabgc - 0, 0, 2 - 2, 0, 2 + 0,0,2 + 0,0,2 0,0,0 CFC12 concentration [mol CFC12 m-3] @@ -5302,8 +5302,8 @@ diabgc diabgc - 0, 0, 2 - 2, 0, 2 + 0,0,2 + 0,0,2 0,0,0 SF6 concentration [mol SF6 m-3] @@ -5314,11 +5314,11 @@ diabgc diabgc - 0, 0, 2 - 2, 0, 2 + 0,0,2 + 0,0,2 0,0,0 - ndex of point diagnostics (i) + index of point diagnostics (i) @@ -5326,8 +5326,8 @@ diabgc diabgc - 0, 0, 2 - 2, 0, 2 + 0,0,2 + 0,0,2 0,0,0 Mass sinking velocity (aggregate scheme) [m d-1] @@ -5338,8 +5338,8 @@ diabgc diabgc - 0, 0, 2 - 2, 0, 2 + 0,0,2 + 0,0,2 0,0,0 Number sinking velocity (aggregate scheme) [m d-1] @@ -5350,8 +5350,8 @@ diabgc diabgc - 0, 0, 0 - 0, 0, 0 + 0,0,0 + 0,0,0 0,0,0 Epsilon exponent (aggregate scheme) [1] @@ -5362,8 +5362,8 @@ diabgc diabgc - 0, 0, 0 - 0, 0, 0 + 0,0,0 + 0,0,0 0,0,0 Average particle size (aggregate scheme) @@ -5374,7 +5374,7 @@ diabgc diabgc - 0, 0, 2 + 0,0,2 @@ -5384,8 +5384,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 0,2,2 0,0,0 @@ -5396,8 +5396,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 Phytoplankton (phyc) [mol C m-3] @@ -5408,8 +5408,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 Zooplankton (zooc) [mol C m-3] @@ -5420,8 +5420,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 Dissolved organic carbon (dissoc) [mol C m-3] @@ -5432,8 +5432,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 Primary production (pp) [mol C m-3 s-1] @@ -5444,8 +5444,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 Phosphorus (po4) [mol P m-3] @@ -5456,8 +5456,8 @@ diabgc diabgc - 0, 4, 4 - 4, 4, 4 + 0,4,4 + 4,4,4 0,0,0 Oxygen (o2) [mol O2 m-3] @@ -5468,8 +5468,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 eposition @@ -5480,8 +5480,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 Nitrate (no3) [mol N m-3] @@ -5492,8 +5492,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 Alkalinity (talk) [eq m-3] @@ -5504,8 +5504,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 Silicate (si) [mol Si m-3] @@ -5516,8 +5516,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 Dissolved carbon (dissic) [mol C m-3] @@ -5528,8 +5528,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 Detrius (detoc) [mol C m-3] @@ -5540,8 +5540,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 CaCO3 shells (calc) [mol C m-3] @@ -5552,8 +5552,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 Opal shells (opal) [mol Si m-3] @@ -5564,8 +5564,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 ] @@ -5576,8 +5576,8 @@ diabgc diabgc - 0, 0, 2 - 2, 2, 2 + 0,0,2 + 4,2,2 0,0,0 Nitrous oxide concentration [mol N2O m-3] @@ -5588,8 +5588,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 @@ -5600,8 +5600,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 Calcite saturation state (omegac) [1] @@ -5612,8 +5612,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 Aragonite saturation state (omegaa) [1] @@ -5624,8 +5624,8 @@ diabgc diabgc - 0, 4, 4 - 4, 4, 4 + 0,4,4 + 4,4,4 0,0,0 preformed oxygen (p_o2) [mol O2 m-3] @@ -5636,7 +5636,7 @@ diabgc diabgc - 0, 4, 4 + 0,4,4 Saturated oxygen (satoxy) [mol O2 m-3] @@ -5646,8 +5646,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 preformed phosphate (p_po4) [mol PO4 m-3] @@ -5658,8 +5658,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 preformed alkalinity (p_talk) [eq m-3] @@ -5670,8 +5670,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 preformed DIC (p_dic) [mol C m-3] @@ -5682,8 +5682,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 saturated DIC (dic_sat) [mol C m-3] @@ -5694,8 +5694,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 Natural dissolved carbon (natdissic) [mol C m-3] @@ -5706,8 +5706,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 Natural alkalinity (nattalk) [eq m-3] @@ -5718,8 +5718,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 Natural carbonate ion concentration (natco3) [mol C m-3] @@ -5730,8 +5730,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 Natural CaCO3 shells (natcalc) [mol C m-3] @@ -5742,8 +5742,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 Natural pH (natph) [-log10([h+])] @@ -5754,8 +5754,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 Natural calcite saturation state (natomegac) [1] @@ -5766,8 +5766,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 Natural aragonite saturation state (natomegaa) [1] @@ -5778,8 +5778,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 Dissolved C13 (dissic13) [mol C m-3] @@ -5790,8 +5790,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 Dissolved C14 (dissic14) [mol C m-3] @@ -5802,8 +5802,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 delta 13C of DIC [1] @@ -5814,8 +5814,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 Particulate organic carbon 13 (detoc13) [mol C m-3] @@ -5826,8 +5826,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 Dissolved organic carbon 13 (dissoc13) [mol C m-3] @@ -5838,8 +5838,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 Particulate inorganic carbon 13 (calc13) [mol C m-3] @@ -5850,8 +5850,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 13C of phytoplankton biomass (phyc13) [mol C m-3] @@ -5862,8 +5862,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 13C of zootoplankton biomass (zooc13) [mol C m-3] @@ -5874,8 +5874,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 CFC11 concentration [mol CFC11 m-3] @@ -5886,8 +5886,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 CFC12 concentration [mol CFC12 m-3] @@ -5898,8 +5898,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 SF6 concentration [mol SF6 m-3] @@ -5910,11 +5910,11 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 - Number of sinking particles (aggregate scheme, nos) [cm-3] + Number of sinking particles (aggregate scheme,nos) [cm-3] @@ -5922,8 +5922,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 Mass sinking velocity (aggregate scheme) [m d-1] @@ -5934,8 +5934,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 Number sinking velocity (aggregate scheme) [m d-1] @@ -5946,8 +5946,8 @@ diabgc diabgc - 0, 0, 0 - 0, 0, 0 + 0,0,0 + 0,0,0 0,0,0 Epsilon exponent (aggregate scheme) [1] @@ -5958,8 +5958,8 @@ diabgc diabgc - 0, 0, 0 - 0, 0, 0 + 0,0,0 + 0,0,0 0,0,0 Average particle size (aggregate scheme) @@ -5970,8 +5970,8 @@ diabgc diabgc - 0, 2, 2 - 2, 2, 2 + 0,2,2 + 4,2,2 0,0,0 @@ -5982,8 +5982,8 @@ diabgc diabgc - 0, 0, 2 - 2, 0, 2 + 0,0,2 + 2,0,2 0,0,0 @@ -5994,8 +5994,8 @@ diabgc diabgc - 0, 0, 2 - 2, 0, 2 + 0,0,2 + 2,0,2 0,0,0 @@ -6006,8 +6006,8 @@ diabgc diabgc - 0, 0, 2 - 2, 0, 2 + 0,0,2 + 2,0,2 0,0,0 @@ -6018,8 +6018,8 @@ diabgc diabgc - 0, 0, 2 - 2, 0, 2 + 0,0,2 + 2,0,2 0,0,0 sediment - water-column diffusive flux of oxygen [mol O2 m-2 s-1] @@ -6030,8 +6030,8 @@ diabgc diabgc - 0, 0, 2 - 2, 0, 2 + 0,0,2 + 2,0,2 0,0,0 sediment - water-column diffusive flux of N2 [mol N2 m-2 s-1] @@ -6042,8 +6042,8 @@ diabgc diabgc - 0, 0, 2 - 2, 0, 2 + 0,0,2 + 2,0,2 0,0,0 sediment - water-column diffusive flux of nitrate [mol NO3 m-2 s-1] @@ -6054,8 +6054,8 @@ diabgc diabgc - 0, 0, 2 - 2, 0, 2 + 0,0,2 + 2,0,2 0,0,0 sediment - water-column diffusive flux of silica [mol Si m-2 s-1] @@ -6066,8 +6066,8 @@ diabgc diabgc - 0, 0, 2 - 2, 0, 2 + 0,0,2 + 2,0,2 0,0,0 (powdic) [mol C m-3] @@ -6078,8 +6078,8 @@ diabgc diabgc - 0, 0, 2 - 2, 0, 2 + 0,0,2 + 2,0,2 0,0,0 (powalk) [eq m-3] @@ -6090,8 +6090,8 @@ diabgc diabgc - 0, 0, 2 - 2, 0, 2 + 0,0,2 + 2,0,2 0,0,0 (powpho) [eq m-3] @@ -6102,8 +6102,8 @@ diabgc diabgc - 0, 0, 2 - 2, 0, 2 + 0,0,2 + 2,0,2 0,0,0 (powox) [mol O2 m-3] @@ -6114,8 +6114,8 @@ diabgc diabgc - 0, 0, 2 - 2, 0, 2 + 0,0,2 + 2,0,2 0,0,0 (pown2) [mol N2 m-3] @@ -6126,8 +6126,8 @@ diabgc diabgc - 0, 0, 2 - 2, 0, 2 + 0,0,2 + 2,0,2 0,0,0 (powno3)[mol N m-3] @@ -6138,8 +6138,8 @@ diabgc diabgc - 0, 0, 2 - 2, 0, 2 + 0,0,2 + 2,0,2 0,0,0 (powsi) [mol Si m-3] @@ -6150,8 +6150,8 @@ diabgc diabgc - 0, 0, 2 - 2, 0, 2 + 0,0,2 + 2,0,2 0,0,0 (ssso12) [mol m-3] @@ -6162,8 +6162,8 @@ diabgc diabgc - 0, 0, 2 - 2, 0, 2 + 0,0,2 + 2,0,2 0,0,0 (ssssil) [mol Si m-3] @@ -6174,8 +6174,8 @@ diabgc diabgc - 0, 0, 2 - 2, 0, 2 + 0,0,2 + 2,0,2 0,0,0 (sssc12) [mol C m-3] @@ -6186,8 +6186,8 @@ diabgc diabgc - 0, 0, 2 - 2, 0, 2 + 0,0,2 + 2,0,2 0,0,0 (ssster) [mol m-3] @@ -6198,8 +6198,8 @@ diabgc diabgc - 0, 0, 2 - 2, 0, 2 + 0,0,2 + 2,0,2 0,0,0 (ssso12) [mol m-3] @@ -6210,8 +6210,8 @@ diabgc diabgc - 0, 0, 2 - 2, 0, 2 + 0,0,2 + 2,0,2 0,0,0 (ssssil) [mol Si m-3] @@ -6222,8 +6222,8 @@ diabgc diabgc - 0, 0, 2 - 2, 0, 2 + 0,0,2 + 2,0,2 0,0,0 (sssc12) [mol C m-3] @@ -6234,8 +6234,8 @@ diabgc diabgc - 0, 0, 2 - 2, 0, 2 + 0,0,2 + 2,0,2 0,0,0 (ssster) [mol m-3] diff --git a/hamocc/hamocc4bcm.F90 b/hamocc/hamocc4bcm.F90 index e4d2760a..19d9fdbc 100644 --- a/hamocc/hamocc4bcm.F90 +++ b/hamocc/hamocc4bcm.F90 @@ -197,7 +197,6 @@ SUBROUTINE HAMOCC4BCM(kpie,kpje,kpke,kbnd,kplyear,kplmon,kplday,kldtday,& ENDDO !$OMP END PARALLEL DO if (mnproc.eq.1) write (io_stdo_bgc,*) 'iHAMOCC: getting bromoform from atm' - endif #endif !-------------------------------------------------------------------- From b946566f9f93cc46eb1d15a24d3ec1eb1e120f2f Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Mon, 31 Jul 2023 15:33:41 +0200 Subject: [PATCH 35/52] fixed setting of do_bgc_aofluxes --- drivers/nuopc/mod_nuopc_methods.F90 | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/nuopc/mod_nuopc_methods.F90 b/drivers/nuopc/mod_nuopc_methods.F90 index 001d4852..7143d1cf 100644 --- a/drivers/nuopc/mod_nuopc_methods.F90 +++ b/drivers/nuopc/mod_nuopc_methods.F90 @@ -126,11 +126,6 @@ module mod_nuopc_methods ! Set logicals for CPP variables -#ifdef HAMOCC - ! Set the logical flag do_bgc_aofluxes to true in mo_control_bgc - logical :: do_bgc_aofluxes = .false. - !logical :: do_bgc_aofluxes = .true. !DEBUG -#endif #ifdef BROMO logical :: do_bromo = .true. #else @@ -172,6 +167,12 @@ subroutine fldlist_add(num, fldlist, stdname, index, ungridded_lbound, ungridded ! Local variables. integer :: rc +#ifdef HAMOCC + ! Set the logical flag do_bgc_aofluxes to false in mo_control_bgc since + ! for nuopc/cmeps the dms and bromo fluxes will be computed in the mediator + do_bgc_aofluxes = .false. +#endif + num = num + 1 if (num > fldsMax) then write(lp,'(a,3i6,2(f21.13,3x),d21.5)') subname// & From b3d13264ad6d9f157aa3762e78704eac7172c7e1 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Tue, 1 Aug 2023 13:59:18 +0200 Subject: [PATCH 36/52] removed the majority of #ifdefs in HAMOCC other than PNETCDF --- cesm/mod_cesm.F90 | 9 +- drivers/nuopc/mod_nuopc_methods.F90 | 36 +- hamocc/accfields.F90 | 378 +++---- hamocc/aufr_bgc.F90 | 562 +++++----- hamocc/aufw_bgc.F90 | 705 ++++++------ hamocc/beleg_parm.F90 | 304 +++-- hamocc/beleg_vars.F90 | 272 ++--- hamocc/carchm.F90 | 476 ++++---- hamocc/cyano.F90 | 10 +- hamocc/dipowa.F90 | 25 +- hamocc/hamocc4bcm.F90 | 318 +++--- hamocc/hamocc_init.F90 | 34 +- hamocc/inventory_bgc.F90 | 1392 ++++++++++++----------- hamocc/mo_apply_ndep.F90 | 7 +- hamocc/mo_apply_rivin.F90 | 13 +- hamocc/mo_bgcmean.F90 | 519 ++++----- hamocc/mo_biomod.F90 | 174 ++- hamocc/mo_carbch.F90 | 138 ++- hamocc/mo_ifdefs.F90 | 72 ++ hamocc/mo_intfcblom.F90 | 272 ++--- hamocc/mo_param1_bgc.F90 | 11 +- hamocc/mo_sedmnt.F90 | 269 ++--- hamocc/ncout_hamocc.F90 | 1198 ++++++++++---------- hamocc/ocprod.F90 | 1619 +++++++++++++-------------- hamocc/powach.F90 | 250 +++-- hamocc/profile_gd.F90 | 38 +- hamocc/sedshi.F90 | 35 +- trc/restart_trcrd.F90 | 50 +- 28 files changed, 4641 insertions(+), 4545 deletions(-) create mode 100644 hamocc/mo_ifdefs.F90 diff --git a/cesm/mod_cesm.F90 b/cesm/mod_cesm.F90 index ac2955d7..83a7d3bb 100644 --- a/cesm/mod_cesm.F90 +++ b/cesm/mod_cesm.F90 @@ -36,6 +36,7 @@ module mod_cesm use mod_checksum, only: csdiag, chksummsk #ifdef HAMOCC use mo_control_bgc, only: do_bgc_aofluxes + use mo_ifdefs, only: use_bromo #endif implicit none @@ -90,12 +91,6 @@ module mod_cesm integer :: & l1ci, l2ci ! Time-level indices for time smoothing of CESM fields. -#ifdef BROMO - logical :: do_bromo = .true. -#else - logical :: do_bromo = .false. -#endif - public :: runid_cesm, runtyp_cesm, ocn_cpl_dt_cesm, nstep_in_cpl, hmlt, & frzpot, mltpot, swa_da, nsf_da, hmlt_da, lip_da, sop_da, eva_da, & rnf_da, rfi_da, fmltfz_da, sfl_da, ztx_da, mty_da, ustarw_da, & @@ -204,7 +199,7 @@ subroutine getfrc_cesm if (.not. do_bgc_aofluxes) then ! flxdms is obtained from the mediator flxdms(i, j) = w1*flxdms_da(i, j, l1ci) + w2*flxdms_da(i, j, l2ci) - if (do_bromo) then + if (use_bromo) then ! flxbrf is obtained from the mediator flxbrf(i, j) = w1*flxbrf_da(i, j, l1ci) + w2*flxbrf_da(i, j, l2ci) end if diff --git a/drivers/nuopc/mod_nuopc_methods.F90 b/drivers/nuopc/mod_nuopc_methods.F90 index 7143d1cf..f30249b9 100644 --- a/drivers/nuopc/mod_nuopc_methods.F90 +++ b/drivers/nuopc/mod_nuopc_methods.F90 @@ -47,6 +47,7 @@ module mod_nuopc_methods use mo_carbch, only: ocetra use mo_param1_bgc, only: idms, ibromo use mo_control_bgc, only: do_bgc_aofluxes + use mo_ifdefs #endif implicit none @@ -126,21 +127,7 @@ module mod_nuopc_methods ! Set logicals for CPP variables -#ifdef BROMO - logical :: do_bromo = .true. -#else - logical :: do_bromo = .false. -#endif -#ifdef PROGCO2 - logical :: progco2 = .true. -#else - logical :: progco2 = .false. -#endif -#ifdef DIAGCO2 - logical :: diagco2 = .true. -#else - logical :: diagco2 = .false. -#endif + contains @@ -234,12 +221,13 @@ subroutine blom_advertise_imports(flds_scalar_name, fldsToOcn_num, fldsToOcn, & call fldlist_add(fldsToOcn_num, fldsToOcn, 'Foxx_lwup' , index_Foxx_lwup) call fldlist_add(fldsToOcn_num, fldsToOcn, 'Foxx_evap' , index_Foxx_evap) call fldlist_add(fldsToOcn_num, fldsToOcn, 'Foxx_swnet' , index_Foxx_swnet) - if (.not. do_bgc_aofluxes) then +#ifdef HAMOCC call fldlist_add(fldsToOcn_num, fldsToOcn, 'Faox_dms', index_Faox_dms) - if (do_bromo) then + if (use_BROMO) then call fldlist_add(fldsToOcn_num, fldsToOcn, 'Faox_brf', index_Faox_brf) end if end if +#endif ! From wave: if (wavsrc_opt == wavsrc_extern) then @@ -287,12 +275,12 @@ subroutine blom_advertise_exports(flds_scalar_name, fldsFrOcn_num, fldsFrOcn) call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'So_bldepth' , index_So_bldepth) call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'Fioo_q' , index_Fioo_q) call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'Faoo_fco2_ocn' , index_Faoo_fco2_ocn) - if (.not. do_bgc_aofluxes) then - call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'So_dms', index_So_dms) - if (do_bromo) then - call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'So_brf', index_So_brf) - end if +#ifdef HAMOCC + call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'So_dms', index_So_dms) + if (use_BROMO) then + call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'So_brf', index_So_brf) end if +#endif end subroutine blom_advertise_exports subroutine blom_logwrite(msg) @@ -868,9 +856,9 @@ subroutine blom_importflds(fldlist_num, fldlist) ! CO2 flux - if (diagco2 .and. index_Sa_co2diag > 0) then + if (use_DIAGCO2 .and. index_Sa_co2diag > 0) then index_co2 = index_Sa_co2diag - else if (progco2 .and. index_Sa_co2prog > 0) then + else if (use_PROGCO2 .and. index_Sa_co2prog > 0) then index_co2 = index_Sa_co2prog else index_co2 = -1 diff --git a/hamocc/accfields.F90 b/hamocc/accfields.F90 index 3edce9a7..fa494c2d 100644 --- a/hamocc/accfields.F90 +++ b/hamocc/accfields.F90 @@ -73,42 +73,44 @@ SUBROUTINE ACCFIELDS(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask) & ioxygen,iphosph,iphy,iprefalk,iprefdic,iprefpo4,iprefo2,isco212,isilica,izoo, & & irdin,irdip,irsi,iralk,iriron,irdoc,irdet -#ifdef AGG + ! AGG use mo_biomod, only: asize3d,eps3d,wnumb,wmass use mo_param1_bgc, only: inos use mo_control_bgc, only: dtb -#endif -#ifdef BROMO + + ! BROMO use mo_param1_bgc, only: iatmbromo,ibromo use mo_biomod, only: int_chbr3_prod,int_chbr3_uv use mo_bgcmean, only: jatmbromo,jbromo,jbromo_prod,jbromo_uv,jbromofx,jsrfbromo -#endif -#ifdef CFC + + ! CFC use mo_param1_bgc, only: iatmf11,iatmf12,iatmsf6,icfc11,icfc12,isf6 use mo_bgcmean, only: jcfc11,jcfc11fx,jcfc12,jcfc12fx,jsf6,jsf6fx -#endif -#ifdef cisonew + + ! cisonew use mo_carbch, only: co213fxd,co213fxu,co214fxd,co214fxu use mo_biomod, only: c14fac,re1312,re14to use mo_vgrid, only: dp_min use mo_param1_bgc, only: iatmc13,iatmc14,icalc13,idet13,idoc13,iphy13,isco213,isco214,izoo13,safediv use mo_bgcmean, only: jatmc13,jatmc14,jbigd14c,jcalc13,jco213fxd,jco213fxu,jco214fxd,jco214fxu,jd13c,jd14c,jdic13,jdic14,& & jdoc13,jgrazer13,jphyto13,jpoc13 -#endif -#ifdef natDIC + + ! natDIC use mo_param1_bgc, only: iatmnco2,inatalkali,inatcalc,inatsco212 use mo_carbch, only: natco3,nathi,natomegaa,natomegac,natpco2d use mo_bgcmean, only: jlvlnatph,jnatalkali,jnatcalc,jnatco2fx,jnatco3,jnatdic,jnatomegaa,jnatomegac,jnatpco2,jnatph, & & jsrfnatalk,jsrfnatdic,jsrfnatph -#endif -#ifndef sedbypass + ! NOT sedbypass use mo_param1_bgc, only: ipowaal,ipowaic,ipowaox,ipowaph,ipowasi,ipown2,ipowno3,isssc12,issso12,issssil,issster use mo_sedmnt, only: powtra,sedlay,burial use mo_bgcmean, only: jbursssc12,jburssso12,jburssssil,jburssster,jpowaal,jpowaic,jpowaox,jpowaph,jpowaph,jpowasi,jpown2, & & jpowno3,jsssc12,jssso12,jssssil,jssster,accbur,accsdm -#endif + ! BOXATM + use mo_bgcmean, only: jatmco2,jatmn2,jatmo2 + use mo_ifdefs, only : use_BROMO, use_AGG, use_WLIN, use_natDIC, use_CFC, use_sedbypass, & + & use_cisonew, use_BOXATM implicit none INTEGER :: kpie,kpje,kpke REAL :: pdlxp(kpie,kpje) @@ -121,32 +123,33 @@ SUBROUTINE ACCFIELDS(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask) INTEGER :: ind1(kpie,kpje),ind2(kpie,kpje) REAL :: wghts(kpie,kpje,ddm) -#ifdef cisonew + ! cisonew REAL :: di12c REAL :: d13c(kpie,kpje,kpke) REAL :: d14c(kpie,kpje,kpke) REAL :: bigd14c(kpie,kpje,kpke) -! Calculation d13C, d14C and Dd14C: Delta notation for output - d13c(:,:,:)=0. - d14c(:,:,:)=0. - bigd14c(:,:,:)=0. - do k=1,kpke - do j=1,kpje - do i=1,kpie - if(omask(i,j).gt.0.5.and.pddpo(i,j,k).gt.dp_min) then - - di12c=max(ocetra(i,j,k,isco212)-ocetra(i,j,k,isco213),0.) - d13c(i,j,k)=(ocetra(i,j,k,isco213)/(di12c+safediv)/re1312-1.)*1000. - d14c(i,j,k)=(ocetra(i,j,k,isco214)*c14fac/(ocetra(i,j,k,isco212)+safediv)/re14to-1.)*1000. - bigd14c(i,j,k)=d14c(i,j,k)-2.*(d13c(i,j,k)+25.)*(1.+d14c(i,j,k)/1000.) - - endif - enddo - enddo - enddo -#endif + if (use_cisonew) then + ! Calculation d13C, d14C and Dd14C: Delta notation for output + d13c(:,:,:)=0. + d14c(:,:,:)=0. + bigd14c(:,:,:)=0. + do k=1,kpke + do j=1,kpje + do i=1,kpie + if(omask(i,j).gt.0.5.and.pddpo(i,j,k).gt.dp_min) then + + di12c=max(ocetra(i,j,k,isco212)-ocetra(i,j,k,isco213),0.) + d13c(i,j,k)=(ocetra(i,j,k,isco213)/(di12c+safediv)/re1312-1.)*1000. + d14c(i,j,k)=(ocetra(i,j,k,isco214)*c14fac/(ocetra(i,j,k,isco212)+safediv)/re14to-1.)*1000. + bigd14c(i,j,k)=d14c(i,j,k)-2.*(d13c(i,j,k)+25.)*(1.+d14c(i,j,k)/1000.) + + endif + enddo + enddo + enddo + end if ! Accumulated fluxes for inventory.F90. Note that these are currently not written to restart! @@ -164,16 +167,16 @@ SUBROUTINE ACCFIELDS(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask) bgct2d(i,j,jprorca) = bgct2d(i,j,jprorca) + carflx_bot(i,j)/2.0 bgct2d(i,j,jprcaca) = bgct2d(i,j,jprcaca) + calflx_bot(i,j)/2.0 bgct2d(i,j,jsilpro) = bgct2d(i,j,jsilpro) + bsiflx_bot(i,j)/2.0 -#ifndef sedbypass - ! Diffusive fluxes between water-column and sediment - bgct2d(i,j,jpodiic) = bgct2d(i,j,jpodiic) + sedfluxo(i,j,ipowaic)/2.0 - bgct2d(i,j,jpodial) = bgct2d(i,j,jpodial) + sedfluxo(i,j,ipowaal)/2.0 - bgct2d(i,j,jpodiph) = bgct2d(i,j,jpodiph) + sedfluxo(i,j,ipowaph)/2.0 - bgct2d(i,j,jpodiox) = bgct2d(i,j,jpodiox) + sedfluxo(i,j,ipowaox)/2.0 - bgct2d(i,j,jpodin2) = bgct2d(i,j,jpodin2) + sedfluxo(i,j,ipown2)/2.0 - bgct2d(i,j,jpodino3) = bgct2d(i,j,jpodino3) + sedfluxo(i,j,ipowno3)/2.0 - bgct2d(i,j,jpodisi) = bgct2d(i,j,jpodisi) + sedfluxo(i,j,ipowasi)/2.0 -#endif + if (.not. use_sedbypass) then + ! Diffusive fluxes between water-column and sediment + bgct2d(i,j,jpodiic) = bgct2d(i,j,jpodiic) + sedfluxo(i,j,ipowaic)/2.0 + bgct2d(i,j,jpodial) = bgct2d(i,j,jpodial) + sedfluxo(i,j,ipowaal)/2.0 + bgct2d(i,j,jpodiph) = bgct2d(i,j,jpodiph) + sedfluxo(i,j,ipowaph)/2.0 + bgct2d(i,j,jpodiox) = bgct2d(i,j,jpodiox) + sedfluxo(i,j,ipowaox)/2.0 + bgct2d(i,j,jpodin2) = bgct2d(i,j,jpodin2) + sedfluxo(i,j,ipown2)/2.0 + bgct2d(i,j,jpodino3) = bgct2d(i,j,jpodino3) + sedfluxo(i,j,ipowno3)/2.0 + bgct2d(i,j,jpodisi) = bgct2d(i,j,jpodisi) + sedfluxo(i,j,ipowasi)/2.0 + end if ! N-deposition, ocean alkalinization, and riverine input fluxes bgct2d(i,j,jndep) = bgct2d(i,j,jndep) + ndepflx(i,j)/2.0 bgct2d(i,j,joalk) = bgct2d(i,j,joalk) + oalkflx(i,j)/2.0 @@ -189,45 +192,44 @@ SUBROUTINE ACCFIELDS(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask) enddo enddo - -! Accumulate atmosphere fields and fluxes + ! Accumulate atmosphere fields and fluxes call accsrf(jatmco2,atm(1,1,iatmco2),omask,0) -#if defined(BOXATM) - call accsrf(jatmo2 ,atm(1,1,iatmo2),omask,0) - call accsrf(jatmn2 ,atm(1,1,iatmn2),omask,0) -#endif + if (use_BOXATM) then + call accsrf(jatmo2 ,atm(1,1,iatmo2),omask,0) + call accsrf(jatmn2 ,atm(1,1,iatmn2),omask,0) + end if call accsrf(joxflux,atmflx(1,1,iatmo2),omask,0) call accsrf(jniflux,atmflx(1,1,iatmn2),omask,0) call accsrf(jn2ofx,atmflx(1,1,iatmn2o),omask,0) call accsrf(jdmsflux,atmflx(1,1,iatmdms),omask,0) -#ifdef CFC - call accsrf(jcfc11fx,atmflx(1,1,iatmf11),omask,0) - call accsrf(jcfc12fx,atmflx(1,1,iatmf12),omask,0) - call accsrf(jsf6fx,atmflx(1,1,iatmsf6),omask,0) -#endif -#ifdef natDIC - call accsrf(jnatco2fx,atmflx(1,1,iatmnco2),omask,0) -#endif -#ifdef BROMO - call accsrf(jatmbromo,atm(1,1,iatmbromo),omask,0) - call accsrf(jbromofx,atmflx(1,1,iatmbromo),omask,0) -#endif -#ifdef cisonew - call accsrf(jatmc13,atm(1,1,iatmc13),omask,0) - call accsrf(jatmc14,atm(1,1,iatmc14),omask,0) -#endif + if (use_CFC) then + call accsrf(jcfc11fx,atmflx(1,1,iatmf11),omask,0) + call accsrf(jcfc12fx,atmflx(1,1,iatmf12),omask,0) + call accsrf(jsf6fx,atmflx(1,1,iatmsf6),omask,0) + endif + if (use_natDIC) then + call accsrf(jnatco2fx,atmflx(1,1,iatmnco2),omask,0) + endif + if (use_BROMO) then + call accsrf(jatmbromo,atm(1,1,iatmbromo),omask,0) + call accsrf(jbromofx,atmflx(1,1,iatmbromo),omask,0) + endif + if (use_cisonew) then + call accsrf(jatmc13,atm(1,1,iatmc13),omask,0) + call accsrf(jatmc14,atm(1,1,iatmc14),omask,0) + endif ! Save up and downward fluxes for CO2 seperately call accsrf(jco2fxd,co2fxd,omask,0) call accsrf(jco2fxu,co2fxu,omask,0) -#ifdef cisonew - call accsrf(jco213fxd,co213fxd,omask,0) - call accsrf(jco213fxu,co213fxu,omask,0) - call accsrf(jco214fxd,co214fxd,omask,0) - call accsrf(jco214fxu,co214fxu,omask,0) -#endif + if (use_cisonew) then + call accsrf(jco213fxd,co213fxd,omask,0) + call accsrf(jco213fxu,co213fxu,omask,0) + call accsrf(jco214fxd,co214fxd,omask,0) + call accsrf(jco214fxu,co214fxu,omask,0) + endif -! Accumulate 2d diagnostics + ! Accumulate 2d diagnostics call accsrf(jpco2,pco2d,omask,0) call accsrf(jpco2m,pco2m,omask,0) call accsrf(jkwco2khm,kwco2sol,omask,0) @@ -253,17 +255,17 @@ SUBROUTINE ACCFIELDS(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask) call accsrf(jintphosy,intphosy,omask,0) call accsrf(jintdnit,intdnit,omask,0) call accsrf(jintnfix,intnfix,omask,0) -#ifdef natDIC - call accsrf(jsrfnatdic,ocetra(1,1,1,inatsco212),omask,0) - call accsrf(jsrfnatalk,ocetra(1,1,1,inatalkali),omask,0) - call accsrf(jnatpco2,natpco2d,omask,0) - call accsrf(jsrfnatph,nathi(1,1,1),omask,0) -#endif -#ifdef BROMO - call accsrf(jsrfbromo,ocetra(1,1,1,ibromo),omask,0) - call accsrf(jbromo_prod,int_chbr3_prod,omask,0) - call accsrf(jbromo_uv,int_chbr3_uv,omask,0) -#endif + if (use_natDIC) then + call accsrf(jsrfnatdic,ocetra(1,1,1,inatsco212),omask,0) + call accsrf(jsrfnatalk,ocetra(1,1,1,inatalkali),omask,0) + call accsrf(jnatpco2,natpco2d,omask,0) + call accsrf(jsrfnatph,nathi(1,1,1),omask,0) + endif + if (use_BROMO) then + call accsrf(jsrfbromo,ocetra(1,1,1,ibromo),omask,0) + call accsrf(jbromo_prod,int_chbr3_prod,omask,0) + call accsrf(jbromo_uv,int_chbr3_uv,omask,0) + endif ! Accumulate fluxes due to N-deposition, ocean alkalinization call accsrf(jndepfx,ndepflx,omask,0) @@ -291,16 +293,16 @@ SUBROUTINE ACCFIELDS(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask) call accsrf(jcalflx_bot,calflx_bot,omask,0) ENDIF -#ifndef sedbypass -! Accumulate diffusive fluxes between water column and sediment - call accsrf(jsediffic,sedfluxo(1,1,ipowaic),omask,0) - call accsrf(jsediffal,sedfluxo(1,1,ipowaal),omask,0) - call accsrf(jsediffph,sedfluxo(1,1,ipowaph),omask,0) - call accsrf(jsediffox,sedfluxo(1,1,ipowaox),omask,0) - call accsrf(jsediffn2,sedfluxo(1,1,ipown2),omask,0) - call accsrf(jsediffno3,sedfluxo(1,1,ipowno3),omask,0) - call accsrf(jsediffsi,sedfluxo(1,1,ipowasi),omask,0) -#endif + if (.not. use_sedbypass) then + ! Accumulate diffusive fluxes between water column and sediment + call accsrf(jsediffic,sedfluxo(1,1,ipowaic),omask,0) + call accsrf(jsediffal,sedfluxo(1,1,ipowaal),omask,0) + call accsrf(jsediffph,sedfluxo(1,1,ipowaph),omask,0) + call accsrf(jsediffox,sedfluxo(1,1,ipowaox),omask,0) + call accsrf(jsediffn2,sedfluxo(1,1,ipown2),omask,0) + call accsrf(jsediffno3,sedfluxo(1,1,ipowno3),omask,0) + call accsrf(jsediffsi,sedfluxo(1,1,ipowasi),omask,0) + endif ! Accumulate layer diagnostics call acclyr(jdp,pddpo,pddpo,0) @@ -329,45 +331,44 @@ SUBROUTINE ACCFIELDS(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask) call acclyr(jprefalk,ocetra(1,1,1,iprefalk),pddpo,1) call acclyr(jprefdic,ocetra(1,1,1,iprefdic),pddpo,1) call acclyr(jdicsat,ocetra(1,1,1,idicsat),pddpo,1) -#ifdef natDIC - call acclyr(jnatalkali,ocetra(1,1,1,inatalkali),pddpo,1) - call acclyr(jnatdic,ocetra(1,1,1,inatsco212),pddpo,1) - call acclyr(jnatcalc,ocetra(1,1,1,inatcalc),pddpo,1) - call acclyr(jnatco3,natco3,pddpo,1) - call acclyr(jnatph,nathi,pddpo,1) - call acclyr(jnatomegaa,natOmegaA,pddpo,1) - call acclyr(jnatomegac,natOmegaC,pddpo,1) -#endif -#ifdef cisonew - call acclyr(jdic13,ocetra(1,1,1,isco213),pddpo,1) - call acclyr(jdic14,ocetra(1,1,1,isco214),pddpo,1) - call acclyr(jd13c,d13c,pddpo,1) - call acclyr(jd14c,d14c,pddpo,1) - call acclyr(jbigd14c,bigd14c,pddpo,1) - call acclyr(jpoc13,ocetra(1,1,1,idet13),pddpo,1) - call acclyr(jdoc13,ocetra(1,1,1,idoc13),pddpo,1) - call acclyr(jcalc13,ocetra(1,1,1,icalc13),pddpo,1) - call acclyr(jphyto13,ocetra(1,1,1,iphy13),pddpo,1) - call acclyr(jgrazer13,ocetra(1,1,1,izoo13),pddpo,1) -#endif -#ifdef AGG - call acclyr(jnos,ocetra(1,1,1,inos),pddpo,1) - call acclyr(jwphy, wmass/dtb,pddpo,1) - call acclyr(jwnos, wnumb/dtb,pddpo,1) - call acclyr(jeps, eps3d, pddpo,1) - call acclyr(jasize,asize3d, pddpo,1) -#endif -#ifdef CFC - call acclyr(jcfc11,ocetra(1,1,1,icfc11),pddpo,1) - call acclyr(jcfc12,ocetra(1,1,1,icfc12),pddpo,1) - call acclyr(jsf6,ocetra(1,1,1,isf6),pddpo,1) -#endif -#ifdef BROMO - call acclyr(jbromo,ocetra(1,1,1,ibromo),pddpo,1) -#endif - + if (use_natDIC) then + call acclyr(jnatalkali,ocetra(1,1,1,inatalkali),pddpo,1) + call acclyr(jnatdic,ocetra(1,1,1,inatsco212),pddpo,1) + call acclyr(jnatcalc,ocetra(1,1,1,inatcalc),pddpo,1) + call acclyr(jnatco3,natco3,pddpo,1) + call acclyr(jnatph,nathi,pddpo,1) + call acclyr(jnatomegaa,natOmegaA,pddpo,1) + call acclyr(jnatomegac,natOmegaC,pddpo,1) + endif + if (use_cisonew) then + call acclyr(jdic13,ocetra(1,1,1,isco213),pddpo,1) + call acclyr(jdic14,ocetra(1,1,1,isco214),pddpo,1) + call acclyr(jd13c,d13c,pddpo,1) + call acclyr(jd14c,d14c,pddpo,1) + call acclyr(jbigd14c,bigd14c,pddpo,1) + call acclyr(jpoc13,ocetra(1,1,1,idet13),pddpo,1) + call acclyr(jdoc13,ocetra(1,1,1,idoc13),pddpo,1) + call acclyr(jcalc13,ocetra(1,1,1,icalc13),pddpo,1) + call acclyr(jphyto13,ocetra(1,1,1,iphy13),pddpo,1) + call acclyr(jgrazer13,ocetra(1,1,1,izoo13),pddpo,1) + endif + if (use_AGG) then + call acclyr(jnos,ocetra(1,1,1,inos),pddpo,1) + call acclyr(jwphy, wmass/dtb,pddpo,1) + call acclyr(jwnos, wnumb/dtb,pddpo,1) + call acclyr(jeps, eps3d, pddpo,1) + call acclyr(jasize,asize3d, pddpo,1) + endif + if (use_CFC) then + call acclyr(jcfc11,ocetra(1,1,1,icfc11),pddpo,1) + call acclyr(jcfc12,ocetra(1,1,1,icfc12),pddpo,1) + call acclyr(jsf6,ocetra(1,1,1,isf6),pddpo,1) + endif + if (use_BROMO) then + call acclyr(jbromo,ocetra(1,1,1,ibromo),pddpo,1) + endif -! Accumulate level diagnostics + ! Accumulate level diagnostics IF (SUM(jlvlphyto+jlvlgrazer+jlvlphosph+jlvloxygen+jlvliron+ & & jlvlano3+jlvlalkali+jlvlsilica+jlvldic+jlvldoc+jlvlpoc+jlvlcalc+& & jlvlopal+jlvln2o+jlvlco3+jlvlph+jlvlomegaa+jlvlomegac+jlvlphosy+& @@ -404,69 +405,68 @@ SUBROUTINE ACCFIELDS(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask) call acclvl(jlvlprefalk,ocetra(1,1,1,iprefalk),k,ind1,ind2,wghts) call acclvl(jlvlprefdic,ocetra(1,1,1,iprefdic),k,ind1,ind2,wghts) call acclvl(jlvldicsat,ocetra(1,1,1,idicsat),k,ind1,ind2,wghts) -#ifdef natDIC - call acclvl(jlvlnatdic,ocetra(1,1,1,inatsco212),k,ind1,ind2,wghts) - call acclvl(jlvlnatalkali,ocetra(1,1,1,inatalkali),k,ind1,ind2,wghts) - call acclvl(jlvlnatcalc,ocetra(1,1,1,inatcalc),k,ind1,ind2,wghts) - call acclvl(jlvlnatco3,natco3,k,ind1,ind2,wghts) - call acclvl(jlvlnatph,nathi,k,ind1,ind2,wghts) - call acclvl(jlvlnatomegaa,natOmegaA,k,ind1,ind2,wghts) - call acclvl(jlvlnatomegac,natOmegaC,k,ind1,ind2,wghts) -#endif -#ifdef cisonew - call acclvl(jlvld13c,d13c,k,ind1,ind2,wghts) - call acclvl(jlvld14c,d14c,k,ind1,ind2,wghts) - call acclvl(jlvlbigd14c,bigd14c,k,ind1,ind2,wghts) - call acclvl(jlvldic13,ocetra(1,1,1,isco213),k,ind1,ind2,wghts) - call acclvl(jlvldic14,ocetra(1,1,1,isco214),k,ind1,ind2,wghts) - call acclvl(jlvlpoc13,ocetra(1,1,1,idet13),k,ind1,ind2,wghts) - call acclvl(jlvldoc13,ocetra(1,1,1,idoc13),k,ind1,ind2,wghts) - call acclvl(jlvlcalc13,ocetra(1,1,1,icalc13),k,ind1,ind2,wghts) - call acclvl(jlvlphyto13,ocetra(1,1,1,iphy13),k,ind1,ind2,wghts) - call acclvl(jlvlgrazer13,ocetra(1,1,1,izoo13),k,ind1,ind2,wghts) -#endif -#ifdef AGG - call acclvl(jlvlnos,ocetra(1,1,1,inos),k,ind1,ind2,wghts) - call acclvl(jlvlwphy, wmass/dtb,k,ind1,ind2,wghts) - call acclvl(jlvlwnos, wnumb/dtb,k,ind1,ind2,wghts) - call acclvl(jlvleps, eps3d, k,ind1,ind2,wghts) - call acclvl(jlvlasize,asize3d, k,ind1,ind2,wghts) -#endif -#ifdef CFC - call acclvl(jlvlcfc11,ocetra(1,1,1,icfc11),k,ind1,ind2,wghts) - call acclvl(jlvlcfc12,ocetra(1,1,1,icfc12),k,ind1,ind2,wghts) - call acclvl(jlvlsf6,ocetra(1,1,1,isf6),k,ind1,ind2,wghts) -#endif -#ifdef BROMO - call acclvl(jlvlbromo,ocetra(1,1,1,ibromo),k,ind1,ind2,wghts) -#endif + if (use_natDIC) then + call acclvl(jlvlnatdic,ocetra(1,1,1,inatsco212),k,ind1,ind2,wghts) + call acclvl(jlvlnatalkali,ocetra(1,1,1,inatalkali),k,ind1,ind2,wghts) + call acclvl(jlvlnatcalc,ocetra(1,1,1,inatcalc),k,ind1,ind2,wghts) + call acclvl(jlvlnatco3,natco3,k,ind1,ind2,wghts) + call acclvl(jlvlnatph,nathi,k,ind1,ind2,wghts) + call acclvl(jlvlnatomegaa,natOmegaA,k,ind1,ind2,wghts) + call acclvl(jlvlnatomegac,natOmegaC,k,ind1,ind2,wghts) + endif + if (use_cisonew) then + call acclvl(jlvld13c,d13c,k,ind1,ind2,wghts) + call acclvl(jlvld14c,d14c,k,ind1,ind2,wghts) + call acclvl(jlvlbigd14c,bigd14c,k,ind1,ind2,wghts) + call acclvl(jlvldic13,ocetra(1,1,1,isco213),k,ind1,ind2,wghts) + call acclvl(jlvldic14,ocetra(1,1,1,isco214),k,ind1,ind2,wghts) + call acclvl(jlvlpoc13,ocetra(1,1,1,idet13),k,ind1,ind2,wghts) + call acclvl(jlvldoc13,ocetra(1,1,1,idoc13),k,ind1,ind2,wghts) + call acclvl(jlvlcalc13,ocetra(1,1,1,icalc13),k,ind1,ind2,wghts) + call acclvl(jlvlphyto13,ocetra(1,1,1,iphy13),k,ind1,ind2,wghts) + call acclvl(jlvlgrazer13,ocetra(1,1,1,izoo13),k,ind1,ind2,wghts) + endif + if (use_AGG) then + call acclvl(jlvlnos,ocetra(1,1,1,inos),k,ind1,ind2,wghts) + call acclvl(jlvlwphy, wmass/dtb,k,ind1,ind2,wghts) + call acclvl(jlvlwnos, wnumb/dtb,k,ind1,ind2,wghts) + call acclvl(jlvleps, eps3d, k,ind1,ind2,wghts) + call acclvl(jlvlasize,asize3d, k,ind1,ind2,wghts) + endif + if (use_CFC) then + call acclvl(jlvlcfc11,ocetra(1,1,1,icfc11),k,ind1,ind2,wghts) + call acclvl(jlvlcfc12,ocetra(1,1,1,icfc12),k,ind1,ind2,wghts) + call acclvl(jlvlsf6,ocetra(1,1,1,isf6),k,ind1,ind2,wghts) + endif + if (use_BROMO) then + call acclvl(jlvlbromo,ocetra(1,1,1,ibromo),k,ind1,ind2,wghts) + endif ENDDO ENDIF -#ifndef sedbypass -! Accumulate sediments - call accsdm(jpowaic,powtra(1,1,1,ipowaic)) - call accsdm(jpowaal,powtra(1,1,1,ipowaal)) - call accsdm(jpowaph,powtra(1,1,1,ipowaph)) - call accsdm(jpowaox,powtra(1,1,1,ipowaox)) - call accsdm(jpown2 ,powtra(1,1,1,ipown2) ) - call accsdm(jpowno3,powtra(1,1,1,ipowno3)) - call accsdm(jpowasi,powtra(1,1,1,ipowasi)) - call accsdm(jssso12,sedlay(1,1,1,issso12)) - call accsdm(jssssil,sedlay(1,1,1,issssil)) - call accsdm(jsssc12,sedlay(1,1,1,isssc12)) - call accsdm(jssster,sedlay(1,1,1,issster)) - -! Accumulate sediment burial - call accbur(jburssso12,burial(1,1,issso12)) - call accbur(jburssssil,burial(1,1,issssil)) - call accbur(jbursssc12,burial(1,1,isssc12)) - call accbur(jburssster,burial(1,1,issster)) -#endif - + if (.not. use_sedbypass) then + ! Accumulate sediments + call accsdm(jpowaic,powtra(1,1,1,ipowaic)) + call accsdm(jpowaal,powtra(1,1,1,ipowaal)) + call accsdm(jpowaph,powtra(1,1,1,ipowaph)) + call accsdm(jpowaox,powtra(1,1,1,ipowaox)) + call accsdm(jpown2 ,powtra(1,1,1,ipown2) ) + call accsdm(jpowno3,powtra(1,1,1,ipowno3)) + call accsdm(jpowasi,powtra(1,1,1,ipowasi)) + call accsdm(jssso12,sedlay(1,1,1,issso12)) + call accsdm(jssssil,sedlay(1,1,1,issssil)) + call accsdm(jsssc12,sedlay(1,1,1,isssc12)) + call accsdm(jssster,sedlay(1,1,1,issster)) + + ! Accumulate sediment burial + call accbur(jburssso12,burial(1,1,issso12)) + call accbur(jburssssil,burial(1,1,issssil)) + call accbur(jbursssc12,burial(1,1,isssc12)) + call accbur(jburssster,burial(1,1,issster)) + end if -! Write output if requested + ! Write output if requested DO l=1,nbgc nacc_bgc(l)=nacc_bgc(l)+1 if (bgcwrt(l)) then @@ -484,4 +484,4 @@ SUBROUTINE ACCFIELDS(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask) rivinflx=0. RETURN - END + END SUBROUTINE ACCFIELDS diff --git a/hamocc/aufr_bgc.F90 b/hamocc/aufr_bgc.F90 index 842720ad..4b0b6c93 100644 --- a/hamocc/aufr_bgc.F90 +++ b/hamocc/aufr_bgc.F90 @@ -112,33 +112,34 @@ SUBROUTINE AUFR_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & use mo_intfcblom, only: sedlay2,powtra2,burial2,atm2 use mod_xc, only: nbdy,mnproc,iqr,jqr,xcbcst,xchalt use mod_dia, only: iotype -#ifdef AGG + ! AGG use mo_param1_bgc, only: iadust,inos -#endif -#ifdef BOXATM + + ! BOXATM use mo_param1_bgc, only: iatmco2,iatmn2,iatmo2 use mo_carbch, only: atm -#endif -#ifdef BROMO + + ! BROMO use mo_param1_bgc, only: ibromo -#endif -#ifdef CFC + + ! CFC use mo_param1_bgc, only: icfc11,icfc12,isf6 -#endif -#ifdef cisonew + + ! cisonew use mo_carbch, only: ocetra - use mo_biomod, only: bifr13,bifr14,c14fac,re1312,re14to - use mo_param1_bgc, only: icalc13,icalc14,idet13,idet14,idoc13,idoc14,iphy13,iphy14,isco213,isco214,izoo13,izoo14,safediv -#endif -#ifdef natDIC - use mo_param1_bgc, only: inatalkali,inatcalc,inatsco212 + use mo_biomod, only: bifr13,bifr14,c14fac,re1312,re14to,prei13,prei14 + use mo_param1_bgc, only: icalc13,icalc14,idet13,idet14,idoc13,idoc14,iphy13,iphy14,isco213,isco214,izoo13,izoo14,safediv, & + & issso13,issso14,isssc13,isssc14,ipowc13,ipowc14,iatmc13,iatmc14 + use mo_bgcmean, only: jatmo2,jatmn2 + + ! natDIC + use mo_param1_bgc, only: inatalkali,inatcalc,inatsco212,iatmnco2 use mo_carbch, only: nathi -#endif -#ifndef sedbypass - use mo_param1_bgc, only: ipowaal,ipowaic,ipowaox,ipowaph,ipowasi,ipown2,ipowno3,isssc12,issso12,issssil,issster,ks -#endif + ! NOT sedbypass + use mo_param1_bgc, only: ipowaal,ipowaic,ipowaox,ipowaph,ipowasi,ipown2,ipowno3,isssc12,issso12,issssil,issster,ks + use mo_ifdefs , only : use_CFC, use_natDIC, use_cisonew, use_BROMO, use_BOXATM, use_AGG, use_sedbypass implicit none INTEGER :: kpie,kpje,kpke,ntr,ntrbgc,itrbgc @@ -148,16 +149,16 @@ SUBROUTINE AUFR_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & character(len=*) :: rstfnm ! Local variables - REAL :: locetra(kpie,kpje,2*kpke,nocetra) ! local array for reading + REAL :: locetra(kpie,kpje,2*kpke,-1:nocetra) ! local array for reading INTEGER :: restyear ! year of restart file INTEGER :: restmonth ! month of restart file INTEGER :: restday ! day of restart file INTEGER :: restdtoce ! time step number from bgc ocean file INTEGER :: idate(5),i,j,k logical :: lread_cfc,lread_nat,lread_iso,lread_atm,lread_bro -#ifdef cisonew + ! cisonew REAL :: rco213,rco214,alpha14,beta13,beta14,d13C_atm,d14cat -#endif + INTEGER ncid,ncstat,ncvarid #ifdef PNETCDF @@ -280,106 +281,105 @@ SUBROUTINE AUFR_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & ENDIF ! Find out whether to restart CFCs -#ifdef CFC - lread_cfc=.true. - IF(IOTYPE==0) THEN - if(mnproc==1) ncstat=nf90_inq_varid(ncid,'cfc11',ncvarid) - call xcbcst(ncstat) - if(ncstat.ne.nf90_noerr) lread_cfc=.false. - ELSE IF(IOTYPE==1) THEN + if (use_CFC) then + lread_cfc=.true. + IF(IOTYPE==0) THEN + if(mnproc==1) ncstat=nf90_inq_varid(ncid,'cfc11',ncvarid) + call xcbcst(ncstat) + if(ncstat.ne.nf90_noerr) lread_cfc=.false. + ELSE IF(IOTYPE==1) THEN #ifdef PNETCDF - ncstat=nfmpi_inq_varid(ncid,'cfc11',ncvarid) - if(ncstat.ne.nf_noerr) lread_cfc=.false. -#endif - ENDIF - IF(mnproc==1 .and. .not. lread_cfc) THEN - WRITE(io_stdo_bgc,*) ' ' - WRITE(io_stdo_bgc,*) 'AUFR_BGC info: CFC tracers not in restart file, ' - WRITE(io_stdo_bgc,*) ' CFCs initialised to zero.' - ENDIF + ncstat=nfmpi_inq_varid(ncid,'cfc11',ncvarid) + if(ncstat.ne.nf_noerr) lread_cfc=.false. #endif + ENDIF + IF(mnproc==1 .and. .not. lread_cfc) THEN + WRITE(io_stdo_bgc,*) ' ' + WRITE(io_stdo_bgc,*) 'AUFR_BGC info: CFC tracers not in restart file, ' + WRITE(io_stdo_bgc,*) ' CFCs initialised to zero.' + ENDIF + end if ! Find out whether to restart natural tracers -#ifdef natDIC - lread_nat=.true. - IF(IOTYPE==0) THEN - if(mnproc==1) ncstat=nf90_inq_varid(ncid,'natsco212',ncvarid) - call xcbcst(ncstat) - if(ncstat.ne.nf90_noerr) lread_nat=.false. - ELSE IF(IOTYPE==1) THEN + if (use_natDIC) then + lread_nat=.true. + IF(IOTYPE==0) THEN + if(mnproc==1) ncstat=nf90_inq_varid(ncid,'natsco212',ncvarid) + call xcbcst(ncstat) + if(ncstat.ne.nf90_noerr) lread_nat=.false. + ELSE IF(IOTYPE==1) THEN #ifdef PNETCDF - ncstat=nfmpi_inq_varid(ncid,'natsco212',ncvarid) - if(ncstat.ne.nf_noerr) lread_nat=.false. -#endif - ENDIF - IF(mnproc==1 .and. .not. lread_nat) THEN - WRITE(io_stdo_bgc,*) ' ' - WRITE(io_stdo_bgc,*) 'AUFR_BGC info: natural tracers not in restart file. ' - WRITE(io_stdo_bgc,*) ' Initialising natural tracers with their non-natural ' - WRITE(io_stdo_bgc,*) ' counterpart.' - ENDIF + ncstat=nfmpi_inq_varid(ncid,'natsco212',ncvarid) + if(ncstat.ne.nf_noerr) lread_nat=.false. #endif + ENDIF + IF(mnproc==1 .and. .not. lread_nat) THEN + WRITE(io_stdo_bgc,*) ' ' + WRITE(io_stdo_bgc,*) 'AUFR_BGC info: natural tracers not in restart file. ' + WRITE(io_stdo_bgc,*) ' Initialising natural tracers with their non-natural ' + WRITE(io_stdo_bgc,*) ' counterpart.' + ENDIF + end if ! Find out whether to restart marine carbon isotopes -#ifdef cisonew - lread_iso=.true. - IF(IOTYPE==0) THEN - if(mnproc==1) ncstat=nf90_inq_varid(ncid,'sco213',ncvarid) - call xcbcst(ncstat) - if(ncstat.ne.nf90_noerr) lread_iso=.false. - ELSE IF(IOTYPE==1) THEN + if (use_cisonew) then + lread_iso=.true. + IF(IOTYPE==0) THEN + if(mnproc==1) ncstat=nf90_inq_varid(ncid,'sco213',ncvarid) + call xcbcst(ncstat) + if(ncstat.ne.nf90_noerr) lread_iso=.false. + ELSE IF(IOTYPE==1) THEN #ifdef PNETCDF - ncstat=nfmpi_inq_varid(ncid,'sco213',ncvarid) - if(ncstat.ne.nf_noerr) lread_iso=.false. -#endif - ENDIF - IF(mnproc==1 .and. .not. lread_iso) THEN - WRITE(io_stdo_bgc,*) ' ' - WRITE(io_stdo_bgc,*) 'AUFR_BGC info: carbon isotopes not in restart file. ' - WRITE(io_stdo_bgc,*) ' Initialising carbon isotopes from scratch ' - ENDIF + ncstat=nfmpi_inq_varid(ncid,'sco213',ncvarid) + if(ncstat.ne.nf_noerr) lread_iso=.false. #endif + ENDIF + IF(mnproc==1 .and. .not. lread_iso) THEN + WRITE(io_stdo_bgc,*) ' ' + WRITE(io_stdo_bgc,*) 'AUFR_BGC info: carbon isotopes not in restart file. ' + WRITE(io_stdo_bgc,*) ' Initialising carbon isotopes from scratch ' + ENDIF + end if ! Find out whether to restart Bromoform -#ifdef BROMO - lread_bro=.true. - IF(IOTYPE==0) THEN - if(mnproc==1) ncstat=nf90_inq_varid(ncid,'bromo',ncvarid) - call xcbcst(ncstat) - if(ncstat.ne.nf90_noerr) lread_bro=.false. - ELSE IF(IOTYPE==1) THEN + if (use_BROMO) then + lread_bro=.true. + IF(IOTYPE==0) THEN + if(mnproc==1) ncstat=nf90_inq_varid(ncid,'bromo',ncvarid) + call xcbcst(ncstat) + if(ncstat.ne.nf90_noerr) lread_bro=.false. + ELSE IF(IOTYPE==1) THEN #ifdef PNETCDF - ncstat=nfmpi_inq_varid(ncid,'bromo',ncvarid) - if(ncstat.ne.nf_noerr) lread_bro=.false. -#endif - ENDIF - IF(mnproc==1 .and. .not. lread_bro) THEN - WRITE(io_stdo_bgc,*) ' ' - WRITE(io_stdo_bgc,*) 'AUFR_BGC info: Bromoform tracer not in restart file, ' - WRITE(io_stdo_bgc,*) 'Initialised to 0.01 pmol L-1 (Stemmler et al., 2015).' - ENDIF + ncstat=nfmpi_inq_varid(ncid,'bromo',ncvarid) + if(ncstat.ne.nf_noerr) lread_bro=.false. #endif + ENDIF + IF(mnproc==1 .and. .not. lread_bro) THEN + WRITE(io_stdo_bgc,*) ' ' + WRITE(io_stdo_bgc,*) 'AUFR_BGC info: Bromoform tracer not in restart file, ' + WRITE(io_stdo_bgc,*) 'Initialised to 0.01 pmol L-1 (Stemmler et al., 2015).' + ENDIF + end if ! Find out whether to restart atmosphere -#if defined(BOXATM) - lread_atm=.true. - IF(IOTYPE==0) THEN - if(mnproc==1) ncstat=nf90_inq_varid(ncid,'atmco2',ncvarid) - call xcbcst(ncstat) - if(ncstat.ne.nf90_noerr) lread_atm=.false. - ELSE IF(IOTYPE==1) THEN + if (use_BOXATM) then + lread_atm=.true. + IF(IOTYPE==0) THEN + if(mnproc==1) ncstat=nf90_inq_varid(ncid,'atmco2',ncvarid) + call xcbcst(ncstat) + if(ncstat.ne.nf90_noerr) lread_atm=.false. + ELSE IF(IOTYPE==1) THEN #ifdef PNETCDF - ncstat=nfmpi_inq_varid(ncid,'atmco2',ncvarid) - if(ncstat.ne.nf_noerr) lread_atm=.false. + ncstat=nfmpi_inq_varid(ncid,'atmco2',ncvarid) + if(ncstat.ne.nf_noerr) lread_atm=.false. #endif - ENDIF - IF(mnproc==1 .and. .not. lread_atm) THEN - WRITE(io_stdo_bgc,*) ' ' - WRITE(io_stdo_bgc,*) 'AUFR_BGC info: atmosphere fields not in restart file. ' - WRITE(io_stdo_bgc,*) ' Initialising atmosphere from scratch ' - ENDIF -#endif - + ENDIF + IF(mnproc==1 .and. .not. lread_atm) THEN + WRITE(io_stdo_bgc,*) ' ' + WRITE(io_stdo_bgc,*) 'AUFR_BGC info: atmosphere fields not in restart file. ' + WRITE(io_stdo_bgc,*) ' Initialising atmosphere from scratch ' + ENDIF + end if ! ! Read restart data : ocean aquateous tracer ! @@ -406,52 +406,51 @@ SUBROUTINE AUFR_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & CALL read_netcdf_var(ncid,'prefdic',locetra(1,1,1,iprefdic),2*kpke,0,iotype) CALL read_netcdf_var(ncid,'dicsat',locetra(1,1,1,idicsat),2*kpke,0,iotype) -#ifdef cisonew - IF(lread_iso) THEN - CALL read_netcdf_var(ncid,'sco213',locetra(1,1,1,isco213),2*kpke,0,iotype) - CALL read_netcdf_var(ncid,'sco214',locetra(1,1,1,isco214),2*kpke,0,iotype) - CALL read_netcdf_var(ncid,'doc13',locetra(1,1,1,idoc13),2*kpke,0,iotype) - CALL read_netcdf_var(ncid,'doc14',locetra(1,1,1,idoc14),2*kpke,0,iotype) - CALL read_netcdf_var(ncid,'phyto13',locetra(1,1,1,iphy13),2*kpke,0,iotype) - CALL read_netcdf_var(ncid,'phyto14',locetra(1,1,1,iphy14),2*kpke,0,iotype) - CALL read_netcdf_var(ncid,'grazer13',locetra(1,1,1,izoo13),2*kpke,0,iotype) - CALL read_netcdf_var(ncid,'grazer14',locetra(1,1,1,izoo14),2*kpke,0,iotype) - CALL read_netcdf_var(ncid,'poc13',locetra(1,1,1,idet13),2*kpke,0,iotype) - CALL read_netcdf_var(ncid,'poc14',locetra(1,1,1,idet14),2*kpke,0,iotype) - CALL read_netcdf_var(ncid,'calciu13',locetra(1,1,1,icalc13),2*kpke,0,iotype) - CALL read_netcdf_var(ncid,'calciu14',locetra(1,1,1,icalc14),2*kpke,0,iotype) - ENDIF -#endif -#ifdef AGG - CALL read_netcdf_var(ncid,'snos',locetra(1,1,1,inos),2*kpke,0,iotype) - CALL read_netcdf_var(ncid,'adust',locetra(1,1,1,iadust),2*kpke,0,iotype) -#endif /*AGG*/ -#ifdef CFC - IF(lread_cfc) THEN - CALL read_netcdf_var(ncid,'cfc11',locetra(1,1,1,icfc11),2*kpke,0,iotype) - CALL read_netcdf_var(ncid,'cfc12',locetra(1,1,1,icfc12),2*kpke,0,iotype) - CALL read_netcdf_var(ncid,'sf6',locetra(1,1,1,isf6),2*kpke,0,iotype) - ENDIF -#endif -#ifdef natDIC - IF(lread_nat) THEN - CALL read_netcdf_var(ncid,'natsco212',locetra(1,1,1,inatsco212),2*kpke,0,iotype) - CALL read_netcdf_var(ncid,'natalkali',locetra(1,1,1,inatalkali),2*kpke,0,iotype) - CALL read_netcdf_var(ncid,'natcalciu',locetra(1,1,1,inatcalc),2*kpke,0,iotype) - CALL read_netcdf_var(ncid,'nathi',nathi(1,1,1),kpke,0,iotype) - ELSE - CALL read_netcdf_var(ncid,'sco212',locetra(1,1,1,inatsco212),2*kpke,0,iotype) - CALL read_netcdf_var(ncid,'alkali',locetra(1,1,1,inatalkali),2*kpke,0,iotype) - CALL read_netcdf_var(ncid,'calciu',locetra(1,1,1,inatcalc),2*kpke,0,iotype) - CALL read_netcdf_var(ncid,'hi',nathi(1,1,1),kpke,0,iotype) - ENDIF -#endif -#ifdef BROMO - IF(lread_bro) THEN - CALL read_netcdf_var(ncid,'bromo',locetra(1,1,1,ibromo),2*kpke,0,iotype) - ENDIF -#endif - + if (use_cisonew) then + IF(lread_iso) THEN + CALL read_netcdf_var(ncid,'sco213',locetra(1,1,1,isco213),2*kpke,0,iotype) + CALL read_netcdf_var(ncid,'sco214',locetra(1,1,1,isco214),2*kpke,0,iotype) + CALL read_netcdf_var(ncid,'doc13',locetra(1,1,1,idoc13),2*kpke,0,iotype) + CALL read_netcdf_var(ncid,'doc14',locetra(1,1,1,idoc14),2*kpke,0,iotype) + CALL read_netcdf_var(ncid,'phyto13',locetra(1,1,1,iphy13),2*kpke,0,iotype) + CALL read_netcdf_var(ncid,'phyto14',locetra(1,1,1,iphy14),2*kpke,0,iotype) + CALL read_netcdf_var(ncid,'grazer13',locetra(1,1,1,izoo13),2*kpke,0,iotype) + CALL read_netcdf_var(ncid,'grazer14',locetra(1,1,1,izoo14),2*kpke,0,iotype) + CALL read_netcdf_var(ncid,'poc13',locetra(1,1,1,idet13),2*kpke,0,iotype) + CALL read_netcdf_var(ncid,'poc14',locetra(1,1,1,idet14),2*kpke,0,iotype) + CALL read_netcdf_var(ncid,'calciu13',locetra(1,1,1,icalc13),2*kpke,0,iotype) + CALL read_netcdf_var(ncid,'calciu14',locetra(1,1,1,icalc14),2*kpke,0,iotype) + ENDIF + endif + if (use_AGG)then + CALL read_netcdf_var(ncid,'snos',locetra(1,1,1,inos),2*kpke,0,iotype) + CALL read_netcdf_var(ncid,'adust',locetra(1,1,1,iadust),2*kpke,0,iotype) + end if + if (use_CFC) then + IF(lread_cfc) THEN + CALL read_netcdf_var(ncid,'cfc11',locetra(1,1,1,icfc11),2*kpke,0,iotype) + CALL read_netcdf_var(ncid,'cfc12',locetra(1,1,1,icfc12),2*kpke,0,iotype) + CALL read_netcdf_var(ncid,'sf6',locetra(1,1,1,isf6),2*kpke,0,iotype) + ENDIF + endif + if (use_natDIC) then + IF(lread_nat) THEN + CALL read_netcdf_var(ncid,'natsco212',locetra(1,1,1,inatsco212),2*kpke,0,iotype) + CALL read_netcdf_var(ncid,'natalkali',locetra(1,1,1,inatalkali),2*kpke,0,iotype) + CALL read_netcdf_var(ncid,'natcalciu',locetra(1,1,1,inatcalc),2*kpke,0,iotype) + CALL read_netcdf_var(ncid,'nathi',nathi(1,1,1),kpke,0,iotype) + ELSE + CALL read_netcdf_var(ncid,'sco212',locetra(1,1,1,inatsco212),2*kpke,0,iotype) + CALL read_netcdf_var(ncid,'alkali',locetra(1,1,1,inatalkali),2*kpke,0,iotype) + CALL read_netcdf_var(ncid,'calciu',locetra(1,1,1,inatcalc),2*kpke,0,iotype) + CALL read_netcdf_var(ncid,'hi',nathi(1,1,1),kpke,0,iotype) + ENDIF + end if + if (use_BROMO) then + IF(lread_bro) THEN + CALL read_netcdf_var(ncid,'bromo',locetra(1,1,1,ibromo),2*kpke,0,iotype) + ENDIF + end if ! ! Read restart data : diagnostic ocean fields (needed for bit to bit reproducability) ! @@ -463,148 +462,147 @@ SUBROUTINE AUFR_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & ! ! Read restart data : sediment variables. ! -#ifndef sedbypass - CALL read_netcdf_var(ncid,'ssso12',sedlay2(1,1,1,issso12),2*ks,0,iotype) - CALL read_netcdf_var(ncid,'sssc12',sedlay2(1,1,1,isssc12),2*ks,0,iotype) - CALL read_netcdf_var(ncid,'ssssil',sedlay2(1,1,1,issssil),2*ks,0,iotype) - CALL read_netcdf_var(ncid,'ssster',sedlay2(1,1,1,issster),2*ks,0,iotype) - CALL read_netcdf_var(ncid,'bur_o12',burial2(1,1,1,issso12),2,0,iotype) - CALL read_netcdf_var(ncid,'bur_c12',burial2(1,1,1,isssc12),2,0,iotype) - CALL read_netcdf_var(ncid,'bur_sil',burial2(1,1,1,issssil),2,0,iotype) - CALL read_netcdf_var(ncid,'bur_clay',burial2(1,1,1,issster),2,0,iotype) - CALL read_netcdf_var(ncid,'sedhpl',sedhpl(1,1,1),ks,0,iotype) - CALL read_netcdf_var(ncid,'powaic',powtra2(1,1,1,ipowaic),2*ks,0,iotype) - CALL read_netcdf_var(ncid,'powaal',powtra2(1,1,1,ipowaal),2*ks,0,iotype) - CALL read_netcdf_var(ncid,'powaph',powtra2(1,1,1,ipowaph),2*ks,0,iotype) - CALL read_netcdf_var(ncid,'powaox',powtra2(1,1,1,ipowaox),2*ks,0,iotype) - CALL read_netcdf_var(ncid,'pown2',powtra2(1,1,1,ipown2),2*ks,0,iotype) - CALL read_netcdf_var(ncid,'powno3',powtra2(1,1,1,ipowno3),2*ks,0,iotype) - CALL read_netcdf_var(ncid,'powasi',powtra2(1,1,1,ipowasi),2*ks,0,iotype) -#ifdef cisonew - IF(lread_iso) THEN - ! Burial fields for c-isotopes still missing - CALL read_netcdf_var(ncid,'ssso13',sedlay2(1,1,1,issso13),2*ks,0,iotype) - CALL read_netcdf_var(ncid,'ssso14',sedlay2(1,1,1,issso14),2*ks,0,iotype) - CALL read_netcdf_var(ncid,'sssc13',sedlay2(1,1,1,isssc13),2*ks,0,iotype) - CALL read_netcdf_var(ncid,'sssc14',sedlay2(1,1,1,isssc14),2*ks,0,iotype) - CALL read_netcdf_var(ncid,'powc13',powtra2(1,1,1,ipowc13),2*ks,0,iotype) - CALL read_netcdf_var(ncid,'powc14',powtra2(1,1,1,ipowc14),2*ks,0,iotype) - ENDIF -#endif -#endif - + if (.not. use_sedbypass) then + CALL read_netcdf_var(ncid,'ssso12',sedlay2(1,1,1,issso12),2*ks,0,iotype) + CALL read_netcdf_var(ncid,'sssc12',sedlay2(1,1,1,isssc12),2*ks,0,iotype) + CALL read_netcdf_var(ncid,'ssssil',sedlay2(1,1,1,issssil),2*ks,0,iotype) + CALL read_netcdf_var(ncid,'ssster',sedlay2(1,1,1,issster),2*ks,0,iotype) + CALL read_netcdf_var(ncid,'bur_o12',burial2(1,1,1,issso12),2,0,iotype) + CALL read_netcdf_var(ncid,'bur_c12',burial2(1,1,1,isssc12),2,0,iotype) + CALL read_netcdf_var(ncid,'bur_sil',burial2(1,1,1,issssil),2,0,iotype) + CALL read_netcdf_var(ncid,'bur_clay',burial2(1,1,1,issster),2,0,iotype) + CALL read_netcdf_var(ncid,'sedhpl',sedhpl(1,1,1),ks,0,iotype) + CALL read_netcdf_var(ncid,'powaic',powtra2(1,1,1,ipowaic),2*ks,0,iotype) + CALL read_netcdf_var(ncid,'powaal',powtra2(1,1,1,ipowaal),2*ks,0,iotype) + CALL read_netcdf_var(ncid,'powaph',powtra2(1,1,1,ipowaph),2*ks,0,iotype) + CALL read_netcdf_var(ncid,'powaox',powtra2(1,1,1,ipowaox),2*ks,0,iotype) + CALL read_netcdf_var(ncid,'pown2',powtra2(1,1,1,ipown2),2*ks,0,iotype) + CALL read_netcdf_var(ncid,'powno3',powtra2(1,1,1,ipowno3),2*ks,0,iotype) + CALL read_netcdf_var(ncid,'powasi',powtra2(1,1,1,ipowasi),2*ks,0,iotype) + if (use_cisonew) then + IF(lread_iso) THEN + ! Burial fields for c-isotopes still missing + CALL read_netcdf_var(ncid,'ssso13',sedlay2(1,1,1,issso13),2*ks,0,iotype) + CALL read_netcdf_var(ncid,'ssso14',sedlay2(1,1,1,issso14),2*ks,0,iotype) + CALL read_netcdf_var(ncid,'sssc13',sedlay2(1,1,1,isssc13),2*ks,0,iotype) + CALL read_netcdf_var(ncid,'sssc14',sedlay2(1,1,1,isssc14),2*ks,0,iotype) + CALL read_netcdf_var(ncid,'powc13',powtra2(1,1,1,ipowc13),2*ks,0,iotype) + CALL read_netcdf_var(ncid,'powc14',powtra2(1,1,1,ipowc14),2*ks,0,iotype) + ENDIF + endif + end if ! ! Read restart data: atmosphere ! -#if defined(BOXATM) - IF(lread_atm) THEN - CALL read_netcdf_var(ncid,'atmco2',atm2(1,1,1,iatmco2),2,0,iotype) - CALL read_netcdf_var(ncid,'atmo2',atm2(1,1,1,iatmo2),2,0,iotype) - CALL read_netcdf_var(ncid,'atmn2',atm2(1,1,1,iatmn2),2,0,iotype) -#ifdef cisonew - IF(lread_iso) THEN - CALL read_netcdf_var(ncid,'atmc13',atm2(1,1,1,iatmc13),2,0,iotype) - CALL read_netcdf_var(ncid,'atmc14',atm2(1,1,1,iatmc14),2,0,iotype) - ELSE - ! If atm isotopes are not in restart but boxatm is on, calculate initial value using atmco2 - ! that is just read in from restart files. Normalize atmc14 using beleg c14fac. - DO j=1,kpje - DO i=1,kpie - beta13 = (prei13/1000.)+1. - alpha14 = 2.*(prei13+25.) - d14cat = (prei14+alpha14)/(1.-alpha14/1000.) - atm(i,j,iatmc13) = beta13*re1312*atm2(i,j,1,iatmco2)/(1.+beta13*re1312) - atm(i,j,iatmc14) = ((d14cat/1000.)+1.)*re14to*atm2(i,j,1,iatmco2)/c14fac - ENDDO - ENDDO - ! Copy the isotope atmosphere fields into both timelevels of atm2. - atm2(:,:,1,iatmc13) = atm(:,:,iatmc13) - atm2(:,:,2,iatmc13) = atm(:,:,iatmc13) - atm2(:,:,1,iatmc14) = atm(:,:,iatmc14) - atm2(:,:,2,iatmc14) = atm(:,:,iatmc14) - ENDIF -#endif -#ifdef natDIC - CALL read_netcdf_var(ncid,'atmnco2',atm2(1,1,1,iatmnco2),2,0,iotype) -#endif - ELSE - ! If atmosphere field is not in restart, copy the atmosphere field - ! (initialised in beleg.F90) into both timelevels of atm2. - atm2(:,:,1,:) = atm(:,:,:) - atm2(:,:,2,:) = atm(:,:,:) - ENDIF -#endif + if (use_BOXATM) then + IF(lread_atm) THEN + CALL read_netcdf_var(ncid,'atmco2',atm2(1,1,1,iatmco2),2,0,iotype) + CALL read_netcdf_var(ncid,'atmo2',atm2(1,1,1,iatmo2),2,0,iotype) + CALL read_netcdf_var(ncid,'atmn2',atm2(1,1,1,iatmn2),2,0,iotype) + if (use_cisonew) then + IF(lread_iso) THEN + CALL read_netcdf_var(ncid,'atmc13',atm2(1,1,1,iatmc13),2,0,iotype) + CALL read_netcdf_var(ncid,'atmc14',atm2(1,1,1,iatmc14),2,0,iotype) + ELSE + ! If atm isotopes are not in restart but boxatm is on, calculate initial value using atmco2 + ! that is just read in from restart files. Normalize atmc14 using beleg c14fac. + DO j=1,kpje + DO i=1,kpie + beta13 = (prei13/1000.)+1. + alpha14 = 2.*(prei13+25.) + d14cat = (prei14+alpha14)/(1.-alpha14/1000.) + atm(i,j,iatmc13) = beta13*re1312*atm2(i,j,1,iatmco2)/(1.+beta13*re1312) + atm(i,j,iatmc14) = ((d14cat/1000.)+1.)*re14to*atm2(i,j,1,iatmco2)/c14fac + ENDDO + ENDDO + ! Copy the isotope atmosphere fields into both timelevels of atm2. + atm2(:,:,1,iatmc13) = atm(:,:,iatmc13) + atm2(:,:,2,iatmc13) = atm(:,:,iatmc13) + atm2(:,:,1,iatmc14) = atm(:,:,iatmc14) + atm2(:,:,2,iatmc14) = atm(:,:,iatmc14) + ENDIF + endif + if (use_natDIC) then + CALL read_netcdf_var(ncid,'atmnco2',atm2(1,1,1,iatmnco2),2,0,iotype) + endif + ELSE + ! If atmosphere field is not in restart, copy the atmosphere field + ! (initialised in beleg.F90) into both timelevels of atm2. + atm2(:,:,1,:) = atm(:,:,:) + atm2(:,:,2,:) = atm(:,:,:) + ENDIF + end if IF(mnproc==1 .AND. IOTYPE==0) THEN - ncstat = NF90_CLOSE(ncid) + ncstat = NF90_CLOSE(ncid) ELSE IF(IOTYPE==1) THEN #ifdef PNETCDF - ncstat = NFMPI_CLOSE(ncid) + ncstat = NFMPI_CLOSE(ncid) #endif ENDIF - -#ifdef cisonew - IF(.NOT. lread_iso) THEN - ! If carbon isotope fields are not read from restart file, copy the d13C - ! d14C fields (initialised in beleg.F90) into both timelevels of locetra. - locetra(:,:,1:kpke, isco213)=ocetra(:,:,:,isco213) - locetra(:,:,kpke+1:2*kpke,isco213)=ocetra(:,:,:,isco213) - locetra(:,:,1:kpke, isco214)=ocetra(:,:,:,isco214) - locetra(:,:,kpke+1:2*kpke,isco214)=ocetra(:,:,:,isco214) - ! Initialise 13C and 14C fields in the same way as in beleg.F90 - DO k=1,2*kpke - DO j=1,kpje - DO i=1,kpie - IF(omask(i,j) .GT. 0.5) THEN - ! 13C is read in as delta13C, convert to 13C using model restart total C - beta13=locetra(i,j,k,isco213)/1000.+1. - locetra(i,j,k,isco213)=locetra(i,j,k,isco212)*beta13*re1312/(1.+beta13*re1312) - - ! 14C is read in as delta14C, convert to 14C using model restart total C, - ! normalize 14C by c14fac to prevent numerical errors - beta14=locetra(i,j,k,isco214)/1000.+1. - locetra(i,j,k,isco214)=locetra(i,j,k,isco212)*beta14*re14to/c14fac - - ! Initialise the remaining 13C and 14C fields, using the restart isco212 field - rco213=locetra(i,j,k,isco213)/(locetra(i,j,k,isco212)+safediv) - rco214=locetra(i,j,k,isco214)/(locetra(i,j,k,isco212)+safediv) - locetra(i,j,k,idoc13)=locetra(i,j,k,idoc)*rco213*bifr13 - locetra(i,j,k,idoc14)=locetra(i,j,k,idoc)*rco214*bifr14 - locetra(i,j,k,iphy13)=locetra(i,j,k,iphy)*rco213*bifr13 - locetra(i,j,k,iphy14)=locetra(i,j,k,iphy)*rco214*bifr14 - locetra(i,j,k,izoo13)=locetra(i,j,k,izoo)*rco213*bifr13 - locetra(i,j,k,izoo14)=locetra(i,j,k,izoo)*rco214*bifr14 - locetra(i,j,k,idet13)=locetra(i,j,k,idet)*rco213*bifr13 - locetra(i,j,k,idet14)=locetra(i,j,k,idet)*rco214*bifr14 - locetra(i,j,k,icalc13)=locetra(i,j,k,icalc)*rco213 - locetra(i,j,k,icalc14)=locetra(i,j,k,icalc)*rco214 - - ENDIF - ENDDO - ENDDO - ENDDO -#ifndef sedbypass - ! Burial fields for c-isotopes still missing - DO k=1,2*ks - DO j=1,kpje - DO i=1,kpie - IF(omask(i,j) .GT. 0.5) THEN - rco213=ocetra(i,j,kbo(i,j),isco213)/(ocetra(i,j,kbo(i,j),isco212)+safediv) - rco214=ocetra(i,j,kbo(i,j),isco214)/(ocetra(i,j,kbo(i,j),isco212)+safediv) - powtra2(i,j,k,ipowc13)=powtra2(i,j,k,ipowc)*rco213*bifr13 - powtra2(i,j,k,ipowc14)=powtra2(i,j,k,ipowc)*rco214*bifr14 - sedlay2(i,j,k,issso13)=sedlay2(i,j,k,issso)*rco213*bifr13 - sedlay2(i,j,k,issso14)=sedlay2(i,j,k,issso)*rco214*bifr14 - sedlay2(i,j,k,isssc13)=sedlay2(i,j,k,isssc)*rco213 - sedlay2(i,j,k,isssc14)=sedlay2(i,j,k,isssc)*rco214 - ENDIF - ENDDO - ENDDO - ENDDO -#endif - ENDIF ! .NOT. lread_iso -#endif + if (use_cisonew) then + IF(.NOT. lread_iso) THEN + ! If carbon isotope fields are not read from restart file, copy the d13C + ! d14C fields (initialised in beleg.F90) into both timelevels of locetra. + locetra(:,:,1:kpke, isco213)=ocetra(:,:,:,isco213) + locetra(:,:,kpke+1:2*kpke,isco213)=ocetra(:,:,:,isco213) + locetra(:,:,1:kpke, isco214)=ocetra(:,:,:,isco214) + locetra(:,:,kpke+1:2*kpke,isco214)=ocetra(:,:,:,isco214) + ! Initialise 13C and 14C fields in the same way as in beleg.F90 + DO k=1,2*kpke + DO j=1,kpje + DO i=1,kpie + IF(omask(i,j) .GT. 0.5) THEN + ! 13C is read in as delta13C, convert to 13C using model restart total C + beta13=locetra(i,j,k,isco213)/1000.+1. + locetra(i,j,k,isco213)=locetra(i,j,k,isco212)*beta13*re1312/(1.+beta13*re1312) + + ! 14C is read in as delta14C, convert to 14C using model restart total C, + ! normalize 14C by c14fac to prevent numerical errors + beta14=locetra(i,j,k,isco214)/1000.+1. + locetra(i,j,k,isco214)=locetra(i,j,k,isco212)*beta14*re14to/c14fac + + ! Initialise the remaining 13C and 14C fields, using the restart isco212 field + rco213=locetra(i,j,k,isco213)/(locetra(i,j,k,isco212)+safediv) + rco214=locetra(i,j,k,isco214)/(locetra(i,j,k,isco212)+safediv) + locetra(i,j,k,idoc13)=locetra(i,j,k,idoc)*rco213*bifr13 + locetra(i,j,k,idoc14)=locetra(i,j,k,idoc)*rco214*bifr14 + locetra(i,j,k,iphy13)=locetra(i,j,k,iphy)*rco213*bifr13 + locetra(i,j,k,iphy14)=locetra(i,j,k,iphy)*rco214*bifr14 + locetra(i,j,k,izoo13)=locetra(i,j,k,izoo)*rco213*bifr13 + locetra(i,j,k,izoo14)=locetra(i,j,k,izoo)*rco214*bifr14 + locetra(i,j,k,idet13)=locetra(i,j,k,idet)*rco213*bifr13 + locetra(i,j,k,idet14)=locetra(i,j,k,idet)*rco214*bifr14 + locetra(i,j,k,icalc13)=locetra(i,j,k,icalc)*rco213 + locetra(i,j,k,icalc14)=locetra(i,j,k,icalc)*rco214 + + ENDIF + ENDDO + ENDDO + ENDDO + + if (.not. use_sedbypass) then + ! Burial fields for c-isotopes still missing + DO k=1,2*ks + DO j=1,kpje + DO i=1,kpie + IF(omask(i,j) .GT. 0.5) THEN + rco213=ocetra(i,j,kbo(i,j),isco213)/(ocetra(i,j,kbo(i,j),isco212)+safediv) + rco214=ocetra(i,j,kbo(i,j),isco214)/(ocetra(i,j,kbo(i,j),isco212)+safediv) + powtra2(i,j,k,ipowc13)=powtra2(i,j,k,ipowc13)*rco213*bifr13 + powtra2(i,j,k,ipowc14)=powtra2(i,j,k,ipowc14)*rco214*bifr14 + sedlay2(i,j,k,issso13)=sedlay2(i,j,k,issso13)*rco213*bifr13 + sedlay2(i,j,k,issso14)=sedlay2(i,j,k,issso14)*rco214*bifr14 + sedlay2(i,j,k,isssc13)=sedlay2(i,j,k,isssc13)*rco213 + sedlay2(i,j,k,isssc14)=sedlay2(i,j,k,isssc14)*rco214 + ENDIF + ENDDO + ENDDO + ENDDO + end if + ENDIF ! .NOT. lread_iso + end if ! return tracer fields to ocean model (both timelevels); No unit ! conversion here, since tracers in the restart file are in @@ -615,4 +613,4 @@ SUBROUTINE AUFR_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & RETURN - END + END SUBROUTINE AUFR_BGC diff --git a/hamocc/aufw_bgc.F90 b/hamocc/aufw_bgc.F90 index 90949313..3c6796e3 100644 --- a/hamocc/aufw_bgc.F90 +++ b/hamocc/aufw_bgc.F90 @@ -5,16 +5,16 @@ ! 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. +! 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 +! 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. +! more details. ! -! You should have received a copy of the GNU Lesser General Public License +! You should have received a copy of the GNU Lesser General Public License ! along with BLOM. If not, see https://www.gnu.org/licenses/. @@ -41,7 +41,7 @@ SUBROUTINE AUFW_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & ! - code cleanup, removed preprocessor option "PNETCDF" ! ! J.Schwinger, *GFI, Bergen* 2014-05-21 -! - adapted code for writing of two time level tracer and +! - adapted code for writing of two time level tracer and ! sediment fields ! ! A.Moree, *GFI, Bergen* 2018-04-12 @@ -69,7 +69,7 @@ SUBROUTINE AUFW_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & ! The bgc data are written to an extra file, other than the ocean data. ! The time stamp of the bgc restart file (idate) is taken from the ! ocean time stamp through the SBR parameter list. The only time -! control variable proper to the bgc is the time step number (idate(5)). +! control variable proper to the bgc is the time step number (idate(5)). ! It can differ from that of the ocean (idate(4)) by the difference ! of the offsets of restart files. ! @@ -83,7 +83,7 @@ SUBROUTINE AUFW_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & ! *INTEGER* *ntr* - number of tracers in tracer field ! *INTEGER* *ntrbgc* - number of biogechemical tracers in tracer field ! *INTEGER* *itrbgc* - start index for biogeochemical tracers in tracer field -! *REAL* *trc* - initial/restart tracer field to be passed from the +! *REAL* *trc* - initial/restart tracer field to be passed from the ! ocean model [mol/kg] ! *REAL* *sedlay2* - initial/restart sediment (two time levels) field ! *REAL* *powtra2* - initial/restart pore water tracer (two time levels) field @@ -97,7 +97,7 @@ SUBROUTINE AUFW_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & ! !************************************************************************** use netcdf, only: nf90_64bit_offset,nf90_global,nf90_noerr,nf90_nofill,nf90_def_dim,nf90_enddef,nf90_close, & - & nf90_create,nf90_put_att,nf90_set_fill + & nf90_create,nf90_put_att,nf90_set_fill use mo_carbch, only: co2star,co3, hi,satoxy use mo_control_bgc, only: io_stdo_bgc,ldtbgc,rmasko use mo_param1_bgc, only: ialkali, ian2o,iano3,icalc,idet,idicsat,idms,idoc,ifdust,igasnit,iiron,iopal,ioxygen,iphosph,iphy, & @@ -106,30 +106,33 @@ SUBROUTINE AUFW_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & use mo_intfcblom, only: sedlay2,powtra2,burial2,atm2 use mod_xc, only: nbdy,itdm,jtdm,mnproc,iqr,jqr,xchalt use mod_dia, only: iotype -#ifdef AGG + ! AGG use mo_param1_bgc, only: iadust, inos -#endif -#ifdef BOXATM + + ! BOXATM use mo_param1_bgc, only: iatmco2,iatmn2,iatmo2 -#endif -#ifdef BROMO + + ! BROMO use mo_param1_bgc, only: ibromo -#endif -#ifdef CFC + + ! CFC use mo_param1_bgc, only: icfc11,icfc12,isf6 -#endif -#ifdef cisonew - use mo_param1_bgc, only: icalc13,icalc14,idet13,idet14,idoc13,idoc14,iphy13,iphy14,isco213,isco214,izoo13,izoo14 -#endif -#ifdef natDIC + + ! cisonew + use mo_param1_bgc, only: icalc13,icalc14,idet13,idet14,idoc13,idoc14,iphy13,iphy14,isco213,isco214,izoo13,izoo14, & + & issso13,issso14,isssc13,isssc14,ipowc13,ipowc14,iatmc13,iatmc14, & + & iatmnco2,issso13,issso14,isssc13,isssc14,ipowc13,ipowc14,iatmc13,iatmc14 + use mo_control_bgc, only: rmasks + + ! natDIC use mo_param1_bgc, only: inatalkali,inatcalc,inatsco212 use mo_carbch, only: nathi -#endif -#ifndef sedbypass + + ! NOT sedbypass use mo_param1_bgc, only: ipowaal,ipowaic,ipowaox,ipowaph,ipowasi,ipown2,ipowno3,isssc12,issso12,issssil,issster -#endif - + use mo_ifdefs + implicit none INTEGER, intent(in) :: kpie,kpje,kpke,ntr,ntrbgc,itrbgc @@ -140,7 +143,7 @@ SUBROUTINE AUFW_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & ! Local variables INTEGER :: i,j - REAL :: locetra(kpie,kpje,2*kpke,nocetra) + REAL :: locetra(kpie,kpje,2*kpke,-1:nocetra) ! Variables for netcdf INTEGER :: ncid,ncvarid,ncstat,ncoldmod,ncdimst(4) @@ -161,13 +164,13 @@ SUBROUTINE AUFW_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & save /xcmpii/ #endif -! pass tracer fields in from ocean model, note that both timelevels -! are passed into the local array locetra; No unit conversion here, -! tracers in the restart file are written in mol/kg +! pass tracer fields in from ocean model, note that both timelevels +! are passed into the local array locetra; No unit conversion here, +! tracers in the restart file are written in mol/kg !-------------------------------------------------------------------- ! testio=0 - locetra(:,:,:,:)=trc(1:kpie,1:kpje,:,itrbgc:itrbgc+ntrbgc-1) + locetra(:,:,:,1:)=trc(1:kpie,1:kpje,:,itrbgc:itrbgc+ntrbgc-1) idate(1) = kplyear idate(2) = kplmon @@ -221,7 +224,7 @@ SUBROUTINE AUFW_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & ENDIF ! ! Define dimension -! ---------------------------------------------------------------------- +! ---------------------------------------------------------------------- ! IF(mnproc==1 .AND. IOTYPE==0) THEN ncstat = NF90_DEF_DIM(ncid, 'lon', itdm, nclonid) @@ -320,11 +323,11 @@ SUBROUTINE AUFW_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & ! ! Define global attributes -! ---------------------------------------------------------------------- +! ---------------------------------------------------------------------- ! IF(mnproc==1 .AND. IOTYPE==0) THEN ncstat = NF90_PUT_ATT(ncid, NF90_GLOBAL,'title' & - &, 'Restart data for marine bgc modules') + &, 'Restart data for marine bgc modules') IF ( ncstat .NE. NF90_NOERR ) THEN call xchalt('(AUFW: Problem with netCDF9)') stop '(AUFW: Problem with netCDF9)' @@ -398,9 +401,9 @@ SUBROUTINE AUFW_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & ENDIF #endif ENDIF -! +! ! Define variables : advected ocean tracer -! ---------------------------------------------------------------------- +! ---------------------------------------------------------------------- ! IF((mnproc==1 .AND. IOTYPE==0) .OR. IOTYPE==1) THEN ncdimst(1) = nclonid @@ -436,7 +439,7 @@ SUBROUTINE AUFW_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & CALL NETCDF_DEF_VARDB(ncid,3,'doc',3,ncdimst,ncvarid, & & 6,'mol/kg',24,'Dissolved organic carbon', & - & rmissing,17,io_stdo_bgc) + & rmissing,17,io_stdo_bgc) CALL NETCDF_DEF_VARDB(ncid,3,'poc',3,ncdimst,ncvarid, & & 6,'mol/kg',25,'Particulate organic carbon', & @@ -464,7 +467,7 @@ SUBROUTINE AUFW_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & CALL NETCDF_DEF_VARDB(ncid,3,'dms',3,ncdimst,ncvarid, & & 6,'mol/kg',15 ,'DiMethylSulfide', & - & rmissing,24,io_stdo_bgc) + & rmissing,24,io_stdo_bgc) CALL NETCDF_DEF_VARDB(ncid,5,'fdust',3,ncdimst,ncvarid, & & 5,'kg/kg',19,'Non-aggregated dust', & @@ -494,94 +497,94 @@ SUBROUTINE AUFW_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & & 6,'mol/kg',13,'Saturated dic', & rmissing,31,io_stdo_bgc) -#ifdef cisonew - CALL NETCDF_DEF_VARDB(ncid,6,'sco213',3,ncdimst,ncvarid, & - & 6,'mol/kg',15, 'Dissolved CO213',rmissing,32,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,6,'sco214',3,ncdimst,ncvarid, & - & 6,'mol/kg',15, 'Dissolved CO214',rmissing,33,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,5,'doc13',3,ncdimst,ncvarid, & - & 6,'mol/kg',24,'Dissolved organic carb13', & - & rmissing,34,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,5,'doc14',3,ncdimst,ncvarid, & - & 6,'mol/kg',24,'Dissolved organic carb14', & - & rmissing,35,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,5,'poc13',3,ncdimst,ncvarid, & - & 7,'molC/kg',28,'Particulate organic carbon13', & - & rmissing,36,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,5,'poc14',3,ncdimst,ncvarid, & - & 7,'molC/kg',28,'Particulate organic carbon14', & - & rmissing,37,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,7,'phyto13',3,ncdimst,ncvarid, & - & 7,'molP/kg',27,'Phytoplankton concentr. 13c', & - & rmissing,38,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,7,'phyto14',3,ncdimst,ncvarid, & - & 7,'molP/kg',27,'Phytoplankton concentr. 14c', & - & rmissing,39,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,8,'grazer13',3,ncdimst,ncvarid, & - & 7,'molP/kg',25,'Zooplankton concentr. 13c', & - & rmissing,40,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,8,'grazer14',3,ncdimst,ncvarid, & - & 7,'molP/kg',25,'Zooplankton concentr. 14c', & - & rmissing,41,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,8,'calciu13',3,ncdimst,ncvarid, & - & 7,'molC/kg',19,'Calcium carbonate13', & - & rmissing,42,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,8,'calciu14',3,ncdimst,ncvarid, & - & 7,'molC/kg',19,'Calcium carbonate14', & - & rmissing,43,io_stdo_bgc) -#endif -#ifdef AGG - CALL NETCDF_DEF_VARDB(ncid,4,'snos',3,ncdimst,ncvarid, & - & 3,'1/g',38,'marine snow aggregates per g sea water', & - & rmissing,44,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,5,'adust',3,ncdimst,ncvarid, & - & 4,'g/kg',15,'Aggregated dust', & - & rmissing,45,io_stdo_bgc) -#endif -#ifdef CFC - CALL NETCDF_DEF_VARDB(ncid,5,'cfc11',3,ncdimst,ncvarid, & - & 6,'mol/kg',5,'CFC11', & - & rmissing,47,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,5,'cfc12',3,ncdimst,ncvarid, & - & 6,'mol/kg',5,'CFC12', & - & rmissing,48,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,3,'sf6',3,ncdimst,ncvarid, & - & 6,'mol/kg',4,'SF-6', & - & rmissing,49,io_stdo_bgc) -#endif -#ifdef natDIC - CALL NETCDF_DEF_VARDB(ncid,9,'natsco212',3,ncdimst,ncvarid, & - & 6,'mol/kg',21, 'Natural dissolved CO2',rmissing,50,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,9,'natalkali',3,ncdimst,ncvarid, & - & 6,'mol/kg',18,'Natural alkalinity',rmissing,51,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,9,'natcalciu',3,ncdimst,ncvarid, & - & 6,'mol/kg',25,'Natural calcium carbonate', & - & rmissing,52,io_stdo_bgc) -#endif -#ifdef BROMO - CALL NETCDF_DEF_VARDB(ncid,5,'bromo',3,ncdimst,ncvarid, & - & 6,'mol/kg',9,'Bromoform',rmissing,47,io_stdo_bgc) -#endif + if (use_cisonew) then + CALL NETCDF_DEF_VARDB(ncid,6,'sco213',3,ncdimst,ncvarid, & + & 6,'mol/kg',15, 'Dissolved CO213',rmissing,32,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,6,'sco214',3,ncdimst,ncvarid, & + & 6,'mol/kg',15, 'Dissolved CO214',rmissing,33,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,5,'doc13',3,ncdimst,ncvarid, & + & 6,'mol/kg',24,'Dissolved organic carb13', & + & rmissing,34,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,5,'doc14',3,ncdimst,ncvarid, & + & 6,'mol/kg',24,'Dissolved organic carb14', & + & rmissing,35,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,5,'poc13',3,ncdimst,ncvarid, & + & 7,'molC/kg',28,'Particulate organic carbon13', & + & rmissing,36,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,5,'poc14',3,ncdimst,ncvarid, & + & 7,'molC/kg',28,'Particulate organic carbon14', & + & rmissing,37,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,7,'phyto13',3,ncdimst,ncvarid, & + & 7,'molP/kg',27,'Phytoplankton concentr. 13c', & + & rmissing,38,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,7,'phyto14',3,ncdimst,ncvarid, & + & 7,'molP/kg',27,'Phytoplankton concentr. 14c', & + & rmissing,39,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,8,'grazer13',3,ncdimst,ncvarid, & + & 7,'molP/kg',25,'Zooplankton concentr. 13c', & + & rmissing,40,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,8,'grazer14',3,ncdimst,ncvarid, & + & 7,'molP/kg',25,'Zooplankton concentr. 14c', & + & rmissing,41,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,8,'calciu13',3,ncdimst,ncvarid, & + & 7,'molC/kg',19,'Calcium carbonate13', & + & rmissing,42,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,8,'calciu14',3,ncdimst,ncvarid, & + & 7,'molC/kg',19,'Calcium carbonate14', & + & rmissing,43,io_stdo_bgc) + end if + if (use_AGG) then + CALL NETCDF_DEF_VARDB(ncid,4,'snos',3,ncdimst,ncvarid, & + & 3,'1/g',38,'marine snow aggregates per g sea water', & + & rmissing,44,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,5,'adust',3,ncdimst,ncvarid, & + & 4,'g/kg',15,'Aggregated dust', & + & rmissing,45,io_stdo_bgc) + end if + if (use_CFC) then + CALL NETCDF_DEF_VARDB(ncid,5,'cfc11',3,ncdimst,ncvarid, & + & 6,'mol/kg',5,'CFC11', & + & rmissing,47,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,5,'cfc12',3,ncdimst,ncvarid, & + & 6,'mol/kg',5,'CFC12', & + & rmissing,48,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,3,'sf6',3,ncdimst,ncvarid, & + & 6,'mol/kg',4,'SF-6', & + & rmissing,49,io_stdo_bgc) + end if + if (use_natDIC) then + CALL NETCDF_DEF_VARDB(ncid,9,'natsco212',3,ncdimst,ncvarid, & + & 6,'mol/kg',21, 'Natural dissolved CO2',rmissing,50,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,9,'natalkali',3,ncdimst,ncvarid, & + & 6,'mol/kg',18,'Natural alkalinity',rmissing,51,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,9,'natcalciu',3,ncdimst,ncvarid, & + & 6,'mol/kg',25,'Natural calcium carbonate', & + & rmissing,52,io_stdo_bgc) + end if + if (use_BROMO) then + CALL NETCDF_DEF_VARDB(ncid,5,'bromo',3,ncdimst,ncvarid, & + & 6,'mol/kg',9,'Bromoform',rmissing,47,io_stdo_bgc) + end if ! ! Define variables : diagnostic ocean fields -! ---------------------------------------------------------------------- +! ---------------------------------------------------------------------- ! IF((mnproc==1 .AND. IOTYPE==0) .OR. IOTYPE==1) THEN ncdimst(1) = nclonid @@ -606,176 +609,178 @@ SUBROUTINE AUFW_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & & 6,'mol/kg',16 ,'Saturated oxygen', & & rmissing,63,io_stdo_bgc) -#ifdef natDIC - CALL NETCDF_DEF_VARDB(ncid,5,'nathi',3,ncdimst,ncvarid, & - & 6,'mol/kg',34,'Natural hydrogen ion concentration', & - & rmissing,64,io_stdo_bgc) -#endif + if (use_natDIC) then + CALL NETCDF_DEF_VARDB(ncid,5,'nathi',3,ncdimst,ncvarid, & + & 6,'mol/kg',34,'Natural hydrogen ion concentration', & + & rmissing,64,io_stdo_bgc) + end if ! ! Define variables : sediment -! ---------------------------------------------------------------------- +! ---------------------------------------------------------------------- ! -#ifndef sedbypass - IF((mnproc==1 .AND. IOTYPE==0) .OR. IOTYPE==1) THEN - ncdimst(1) = nclonid - ncdimst(2) = nclatid - ncdimst(3) = ncks2id - ncdimst(4) = 0 - ENDIF - - CALL NETCDF_DEF_VARDB(ncid,6,'ssso12',3,ncdimst,ncvarid, & - & 9,'kmol/m**3',35,'Sediment accumulated organic carbon', & - & rmissing,70,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,6,'sssc12',3,ncdimst,ncvarid, & - & 9,'kmol/m**3',38,'Sediment accumulated calcium carbonate', & - & rmissing,71,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,6,'ssssil',3,ncdimst,ncvarid, & - & 9,'kmol/m**3',25,'Sediment accumulated opal', & - & rmissing,72,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,6,'ssster',3,ncdimst,ncvarid, & - & 7,'kg/m**3',25,'Sediment accumulated clay', & - & rmissing,73,io_stdo_bgc) + if (.not. use_sedbypass) then - CALL NETCDF_DEF_VARDB(ncid,6,'powaic',3,ncdimst,ncvarid, & - & 9,'kmol/m**3',23,'Sediment pore water CO2', & - & rmissing,74,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,6,'powaal',3,ncdimst,ncvarid, & - & 9,'kmol/m**3',30,'Sediment pore water alkalinity', & - & rmissing,75,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,6,'powaph',3,ncdimst,ncvarid, & - & 9,'kmol/m**3',29,'Sediment pore water phosphate', & - & rmissing,76,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,6,'powaox',3,ncdimst,ncvarid, & - & 9,'kmol/m**3',26,'Sediment pore water oxygen', & - & rmissing,77,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,5,'pown2',3,ncdimst,ncvarid, & - & 9,'kmol/m**3',36,'Sediment pore water gaseous nitrogen', & - & rmissing,78,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,6,'powno3',3,ncdimst,ncvarid, & - & 9,'kmol/m**3',33,'Sediment pore water nitrate (NO3)', & - & rmissing,79,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,6,'powasi',3,ncdimst,ncvarid, & - & 9,'kmol/m**3',42,'Sediment pore water silicid acid (Si(OH)4)',& - & rmissing,80,io_stdo_bgc) - -#ifdef cisonew - CALL NETCDF_DEF_VARDB(ncid,6,'ssso13',3,ncdimst,ncvarid, & - & 9,'kmol/m**3',37,'Sediment accumulated organic carbon13', & - & rmasks,81,io_stdo_bgc) + IF((mnproc==1 .AND. IOTYPE==0) .OR. IOTYPE==1) THEN + ncdimst(1) = nclonid + ncdimst(2) = nclatid + ncdimst(3) = ncks2id + ncdimst(4) = 0 + ENDIF - CALL NETCDF_DEF_VARDB(ncid,6,'ssso14',3,ncdimst,ncvarid, & - & 9,'kmol/m**3',37,'Sediment accumulated organic carbon14', & - & rmasks,82,io_stdo_bgc) + CALL NETCDF_DEF_VARDB(ncid,6,'ssso12',3,ncdimst,ncvarid, & + & 9,'kmol/m**3',35,'Sediment accumulated organic carbon', & + & rmissing,70,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,6,'sssc12',3,ncdimst,ncvarid, & + & 9,'kmol/m**3',38,'Sediment accumulated calcium carbonate', & + & rmissing,71,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,6,'ssssil',3,ncdimst,ncvarid, & + & 9,'kmol/m**3',25,'Sediment accumulated opal', & + & rmissing,72,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,6,'ssster',3,ncdimst,ncvarid, & + & 7,'kg/m**3',25,'Sediment accumulated clay', & + & rmissing,73,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,6,'powaic',3,ncdimst,ncvarid, & + & 9,'kmol/m**3',23,'Sediment pore water CO2', & + & rmissing,74,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,6,'powaal',3,ncdimst,ncvarid, & + & 9,'kmol/m**3',30,'Sediment pore water alkalinity', & + & rmissing,75,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,6,'powaph',3,ncdimst,ncvarid, & + & 9,'kmol/m**3',29,'Sediment pore water phosphate', & + & rmissing,76,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,6,'powaox',3,ncdimst,ncvarid, & + & 9,'kmol/m**3',26,'Sediment pore water oxygen', & + & rmissing,77,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,5,'pown2',3,ncdimst,ncvarid, & + & 9,'kmol/m**3',36,'Sediment pore water gaseous nitrogen', & + & rmissing,78,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,6,'powno3',3,ncdimst,ncvarid, & + & 9,'kmol/m**3',33,'Sediment pore water nitrate (NO3)', & + & rmissing,79,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,6,'powasi',3,ncdimst,ncvarid, & + & 9,'kmol/m**3',42,'Sediment pore water silicid acid (Si(OH)4)',& + & rmissing,80,io_stdo_bgc) + + if (use_cisonew) then + CALL NETCDF_DEF_VARDB(ncid,6,'ssso13',3,ncdimst,ncvarid, & + & 9,'kmol/m**3',37,'Sediment accumulated organic carbon13', & + & rmasks,81,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,6,'ssso14',3,ncdimst,ncvarid, & + & 9,'kmol/m**3',37,'Sediment accumulated organic carbon14', & + & rmasks,82,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,6,'sssc13',3,ncdimst,ncvarid, & + & 9,'kmol/m**3',40,'Sediment accumulated calcium carbonate13', & + & rmasks,83,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,6,'sssc14',3,ncdimst,ncvarid, & + & 9,'kmol/m**3',40,'Sediment accumulated calcium carbonate14', & + & rmasks,84,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,6,'powc13',3,ncdimst,ncvarid, & + & 9,'kmol/m**3',25,'Sediment pore water DIC13', & + & rmasks,85,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,6,'powc14',3,ncdimst,ncvarid, & + & 9,'kmol/m**3',25,'Sediment pore water DIC14', & + & rmasks,86,io_stdo_bgc) + end if + + IF((mnproc==1 .AND. IOTYPE==0) .OR. IOTYPE==1) THEN + ncdimst(1) = nclonid + ncdimst(2) = nclatid + ncdimst(3) = ncksid + ncdimst(4) = 0 + ENDIF - CALL NETCDF_DEF_VARDB(ncid,6,'sssc13',3,ncdimst,ncvarid, & - & 9,'kmol/m**3',40,'Sediment accumulated calcium carbonate13', & - & rmasks,83,io_stdo_bgc) + CALL NETCDF_DEF_VARDB(ncid,6,'sedhpl',3,ncdimst,ncvarid, & + & 9,'kmol/m**2',34,'Sediment accumulated hydrogen ions', & + & rmissing,87,io_stdo_bgc) + + ! + ! Define variables : sediment burial + ! ---------------------------------------------------------------------- + ! + IF((mnproc==1 .AND. IOTYPE==0) .OR. IOTYPE==1) THEN + ncdimst(1) = nclonid + ncdimst(2) = nclatid + ncdimst(3) = nctlvl2id + ncdimst(4) = 0 + ENDIF - CALL NETCDF_DEF_VARDB(ncid,6,'sssc14',3,ncdimst,ncvarid, & - & 9,'kmol/m**3',40,'Sediment accumulated calcium carbonate14', & - & rmasks,84,io_stdo_bgc) + CALL NETCDF_DEF_VARDB(ncid,7,'bur_o12',3,ncdimst,ncvarid, & + & 9,'kmol/m**2',30,'Burial layer of organic carbon', & + & rmissing,90,io_stdo_bgc) - CALL NETCDF_DEF_VARDB(ncid,6,'powc13',3,ncdimst,ncvarid, & - & 9,'kmol/m**3',25,'Sediment pore water DIC13', & - & rmasks,85,io_stdo_bgc) + CALL NETCDF_DEF_VARDB(ncid,7,'bur_c12',3,ncdimst,ncvarid, & + & 9,'kmol/m**2',33,'Burial layer of calcium carbonate', & + & rmissing,91,io_stdo_bgc) - CALL NETCDF_DEF_VARDB(ncid,6,'powc14',3,ncdimst,ncvarid, & - & 9,'kmol/m**3',25,'Sediment pore water DIC14', & - & rmasks,86,io_stdo_bgc) -#endif + CALL NETCDF_DEF_VARDB(ncid,7,'bur_sil',3,ncdimst,ncvarid, & + & 9,'kmol/m**2',20,'Burial layer of opal', & + & rmissing,92,io_stdo_bgc) - IF((mnproc==1 .AND. IOTYPE==0) .OR. IOTYPE==1) THEN - ncdimst(1) = nclonid - ncdimst(2) = nclatid - ncdimst(3) = ncksid - ncdimst(4) = 0 - ENDIF + CALL NETCDF_DEF_VARDB(ncid,8,'bur_clay',3,ncdimst,ncvarid, & + & 7,'kg/m**2',20,'Burial layer of clay', & + & rmissing,93,io_stdo_bgc) - CALL NETCDF_DEF_VARDB(ncid,6,'sedhpl',3,ncdimst,ncvarid, & - & 9,'kmol/m**2',34,'Sediment accumulated hydrogen ions', & - & rmissing,87,io_stdo_bgc) + end if ! not sedbypass ! -! Define variables : sediment burial -! ---------------------------------------------------------------------- -! - IF((mnproc==1 .AND. IOTYPE==0) .OR. IOTYPE==1) THEN - ncdimst(1) = nclonid - ncdimst(2) = nclatid - ncdimst(3) = nctlvl2id - ncdimst(4) = 0 - ENDIF - - CALL NETCDF_DEF_VARDB(ncid,7,'bur_o12',3,ncdimst,ncvarid, & - & 9,'kmol/m**2',30,'Burial layer of organic carbon', & - & rmissing,90,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,7,'bur_c12',3,ncdimst,ncvarid, & - & 9,'kmol/m**2',33,'Burial layer of calcium carbonate', & - & rmissing,91,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,7,'bur_sil',3,ncdimst,ncvarid, & - & 9,'kmol/m**2',20,'Burial layer of opal', & - & rmissing,92,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,8,'bur_clay',3,ncdimst,ncvarid, & - & 7,'kg/m**2',20,'Burial layer of clay', & - & rmissing,93,io_stdo_bgc) +! Define variables: atmosphere +! ---------------------------------------------------------------------- +! + if (use_BOXATM) then + IF((mnproc==1 .AND. IOTYPE==0) .OR. IOTYPE==1) THEN + ncdimst(1) = nclonid + ncdimst(2) = nclatid + ncdimst(3) = nctlvl2id + ncdimst(4) = 0 + ENDIF -#endif /* sedbypass */ + CALL NETCDF_DEF_VARDB(ncid,6,'atmco2',3,ncdimst,ncvarid, & + & 3,'ppm',15,'atmospheric CO2', & + & rmissing,101,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,5,'atmo2',3,ncdimst,ncvarid, & + & 3,'ppm',14,'atmospheric O2', & + & rmissing,102,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,5,'atmn2',3,ncdimst,ncvarid, & + & 3,'ppm',14,'atmospheric N2', & + & rmissing,103,io_stdo_bgc) + + if (use_cisonew) then + CALL NETCDF_DEF_VARDB(ncid,6,'atmc13',3,ncdimst,ncvarid, & + & 3,'ppm',17,'atmospheric 13CO2', & + & rmissing,104,io_stdo_bgc) + CALL NETCDF_DEF_VARDB(ncid,6,'atmc14',3,ncdimst,ncvarid, & + & 3,'ppm',17,'atmospheric 14CO2', & + & rmissing,105,io_stdo_bgc) + end if + if (use_natDIC) then + CALL NETCDF_DEF_VARDB(ncid,7,'atmnco2',3,ncdimst,ncvarid, & + & 3,'ppm',23,'natural atmospheric CO2', & + & rmissing,106,io_stdo_bgc) + end if + end if -! -! Define variables: atmosphere -! ---------------------------------------------------------------------- -! -#if defined(BOXATM) - IF((mnproc==1 .AND. IOTYPE==0) .OR. IOTYPE==1) THEN - ncdimst(1) = nclonid - ncdimst(2) = nclatid - ncdimst(3) = nctlvl2id - ncdimst(4) = 0 - ENDIF - - CALL NETCDF_DEF_VARDB(ncid,6,'atmco2',3,ncdimst,ncvarid, & - & 3,'ppm',15,'atmospheric CO2', & - & rmissing,101,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,5,'atmo2',3,ncdimst,ncvarid, & - & 3,'ppm',14,'atmospheric O2', & - & rmissing,102,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,5,'atmn2',3,ncdimst,ncvarid, & - & 3,'ppm',14,'atmospheric N2', & - & rmissing,103,io_stdo_bgc) - -#ifdef cisonew - CALL NETCDF_DEF_VARDB(ncid,6,'atmc13',3,ncdimst,ncvarid, & - & 3,'ppm',17,'atmospheric 13CO2', & - & rmissing,104,io_stdo_bgc) - CALL NETCDF_DEF_VARDB(ncid,6,'atmc14',3,ncdimst,ncvarid, & - & 3,'ppm',17,'atmospheric 14CO2', & - & rmissing,105,io_stdo_bgc) -#endif -#ifdef natDIC - CALL NETCDF_DEF_VARDB(ncid,7,'atmnco2',3,ncdimst,ncvarid, & - & 3,'ppm',23,'natural atmospheric CO2', & - & rmissing,106,io_stdo_bgc) -#endif -#endif IF(mnproc==1 .AND. IOTYPE==0) THEN ncstat = NF90_ENDDEF(ncid) - + IF ( ncstat .NE. NF90_NOERR ) THEN call xchalt('(AUFW: Problem with netCDF00)') stop '(AUFW: Problem with netCDF00)' @@ -783,7 +788,7 @@ SUBROUTINE AUFW_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & ! ! Set fill mode -! ---------------------------------------------------------------------- +! ---------------------------------------------------------------------- ! ncstat = NF90_SET_FILL(ncid,NF90_NOFILL, ncoldmod) IF ( ncstat .NE. NF90_NOERR ) THEN @@ -817,7 +822,7 @@ SUBROUTINE AUFW_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & CALL write_netcdf_var(ncid,'silica',locetra(1,1,1,isilica),2*kpke,0) CALL write_netcdf_var(ncid,'doc',locetra(1,1,1,idoc),2*kpke,0) CALL write_netcdf_var(ncid,'poc',locetra(1,1,1,idet),2*kpke,0) - CALL write_netcdf_var(ncid,'phyto',locetra(1,1,1,iphy),2*kpke,0) + CALL write_netcdf_var(ncid,'phyto',locetra(1,1,1,iphy),2*kpke,0) CALL write_netcdf_var(ncid,'grazer',locetra(1,1,1,izoo),2*kpke,0) CALL write_netcdf_var(ncid,'calciu',locetra(1,1,1,icalc),2*kpke,0) CALL write_netcdf_var(ncid,'opal',locetra(1,1,1,iopal),2*kpke,0) @@ -830,37 +835,37 @@ SUBROUTINE AUFW_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & CALL write_netcdf_var(ncid,'prefalk',locetra(1,1,1,iprefalk),2*kpke,0) CALL write_netcdf_var(ncid,'prefdic',locetra(1,1,1,iprefdic),2*kpke,0) CALL write_netcdf_var(ncid,'dicsat',locetra(1,1,1,idicsat),2*kpke,0) -#ifdef cisonew - CALL write_netcdf_var(ncid,'sco213',locetra(1,1,1,isco213),2*kpke,0) - CALL write_netcdf_var(ncid,'sco214',locetra(1,1,1,isco214),2*kpke,0) - CALL write_netcdf_var(ncid,'doc13',locetra(1,1,1,idoc13),2*kpke,0) - CALL write_netcdf_var(ncid,'doc14',locetra(1,1,1,idoc14),2*kpke,0) - CALL write_netcdf_var(ncid,'poc13',locetra(1,1,1,idet13),2*kpke,0) - CALL write_netcdf_var(ncid,'poc14',locetra(1,1,1,idet14),2*kpke,0) - CALL write_netcdf_var(ncid,'phyto13',locetra(1,1,1,iphy13),2*kpke,0) - CALL write_netcdf_var(ncid,'phyto14',locetra(1,1,1,iphy14),2*kpke,0) - CALL write_netcdf_var(ncid,'grazer13',locetra(1,1,1,izoo13),2*kpke,0) - CALL write_netcdf_var(ncid,'grazer14',locetra(1,1,1,izoo14),2*kpke,0) - CALL write_netcdf_var(ncid,'calciu13',locetra(1,1,1,icalc13),2*kpke,0) - CALL write_netcdf_var(ncid,'calciu14',locetra(1,1,1,icalc14),2*kpke,0) -#endif -#ifdef AGG - CALL write_netcdf_var(ncid,'snos',locetra(1,1,1,inos),2*kpke,0) - CALL write_netcdf_var(ncid,'adust',locetra(1,1,1,iadust),2*kpke,0) -#endif /*AGG*/ -#ifdef CFC - CALL write_netcdf_var(ncid,'cfc11',locetra(1,1,1,icfc11),2*kpke,0) - CALL write_netcdf_var(ncid,'cfc12',locetra(1,1,1,icfc12),2*kpke,0) - CALL write_netcdf_var(ncid,'sf6',locetra(1,1,1,isf6),2*kpke,0) -#endif -#ifdef natDIC - CALL write_netcdf_var(ncid,'natsco212',locetra(1,1,1,inatsco212),2*kpke,0) - CALL write_netcdf_var(ncid,'natalkali',locetra(1,1,1,inatalkali),2*kpke,0) - CALL write_netcdf_var(ncid,'natcalciu',locetra(1,1,1,inatcalc),2*kpke,0) -#endif -#ifdef BROMO - CALL write_netcdf_var(ncid,'bromo',locetra(1,1,1,ibromo),2*kpke,0) -#endif + if (use_cisonew) then + CALL write_netcdf_var(ncid,'sco213',locetra(1,1,1,isco213),2*kpke,0) + CALL write_netcdf_var(ncid,'sco214',locetra(1,1,1,isco214),2*kpke,0) + CALL write_netcdf_var(ncid,'doc13',locetra(1,1,1,idoc13),2*kpke,0) + CALL write_netcdf_var(ncid,'doc14',locetra(1,1,1,idoc14),2*kpke,0) + CALL write_netcdf_var(ncid,'poc13',locetra(1,1,1,idet13),2*kpke,0) + CALL write_netcdf_var(ncid,'poc14',locetra(1,1,1,idet14),2*kpke,0) + CALL write_netcdf_var(ncid,'phyto13',locetra(1,1,1,iphy13),2*kpke,0) + CALL write_netcdf_var(ncid,'phyto14',locetra(1,1,1,iphy14),2*kpke,0) + CALL write_netcdf_var(ncid,'grazer13',locetra(1,1,1,izoo13),2*kpke,0) + CALL write_netcdf_var(ncid,'grazer14',locetra(1,1,1,izoo14),2*kpke,0) + CALL write_netcdf_var(ncid,'calciu13',locetra(1,1,1,icalc13),2*kpke,0) + CALL write_netcdf_var(ncid,'calciu14',locetra(1,1,1,icalc14),2*kpke,0) + end if + if (use_AGG) then + CALL write_netcdf_var(ncid,'snos',locetra(1,1,1,inos),2*kpke,0) + CALL write_netcdf_var(ncid,'adust',locetra(1,1,1,iadust),2*kpke,0) + end if + if (use_CFC) then + CALL write_netcdf_var(ncid,'cfc11',locetra(1,1,1,icfc11),2*kpke,0) + CALL write_netcdf_var(ncid,'cfc12',locetra(1,1,1,icfc12),2*kpke,0) + CALL write_netcdf_var(ncid,'sf6',locetra(1,1,1,isf6),2*kpke,0) + end if + if (use_natDIC) then + CALL write_netcdf_var(ncid,'natsco212',locetra(1,1,1,inatsco212),2*kpke,0) + CALL write_netcdf_var(ncid,'natalkali',locetra(1,1,1,inatalkali),2*kpke,0) + CALL write_netcdf_var(ncid,'natcalciu',locetra(1,1,1,inatcalc),2*kpke,0) + end if + if (use_BROMO) then + CALL write_netcdf_var(ncid,'bromo',locetra(1,1,1,ibromo),2*kpke,0) + end if ! ! Write restart data : diagtnostic ocean fields @@ -869,53 +874,53 @@ SUBROUTINE AUFW_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & CALL write_netcdf_var(ncid,'co3',co3(1,1,1),kpke,0) CALL write_netcdf_var(ncid,'co2star',co2star(1,1,1),kpke,0) CALL write_netcdf_var(ncid,'satoxy',satoxy(1,1,1),kpke,0) -#ifdef natDIC - CALL write_netcdf_var(ncid,'nathi',nathi(1,1,1),kpke,0) -#endif + if (use_natDIC) then + CALL write_netcdf_var(ncid,'nathi',nathi(1,1,1),kpke,0) + end if ! ! Write restart data : sediment variables. ! -#ifndef sedbypass - CALL write_netcdf_var(ncid,'ssso12',sedlay2(1,1,1,issso12),2*ks,0) - CALL write_netcdf_var(ncid,'sssc12',sedlay2(1,1,1,isssc12),2*ks,0) - CALL write_netcdf_var(ncid,'ssssil',sedlay2(1,1,1,issssil),2*ks,0) - CALL write_netcdf_var(ncid,'ssster',sedlay2(1,1,1,issster),2*ks,0) - CALL write_netcdf_var(ncid,'bur_o12',burial2(1,1,1,issso12),2,0) - CALL write_netcdf_var(ncid,'bur_c12',burial2(1,1,1,isssc12),2,0) - CALL write_netcdf_var(ncid,'bur_sil',burial2(1,1,1,issssil),2,0) - CALL write_netcdf_var(ncid,'bur_clay',burial2(1,1,1,issster),2,0) - CALL write_netcdf_var(ncid,'sedhpl',sedhpl(1,1,1),ks,0) - CALL write_netcdf_var(ncid,'powaic',powtra2(1,1,1,ipowaic),2*ks,0) - CALL write_netcdf_var(ncid,'powaal',powtra2(1,1,1,ipowaal),2*ks,0) - CALL write_netcdf_var(ncid,'powaph',powtra2(1,1,1,ipowaph),2*ks,0) - CALL write_netcdf_var(ncid,'powaox',powtra2(1,1,1,ipowaox),2*ks,0) - CALL write_netcdf_var(ncid,'pown2',powtra2(1,1,1,ipown2),2*ks,0) - CALL write_netcdf_var(ncid,'powno3',powtra2(1,1,1,ipowno3),2*ks,0) - CALL write_netcdf_var(ncid,'powasi',powtra2(1,1,1,ipowasi),2*ks,0) -#ifdef cisonew - CALL write_netcdf_var(ncid,'ssso13',sedlay2(1,1,1,issso13),2*ks,0) - CALL write_netcdf_var(ncid,'ssso14',sedlay2(1,1,1,issso14),2*ks,0) - CALL write_netcdf_var(ncid,'sssc13',sedlay2(1,1,1,isssc13),2*ks,0) - CALL write_netcdf_var(ncid,'sssc14',sedlay2(1,1,1,isssc14),2*ks,0) - CALL write_netcdf_var(ncid,'powc13',powtra2(1,1,1,ipowc13),2*ks,0) - CALL write_netcdf_var(ncid,'powc14',powtra2(1,1,1,ipowc14),2*ks,0) -#endif -#endif + if (.not. use_sedbypass) then + CALL write_netcdf_var(ncid,'ssso12',sedlay2(1,1,1,issso12),2*ks,0) + CALL write_netcdf_var(ncid,'sssc12',sedlay2(1,1,1,isssc12),2*ks,0) + CALL write_netcdf_var(ncid,'ssssil',sedlay2(1,1,1,issssil),2*ks,0) + CALL write_netcdf_var(ncid,'ssster',sedlay2(1,1,1,issster),2*ks,0) + CALL write_netcdf_var(ncid,'bur_o12',burial2(1,1,1,issso12),2,0) + CALL write_netcdf_var(ncid,'bur_c12',burial2(1,1,1,isssc12),2,0) + CALL write_netcdf_var(ncid,'bur_sil',burial2(1,1,1,issssil),2,0) + CALL write_netcdf_var(ncid,'bur_clay',burial2(1,1,1,issster),2,0) + CALL write_netcdf_var(ncid,'sedhpl',sedhpl(1,1,1),ks,0) + CALL write_netcdf_var(ncid,'powaic',powtra2(1,1,1,ipowaic),2*ks,0) + CALL write_netcdf_var(ncid,'powaal',powtra2(1,1,1,ipowaal),2*ks,0) + CALL write_netcdf_var(ncid,'powaph',powtra2(1,1,1,ipowaph),2*ks,0) + CALL write_netcdf_var(ncid,'powaox',powtra2(1,1,1,ipowaox),2*ks,0) + CALL write_netcdf_var(ncid,'pown2',powtra2(1,1,1,ipown2),2*ks,0) + CALL write_netcdf_var(ncid,'powno3',powtra2(1,1,1,ipowno3),2*ks,0) + CALL write_netcdf_var(ncid,'powasi',powtra2(1,1,1,ipowasi),2*ks,0) + if (use_cisonew) then + CALL write_netcdf_var(ncid,'ssso13',sedlay2(1,1,1,issso13),2*ks,0) + CALL write_netcdf_var(ncid,'ssso14',sedlay2(1,1,1,issso14),2*ks,0) + CALL write_netcdf_var(ncid,'sssc13',sedlay2(1,1,1,isssc13),2*ks,0) + CALL write_netcdf_var(ncid,'sssc14',sedlay2(1,1,1,isssc14),2*ks,0) + CALL write_netcdf_var(ncid,'powc13',powtra2(1,1,1,ipowc13),2*ks,0) + CALL write_netcdf_var(ncid,'powc14',powtra2(1,1,1,ipowc14),2*ks,0) + end if + end if ! ! Write restart data: atmosphere. ! -#if defined(BOXATM) - CALL write_netcdf_var(ncid,'atmco2',atm2(1,1,1,iatmco2),2,0) - CALL write_netcdf_var(ncid,'atmo2',atm2(1,1,1,iatmo2),2,0) - CALL write_netcdf_var(ncid,'atmn2',atm2(1,1,1,iatmn2),2,0) -#ifdef cisonew - CALL write_netcdf_var(ncid,'atmc13',atm2(1,1,1,iatmc13),2,0) - CALL write_netcdf_var(ncid,'atmc14',atm2(1,1,1,iatmc14),2,0) -#endif -#ifdef natDIC - CALL write_netcdf_var(ncid,'atmnco2',atm2(1,1,1,iatmnco2),2,0) -#endif -#endif + if (use_BOXATM) then + CALL write_netcdf_var(ncid,'atmco2',atm2(1,1,1,iatmco2),2,0) + CALL write_netcdf_var(ncid,'atmo2',atm2(1,1,1,iatmo2),2,0) + CALL write_netcdf_var(ncid,'atmn2',atm2(1,1,1,iatmn2),2,0) + if (use_cisonew) then + CALL write_netcdf_var(ncid,'atmc13',atm2(1,1,1,iatmc13),2,0) + CALL write_netcdf_var(ncid,'atmc14',atm2(1,1,1,iatmc14),2,0) + end if + if (use_natDIC) then + CALL write_netcdf_var(ncid,'atmnco2',atm2(1,1,1,iatmnco2),2,0) + end if + end if IF(mnproc==1 .AND. IOTYPE==0) THEN @@ -940,4 +945,4 @@ SUBROUTINE AUFW_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & ENDIF RETURN - END + END SUBROUTINE AUFW_BGC diff --git a/hamocc/beleg_parm.F90 b/hamocc/beleg_parm.F90 index 949abea9..828ed9a0 100644 --- a/hamocc/beleg_parm.F90 +++ b/hamocc/beleg_parm.F90 @@ -51,23 +51,25 @@ SUBROUTINE BELEG_PARM(kpie,kpje) use mo_param1_bgc, only: iatmco2,iatmnco2,iatmo2,iatmn2,iatmc13,iatmc14,iatmbromo use mod_xc, only: mnproc -#ifdef AGG + ! AGG use mo_biomod, only: alar1,alar2,alar3,alow1,alow2,alow3,calmax,cellmass,cellsink,dustd1,dustd2,dustd3,dustsink, & & fractdim,fse,fsh,nmldmin,plower,pupper,safe,sinkexp,stick,tmfac,tsfac,vsmall,zdis -#elif defined(WLIN) + + ! WLIN use mo_biomod, only: wmin,wmax,wlin -#endif -#ifdef BROMO + + ! BROMO use mo_biomod, only: rbro use mo_carbch, only: atm_bromo,fbro1,fbro2 -#endif -#ifdef cisonew + + ! cisonew use mo_biomod, only: bifr13,bifr14,c14fac,prei13,prei14,re1312,re14to use mo_carbch, only: atm_c13, atm_c14,c14_t_half,c14dec -#endif -#ifdef natDIC + + ! natDI use mo_carbch, only: atm_co2_nat -#endif + + use mo_ifdefs implicit none @@ -75,31 +77,18 @@ SUBROUTINE BELEG_PARM(kpie,kpje) ! local variables INTEGER :: i,j -#ifdef cisonew REAL :: alpha14,beta13,beta14,d13C_atm,d14cat -#endif -#ifdef AGG REAL :: shear -#else - REAL :: dustd1, dustd2, dustsink -#endif - - ! ! Atmospheric concentrations (atm_co2 is set via namelist). ! atm_o2 = 196800. atm_n2 = 802000. -#ifdef natDIC atm_co2_nat = 284.32 ! CMIP6 pre-industrial reference -#endif -#ifdef BROMO !For now use 3.4ppt from Hense and Quack (2009; Biogeosciences) NEED TO !BE UPDATED WITH Ziska et al. (2013) climatology database atm_bromo = 3.4 -#endif -#ifdef cisonew ! set standard carbon isotope ratios re1312=0.0112372 re14to=1.170e-12 ! Karlen et al. 1965 / Orr et al. 2017 @@ -116,8 +105,6 @@ SUBROUTINE BELEG_PARM(kpie,kpje) atm_c14 = ((d14cat/1000.)+1.)*re14to*atm_co2 ! factor for normalizing 14C tracers (~1e-12) c14fac = atm_c14/atm_co2 -#endif - ! Initialise atmosphere fields. We use a 2D representation of atmospheric ! fields for simplicity, even for cases where actually only a scalar value @@ -128,16 +115,16 @@ SUBROUTINE BELEG_PARM(kpie,kpje) atm(i,j,iatmco2) = atm_co2 atm(i,j,iatmo2) = atm_o2 atm(i,j,iatmn2) = atm_n2 -#ifdef natDIC - atm(i,j,iatmnco2) = atm_co2_nat -#endif -#ifdef cisonew - atm(i,j,iatmc13) = atm_c13 - atm(i,j,iatmc14) = atm_c14/c14fac -#endif -#ifdef BROMO - atm(i,j,iatmbromo)= atm_bromo -#endif + if (use_natDIC) then + atm(i,j,iatmnco2) = atm_co2_nat + end if + if (use_cisonew) then + atm(i,j,iatmc13) = atm_c13 + atm(i,j,iatmc14) = atm_c14/c14fac + end if + if (use_BROMO) then + atm(i,j,iatmbromo)= atm_bromo + end if ENDDO ENDDO @@ -158,25 +145,23 @@ SUBROUTINE BELEG_PARM(kpie,kpje) gammaz=0.06*dtb !1/d -excretion rate ecan=0.95 ! fraction of mortality as PO_4 pi_alpha=0.02*0.4 ! initial slope of production vs irradiance curve (alpha) (0.002 for 10 steps per day) -#ifdef AGG - zinges = 0.5 !dimensionless fraction -assimilation efficiency - epsher = 0.9 !dimensionless fraction -fraction of grazing egested -#elif defined(WLIN) - zinges = 0.7 !dimensionless fraction -assimilation efficiency - epsher = 0.85 !dimensionless fraction -fraction of grazing egested -#else - zinges = 0.6 !dimensionless fraction -assimilation efficiency - epsher = 0.8 !dimensionless fraction -fraction of grazing egest -#endif - -#ifdef cisonew + if (use_agg) then + zinges = 0.5 !dimensionless fraction -assimilation efficiency + epsher = 0.9 !dimensionless fraction -fraction of grazing egested + else if (use_wlin) then + zinges = 0.7 !dimensionless fraction -assimilation efficiency + epsher = 0.85 !dimensionless fraction -fraction of grazing egested + else + zinges = 0.6 !dimensionless fraction -assimilation efficiency + epsher = 0.8 !dimensionless fraction -fraction of grazing egest + end if + ! Initial fractionation during photosynthesis bifr13=0.98 bifr14=bifr13**2 ! Decay parameter for sco214, HalfLive = 5730 years c14_t_half=5700.*365. ! Half life of 14C [days] c14dec=1.-(log(2.)/c14_t_half)*dtb ! lambda [1/day]; c14dec[-] -#endif ! half sat. constants, note that the units are kmol/m3 ! bkphy = 4.e-8 !i.e. 0.04 mmol P/m3 @@ -188,11 +173,10 @@ SUBROUTINE BELEG_PARM(kpie,kpje) wcal = 30.*dtb !m/d wopal = 30.*dtb !m/d iris : 60 -#if defined(WLIN) && ! defined(AGG) +! for use_wlin and use_agg wmin = 1.*dtb !m/d minimum sinking speed wmax = 60.*dtb !m/d maximum sinking speed wlin = 60./2400.*dtb !m/d/m constant describing incr. with depth, r/a=1.0 -#endif ! deep see remineralisation constants drempoc = 0.025*dtb !1/d @@ -236,7 +220,6 @@ SUBROUTINE BELEG_PARM(kpie,kpje) rdn2o1=2*ro2ut-2.5*rnit ! moles N2O used for remineralisation of 1 mole P rdn2o2=2*ro2ut-2*rnit ! moles N2 released for remineralisation of 1 mole P -#ifdef BROMO !Bromoform to phosphate ratio (Hense and Quack, 2009) !JT: too little production: 0.25Gmol/yr rbro=6.72e-7*rnit ! rbro=2.*6.72e-7*rnit @@ -244,19 +227,18 @@ SUBROUTINE BELEG_PARM(kpie,kpje) rbro=2.4e-6*rnit fbro1=1.0 fbro2=1.0 -#endif - -#ifdef AGG - rcalc = 14. ! calcium carbonate to organic phosphorous production ratio - ropal = 10.5 ! opal to organic phosphorous production ratio - calmax= 0.20 -#elif defined(WLIN) - rcalc = 33. ! calcium carbonate to organic phosphorous production ratio - ropal = 45. ! opal to organic phosphorous production ratio -#else - rcalc = 40. ! iris 40 !calcium carbonate to organic phosphorous production ratio - ropal = 30. ! iris 25 !opal to organic phosphorous production ratio -#endif + + if (use_agg) then + rcalc = 14. ! calcium carbonate to organic phosphorous production ratio + ropal = 10.5 ! opal to organic phosphorous production ratio + calmax= 0.20 + else if (use_wlin) then + rcalc = 33. ! calcium carbonate to organic phosphorous production ratio + ropal = 45. ! opal to organic phosphorous production ratio + else + rcalc = 40. ! iris 40 !calcium carbonate to organic phosphorous production ratio + ropal = 30. ! iris 25 !opal to organic phosphorous production ratio + end if ! parameters for sw-radiation attenuation ! Analog to Moore et al., Deep-Sea Research II 49 (2002), 403-462 @@ -302,14 +284,14 @@ SUBROUTINE BELEG_PARM(kpie,kpje) &'* Values of BELEG_BGC variables : ' WRITE(io_stdo_bgc,*) & &'* atm_co2 = ',atm_co2 -#ifdef cisonew - WRITE(io_stdo_bgc,*) & - &'* atm_c13 = ',atm_c13 - WRITE(io_stdo_bgc,*) & - &'* d13C_atm = ',d13C_atm - WRITE(io_stdo_bgc,*) & - &'* atm_c14 = ',atm_c14 -#endif + if (use_cisonew) then + WRITE(io_stdo_bgc,*) & + &'* atm_c13 = ',atm_c13 + WRITE(io_stdo_bgc,*) & + &'* d13C_atm = ',d13C_atm + WRITE(io_stdo_bgc,*) & + &'* atm_c14 = ',atm_c14 + end if WRITE(io_stdo_bgc,*) & &'* atm_o2 = ',atm_o2 WRITE(io_stdo_bgc,*) & @@ -402,100 +384,98 @@ SUBROUTINE BELEG_PARM(kpie,kpje) &'* dmspar(5) = ',dmspar(5) ENDIF -#ifndef AGG - dustd1 = 0.0001 !cm = 1 um, boundary between clay and silt - dustd2=dustd1*dustd1 - dustsink = (9.81 * 86400. / 18. & ! g * sec per day / 18. - & * (claydens - 1025.) / 1.567 * 1000. & !excess density / dyn. visc. - & * dustd2 * 1.e-4)*dtb - wdust = dustsink + if (.not. use_agg) then + dustd1 = 0.0001 !cm = 1 um, boundary between clay and silt + dustd2=dustd1*dustd1 + dustsink = (9.81 * 86400. / 18. & ! g * sec per day / 18. + & * (claydens - 1025.) / 1.567 * 1000. & !excess density / dyn. visc. + & * dustd2 * 1.e-4)*dtb + wdust = dustsink + + IF (mnproc.eq.1) THEN + WRITE(io_stdo_bgc,*) & + &'* dustd1 = ',dustd1 + WRITE(io_stdo_bgc,*) & + &'* dustd2 = ',dustd2 + WRITE(io_stdo_bgc,*) & + &'* dustsink = ',dustsink + WRITE(io_stdo_bgc,*) & + &'* wdust = ',wdust + ENDIF + end if IF (mnproc.eq.1) THEN - WRITE(io_stdo_bgc,*) & - &'* dustd1 = ',dustd1 - WRITE(io_stdo_bgc,*) & - &'* dustd2 = ',dustd2 - WRITE(io_stdo_bgc,*) & - &'* dustsink = ',dustsink - WRITE(io_stdo_bgc,*) & - &'* wdust = ',wdust - ENDIF -#endif - - IF (mnproc.eq.1) THEN - WRITE(io_stdo_bgc,*) & - &'****************************************************************' + WRITE(io_stdo_bgc,*) & + &'****************************************************************' ENDIF -#ifdef AGG -! parameters needed for the aggregation module - - SinkExp = 0.62 - FractDim = 1.62 -! Stick = 0.40 -! Stick = 0.25 - Stick = 0.15 - cellmass = 0.012 / rnit ![nmol P] -!ik cellmass = 0.0039/ rnit ![nmol P] for a 10 um diameter - cellsink = 1.40 *dtb! [m/d] -!ik cellsink = 0.911 *dtb! [m/d] for a 10 um diameter -! shear = 86400. !shear in the mixed layer, 1.0 d-1 -! shear = 64800. !shear in the mixed layer, 0.75 d-1 - shear = 43200. !shear in the mixed layer, 0.5 d-1 - fsh = 0.163 * shear *dtb - fse = 0.125 * 3.1415927 * cellsink * 100. - alow1 = 0.002 !diameter of smallest particle [cm] -!ik alow1 = 0.001 !diameter of smallest particle [cm] - alow2 = alow1 * alow1 - alow3 = alow2 * alow1 -! alar1 = 1.0 !diameter of largest particle for size dependend aggregation and sinking [cm] -! alar1 = 0.75 !diameter of largest particle for size dependend aggregation and sinking [cm] - alar1 = 0.5 !diameter of largest particle for size dependend aggregation and sinking [cm] - vsmall = 1.e-9 - safe = 1.e-6 - pupper = safe/((FractDim+safe)*cellmass) - plower = 1./(1.1*cellmass) - zdis = 0.01 / ((FractDim + 0.01)*cellmass) - nmldmin = 0.1 ! minimum particle number in mixed layer - -! Determine maximum sinking speed - IF (mnproc.eq.1) THEN - write(io_stdo_bgc,*) - write(io_stdo_bgc,*) & - &'****************************************************************' - write(io_stdo_bgc,*) 'HAMOCC aggregate sinking scheme:' - write(io_stdo_bgc,*) ' Maximum sinking speed for aggregates of ' - write(io_stdo_bgc,*) ' maximum size ', alar1, ' cm is ' - write(io_stdo_bgc,*) cellsink/dtb*(alar1/alow1)**SinkExp, ' m/day' - endif - - alar2 = alar1 * alar1 - alar3 = alar2 * alar1 - TSFac = (alar1/alow1)**SinkExp - TMFac = (alar1/alow1)**FractDim - -! for shear aggregation of dust: - dustd1 = 0.0001 !cm = 1 um, boundary between clay and silt - dustd2=dustd1*dustd1 - dustd3=dustd2*dustd1 - dustsink = (9.81 * 86400. / 18. & ! g * sec per day / 18. - & * (claydens - 1025.) / 1.567 * 1000. & !excess density / dyn. visc. - & * dustd2 * 1.e-4)*dtb - IF (mnproc.eq.1) THEN - write(io_stdo_bgc,*) ' dust diameter (cm)', dustd1 - write(io_stdo_bgc,*) ' dust sinking speed (m/d)', dustsink / dtb - if(dustsink.gt.cellsink) then - write(io_stdo_bgc,*) ' dust sinking speed greater than cellsink' - dustsink=cellsink - write(io_stdo_bgc,*) ' set dust sinking speed to cellsink' - endif - write(io_stdo_bgc,*) & - &'****************************************************************' - endif - -#endif /*AGG*/ - - + if (use_agg) then + ! parameters needed for the aggregation module + + SinkExp = 0.62 + FractDim = 1.62 + ! Stick = 0.40 + ! Stick = 0.25 + Stick = 0.15 + cellmass = 0.012 / rnit ![nmol P] + !ik cellmass = 0.0039/ rnit ![nmol P] for a 10 um diameter + cellsink = 1.40 *dtb! [m/d] + !ik cellsink = 0.911 *dtb! [m/d] for a 10 um diameter + ! shear = 86400. !shear in the mixed layer, 1.0 d-1 + ! shear = 64800. !shear in the mixed layer, 0.75 d-1 + shear = 43200. !shear in the mixed layer, 0.5 d-1 + fsh = 0.163 * shear *dtb + fse = 0.125 * 3.1415927 * cellsink * 100. + alow1 = 0.002 !diameter of smallest particle [cm] + !ik alow1 = 0.001 !diameter of smallest particle [cm] + alow2 = alow1 * alow1 + alow3 = alow2 * alow1 + ! alar1 = 1.0 !diameter of largest particle for size dependend aggregation and sinking [cm] + ! alar1 = 0.75 !diameter of largest particle for size dependend aggregation and sinking [cm] + alar1 = 0.5 !diameter of largest particle for size dependend aggregation and sinking [cm] + vsmall = 1.e-9 + safe = 1.e-6 + pupper = safe/((FractDim+safe)*cellmass) + plower = 1./(1.1*cellmass) + zdis = 0.01 / ((FractDim + 0.01)*cellmass) + nmldmin = 0.1 ! minimum particle number in mixed layer + + ! Determine maximum sinking speed + IF (mnproc.eq.1) THEN + write(io_stdo_bgc,*) + write(io_stdo_bgc,*) & + &'****************************************************************' + write(io_stdo_bgc,*) 'HAMOCC aggregate sinking scheme:' + write(io_stdo_bgc,*) ' Maximum sinking speed for aggregates of ' + write(io_stdo_bgc,*) ' maximum size ', alar1, ' cm is ' + write(io_stdo_bgc,*) cellsink/dtb*(alar1/alow1)**SinkExp, ' m/day' + endif + + alar2 = alar1 * alar1 + alar3 = alar2 * alar1 + TSFac = (alar1/alow1)**SinkExp + TMFac = (alar1/alow1)**FractDim + + ! for shear aggregation of dust: + dustd1 = 0.0001 !cm = 1 um, boundary between clay and silt + dustd2=dustd1*dustd1 + dustd3=dustd2*dustd1 + dustsink = (9.81 * 86400. / 18. & ! g * sec per day / 18. + & * (claydens - 1025.) / 1.567 * 1000. & !excess density / dyn. visc. + & * dustd2 * 1.e-4)*dtb + IF (mnproc.eq.1) THEN + write(io_stdo_bgc,*) ' dust diameter (cm)', dustd1 + write(io_stdo_bgc,*) ' dust sinking speed (m/d)', dustsink / dtb + if(dustsink.gt.cellsink) then + write(io_stdo_bgc,*) ' dust sinking speed greater than cellsink' + dustsink=cellsink + write(io_stdo_bgc,*) ' set dust sinking speed to cellsink' + endif + write(io_stdo_bgc,*) & + &'****************************************************************' + endif + + end if RETURN - END + END SUBROUTINE BELEG_PARM diff --git a/hamocc/beleg_vars.F90 b/hamocc/beleg_vars.F90 index f7d68963..07d19d3d 100644 --- a/hamocc/beleg_vars.F90 +++ b/hamocc/beleg_vars.F90 @@ -59,31 +59,34 @@ SUBROUTINE BELEG_VARS(kpaufr,kpie,kpje,kpke,kbnd,pddpo,prho,omask, & & iprefalk,iprefdic,iprefo2,iprefpo4,isco212,isilica,izoo use mo_vgrid, only: kmle,kbo -#ifdef AGG + ! AGG use mo_biomod, only: cellmass,fractdim use mo_param1_bgc, only: iadust,inos -#endif -#ifdef BROMO + + ! BROMO use mo_param1_bgc, only: ibromo -#endif -#ifdef CFC + + ! CFC use mo_param1_bgc, only: icfc11,icfc12,isf6 -#endif -#ifdef cisonew + + ! cisonew use mo_biomod, only: bifr13,bifr14,c14fac,re1312,re14to use mo_param1_bgc, only: icalc13,icalc14,idet13,idet14,idoc13,idoc14,iphy13,iphy14,isco213,isco214,izoo13,izoo14,safediv -#endif -#ifdef natDIC + + ! natDIC use mo_param1_bgc, only: inatcalc use mo_carbch, only: nathi,natco3 -#endif -#ifndef sedbypass - use mo_param1_bgc, only: ipowaal,ipowaic,ipowaox,ipowaph,ipowasi,ipown2,ipowno3,isssc12,issso12,issssil,issster,ks,nsedtra + + ! sedbypass + use mo_param1_bgc, only: ipowaal,ipowaic,ipowaox,ipowaph,ipowasi,ipown2,ipowno3,isssc12,issso12,issssil,issster,ks,nsedtra, & + & ipowc13,ipowc13,issso13,issso13,isssc13,ipowc14,isssc14,issso14 + use mo_sedmnt, only: sedhpl,burial,powtra,sedlay -#endif -#ifdef FB_BGC_OCE + + ! FB_BGC_OCE use mo_biomod, only: abs_oce -#endif + + use mo_ifdefs implicit none @@ -96,23 +99,20 @@ SUBROUTINE BELEG_VARS(kpaufr,kpie,kpje,kpke,kbnd,pddpo,prho,omask, & ! local variables INTEGER :: i,j,k,l -#ifdef cisonew + ! cisonew REAL :: rco213,rco214,beta13,beta14 -#endif -#ifdef AGG + ! AGG REAL :: snow -#endif - -#ifdef FB_BGC_OCE - DO k=1,kpke - DO j=1,kpje - DO i=1,kpie - abs_oce(i,j,k)=1. - ENDDO - ENDDO - ENDDO -#endif + if (use_FB_BGC_OCE) then + DO k=1,kpke + DO j=1,kpje + DO i=1,kpie + abs_oce(i,j,k)=1. + ENDDO + ENDDO + ENDDO + end if ! ! Initialisation of ocean tracers and sediment @@ -138,18 +138,18 @@ SUBROUTINE BELEG_VARS(kpaufr,kpie,kpje,kpke,kbnd,pddpo,prho,omask, & ocetra(i,j,k,ioxygen) = ocetra(i,j,k,ioxygen)/prho(i,j,k) ocetra(i,j,k,iano3) = ocetra(i,j,k,iano3) /prho(i,j,k) ocetra(i,j,k,isilica) = ocetra(i,j,k,isilica)/prho(i,j,k) -#ifdef cisonew - ! d13C based on Eide data is read in above (profile_gd) - ! Convert to 13C using model initial (ie GLODAP) total C - ! If restarting, this is redone with model total C from restart in aufr_bgc.F90 - beta13=ocetra(i,j,k,isco213)/1000.+1. - ocetra(i,j,k,isco213) = ocetra(i,j,k,isco212)*beta13*re1312/(1.+beta13*re1312) + if (use_cisonew) then + ! d13C based on Eide data is read in above (profile_gd) + ! Convert to 13C using model initial (ie GLODAP) total C + ! If restarting, this is redone with model total C from restart in aufr_bgc.F90 + beta13=ocetra(i,j,k,isco213)/1000.+1. + ocetra(i,j,k,isco213) = ocetra(i,j,k,isco212)*beta13*re1312/(1.+beta13*re1312) - ! 14C is read in as small delta14C (calculated from R. Key, 2003 and Eide et al. 2017) - ! Convert to 14C using model total C, and normalize by c14fac to prevent numerical errors - beta14=ocetra(i,j,k,isco214)/1000.+1. - ocetra(i,j,k,isco214) = ocetra(i,j,k,isco212)*beta14*re14to/c14fac -#endif + ! 14C is read in as small delta14C (calculated from R. Key, 2003 and Eide et al. 2017) + ! Convert to 14C using model total C, and normalize by c14fac to prevent numerical errors + beta14=ocetra(i,j,k,isco214)/1000.+1. + ocetra(i,j,k,isco214) = ocetra(i,j,k,isco212)*beta14*re14to/c14fac + end if ENDIF ENDDO ENDDO @@ -179,40 +179,40 @@ SUBROUTINE BELEG_VARS(kpaufr,kpie,kpje,kpke,kbnd,pddpo,prho,omask, & hi(i,j,k) =1.e-8 co3(i,j,k) =0. co2star(i,j,k) =20.e-6 -#ifdef AGG -! calculate initial numbers from mass, to start with appropriate size distribution - snow = (ocetra(i,j,k,iphy)+ocetra(i,j,k,idet))*1.e+6 - ocetra(i,j,k,inos) = snow / cellmass / (FractDim+1.) - ocetra(i,j,k,iadust) =0. -#endif /*AGG*/ -#ifdef CFC - ocetra(i,j,k,icfc11) =0. - ocetra(i,j,k,icfc12) =0. - ocetra(i,j,k,isf6) =0. -#endif -#ifdef natDIC - nathi(i,j,k) =1.e-8 - natco3(i,j,k) =0. - ocetra(i,j,k,inatcalc) =0. -#endif -#ifdef cisonew - rco213=ocetra(i,j,k,isco213)/(ocetra(i,j,k,isco212)+safediv) - rco214=ocetra(i,j,k,isco214)/(ocetra(i,j,k,isco212)+safediv) - ocetra(i,j,k,iphy13) =ocetra(i,j,k,iphy)*rco213*bifr13 - ocetra(i,j,k,iphy14) =ocetra(i,j,k,iphy)*rco214*bifr14 - ocetra(i,j,k,izoo13) =ocetra(i,j,k,izoo)*rco213*bifr13 - ocetra(i,j,k,izoo14) =ocetra(i,j,k,izoo)*rco214*bifr14 - ocetra(i,j,k,idoc13) =ocetra(i,j,k,idoc)*rco213*bifr13 - ocetra(i,j,k,idoc14) =ocetra(i,j,k,idoc)*rco214*bifr14 - ocetra(i,j,k,idet13) =ocetra(i,j,k,idet)*rco213*bifr13 - ocetra(i,j,k,idet14) =ocetra(i,j,k,idet)*rco214*bifr14 - ocetra(i,j,k,icalc13)=ocetra(i,j,k,icalc)*rco213 - ocetra(i,j,k,icalc14)=ocetra(i,j,k,icalc)*rco214 -#endif -#ifdef BROMO -! Initialise to 0,01 pmol L-1 (Stemmler et al., 2015) => mol/kg - ocetra(i,j,k,ibromo)= 1.e-14/prho(i,j,k) -#endif + if (use_AGG) then + ! calculate initial numbers from mass, to start with appropriate size distribution + snow = (ocetra(i,j,k,iphy)+ocetra(i,j,k,idet))*1.e+6 + ocetra(i,j,k,inos) = snow / cellmass / (FractDim+1.) + ocetra(i,j,k,iadust) =0. + end if + if (use_CFC) then + ocetra(i,j,k,icfc11) =0. + ocetra(i,j,k,icfc12) =0. + ocetra(i,j,k,isf6) =0. + end if + if (use_natDIC) then + nathi(i,j,k) =1.e-8 + natco3(i,j,k) =0. + ocetra(i,j,k,inatcalc) =0. + end if + if (use_cisonew) then + rco213=ocetra(i,j,k,isco213)/(ocetra(i,j,k,isco212)+safediv) + rco214=ocetra(i,j,k,isco214)/(ocetra(i,j,k,isco212)+safediv) + ocetra(i,j,k,iphy13) =ocetra(i,j,k,iphy)*rco213*bifr13 + ocetra(i,j,k,iphy14) =ocetra(i,j,k,iphy)*rco214*bifr14 + ocetra(i,j,k,izoo13) =ocetra(i,j,k,izoo)*rco213*bifr13 + ocetra(i,j,k,izoo14) =ocetra(i,j,k,izoo)*rco214*bifr14 + ocetra(i,j,k,idoc13) =ocetra(i,j,k,idoc)*rco213*bifr13 + ocetra(i,j,k,idoc14) =ocetra(i,j,k,idoc)*rco214*bifr14 + ocetra(i,j,k,idet13) =ocetra(i,j,k,idet)*rco213*bifr13 + ocetra(i,j,k,idet14) =ocetra(i,j,k,idet)*rco214*bifr14 + ocetra(i,j,k,icalc13)=ocetra(i,j,k,icalc)*rco213 + ocetra(i,j,k,icalc14)=ocetra(i,j,k,icalc)*rco214 + end if + if (use_BROMO) then + ! Initialise to 0,01 pmol L-1 (Stemmler et al., 2015) => mol/kg + ocetra(i,j,k,ibromo)= 1.e-14/prho(i,j,k) + end if ENDIF ! omask > 0.5 ENDDO ENDDO @@ -233,69 +233,69 @@ SUBROUTINE BELEG_VARS(kpaufr,kpie,kpje,kpke,kbnd,pddpo,prho,omask, & ! Initial values for sediment -#ifndef sedbypass - DO k=1,ks - DO j=1,kpje - DO i=1,kpie - IF(omask(i,j) .GT. 0.5) THEN - powtra(i,j,k,ipowaic)=ocetra(i,j,kbo(i,j),isco212) - powtra(i,j,k,ipowaal)=ocetra(i,j,kbo(i,j),ialkali) - powtra(i,j,k,ipowaph)=ocetra(i,j,kbo(i,j),iphosph) - powtra(i,j,k,ipowaox)=ocetra(i,j,kbo(i,j),ioxygen) - powtra(i,j,k,ipown2) =0. - powtra(i,j,k,ipowno3)=ocetra(i,j,kbo(i,j),iano3) - powtra(i,j,k,ipowasi)=ocetra(i,j,kbo(i,j),isilica) - sedlay(i,j,k,issso12)=1.e-8 - sedlay(i,j,k,isssc12)=1.e-8 - sedlay(i,j,k,issster)=30. - sedlay(i,j,k,issssil)=1.e-8 - sedhpl(i,j,k) =hi(i,j,kbo(i,j)) -#ifdef cisonew - rco213=ocetra(i,j,kbo(i,j),isco213)/(ocetra(i,j,kbo(i,j),isco212)+safediv) - rco214=ocetra(i,j,kbo(i,j),isco214)/(ocetra(i,j,kbo(i,j),isco212)+safediv) - powtra(i,j,k,ipowc13)=powtra(i,j,k,ipowaic)*rco213*bifr13 - powtra(i,j,k,ipowc14)=powtra(i,j,k,ipowaic)*rco214*bifr14 - sedlay(i,j,k,issso13)=sedlay(i,j,k,issso12)*rco213*bifr13 - sedlay(i,j,k,issso14)=sedlay(i,j,k,issso12)*rco214*bifr14 - sedlay(i,j,k,isssc13)=sedlay(i,j,k,isssc12)*rco213 - sedlay(i,j,k,isssc14)=sedlay(i,j,k,isssc12)*rco214 -#endif - ELSE - powtra(i,j,k,ipowno3)=rmasks - powtra(i,j,k,ipown2) =rmasks - powtra(i,j,k,ipowaic)=rmasks - powtra(i,j,k,ipowaal)=rmasks - powtra(i,j,k,ipowaph)=rmasks - powtra(i,j,k,ipowaox)=rmasks - powtra(i,j,k,ipowasi)=rmasks - sedlay(i,j,k,issso12)=rmasks - sedlay(i,j,k,isssc12)=rmasks - sedlay(i,j,k,issssil)=rmasks - sedlay(i,j,k,issster)=rmasks - sedlay(i,j,k,issssil)=rmasks - sedhpl(i,j,k) =rmasks -#ifdef cisonew - powtra(i,j,k,ipowc13)=rmasks - powtra(i,j,k,ipowc14)=rmasks - sedlay(i,j,k,issso13)=rmasks - sedlay(i,j,k,issso14)=rmasks - sedlay(i,j,k,isssc13)=rmasks - sedlay(i,j,k,isssc14)=rmasks -#endif - ENDIF - ENDDO - ENDDO - ENDDO + if (.not. use_sedbypass) then + DO k=1,ks + DO j=1,kpje + DO i=1,kpie + IF(omask(i,j) .GT. 0.5) THEN + powtra(i,j,k,ipowaic)=ocetra(i,j,kbo(i,j),isco212) + powtra(i,j,k,ipowaal)=ocetra(i,j,kbo(i,j),ialkali) + powtra(i,j,k,ipowaph)=ocetra(i,j,kbo(i,j),iphosph) + powtra(i,j,k,ipowaox)=ocetra(i,j,kbo(i,j),ioxygen) + powtra(i,j,k,ipown2) =0. + powtra(i,j,k,ipowno3)=ocetra(i,j,kbo(i,j),iano3) + powtra(i,j,k,ipowasi)=ocetra(i,j,kbo(i,j),isilica) + sedlay(i,j,k,issso12)=1.e-8 + sedlay(i,j,k,isssc12)=1.e-8 + sedlay(i,j,k,issster)=30. + sedlay(i,j,k,issssil)=1.e-8 + sedhpl(i,j,k) =hi(i,j,kbo(i,j)) + if (use_cisonew) then + rco213=ocetra(i,j,kbo(i,j),isco213)/(ocetra(i,j,kbo(i,j),isco212)+safediv) + rco214=ocetra(i,j,kbo(i,j),isco214)/(ocetra(i,j,kbo(i,j),isco212)+safediv) + powtra(i,j,k,ipowc13)=powtra(i,j,k,ipowaic)*rco213*bifr13 + powtra(i,j,k,ipowc14)=powtra(i,j,k,ipowaic)*rco214*bifr14 + sedlay(i,j,k,issso13)=sedlay(i,j,k,issso12)*rco213*bifr13 + sedlay(i,j,k,issso14)=sedlay(i,j,k,issso12)*rco214*bifr14 + sedlay(i,j,k,isssc13)=sedlay(i,j,k,isssc12)*rco213 + sedlay(i,j,k,isssc14)=sedlay(i,j,k,isssc12)*rco214 + end if + ELSE + powtra(i,j,k,ipowno3)=rmasks + powtra(i,j,k,ipown2) =rmasks + powtra(i,j,k,ipowaic)=rmasks + powtra(i,j,k,ipowaal)=rmasks + powtra(i,j,k,ipowaph)=rmasks + powtra(i,j,k,ipowaox)=rmasks + powtra(i,j,k,ipowasi)=rmasks + sedlay(i,j,k,issso12)=rmasks + sedlay(i,j,k,isssc12)=rmasks + sedlay(i,j,k,issssil)=rmasks + sedlay(i,j,k,issster)=rmasks + sedlay(i,j,k,issssil)=rmasks + sedhpl(i,j,k) =rmasks + if (use_cisonew) then + powtra(i,j,k,ipowc13)=rmasks + powtra(i,j,k,ipowc14)=rmasks + sedlay(i,j,k,issso13)=rmasks + sedlay(i,j,k,issso14)=rmasks + sedlay(i,j,k,isssc13)=rmasks + sedlay(i,j,k,isssc14)=rmasks + end if + ENDIF + ENDDO + ENDDO + ENDDO - ! last and final sediment layer - DO l=1,nsedtra - DO j=1,kpje - DO i=1,kpie - burial(i,j,l)=0. - ENDDO - ENDDO - ENDDO -#endif + ! last and final sediment layer + DO l=1,nsedtra + DO j=1,kpje + DO i=1,kpie + burial(i,j,l)=0. + ENDDO + ENDDO + ENDDO + end if return !****************************************************************************** diff --git a/hamocc/carchm.F90 b/hamocc/carchm.F90 index 6fdcddd3..f73c7436 100644 --- a/hamocc/carchm.F90 +++ b/hamocc/carchm.F90 @@ -107,18 +107,24 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & use mo_vgrid, only: dp_min,kmle,kbo,ptiestu use mo_param1_bgc, only: iatmbromo,ibromo -#ifdef CFC + ! CFC use mo_carbch, only: atm_cfc11_nh,atm_cfc11_sh,atm_cfc12_nh,atm_cfc12_sh,atm_sf6_nh,atm_sf6_sh use mo_param1_bgc, only: iatmf11,iatmf12,iatmsf6,icfc11,icfc12,isf6 -#endif -#ifdef cisonew + + ! cisonew use mo_carbch, only: co213fxd,co213fxu,co214fxd,co214fxu,c14dec use mo_param1_bgc, only: iatmc13,iatmc14,icalc13,icalc14,idet14,idoc14,iphy14,isco213,isco214,izoo14,safediv -#endif -#ifdef natDIC + + ! natDIC use mo_carbch, only: atm_co2_nat,nathi,natco3,natpco2d,natomegaa,natomegac use mo_param1_bgc, only: iatmnco2,inatalkali,inatcalc,inatsco212 -#endif + + ! sedbypass + use mo_sedmnt, only: sedlay,powtra + use mo_param1_bgc, only: issso14,isssc14,ipowc14 + + use mo_ifdefs + implicit none INTEGER, intent(in) :: kpie,kpje,kpke,kbnd @@ -137,7 +143,7 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & REAL, intent(in) :: pflxbromo(1-kbnd:kpie+kbnd,1-kbnd:kpje+kbnd) ! Local variables - INTEGER :: i,j,k,l,js + INTEGER :: i,j,k,l,js,ks INTEGER, parameter :: niter=20 REAL :: supsat, undsa, dissol @@ -152,35 +158,33 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & REAL :: Kh,Khd,K1,K2,Kb,K1p,K2p,K3p,Ksi,Kw,Ks1,Kf,Kspc,Kspa REAL :: tc,ta,sit,pt,ah1,ac,cu,cb,cc,tc_sat REAL :: omega -#ifdef CFC + ! CFC REAL :: atm_cfc11,atm_cfc12,atm_sf6,fact REAL :: sch_11,sch_12,sch_sf,kw_11,kw_12,kw_sf REAL :: flx11,flx12,flxsf,a_11,a_12,a_sf -#endif -#ifdef natDIC + ! natDIC REAL :: natcu,natcb,natcc REAL :: natpco2,natfluxd,natfluxu,natomega REAL :: natsupsat,natundsa,natdissol -#endif -#ifdef cisonew + ! cisonew REAL :: rco213,rco214 REAL :: dissol13,dissol14 REAL :: flux14d,flux14u,flux13d,flux13u REAL :: atco213,atco214,pco213,pco214 REAL :: frac_k,frac_aqg,frac_dicg -#endif + ! bromo REAL :: flx_bromo,sch_bromo,kw_bromo,a_bromo,atbrf,Kb1,lsub ! set variables for diagnostic output to zero atmflx (:,:,:)=0. co2fxd (:,:)=0. co2fxu (:,:)=0. -#ifdef cisonew - co213fxd (:,:)=0. - co213fxu (:,:)=0. - co214fxd (:,:)=0. - co214fxu (:,:)=0. -#endif + if (use_cisonew) then + co213fxd (:,:)=0. + co213fxu (:,:)=0. + co214fxd (:,:)=0. + co214fxu (:,:)=0. + end if pco2d (:,:)=0. pco2m (:,:)=0. kwco2d (:,:)=0. @@ -192,30 +196,28 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & satoxy (:,:,:)=0. omegaA (:,:,:)=0. omegaC (:,:,:)=0. -#ifdef natDIC - natpco2d (:,:)=0. - natco3 (:,:,:)=0. - natomegaA(:,:,:)=0. - natomegaC(:,:,:)=0. -#endif + if (use_natDIC) then + natpco2d (:,:)=0. + natco3 (:,:,:)=0. + natomegaA(:,:,:)=0. + natomegaC(:,:,:)=0. + end if !$OMP PARALLEL DO PRIVATE(t,t2,t3,t4,tk,tk100,s,rs,prb,Kh,Khd,K1,K2 & !$OMP ,Kb,K1p,K2p,K3p,Ksi,Kw,Ks1,Kf,Kspc,Kspa,tc,ta,sit,pt,ah1,ac & !$OMP ,cu,cb,cc,pco2,rpp0,scco2,scdms,sco2,oxy,ani,anisa,Xconvxa & !$OMP ,kwco2,kwdms,kwo2,atco2,ato2,atn2,fluxd,fluxu,oxflux,tc_sat & !$OMP ,niflux,n2oflux,dmsflux,omega,supsat,undsa,dissol & -#ifdef CFC +! CFC !$OMP ,sch_11,sch_12,sch_sf,kw_11,kw_12,kw_sf,a_11,a_12,a_sf,flx11 & !$OMP ,flx12,flxsf,atm_cfc11,atm_cfc12,atm_sf6 & -#endif -#ifdef natDIC +! natDIC !$OMP ,natcu,natcb,natcc,natpco2,natfluxd,natfluxu,natomega & !$OMP ,natsupsat,natundsa,natdissol & -#endif -#ifdef cisonew +! cisonew !$OMP ,atco213,atco214,rco213,rco214,pco213,pco214,frac_aqg & !$OMP ,frac_dicg,flux13d,flux13u,flux14d,flux14u,dissol13,dissol14 & -#endif +! !$OMP ,flx_bromo,sch_bromo,kw_bromo,a_bromo,atbrf,Kb1,lsub & !$OMP ,j,i) DO k=1,kpke @@ -261,25 +263,25 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & ! Carbonate ion concentration, convert from mol/kg to kmol/m^3 co3(i,j,k) = cc * rrho -#ifdef natDIC - tc = ocetra(i,j,k,inatsco212) / rrho ! convert to mol/kg - ta = ocetra(i,j,k,inatalkali) / rrho - ah1 = nathi(i,j,k) + if (use_natDIC) then + tc = ocetra(i,j,k,inatsco212) / rrho ! convert to mol/kg + ta = ocetra(i,j,k,inatalkali) / rrho + ah1 = nathi(i,j,k) - CALL CARCHM_SOLVE(s,tc,ta,sit,pt,K1,K2,Kb,Kw,Ks1,Kf,Ksi,K1p,K2p,K3p, & - ah1,ac,niter) + CALL CARCHM_SOLVE(s,tc,ta,sit,pt,K1,K2,Kb,Kw,Ks1,Kf,Ksi,K1p,K2p,K3p, & + ah1,ac,niter) - if(ah1.gt.0.) then - nathi(i,j,k)=max(1.e-20,ah1) - endif + if(ah1.gt.0.) then + nathi(i,j,k)=max(1.e-20,ah1) + endif -! Determine natural CO2*, HCO3- and CO3-- concentrations (in mol/kg soln) - natcu = ( 2. * tc - ac ) / ( 2. + K1 / ah1 ) - natcb = K1 * natcu / ah1 - natcc = K2 * natcb / ah1 -! Natural carbonate ion concentration, convert from mol/kg to kmol/m^3 - natco3(i,j,k) = natcc * rrho -#endif + ! Determine natural CO2*, HCO3- and CO3-- concentrations (in mol/kg soln) + natcu = ( 2. * tc - ac ) / ( 2. + K1 / ah1 ) + natcb = K1 * natcu / ah1 + natcc = K2 * natcb / ah1 + ! Natural carbonate ion concentration, convert from mol/kg to kmol/m^3 + natco3(i,j,k) = natcc * rrho + end if ! solubility of O2 (Weiss, R.F. 1970, Deep-Sea Res., 17, 721-735) for moist air ! at 1 atm; multiplication with oxyco converts to kmol/m^3/atm @@ -290,9 +292,9 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & ! Determine CO2 pressure and fugacity (in micoatm) ! NOTE: equation below for pCO2 needs requires CO2 in mol/kg pco2 = cu * 1.e6 / Kh -#ifdef natDIC - natpco2 = natcu * 1.e6 / Kh -#endif + if (use_natDIC) then + natpco2 = natcu * 1.e6 / Kh + end if ! Schmidt numbers according to Wanninkhof (2014), Table 1 @@ -301,16 +303,16 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & scn2 = 2304.8 - 162.75*t + 6.2557*t2 - 0.13129 *t3 + 0.0011255 *t4 scdms = 2855.7 - 177.63*t + 6.0438*t2 - 0.11645 *t3 + 0.00094743*t4 scn2o = 2356.2 - 166.38*t + 6.3952*t2 - 0.13422 *t3 + 0.0011506 *t4 -#ifdef CFC - sch_11= 3579.2 - 222.63*t + 7.5749*t2 - 0.14595 *t3 + 0.0011874 *t4 - sch_12= 3828.1 - 249.86*t + 8.7603*t2 - 0.1716 *t3 + 0.001408 *t4 - sch_sf= 3177.5 - 200.57*t + 6.8865*t2 - 0.13335 *t3 + 0.0010877 *t4 -#endif -#ifdef BROMO -! Stemmler et al. (2015; Biogeosciences) Eq. (9); Quack and Wallace -! (2003; GBC) - sch_bromo= 4662.8 - 319.45*t + 9.9012*t2 - 0.1159*t3 -#endif + if (use_CFC) then + sch_11= 3579.2 - 222.63*t + 7.5749*t2 - 0.14595 *t3 + 0.0011874 *t4 + sch_12= 3828.1 - 249.86*t + 8.7603*t2 - 0.1716 *t3 + 0.001408 *t4 + sch_sf= 3177.5 - 200.57*t + 6.8865*t2 - 0.13335 *t3 + 0.0010877 *t4 + end if + if (use_BROMO) then + ! Stemmler et al. (2015; Biogeosciences) Eq. (9); Quack and Wallace + ! (2003; GBC) + sch_bromo= 4662.8 - 319.45*t + 9.9012*t2 - 0.1159*t3 + end if ! solubility of N2 (Weiss, R.F. 1970, Deep-Sea Res., 17, 721-735) for moist air ! at 1 atm; multiplication with oxyco converts to kmol/m^3/atm @@ -322,27 +324,27 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & rs=al1+al2/tk100+al3*log(tk100)+al4*tk100**2+s*(bl1+bl2*tk100+bl3*tk100**2) satn2o(i,j)=exp(rs) -#ifdef CFC + if (use_CFC) then ! solubility of cfc11,12 (mol/(l*atm)) (Warner and Weiss 1985) and ! sf6 from eq. 6 of Bullister et al. (2002) ! These are the alpha in (1b) of the ocmpic2 howto - a_11 = exp(-229.9261 + 319.6552*(100/tk) + 119.4471*log(tk100) & - & -1.39165*(tk100)**2 + s*(-0.142382 + 0.091459*(tk100) & - & -0.0157274*(tk100)**2)) - a_12 = exp(-218.0971 + 298.9702*(100/tk) + 113.8049*log(tk100) & - & -1.39165*(tk100)**2 + s*(-0.143566 + 0.091015*(tk100) & - & -0.0153924*(tk100)**2)) - a_sf = exp(-80.0343 + 117.232 *(100/tk) + 29.5817*log(tk100) & - & +s*(0.033518-0.0373942*(tk100)+0.00774862*(tk100)**2)) -! conversion from mol/(l * atm) to kmol/(m3 * pptv) - a_11 = 1e-12 * a_11 - a_12 = 1e-12 * a_12 - a_sf = 1e-12 * a_sf -#endif -#ifdef BROMO + a_11 = exp(-229.9261 + 319.6552*(100/tk) + 119.4471*log(tk100) & + & -1.39165*(tk100)**2 + s*(-0.142382 + 0.091459*(tk100) & + & -0.0157274*(tk100)**2)) + a_12 = exp(-218.0971 + 298.9702*(100/tk) + 113.8049*log(tk100) & + & -1.39165*(tk100)**2 + s*(-0.143566 + 0.091015*(tk100) & + & -0.0153924*(tk100)**2)) + a_sf = exp(-80.0343 + 117.232 *(100/tk) + 29.5817*log(tk100) & + & +s*(0.033518-0.0373942*(tk100)+0.00774862*(tk100)**2)) + ! conversion from mol/(l * atm) to kmol/(m3 * pptv) + a_11 = 1e-12 * a_11 + a_12 = 1e-12 * a_12 + a_sf = 1e-12 * a_sf + end if + if (use_BROMO) then !Henry's law constant [dimensionless] for Bromoform from Quack and Wallace (2003; GBC) - a_bromo = exp(13.16 - 4973*(1/tk)) -#endif + a_bromo = exp(13.16 - 4973*(1/tk)) + end if ! Transfer (piston) velocity kw according to Wanninkhof (2014), in units of ms-1 Xconvxa = 6.97e-07 ! Wanninkhof's a=0.251 converted from [cm hr-1]/[m s-1]^2 to [ms-1]/[m s-1]^2 @@ -351,28 +353,28 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & kwn2 = (1.-psicomo(i,j)) * Xconvxa * pfu10(i,j)**2*(660./scn2)**0.5 kwdms = (1.-psicomo(i,j)) * Xconvxa * pfu10(i,j)**2*(660./scdms)**0.5 kwn2o = (1.-psicomo(i,j)) * Xconvxa * pfu10(i,j)**2*(660./scn2o)**0.5 -#ifdef CFC - kw_11 = (1.-psicomo(i,j)) * Xconvxa * pfu10(i,j)**2*(660./sch_11)**0.5 - kw_12 = (1.-psicomo(i,j)) * Xconvxa * pfu10(i,j)**2*(660./sch_12)**0.5 - kw_sf = (1.-psicomo(i,j)) * Xconvxa * pfu10(i,j)**2*(660./sch_sf)**0.5 -#endif -#ifdef BROMO + if (use_CFC) then + kw_11 = (1.-psicomo(i,j)) * Xconvxa * pfu10(i,j)**2*(660./sch_11)**0.5 + kw_12 = (1.-psicomo(i,j)) * Xconvxa * pfu10(i,j)**2*(660./sch_12)**0.5 + kw_sf = (1.-psicomo(i,j)) * Xconvxa * pfu10(i,j)**2*(660./sch_sf)**0.5 + end if + if (use_BROMO) then ! Stemmler et al. (2015; Biogeosciences) Eq. (8) ! 1.e-2/3600 = conversion from [cm hr-1]/[m s-1]^2 to [ms-1]/[m s-1]^2 - kw_bromo=(1.-psicomo(i,j)) * 1.e-2/3600. * & - & (0.222*pfu10(i,j)**2+0.33*pfu10(i,j))*(660./sch_bromo)**0.5 -#endif + kw_bromo=(1.-psicomo(i,j)) * 1.e-2/3600. * & + & (0.222*pfu10(i,j)**2+0.33*pfu10(i,j))*(660./sch_bromo)**0.5 + end if atco2 = atm(i,j,iatmco2) ato2 = atm(i,j,iatmo2) atn2 = atm(i,j,iatmn2) -#ifdef cisonew - atco213 = atm(i,j,iatmc13) - atco214 = atm(i,j,iatmc14) -#endif -#ifdef BROMO - atbrf = atm(i,j,iatmbromo) -#endif + if (use_cisonew) then + atco213 = atm(i,j,iatmc13) + atco214 = atm(i,j,iatmc14) + end if + if (use_BROMO) then + atbrf = atm(i,j,iatmbromo) + end if ! Ratio P/P_0, where P is the local SLP and P_0 is standard pressure (1 atm). This is ! used in all surface flux calculations where atmospheric concentration is given as a @@ -383,11 +385,11 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & fluxu=pco2 *kwco2*dtbgc*Kh*1e-6*rrho ! to get fluxes in kmol/m^2 !JT set limit for CO2 outgassing to avoid negative DIC concentration, set minimum DIC concentration to 1e-5 kmol/m3 fluxu=min(fluxu,fluxd-(1e-5 - ocetra(i,j,k,isco212))*pddpo(i,j,1)) -#ifdef natDIC - natfluxd=atm_co2_nat*rpp0*kwco2*dtbgc*Kh*1e-6*rrho - natfluxu=natpco2 *kwco2*dtbgc*Kh*1e-6*rrho - natfluxu=min(natfluxu,natfluxd-(1e-5 - ocetra(i,j,k,inatsco212))*pddpo(i,j,1)) -#endif + if (use_natDIC) then + natfluxd=atm_co2_nat*rpp0*kwco2*dtbgc*Kh*1e-6*rrho + natfluxu=natpco2 *kwco2*dtbgc*Kh*1e-6*rrho + natfluxu=min(natfluxu,natfluxd-(1e-5 - ocetra(i,j,k,inatsco212))*pddpo(i,j,1)) + end if ! Calculate saturation DIC concentration in mixed layer ta = ocetra(i,j,k,ialkali) / rrho @@ -395,33 +397,33 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & Ksi,K1p,K2p,K3p,tc_sat,niter) ocetra(i,j,1:kmle(i,j),idicsat) = tc_sat * rrho ! convert mol/kg to kmlo/m^3 -#ifdef cisonew + if (use_cisonew ) then ! Ocean-Atmosphere fluxes for carbon isotopes - rco213=ocetra(i,j,1,isco213)/(ocetra(i,j,1,isco212)+safediv) ! Fraction DIC13 over total DIC - rco214=ocetra(i,j,1,isco214)/(ocetra(i,j,1,isco212)+safediv) ! Fraction DIC14 over total DIC + rco213=ocetra(i,j,1,isco213)/(ocetra(i,j,1,isco212)+safediv) ! Fraction DIC13 over total DIC + rco214=ocetra(i,j,1,isco214)/(ocetra(i,j,1,isco212)+safediv) ! Fraction DIC14 over total DIC - pco213 = pco2 * rco213 ! Determine water CO213 pressure and fugacity (microatm) - pco214 = pco2 * rco214 ! Determine water CO214 pressure and fugacity (microatm) + pco213 = pco2 * rco213 ! Determine water CO213 pressure and fugacity (microatm) + pco214 = pco2 * rco214 ! Determine water CO214 pressure and fugacity (microatm) ! fractionation factors for 13C during air-sea gas exchange (Zhang et al. 1995, Orr et al. 2017) - frac_k = 0.99912 !Constant kinetic fractionation - frac_aqg = (0.0049*t - 1.31)/1000. + 1. !Gas dissolution fractionation - frac_dicg = (0.0144*t*(cc/(cc+cu+cb)) - 0.107*t + 10.53)/1000. + 1. !DIC to CO2 frac - flux13d=atco213*rpp0*kwco2*dtbgc*Kh*1.e-6*rrho*frac_aqg*frac_k - flux13u=pco213 *kwco2*dtbgc*Kh*1.e-6*rrho*frac_aqg*frac_k/frac_dicg - flux14d=atco214*rpp0*kwco2*dtbgc*Kh*1.e-6*rrho*(frac_aqg**2)*(frac_k**2) - flux14u=pco214 *kwco2*dtbgc*Kh*1.e-6*rrho*(frac_aqg**2)*(frac_k**2)/(frac_dicg**2) -#endif + frac_k = 0.99912 !Constant kinetic fractionation + frac_aqg = (0.0049*t - 1.31)/1000. + 1. !Gas dissolution fractionation + frac_dicg = (0.0144*t*(cc/(cc+cu+cb)) - 0.107*t + 10.53)/1000. + 1. !DIC to CO2 frac + flux13d=atco213*rpp0*kwco2*dtbgc*Kh*1.e-6*rrho*frac_aqg*frac_k + flux13u=pco213 *kwco2*dtbgc*Kh*1.e-6*rrho*frac_aqg*frac_k/frac_dicg + flux14d=atco214*rpp0*kwco2*dtbgc*Kh*1.e-6*rrho*(frac_aqg**2)*(frac_k**2) + flux14u=pco214 *kwco2*dtbgc*Kh*1.e-6*rrho*(frac_aqg**2)*(frac_k**2)/(frac_dicg**2) + end if ! Update DIC ocetra(i,j,1,isco212)=ocetra(i,j,1,isco212)+(fluxd-fluxu)/pddpo(i,j,1) -#ifdef natDIC - ocetra(i,j,1,inatsco212)=ocetra(i,j,1,inatsco212)+(natfluxd-natfluxu)/pddpo(i,j,1) -#endif -#ifdef cisonew - ocetra(i,j,1,isco213)=ocetra(i,j,1,isco213)+(flux13d-flux13u)/pddpo(i,j,1) - ocetra(i,j,1,isco214)=ocetra(i,j,1,isco214)+(flux14d-flux14u)/pddpo(i,j,1) -#endif + if (use_natDIC) then + ocetra(i,j,1,inatsco212)=ocetra(i,j,1,inatsco212)+(natfluxd-natfluxu)/pddpo(i,j,1) + end if + if (use_cisonew) then + ocetra(i,j,1,isco213)=ocetra(i,j,1,isco213)+(flux13d-flux13u)/pddpo(i,j,1) + ocetra(i,j,1,isco214)=ocetra(i,j,1,isco214)+(flux14d-flux14u)/pddpo(i,j,1) + end if ! Surface flux of oxygen oxflux=kwo2*dtbgc*(ocetra(i,j,1,ioxygen)-satoxy(i,j,1)*(ato2/196800)*rpp0) @@ -432,7 +434,7 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & ! Surface flux of laughing gas (same piston velocity as for O2 and N2) n2oflux=kwn2o*dtbgc*(ocetra(i,j,1,ian2o)-satn2o(i,j)*atn2o*rpp0) ocetra(i,j,1,ian2o)=ocetra(i,j,1,ian2o)-n2oflux/pddpo(i,j,1) -#ifdef CFC + if (use_CFC) then ! Surface fluxes for CFC: eqn. (1a) in ocmip2 howto doc(hyc) ! flux of CFC: downward direction (mol/m**2/s) ! flx11=kw_11*(a_11*cfc11_atm(i,j)*ppair/p0-trc(i,j,1,1)) @@ -440,36 +442,36 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & ! unit should be in [kmol cfc m-2] ! unit of [cfc11_atm(i,j)*ppair/p0] should be in [pptv] ! unit of [flx11-12] is in [kmol / m2] - - IF (pglat(i,j).GE.10) THEN - atm_cfc11=atm_cfc11_nh - atm_cfc12=atm_cfc12_nh - atm_sf6=atm_sf6_nh - ELSE IF (pglat(i,j).LE.-10) THEN - atm_cfc11=atm_cfc11_sh - atm_cfc12=atm_cfc12_sh - atm_sf6=atm_sf6_sh - ELSE - fact=(pglat(i,j)-(-10))/20. - atm_cfc11=fact*atm_cfc11_nh+(1-fact)*atm_cfc11_sh - atm_cfc12=fact*atm_cfc12_nh+(1-fact)*atm_cfc12_sh - atm_sf6=fact*atm_sf6_nh+(1-fact)*atm_sf6_sh - ENDIF + + IF (pglat(i,j).GE.10) THEN + atm_cfc11=atm_cfc11_nh + atm_cfc12=atm_cfc12_nh + atm_sf6=atm_sf6_nh + ELSE IF (pglat(i,j).LE.-10) THEN + atm_cfc11=atm_cfc11_sh + atm_cfc12=atm_cfc12_sh + atm_sf6=atm_sf6_sh + ELSE + fact=(pglat(i,j)-(-10))/20. + atm_cfc11=fact*atm_cfc11_nh+(1-fact)*atm_cfc11_sh + atm_cfc12=fact*atm_cfc12_nh+(1-fact)*atm_cfc12_sh + atm_sf6=fact*atm_sf6_nh+(1-fact)*atm_sf6_sh + ENDIF ! Use conversion of 9.86923e-6 [std atm / Pascal] ! Surface flux of cfc11 - flx11=kw_11*dtbgc* & - & (a_11*atm_cfc11*ppao(i,j)*9.86923*1e-6-ocetra(i,j,1,icfc11)) - ocetra(i,j,1,icfc11)=ocetra(i,j,1,icfc11)+flx11/pddpo(i,j,1) + flx11=kw_11*dtbgc* & + & (a_11*atm_cfc11*ppao(i,j)*9.86923*1e-6-ocetra(i,j,1,icfc11)) + ocetra(i,j,1,icfc11)=ocetra(i,j,1,icfc11)+flx11/pddpo(i,j,1) ! Surface flux of cfc12 - flx12=kw_12*dtbgc* & - & (a_12*atm_cfc12*ppao(i,j)*9.86923*1e-6-ocetra(i,j,1,icfc12)) - ocetra(i,j,1,icfc12)=ocetra(i,j,1,icfc12)+flx12/pddpo(i,j,1) + flx12=kw_12*dtbgc* & + & (a_12*atm_cfc12*ppao(i,j)*9.86923*1e-6-ocetra(i,j,1,icfc12)) + ocetra(i,j,1,icfc12)=ocetra(i,j,1,icfc12)+flx12/pddpo(i,j,1) ! Surface flux of sf6 - flxsf=kw_sf*dtbgc* & - & (a_sf*atm_sf6*ppao(i,j)*9.86923*1e-6-ocetra(i,j,1,isf6)) - ocetra(i,j,1,isf6)=ocetra(i,j,1,isf6)+flxsf/pddpo(i,j,1) -#endif + flxsf=kw_sf*dtbgc* & + & (a_sf*atm_sf6*ppao(i,j)*9.86923*1e-6-ocetra(i,j,1,isf6)) + ocetra(i,j,1,isf6)=ocetra(i,j,1,isf6)+flxsf/pddpo(i,j,1) + end if ! Surface flux of dms if (do_bgc_aofluxes) then @@ -481,63 +483,63 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & ocetra(i,j,1,idms) = ocetra(i,j,1,idms) - dmsflux/pddpo(i,j,1) atmflx(i,j,iatmdms) = dmsflux ! positive to atmosphere [kmol dms m-2 timestep-1] -#ifdef BROMO + if (use_BROMO) then ! Quack and Wallace (2003) eq. 1 ! flux = kw*(Cw - Ca/H) ; kw[m s-1]; Cw[kmol m-3]; ! Convert Ca(atbrf) from ! [pptv] to [ppp] by multiplying with 1e-12 (ppp = parts per part, dimensionless) ! [ppp] to [mol L-1] by multiplying with pressure[bar]/(SST[K]*R[L bar K-1 mol-1]); R=0,083 ! [mol L-1] to [kmol m-3] by multiplying with 1 - - if (do_bgc_aofluxes) then - flx_bromo = kw_bromo*dtbgc* & - (atbrf/a_bromo*1e-12*ppao(i,j)*1e-5/(tk*0.083) - ocetra(i,j,1,ibromo)) - else - ! Note that the external computation of fluxes is -flx_bromo/dtbgc - ! using above computation of flx_bromo - ! So need to divide by 252.7 and multiply by -dtbgc and in order to use this - ! for the tendency in the tracer update - flx_bromo = dtbgc*pflxbromo(i,j) + + if (do_bgc_aofluxes) then + flx_bromo = kw_bromo*dtbgc* & + (atbrf/a_bromo*1e-12*ppao(i,j)*1e-5/(tk*0.083) - ocetra(i,j,1,ibromo)) + else + ! Note that the external computation of fluxes is -flx_bromo/dtbgc + ! using above computation of flx_bromo + ! So need to divide by 252.7 and multiply by -dtbgc and in order to use this + ! for the tendency in the tracer update + flx_bromo = dtbgc*pflxbromo(i,j) + end if + ocetra(i,j,1,ibromo) = ocetra(i,j,1,ibromo) + flx_bromo/pddpo(i,j,1) + atmflx(i,j,iatmbromo) = -flx_bromo end if - ocetra(i,j,1,ibromo) = ocetra(i,j,1,ibromo) + flx_bromo/pddpo(i,j,1) - atmflx(i,j,iatmbromo) = -flx_bromo -#endif ! Save surface fluxes atmflx(i,j,iatmco2)=fluxu-fluxd atmflx(i,j,iatmo2)=oxflux atmflx(i,j,iatmn2)=niflux atmflx(i,j,iatmn2o)=n2oflux -#ifdef cisonew - atmflx(i,j,iatmc13)=flux13u-flux13d - atmflx(i,j,iatmc14)=flux14u-flux14d -#endif -#ifdef CFC - atmflx(i,j,iatmf11)=flx11 - atmflx(i,j,iatmf12)=flx12 - atmflx(i,j,iatmsf6)=flxsf -#endif -#ifdef natDIC - atmflx(i,j,iatmnco2)=natfluxu-natfluxd -#endif + if (use_cisonew) then + atmflx(i,j,iatmc13)=flux13u-flux13d + atmflx(i,j,iatmc14)=flux14u-flux14d + end if + if (use_CFC) then + atmflx(i,j,iatmf11)=flx11 + atmflx(i,j,iatmf12)=flx12 + atmflx(i,j,iatmsf6)=flxsf + end if + if (use_natDIC) then + atmflx(i,j,iatmnco2)=natfluxu-natfluxd + end if ! Save up- and downward components of carbon fluxes for output co2fxd(i,j) = fluxd co2fxu(i,j) = fluxu -#ifdef cisonew - co213fxd(i,j)= flux13d - co213fxu(i,j)= flux13u - co214fxd(i,j)= flux14d - co214fxu(i,j)= flux14u -#endif + if (use_cisonew) then + co213fxd(i,j)= flux13d + co213fxu(i,j)= flux13u + co214fxd(i,j)= flux14d + co214fxu(i,j)= flux14u + end if ! 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 + if (use_natDIC) then + natpco2d(i,j) = natcu * 1.e6 / Khd + end if ! Save product of piston velocity and solubility for output kwco2sol(i,j) = kwco2*Kh*1e-6 !m/s mol/kg/muatm @@ -547,15 +549,15 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & endif ! k==1 -#ifdef BROMO + if (use_BROMO) then ! Degradation to hydrolysis (Eq. 2-4 of Stemmler et al., 2015) ! A1=1.23e17 mol min-1 => 2.05e12 kmol sec-1 - Kb1=2.05e12*exp(-1.073e5/(8.314*tk))*dtbgc - ocetra(i,j,k,ibromo)=ocetra(i,j,k,ibromo)*(1.-(Kb1*Kw/ah1)) + Kb1=2.05e12*exp(-1.073e5/(8.314*tk))*dtbgc + ocetra(i,j,k,ibromo)=ocetra(i,j,k,ibromo)*(1.-(Kb1*Kw/ah1)) ! Degradation to halogen substitution (Eq. 5-6 of Stemmler et al., 2015) - lsub=7.33e-10*exp(1.250713e4*(1/298.-1/tk))*dtbgc - ocetra(i,j,k,ibromo)=ocetra(i,j,k,ibromo)*(1.-lsub) -#endif + lsub=7.33e-10*exp(1.250713e4*(1/298.-1/tk))*dtbgc + ocetra(i,j,k,ibromo)=ocetra(i,j,k,ibromo)*(1.-lsub) + end if ! ----------------------------------------------------------------- ! Deep ocean processes @@ -569,43 +571,43 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & supsat=co3(i,j,k)-co3(i,j,k)/OmegaC(i,j,k) undsa=MAX(0.,-supsat) dissol=MIN(undsa,0.05*ocetra(i,j,k,icalc)) -#ifdef natDIC - natomega = ( calcon * s / 35. ) * natcc - natOmegaA(i,j,k) = natomega / Kspa - natOmegaC(i,j,k) = natomega / Kspc - natsupsat=natco3(i,j,k)-natco3(i,j,k)/natOmegaC(i,j,k) - natundsa=MAX(0.,-natsupsat) - natdissol=MIN(natundsa,0.05*ocetra(i,j,k,inatcalc)) -#endif -#ifdef cisonew - dissol13=dissol*ocetra(i,j,k,icalc13)/(ocetra(i,j,k,icalc)+safediv) - dissol14=dissol*ocetra(i,j,k,icalc14)/(ocetra(i,j,k,icalc)+safediv) -#endif + if (use_natDIC) then + natomega = ( calcon * s / 35. ) * natcc + natOmegaA(i,j,k) = natomega / Kspa + natOmegaC(i,j,k) = natomega / Kspc + natsupsat=natco3(i,j,k)-natco3(i,j,k)/natOmegaC(i,j,k) + natundsa=MAX(0.,-natsupsat) + natdissol=MIN(natundsa,0.05*ocetra(i,j,k,inatcalc)) + end if + if (use_cisonew) then + dissol13=dissol*ocetra(i,j,k,icalc13)/(ocetra(i,j,k,icalc)+safediv) + dissol14=dissol*ocetra(i,j,k,icalc14)/(ocetra(i,j,k,icalc)+safediv) + end if ocetra(i,j,k,icalc)=ocetra(i,j,k,icalc)-dissol ocetra(i,j,k,ialkali)=ocetra(i,j,k,ialkali)+2.*dissol ocetra(i,j,k,isco212)=ocetra(i,j,k,isco212)+dissol -#ifdef natDIC - ocetra(i,j,k,inatcalc)=ocetra(i,j,k,inatcalc)-natdissol - ocetra(i,j,k,inatalkali)=ocetra(i,j,k,inatalkali)+2.*natdissol - ocetra(i,j,k,inatsco212)=ocetra(i,j,k,inatsco212)+natdissol -#endif -#ifdef cisonew - ocetra(i,j,k,icalc13)=ocetra(i,j,k,icalc13)-dissol13 - ocetra(i,j,k,isco213)=ocetra(i,j,k,isco213)+dissol13 - ocetra(i,j,k,icalc14)=ocetra(i,j,k,icalc14)-dissol14 - ocetra(i,j,k,isco214)=ocetra(i,j,k,isco214)+dissol14 -#endif - - -#ifdef cisonew -! Decay of the ocean tracers that contain radioactive carbon 14C - ocetra(i,j,k,isco214) = ocetra(i,j,k,isco214)*c14dec - ocetra(i,j,k,idet14) = ocetra(i,j,k,idet14) *c14dec - ocetra(i,j,k,icalc14) = ocetra(i,j,k,icalc14)*c14dec - ocetra(i,j,k,idoc14) = ocetra(i,j,k,idoc14)*c14dec - ocetra(i,j,k,iphy14) = ocetra(i,j,k,iphy14)*c14dec - ocetra(i,j,k,izoo14) = ocetra(i,j,k,izoo14)*c14dec -#endif + if (use_natDIC) then + ocetra(i,j,k,inatcalc)=ocetra(i,j,k,inatcalc)-natdissol + ocetra(i,j,k,inatalkali)=ocetra(i,j,k,inatalkali)+2.*natdissol + ocetra(i,j,k,inatsco212)=ocetra(i,j,k,inatsco212)+natdissol + end if + if (use_cisonew) then + ocetra(i,j,k,icalc13)=ocetra(i,j,k,icalc13)-dissol13 + ocetra(i,j,k,isco213)=ocetra(i,j,k,isco213)+dissol13 + ocetra(i,j,k,icalc14)=ocetra(i,j,k,icalc14)-dissol14 + ocetra(i,j,k,isco214)=ocetra(i,j,k,isco214)+dissol14 + end if + + + if (use_cisonew) then + ! Decay of the ocean tracers that contain radioactive carbon 14C + ocetra(i,j,k,isco214) = ocetra(i,j,k,isco214)*c14dec + ocetra(i,j,k,idet14) = ocetra(i,j,k,idet14) *c14dec + ocetra(i,j,k,icalc14) = ocetra(i,j,k,icalc14)*c14dec + ocetra(i,j,k,idoc14) = ocetra(i,j,k,idoc14)*c14dec + ocetra(i,j,k,iphy14) = ocetra(i,j,k,iphy14)*c14dec + ocetra(i,j,k,izoo14) = ocetra(i,j,k,izoo14)*c14dec + end if ! Save bottom level dissociation konstants for use in sediment module if( k==kbo(i,j) ) then @@ -633,25 +635,25 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & ! C14 decay in the sediment (could be moved to sediment part) -#ifdef cisonew -#ifndef sedbypass - do k=1,ks -!$OMP PARALLEL DO PRIVATE(i) - do j=1,kpje - do i=1,kpie - if(omask(i,j).gt.0.5) then - sedlay(i,j,k,issso14)=sedlay(i,j,k,issso14)*c14dec - sedlay(i,j,k,isssc14)=sedlay(i,j,k,isssc14)*c14dec - powtra(i,j,k,ipowc14)=powtra(i,j,k,ipowc14)*c14dec - endif - enddo - enddo -!$OMP END PARALLEL DO - enddo -#endif -#endif + if (use_cisonew) then + if (.not. use_sedbypass) then + do k=1,ks + !$OMP PARALLEL DO PRIVATE(i) + do j=1,kpje + do i=1,kpie + if(omask(i,j).gt.0.5) then + sedlay(i,j,k,issso14)=sedlay(i,j,k,issso14)*c14dec + sedlay(i,j,k,isssc14)=sedlay(i,j,k,isssc14)*c14dec + powtra(i,j,k,ipowc14)=powtra(i,j,k,ipowc14)*c14dec + endif + enddo + enddo + !$OMP END PARALLEL DO + enddo + end if + end if RETURN - END + END SUBROUTINE CARCHM diff --git a/hamocc/cyano.F90 b/hamocc/cyano.F90 index f3f696df..765ddc75 100644 --- a/hamocc/cyano.F90 +++ b/hamocc/cyano.F90 @@ -65,9 +65,9 @@ SUBROUTINE CYANO(kpie,kpje,kpke,kbnd,pddpo,omask,ptho) use mo_biomod, only: bluefix,intnfix,rnit,tf0,tf1,tf2,tff use mo_param1_bgc, only: ialkali,iano3,igasnit,iphosph,ioxygen use mo_vgrid, only: kmle -#ifdef natDIC + ! natDIC use mo_param1_bgc, only: inatalkali -#endif + use mo_ifdefs implicit none @@ -113,9 +113,9 @@ SUBROUTINE CYANO(kpie,kpje,kpke,kbnd,pddpo,omask,ptho) ! Nitrogen fixation followed by remineralisation and nitrification decreases ! alkalinity by 1 mole per mole nitrogen fixed (Wolf-Gladrow et al. 2007) ocetra(i,j,k,ialkali)=ocetra(i,j,k,ialkali)-dano3 -#ifdef natDIC - ocetra(i,j,k,inatalkali)=ocetra(i,j,k,inatalkali)-dano3 -#endif + if (use_natDIC) then + ocetra(i,j,k,inatalkali)=ocetra(i,j,k,inatalkali)-dano3 + end if intnfix(i,j) = intnfix(i,j) + & & (ocetra(i,j,k,iano3)-oldocetra)*pddpo(i,j,k) diff --git a/hamocc/dipowa.F90 b/hamocc/dipowa.F90 index f601b33b..d38e7ad6 100644 --- a/hamocc/dipowa.F90 +++ b/hamocc/dipowa.F90 @@ -59,12 +59,11 @@ subroutine dipowa(kpie,kpje,kpke,omask,lspin) use mo_sedmnt, only: powtra,porwat,porwah,sedict,seddw,seddzi,zcoefsu,zcoeflo use mo_param1_bgc, only: ks,npowtra,map_por2octra use mo_vgrid, only: kbo,bolay -#ifdef cisonew + ! cisonew use mo_param1_bgc, only: ipowc13,ipowc14,isco213,isco214 -#endif -#ifdef natDIC + ! natDIC use mo_param1_bgc, only: ialkali,inatalkali,inatsco212,isco212 -#endif + use mo_ifdefs implicit none @@ -190,15 +189,15 @@ subroutine dipowa(kpie,kpje,kpke,omask,lspin) ! diffusive fluxes (positive downward) sedfluxo(i,j,iv) = sedfluxo(i,j,iv) & & -(ocetra(i,j,kbo(i,j),iv_oc) - aprior)* bolay(i,j) -#ifdef natDIC - ! workaround as long as natDIC is not implemented throughout the sediment module - if (iv_oc==isco212) ocetra(i,j,kbo(i,j),inatsco212) = & - & ocetra(i,j,kbo(i,j),inatsco212) + & - & ocetra(i,j,kbo(i,j),isco212) - aprior - if (iv_oc==ialkali) ocetra(i,j,kbo(i,j),inatalkali) = & - & ocetra(i,j,kbo(i,j),inatalkali) + & - & ocetra(i,j,kbo(i,j),ialkali) - aprior -#endif + if (use_natDIC) then + ! workaround as long as natDIC is not implemented throughout the sediment module + if (iv_oc==isco212) ocetra(i,j,kbo(i,j),inatsco212) = & + & ocetra(i,j,kbo(i,j),inatsco212) + & + & ocetra(i,j,kbo(i,j),isco212) - aprior + if (iv_oc==ialkali) ocetra(i,j,kbo(i,j),inatalkali) = & + & ocetra(i,j,kbo(i,j),inatalkali) + & + & ocetra(i,j,kbo(i,j),ialkali) - aprior + end if endif enddo enddo diff --git a/hamocc/hamocc4bcm.F90 b/hamocc/hamocc4bcm.F90 index 19d9fdbc..74bbb2b6 100644 --- a/hamocc/hamocc4bcm.F90 +++ b/hamocc/hamocc4bcm.F90 @@ -93,15 +93,14 @@ SUBROUTINE HAMOCC4BCM(kpie,kpje,kpke,kbnd,kplyear,kplmon,kplday,kldtday,& use mo_apply_rivin, only: apply_rivin use mo_apply_ndep, only: apply_ndep use mo_apply_oafx, only: apply_oafx -#if defined(BOXATM) - use mo_boxatm, only: update_boxatm -#endif -#ifdef BROMO + ! BOXATM + ! use mo_boxatm, only: update_boxatm ERROR: there is no mo_boxatm + ! BROMO use mo_param1_bgc, only: iatmbromo -#endif -#ifdef CFC + !CFC use mo_carbch, only: atm_cfc11_nh,atm_cfc11_sh,atm_cfc12_nh,atm_cfc12_sh,atm_sf6_nh,atm_sf6_sh -#endif + use mo_ifdefs + implicit none INTEGER, intent(in) :: kpie,kpje,kpke,kbnd @@ -175,45 +174,45 @@ SUBROUTINE HAMOCC4BCM(kpie,kpje,kpke,kbnd,kplyear,kplmon,kplday,kldtday,& !-------------------------------------------------------------------- ! Pass atmospheric co2 if coupled to an active atmosphere model ! -#if defined(PROGCO2) || defined(DIAGCO2) -!$OMP PARALLEL DO PRIVATE(i) - DO j=1,kpje - DO i=1,kpie - atm(i,j,iatmco2)=patmco2(i,j) - ENDDO - ENDDO -!$OMP END PARALLEL DO - !if (mnproc.eq.1) write (io_stdo_bgc,*) 'iHAMOCC: getting co2 from atm' -#endif - -#ifdef BROMO -!$OMP PARALLEL DO PRIVATE(i) - DO j=1,kpje - DO i=1,kpie - IF (patmbromo(i,j).gt.0.) THEN - atm(i,j,iatmbromo)=patmbromo(i,j) - ENDIF - ENDDO - ENDDO -!$OMP END PARALLEL DO - if (mnproc.eq.1) write (io_stdo_bgc,*) 'iHAMOCC: getting bromoform from atm' -#endif + if (use_PROGCO2 .or. use_DIAGCO2) then + !$OMP PARALLEL DO PRIVATE(i) + DO j=1,kpje + DO i=1,kpie + atm(i,j,iatmco2)=patmco2(i,j) + ENDDO + ENDDO + !$OMP END PARALLEL DO + !if (mnproc.eq.1) write (io_stdo_bgc,*) 'iHAMOCC: getting co2 from atm' + end if + + if (use_BROMO) then + !$OMP PARALLEL DO PRIVATE(i) + DO j=1,kpje + DO i=1,kpie + IF (patmbromo(i,j).gt.0.) THEN + atm(i,j,iatmbromo)=patmbromo(i,j) + ENDIF + ENDDO + ENDDO + !$OMP END PARALLEL DO + if (mnproc.eq.1) write (io_stdo_bgc,*) 'iHAMOCC: getting bromoform from atm' + end if !-------------------------------------------------------------------- ! Read atmospheric cfc concentrations ! -#ifdef CFC - call get_cfc(kplyear,atm_cfc11_nh,atm_cfc12_nh,atm_sf6_nh, & - atm_cfc11_sh,atm_cfc12_sh,atm_sf6_sh) -#endif + if (use_CFC) then + call get_cfc(kplyear,atm_cfc11_nh,atm_cfc12_nh,atm_sf6_nh, & + atm_cfc11_sh,atm_cfc12_sh,atm_sf6_sh) + end if -#ifdef PBGC_CK_TIMESTEP - IF (mnproc.eq.1) THEN - WRITE(io_stdo_bgc,*)' ' - WRITE(io_stdo_bgc,*)'before BGC: call INVENTORY' - ENDIF - CALL INVENTORY_BGC(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask,0) -#endif + if (use_PBGC_CK_TIMESTEP) then + IF (mnproc.eq.1) THEN + WRITE(io_stdo_bgc,*)' ' + WRITE(io_stdo_bgc,*)'before BGC: call INVENTORY' + ENDIF + CALL INVENTORY_BGC(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask,0) + end if !--------------------------------------------------------------------- @@ -228,13 +227,13 @@ SUBROUTINE HAMOCC4BCM(kpie,kpje,kpke,kbnd,kplyear,kplmon,kplday,kldtday,& CALL OCPROD(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) -#ifdef PBGC_CK_TIMESTEP - IF (mnproc.eq.1) THEN - WRITE(io_stdo_bgc,*)' ' - WRITE(io_stdo_bgc,*)'after OCPROD: call INVENTORY' - ENDIF - CALL INVENTORY_BGC(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask,0) -#endif + if (use_PBGC_CK_TIMESTEP ) then + IF (mnproc.eq.1) THEN + WRITE(io_stdo_bgc,*)' ' + WRITE(io_stdo_bgc,*)'after OCPROD: call INVENTORY' + ENDIF + CALL INVENTORY_BGC(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask,0) + end if do l=1,nocetra @@ -251,83 +250,84 @@ SUBROUTINE HAMOCC4BCM(kpie,kpje,kpke,kbnd,kplyear,kplmon,kplday,kldtday,& enddo enddo -#ifdef PBGC_CK_TIMESTEP - IF (mnproc.eq.1) THEN - WRITE(io_stdo_bgc,*)' ' - WRITE(io_stdo_bgc,*)'after LIMIT: call INVENTORY' - ENDIF - CALL INVENTORY_BGC(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask,0) -#endif + if (use_PBGC_CK_TIMESTEP ) then + IF (mnproc.eq.1) THEN + WRITE(io_stdo_bgc,*)' ' + WRITE(io_stdo_bgc,*)'after LIMIT: call INVENTORY' + ENDIF + CALL INVENTORY_BGC(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask,0) + end if CALL CYANO(kpie,kpje,kpke,kbnd,pddpo,omask,ptho) -#ifdef PBGC_CK_TIMESTEP - IF (mnproc.eq.1) THEN - WRITE(io_stdo_bgc,*)' ' - WRITE(io_stdo_bgc,*)'after CYANO: call INVENTORY' - ENDIF - CALL INVENTORY_BGC(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask,0) -#endif + if (use_PBGC_CK_TIMESTEP ) then + IF (mnproc.eq.1) THEN + WRITE(io_stdo_bgc,*)' ' + WRITE(io_stdo_bgc,*)'after CYANO: call INVENTORY' + ENDIF + CALL INVENTORY_BGC(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask,0) + end if CALL CARCHM(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,prho,pglat,omask, & psicomo,ppao,pfu10,ptho,psao,& pflxdms,pflxbromo) -#ifdef PBGC_CK_TIMESTEP - IF (mnproc.eq.1) THEN - WRITE(io_stdo_bgc,*)' ' - WRITE(io_stdo_bgc,*)'after CARCHM: call INVENTORY' - ENDIF - CALL INVENTORY_BGC(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask,0) -#endif + if (use_PBGC_CK_TIMESTEP ) then + IF (mnproc.eq.1) THEN + WRITE(io_stdo_bgc,*)' ' + WRITE(io_stdo_bgc,*)'after CARCHM: call INVENTORY' + ENDIF + CALL INVENTORY_BGC(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask,0) + end if ! Apply n-deposition CALL apply_ndep(kpie,kpje,kpke,pddpo,omask,ndep) -#ifdef PBGC_CK_TIMESTEP - IF (mnproc.eq.1) THEN - WRITE(io_stdo_bgc,*)' ' - WRITE(io_stdo_bgc,*)'after N deposition: call INVENTORY' - ENDIF - CALL INVENTORY_BGC(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask,0) -#endif + if (use_PBGC_CK_TIMESTEP ) then + IF (mnproc.eq.1) THEN + WRITE(io_stdo_bgc,*)' ' + WRITE(io_stdo_bgc,*)'after N deposition: call INVENTORY' + ENDIF + CALL INVENTORY_BGC(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask,0) + end if ! Apply riverine input of carbon and nutrients call apply_rivin(kpie,kpje,kpke,pddpo,omask,rivin) -#ifdef PBGC_CK_TIMESTEP - IF (mnproc.eq.1) THEN - WRITE(io_stdo_bgc,*)' ' - WRITE(io_stdo_bgc,*)'after river input: call INVENTORY' - ENDIF - CALL INVENTORY_BGC(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask,0) -#endif + if (use_PBGC_CK_TIMESTEP ) then + IF (mnproc.eq.1) THEN + WRITE(io_stdo_bgc,*)' ' + WRITE(io_stdo_bgc,*)'after river input: call INVENTORY' + ENDIF + CALL INVENTORY_BGC(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask,0) + end if ! Apply alkalinity flux due to ocean alkalinization call apply_oafx(kpie,kpje,kpke,pddpo,omask,oafx) -#ifdef PBGC_CK_TIMESTEP - IF (mnproc.eq.1) THEN - WRITE(io_stdo_bgc,*)' ' - WRITE(io_stdo_bgc,*)'after ocean alkalinization: call INVENTORY' - ENDIF - CALL INVENTORY_BGC(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask,0) -#endif + if (use_PBGC_CK_TIMESTEP ) then + IF (mnproc.eq.1) THEN + WRITE(io_stdo_bgc,*)' ' + WRITE(io_stdo_bgc,*)'after ocean alkalinization: call INVENTORY' + ENDIF + CALL INVENTORY_BGC(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask,0) + end if ! Update atmospheric pCO2 [ppm] -#if defined(BOXATM) - CALL update_boxatm(kpie,kpje,pdlxp,pdlyp) -#endif + ! ERROR - there is no module that contains update_boxatm + ! if (use_BOXATM) then + ! CALL update_boxatm(kpie,kpje,pdlxp,pdlyp) + ! end if -#ifdef PBGC_CK_TIMESTEP - IF (mnproc.eq.1) THEN - WRITE(io_stdo_bgc,*)' ' - WRITE(io_stdo_bgc,*)'after ATMOTR: call INVENTORY' - ENDIF - CALL INVENTORY_BGC(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask,0) -#endif + if (use_PBGC_CK_TIMESTEP ) then + IF (mnproc.eq.1) THEN + WRITE(io_stdo_bgc,*)' ' + WRITE(io_stdo_bgc,*)'after ATMOTR: call INVENTORY' + ENDIF + CALL INVENTORY_BGC(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask,0) + end if ! update preformed tracers CALL PREFTRC(kpie,kpje,omask) @@ -336,62 +336,62 @@ SUBROUTINE HAMOCC4BCM(kpie,kpje,kpke,kbnd,kplyear,kplmon,kplday,kldtday,& !-------------------------------------------------------------------- ! Sediment module -#ifndef sedbypass -! jump over sediment if sedbypass is defined - - if(do_sedspinup .and. kplyear>=sedspin_yr_s & - .and. kplyear<=sedspin_yr_e) then - nspin = sedspin_ncyc - if(mnproc == 1) then - write(io_stdo_bgc,*) - write(io_stdo_bgc,*) 'iHAMOCC: sediment spinup activated with ', & - nspin, ' subcycles' - endif - else - nspin = 1 - endif - - ! Loop for sediment spinup. If deactivated then nspin=1 and lspin=.false. - do it=1,nspin - - if( it=sedspin_yr_s & + .and. kplyear<=sedspin_yr_e) then + nspin = sedspin_ncyc + if(mnproc == 1) then + write(io_stdo_bgc,*) + write(io_stdo_bgc,*) 'iHAMOCC: sediment spinup activated with ', & + nspin, ' subcycles' + endif + else + nspin = 1 + endif + + ! Loop for sediment spinup. If deactivated then nspin=1 and lspin=.false. + do it=1,nspin + + if( it_varid, and mean concentration zc__varid integer :: ztotvol_varid ! Total ocean volume @@ -744,7 +767,8 @@ subroutine write_netcdf(iogrp) integer :: zt_prefalk_varid, zc_prefalk_varid ! Preformed alkalinity integer :: zt_prefdic_varid, zc_prefdic_varid ! Preformed DIC integer :: zt_dicsat_varid, zc_dicsat_varid ! Saturated DIC -#ifdef cisonew + + ! cisonew integer :: zt_sco213_varid, zc_sco213_varid ! Dissolved CO2-C13 integer :: zt_sco214_varid, zc_sco214_varid ! Dissolved CO2-C14 integer :: zt_doc13_varid, zc_doc13_varid ! Dissolved organic carbon-C13 @@ -757,24 +781,24 @@ subroutine write_netcdf(iogrp) integer :: zt_grazer14_varid, zc_grazer14_varid ! Zooplankton concentration-C14 integer :: zt_calciu13_varid, zc_calciu13_varid ! Calcium carbonate-C13 integer :: zt_calciu14_varid, zc_calciu14_varid ! Calcium carbonate-C14 -#endif -#ifdef AGG + + ! AGG integer :: zt_snos_varid, zc_snos_varid ! Marine snow aggregates per g sea water integer :: zt_adust_varid, zc_adust_varid ! Aggregated dust -#endif -#ifdef CFC + + ! CFC integer :: zt_cfc11_varid, zc_cfc11_varid ! CFC-11 : Trichlorofluoromethane integer :: zt_cfc12_varid, zc_cfc12_varid ! CFC-12 : Dichlorodifluoromethane integer :: zt_sf6_varid, zc_sf6_varid ! SF6 : Sulfur hexafluoride -#endif -#ifdef natDIC + + ! natDIC integer :: zt_natsco212_varid, zc_natsco212_varid ! Natural dissolved CO2 integer :: zt_natalkali_varid, zc_natalkali_varid ! Natural alkalinity integer :: zt_natcalciu_varid, zc_natcalciu_varid ! Natural calcium carbonate -#endif -#ifdef BROMO + + ! BROMO integer :: zt_bromo_varid, zc_bromo_varid ! Bromoform -#endif + !--- sum of inventory integer :: totcarb_varid, totphos_varid, totsili_varid, totnitr_varid integer :: totoxyg_varid @@ -818,63 +842,63 @@ subroutine write_netcdf(iogrp) call nccheck( NF90_PUT_ATT(ncid, NF90_GLOBAL, 'date', timeunits) ) !--- Define dimensions -#ifndef sedbypass - call nccheck( NF90_DEF_DIM(ncid, 'npowtra', npowtra, npowtra_dimid) ) - call nccheck( NF90_DEF_DIM(ncid, 'nsedtra', nsedtra, nsedtra_dimid) ) -#endif + if (.not. use_sedbypass) then + call nccheck( NF90_DEF_DIM(ncid, 'npowtra', npowtra, npowtra_dimid) ) + call nccheck( NF90_DEF_DIM(ncid, 'nsedtra', nsedtra, nsedtra_dimid) ) + end if call nccheck( NF90_DEF_DIM(ncid, 'time', NF90_UNLIMITED, time_dimid) ) !--- Dimensions for arrays. !--- The unlimited "time" dimension must come last in the list of dimensions. -#ifndef sedbypass - zpowtra_dimids = (/ npowtra_dimid, time_dimid /) - zsedtra_dimids = (/ nsedtra_dimid, time_dimid /) -#endif + if (.not. use_sedbypass) then + zpowtra_dimids = (/ npowtra_dimid, time_dimid /) + zsedtra_dimids = (/ nsedtra_dimid, time_dimid /) + end if !--- Define variables : time call nccheck( NF90_DEF_VAR(ncid, 'time', NF90_DOUBLE, time_dimid, & & time_varid) ) call nccheck( NF90_PUT_ATT(ncid, time_varid, 'units', 'days') ) -#ifndef sedbypass - !--- aqueous sediment tracers - call nccheck( NF90_DEF_VAR(ncid, 'zsedtotvol', NF90_DOUBLE, time_dimid, & - & zsedtotvol_varid) ) - call nccheck( NF90_PUT_ATT(ncid, zsedtotvol_varid, 'long_name', & - & 'Total sediment volume') ) - call nccheck( NF90_PUT_ATT(ncid, zsedtotvol_varid, 'units', 'L') ) - - call nccheck( NF90_DEF_VAR(ncid, 'zpowtratot', NF90_DOUBLE, & - & zpowtra_dimids, zpowtratot_varid) ) - call nccheck( NF90_PUT_ATT(ncid, zpowtratot_varid, 'long_name', & - & 'Total aqueous sediment tracer') ) - call nccheck( NF90_PUT_ATT(ncid, zpowtratot_varid, 'units', 'kmol') ) - - call nccheck( NF90_DEF_VAR(ncid, 'zpowtratoc', NF90_DOUBLE, & - & zpowtra_dimids, zpowtratoc_varid) ) - call nccheck( NF90_PUT_ATT(ncid, zpowtratoc_varid, 'long_name', & - & 'Aqueous sediment concentration') ) - call nccheck( NF90_PUT_ATT(ncid, zpowtratoc_varid, 'units', 'kmol/L') ) - - !--- non-aqueous sediment tracers - call nccheck( NF90_DEF_VAR(ncid, 'zsedlayto', NF90_DOUBLE, & - & zsedtra_dimids, zsedlayto_varid) ) - call nccheck( NF90_PUT_ATT(ncid, zsedlayto_varid, 'long_name', & - & 'Sediment layer tracers') ) - call nccheck( NF90_PUT_ATT(ncid, zsedlayto_varid, 'units', 'kmol') ) - - call nccheck( NF90_DEF_VAR(ncid, 'zburial', NF90_DOUBLE, & - & zsedtra_dimids, zburial_varid) ) - call nccheck( NF90_PUT_ATT(ncid, zburial_varid, 'long_name', & - & 'Sediment burial tracers') ) - call nccheck( NF90_PUT_ATT(ncid, zburial_varid, 'units', 'kmol') ) - - call nccheck( NF90_DEF_VAR(ncid, 'zsedhplto', NF90_DOUBLE, time_dimid, & - & zsedhplto_varid) ) - call nccheck( NF90_PUT_ATT(ncid, zsedhplto_varid, 'long_name', & - & 'Total sediment accumulated hydrogen ions') ) - call nccheck( NF90_PUT_ATT(ncid, zsedhplto_varid, 'units', 'kmol') ) -#endif + if (.not. use_sedbypass) then + !--- aqueous sediment tracers + call nccheck( NF90_DEF_VAR(ncid, 'zsedtotvol', NF90_DOUBLE, time_dimid, & + & zsedtotvol_varid) ) + call nccheck( NF90_PUT_ATT(ncid, zsedtotvol_varid, 'long_name', & + & 'Total sediment volume') ) + call nccheck( NF90_PUT_ATT(ncid, zsedtotvol_varid, 'units', 'L') ) + + call nccheck( NF90_DEF_VAR(ncid, 'zpowtratot', NF90_DOUBLE, & + & zpowtra_dimids, zpowtratot_varid) ) + call nccheck( NF90_PUT_ATT(ncid, zpowtratot_varid, 'long_name', & + & 'Total aqueous sediment tracer') ) + call nccheck( NF90_PUT_ATT(ncid, zpowtratot_varid, 'units', 'kmol') ) + + call nccheck( NF90_DEF_VAR(ncid, 'zpowtratoc', NF90_DOUBLE, & + & zpowtra_dimids, zpowtratoc_varid) ) + call nccheck( NF90_PUT_ATT(ncid, zpowtratoc_varid, 'long_name', & + & 'Aqueous sediment concentration') ) + call nccheck( NF90_PUT_ATT(ncid, zpowtratoc_varid, 'units', 'kmol/L') ) + + !--- non-aqueous sediment tracers + call nccheck( NF90_DEF_VAR(ncid, 'zsedlayto', NF90_DOUBLE, & + & zsedtra_dimids, zsedlayto_varid) ) + call nccheck( NF90_PUT_ATT(ncid, zsedlayto_varid, 'long_name', & + & 'Sediment layer tracers') ) + call nccheck( NF90_PUT_ATT(ncid, zsedlayto_varid, 'units', 'kmol') ) + + call nccheck( NF90_DEF_VAR(ncid, 'zburial', NF90_DOUBLE, & + & zsedtra_dimids, zburial_varid) ) + call nccheck( NF90_PUT_ATT(ncid, zburial_varid, 'long_name', & + & 'Sediment burial tracers') ) + call nccheck( NF90_PUT_ATT(ncid, zburial_varid, 'units', 'kmol') ) + + call nccheck( NF90_DEF_VAR(ncid, 'zsedhplto', NF90_DOUBLE, time_dimid, & + & zsedhplto_varid) ) + call nccheck( NF90_PUT_ATT(ncid, zsedhplto_varid, 'long_name', & + & 'Total sediment accumulated hydrogen ions') ) + call nccheck( NF90_PUT_ATT(ncid, zsedhplto_varid, 'units', 'kmol') ) + end if !--- Define variables : oceanic tracers call nccheck( NF90_DEF_VAR(ncid, 'ztotvol', NF90_DOUBLE, time_dimid, & @@ -1147,272 +1171,272 @@ subroutine write_netcdf(iogrp) & 'Mean saturated DIC concentration') ) call nccheck( NF90_PUT_ATT(ncid, zc_dicsat_varid, 'units', 'kmol/m^3') ) -#ifdef cisonew - call nccheck( NF90_DEF_VAR(ncid, 'zt_sco213', NF90_DOUBLE, & - & time_dimid, zt_sco213_varid) ) - call nccheck( NF90_PUT_ATT(ncid, zt_sco213_varid, 'long_name', & - & 'Total dissolved CO2-C13 tracer') ) - call nccheck( NF90_PUT_ATT(ncid, zt_sco213_varid, 'units', 'kmol') ) - - call nccheck( NF90_DEF_VAR(ncid, 'zc_sco213', NF90_DOUBLE, & - & time_dimid, zc_sco213_varid) ) - call nccheck( NF90_PUT_ATT(ncid, zc_sco213_varid, 'long_name', & - & 'Mean dissolved CO2-C13 concentration') ) - call nccheck( NF90_PUT_ATT(ncid, zc_sco213_varid, 'units', 'kmol/m^3') ) - - call nccheck( NF90_DEF_VAR(ncid, 'zt_sco214', NF90_DOUBLE, & - & time_dimid, zt_sco214_varid) ) - call nccheck( NF90_PUT_ATT(ncid, zt_sco214_varid, 'long_name', & - & 'Total dissolved CO2-C14 tracer') ) - call nccheck( NF90_PUT_ATT(ncid, zt_sco214_varid, 'units', 'kmol') ) - - call nccheck( NF90_DEF_VAR(ncid, 'zc_sco214', NF90_DOUBLE, & - & time_dimid, zc_sco214_varid) ) - call nccheck( NF90_PUT_ATT(ncid, zc_sco214_varid, 'long_name', & - & 'Mean dissolved CO2-C14 concentration') ) - call nccheck( NF90_PUT_ATT(ncid, zc_sco214_varid, 'units', 'kmol/m^3') ) - - call nccheck( NF90_DEF_VAR(ncid, 'zt_doc13', NF90_DOUBLE, & - & time_dimid, zt_doc13_varid) ) - call nccheck( NF90_PUT_ATT(ncid, zt_doc13_varid, 'long_name', & - & 'Total dissolved organic carbon-C13 tracer') ) - call nccheck( NF90_PUT_ATT(ncid, zt_doc13_varid, 'units', 'kmol') ) - - call nccheck( NF90_DEF_VAR(ncid, 'zc_doc13', NF90_DOUBLE, & - & time_dimid, zc_doc13_varid) ) - call nccheck( NF90_PUT_ATT(ncid, zc_doc13_varid, 'long_name', & - & 'Mean dissolved organic carbon-C13 concentration') ) - call nccheck( NF90_PUT_ATT(ncid, zc_doc13_varid, 'units', 'kmol/m^3') ) - - call nccheck( NF90_DEF_VAR(ncid, 'zt_doc14', NF90_DOUBLE, & - & time_dimid, zt_doc14_varid) ) - call nccheck( NF90_PUT_ATT(ncid, zt_doc14_varid, 'long_name', & - & 'Total dissolved organic carbon-C14 tracer') ) - call nccheck( NF90_PUT_ATT(ncid, zt_doc14_varid, 'units', 'kmol') ) - - call nccheck( NF90_DEF_VAR(ncid, 'zc_doc14', NF90_DOUBLE, & - & time_dimid, zc_doc14_varid) ) - call nccheck( NF90_PUT_ATT(ncid, zc_doc14_varid, 'long_name', & - & 'Mean dissolved organic carbon-C14 concentration') ) - call nccheck( NF90_PUT_ATT(ncid, zc_doc14_varid, 'units', 'kmol/m^3') ) - - call nccheck( NF90_DEF_VAR(ncid, 'zt_poc13', NF90_DOUBLE, & - & time_dimid, zt_poc13_varid) ) - call nccheck( NF90_PUT_ATT(ncid, zt_poc13_varid, 'long_name', & - & 'Total particulate organic carbon-C13 tracer') ) - call nccheck( NF90_PUT_ATT(ncid, zt_poc13_varid, 'units', 'kmol') ) - - call nccheck( NF90_DEF_VAR(ncid, 'zc_poc13', NF90_DOUBLE, & - & time_dimid, zc_poc13_varid) ) - call nccheck( NF90_PUT_ATT(ncid, zc_poc13_varid, 'long_name', & - & 'Mean particulate organic carbon-C13 concentration') ) - call nccheck( NF90_PUT_ATT(ncid, zc_poc13_varid, 'units', 'kmol/m^3') ) - - call nccheck( NF90_DEF_VAR(ncid, 'zt_poc14', NF90_DOUBLE, & - & time_dimid, zt_poc14_varid) ) - call nccheck( NF90_PUT_ATT(ncid, zt_poc14_varid, 'long_name', & - & 'Total particulate organic carbon-C14 tracer') ) - call nccheck( NF90_PUT_ATT(ncid, zt_poc14_varid, 'units', 'kmol') ) - - call nccheck( NF90_DEF_VAR(ncid, 'zc_poc14', NF90_DOUBLE, & - & time_dimid, zc_poc14_varid) ) - call nccheck( NF90_PUT_ATT(ncid, zc_poc14_varid, 'long_name', & - & 'Mean particulate organic carbon-C14 concentration') ) - call nccheck( NF90_PUT_ATT(ncid, zc_poc14_varid, 'units', 'kmol/m^3') ) - - call nccheck( NF90_DEF_VAR(ncid, 'zt_phyto13', NF90_DOUBLE, & - & time_dimid, zt_phyto13_varid) ) - call nccheck( NF90_PUT_ATT(ncid, zt_phyto13_varid, 'long_name', & - & 'Total phytoplankton-C13 tracer') ) - call nccheck( NF90_PUT_ATT(ncid, zt_phyto13_varid, 'units', 'kmolP') ) - - call nccheck( NF90_DEF_VAR(ncid, 'zc_phyto13', NF90_DOUBLE, & - & time_dimid, zc_phyto13_varid) ) - call nccheck( NF90_PUT_ATT(ncid, zc_phyto13_varid, 'long_name', & - & 'Mean phytoplankton-C13 concentration') ) - call nccheck( NF90_PUT_ATT(ncid, zc_phyto13_varid, 'units', 'kmolP/m^3') ) - - call nccheck( NF90_DEF_VAR(ncid, 'zt_phyto14', NF90_DOUBLE, & - & time_dimid, zt_phyto14_varid) ) - call nccheck( NF90_PUT_ATT(ncid, zt_phyto14_varid, 'long_name', & - & 'Total phytoplankton-C14 tracer') ) - call nccheck( NF90_PUT_ATT(ncid, zt_phyto14_varid, 'units', 'kmolP') ) - - call nccheck( NF90_DEF_VAR(ncid, 'zc_phyto14', NF90_DOUBLE, & - & time_dimid, zc_phyto14_varid) ) - call nccheck( NF90_PUT_ATT(ncid, zc_phyto14_varid, 'long_name', & - & 'Mean phytoplankton-C14 concentration') ) - call nccheck( NF90_PUT_ATT(ncid, zc_phyto14_varid, 'units', 'kmolP/m^3') ) - - call nccheck( NF90_DEF_VAR(ncid, 'zt_grazer13', NF90_DOUBLE, & - & time_dimid, zt_grazer13_varid) ) - call nccheck( NF90_PUT_ATT(ncid, zt_grazer13_varid, 'long_name', & - & 'Total zooplankton-C13 tracer') ) - call nccheck( NF90_PUT_ATT(ncid, zt_grazer13_varid, 'units', 'kmolP') ) - - call nccheck( NF90_DEF_VAR(ncid, 'zc_grazer13', NF90_DOUBLE, & - & time_dimid, zc_grazer13_varid) ) - call nccheck( NF90_PUT_ATT(ncid, zc_grazer13_varid, 'long_name', & - & 'Mean zooplankton-C13 concentration') ) - call nccheck( NF90_PUT_ATT(ncid, zc_grazer13_varid, 'units', & - & 'kmolP/m^3') ) - - call nccheck( NF90_DEF_VAR(ncid, 'zt_grazer14', NF90_DOUBLE, & - & time_dimid, zt_grazer14_varid) ) - call nccheck( NF90_PUT_ATT(ncid, zt_grazer14_varid, 'long_name', & - & 'Total zooplankton-C14 tracer') ) - call nccheck( NF90_PUT_ATT(ncid, zt_grazer14_varid, 'units', 'kmolP') ) - - call nccheck( NF90_DEF_VAR(ncid, 'zc_grazer14', NF90_DOUBLE, & - & time_dimid, zc_grazer14_varid) ) - call nccheck( NF90_PUT_ATT(ncid, zc_grazer14_varid, 'long_name', & - & 'Mean zooplankton-C14 concentration') ) - call nccheck( NF90_PUT_ATT(ncid, zc_grazer14_varid, 'units', & - & 'kmolP/m^3') ) - - call nccheck( NF90_DEF_VAR(ncid, 'zt_calciu13', NF90_DOUBLE, & - & time_dimid, zt_calciu13_varid) ) - call nccheck( NF90_PUT_ATT(ncid, zt_calciu13_varid, 'long_name', & - & 'Total calcium carbonate-C13 tracer') ) - call nccheck( NF90_PUT_ATT(ncid, zt_calciu13_varid, 'units', 'kmol') ) - - call nccheck( NF90_DEF_VAR(ncid, 'zc_calciu13', NF90_DOUBLE, & - & time_dimid, zc_calciu13_varid) ) - call nccheck( NF90_PUT_ATT(ncid, zc_calciu13_varid, 'long_name', & - & 'Mean calcium carbonate-C13 concentration') ) - call nccheck( NF90_PUT_ATT(ncid, zc_calciu13_varid, 'units', 'kmol/m^3') ) - - call nccheck( NF90_DEF_VAR(ncid, 'zt_calciu14', NF90_DOUBLE, & - & time_dimid, zt_calciu14_varid) ) - call nccheck( NF90_PUT_ATT(ncid, zt_calciu14_varid, 'long_name', & - & 'Total calcium carbonate-C14 tracer') ) - call nccheck( NF90_PUT_ATT(ncid, zt_calciu14_varid, 'units', 'kmol') ) - - call nccheck( NF90_DEF_VAR(ncid, 'zc_calciu14', NF90_DOUBLE, & - & time_dimid, zc_calciu14_varid) ) - call nccheck( NF90_PUT_ATT(ncid, zc_calciu14_varid, 'long_name', & - & 'Mean calcium carbonate-C14 concentration') ) - call nccheck( NF90_PUT_ATT(ncid, zc_calciu14_varid, 'units', 'kmol/m^3') ) -#endif - -#ifdef AGG - call nccheck( NF90_DEF_VAR(ncid, 'zt_snos', NF90_DOUBLE, & - & time_dimid, zt_snos_varid) ) - call nccheck( NF90_PUT_ATT(ncid, zt_snos_varid, 'long_name', & - & 'Total marine snow aggrerates tracer') ) - call nccheck( NF90_PUT_ATT(ncid, zt_snos_varid, 'units', '---') ) ! What is the unit? - - call nccheck( NF90_DEF_VAR(ncid, 'zc_snos', NF90_DOUBLE, & - & time_dimid, zc_snos_varid) ) - call nccheck( NF90_PUT_ATT(ncid, zc_snos_varid, 'long_name', & - & 'Mean marine snow aggregates concentration') ) - call nccheck( NF90_PUT_ATT(ncid, zc_snos_varid, 'units', '---/m^3') ) ! What is the unit? - - call nccheck( NF90_DEF_VAR(ncid, 'zt_adust', NF90_DOUBLE, & - & time_dimid, zt_adust_varid) ) - call nccheck( NF90_PUT_ATT(ncid, zt_adust_varid, 'long_name', & - & 'Total aggregated dust tracer') ) - call nccheck( NF90_PUT_ATT(ncid, zt_adust_varid, 'units', '---') ) ! What is the unit? - - call nccheck( NF90_DEF_VAR(ncid, 'zc_adust', NF90_DOUBLE, & - & time_dimid, zc_adust_varid) ) - call nccheck( NF90_PUT_ATT(ncid, zc_adust_varid, 'long_name', & - & 'Mean aggregated dust concentration') ) - call nccheck( NF90_PUT_ATT(ncid, zc_adust_varid, 'units', '---/m^3') ) ! What is the unit? -#endif - -#ifdef CFC - call nccheck( NF90_DEF_VAR(ncid, 'zt_cfc11', NF90_DOUBLE, & - & time_dimid, zt_cfc11_varid) ) - call nccheck( NF90_PUT_ATT(ncid, zt_cfc11_varid, 'long_name', & - & 'Total CFC-11 tracer') ) - call nccheck( NF90_PUT_ATT(ncid, zt_cfc11_varid, 'units', 'kmol') ) - - call nccheck( NF90_DEF_VAR(ncid, 'zc_cfc11', NF90_DOUBLE, & - & time_dimid, zc_cfc11_varid) ) - call nccheck( NF90_PUT_ATT(ncid, zc_cfc11_varid, 'long_name', & - & 'Mean CFC-11 concentration') ) - call nccheck( NF90_PUT_ATT(ncid, zc_cfc11_varid, 'units', 'kmol/m^3') ) - - call nccheck( NF90_DEF_VAR(ncid, 'zt_cfc12', NF90_DOUBLE, & - & time_dimid, zt_cfc12_varid) ) - call nccheck( NF90_PUT_ATT(ncid, zt_cfc12_varid, 'long_name', & - & 'Total CFC-12 tracer') ) - call nccheck( NF90_PUT_ATT(ncid, zt_cfc12_varid, 'units', 'kmol') ) - - call nccheck( NF90_DEF_VAR(ncid, 'zc_cfc12', NF90_DOUBLE, & - & time_dimid, zc_cfc12_varid) ) - call nccheck( NF90_PUT_ATT(ncid, zc_cfc12_varid, 'long_name', & - & 'Mean CFC-12 concentration') ) - call nccheck( NF90_PUT_ATT(ncid, zc_cfc12_varid, 'units', 'kmol/m^3') ) - - call nccheck( NF90_DEF_VAR(ncid, 'zt_sf6', NF90_DOUBLE, & - & time_dimid, zt_sf6_varid) ) - call nccheck( NF90_PUT_ATT(ncid, zt_sf6_varid, 'long_name', & - & 'Total SF6 tracer') ) - call nccheck( NF90_PUT_ATT(ncid, zt_sf6_varid, 'units', 'kmol') ) - - call nccheck( NF90_DEF_VAR(ncid, 'zc_sf6', NF90_DOUBLE, & - & time_dimid, zc_sf6_varid) ) - call nccheck( NF90_PUT_ATT(ncid, zc_sf6_varid, 'long_name', & - & 'Mean SF6 concentration') ) - call nccheck( NF90_PUT_ATT(ncid, zc_sf6_varid, 'units', 'kmol/m^3') ) -#endif - -#ifdef natDIC - call nccheck( NF90_DEF_VAR(ncid, 'zt_natsco212', NF90_DOUBLE, & - & time_dimid, zt_natsco212_varid) ) - call nccheck( NF90_PUT_ATT(ncid, zt_natsco212_varid, 'long_name', & - & 'Total natural dissolved CO2 tracer') ) - call nccheck( NF90_PUT_ATT(ncid, zt_natsco212_varid, 'units', 'kmol') ) - - call nccheck( NF90_DEF_VAR(ncid, 'zc_natsco212', NF90_DOUBLE, & - & time_dimid, zc_natsco212_varid) ) - call nccheck( NF90_PUT_ATT(ncid, zc_natsco212_varid, 'long_name', & - & 'Mean natural dissolved CO2 concentration') ) - call nccheck( NF90_PUT_ATT(ncid, zc_natsco212_varid, 'units', & - & 'kmol/m^3') ) - - call nccheck( NF90_DEF_VAR(ncid, 'zt_natalkali', NF90_DOUBLE, & - & time_dimid, zt_natalkali_varid) ) - call nccheck( NF90_PUT_ATT(ncid, zt_natalkali_varid, 'long_name', & - & 'Total natural alkalinity tracer') ) - call nccheck( NF90_PUT_ATT(ncid, zt_natalkali_varid, 'units', 'kmol') ) - - call nccheck( NF90_DEF_VAR(ncid, 'zc_natalkali', NF90_DOUBLE, & - & time_dimid, zc_natalkali_varid) ) - call nccheck( NF90_PUT_ATT(ncid, zc_natalkali_varid, 'long_name', & - & 'Mean natural alkalinity concentration') ) - call nccheck( NF90_PUT_ATT(ncid, zc_natalkali_varid, 'units', & - & 'kmol/m^3') ) - - call nccheck( NF90_DEF_VAR(ncid, 'zt_natcalciu', NF90_DOUBLE, & - & time_dimid, zt_natcalciu_varid) ) - call nccheck( NF90_PUT_ATT(ncid, zt_natcalciu_varid, 'long_name', & - & 'Total natural calcium carbonate tracer') ) - call nccheck( NF90_PUT_ATT(ncid, zt_natcalciu_varid, 'units', 'kmol') ) - - call nccheck( NF90_DEF_VAR(ncid, 'zc_natcalciu', NF90_DOUBLE, & - & time_dimid, zc_natcalciu_varid) ) - call nccheck( NF90_PUT_ATT(ncid, zc_natcalciu_varid, 'long_name', & - & 'Mean natural calcium carbonate concentration') ) - call nccheck( NF90_PUT_ATT(ncid, zc_natcalciu_varid, 'units', & - & 'kmol/m^3') ) -#endif - -#ifdef BROMO - call nccheck( NF90_DEF_VAR(ncid, 'zt_bromo', NF90_DOUBLE, & - & time_dimid, zt_bromo_varid) ) - call nccheck( NF90_PUT_ATT(ncid, zt_bromo_varid, 'long_name', & - & 'Total bromoform tracer') ) - call nccheck( NF90_PUT_ATT(ncid, zt_bromo_varid, 'units', 'kmol') ) - - call nccheck( NF90_DEF_VAR(ncid, 'zc_bromo', NF90_DOUBLE, & - & time_dimid, zc_bromo_varid) ) - call nccheck( NF90_PUT_ATT(ncid, zc_bromo_varid, 'long_name', & - & 'Mean bromoform concentration') ) - call nccheck( NF90_PUT_ATT(ncid, zc_bromo_varid, 'units', 'kmol/m^3') ) -#endif + if (use_cisonew) then + call nccheck( NF90_DEF_VAR(ncid, 'zt_sco213', NF90_DOUBLE, & + & time_dimid, zt_sco213_varid) ) + call nccheck( NF90_PUT_ATT(ncid, zt_sco213_varid, 'long_name', & + & 'Total dissolved CO2-C13 tracer') ) + call nccheck( NF90_PUT_ATT(ncid, zt_sco213_varid, 'units', 'kmol') ) + + call nccheck( NF90_DEF_VAR(ncid, 'zc_sco213', NF90_DOUBLE, & + & time_dimid, zc_sco213_varid) ) + call nccheck( NF90_PUT_ATT(ncid, zc_sco213_varid, 'long_name', & + & 'Mean dissolved CO2-C13 concentration') ) + call nccheck( NF90_PUT_ATT(ncid, zc_sco213_varid, 'units', 'kmol/m^3') ) + + call nccheck( NF90_DEF_VAR(ncid, 'zt_sco214', NF90_DOUBLE, & + & time_dimid, zt_sco214_varid) ) + call nccheck( NF90_PUT_ATT(ncid, zt_sco214_varid, 'long_name', & + & 'Total dissolved CO2-C14 tracer') ) + call nccheck( NF90_PUT_ATT(ncid, zt_sco214_varid, 'units', 'kmol') ) + + call nccheck( NF90_DEF_VAR(ncid, 'zc_sco214', NF90_DOUBLE, & + & time_dimid, zc_sco214_varid) ) + call nccheck( NF90_PUT_ATT(ncid, zc_sco214_varid, 'long_name', & + & 'Mean dissolved CO2-C14 concentration') ) + call nccheck( NF90_PUT_ATT(ncid, zc_sco214_varid, 'units', 'kmol/m^3') ) + + call nccheck( NF90_DEF_VAR(ncid, 'zt_doc13', NF90_DOUBLE, & + & time_dimid, zt_doc13_varid) ) + call nccheck( NF90_PUT_ATT(ncid, zt_doc13_varid, 'long_name', & + & 'Total dissolved organic carbon-C13 tracer') ) + call nccheck( NF90_PUT_ATT(ncid, zt_doc13_varid, 'units', 'kmol') ) + + call nccheck( NF90_DEF_VAR(ncid, 'zc_doc13', NF90_DOUBLE, & + & time_dimid, zc_doc13_varid) ) + call nccheck( NF90_PUT_ATT(ncid, zc_doc13_varid, 'long_name', & + & 'Mean dissolved organic carbon-C13 concentration') ) + call nccheck( NF90_PUT_ATT(ncid, zc_doc13_varid, 'units', 'kmol/m^3') ) + + call nccheck( NF90_DEF_VAR(ncid, 'zt_doc14', NF90_DOUBLE, & + & time_dimid, zt_doc14_varid) ) + call nccheck( NF90_PUT_ATT(ncid, zt_doc14_varid, 'long_name', & + & 'Total dissolved organic carbon-C14 tracer') ) + call nccheck( NF90_PUT_ATT(ncid, zt_doc14_varid, 'units', 'kmol') ) + + call nccheck( NF90_DEF_VAR(ncid, 'zc_doc14', NF90_DOUBLE, & + & time_dimid, zc_doc14_varid) ) + call nccheck( NF90_PUT_ATT(ncid, zc_doc14_varid, 'long_name', & + & 'Mean dissolved organic carbon-C14 concentration') ) + call nccheck( NF90_PUT_ATT(ncid, zc_doc14_varid, 'units', 'kmol/m^3') ) + + call nccheck( NF90_DEF_VAR(ncid, 'zt_poc13', NF90_DOUBLE, & + & time_dimid, zt_poc13_varid) ) + call nccheck( NF90_PUT_ATT(ncid, zt_poc13_varid, 'long_name', & + & 'Total particulate organic carbon-C13 tracer') ) + call nccheck( NF90_PUT_ATT(ncid, zt_poc13_varid, 'units', 'kmol') ) + + call nccheck( NF90_DEF_VAR(ncid, 'zc_poc13', NF90_DOUBLE, & + & time_dimid, zc_poc13_varid) ) + call nccheck( NF90_PUT_ATT(ncid, zc_poc13_varid, 'long_name', & + & 'Mean particulate organic carbon-C13 concentration') ) + call nccheck( NF90_PUT_ATT(ncid, zc_poc13_varid, 'units', 'kmol/m^3') ) + + call nccheck( NF90_DEF_VAR(ncid, 'zt_poc14', NF90_DOUBLE, & + & time_dimid, zt_poc14_varid) ) + call nccheck( NF90_PUT_ATT(ncid, zt_poc14_varid, 'long_name', & + & 'Total particulate organic carbon-C14 tracer') ) + call nccheck( NF90_PUT_ATT(ncid, zt_poc14_varid, 'units', 'kmol') ) + + call nccheck( NF90_DEF_VAR(ncid, 'zc_poc14', NF90_DOUBLE, & + & time_dimid, zc_poc14_varid) ) + call nccheck( NF90_PUT_ATT(ncid, zc_poc14_varid, 'long_name', & + & 'Mean particulate organic carbon-C14 concentration') ) + call nccheck( NF90_PUT_ATT(ncid, zc_poc14_varid, 'units', 'kmol/m^3') ) + + call nccheck( NF90_DEF_VAR(ncid, 'zt_phyto13', NF90_DOUBLE, & + & time_dimid, zt_phyto13_varid) ) + call nccheck( NF90_PUT_ATT(ncid, zt_phyto13_varid, 'long_name', & + & 'Total phytoplankton-C13 tracer') ) + call nccheck( NF90_PUT_ATT(ncid, zt_phyto13_varid, 'units', 'kmolP') ) + + call nccheck( NF90_DEF_VAR(ncid, 'zc_phyto13', NF90_DOUBLE, & + & time_dimid, zc_phyto13_varid) ) + call nccheck( NF90_PUT_ATT(ncid, zc_phyto13_varid, 'long_name', & + & 'Mean phytoplankton-C13 concentration') ) + call nccheck( NF90_PUT_ATT(ncid, zc_phyto13_varid, 'units', 'kmolP/m^3') ) + + call nccheck( NF90_DEF_VAR(ncid, 'zt_phyto14', NF90_DOUBLE, & + & time_dimid, zt_phyto14_varid) ) + call nccheck( NF90_PUT_ATT(ncid, zt_phyto14_varid, 'long_name', & + & 'Total phytoplankton-C14 tracer') ) + call nccheck( NF90_PUT_ATT(ncid, zt_phyto14_varid, 'units', 'kmolP') ) + + call nccheck( NF90_DEF_VAR(ncid, 'zc_phyto14', NF90_DOUBLE, & + & time_dimid, zc_phyto14_varid) ) + call nccheck( NF90_PUT_ATT(ncid, zc_phyto14_varid, 'long_name', & + & 'Mean phytoplankton-C14 concentration') ) + call nccheck( NF90_PUT_ATT(ncid, zc_phyto14_varid, 'units', 'kmolP/m^3') ) + + call nccheck( NF90_DEF_VAR(ncid, 'zt_grazer13', NF90_DOUBLE, & + & time_dimid, zt_grazer13_varid) ) + call nccheck( NF90_PUT_ATT(ncid, zt_grazer13_varid, 'long_name', & + & 'Total zooplankton-C13 tracer') ) + call nccheck( NF90_PUT_ATT(ncid, zt_grazer13_varid, 'units', 'kmolP') ) + + call nccheck( NF90_DEF_VAR(ncid, 'zc_grazer13', NF90_DOUBLE, & + & time_dimid, zc_grazer13_varid) ) + call nccheck( NF90_PUT_ATT(ncid, zc_grazer13_varid, 'long_name', & + & 'Mean zooplankton-C13 concentration') ) + call nccheck( NF90_PUT_ATT(ncid, zc_grazer13_varid, 'units', & + & 'kmolP/m^3') ) + + call nccheck( NF90_DEF_VAR(ncid, 'zt_grazer14', NF90_DOUBLE, & + & time_dimid, zt_grazer14_varid) ) + call nccheck( NF90_PUT_ATT(ncid, zt_grazer14_varid, 'long_name', & + & 'Total zooplankton-C14 tracer') ) + call nccheck( NF90_PUT_ATT(ncid, zt_grazer14_varid, 'units', 'kmolP') ) + + call nccheck( NF90_DEF_VAR(ncid, 'zc_grazer14', NF90_DOUBLE, & + & time_dimid, zc_grazer14_varid) ) + call nccheck( NF90_PUT_ATT(ncid, zc_grazer14_varid, 'long_name', & + & 'Mean zooplankton-C14 concentration') ) + call nccheck( NF90_PUT_ATT(ncid, zc_grazer14_varid, 'units', & + & 'kmolP/m^3') ) + + call nccheck( NF90_DEF_VAR(ncid, 'zt_calciu13', NF90_DOUBLE, & + & time_dimid, zt_calciu13_varid) ) + call nccheck( NF90_PUT_ATT(ncid, zt_calciu13_varid, 'long_name', & + & 'Total calcium carbonate-C13 tracer') ) + call nccheck( NF90_PUT_ATT(ncid, zt_calciu13_varid, 'units', 'kmol') ) + + call nccheck( NF90_DEF_VAR(ncid, 'zc_calciu13', NF90_DOUBLE, & + & time_dimid, zc_calciu13_varid) ) + call nccheck( NF90_PUT_ATT(ncid, zc_calciu13_varid, 'long_name', & + & 'Mean calcium carbonate-C13 concentration') ) + call nccheck( NF90_PUT_ATT(ncid, zc_calciu13_varid, 'units', 'kmol/m^3') ) + + call nccheck( NF90_DEF_VAR(ncid, 'zt_calciu14', NF90_DOUBLE, & + & time_dimid, zt_calciu14_varid) ) + call nccheck( NF90_PUT_ATT(ncid, zt_calciu14_varid, 'long_name', & + & 'Total calcium carbonate-C14 tracer') ) + call nccheck( NF90_PUT_ATT(ncid, zt_calciu14_varid, 'units', 'kmol') ) + + call nccheck( NF90_DEF_VAR(ncid, 'zc_calciu14', NF90_DOUBLE, & + & time_dimid, zc_calciu14_varid) ) + call nccheck( NF90_PUT_ATT(ncid, zc_calciu14_varid, 'long_name', & + & 'Mean calcium carbonate-C14 concentration') ) + call nccheck( NF90_PUT_ATT(ncid, zc_calciu14_varid, 'units', 'kmol/m^3') ) + end if + + if (use_AGG) then + call nccheck( NF90_DEF_VAR(ncid, 'zt_snos', NF90_DOUBLE, & + & time_dimid, zt_snos_varid) ) + call nccheck( NF90_PUT_ATT(ncid, zt_snos_varid, 'long_name', & + & 'Total marine snow aggrerates tracer') ) + call nccheck( NF90_PUT_ATT(ncid, zt_snos_varid, 'units', '---') ) ! What is the unit? + + call nccheck( NF90_DEF_VAR(ncid, 'zc_snos', NF90_DOUBLE, & + & time_dimid, zc_snos_varid) ) + call nccheck( NF90_PUT_ATT(ncid, zc_snos_varid, 'long_name', & + & 'Mean marine snow aggregates concentration') ) + call nccheck( NF90_PUT_ATT(ncid, zc_snos_varid, 'units', '---/m^3') ) ! What is the unit? + + call nccheck( NF90_DEF_VAR(ncid, 'zt_adust', NF90_DOUBLE, & + & time_dimid, zt_adust_varid) ) + call nccheck( NF90_PUT_ATT(ncid, zt_adust_varid, 'long_name', & + & 'Total aggregated dust tracer') ) + call nccheck( NF90_PUT_ATT(ncid, zt_adust_varid, 'units', '---') ) ! What is the unit? + + call nccheck( NF90_DEF_VAR(ncid, 'zc_adust', NF90_DOUBLE, & + & time_dimid, zc_adust_varid) ) + call nccheck( NF90_PUT_ATT(ncid, zc_adust_varid, 'long_name', & + & 'Mean aggregated dust concentration') ) + call nccheck( NF90_PUT_ATT(ncid, zc_adust_varid, 'units', '---/m^3') ) ! What is the unit? + end if + + if (use_CFC) then + call nccheck( NF90_DEF_VAR(ncid, 'zt_cfc11', NF90_DOUBLE, & + & time_dimid, zt_cfc11_varid) ) + call nccheck( NF90_PUT_ATT(ncid, zt_cfc11_varid, 'long_name', & + & 'Total CFC-11 tracer') ) + call nccheck( NF90_PUT_ATT(ncid, zt_cfc11_varid, 'units', 'kmol') ) + + call nccheck( NF90_DEF_VAR(ncid, 'zc_cfc11', NF90_DOUBLE, & + & time_dimid, zc_cfc11_varid) ) + call nccheck( NF90_PUT_ATT(ncid, zc_cfc11_varid, 'long_name', & + & 'Mean CFC-11 concentration') ) + call nccheck( NF90_PUT_ATT(ncid, zc_cfc11_varid, 'units', 'kmol/m^3') ) + + call nccheck( NF90_DEF_VAR(ncid, 'zt_cfc12', NF90_DOUBLE, & + & time_dimid, zt_cfc12_varid) ) + call nccheck( NF90_PUT_ATT(ncid, zt_cfc12_varid, 'long_name', & + & 'Total CFC-12 tracer') ) + call nccheck( NF90_PUT_ATT(ncid, zt_cfc12_varid, 'units', 'kmol') ) + + call nccheck( NF90_DEF_VAR(ncid, 'zc_cfc12', NF90_DOUBLE, & + & time_dimid, zc_cfc12_varid) ) + call nccheck( NF90_PUT_ATT(ncid, zc_cfc12_varid, 'long_name', & + & 'Mean CFC-12 concentration') ) + call nccheck( NF90_PUT_ATT(ncid, zc_cfc12_varid, 'units', 'kmol/m^3') ) + + call nccheck( NF90_DEF_VAR(ncid, 'zt_sf6', NF90_DOUBLE, & + & time_dimid, zt_sf6_varid) ) + call nccheck( NF90_PUT_ATT(ncid, zt_sf6_varid, 'long_name', & + & 'Total SF6 tracer') ) + call nccheck( NF90_PUT_ATT(ncid, zt_sf6_varid, 'units', 'kmol') ) + + call nccheck( NF90_DEF_VAR(ncid, 'zc_sf6', NF90_DOUBLE, & + & time_dimid, zc_sf6_varid) ) + call nccheck( NF90_PUT_ATT(ncid, zc_sf6_varid, 'long_name', & + & 'Mean SF6 concentration') ) + call nccheck( NF90_PUT_ATT(ncid, zc_sf6_varid, 'units', 'kmol/m^3') ) + end if + + if (use_natDIC) then + call nccheck( NF90_DEF_VAR(ncid, 'zt_natsco212', NF90_DOUBLE, & + & time_dimid, zt_natsco212_varid) ) + call nccheck( NF90_PUT_ATT(ncid, zt_natsco212_varid, 'long_name', & + & 'Total natural dissolved CO2 tracer') ) + call nccheck( NF90_PUT_ATT(ncid, zt_natsco212_varid, 'units', 'kmol') ) + + call nccheck( NF90_DEF_VAR(ncid, 'zc_natsco212', NF90_DOUBLE, & + & time_dimid, zc_natsco212_varid) ) + call nccheck( NF90_PUT_ATT(ncid, zc_natsco212_varid, 'long_name', & + & 'Mean natural dissolved CO2 concentration') ) + call nccheck( NF90_PUT_ATT(ncid, zc_natsco212_varid, 'units', & + & 'kmol/m^3') ) + + call nccheck( NF90_DEF_VAR(ncid, 'zt_natalkali', NF90_DOUBLE, & + & time_dimid, zt_natalkali_varid) ) + call nccheck( NF90_PUT_ATT(ncid, zt_natalkali_varid, 'long_name', & + & 'Total natural alkalinity tracer') ) + call nccheck( NF90_PUT_ATT(ncid, zt_natalkali_varid, 'units', 'kmol') ) + + call nccheck( NF90_DEF_VAR(ncid, 'zc_natalkali', NF90_DOUBLE, & + & time_dimid, zc_natalkali_varid) ) + call nccheck( NF90_PUT_ATT(ncid, zc_natalkali_varid, 'long_name', & + & 'Mean natural alkalinity concentration') ) + call nccheck( NF90_PUT_ATT(ncid, zc_natalkali_varid, 'units', & + & 'kmol/m^3') ) + + call nccheck( NF90_DEF_VAR(ncid, 'zt_natcalciu', NF90_DOUBLE, & + & time_dimid, zt_natcalciu_varid) ) + call nccheck( NF90_PUT_ATT(ncid, zt_natcalciu_varid, 'long_name', & + & 'Total natural calcium carbonate tracer') ) + call nccheck( NF90_PUT_ATT(ncid, zt_natcalciu_varid, 'units', 'kmol') ) + + call nccheck( NF90_DEF_VAR(ncid, 'zc_natcalciu', NF90_DOUBLE, & + & time_dimid, zc_natcalciu_varid) ) + call nccheck( NF90_PUT_ATT(ncid, zc_natcalciu_varid, 'long_name', & + & 'Mean natural calcium carbonate concentration') ) + call nccheck( NF90_PUT_ATT(ncid, zc_natcalciu_varid, 'units', & + & 'kmol/m^3') ) + end if + + if (use_BROMO) then + call nccheck( NF90_DEF_VAR(ncid, 'zt_bromo', NF90_DOUBLE, & + & time_dimid, zt_bromo_varid) ) + call nccheck( NF90_PUT_ATT(ncid, zt_bromo_varid, 'long_name', & + & 'Total bromoform tracer') ) + call nccheck( NF90_PUT_ATT(ncid, zt_bromo_varid, 'units', 'kmol') ) + + call nccheck( NF90_DEF_VAR(ncid, 'zc_bromo', NF90_DOUBLE, & + & time_dimid, zc_bromo_varid) ) + call nccheck( NF90_PUT_ATT(ncid, zc_bromo_varid, 'long_name', & + & 'Mean bromoform concentration') ) + call nccheck( NF90_PUT_ATT(ncid, zc_bromo_varid, 'units', 'kmol/m^3') ) + end if !--- Define variables : sum of inventory call nccheck( NF90_DEF_VAR(ncid, 'totcarb', NF90_DOUBLE, time_dimid, & @@ -1492,22 +1516,24 @@ subroutine write_netcdf(iogrp) call nccheck( NF90_OPEN(trim(fname_inv(iogrp)), NF90_WRITE, ncid) ) !--- Inquire dimid call nccheck( NF90_INQ_DIMID(ncid, "time", time_dimid) ) -#ifndef sedbypass - call nccheck( NF90_INQ_DIMID(ncid, 'npowtra', npowtra_dimid) ) - call nccheck( NF90_INQ_DIMID(ncid, 'nsedtra', nsedtra_dimid) ) -#endif + if (.not. use_sedbypass) then + call nccheck( NF90_INQ_DIMID(ncid, 'npowtra', npowtra_dimid) ) + call nccheck( NF90_INQ_DIMID(ncid, 'nsedtra', nsedtra_dimid) ) + end if !--- Inquire varid : time call nccheck( NF90_INQ_VARID(ncid, "time", time_varid) ) -#ifndef sedbypass - !--- aqueous sediment tracers - call nccheck( NF90_INQ_VARID(ncid, 'zsedtotvol', zsedtotvol_varid) ) - call nccheck( NF90_INQ_VARID(ncid, 'zpowtratot', zpowtratot_varid) ) - call nccheck( NF90_INQ_VARID(ncid, 'zpowtratoc', zpowtratoc_varid) ) - !--- non-aqueous sediment tracers - call nccheck( NF90_INQ_VARID(ncid, 'zsedlayto', zsedlayto_varid) ) - call nccheck( NF90_INQ_VARID(ncid, 'zburial', zburial_varid) ) - call nccheck( NF90_INQ_VARID(ncid, 'zsedhplto', zsedhplto_varid) ) -#endif + + if (.not. use_sedbypass) then + !--- aqueous sediment tracers + call nccheck( NF90_INQ_VARID(ncid, 'zsedtotvol', zsedtotvol_varid) ) + call nccheck( NF90_INQ_VARID(ncid, 'zpowtratot', zpowtratot_varid) ) + call nccheck( NF90_INQ_VARID(ncid, 'zpowtratoc', zpowtratoc_varid) ) + !--- non-aqueous sediment tracers + call nccheck( NF90_INQ_VARID(ncid, 'zsedlayto', zsedlayto_varid) ) + call nccheck( NF90_INQ_VARID(ncid, 'zburial', zburial_varid) ) + call nccheck( NF90_INQ_VARID(ncid, 'zsedhplto', zsedhplto_varid) ) + end if + !--- Inquire varid : ocean tracers call nccheck( NF90_INQ_VARID(ncid, "ztotvol", ztotvol_varid) ) call nccheck( NF90_INQ_VARID(ncid, "zt_sco212", zt_sco212_varid) ) @@ -1554,58 +1580,58 @@ subroutine write_netcdf(iogrp) call nccheck( NF90_INQ_VARID(ncid, "zc_prefdic", zc_prefdic_varid) ) call nccheck( NF90_INQ_VARID(ncid, "zt_dicsat", zt_dicsat_varid) ) call nccheck( NF90_INQ_VARID(ncid, "zc_dicsat", zc_dicsat_varid) ) -#ifdef cisonew - call nccheck( NF90_INQ_VARID(ncid, "zt_sco213", zt_sco213_varid) ) - call nccheck( NF90_INQ_VARID(ncid, "zc_sco213", zc_sco213_varid) ) - call nccheck( NF90_INQ_VARID(ncid, "zt_sco214", zt_sco214_varid) ) - call nccheck( NF90_INQ_VARID(ncid, "zc_sco214", zc_sco214_varid) ) - call nccheck( NF90_INQ_VARID(ncid, "zt_doc13", zt_doc13_varid) ) - call nccheck( NF90_INQ_VARID(ncid, "zc_doc13", zc_doc13_varid) ) - call nccheck( NF90_INQ_VARID(ncid, "zt_doc14", zt_doc14_varid) ) - call nccheck( NF90_INQ_VARID(ncid, "zc_doc14", zc_doc14_varid) ) - call nccheck( NF90_INQ_VARID(ncid, "zt_poc13", zt_poc13_varid) ) - call nccheck( NF90_INQ_VARID(ncid, "zc_poc13", zc_poc13_varid) ) - call nccheck( NF90_INQ_VARID(ncid, "zt_poc14", zt_poc14_varid) ) - call nccheck( NF90_INQ_VARID(ncid, "zc_poc14", zc_poc14_varid) ) - call nccheck( NF90_INQ_VARID(ncid, "zt_phyto13", zt_phyto13_varid) ) - call nccheck( NF90_INQ_VARID(ncid, "zc_phyto13", zc_phyto13_varid) ) - call nccheck( NF90_INQ_VARID(ncid, "zt_phyto14", zt_phyto14_varid) ) - call nccheck( NF90_INQ_VARID(ncid, "zc_phyto14", zc_phyto14_varid) ) - call nccheck( NF90_INQ_VARID(ncid, "zt_grazer13", zt_grazer13_varid) ) - call nccheck( NF90_INQ_VARID(ncid, "zc_grazer13", zc_grazer13_varid) ) - call nccheck( NF90_INQ_VARID(ncid, "zt_grazer14", zt_grazer14_varid) ) - call nccheck( NF90_INQ_VARID(ncid, "zc_grazer14", zc_grazer14_varid) ) - call nccheck( NF90_INQ_VARID(ncid, "zt_calciu13", zt_calciu13_varid) ) - call nccheck( NF90_INQ_VARID(ncid, "zc_calciu13", zc_calciu13_varid) ) - call nccheck( NF90_INQ_VARID(ncid, "zt_calciu14", zt_calciu14_varid) ) - call nccheck( NF90_INQ_VARID(ncid, "zc_calciu14", zc_calciu14_varid) ) -#endif -#ifdef AGG - call nccheck( NF90_INQ_VARID(ncid, "zt_snos", zt_snos_varid) ) - call nccheck( NF90_INQ_VARID(ncid, "zc_snos", zc_snos_varid) ) - call nccheck( NF90_INQ_VARID(ncid, "zt_adust", zt_adust_varid) ) - call nccheck( NF90_INQ_VARID(ncid, "zc_adust", zc_adust_varid) ) -#endif -#ifdef CFC - call nccheck( NF90_INQ_VARID(ncid, "zt_cfc11", zt_cfc11_varid) ) - call nccheck( NF90_INQ_VARID(ncid, "zc_cfc11", zc_cfc11_varid) ) - call nccheck( NF90_INQ_VARID(ncid, "zt_cfc12", zt_cfc12_varid) ) - call nccheck( NF90_INQ_VARID(ncid, "zc_cfc12", zc_cfc12_varid) ) - call nccheck( NF90_INQ_VARID(ncid, "zt_sf6", zt_sf6_varid) ) - call nccheck( NF90_INQ_VARID(ncid, "zc_sf6", zc_sf6_varid) ) -#endif -#ifdef natDIC - call nccheck( NF90_INQ_VARID(ncid, "zt_natsco212", zt_natsco212_varid) ) - call nccheck( NF90_INQ_VARID(ncid, "zc_natsco212", zc_natsco212_varid) ) - call nccheck( NF90_INQ_VARID(ncid, "zt_natalkali", zt_natalkali_varid) ) - call nccheck( NF90_INQ_VARID(ncid, "zc_natalkali", zc_natalkali_varid) ) - call nccheck( NF90_INQ_VARID(ncid, "zt_natcalciu", zt_natcalciu_varid) ) - call nccheck( NF90_INQ_VARID(ncid, "zc_natcalciu", zc_natcalciu_varid) ) -#endif -#ifdef BROMO - call nccheck( NF90_INQ_VARID(ncid, "zt_bromo", zt_bromo_varid) ) - call nccheck( NF90_INQ_VARID(ncid, "zc_bromo", zc_bromo_varid) ) -#endif + if (use_cisonew) then + call nccheck( NF90_INQ_VARID(ncid, "zt_sco213", zt_sco213_varid) ) + call nccheck( NF90_INQ_VARID(ncid, "zc_sco213", zc_sco213_varid) ) + call nccheck( NF90_INQ_VARID(ncid, "zt_sco214", zt_sco214_varid) ) + call nccheck( NF90_INQ_VARID(ncid, "zc_sco214", zc_sco214_varid) ) + call nccheck( NF90_INQ_VARID(ncid, "zt_doc13", zt_doc13_varid) ) + call nccheck( NF90_INQ_VARID(ncid, "zc_doc13", zc_doc13_varid) ) + call nccheck( NF90_INQ_VARID(ncid, "zt_doc14", zt_doc14_varid) ) + call nccheck( NF90_INQ_VARID(ncid, "zc_doc14", zc_doc14_varid) ) + call nccheck( NF90_INQ_VARID(ncid, "zt_poc13", zt_poc13_varid) ) + call nccheck( NF90_INQ_VARID(ncid, "zc_poc13", zc_poc13_varid) ) + call nccheck( NF90_INQ_VARID(ncid, "zt_poc14", zt_poc14_varid) ) + call nccheck( NF90_INQ_VARID(ncid, "zc_poc14", zc_poc14_varid) ) + call nccheck( NF90_INQ_VARID(ncid, "zt_phyto13", zt_phyto13_varid) ) + call nccheck( NF90_INQ_VARID(ncid, "zc_phyto13", zc_phyto13_varid) ) + call nccheck( NF90_INQ_VARID(ncid, "zt_phyto14", zt_phyto14_varid) ) + call nccheck( NF90_INQ_VARID(ncid, "zc_phyto14", zc_phyto14_varid) ) + call nccheck( NF90_INQ_VARID(ncid, "zt_grazer13", zt_grazer13_varid) ) + call nccheck( NF90_INQ_VARID(ncid, "zc_grazer13", zc_grazer13_varid) ) + call nccheck( NF90_INQ_VARID(ncid, "zt_grazer14", zt_grazer14_varid) ) + call nccheck( NF90_INQ_VARID(ncid, "zc_grazer14", zc_grazer14_varid) ) + call nccheck( NF90_INQ_VARID(ncid, "zt_calciu13", zt_calciu13_varid) ) + call nccheck( NF90_INQ_VARID(ncid, "zc_calciu13", zc_calciu13_varid) ) + call nccheck( NF90_INQ_VARID(ncid, "zt_calciu14", zt_calciu14_varid) ) + call nccheck( NF90_INQ_VARID(ncid, "zc_calciu14", zc_calciu14_varid) ) + end if + if (use_AGG) then + call nccheck( NF90_INQ_VARID(ncid, "zt_snos", zt_snos_varid) ) + call nccheck( NF90_INQ_VARID(ncid, "zc_snos", zc_snos_varid) ) + call nccheck( NF90_INQ_VARID(ncid, "zt_adust", zt_adust_varid) ) + call nccheck( NF90_INQ_VARID(ncid, "zc_adust", zc_adust_varid) ) + end if + if (use_CFC) then + call nccheck( NF90_INQ_VARID(ncid, "zt_cfc11", zt_cfc11_varid) ) + call nccheck( NF90_INQ_VARID(ncid, "zc_cfc11", zc_cfc11_varid) ) + call nccheck( NF90_INQ_VARID(ncid, "zt_cfc12", zt_cfc12_varid) ) + call nccheck( NF90_INQ_VARID(ncid, "zc_cfc12", zc_cfc12_varid) ) + call nccheck( NF90_INQ_VARID(ncid, "zt_sf6", zt_sf6_varid) ) + call nccheck( NF90_INQ_VARID(ncid, "zc_sf6", zc_sf6_varid) ) + end if + if (use_natDIC) then + call nccheck( NF90_INQ_VARID(ncid, "zt_natsco212", zt_natsco212_varid) ) + call nccheck( NF90_INQ_VARID(ncid, "zc_natsco212", zc_natsco212_varid) ) + call nccheck( NF90_INQ_VARID(ncid, "zt_natalkali", zt_natalkali_varid) ) + call nccheck( NF90_INQ_VARID(ncid, "zc_natalkali", zc_natalkali_varid) ) + call nccheck( NF90_INQ_VARID(ncid, "zt_natcalciu", zt_natcalciu_varid) ) + call nccheck( NF90_INQ_VARID(ncid, "zc_natcalciu", zc_natcalciu_varid) ) + end if + if (use_BROMO) then + call nccheck( NF90_INQ_VARID(ncid, "zt_bromo", zt_bromo_varid) ) + call nccheck( NF90_INQ_VARID(ncid, "zc_bromo", zc_bromo_varid) ) + end if !--- Inquire varid : sum of inventory call nccheck( NF90_INQ_VARID(ncid, "totcarb", totcarb_varid) ) call nccheck( NF90_INQ_VARID(ncid, "totphos", totphos_varid) ) @@ -1624,33 +1650,33 @@ subroutine write_netcdf(iogrp) !=== Increment record by 1, reset start and count arrays ncrec(iogrp) = ncrec(iogrp) + 1 wrstart = (/ ncrec(iogrp) /) -#ifndef sedbypass - zpowtra_wrstart = (/ 1, ncrec(iogrp) /) - zpowtra_count = (/ npowtra, 1 /) - zsedtra_wrstart = (/ 1, ncrec(iogrp) /) - zsedtra_count = (/ nsedtra, 1 /) -#endif + if (.not. use_sedbypass) then + zpowtra_wrstart = (/ 1, ncrec(iogrp) /) + zpowtra_count = (/ npowtra, 1 /) + zsedtra_wrstart = (/ 1, ncrec(iogrp) /) + zsedtra_count = (/ nsedtra, 1 /) + end if !=== Write output data to netCDF file !--- Write data : time datenum = time - time0 call nccheck( NF90_PUT_VAR(ncid, time_varid, datenum, start = wrstart) ) -#ifndef sedbypass - !--- aqueous sediment tracers - call nccheck( NF90_PUT_VAR(ncid, zsedtotvol_varid, zsedtotvol, & - & start = wrstart) ) - call nccheck( NF90_PUT_VAR(ncid, zpowtratot_varid, zpowtratot, & - & start = zpowtra_wrstart, count = zpowtra_count) ) - call nccheck( NF90_PUT_VAR(ncid, zpowtratoc_varid, zpowtratoc, & - & start = zpowtra_wrstart, count = zpowtra_count) ) - !--- non-aqueous sediment tracers - call nccheck( NF90_PUT_VAR(ncid, zsedlayto_varid, zsedlayto, & - & start = zsedtra_wrstart, count = zsedtra_count) ) - call nccheck( NF90_PUT_VAR(ncid, zburial_varid, zburial, & - & start = zsedtra_wrstart, count = zsedtra_count) ) - call nccheck( NF90_PUT_VAR(ncid, zsedhplto_varid, zsedhplto, & - & start = wrstart) ) -#endif + if (.not. use_sedbypass) then + !--- aqueous sediment tracers + call nccheck( NF90_PUT_VAR(ncid, zsedtotvol_varid, zsedtotvol, & + & start = wrstart) ) + call nccheck( NF90_PUT_VAR(ncid, zpowtratot_varid, zpowtratot, & + & start = zpowtra_wrstart, count = zpowtra_count) ) + call nccheck( NF90_PUT_VAR(ncid, zpowtratoc_varid, zpowtratoc, & + & start = zpowtra_wrstart, count = zpowtra_count) ) + !--- non-aqueous sediment tracers + call nccheck( NF90_PUT_VAR(ncid, zsedlayto_varid, zsedlayto, & + & start = zsedtra_wrstart, count = zsedtra_count) ) + call nccheck( NF90_PUT_VAR(ncid, zburial_varid, zburial, & + & start = zsedtra_wrstart, count = zsedtra_count) ) + call nccheck( NF90_PUT_VAR(ncid, zsedhplto_varid, zsedhplto, & + & start = wrstart) ) + end if !--- Write data : ocean tracers call nccheck( NF90_PUT_VAR(ncid, ztotvol_varid, ztotvol, start = wrstart) ) call nccheck( NF90_PUT_VAR(ncid, zt_sco212_varid, & @@ -1741,100 +1767,100 @@ subroutine write_netcdf(iogrp) & zocetratot(idicsat), start = wrstart) ) call nccheck( NF90_PUT_VAR(ncid, zc_dicsat_varid, & & zocetratoc(idicsat), start = wrstart) ) -#ifdef cisonew - call nccheck( NF90_PUT_VAR(ncid, zt_sco213_varid, & - & zocetratot(isco213), start = wrstart) ) - call nccheck( NF90_PUT_VAR(ncid, zc_sco213_varid, & - & zocetratoc(isco213), start = wrstart) ) - call nccheck( NF90_PUT_VAR(ncid, zt_sco214_varid, & - & zocetratot(isco214), start = wrstart) ) - call nccheck( NF90_PUT_VAR(ncid, zc_sco214_varid, & - & zocetratoc(isco214), start = wrstart) ) - call nccheck( NF90_PUT_VAR(ncid, zt_doc13_varid, & - & zocetratot(idoc13), start = wrstart) ) - call nccheck( NF90_PUT_VAR(ncid, zc_doc13_varid, & - & zocetratoc(idoc13), start = wrstart) ) - call nccheck( NF90_PUT_VAR(ncid, zt_doc14_varid, & - & zocetratot(idoc14), start = wrstart) ) - call nccheck( NF90_PUT_VAR(ncid, zc_doc14_varid, & - & zocetratoc(idoc14), start = wrstart) ) - call nccheck( NF90_PUT_VAR(ncid, zt_poc13_varid, & - & zocetratot(idet13), start = wrstart) ) - call nccheck( NF90_PUT_VAR(ncid, zc_poc13_varid, & - & zocetratoc(idet13), start = wrstart) ) - call nccheck( NF90_PUT_VAR(ncid, zt_poc14_varid, & - & zocetratot(idet14), start = wrstart) ) - call nccheck( NF90_PUT_VAR(ncid, zc_poc14_varid, & - & zocetratoc(idet14), start = wrstart) ) - call nccheck( NF90_PUT_VAR(ncid, zt_phyto13_varid, & - & zocetratot(iphy13), start = wrstart) ) - call nccheck( NF90_PUT_VAR(ncid, zc_phyto13_varid, & - & zocetratoc(iphy13), start = wrstart) ) - call nccheck( NF90_PUT_VAR(ncid, zt_phyto14_varid, & - & zocetratot(iphy14), start = wrstart) ) - call nccheck( NF90_PUT_VAR(ncid, zc_phyto14_varid, & - & zocetratoc(iphy14), start = wrstart) ) - call nccheck( NF90_PUT_VAR(ncid, zt_grazer13_varid, & - & zocetratot(izoo13), start = wrstart) ) - call nccheck( NF90_PUT_VAR(ncid, zc_grazer13_varid, & - & zocetratoc(izoo13), start = wrstart) ) - call nccheck( NF90_PUT_VAR(ncid, zt_grazer14_varid, & - & zocetratot(izoo14), start = wrstart) ) - call nccheck( NF90_PUT_VAR(ncid, zc_grazer14_varid, & - & zocetratoc(izoo14), start = wrstart) ) - call nccheck( NF90_PUT_VAR(ncid, zt_calciu13_varid, & - & zocetratot(icalc13), start = wrstart) ) - call nccheck( NF90_PUT_VAR(ncid, zc_calciu13_varid, & - & zocetratoc(icalc13), start = wrstart) ) - call nccheck( NF90_PUT_VAR(ncid, zt_calciu14_varid, & - & zocetratot(icalc14), start = wrstart) ) - call nccheck( NF90_PUT_VAR(ncid, zc_calciu14_varid, & - & zocetratoc(icalc14), start = wrstart) ) -#endif -#ifdef AGG - call nccheck( NF90_PUT_VAR(ncid, zt_snos_varid, & - & zocetratot(inos), start = wrstart) ) - call nccheck( NF90_PUT_VAR(ncid, zc_snos_varid, & - & zocetratoc(inos), start = wrstart) ) - call nccheck( NF90_PUT_VAR(ncid, zt_adust_varid, & - & zocetratot(iadust), start = wrstart) ) - call nccheck( NF90_PUT_VAR(ncid, zc_adust_varid, & - & zocetratoc(iadust), start = wrstart) ) -#endif -#ifdef CFC - call nccheck( NF90_PUT_VAR(ncid, zt_cfc11_varid, & - & zocetratot(icfc11), start = wrstart) ) - call nccheck( NF90_PUT_VAR(ncid, zc_cfc11_varid, & - & zocetratoc(icfc11), start = wrstart) ) - call nccheck( NF90_PUT_VAR(ncid, zt_cfc12_varid, & - & zocetratot(icfc12), start = wrstart) ) - call nccheck( NF90_PUT_VAR(ncid, zc_cfc12_varid, & - & zocetratoc(icfc12), start = wrstart) ) - call nccheck( NF90_PUT_VAR(ncid, zt_sf6_varid, & - & zocetratot(isf6), start = wrstart) ) - call nccheck( NF90_PUT_VAR(ncid, zc_sf6_varid, & - & zocetratoc(isf6), start = wrstart) ) -#endif -#ifdef natDIC - call nccheck( NF90_PUT_VAR(ncid, zt_natsco212_varid, & - & zocetratot(inatsco212), start = wrstart) ) - call nccheck( NF90_PUT_VAR(ncid, zc_natsco212_varid, & - & zocetratoc(inatsco212), start = wrstart) ) - call nccheck( NF90_PUT_VAR(ncid, zt_natalkali_varid, & - & zocetratot(inatalkali), start = wrstart) ) - call nccheck( NF90_PUT_VAR(ncid, zc_natalkali_varid, & - & zocetratoc(inatalkali), start = wrstart) ) - call nccheck( NF90_PUT_VAR(ncid, zt_natcalciu_varid, & - & zocetratot(inatcalc), start = wrstart) ) - call nccheck( NF90_PUT_VAR(ncid, zc_natcalciu_varid, & - & zocetratoc(inatcalc), start = wrstart) ) -#endif -#ifdef BROMO - call nccheck( NF90_PUT_VAR(ncid, zt_bromo_varid, & - & zocetratot(ibromo), start = wrstart) ) - call nccheck( NF90_PUT_VAR(ncid, zc_bromo_varid, & - & zocetratoc(ibromo), start = wrstart) ) -#endif + if (use_cisonew) then + call nccheck( NF90_PUT_VAR(ncid, zt_sco213_varid, & + & zocetratot(isco213), start = wrstart) ) + call nccheck( NF90_PUT_VAR(ncid, zc_sco213_varid, & + & zocetratoc(isco213), start = wrstart) ) + call nccheck( NF90_PUT_VAR(ncid, zt_sco214_varid, & + & zocetratot(isco214), start = wrstart) ) + call nccheck( NF90_PUT_VAR(ncid, zc_sco214_varid, & + & zocetratoc(isco214), start = wrstart) ) + call nccheck( NF90_PUT_VAR(ncid, zt_doc13_varid, & + & zocetratot(idoc13), start = wrstart) ) + call nccheck( NF90_PUT_VAR(ncid, zc_doc13_varid, & + & zocetratoc(idoc13), start = wrstart) ) + call nccheck( NF90_PUT_VAR(ncid, zt_doc14_varid, & + & zocetratot(idoc14), start = wrstart) ) + call nccheck( NF90_PUT_VAR(ncid, zc_doc14_varid, & + & zocetratoc(idoc14), start = wrstart) ) + call nccheck( NF90_PUT_VAR(ncid, zt_poc13_varid, & + & zocetratot(idet13), start = wrstart) ) + call nccheck( NF90_PUT_VAR(ncid, zc_poc13_varid, & + & zocetratoc(idet13), start = wrstart) ) + call nccheck( NF90_PUT_VAR(ncid, zt_poc14_varid, & + & zocetratot(idet14), start = wrstart) ) + call nccheck( NF90_PUT_VAR(ncid, zc_poc14_varid, & + & zocetratoc(idet14), start = wrstart) ) + call nccheck( NF90_PUT_VAR(ncid, zt_phyto13_varid, & + & zocetratot(iphy13), start = wrstart) ) + call nccheck( NF90_PUT_VAR(ncid, zc_phyto13_varid, & + & zocetratoc(iphy13), start = wrstart) ) + call nccheck( NF90_PUT_VAR(ncid, zt_phyto14_varid, & + & zocetratot(iphy14), start = wrstart) ) + call nccheck( NF90_PUT_VAR(ncid, zc_phyto14_varid, & + & zocetratoc(iphy14), start = wrstart) ) + call nccheck( NF90_PUT_VAR(ncid, zt_grazer13_varid, & + & zocetratot(izoo13), start = wrstart) ) + call nccheck( NF90_PUT_VAR(ncid, zc_grazer13_varid, & + & zocetratoc(izoo13), start = wrstart) ) + call nccheck( NF90_PUT_VAR(ncid, zt_grazer14_varid, & + & zocetratot(izoo14), start = wrstart) ) + call nccheck( NF90_PUT_VAR(ncid, zc_grazer14_varid, & + & zocetratoc(izoo14), start = wrstart) ) + call nccheck( NF90_PUT_VAR(ncid, zt_calciu13_varid, & + & zocetratot(icalc13), start = wrstart) ) + call nccheck( NF90_PUT_VAR(ncid, zc_calciu13_varid, & + & zocetratoc(icalc13), start = wrstart) ) + call nccheck( NF90_PUT_VAR(ncid, zt_calciu14_varid, & + & zocetratot(icalc14), start = wrstart) ) + call nccheck( NF90_PUT_VAR(ncid, zc_calciu14_varid, & + & zocetratoc(icalc14), start = wrstart) ) + end if + if (use_AGG) then + call nccheck( NF90_PUT_VAR(ncid, zt_snos_varid, & + & zocetratot(inos), start = wrstart) ) + call nccheck( NF90_PUT_VAR(ncid, zc_snos_varid, & + & zocetratoc(inos), start = wrstart) ) + call nccheck( NF90_PUT_VAR(ncid, zt_adust_varid, & + & zocetratot(iadust), start = wrstart) ) + call nccheck( NF90_PUT_VAR(ncid, zc_adust_varid, & + & zocetratoc(iadust), start = wrstart) ) + end if + if (use_CFC) then + call nccheck( NF90_PUT_VAR(ncid, zt_cfc11_varid, & + & zocetratot(icfc11), start = wrstart) ) + call nccheck( NF90_PUT_VAR(ncid, zc_cfc11_varid, & + & zocetratoc(icfc11), start = wrstart) ) + call nccheck( NF90_PUT_VAR(ncid, zt_cfc12_varid, & + & zocetratot(icfc12), start = wrstart) ) + call nccheck( NF90_PUT_VAR(ncid, zc_cfc12_varid, & + & zocetratoc(icfc12), start = wrstart) ) + call nccheck( NF90_PUT_VAR(ncid, zt_sf6_varid, & + & zocetratot(isf6), start = wrstart) ) + call nccheck( NF90_PUT_VAR(ncid, zc_sf6_varid, & + & zocetratoc(isf6), start = wrstart) ) + end if + if (use_natDIC) then + call nccheck( NF90_PUT_VAR(ncid, zt_natsco212_varid, & + & zocetratot(inatsco212), start = wrstart) ) + call nccheck( NF90_PUT_VAR(ncid, zc_natsco212_varid, & + & zocetratoc(inatsco212), start = wrstart) ) + call nccheck( NF90_PUT_VAR(ncid, zt_natalkali_varid, & + & zocetratot(inatalkali), start = wrstart) ) + call nccheck( NF90_PUT_VAR(ncid, zc_natalkali_varid, & + & zocetratoc(inatalkali), start = wrstart) ) + call nccheck( NF90_PUT_VAR(ncid, zt_natcalciu_varid, & + & zocetratot(inatcalc), start = wrstart) ) + call nccheck( NF90_PUT_VAR(ncid, zc_natcalciu_varid, & + & zocetratoc(inatcalc), start = wrstart) ) + end if + if (use_BROMO) then + call nccheck( NF90_PUT_VAR(ncid, zt_bromo_varid, & + & zocetratot(ibromo), start = wrstart) ) + call nccheck( NF90_PUT_VAR(ncid, zc_bromo_varid, & + & zocetratoc(ibromo), start = wrstart) ) + end if !--- Write data : sum of inventory call nccheck( NF90_PUT_VAR(ncid, totcarb_varid, totalcarbon, & & start = wrstart) ) diff --git a/hamocc/mo_apply_ndep.F90 b/hamocc/mo_apply_ndep.F90 index 36d7159b..7e490f76 100644 --- a/hamocc/mo_apply_ndep.F90 +++ b/hamocc/mo_apply_ndep.F90 @@ -88,6 +88,7 @@ subroutine apply_ndep(kpie,kpje,kpke,pddpo,omask,ndep) use mo_control_bgc, only: io_stdo_bgc,dtb,do_ndep use mo_carbch, only: ocetra,ndepflx use mo_param1_bgc, only: iano3,ialkali,inatalkali + use mo_ifdefs implicit none @@ -113,9 +114,9 @@ subroutine apply_ndep(kpie,kpje,kpke,pddpo,omask,ndep) ndepflx(i,j) = ndep(i,j)*dtb/365. ocetra(i,j,1,iano3)=ocetra(i,j,1,iano3)+ndepflx(i,j)/pddpo(i,j,1) ocetra(i,j,1,ialkali)=ocetra(i,j,1,ialkali)-ndepflx(i,j)/pddpo(i,j,1) -#ifdef natDIC - ocetra(i,j,1,inatalkali)=ocetra(i,j,1,inatalkali)-ndepflx(i,j)/pddpo(i,j,1) -#endif + if (use_natDIC) then + ocetra(i,j,1,inatalkali)=ocetra(i,j,1,inatalkali)-ndepflx(i,j)/pddpo(i,j,1) + end if endif enddo enddo diff --git a/hamocc/mo_apply_rivin.F90 b/hamocc/mo_apply_rivin.F90 index 0dfbc528..d3627014 100644 --- a/hamocc/mo_apply_rivin.F90 +++ b/hamocc/mo_apply_rivin.F90 @@ -92,6 +92,7 @@ subroutine apply_rivin(kpie,kpje,kpke,pddpo,omask,rivin) ialkali,inatsco212,inatalkali use mo_vgrid, only: kmle use mo_carbch, only: ocetra,rivinflx + use mo_ifdefs implicit none @@ -133,12 +134,12 @@ subroutine apply_rivin(kpie,kpje,kpke,pddpo,omask,rivin) + rivin(i,j,irdin)*fdt/volij & + rivin(i,j,irdip)*fdt/volij ocetra(i,j,1:kmle(i,j),ialkali) = ocetra(i,j,1:kmle(i,j),ialkali) + rivin(i,j,iralk)*fdt/volij -#ifdef natDIC - ocetra(i,j,1:kmle(i,j),inatsco212) = ocetra(i,j,1:kmle(i,j),inatsco212) + rivin(i,j,iralk)*fdt/volij & - + rivin(i,j,irdin)*fdt/volij & - + rivin(i,j,irdip)*fdt/volij - ocetra(i,j,1:kmle(i,j),inatalkali) = ocetra(i,j,1:kmle(i,j),inatalkali) + rivin(i,j,iralk)*fdt/volij -#endif + if (use_natDIC) then + ocetra(i,j,1:kmle(i,j),inatsco212) = ocetra(i,j,1:kmle(i,j),inatsco212) + rivin(i,j,iralk)*fdt/volij & + + rivin(i,j,irdin)*fdt/volij & + + rivin(i,j,irdip)*fdt/volij + ocetra(i,j,1:kmle(i,j),inatalkali) = ocetra(i,j,1:kmle(i,j),inatalkali) + rivin(i,j,iralk)*fdt/volij + end if ocetra(i,j,1:kmle(i,j),iiron) = ocetra(i,j,1:kmle(i,j),iiron) + rivin(i,j,iriron)*fdt/volij*dFe_frac ocetra(i,j,1:kmle(i,j),idoc) = ocetra(i,j,1:kmle(i,j),idoc) + rivin(i,j,irdoc)*fdt/volij ocetra(i,j,1:kmle(i,j),idet) = ocetra(i,j,1:kmle(i,j),idet) + rivin(i,j,irdet)*fdt/volij diff --git a/hamocc/mo_bgcmean.F90 b/hamocc/mo_bgcmean.F90 index 08cc202f..761f9d4c 100644 --- a/hamocc/mo_bgcmean.F90 +++ b/hamocc/mo_bgcmean.F90 @@ -58,6 +58,7 @@ MODULE mo_bgcmean use mod_nctools, only: ncpack,nccomp,nccopa,ncwrtr use netcdf, only: nf90_fill_double use mo_param1_bgc, only: ks + use mo_ifdefs IMPLICIT NONE @@ -676,62 +677,62 @@ SUBROUTINE ALLOC_MEM_BGCMEAN(kpie,kpje,kpke) jcalflx4000(n)=i_bsc_m2d*min(1,FLX_CAL4000(n)) IF (FLX_CAL_BOT(n).GT.0) i_bsc_m2d=i_bsc_m2d+1 jcalflx_bot(n)=i_bsc_m2d*min(1,FLX_CAL_BOT(n)) -#ifndef sedbypass - IF (FLX_SEDIFFIC(n).GT.0) i_bsc_m2d=i_bsc_m2d+1 - jsediffic(n)=i_bsc_m2d*min(1,FLX_SEDIFFIC(n)) - IF (FLX_SEDIFFAL(n).GT.0) i_bsc_m2d=i_bsc_m2d+1 - jsediffal(n)=i_bsc_m2d*min(1,FLX_SEDIFFAL(n)) - IF (FLX_SEDIFFPH(n).GT.0) i_bsc_m2d=i_bsc_m2d+1 - jsediffph(n)=i_bsc_m2d*min(1,FLX_SEDIFFph(n)) - IF (FLX_SEDIFFOX(n).GT.0) i_bsc_m2d=i_bsc_m2d+1 - jsediffox(n)=i_bsc_m2d*min(1,FLX_SEDIFFOX(n)) - IF (FLX_SEDIFFN2(n).GT.0) i_bsc_m2d=i_bsc_m2d+1 - jsediffn2(n)=i_bsc_m2d*min(1,FLX_SEDIFFN2(n)) - IF (FLX_SEDIFFNO3(n).GT.0) i_bsc_m2d=i_bsc_m2d+1 - jsediffno3(n)=i_bsc_m2d*min(1,FLX_SEDIFFNO3(n)) - IF (FLX_SEDIFFSI(n).GT.0) i_bsc_m2d=i_bsc_m2d+1 - jsediffsi(n)=i_bsc_m2d*min(1,FLX_SEDIFFSI(n)) -#endif -#ifdef cisonew - IF (SRF_CO213FXD(n).GT.0) i_bsc_m2d=i_bsc_m2d+1 - jco213fxd(n)=i_bsc_m2d*min(1,SRF_CO213FXD(n)) - IF (SRF_CO213FXU(n).GT.0) i_bsc_m2d=i_bsc_m2d+1 - jco213fxu(n)=i_bsc_m2d*min(1,SRF_CO213FXU(n)) - IF (SRF_CO214FXD(n).GT.0) i_bsc_m2d=i_bsc_m2d+1 - jco214fxd(n)=i_bsc_m2d*min(1,SRF_CO214FXD(n)) - IF (SRF_CO214FXU(n).GT.0) i_bsc_m2d=i_bsc_m2d+1 - jco214fxu(n)=i_bsc_m2d*min(1,SRF_CO214FXU(n)) -#endif -#ifdef CFC - IF (SRF_CFC11(n).GT.0) i_bsc_m2d=i_bsc_m2d+1 - jcfc11fx(n)=i_bsc_m2d*min(1,SRF_CFC11(n)) - IF (SRF_CFC12(n).GT.0) i_bsc_m2d=i_bsc_m2d+1 - jcfc12fx(n)=i_bsc_m2d*min(1,SRF_CFC12(n)) - IF (SRF_SF6(n).GT.0) i_bsc_m2d=i_bsc_m2d+1 - jsf6fx(n)=i_bsc_m2d*min(1,SRF_SF6(n)) -#endif -#ifdef natDIC - IF (SRF_NATDIC(n).GT.0) i_bsc_m2d=i_bsc_m2d+1 - jsrfnatdic(n)=i_bsc_m2d*min(1,SRF_NATDIC(n)) - IF (SRF_NATALKALI(n).GT.0) i_bsc_m2d=i_bsc_m2d+1 - jsrfnatalk(n)=i_bsc_m2d*min(1,SRF_NATALKALI(n)) - IF (SRF_NATPCO2(n).GT.0) i_bsc_m2d=i_bsc_m2d+1 - jnatpco2(n)=i_bsc_m2d*min(1,SRF_NATPCO2(n)) - IF (SRF_NATCO2FX(n).GT.0) i_bsc_m2d=i_bsc_m2d+1 - jnatco2fx(n)=i_bsc_m2d*min(1,SRF_NATCO2FX(n)) - IF (SRF_NATPH(n).GT.0) i_bsc_m2d=i_bsc_m2d+1 - jsrfnatph(n)=i_bsc_m2d*min(1,SRF_NATPH(n)) -#endif -#ifdef BROMO - IF (SRF_BROMO(n).GT.0) i_bsc_m2d=i_bsc_m2d+1 - jsrfbromo(n)=i_bsc_m2d*min(1,SRF_BROMO(n)) - IF (SRF_BROMOFX(n).GT.0) i_bsc_m2d=i_bsc_m2d+1 - jbromofx(n)=i_bsc_m2d*min(1,SRF_BROMOFX(n)) - IF (INT_BROMOPRO(n).GT.0) i_bsc_m2d=i_bsc_m2d+1 - jbromo_prod(n)=i_bsc_m2d*min(1,INT_BROMOPRO(n)) - IF (INT_BROMOUV(n).GT.0) i_bsc_m2d=i_bsc_m2d+1 - jbromo_uv(n)=i_bsc_m2d*min(1,INT_BROMOUV(n)) -#endif + if (.not. use_sedbypass) then + IF (FLX_SEDIFFIC(n).GT.0) i_bsc_m2d=i_bsc_m2d+1 + jsediffic(n)=i_bsc_m2d*min(1,FLX_SEDIFFIC(n)) + IF (FLX_SEDIFFAL(n).GT.0) i_bsc_m2d=i_bsc_m2d+1 + jsediffal(n)=i_bsc_m2d*min(1,FLX_SEDIFFAL(n)) + IF (FLX_SEDIFFPH(n).GT.0) i_bsc_m2d=i_bsc_m2d+1 + jsediffph(n)=i_bsc_m2d*min(1,FLX_SEDIFFph(n)) + IF (FLX_SEDIFFOX(n).GT.0) i_bsc_m2d=i_bsc_m2d+1 + jsediffox(n)=i_bsc_m2d*min(1,FLX_SEDIFFOX(n)) + IF (FLX_SEDIFFN2(n).GT.0) i_bsc_m2d=i_bsc_m2d+1 + jsediffn2(n)=i_bsc_m2d*min(1,FLX_SEDIFFN2(n)) + IF (FLX_SEDIFFNO3(n).GT.0) i_bsc_m2d=i_bsc_m2d+1 + jsediffno3(n)=i_bsc_m2d*min(1,FLX_SEDIFFNO3(n)) + IF (FLX_SEDIFFSI(n).GT.0) i_bsc_m2d=i_bsc_m2d+1 + jsediffsi(n)=i_bsc_m2d*min(1,FLX_SEDIFFSI(n)) + end if + if (use_cisonew) then + IF (SRF_CO213FXD(n).GT.0) i_bsc_m2d=i_bsc_m2d+1 + jco213fxd(n)=i_bsc_m2d*min(1,SRF_CO213FXD(n)) + IF (SRF_CO213FXU(n).GT.0) i_bsc_m2d=i_bsc_m2d+1 + jco213fxu(n)=i_bsc_m2d*min(1,SRF_CO213FXU(n)) + IF (SRF_CO214FXD(n).GT.0) i_bsc_m2d=i_bsc_m2d+1 + jco214fxd(n)=i_bsc_m2d*min(1,SRF_CO214FXD(n)) + IF (SRF_CO214FXU(n).GT.0) i_bsc_m2d=i_bsc_m2d+1 + jco214fxu(n)=i_bsc_m2d*min(1,SRF_CO214FXU(n)) + end if + if (use_CFC) then + IF (SRF_CFC11(n).GT.0) i_bsc_m2d=i_bsc_m2d+1 + jcfc11fx(n)=i_bsc_m2d*min(1,SRF_CFC11(n)) + IF (SRF_CFC12(n).GT.0) i_bsc_m2d=i_bsc_m2d+1 + jcfc12fx(n)=i_bsc_m2d*min(1,SRF_CFC12(n)) + IF (SRF_SF6(n).GT.0) i_bsc_m2d=i_bsc_m2d+1 + jsf6fx(n)=i_bsc_m2d*min(1,SRF_SF6(n)) + end if + if (use_natDIC) then + IF (SRF_NATDIC(n).GT.0) i_bsc_m2d=i_bsc_m2d+1 + jsrfnatdic(n)=i_bsc_m2d*min(1,SRF_NATDIC(n)) + IF (SRF_NATALKALI(n).GT.0) i_bsc_m2d=i_bsc_m2d+1 + jsrfnatalk(n)=i_bsc_m2d*min(1,SRF_NATALKALI(n)) + IF (SRF_NATPCO2(n).GT.0) i_bsc_m2d=i_bsc_m2d+1 + jnatpco2(n)=i_bsc_m2d*min(1,SRF_NATPCO2(n)) + IF (SRF_NATCO2FX(n).GT.0) i_bsc_m2d=i_bsc_m2d+1 + jnatco2fx(n)=i_bsc_m2d*min(1,SRF_NATCO2FX(n)) + IF (SRF_NATPH(n).GT.0) i_bsc_m2d=i_bsc_m2d+1 + jsrfnatph(n)=i_bsc_m2d*min(1,SRF_NATPH(n)) + end if + if (use_BROMO ) then + IF (SRF_BROMO(n).GT.0) i_bsc_m2d=i_bsc_m2d+1 + jsrfbromo(n)=i_bsc_m2d*min(1,SRF_BROMO(n)) + IF (SRF_BROMOFX(n).GT.0) i_bsc_m2d=i_bsc_m2d+1 + jbromofx(n)=i_bsc_m2d*min(1,SRF_BROMOFX(n)) + IF (INT_BROMOPRO(n).GT.0) i_bsc_m2d=i_bsc_m2d+1 + jbromo_prod(n)=i_bsc_m2d*min(1,INT_BROMOPRO(n)) + IF (INT_BROMOUV(n).GT.0) i_bsc_m2d=i_bsc_m2d+1 + jbromo_uv(n)=i_bsc_m2d*min(1,INT_BROMOUV(n)) + end if ENDDO domassfluxes = any( & @@ -746,22 +747,22 @@ SUBROUTINE ALLOC_MEM_BGCMEAN(kpie,kpje,kpke) DO n=1,nbgc IF (SRF_ATMCO2(n).GT.0) i_atm_m2d=i_atm_m2d+1 jatmco2(n)=i_atm_m2d*min(1,SRF_ATMCO2(n)) -#if defined(BOXATM) - IF (SRF_ATMO2(n).GT.0) i_atm_m2d=i_atm_m2d+1 - jatmo2(n)=i_atm_m2d*min(1,SRF_ATMO2(n)) - IF (SRF_ATMN2(n).GT.0) i_atm_m2d=i_atm_m2d+1 - jatmn2(n)=i_atm_m2d*min(1,SRF_ATMN2(n)) -#endif -#ifdef cisonew - IF (SRF_ATMC13(n).GT.0) i_atm_m2d=i_atm_m2d+1 - jatmc13(n)=i_atm_m2d*min(1,SRF_ATMC13(n)) - IF (SRF_ATMC14(n).GT.0) i_atm_m2d=i_atm_m2d+1 - jatmc14(n)=i_atm_m2d*min(1,SRF_ATMC14(n)) -#endif -#if defined(BROMO) - IF (SRF_ATMBROMO(n).GT.0) i_atm_m2d=i_atm_m2d+1 - jatmbromo(n)=i_atm_m2d*min(1,SRF_ATMBROMO(n)) -#endif + if (use_BOXATM) then + IF (SRF_ATMO2(n).GT.0) i_atm_m2d=i_atm_m2d+1 + jatmo2(n)=i_atm_m2d*min(1,SRF_ATMO2(n)) + IF (SRF_ATMN2(n).GT.0) i_atm_m2d=i_atm_m2d+1 + jatmn2(n)=i_atm_m2d*min(1,SRF_ATMN2(n)) + end if + if (use_cisonew) then + IF (SRF_ATMC13(n).GT.0) i_atm_m2d=i_atm_m2d+1 + jatmc13(n)=i_atm_m2d*min(1,SRF_ATMC13(n)) + IF (SRF_ATMC14(n).GT.0) i_atm_m2d=i_atm_m2d+1 + jatmc14(n)=i_atm_m2d*min(1,SRF_ATMC14(n)) + end if + if (use_BROMO ) then + IF (SRF_ATMBROMO(n).GT.0) i_atm_m2d=i_atm_m2d+1 + jatmbromo(n)=i_atm_m2d*min(1,SRF_ATMBROMO(n)) + end if ENDDO i_atm_m2d=i_atm_m2d-i_bsc_m2d @@ -822,68 +823,68 @@ SUBROUTINE ALLOC_MEM_BGCMEAN(kpie,kpje,kpke) jdicsat(n)=i_bsc_m3d*min(1,LYR_DICSAT(n)) IF (LYR_DP(n).GT.0) i_bsc_m3d=i_bsc_m3d+1 jdp(n)=i_bsc_m3d*min(1,LYR_DP(n)) -#ifdef CFC - IF (LYR_CFC11(n).GT.0) i_bsc_m3d=i_bsc_m3d+1 - jcfc11(n)=i_bsc_m3d*min(1,LYR_CFC11(n)) - IF (LYR_CFC12(n).GT.0) i_bsc_m3d=i_bsc_m3d+1 - jcfc12(n)=i_bsc_m3d*min(1,LYR_CFC12(n)) - IF (LYR_SF6(n).GT.0) i_bsc_m3d=i_bsc_m3d+1 - jsf6(n)=i_bsc_m3d*min(1,LYR_SF6(n)) -#endif -#ifdef cisonew - IF (LYR_DIC13(n).GT.0) i_bsc_m3d=i_bsc_m3d+1 - jdic13(n)=i_bsc_m3d*min(1,LYR_DIC13(n)) - IF (LYR_DIC14(n).GT.0) i_bsc_m3d=i_bsc_m3d+1 - jdic14(n)=i_bsc_m3d*min(1,LYR_DIC14(n)) - IF (LYR_D13C(n).GT.0) i_bsc_m3d=i_bsc_m3d+1 - jd13c(n)=i_bsc_m3d*min(1,LYR_D13C(n)) - IF (LYR_D14C(n).GT.0) i_bsc_m3d=i_bsc_m3d+1 - jd14c(n)=i_bsc_m3d*min(1,LYR_D14C(n)) - IF (LYR_BIGD14C(n).GT.0) i_bsc_m3d=i_bsc_m3d+1 - jbigd14c(n)=i_bsc_m3d*min(1,LYR_BIGD14C(n)) - IF (LYR_POC13(n).GT.0) i_bsc_m3d=i_bsc_m3d+1 - jpoc13(n)=i_bsc_m3d*min(1,LYR_POC13(n)) - IF (LYR_DOC13(n).GT.0) i_bsc_m3d=i_bsc_m3d+1 - jdoc13(n)=i_bsc_m3d*min(1,LYR_DOC13(n)) - IF (LYR_CALC13(n).GT.0) i_bsc_m3d=i_bsc_m3d+1 - jcalc13(n)=i_bsc_m3d*min(1,LYR_CALC13(n)) - IF (LYR_PHYTO13(n).GT.0) i_bsc_m3d=i_bsc_m3d+1 - jphyto13(n)=i_bsc_m3d*min(1,LYR_PHYTO13(n)) - IF (LYR_GRAZER13(n).GT.0) i_bsc_m3d=i_bsc_m3d+1 - jgrazer13(n)=i_bsc_m3d*min(1,LYR_GRAZER13(n)) -#endif -#ifdef AGG - IF (LYR_NOS(n).GT.0) i_bsc_m3d=i_bsc_m3d+1 - jnos(n)=i_bsc_m3d*min(1,LYR_NOS(n)) - IF (LYR_WPHY(n).GT.0) i_bsc_m3d=i_bsc_m3d+1 - jwphy(n)=i_bsc_m3d*min(1,LYR_WPHY(n)) - IF (LYR_WNOS(n).GT.0) i_bsc_m3d=i_bsc_m3d+1 - jwnos(n)=i_bsc_m3d*min(1,LYR_WNOS(n)) - IF (LYR_EPS(n).GT.0) i_bsc_m3d=i_bsc_m3d+1 - jeps(n)=i_bsc_m3d*min(1,LYR_EPS(n)) - IF (LYR_ASIZE(n).GT.0) i_bsc_m3d=i_bsc_m3d+1 - jasize(n)=i_bsc_m3d*min(1,LYR_ASIZE(n)) -#endif -#ifdef natDIC - IF (LYR_NATCO3(n).GT.0) i_bsc_m3d=i_bsc_m3d+1 - jnatco3(n)=i_bsc_m3d*min(1,LYR_NATCO3(n)) - IF (LYR_NATALKALI(n).GT.0) i_bsc_m3d=i_bsc_m3d+1 - jnatalkali(n)=i_bsc_m3d*min(1,LYR_NATALKALI(n)) - IF (LYR_NATDIC(n).GT.0) i_bsc_m3d=i_bsc_m3d+1 - jnatdic(n)=i_bsc_m3d*min(1,LYR_NATDIC(n)) - IF (LYR_NATCALC(n).GT.0) i_bsc_m3d=i_bsc_m3d+1 - jnatcalc(n)=i_bsc_m3d*min(1,LYR_NATCALC(n)) - IF (LYR_NATPH(n).GT.0) i_bsc_m3d=i_bsc_m3d+1 - jnatph(n)=i_bsc_m3d*min(1,LYR_NATPH(n)) - IF (LYR_NATOMEGAA(n).GT.0) i_bsc_m3d=i_bsc_m3d+1 - jnatomegaa(n)=i_bsc_m3d*min(1,LYR_NATOMEGAA(n)) - IF (LYR_NATOMEGAC(n).GT.0) i_bsc_m3d=i_bsc_m3d+1 - jnatomegac(n)=i_bsc_m3d*min(1,LYR_NATOMEGAC(n)) -#endif -#ifdef BROMO - IF (LYR_BROMO(n).GT.0) i_bsc_m3d=i_bsc_m3d+1 - jbromo(n)=i_bsc_m3d*min(1,LYR_BROMO(n)) -#endif + if (use_CFC) then + IF (LYR_CFC11(n).GT.0) i_bsc_m3d=i_bsc_m3d+1 + jcfc11(n)=i_bsc_m3d*min(1,LYR_CFC11(n)) + IF (LYR_CFC12(n).GT.0) i_bsc_m3d=i_bsc_m3d+1 + jcfc12(n)=i_bsc_m3d*min(1,LYR_CFC12(n)) + IF (LYR_SF6(n).GT.0) i_bsc_m3d=i_bsc_m3d+1 + jsf6(n)=i_bsc_m3d*min(1,LYR_SF6(n)) + end if + if (use_cisonew) then + IF (LYR_DIC13(n).GT.0) i_bsc_m3d=i_bsc_m3d+1 + jdic13(n)=i_bsc_m3d*min(1,LYR_DIC13(n)) + IF (LYR_DIC14(n).GT.0) i_bsc_m3d=i_bsc_m3d+1 + jdic14(n)=i_bsc_m3d*min(1,LYR_DIC14(n)) + IF (LYR_D13C(n).GT.0) i_bsc_m3d=i_bsc_m3d+1 + jd13c(n)=i_bsc_m3d*min(1,LYR_D13C(n)) + IF (LYR_D14C(n).GT.0) i_bsc_m3d=i_bsc_m3d+1 + jd14c(n)=i_bsc_m3d*min(1,LYR_D14C(n)) + IF (LYR_BIGD14C(n).GT.0) i_bsc_m3d=i_bsc_m3d+1 + jbigd14c(n)=i_bsc_m3d*min(1,LYR_BIGD14C(n)) + IF (LYR_POC13(n).GT.0) i_bsc_m3d=i_bsc_m3d+1 + jpoc13(n)=i_bsc_m3d*min(1,LYR_POC13(n)) + IF (LYR_DOC13(n).GT.0) i_bsc_m3d=i_bsc_m3d+1 + jdoc13(n)=i_bsc_m3d*min(1,LYR_DOC13(n)) + IF (LYR_CALC13(n).GT.0) i_bsc_m3d=i_bsc_m3d+1 + jcalc13(n)=i_bsc_m3d*min(1,LYR_CALC13(n)) + IF (LYR_PHYTO13(n).GT.0) i_bsc_m3d=i_bsc_m3d+1 + jphyto13(n)=i_bsc_m3d*min(1,LYR_PHYTO13(n)) + IF (LYR_GRAZER13(n).GT.0) i_bsc_m3d=i_bsc_m3d+1 + jgrazer13(n)=i_bsc_m3d*min(1,LYR_GRAZER13(n)) + end if + if (use_AGG) then + IF (LYR_NOS(n).GT.0) i_bsc_m3d=i_bsc_m3d+1 + jnos(n)=i_bsc_m3d*min(1,LYR_NOS(n)) + IF (LYR_WPHY(n).GT.0) i_bsc_m3d=i_bsc_m3d+1 + jwphy(n)=i_bsc_m3d*min(1,LYR_WPHY(n)) + IF (LYR_WNOS(n).GT.0) i_bsc_m3d=i_bsc_m3d+1 + jwnos(n)=i_bsc_m3d*min(1,LYR_WNOS(n)) + IF (LYR_EPS(n).GT.0) i_bsc_m3d=i_bsc_m3d+1 + jeps(n)=i_bsc_m3d*min(1,LYR_EPS(n)) + IF (LYR_ASIZE(n).GT.0) i_bsc_m3d=i_bsc_m3d+1 + jasize(n)=i_bsc_m3d*min(1,LYR_ASIZE(n)) + end if + if (use_natDIC) then + IF (LYR_NATCO3(n).GT.0) i_bsc_m3d=i_bsc_m3d+1 + jnatco3(n)=i_bsc_m3d*min(1,LYR_NATCO3(n)) + IF (LYR_NATALKALI(n).GT.0) i_bsc_m3d=i_bsc_m3d+1 + jnatalkali(n)=i_bsc_m3d*min(1,LYR_NATALKALI(n)) + IF (LYR_NATDIC(n).GT.0) i_bsc_m3d=i_bsc_m3d+1 + jnatdic(n)=i_bsc_m3d*min(1,LYR_NATDIC(n)) + IF (LYR_NATCALC(n).GT.0) i_bsc_m3d=i_bsc_m3d+1 + jnatcalc(n)=i_bsc_m3d*min(1,LYR_NATCALC(n)) + IF (LYR_NATPH(n).GT.0) i_bsc_m3d=i_bsc_m3d+1 + jnatph(n)=i_bsc_m3d*min(1,LYR_NATPH(n)) + IF (LYR_NATOMEGAA(n).GT.0) i_bsc_m3d=i_bsc_m3d+1 + jnatomegaa(n)=i_bsc_m3d*min(1,LYR_NATOMEGAA(n)) + IF (LYR_NATOMEGAC(n).GT.0) i_bsc_m3d=i_bsc_m3d+1 + jnatomegac(n)=i_bsc_m3d*min(1,LYR_NATOMEGAC(n)) + end if + if (use_BROMO) then + IF (LYR_BROMO(n).GT.0) i_bsc_m3d=i_bsc_m3d+1 + jbromo(n)=i_bsc_m3d*min(1,LYR_BROMO(n)) + end if IF (LVL_PHYTO(n).GT.0) ilvl_bsc_m3d=ilvl_bsc_m3d+1 jlvlphyto(n)=ilvl_bsc_m3d*min(1,LVL_PHYTO(n)) @@ -935,68 +936,68 @@ SUBROUTINE ALLOC_MEM_BGCMEAN(kpie,kpje,kpke) jlvlprefdic(n)=ilvl_bsc_m3d*min(1,LVL_PREFDIC(n)) IF (LVL_DICSAT(n).GT.0) ilvl_bsc_m3d=ilvl_bsc_m3d+1 jlvldicsat(n)=ilvl_bsc_m3d*min(1,LVL_DICSAT(n)) -#ifdef CFC - IF (LVL_CFC11(n).GT.0) ilvl_bsc_m3d=ilvl_bsc_m3d+1 - jlvlcfc11(n)=ilvl_bsc_m3d*min(1,LVL_CFC11(n)) - IF (LVL_CFC12(n).GT.0) ilvl_bsc_m3d=ilvl_bsc_m3d+1 - jlvlcfc12(n)=ilvl_bsc_m3d*min(1,LVL_CFC12(n)) - IF (LVL_SF6(n).GT.0) ilvl_bsc_m3d=ilvl_bsc_m3d+1 - jlvlsf6(n)=ilvl_bsc_m3d*min(1,LVL_SF6(n)) -#endif -#ifdef cisonew - IF (LVL_DIC13(n).GT.0) ilvl_bsc_m3d=ilvl_bsc_m3d+1 - jlvldic13(n)=ilvl_bsc_m3d*min(1,LVL_DIC13(n)) - IF (LVL_DIC14(n).GT.0) ilvl_bsc_m3d=ilvl_bsc_m3d+1 - jlvldic14(n)=ilvl_bsc_m3d*min(1,LVL_DIC14(n)) - IF (LVL_D13C(n).GT.0) ilvl_bsc_m3d=ilvl_bsc_m3d+1 - jlvld13c(n)=ilvl_bsc_m3d*min(1,LVL_D13C(n)) - IF (LVL_D14C(n).GT.0) ilvl_bsc_m3d=ilvl_bsc_m3d+1 - jlvld14c(n)=ilvl_bsc_m3d*min(1,LVL_D14C(n)) - IF (LVL_BIGD14C(n).GT.0) ilvl_bsc_m3d=ilvl_bsc_m3d+1 - jlvlbigd14c(n)=ilvl_bsc_m3d*min(1,LVL_BIGD14C(n)) - IF (LVL_POC13(n).GT.0) ilvl_bsc_m3d=ilvl_bsc_m3d+1 - jlvlpoc13(n)=ilvl_bsc_m3d*min(1,LVL_POC13(n)) - IF (LVL_DOC13(n).GT.0) ilvl_bsc_m3d=ilvl_bsc_m3d+1 - jlvldoc13(n)=ilvl_bsc_m3d*min(1,LVL_DOC13(n)) - IF (LVL_CALC13(n).GT.0) ilvl_bsc_m3d=ilvl_bsc_m3d+1 - jlvlcalc13(n)=ilvl_bsc_m3d*min(1,LVL_CALC13(n)) - IF (LVL_PHYTO13(n).GT.0) ilvl_bsc_m3d=ilvl_bsc_m3d+1 - jlvlphyto13(n)=ilvl_bsc_m3d*min(1,LVL_PHYTO13(n)) - IF (LVL_GRAZER13(n).GT.0) ilvl_bsc_m3d=ilvl_bsc_m3d+1 - jlvlgrazer13(n)=ilvl_bsc_m3d*min(1,LVL_GRAZER13(n)) -#endif -#ifdef AGG - IF (LVL_NOS(n).GT.0) ilvl_bsc_m3d=ilvl_bsc_m3d+1 - jlvlnos(n)=ilvl_bsc_m3d*min(1,LVL_NOS(n)) - IF (LVL_WPHY(n).GT.0) ilvl_bsc_m3d=ilvl_bsc_m3d+1 - jlvlwphy(n)=ilvl_bsc_m3d*min(1,LVL_WPHY(n)) - IF (LVL_WNOS(n).GT.0) ilvl_bsc_m3d=ilvl_bsc_m3d+1 - jlvlwnos(n)=ilvl_bsc_m3d*min(1,LVL_WNOS(n)) - IF (LVL_EPS(n).GT.0) ilvl_bsc_m3d=ilvl_bsc_m3d+1 - jlvleps(n)=ilvl_bsc_m3d*min(1,LVL_EPS(n)) - IF (LVL_ASIZE(n).GT.0) ilvl_bsc_m3d=ilvl_bsc_m3d+1 - jlvlasize(n)=ilvl_bsc_m3d*min(1,LVL_ASIZE(n)) -#endif -#ifdef natDIC - IF (LVL_NATCO3(n).GT.0) ilvl_bsc_m3d=ilvl_bsc_m3d+1 - jlvlnatco3(n)=ilvl_bsc_m3d*min(1,LVL_NATCO3(n)) - IF (LVL_NATALKALI(n).GT.0) ilvl_bsc_m3d=ilvl_bsc_m3d+1 - jlvlnatalkali(n)=ilvl_bsc_m3d*min(1,LVL_NATALKALI(n)) - IF (LVL_NATDIC(n).GT.0) ilvl_bsc_m3d=ilvl_bsc_m3d+1 - jlvlnatdic(n)=ilvl_bsc_m3d*min(1,LVL_NATDIC(n)) - IF (LVL_NATCALC(n).GT.0) ilvl_bsc_m3d=ilvl_bsc_m3d+1 - jlvlnatcalc(n)=ilvl_bsc_m3d*min(1,LVL_NATCALC(n)) - IF (LVL_NATPH(n).GT.0) ilvl_bsc_m3d=ilvl_bsc_m3d+1 - jlvlnatph(n)=ilvl_bsc_m3d*min(1,LVL_NATPH(n)) - IF (LVL_NATOMEGAA(n).GT.0) ilvl_bsc_m3d=ilvl_bsc_m3d+1 - jlvlnatomegaa(n)=ilvl_bsc_m3d*min(1,LVL_NATOMEGAA(n)) - IF (LVL_NATOMEGAC(n).GT.0) ilvl_bsc_m3d=ilvl_bsc_m3d+1 - jlvlnatomegac(n)=ilvl_bsc_m3d*min(1,LVL_NATOMEGAC(n)) -#endif -#ifdef BROMO - IF (LVL_BROMO(n).GT.0) ilvl_bsc_m3d=ilvl_bsc_m3d+1 - jlvlbromo(n)=ilvl_bsc_m3d*min(1,LVL_BROMO(n)) -#endif + if (use_CFC) then + IF (LVL_CFC11(n).GT.0) ilvl_bsc_m3d=ilvl_bsc_m3d+1 + jlvlcfc11(n)=ilvl_bsc_m3d*min(1,LVL_CFC11(n)) + IF (LVL_CFC12(n).GT.0) ilvl_bsc_m3d=ilvl_bsc_m3d+1 + jlvlcfc12(n)=ilvl_bsc_m3d*min(1,LVL_CFC12(n)) + IF (LVL_SF6(n).GT.0) ilvl_bsc_m3d=ilvl_bsc_m3d+1 + jlvlsf6(n)=ilvl_bsc_m3d*min(1,LVL_SF6(n)) + end if + if (use_cisonew) then + IF (LVL_DIC13(n).GT.0) ilvl_bsc_m3d=ilvl_bsc_m3d+1 + jlvldic13(n)=ilvl_bsc_m3d*min(1,LVL_DIC13(n)) + IF (LVL_DIC14(n).GT.0) ilvl_bsc_m3d=ilvl_bsc_m3d+1 + jlvldic14(n)=ilvl_bsc_m3d*min(1,LVL_DIC14(n)) + IF (LVL_D13C(n).GT.0) ilvl_bsc_m3d=ilvl_bsc_m3d+1 + jlvld13c(n)=ilvl_bsc_m3d*min(1,LVL_D13C(n)) + IF (LVL_D14C(n).GT.0) ilvl_bsc_m3d=ilvl_bsc_m3d+1 + jlvld14c(n)=ilvl_bsc_m3d*min(1,LVL_D14C(n)) + IF (LVL_BIGD14C(n).GT.0) ilvl_bsc_m3d=ilvl_bsc_m3d+1 + jlvlbigd14c(n)=ilvl_bsc_m3d*min(1,LVL_BIGD14C(n)) + IF (LVL_POC13(n).GT.0) ilvl_bsc_m3d=ilvl_bsc_m3d+1 + jlvlpoc13(n)=ilvl_bsc_m3d*min(1,LVL_POC13(n)) + IF (LVL_DOC13(n).GT.0) ilvl_bsc_m3d=ilvl_bsc_m3d+1 + jlvldoc13(n)=ilvl_bsc_m3d*min(1,LVL_DOC13(n)) + IF (LVL_CALC13(n).GT.0) ilvl_bsc_m3d=ilvl_bsc_m3d+1 + jlvlcalc13(n)=ilvl_bsc_m3d*min(1,LVL_CALC13(n)) + IF (LVL_PHYTO13(n).GT.0) ilvl_bsc_m3d=ilvl_bsc_m3d+1 + jlvlphyto13(n)=ilvl_bsc_m3d*min(1,LVL_PHYTO13(n)) + IF (LVL_GRAZER13(n).GT.0) ilvl_bsc_m3d=ilvl_bsc_m3d+1 + jlvlgrazer13(n)=ilvl_bsc_m3d*min(1,LVL_GRAZER13(n)) + end if + if (use_AGG) then + IF (LVL_NOS(n).GT.0) ilvl_bsc_m3d=ilvl_bsc_m3d+1 + jlvlnos(n)=ilvl_bsc_m3d*min(1,LVL_NOS(n)) + IF (LVL_WPHY(n).GT.0) ilvl_bsc_m3d=ilvl_bsc_m3d+1 + jlvlwphy(n)=ilvl_bsc_m3d*min(1,LVL_WPHY(n)) + IF (LVL_WNOS(n).GT.0) ilvl_bsc_m3d=ilvl_bsc_m3d+1 + jlvlwnos(n)=ilvl_bsc_m3d*min(1,LVL_WNOS(n)) + IF (LVL_EPS(n).GT.0) ilvl_bsc_m3d=ilvl_bsc_m3d+1 + jlvleps(n)=ilvl_bsc_m3d*min(1,LVL_EPS(n)) + IF (LVL_ASIZE(n).GT.0) ilvl_bsc_m3d=ilvl_bsc_m3d+1 + jlvlasize(n)=ilvl_bsc_m3d*min(1,LVL_ASIZE(n)) + end if + if (use_natDIC) then + IF (LVL_NATCO3(n).GT.0) ilvl_bsc_m3d=ilvl_bsc_m3d+1 + jlvlnatco3(n)=ilvl_bsc_m3d*min(1,LVL_NATCO3(n)) + IF (LVL_NATALKALI(n).GT.0) ilvl_bsc_m3d=ilvl_bsc_m3d+1 + jlvlnatalkali(n)=ilvl_bsc_m3d*min(1,LVL_NATALKALI(n)) + IF (LVL_NATDIC(n).GT.0) ilvl_bsc_m3d=ilvl_bsc_m3d+1 + jlvlnatdic(n)=ilvl_bsc_m3d*min(1,LVL_NATDIC(n)) + IF (LVL_NATCALC(n).GT.0) ilvl_bsc_m3d=ilvl_bsc_m3d+1 + jlvlnatcalc(n)=ilvl_bsc_m3d*min(1,LVL_NATCALC(n)) + IF (LVL_NATPH(n).GT.0) ilvl_bsc_m3d=ilvl_bsc_m3d+1 + jlvlnatph(n)=ilvl_bsc_m3d*min(1,LVL_NATPH(n)) + IF (LVL_NATOMEGAA(n).GT.0) ilvl_bsc_m3d=ilvl_bsc_m3d+1 + jlvlnatomegaa(n)=ilvl_bsc_m3d*min(1,LVL_NATOMEGAA(n)) + IF (LVL_NATOMEGAC(n).GT.0) ilvl_bsc_m3d=ilvl_bsc_m3d+1 + jlvlnatomegac(n)=ilvl_bsc_m3d*min(1,LVL_NATOMEGAC(n)) + end if + if (use_BROMO) then + IF (LVL_BROMO(n).GT.0) ilvl_bsc_m3d=ilvl_bsc_m3d+1 + jlvlbromo(n)=ilvl_bsc_m3d*min(1,LVL_BROMO(n)) + end if IF (i_bsc_m3d.NE.0) checkdp(n)=1 ENDDO @@ -1012,43 +1013,43 @@ SUBROUTINE ALLOC_MEM_BGCMEAN(kpie,kpje,kpke) i_bsc_sed=0 i_bsc_bur=0 -#ifndef sedbypass - DO n=1,nbgc - IF (SDM_POWAIC(n).GT.0) i_bsc_sed=i_bsc_sed+1 - jpowaic(n)=i_bsc_sed*min(1,SDM_POWAIC(n)) - IF (SDM_POWAAL(n).GT.0) i_bsc_sed=i_bsc_sed+1 - jpowaal(n)=i_bsc_sed*min(1,SDM_POWAAL(n)) - IF (SDM_POWAPH(n).GT.0) i_bsc_sed=i_bsc_sed+1 - jpowaph(n)=i_bsc_sed*min(1,SDM_POWAPH(n)) - IF (SDM_POWAOX(n).GT.0) i_bsc_sed=i_bsc_sed+1 - jpowaox(n)=i_bsc_sed*min(1,SDM_POWAOX(n)) - IF (SDM_POWN2(n) .GT.0) i_bsc_sed=i_bsc_sed+1 - jpown2(n) =i_bsc_sed*min(1,SDM_POWN2(n)) - IF (SDM_POWNO3(n).GT.0) i_bsc_sed=i_bsc_sed+1 - jpowno3(n)=i_bsc_sed*min(1,SDM_POWNO3(n)) - IF (SDM_POWASI(n).GT.0) i_bsc_sed=i_bsc_sed+1 - jpowasi(n)=i_bsc_sed*min(1,SDM_POWASI(n)) - IF (SDM_SSSO12(n).GT.0) i_bsc_sed=i_bsc_sed+1 - jssso12(n)=i_bsc_sed*min(1,SDM_SSSO12(n)) - IF (SDM_SSSSIL(n).GT.0) i_bsc_sed=i_bsc_sed+1 - jssssil(n)=i_bsc_sed*min(1,SDM_SSSSIL(n)) - IF (SDM_SSSC12(n).GT.0) i_bsc_sed=i_bsc_sed+1 - jsssc12(n)=i_bsc_sed*min(1,SDM_SSSC12(n)) - IF (SDM_SSSTER(n).GT.0) i_bsc_sed=i_bsc_sed+1 - jssster(n)=i_bsc_sed*min(1,SDM_SSSTER(n)) - ENDDO - - DO n=1,nbgc - IF (BUR_SSSO12(n).GT.0) i_bsc_bur=i_bsc_bur+1 - jburssso12(n)=i_bsc_bur*min(1,BUR_SSSO12(n)) - IF (BUR_SSSC12(n).GT.0) i_bsc_bur=i_bsc_bur+1 - jbursssc12(n)=i_bsc_bur*min(1,BUR_SSSC12(n)) - IF (BUR_SSSSIL(n).GT.0) i_bsc_bur=i_bsc_bur+1 - jburssssil(n)=i_bsc_bur*min(1,BUR_SSSSIL(n)) - IF (BUR_SSSTER(n).GT.0) i_bsc_bur=i_bsc_bur+1 - jburssster(n)=i_bsc_bur*min(1,BUR_SSSTER(n)) - ENDDO -#endif + if (.not. use_sedbypass) then + DO n=1,nbgc + IF (SDM_POWAIC(n).GT.0) i_bsc_sed=i_bsc_sed+1 + jpowaic(n)=i_bsc_sed*min(1,SDM_POWAIC(n)) + IF (SDM_POWAAL(n).GT.0) i_bsc_sed=i_bsc_sed+1 + jpowaal(n)=i_bsc_sed*min(1,SDM_POWAAL(n)) + IF (SDM_POWAPH(n).GT.0) i_bsc_sed=i_bsc_sed+1 + jpowaph(n)=i_bsc_sed*min(1,SDM_POWAPH(n)) + IF (SDM_POWAOX(n).GT.0) i_bsc_sed=i_bsc_sed+1 + jpowaox(n)=i_bsc_sed*min(1,SDM_POWAOX(n)) + IF (SDM_POWN2(n) .GT.0) i_bsc_sed=i_bsc_sed+1 + jpown2(n) =i_bsc_sed*min(1,SDM_POWN2(n)) + IF (SDM_POWNO3(n).GT.0) i_bsc_sed=i_bsc_sed+1 + jpowno3(n)=i_bsc_sed*min(1,SDM_POWNO3(n)) + IF (SDM_POWASI(n).GT.0) i_bsc_sed=i_bsc_sed+1 + jpowasi(n)=i_bsc_sed*min(1,SDM_POWASI(n)) + IF (SDM_SSSO12(n).GT.0) i_bsc_sed=i_bsc_sed+1 + jssso12(n)=i_bsc_sed*min(1,SDM_SSSO12(n)) + IF (SDM_SSSSIL(n).GT.0) i_bsc_sed=i_bsc_sed+1 + jssssil(n)=i_bsc_sed*min(1,SDM_SSSSIL(n)) + IF (SDM_SSSC12(n).GT.0) i_bsc_sed=i_bsc_sed+1 + jsssc12(n)=i_bsc_sed*min(1,SDM_SSSC12(n)) + IF (SDM_SSSTER(n).GT.0) i_bsc_sed=i_bsc_sed+1 + jssster(n)=i_bsc_sed*min(1,SDM_SSSTER(n)) + ENDDO + + DO n=1,nbgc + IF (BUR_SSSO12(n).GT.0) i_bsc_bur=i_bsc_bur+1 + jburssso12(n)=i_bsc_bur*min(1,BUR_SSSO12(n)) + IF (BUR_SSSC12(n).GT.0) i_bsc_bur=i_bsc_bur+1 + jbursssc12(n)=i_bsc_bur*min(1,BUR_SSSC12(n)) + IF (BUR_SSSSIL(n).GT.0) i_bsc_bur=i_bsc_bur+1 + jburssssil(n)=i_bsc_bur*min(1,BUR_SSSSIL(n)) + IF (BUR_SSSTER(n).GT.0) i_bsc_bur=i_bsc_bur+1 + jburssster(n)=i_bsc_bur*min(1,BUR_SSSTER(n)) + ENDDO + end if nbgcm2d = i_bsc_m2d+i_atm_m2d nbgcm3d = i_bsc_m3d @@ -1116,32 +1117,32 @@ SUBROUTINE ALLOC_MEM_BGCMEAN(kpie,kpje,kpke) IF (errstat.NE.0) STOP 'not enough memory bgcm3dlvl' IF (nbgcm3dlvl.NE.0) bgcm3dlvl=0. -#ifndef sedbypass - IF (mnproc.EQ.1) THEN - WRITE(io_stdo_bgc,*)'Memory allocation for variable bgctsed ...' - WRITE(io_stdo_bgc,*)'First dimension : ',kpie - WRITE(io_stdo_bgc,*)'Second dimension : ',kpje - WRITE(io_stdo_bgc,*)'Third dimension : ',ks - WRITE(io_stdo_bgc,*)'Forth dimension : ',nbgct_sed - ENDIF - - ALLOCATE (bgct_sed(1-nbdy:kpie+nbdy,1-nbdy:kpje+nbdy,ks, & - & nbgct_sed),stat=errstat) - IF (errstat.NE.0) STOP 'not enough memory bgct_sed' - IF (nbgct_sed.NE.0) bgct_sed=0. - - IF (mnproc.EQ.1) THEN - WRITE(io_stdo_bgc,*)'Memory allocation for variable bgctbur ...' - WRITE(io_stdo_bgc,*)'First dimension : ',kpie - WRITE(io_stdo_bgc,*)'Second dimension : ',kpje - WRITE(io_stdo_bgc,*)'Third dimension : ',nbgct_bur - ENDIF - - ALLOCATE (bgct_bur(1-nbdy:kpie+nbdy,1-nbdy:kpje+nbdy, & - & nbgct_bur),stat=errstat) - IF (errstat.NE.0) STOP 'not enough memory bgct_sed' - IF (nbgct_bur.NE.0) bgct_bur=0. -#endif + if (.not. use_sedbypass) then + IF (mnproc.EQ.1) THEN + WRITE(io_stdo_bgc,*)'Memory allocation for variable bgctsed ...' + WRITE(io_stdo_bgc,*)'First dimension : ',kpie + WRITE(io_stdo_bgc,*)'Second dimension : ',kpje + WRITE(io_stdo_bgc,*)'Third dimension : ',ks + WRITE(io_stdo_bgc,*)'Forth dimension : ',nbgct_sed + ENDIF + + ALLOCATE (bgct_sed(1-nbdy:kpie+nbdy,1-nbdy:kpje+nbdy,ks, & + & nbgct_sed),stat=errstat) + IF (errstat.NE.0) STOP 'not enough memory bgct_sed' + IF (nbgct_sed.NE.0) bgct_sed=0. + + IF (mnproc.EQ.1) THEN + WRITE(io_stdo_bgc,*)'Memory allocation for variable bgctbur ...' + WRITE(io_stdo_bgc,*)'First dimension : ',kpie + WRITE(io_stdo_bgc,*)'Second dimension : ',kpje + WRITE(io_stdo_bgc,*)'Third dimension : ',nbgct_bur + ENDIF + + ALLOCATE (bgct_bur(1-nbdy:kpie+nbdy,1-nbdy:kpje+nbdy, & + & nbgct_bur),stat=errstat) + IF (errstat.NE.0) STOP 'not enough memory bgct_sed' + IF (nbgct_bur.NE.0) bgct_bur=0. + end if END SUBROUTINE ALLOC_MEM_BGCMEAN diff --git a/hamocc/mo_biomod.F90 b/hamocc/mo_biomod.F90 index 0703211d..f290f101 100644 --- a/hamocc/mo_biomod.F90 +++ b/hamocc/mo_biomod.F90 @@ -51,9 +51,9 @@ MODULE mo_biomod implicit none REAL, DIMENSION (:,:), ALLOCATABLE :: strahl -#ifdef FB_BGC_OCE + ! FB_BGC_OCE REAL, DIMENSION (:,:,:), ALLOCATABLE :: abs_oce -#endif + ! REAL, DIMENSION (:,:), ALLOCATABLE :: expoor REAL, DIMENSION (:,:), ALLOCATABLE :: expoca REAL, DIMENSION (:,:), ALLOCATABLE :: exposi @@ -82,16 +82,16 @@ MODULE mo_biomod REAL, DIMENSION (:,:), ALLOCATABLE :: calflx4000 REAL, DIMENSION (:,:), ALLOCATABLE :: calflx_bot REAL, DIMENSION (:,:,:), ALLOCATABLE :: phosy3d -#ifdef AGG + + ! AGG REAL, DIMENSION (:,:,:), ALLOCATABLE :: wmass REAL, DIMENSION (:,:,:), ALLOCATABLE :: wnumb REAL, DIMENSION (:,:,:), ALLOCATABLE :: eps3d REAL, DIMENSION (:,:,:), ALLOCATABLE :: asize3d -#endif -#ifdef BROMO + + ! BROMO REAL, DIMENSION (:,:), ALLOCATABLE :: int_chbr3_prod REAL, DIMENSION (:,:), ALLOCATABLE :: int_chbr3_uv -#endif REAL :: phytomi,grami,grazra,pi_alpha REAL :: remido,dyphy,zinges,epsher,spemor,gammap,gammaz,ecan @@ -102,32 +102,32 @@ MODULE mo_biomod REAL :: drempoc,dremopal,dremn2o,dremsul REAL :: perc_diron, riron, fesoly, relaxfe, fetune, wdust REAL :: ctochl, atten_w, atten_c, atten_uv, atten_f -#ifdef cisonew + ! cisonew REAL :: c14fac REAL :: re1312,re14to,prei13,prei14 REAL :: bifr13,bifr14,growth_co2,bifr13_perm -#endif -#ifdef AGG + + ! AGG REAL :: SinkExp, FractDim, Stick, cellmass, cellsink, fsh, fse REAL :: alow1, alow2,alow3,alar1,alar2,alar3,TSFac,TMFac REAL :: vsmall,safe,pupper,plower,zdis,nmldmin REAL :: dustd1,dustd2,dustd3,dustsink,calmax -#elif defined(WLIN) + + ! WLIN REAL :: wmin,wmax,wlin -#endif -#ifdef BROMO + + ! BROMO REAL :: rbro -#endif 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_ifdefs INTEGER, intent(in) :: kpie,kpje,kpke INTEGER :: errstat @@ -151,20 +151,18 @@ SUBROUTINE ALLOC_MEM_BIOMOD(kpie,kpje,kpke) 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 -#ifdef FB_BGC_OCE - 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 - + ALLOCATE (abs_oce(kpie,kpje,kpke),stat=errstat) + if(errstat.ne.0) stop 'not enough memory abs_oce' + abs_oce(:,:,:) = 0.0 + end if IF (mnproc.eq.1) THEN WRITE(io_stdo_bgc,*)'Memory allocation for variable expoor ...' @@ -321,69 +319,65 @@ SUBROUTINE ALLOC_MEM_BIOMOD(kpie,kpje,kpke) if(errstat.ne.0) stop 'not enough memory phosy3d' phosy3d(:,:,:) = 0.0 - -#ifdef AGG - 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 - -#ifdef BROMO - 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_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 + end if + + 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 + end if !****************************************************************************** END SUBROUTINE ALLOC_MEM_BIOMOD diff --git a/hamocc/mo_carbch.F90 b/hamocc/mo_carbch.F90 index b2e7f0a8..e079d404 100644 --- a/hamocc/mo_carbch.F90 +++ b/hamocc/mo_carbch.F90 @@ -82,34 +82,24 @@ MODULE mo_carbch REAL, DIMENSION (:,:), ALLOCATABLE :: co2solm REAL, DIMENSION (:,:), ALLOCATABLE :: co2fxd REAL, DIMENSION (:,:), ALLOCATABLE :: co2fxu -#ifdef cisonew REAL, DIMENSION (:,:), ALLOCATABLE :: co213fxd REAL, DIMENSION (:,:), ALLOCATABLE :: co213fxu REAL, DIMENSION (:,:), ALLOCATABLE :: co214fxd REAL, DIMENSION (:,:), ALLOCATABLE :: co214fxu -#endif REAL :: dmspar(6) -#ifdef natDIC REAL :: atm_co2_nat REAL, DIMENSION (:,:), ALLOCATABLE :: natpco2d REAL, DIMENSION (:,:,:), ALLOCATABLE :: nathi REAL, DIMENSION (:,:,:), ALLOCATABLE :: natco3 REAL, DIMENSION (:,:,:), ALLOCATABLE :: natOmegaA REAL, DIMENSION (:,:,:), ALLOCATABLE :: natOmegaC -#endif REAL :: atm_co2, atm_o2, atm_n2 REAL :: atm_c13, atm_c14 -#ifdef cisonew REAL :: c14_t_half, c14dec -#endif -#ifdef CFC REAL :: atm_cfc11_nh,atm_cfc11_sh REAL :: atm_cfc12_nh,atm_cfc12_sh REAL :: atm_sf6_nh,atm_sf6_sh -#endif -#ifdef BROMO REAL :: atm_bromo, fbro1, fbro2 -#endif CONTAINS @@ -120,10 +110,10 @@ SUBROUTINE ALLOC_MEM_CARBCH(kpie,kpje,kpke) use mod_xc, only: mnproc use mo_control_bgc, only: io_stdo_bgc use mo_param1_bgc, only: nocetra,npowtra,natm,nriv + use mo_ifdefs INTEGER, intent(in) :: kpie,kpje,kpke INTEGER :: errstat - IF (mnproc.eq.1) THEN WRITE(io_stdo_bgc,*)' ' @@ -192,52 +182,52 @@ SUBROUTINE ALLOC_MEM_CARBCH(kpie,kpje,kpke) OmegaA(:,:,:) = 0.0 OmegaC(:,:,:) = 0.0 -#ifdef natDIC - IF (mnproc.eq.1) THEN - WRITE(io_stdo_bgc,*)'Memory allocation for variable natpco2d ...' - WRITE(io_stdo_bgc,*)'First dimension : ',kpie - WRITE(io_stdo_bgc,*)'Second dimension : ',kpje - ENDIF - - ALLOCATE (natpco2d(kpie,kpje),stat=errstat) - if(errstat.ne.0) stop 'not enough memory natpco2d' - natpco2d(:,:) = 0.0 - - IF (mnproc.eq.1) THEN - WRITE(io_stdo_bgc,*)'Memory allocation for variable nathi ...' - WRITE(io_stdo_bgc,*)'First dimension : ',kpie - WRITE(io_stdo_bgc,*)'Second dimension : ',kpje - WRITE(io_stdo_bgc,*)'Third dimension : ',kpke - ENDIF - - ALLOCATE (nathi(kpie,kpje,kpke),stat=errstat) - if(errstat.ne.0) stop 'not enough memory nathi' - nathi(:,:,:) = 0.0 - - IF (mnproc.eq.1) THEN - WRITE(io_stdo_bgc,*)'Memory allocation for variable natco3 ...' - WRITE(io_stdo_bgc,*)'First dimension : ',kpie - WRITE(io_stdo_bgc,*)'Second dimension : ',kpje - WRITE(io_stdo_bgc,*)'Third dimension : ',kpke - ENDIF - - ALLOCATE (natco3(kpie,kpje,kpke),stat=errstat) - if(errstat.ne.0) stop 'not enough memory natco3' - natco3(:,:,:) = 0.0 - - IF (mnproc.eq.1) THEN - WRITE(io_stdo_bgc,*)'Memory allocation for variable natOmegaA, natOmegaC ...' - WRITE(io_stdo_bgc,*)'First dimension : ',kpie - WRITE(io_stdo_bgc,*)'Second dimension : ',kpje - WRITE(io_stdo_bgc,*)'Third dimension : ',kpke - ENDIF - - ALLOCATE (natOmegaA(kpie,kpje,kpke),stat=errstat) - ALLOCATE (natOmegaC(kpie,kpje,kpke),stat=errstat) - if(errstat.ne.0) stop 'not enough memory natOmegaA, natOmegaC' - natOmegaA(:,:,:) = 0.0 - natOmegaC(:,:,:) = 0.0 -#endif + if (use_natDIC) then + IF (mnproc.eq.1) THEN + WRITE(io_stdo_bgc,*)'Memory allocation for variable natpco2d ...' + WRITE(io_stdo_bgc,*)'First dimension : ',kpie + WRITE(io_stdo_bgc,*)'Second dimension : ',kpje + ENDIF + + ALLOCATE (natpco2d(kpie,kpje),stat=errstat) + if(errstat.ne.0) stop 'not enough memory natpco2d' + natpco2d(:,:) = 0.0 + + IF (mnproc.eq.1) THEN + WRITE(io_stdo_bgc,*)'Memory allocation for variable nathi ...' + WRITE(io_stdo_bgc,*)'First dimension : ',kpie + WRITE(io_stdo_bgc,*)'Second dimension : ',kpje + WRITE(io_stdo_bgc,*)'Third dimension : ',kpke + ENDIF + + ALLOCATE (nathi(kpie,kpje,kpke),stat=errstat) + if(errstat.ne.0) stop 'not enough memory nathi' + nathi(:,:,:) = 0.0 + + IF (mnproc.eq.1) THEN + WRITE(io_stdo_bgc,*)'Memory allocation for variable natco3 ...' + WRITE(io_stdo_bgc,*)'First dimension : ',kpie + WRITE(io_stdo_bgc,*)'Second dimension : ',kpje + WRITE(io_stdo_bgc,*)'Third dimension : ',kpke + ENDIF + + ALLOCATE (natco3(kpie,kpje,kpke),stat=errstat) + if(errstat.ne.0) stop 'not enough memory natco3' + natco3(:,:,:) = 0.0 + + IF (mnproc.eq.1) THEN + WRITE(io_stdo_bgc,*)'Memory allocation for variable natOmegaA, natOmegaC ...' + WRITE(io_stdo_bgc,*)'First dimension : ',kpie + WRITE(io_stdo_bgc,*)'Second dimension : ',kpje + WRITE(io_stdo_bgc,*)'Third dimension : ',kpke + ENDIF + + ALLOCATE (natOmegaA(kpie,kpje,kpke),stat=errstat) + ALLOCATE (natOmegaC(kpie,kpje,kpke),stat=errstat) + if(errstat.ne.0) stop 'not enough memory natOmegaA, natOmegaC' + natOmegaA(:,:,:) = 0.0 + natOmegaC(:,:,:) = 0.0 + end if IF (mnproc.eq.1) THEN WRITE(io_stdo_bgc,*)'Memory allocation for variable sedfluxo ..' @@ -412,23 +402,23 @@ SUBROUTINE ALLOC_MEM_CARBCH(kpie,kpje,kpke) co2fxd(:,:) = 0.0 co2fxu(:,:) = 0.0 -#ifdef cisonew - IF (mnproc.eq.1) THEN - WRITE(io_stdo_bgc,*)'Memory allocation for variable co213fxd,..., co214fxu ...' - WRITE(io_stdo_bgc,*)'First dimension : ',kpie - WRITE(io_stdo_bgc,*)'Second dimension : ',kpje - ENDIF - - ALLOCATE (co213fxd(kpie,kpje),stat=errstat) - ALLOCATE (co213fxu(kpie,kpje),stat=errstat) - ALLOCATE (co214fxd(kpie,kpje),stat=errstat) - ALLOCATE (co214fxu(kpie,kpje),stat=errstat) - if(errstat.ne.0) stop 'not enough memory co213fxd,..., co214fxu' - co213fxd(:,:) = 0.0 - co213fxu(:,:) = 0.0 - co214fxd(:,:) = 0.0 - co214fxu(:,:) = 0.0 -#endif + if (use_cisonew) then + IF (mnproc.eq.1) THEN + WRITE(io_stdo_bgc,*)'Memory allocation for variable co213fxd,..., co214fxu ...' + WRITE(io_stdo_bgc,*)'First dimension : ',kpie + WRITE(io_stdo_bgc,*)'Second dimension : ',kpje + ENDIF + + ALLOCATE (co213fxd(kpie,kpje),stat=errstat) + ALLOCATE (co213fxu(kpie,kpje),stat=errstat) + ALLOCATE (co214fxd(kpie,kpje),stat=errstat) + ALLOCATE (co214fxu(kpie,kpje),stat=errstat) + if(errstat.ne.0) stop 'not enough memory co213fxd,..., co214fxu' + co213fxd(:,:) = 0.0 + co213fxu(:,:) = 0.0 + co214fxd(:,:) = 0.0 + co214fxu(:,:) = 0.0 + end if !****************************************************************************** END SUBROUTINE ALLOC_MEM_CARBCH diff --git a/hamocc/mo_ifdefs.F90 b/hamocc/mo_ifdefs.F90 new file mode 100644 index 00000000..ae53a3ab --- /dev/null +++ b/hamocc/mo_ifdefs.F90 @@ -0,0 +1,72 @@ +module mo_ifdefs + + implicit none + public + +#ifdef BROMO + logical, parameter :: use_BROMO = .true. +#else + logical, parameter :: use_BROMO = .false. +#endif +#ifdef AGG + logical, parameter :: use_AGG = .true. +#else + logical, parameter :: use_AGG = .false. +#endif +#ifdef WLIN + logical, parameter :: use_WLIN = .true. +#else + logical, parameter :: use_WLIN = .false. +#endif +#ifdef natDIC + logical, parameter :: use_natDIC = .true. +#else + logical, parameter :: use_natDIC = .false. +#endif +#ifdef CFC + logical, parameter :: use_CFC = .true. +#else + logical, parameter :: use_CFC = .false. +#endif +#ifdef cisonew + logical, parameter :: use_cisonew = .true. +#else + logical, parameter :: use_cisonew = .false. +#endif +#ifdef PBGC_OCNP_TIMESTEP + logical, parameter :: use_PBGC_OCNP_TIMESTEP = .true. +#else + logical, parameter :: use_PBGC_OCNP_TIMESTEP = .false. +#endif +#ifdef PBGC_CK_TIMESTEP + logical, parameter :: use_PBGC_CK_TIMESTEP = .true. +#else + logical, parameter :: use_PBGC_CK_TIMESTEP = .false. +#endif +#ifdef FB_BGC_OCE + logical, parameter :: use_FB_BGC_OCE = .true. +#else + logical, parameter :: use_FB_BGC_OCE = .false. +#endif +#ifdef BOXATM + logical, parameter :: use_BOXATM = .true. +#else + logical, parameter :: use_BOXATM = .false. +#endif +#ifdef sedbypass + logical, parameter :: use_sedbypass = .true. +#else + logical, parameter :: use_sedbypass = .false. +#endif +#ifdef PROGCO2 + logical, parameter :: use_PROGCO2 = .true. +#else + logical, parameter :: use_PROGCO2 = .false. +#endif +#ifdef DIAGCO2 + logical, parameter :: use_DIAGCO2 = .true. +#else + logical, parameter :: use_DIAGCO2 = .false. +#endif + +end module mo_ifdefs diff --git a/hamocc/mo_intfcblom.F90 b/hamocc/mo_intfcblom.F90 index e0d78b3b..2c7c30f3 100644 --- a/hamocc/mo_intfcblom.F90 +++ b/hamocc/mo_intfcblom.F90 @@ -63,6 +63,7 @@ module mo_intfcblom ! *atm2* *REAL* - two time-level copy of atm ! !****************************************************************************** + use mo_ifdefs implicit none integer, parameter :: nphys=2 @@ -157,59 +158,58 @@ subroutine alloc_mem_intfcblom(kpie,kpje,kpke) if(errstat.ne.0) stop 'not enough memory omask' omask(:,:) = 0.0 -#ifndef sedbypass - IF(mnproc.eq.1) THEN - WRITE(io_stdo_bgc,*)'Memory allocation for variable sedlay2 ...' - WRITE(io_stdo_bgc,*)'First dimension : ',kpie - WRITE(io_stdo_bgc,*)'Second dimension : ',kpje - WRITE(io_stdo_bgc,*)'Third dimension : ',2*ks - WRITE(io_stdo_bgc,*)'Fourth dimension : ',nsedtra - ENDIF - - ALLOCATE (sedlay2(kpie,kpje,2*ks,nsedtra),stat=errstat) - if(errstat.ne.0) stop 'not enough memory sedlay2' - sedlay2(:,:,:,:) = 0.0 - - - IF(mnproc.eq.1) THEN - WRITE(io_stdo_bgc,*)'Memory allocation for variable powtra2 ...' - WRITE(io_stdo_bgc,*)'First dimension : ',kpie - WRITE(io_stdo_bgc,*)'Second dimension : ',kpje - WRITE(io_stdo_bgc,*)'Third dimension : ',2*ks - WRITE(io_stdo_bgc,*)'Fourth dimension : ',npowtra - ENDIF - - ALLOCATE (powtra2(kpie,kpje,2*ks,npowtra),stat=errstat) - if(errstat.ne.0) stop 'not enough memory powtra2' - powtra2(:,:,:,:) = 0.0 - - - IF(mnproc.eq.1) THEN - WRITE(io_stdo_bgc,*)'Memory allocation for variable burial2 ...' - WRITE(io_stdo_bgc,*)'First dimension : ',kpie - WRITE(io_stdo_bgc,*)'Second dimension : ',kpje - WRITE(io_stdo_bgc,*)'Third dimension : ',2 - WRITE(io_stdo_bgc,*)'Fourth dimension : ',nsedtra - ENDIF - - ALLOCATE (burial2(kpie,kpje,2,nsedtra),stat=errstat) - if(errstat.ne.0) stop 'not enough memory burial2' - burial2(:,:,:,:) = 0.0 -#endif - -#if defined(BOXATM) - IF (mnproc.eq.1) THEN - WRITE(io_stdo_bgc,*)'Memory allocation for variable atm2 ...' - WRITE(io_stdo_bgc,*)'First dimension : ',kpie - WRITE(io_stdo_bgc,*)'Second dimension : ',kpje - WRITE(io_stdo_bgc,*)'Third dimension : ',2 - WRITE(io_stdo_bgc,*)'Fourth dimension : ',natm - ENDIF - - ALLOCATE (atm2(kpie,kpje,2,natm),stat=errstat) - if(errstat.ne.0) stop 'not enough memory atm2' - atm2(:,:,:,:) = 0.0 -#endif + if (.not. use_sedbypass) then + IF(mnproc.eq.1) THEN + WRITE(io_stdo_bgc,*)'Memory allocation for variable sedlay2 ...' + WRITE(io_stdo_bgc,*)'First dimension : ',kpie + WRITE(io_stdo_bgc,*)'Second dimension : ',kpje + WRITE(io_stdo_bgc,*)'Third dimension : ',2*ks + WRITE(io_stdo_bgc,*)'Fourth dimension : ',nsedtra + ENDIF + + ALLOCATE (sedlay2(kpie,kpje,2*ks,nsedtra),stat=errstat) + if(errstat.ne.0) stop 'not enough memory sedlay2' + sedlay2(:,:,:,:) = 0.0 + + IF(mnproc.eq.1) THEN + WRITE(io_stdo_bgc,*)'Memory allocation for variable powtra2 ...' + WRITE(io_stdo_bgc,*)'First dimension : ',kpie + WRITE(io_stdo_bgc,*)'Second dimension : ',kpje + WRITE(io_stdo_bgc,*)'Third dimension : ',2*ks + WRITE(io_stdo_bgc,*)'Fourth dimension : ',npowtra + ENDIF + + ALLOCATE (powtra2(kpie,kpje,2*ks,npowtra),stat=errstat) + if(errstat.ne.0) stop 'not enough memory powtra2' + powtra2(:,:,:,:) = 0.0 + + + IF(mnproc.eq.1) THEN + WRITE(io_stdo_bgc,*)'Memory allocation for variable burial2 ...' + WRITE(io_stdo_bgc,*)'First dimension : ',kpie + WRITE(io_stdo_bgc,*)'Second dimension : ',kpje + WRITE(io_stdo_bgc,*)'Third dimension : ',2 + WRITE(io_stdo_bgc,*)'Fourth dimension : ',nsedtra + ENDIF + + ALLOCATE (burial2(kpie,kpje,2,nsedtra),stat=errstat) + if(errstat.ne.0) stop 'not enough memory burial2' + burial2(:,:,:,:) = 0.0 + end if + + if (use_BOXATM) then + IF (mnproc.eq.1) THEN + WRITE(io_stdo_bgc,*)'Memory allocation for variable atm2 ...' + WRITE(io_stdo_bgc,*)'First dimension : ',kpie + WRITE(io_stdo_bgc,*)'Second dimension : ',kpje + WRITE(io_stdo_bgc,*)'Third dimension : ',2 + WRITE(io_stdo_bgc,*)'Fourth dimension : ',natm + ENDIF + + ALLOCATE (atm2(kpie,kpje,2,natm),stat=errstat) + if(errstat.ne.0) stop 'not enough memory atm2' + atm2(:,:,:,:) = 0.0 + end if end subroutine alloc_mem_intfcblom !****************************************************************************** @@ -369,39 +369,39 @@ subroutine blom2hamocc(m,n,mm,nn) ! --- is kept outside HAMOCC) ! --- ------------------------------------------------------------------ -#ifndef sedbypass - nns=(n-1)*ks - -!$OMP PARALLEL DO PRIVATE(k,kn,l,i) - do k=1,ks - kn=k+nns - do j=1,jj - do l=1,isp(j) - do i=max(1,ifp(j,l)),min(ii,ilp(j,l)) - sedlay(i,j,k,:) = sedlay2(i,j,kn,:) - powtra(i,j,k,:) = powtra2(i,j,kn,:) - burial(i,j,:) = burial2(i,j,n,:) - enddo + if (.not. use_sedbypass) then + nns=(n-1)*ks + + !$OMP PARALLEL DO PRIVATE(k,kn,l,i) + do k=1,ks + kn=k+nns + do j=1,jj + do l=1,isp(j) + do i=max(1,ifp(j,l)),min(ii,ilp(j,l)) + sedlay(i,j,k,:) = sedlay2(i,j,kn,:) + powtra(i,j,k,:) = powtra2(i,j,kn,:) + burial(i,j,:) = burial2(i,j,n,:) + enddo + enddo + enddo enddo - enddo - enddo -!$OMP END PARALLEL DO -#endif + !$OMP END PARALLEL DO + end if ! --- ------------------------------------------------------------------ ! --- pass atmosphere fields if required (a two time-level copy of ! --- atmosphere fields is kept outside HAMOCC) ! --- ------------------------------------------------------------------ -#if defined(BOXATM) -!$OMP PARALLEL DO PRIVATE(i) - do j=1,jj - do i=1,ii - atm(i,j,:) = atm2(i,j,n,:) - enddo - enddo -!$OMP END PARALLEL DO -#endif + if (use_BOXATM) then + !$OMP PARALLEL DO PRIVATE(i) + do j=1,jj + do i=1,ii + atm(i,j,:) = atm2(i,j,n,:) + enddo + enddo + !$OMP END PARALLEL DO + end if end subroutine blom2hamocc !****************************************************************************** @@ -472,71 +472,71 @@ subroutine hamocc2blom(m,n,mm,nn) ! --- apply time smoothing for sediment fields and pass them back ! --- ------------------------------------------------------------------ -#ifndef sedbypass - nns=(n-1)*ks - mms=(m-1)*ks - -!$OMP PARALLEL DO PRIVATE(k,km,kn,l,i) - do k=1,ks - km=k+mms - kn=k+nns - do j=1,jj - do l=1,isp(j) - do i=max(1,ifp(j,l)),min(ii,ilp(j,l)) ! time smoothing (analog to tmsmt2.F) - sedlay2(i,j,km,:) = wts1*sedlay2(i,j,km,:) & ! mid timelevel - + wts2*sedlay2(i,j,kn,:) & ! old timelevel - + wts2*sedlay(i,j,k,:) ! new timelevel - powtra2(i,j,km,:) = wts1*powtra2(i,j,km,:) & - + wts2*powtra2(i,j,kn,:) & - + wts2*powtra(i,j,k,:) - burial2(i,j,m,:) = wts1*burial2(i,j,m,:) & - + wts2*burial2(i,j,n,:) & - + wts2*burial(i,j,:) - enddo + if (.not. use_sedbypass) then + nns=(n-1)*ks + mms=(m-1)*ks + + !$OMP PARALLEL DO PRIVATE(k,km,kn,l,i) + do k=1,ks + km=k+mms + kn=k+nns + do j=1,jj + do l=1,isp(j) + do i=max(1,ifp(j,l)),min(ii,ilp(j,l)) ! time smoothing (analog to tmsmt2.F) + sedlay2(i,j,km,:) = wts1*sedlay2(i,j,km,:) & ! mid timelevel + + wts2*sedlay2(i,j,kn,:) & ! old timelevel + + wts2*sedlay(i,j,k,:) ! new timelevel + powtra2(i,j,km,:) = wts1*powtra2(i,j,km,:) & + + wts2*powtra2(i,j,kn,:) & + + wts2*powtra(i,j,k,:) + burial2(i,j,m,:) = wts1*burial2(i,j,m,:) & + + wts2*burial2(i,j,n,:) & + + wts2*burial(i,j,:) + enddo + enddo + enddo enddo + !$OMP END PARALLEL DO + + !$OMP PARALLEL DO PRIVATE(k,kn,l,i) + do k=1,ks + kn=k+nns + do j=1,jj + do l=1,isp(j) + do i=max(1,ifp(j,l)),min(ii,ilp(j,l)) + sedlay2(i,j,kn,:) = sedlay(i,j,k,:) ! new time level replaces old time level here + powtra2(i,j,kn,:) = powtra(i,j,k,:) + burial2(i,j,n,:) = burial(i,j,:) + enddo + enddo + enddo enddo - enddo -!$OMP END PARALLEL DO - -!$OMP PARALLEL DO PRIVATE(k,kn,l,i) - do k=1,ks - kn=k+nns - do j=1,jj - do l=1,isp(j) - do i=max(1,ifp(j,l)),min(ii,ilp(j,l)) - sedlay2(i,j,kn,:) = sedlay(i,j,k,:) ! new time level replaces old time level here - powtra2(i,j,kn,:) = powtra(i,j,k,:) - burial2(i,j,n,:) = burial(i,j,:) - enddo - enddo - enddo - enddo -!$OMP END PARALLEL DO -#endif + !$OMP END PARALLEL DO + end if ! --- ------------------------------------------------------------------ ! --- apply time smoothing for atmosphere fields if required ! --- ------------------------------------------------------------------ -#if defined(BOXATM) -!$OMP PARALLEL DO PRIVATE(i) - do j=1,jj - do i=1,ii ! time smoothing (analog to tmsmt2.F) - atm2(i,j,m,:) = wts1*atm2(i,j,m,:) & ! mid timelevel - + wts2*atm2(i,j,n,:) & ! old timelevel - + wts2*atm(i,j,:) ! new timelevel - enddo - enddo -!$OMP END PARALLEL DO + if (use_BOXATM) then + !$OMP PARALLEL DO PRIVATE(i) + do j=1,jj + do i=1,ii ! time smoothing (analog to tmsmt2.F) + atm2(i,j,m,:) = wts1*atm2(i,j,m,:) & ! mid timelevel + + wts2*atm2(i,j,n,:) & ! old timelevel + + wts2*atm(i,j,:) ! new timelevel + enddo + enddo + !$OMP END PARALLEL DO -!$OMP PARALLEL DO PRIVATE(i) - do j=1,jj - do i=1,ii - atm2(i,j,n,:) = atm(i,j,:) ! new time level replaces old time level here - enddo - enddo -!$OMP END PARALLEL DO -#endif + !$OMP PARALLEL DO PRIVATE(i) + do j=1,jj + do i=1,ii + atm2(i,j,n,:) = atm(i,j,:) ! new time level replaces old time level here + enddo + enddo + !$OMP END PARALLEL DO + end if end subroutine hamocc2blom !****************************************************************************** diff --git a/hamocc/mo_param1_bgc.F90 b/hamocc/mo_param1_bgc.F90 index f18df794..d47268b2 100644 --- a/hamocc/mo_param1_bgc.F90 +++ b/hamocc/mo_param1_bgc.F90 @@ -38,6 +38,7 @@ MODULE mo_param1_bgc ! - definition of indices in tracer arrays ! !****************************************************************************** + use mo_ifdefs implicit none INTEGER, PARAMETER :: ks=12,ksp=ks+1 ! ks: nb of sediment layers @@ -246,7 +247,7 @@ MODULE mo_param1_bgc INTEGER, PARAMETER :: npowtra = i_pow_base + i_pow_cisonew ! Mapping between pore water and ocean tracers needed for pore water diffusion - INTEGER, SAVE :: map_por2octra(npowtra) + INTEGER, SAVE :: map_por2octra(-1:npowtra) contains @@ -259,10 +260,10 @@ subroutine init_por2octra_mapping() map_por2octra(ipown2) = igasnit map_por2octra(ipowno3) = iano3 map_por2octra(ipowasi) = isilica -#ifdef cisonew - map_por2octra(ipowc13) = isco213 - map_por2octra(ipowc14) = isco214 -#endif + if (use_cisonew) then + map_por2octra(ipowc13) = isco213 + map_por2octra(ipowc14) = isco214 + end if end subroutine init_por2octra_mapping diff --git a/hamocc/mo_sedmnt.F90 b/hamocc/mo_sedmnt.F90 index 7fab49b4..16d36ce8 100644 --- a/hamocc/mo_sedmnt.F90 +++ b/hamocc/mo_sedmnt.F90 @@ -72,6 +72,7 @@ MODULE mo_sedmnt use mo_param1_bgc, only: ks,ksp,nsedtra,npowtra use mo_control_bgc, only: io_stdo_bgc use mod_xc, only: mnproc + use mo_ifdefs implicit none @@ -188,11 +189,11 @@ SUBROUTINE ini_sedmnt(kpie,kpje,kpke,omask,sed_por) seddw(k) = 0.5 * (dzs(k) + dzs(k+1)) ! distance between grid cell centers (pressure points) enddo -#ifndef sedbypass - ! 2d and 3d fields are not allocated in case of sedbypass - ! so only initialize them if we are using the sediment - CALL ini_sedmnt_por(kpie,kpje,kpke,omask,sed_por) -#endif + if (.not. use_sedbypass) then + ! 2d and 3d fields are not allocated in case of sedbypass + ! so only initialize them if we are using the sediment + CALL ini_sedmnt_por(kpie,kpje,kpke,omask,sed_por) + end if END SUBROUTINE ini_sedmnt !======================================================================== @@ -320,14 +321,14 @@ SUBROUTINE ALLOC_MEM_SEDMNT(kpie,kpje) ALLOCATE (prorca(kpie,kpje),stat=errstat) if(errstat.ne.0) stop 'not enough memory prorca' prorca(:,:) = 0.0 -#ifdef cisonew - ALLOCATE (pror13(kpie,kpje),stat=errstat) - if(errstat.ne.0) stop 'not enough memory pror13' - pror13(:,:) = 0.0 - ALLOCATE (pror14(kpie,kpje),stat=errstat) - if(errstat.ne.0) stop 'not enough memory pror14' - pror14(:,:) = 0.0 -#endif + if (use_cisonew) then + ALLOCATE (pror13(kpie,kpje),stat=errstat) + if(errstat.ne.0) stop 'not enough memory pror13' + pror13(:,:) = 0.0 + ALLOCATE (pror14(kpie,kpje),stat=errstat) + if(errstat.ne.0) stop 'not enough memory pror14' + pror14(:,:) = 0.0 + end if IF (mnproc.eq.1) THEN WRITE(io_stdo_bgc,*)'Memory allocation for variable prcaca ...' @@ -338,14 +339,14 @@ SUBROUTINE ALLOC_MEM_SEDMNT(kpie,kpje) ALLOCATE (prcaca(kpie,kpje),stat=errstat) if(errstat.ne.0) stop 'not enough memory prcaca' prcaca(:,:) = 0.0 -#ifdef cisonew - ALLOCATE (prca13(kpie,kpje),stat=errstat) - if(errstat.ne.0) stop 'not enough memory prca13' - prca13(:,:) = 0.0 - ALLOCATE (prca14(kpie,kpje),stat=errstat) - if(errstat.ne.0) stop 'not enough memory prca14' - prca14(:,:) = 0.0 -#endif + if (use_cisonew) then + ALLOCATE (prca13(kpie,kpje),stat=errstat) + if(errstat.ne.0) stop 'not enough memory prca13' + prca13(:,:) = 0.0 + ALLOCATE (prca14(kpie,kpje),stat=errstat) + if(errstat.ne.0) stop 'not enough memory prca14' + prca14(:,:) = 0.0 + end if IF (mnproc.eq.1) THEN WRITE(io_stdo_bgc,*)'Memory allocation for variable produs ...' @@ -358,119 +359,119 @@ SUBROUTINE ALLOC_MEM_SEDMNT(kpie,kpje) produs(:,:) = 0.0 -#ifndef sedbypass - IF (mnproc.eq.1) THEN - WRITE(io_stdo_bgc,*)'Memory allocation for variable sedlay ...' - WRITE(io_stdo_bgc,*)'First dimension : ',kpie - WRITE(io_stdo_bgc,*)'Second dimension : ',kpje - WRITE(io_stdo_bgc,*)'Third dimension : ',ks - WRITE(io_stdo_bgc,*)'Forth dimension : ',nsedtra - ENDIF - - ALLOCATE (sedlay(kpie,kpje,ks,nsedtra),stat=errstat) - if(errstat.ne.0) stop 'not enough memory sedlay' - sedlay(:,:,:,:) = 0.0 - - - IF (mnproc.eq.1) THEN - WRITE(io_stdo_bgc,*)'Memory allocation for variable sedhpl ...' - WRITE(io_stdo_bgc,*)'First dimension : ',kpie - WRITE(io_stdo_bgc,*)'Second dimension : ',kpje - WRITE(io_stdo_bgc,*)'Third dimension : ',ks - ENDIF - - ALLOCATE (sedhpl(kpie,kpje,ks),stat=errstat) - if(errstat.ne.0) stop 'not enough memory sedhpl' - sedhpl(:,:,:) = 0.0 - - IF (mnproc.eq.1) THEN - WRITE(io_stdo_bgc,*)'Memory allocation for variable porsol ...' - WRITE(io_stdo_bgc,*)'First dimension : ',kpie - WRITE(io_stdo_bgc,*)'Second dimension : ',kpje - WRITE(io_stdo_bgc,*)'Third dimension : ',ks - ENDIF - - ALLOCATE (porsol(kpie,kpje,ks),stat=errstat) - if(errstat.ne.0) stop 'not enough memory porsol' - porsol(:,:,:) = 0.0 - - IF (mnproc.eq.1) THEN - WRITE(io_stdo_bgc,*)'Memory allocation for variable porwah ...' - WRITE(io_stdo_bgc,*)'First dimension : ',kpie - WRITE(io_stdo_bgc,*)'Second dimension : ',kpje - WRITE(io_stdo_bgc,*)'Third dimension : ',ks - ENDIF - - ALLOCATE (porwah(kpie,kpje,ks),stat=errstat) - if(errstat.ne.0) stop 'not enough memory porwah' - porwah(:,:,:) = 0.0 - - IF (mnproc.eq.1) THEN - WRITE(io_stdo_bgc,*)'Memory allocation for variable porwat ...' - WRITE(io_stdo_bgc,*)'First dimension : ',kpie - WRITE(io_stdo_bgc,*)'Second dimension : ',kpje - WRITE(io_stdo_bgc,*)'Third dimension : ',ks - ENDIF - - ALLOCATE (porwat(kpie,kpje,ks),stat=errstat) - if(errstat.ne.0) stop 'not enough memory porwat' - porwat(:,:,:) = 0.0 - - IF (mnproc.eq.1) THEN - WRITE(io_stdo_bgc,*)'Memory allocation for variable solfu ...' - WRITE(io_stdo_bgc,*)'First dimension : ',kpie - WRITE(io_stdo_bgc,*)'Second dimension : ',kpje - ENDIF - - ALLOCATE (solfu(kpie,kpje),stat=errstat) - if(errstat.ne.0) stop 'not enough memory solfu' - solfu(:,:) = 0.0 - - IF (mnproc.eq.1) THEN - WRITE(io_stdo_bgc,*)'Memory allocation for variable zcoefsu ...' - WRITE(io_stdo_bgc,*)'First dimension : ',kpie - WRITE(io_stdo_bgc,*)'Second dimension : ',kpje - WRITE(io_stdo_bgc,*)'Third dimension : ',ks - ENDIF - - ALLOCATE (zcoefsu(kpie,kpje,0:ks),stat=errstat) - if(errstat.ne.0) stop 'not enough memory zcoefsu' - zcoefsu(:,:,:) = 0.0 - - IF (mnproc.eq.1) THEN - WRITE(io_stdo_bgc,*)'Memory allocation for variable zcoeflo ...' - WRITE(io_stdo_bgc,*)'First dimension : ',kpie - WRITE(io_stdo_bgc,*)'Second dimension : ',kpje - WRITE(io_stdo_bgc,*)'Third dimension : ',ks - ENDIF - - ALLOCATE (zcoeflo(kpie,kpje,0:ks),stat=errstat) - if(errstat.ne.0) stop 'not enough memory zcoeflo' - zcoeflo(:,:,:) = 0.0 - - IF (mnproc.eq.1) THEN - WRITE(io_stdo_bgc,*)'Memory allocation for variable burial ...' - WRITE(io_stdo_bgc,*)'First dimension : ',kpie - WRITE(io_stdo_bgc,*)'Second dimension : ',kpje - WRITE(io_stdo_bgc,*)'Third dimension : ',nsedtra - ENDIF - - ALLOCATE (burial(kpie,kpje,nsedtra),stat=errstat) - if(errstat.ne.0) stop 'not enough memory burial' - burial(:,:,:) = 0.0 - - IF (mnproc.eq.1) THEN - WRITE(io_stdo_bgc,*)'Memory allocation for variable powtra ...' - WRITE(io_stdo_bgc,*)'First dimension : ',kpie - WRITE(io_stdo_bgc,*)'Second dimension : ',kpje - WRITE(io_stdo_bgc,*)'Third dimension : ',ks - WRITE(io_stdo_bgc,*)'Forth dimension : ',npowtra - ENDIF - - ALLOCATE (powtra(kpie,kpje,ks,npowtra),stat=errstat) - if(errstat.ne.0) stop 'not enough memory powtra' - powtra(:,:,:,:) = 0.0 -#endif + if (.not. use_sedbypass) then + IF (mnproc.eq.1) THEN + WRITE(io_stdo_bgc,*)'Memory allocation for variable sedlay ...' + WRITE(io_stdo_bgc,*)'First dimension : ',kpie + WRITE(io_stdo_bgc,*)'Second dimension : ',kpje + WRITE(io_stdo_bgc,*)'Third dimension : ',ks + WRITE(io_stdo_bgc,*)'Forth dimension : ',nsedtra + ENDIF + + ALLOCATE (sedlay(kpie,kpje,ks,nsedtra),stat=errstat) + if(errstat.ne.0) stop 'not enough memory sedlay' + sedlay(:,:,:,:) = 0.0 + + + IF (mnproc.eq.1) THEN + WRITE(io_stdo_bgc,*)'Memory allocation for variable sedhpl ...' + WRITE(io_stdo_bgc,*)'First dimension : ',kpie + WRITE(io_stdo_bgc,*)'Second dimension : ',kpje + WRITE(io_stdo_bgc,*)'Third dimension : ',ks + ENDIF + + ALLOCATE (sedhpl(kpie,kpje,ks),stat=errstat) + if(errstat.ne.0) stop 'not enough memory sedhpl' + sedhpl(:,:,:) = 0.0 + + IF (mnproc.eq.1) THEN + WRITE(io_stdo_bgc,*)'Memory allocation for variable porsol ...' + WRITE(io_stdo_bgc,*)'First dimension : ',kpie + WRITE(io_stdo_bgc,*)'Second dimension : ',kpje + WRITE(io_stdo_bgc,*)'Third dimension : ',ks + ENDIF + + ALLOCATE (porsol(kpie,kpje,ks),stat=errstat) + if(errstat.ne.0) stop 'not enough memory porsol' + porsol(:,:,:) = 0.0 + + IF (mnproc.eq.1) THEN + WRITE(io_stdo_bgc,*)'Memory allocation for variable porwah ...' + WRITE(io_stdo_bgc,*)'First dimension : ',kpie + WRITE(io_stdo_bgc,*)'Second dimension : ',kpje + WRITE(io_stdo_bgc,*)'Third dimension : ',ks + ENDIF + + ALLOCATE (porwah(kpie,kpje,ks),stat=errstat) + if(errstat.ne.0) stop 'not enough memory porwah' + porwah(:,:,:) = 0.0 + + IF (mnproc.eq.1) THEN + WRITE(io_stdo_bgc,*)'Memory allocation for variable porwat ...' + WRITE(io_stdo_bgc,*)'First dimension : ',kpie + WRITE(io_stdo_bgc,*)'Second dimension : ',kpje + WRITE(io_stdo_bgc,*)'Third dimension : ',ks + ENDIF + + ALLOCATE (porwat(kpie,kpje,ks),stat=errstat) + if(errstat.ne.0) stop 'not enough memory porwat' + porwat(:,:,:) = 0.0 + + IF (mnproc.eq.1) THEN + WRITE(io_stdo_bgc,*)'Memory allocation for variable solfu ...' + WRITE(io_stdo_bgc,*)'First dimension : ',kpie + WRITE(io_stdo_bgc,*)'Second dimension : ',kpje + ENDIF + + ALLOCATE (solfu(kpie,kpje),stat=errstat) + if(errstat.ne.0) stop 'not enough memory solfu' + solfu(:,:) = 0.0 + + IF (mnproc.eq.1) THEN + WRITE(io_stdo_bgc,*)'Memory allocation for variable zcoefsu ...' + WRITE(io_stdo_bgc,*)'First dimension : ',kpie + WRITE(io_stdo_bgc,*)'Second dimension : ',kpje + WRITE(io_stdo_bgc,*)'Third dimension : ',ks + ENDIF + + ALLOCATE (zcoefsu(kpie,kpje,0:ks),stat=errstat) + if(errstat.ne.0) stop 'not enough memory zcoefsu' + zcoefsu(:,:,:) = 0.0 + + IF (mnproc.eq.1) THEN + WRITE(io_stdo_bgc,*)'Memory allocation for variable zcoeflo ...' + WRITE(io_stdo_bgc,*)'First dimension : ',kpie + WRITE(io_stdo_bgc,*)'Second dimension : ',kpje + WRITE(io_stdo_bgc,*)'Third dimension : ',ks + ENDIF + + ALLOCATE (zcoeflo(kpie,kpje,0:ks),stat=errstat) + if(errstat.ne.0) stop 'not enough memory zcoeflo' + zcoeflo(:,:,:) = 0.0 + + IF (mnproc.eq.1) THEN + WRITE(io_stdo_bgc,*)'Memory allocation for variable burial ...' + WRITE(io_stdo_bgc,*)'First dimension : ',kpie + WRITE(io_stdo_bgc,*)'Second dimension : ',kpje + WRITE(io_stdo_bgc,*)'Third dimension : ',nsedtra + ENDIF + + ALLOCATE (burial(kpie,kpje,nsedtra),stat=errstat) + if(errstat.ne.0) stop 'not enough memory burial' + burial(:,:,:) = 0.0 + + IF (mnproc.eq.1) THEN + WRITE(io_stdo_bgc,*)'Memory allocation for variable powtra ...' + WRITE(io_stdo_bgc,*)'First dimension : ',kpie + WRITE(io_stdo_bgc,*)'Second dimension : ',kpje + WRITE(io_stdo_bgc,*)'Third dimension : ',ks + WRITE(io_stdo_bgc,*)'Forth dimension : ',npowtra + ENDIF + + ALLOCATE (powtra(kpie,kpje,ks,npowtra),stat=errstat) + if(errstat.ne.0) stop 'not enough memory powtra' + powtra(:,:,:,:) = 0.0 + end if !****************************************************************************** diff --git a/hamocc/ncout_hamocc.F90 b/hamocc/ncout_hamocc.F90 index 7d29652e..1bf7760e 100644 --- a/hamocc/ncout_hamocc.F90 +++ b/hamocc/ncout_hamocc.F90 @@ -110,24 +110,22 @@ subroutine ncwrt_bgc(iogrp) & filemon_bgc,fileann_bgc,ip,wrtlyr,wrtlvl,wrtsrf, & & loglyr,loglvl,logsrf,inilvl,inilyr,inisrf, & & msklvl,msksrf,finlyr -#ifdef AGG + ! AGG use mo_bgcmean, only: lyr_nos,lyr_wphy, lyr_wnos,lyr_eps, & & lyr_asize,lvl_nos,lvl_wphy,lvl_wnos,lvl_eps, & & lvl_asize -#endif -#ifdef BROMO + ! BROMO use mo_bgcmean, only: jbromo,jbromofx,jsrfbromo,jbromo_prod, & & jbromo_uv,jatmbromo,lvl_bromo,srf_bromofx, & & srf_bromo,int_bromopro,int_bromouv, & & srf_atmbromo,lyr_bromo -#endif -#ifdef CFC + ! CFC use mo_bgcmean,only: jcfc11,jcfc12,jsf6,jcfc11fx,jcfc12fx,jsf6fx, & & lvl_cfc11,lvl_cfc12,lvl_sf6,srf_cfc11, & & srf_cfc12,srf_sf6,lyr_cfc11,lyr_cfc12, & & lyr_sf6 -#endif -#ifdef cisonew + + ! cisonew use mo_biomod, only: c14fac use mo_bgcmean, only: jdic13,jdic14,jd13c,jd14c,jbigd14c,jpoc13, & & jdoc13,jcalc13,jphyto13,jgrazer13,jco213fxd, & @@ -140,8 +138,7 @@ subroutine ncwrt_bgc(iogrp) & lyr_grazer13,lvl_dic13,lvl_dic14,lvl_d13c, & & lvl_d14c,lvl_bigd14c,lvl_poc13,lvl_doc13, & & lvl_calc13,lvl_phyto13,lvl_grazer13 -#endif -#ifdef natDIC + ! natDIC use mo_bgcmean, only: jnatalkali,jnatdic,jnatcalc,jnatco3,jnatph, & & jnatomegaa,jnatomegac,jlvlnatph, & & jsrfnatdic,jsrfnatalk,jsrfnatph, & @@ -151,8 +148,7 @@ subroutine ncwrt_bgc(iogrp) & lvl_natalkali,lvl_natdic,lvl_natph,lvl_natcalc, & & lvl_natomegaa,lvl_natomegac,srf_natdic, & & srf_natalkali,srf_natpco2,srf_natco2fx,srf_natph -#endif -#ifndef sedbypass + ! NOT sedbypass use mo_bgcmean, only: jpowaic,jpowaal,jpowaph,jpowaox,jpown2, & & jpowno3,jpowasi,jssso12,jssssil,jssster, & & jsssc12,jbursssc12,jburssssil,jburssster, & @@ -161,7 +157,10 @@ subroutine ncwrt_bgc(iogrp) & sdm_ssssil,sdm_sssc12,sdm_ssster,jburssso12, & & bur_sssc12,bur_ssssil,bur_ssster,bur_ssso12, & & inisdm,inibur,wrtsdm,accbur,accsdm,wrtbur -#endif + ! BOXATM + use mo_bgcmean, only: jatmco2,jatmn2,jatmo2,srf_atmo2,srf_atmn2 + + use mo_ifdefs implicit none @@ -267,42 +266,42 @@ subroutine ncwrt_bgc(iogrp) call finlyr(jprefalk(iogrp),jdp(iogrp)) call finlyr(jprefdic(iogrp),jdp(iogrp)) call finlyr(jdicsat(iogrp),jdp(iogrp)) -#ifdef cisonew - call finlyr(jdic13(iogrp),jdp(iogrp)) - call finlyr(jdic14(iogrp),jdp(iogrp)) - call finlyr(jd13c(iogrp),jdp(iogrp)) - call finlyr(jd14c(iogrp),jdp(iogrp)) - call finlyr(jbigd14c(iogrp),jdp(iogrp)) - call finlyr(jpoc13(iogrp),jdp(iogrp)) - call finlyr(jdoc13(iogrp),jdp(iogrp)) - call finlyr(jcalc13(iogrp),jdp(iogrp)) - call finlyr(jphyto13(iogrp),jdp(iogrp)) - call finlyr(jgrazer13(iogrp),jdp(iogrp)) -#endif -#ifdef AGG - call finlyr(jnos(iogrp),jdp(iogrp)) - call finlyr(jwphy(iogrp),jdp(iogrp)) - call finlyr(jwnos(iogrp),jdp(iogrp)) - call finlyr(jeps(iogrp),jdp(iogrp)) - call finlyr(jasize(iogrp),jdp(iogrp)) -#endif -#ifdef CFC - call finlyr(jcfc11(iogrp),jdp(iogrp)) - call finlyr(jcfc12(iogrp),jdp(iogrp)) - call finlyr(jsf6(iogrp),jdp(iogrp)) -#endif -#ifdef natDIC - call finlyr(jnatalkali(iogrp),jdp(iogrp)) - call finlyr(jnatdic(iogrp),jdp(iogrp)) - call finlyr(jnatcalc(iogrp),jdp(iogrp)) - call finlyr(jnatco3(iogrp),jdp(iogrp)) - call finlyr(jnatph(iogrp),jdp(iogrp)) - call finlyr(jnatomegaa(iogrp),jdp(iogrp)) - call finlyr(jnatomegac(iogrp),jdp(iogrp)) -#endif -#ifdef BROMO - call finlyr(jbromo(iogrp),jdp(iogrp)) -#endif + if (use_cisonew) then + call finlyr(jdic13(iogrp),jdp(iogrp)) + call finlyr(jdic14(iogrp),jdp(iogrp)) + call finlyr(jd13c(iogrp),jdp(iogrp)) + call finlyr(jd14c(iogrp),jdp(iogrp)) + call finlyr(jbigd14c(iogrp),jdp(iogrp)) + call finlyr(jpoc13(iogrp),jdp(iogrp)) + call finlyr(jdoc13(iogrp),jdp(iogrp)) + call finlyr(jcalc13(iogrp),jdp(iogrp)) + call finlyr(jphyto13(iogrp),jdp(iogrp)) + call finlyr(jgrazer13(iogrp),jdp(iogrp)) + end if + if (use_AGG) then + call finlyr(jnos(iogrp),jdp(iogrp)) + call finlyr(jwphy(iogrp),jdp(iogrp)) + call finlyr(jwnos(iogrp),jdp(iogrp)) + call finlyr(jeps(iogrp),jdp(iogrp)) + call finlyr(jasize(iogrp),jdp(iogrp)) + end if + if (use_CFC) then + call finlyr(jcfc11(iogrp),jdp(iogrp)) + call finlyr(jcfc12(iogrp),jdp(iogrp)) + call finlyr(jsf6(iogrp),jdp(iogrp)) + end if + if (use_natDIC) then + call finlyr(jnatalkali(iogrp),jdp(iogrp)) + call finlyr(jnatdic(iogrp),jdp(iogrp)) + call finlyr(jnatcalc(iogrp),jdp(iogrp)) + call finlyr(jnatco3(iogrp),jdp(iogrp)) + call finlyr(jnatph(iogrp),jdp(iogrp)) + call finlyr(jnatomegaa(iogrp),jdp(iogrp)) + call finlyr(jnatomegac(iogrp),jdp(iogrp)) + end if + if (use_BROMO) then + call finlyr(jbromo(iogrp),jdp(iogrp)) + end if ! --- Mask sea floor in mass fluxes call msksrf(jcarflx0100(iogrp),k0100) @@ -347,52 +346,52 @@ subroutine ncwrt_bgc(iogrp) call msklvl(jlvlprefalk(iogrp),depths) call msklvl(jlvlprefdic(iogrp),depths) call msklvl(jlvldicsat(iogrp),depths) -#ifdef cisonew - call msklvl(jlvldic13(iogrp),depths) - call msklvl(jlvldic14(iogrp),depths) - call msklvl(jlvld13c(iogrp),depths) - call msklvl(jlvld14c(iogrp),depths) - call msklvl(jlvlbigd14c(iogrp),depths) - call msklvl(jlvlpoc13(iogrp),depths) - call msklvl(jlvldoc13(iogrp),depths) - call msklvl(jlvlcalc13(iogrp),depths) - call msklvl(jlvlphyto13(iogrp),depths) - call msklvl(jlvlgrazer13(iogrp),depths) -#endif -#ifdef AGG - call msklvl(jlvlnos(iogrp),depths) - call msklvl(jlvlwphy(iogrp),depths) - call msklvl(jlvlwnos(iogrp),depths) - call msklvl(jlvleps(iogrp),depths) - call msklvl(jlvlasize(iogrp),depths) -#endif -#ifdef CFC - call msklvl(jlvlcfc11(iogrp),depths) - call msklvl(jlvlcfc12(iogrp),depths) - call msklvl(jlvlsf6(iogrp),depths) -#endif -#ifdef natDIC - call msklvl(jlvlnatalkali(iogrp),depths) - call msklvl(jlvlnatdic(iogrp),depths) - call msklvl(jlvlnatcalc(iogrp),depths) - call msklvl(jlvlnatco3(iogrp),depths) - call msklvl(jlvlnatph(iogrp),depths) - call msklvl(jlvlnatomegaa(iogrp),depths) - call msklvl(jlvlnatomegac(iogrp),depths) -#endif -#ifdef BROMO - call msklvl(jlvlbromo(iogrp),depths) -#endif + if (use_cisonew) then + call msklvl(jlvldic13(iogrp),depths) + call msklvl(jlvldic14(iogrp),depths) + call msklvl(jlvld13c(iogrp),depths) + call msklvl(jlvld14c(iogrp),depths) + call msklvl(jlvlbigd14c(iogrp),depths) + call msklvl(jlvlpoc13(iogrp),depths) + call msklvl(jlvldoc13(iogrp),depths) + call msklvl(jlvlcalc13(iogrp),depths) + call msklvl(jlvlphyto13(iogrp),depths) + call msklvl(jlvlgrazer13(iogrp),depths) + end if + if (use_AGG) then + call msklvl(jlvlnos(iogrp),depths) + call msklvl(jlvlwphy(iogrp),depths) + call msklvl(jlvlwnos(iogrp),depths) + call msklvl(jlvleps(iogrp),depths) + call msklvl(jlvlasize(iogrp),depths) + end if + if (use_CFC) then + call msklvl(jlvlcfc11(iogrp),depths) + call msklvl(jlvlcfc12(iogrp),depths) + call msklvl(jlvlsf6(iogrp),depths) + end if + if (use_natDIC) then + call msklvl(jlvlnatalkali(iogrp),depths) + call msklvl(jlvlnatdic(iogrp),depths) + call msklvl(jlvlnatcalc(iogrp),depths) + call msklvl(jlvlnatco3(iogrp),depths) + call msklvl(jlvlnatph(iogrp),depths) + call msklvl(jlvlnatomegaa(iogrp),depths) + call msklvl(jlvlnatomegac(iogrp),depths) + end if + if (use_BROMO) then + call msklvl(jlvlbromo(iogrp),depths) + end if ! --- Compute log10 of pH if (SRF_PH(iogrp).ne.0) call logsrf(jsrfph(iogrp),rnacc,0.) if (LYR_PH(iogrp).ne.0) call loglyr(jph(iogrp),1.,0.) if (LVL_PH(iogrp).ne.0) call loglvl(jlvlph(iogrp),rnacc,0.) -#ifdef natDIC - if (SRF_NATPH(iogrp).ne.0) call logsrf(jsrfnatph(iogrp),rnacc,0.) - if (LYR_NATPH(iogrp).ne.0) call loglyr(jnatph(iogrp),1.,0.) - if (LVL_NATPH(iogrp).ne.0) call loglvl(jlvlnatph(iogrp),rnacc,0.) -#endif + if (use_natDIC) then + if (SRF_NATPH(iogrp).ne.0) call logsrf(jsrfnatph(iogrp),rnacc,0.) + if (LYR_NATPH(iogrp).ne.0) call loglyr(jnatph(iogrp),1.,0.) + if (LVL_NATPH(iogrp).ne.0) call loglvl(jlvlnatph(iogrp),rnacc,0.) + end if ! --- Store 2d fields call wrtsrf(jkwco2(iogrp), SRF_KWCO2(iogrp), rnacc, 0.,cmpflg,'kwco2') @@ -446,49 +445,49 @@ subroutine ncwrt_bgc(iogrp) call wrtsrf(jcalflx2000(iogrp), FLX_CAL2000(iogrp), rnacc*1e3/dtbgc,0.,cmpflg,'calflx2000') call wrtsrf(jcalflx4000(iogrp), FLX_CAL4000(iogrp), rnacc*1e3/dtbgc,0.,cmpflg,'calflx4000') call wrtsrf(jcalflx_bot(iogrp), FLX_CAL_BOT(iogrp), rnacc*1e3/dtbgc,0.,cmpflg,'calflx_bot') -#ifndef sedbypass - call wrtsrf(jsediffic(iogrp), FLX_SEDIFFIC(iogrp), rnacc*1e3/dtbgc,0.,cmpflg,'sedfdic') - call wrtsrf(jsediffal(iogrp), FLX_SEDIFFAL(iogrp), rnacc*1e3/dtbgc,0.,cmpflg,'sedfalk') - call wrtsrf(jsediffph(iogrp), FLX_SEDIFFPH(iogrp), rnacc*1e3/dtbgc,0.,cmpflg,'sedfpho') - call wrtsrf(jsediffox(iogrp), FLX_SEDIFFOX(iogrp), rnacc*1e3/dtbgc,0.,cmpflg,'sedfox') - call wrtsrf(jsediffn2(iogrp), FLX_SEDIFFN2(iogrp), rnacc*1e3/dtbgc,0.,cmpflg,'sedfn2') - call wrtsrf(jsediffno3(iogrp), FLX_SEDIFFNO3(iogrp),rnacc*1e3/dtbgc,0.,cmpflg,'sedfno3') - call wrtsrf(jsediffsi(iogrp), FLX_SEDIFFSI(iogrp), rnacc*1e3/dtbgc,0.,cmpflg,'sedfsi') -#endif -#ifdef cisonew - call wrtsrf(jco213fxd(iogrp), SRF_CO213FXD(iogrp), rnacc*12./dtbgc,0.,cmpflg,'co213fxd') - call wrtsrf(jco213fxu(iogrp), SRF_CO213FXU(iogrp), rnacc*12./dtbgc,0.,cmpflg,'co213fxu') - call wrtsrf(jco214fxd(iogrp), SRF_CO214FXD(iogrp), rnacc*12.*c14fac/dtbgc,0.,cmpflg,'co214fxd') - call wrtsrf(jco214fxu(iogrp), SRF_CO214FXU(iogrp), rnacc*12.*c14fac/dtbgc,0.,cmpflg,'co214fxu') -#endif -#ifdef CFC - call wrtsrf(jcfc11fx(iogrp), SRF_CFC11(iogrp), rnacc*1e3/dtbgc,0.,cmpflg,'cfc11flux') - call wrtsrf(jcfc12fx(iogrp), SRF_CFC12(iogrp), rnacc*1e3/dtbgc,0.,cmpflg,'cfc12flux') - call wrtsrf(jsf6fx(iogrp), SRF_SF6(iogrp), rnacc*1e3/dtbgc,0.,cmpflg,'sf6flux') -#endif -#ifdef natDIC - call wrtsrf(jsrfnatdic(iogrp), SRF_NATDIC(iogrp), rnacc*1e3, 0.,cmpflg,'srfnatdissic') - call wrtsrf(jsrfnatalk(iogrp), SRF_NATALKALI(iogrp),rnacc*1e3, 0.,cmpflg,'srfnattalk') - call wrtsrf(jnatpco2(iogrp), SRF_NATPCO2(iogrp), rnacc, 0.,cmpflg,'natpco2') - call wrtsrf(jnatco2fx(iogrp), SRF_NATCO2FX(iogrp), rnacc*12./dtbgc,0.,cmpflg,'natco2fx') - call wrtsrf(jsrfnatph(iogrp), SRF_NATPH(iogrp), -1., 0.,cmpflg,'srfnatph') -#endif -#ifdef BROMO - call wrtsrf(jbromofx(iogrp), SRF_BROMOFX(iogrp), rnacc*1e3/dtbgc,0.,cmpflg,'bromofx') - call wrtsrf(jsrfbromo(iogrp), SRF_BROMO(iogrp), rnacc*1e3, 0.,cmpflg,'srfbromo') - call wrtsrf(jbromo_prod(iogrp), INT_BROMOPRO(iogrp), rnacc*1e3/dtbgc,0.,cmpflg,'intbromoprod') - call wrtsrf(jbromo_uv(iogrp), INT_BROMOUV(iogrp), rnacc*1e3/dtbgc,0.,cmpflg,'intbromouv') - call wrtsrf(jatmbromo(iogrp), SRF_ATMBROMO(iogrp), rnacc, 0.,cmpflg,'atmbromo') -#endif + if (.not. use_sedbypass) then + call wrtsrf(jsediffic(iogrp), FLX_SEDIFFIC(iogrp), rnacc*1e3/dtbgc,0.,cmpflg,'sedfdic') + call wrtsrf(jsediffal(iogrp), FLX_SEDIFFAL(iogrp), rnacc*1e3/dtbgc,0.,cmpflg,'sedfalk') + call wrtsrf(jsediffph(iogrp), FLX_SEDIFFPH(iogrp), rnacc*1e3/dtbgc,0.,cmpflg,'sedfpho') + call wrtsrf(jsediffox(iogrp), FLX_SEDIFFOX(iogrp), rnacc*1e3/dtbgc,0.,cmpflg,'sedfox') + call wrtsrf(jsediffn2(iogrp), FLX_SEDIFFN2(iogrp), rnacc*1e3/dtbgc,0.,cmpflg,'sedfn2') + call wrtsrf(jsediffno3(iogrp), FLX_SEDIFFNO3(iogrp),rnacc*1e3/dtbgc,0.,cmpflg,'sedfno3') + call wrtsrf(jsediffsi(iogrp), FLX_SEDIFFSI(iogrp), rnacc*1e3/dtbgc,0.,cmpflg,'sedfsi') + end if + if (use_cisonew) then + call wrtsrf(jco213fxd(iogrp), SRF_CO213FXD(iogrp), rnacc*12./dtbgc,0.,cmpflg,'co213fxd') + call wrtsrf(jco213fxu(iogrp), SRF_CO213FXU(iogrp), rnacc*12./dtbgc,0.,cmpflg,'co213fxu') + call wrtsrf(jco214fxd(iogrp), SRF_CO214FXD(iogrp), rnacc*12.*c14fac/dtbgc,0.,cmpflg,'co214fxd') + call wrtsrf(jco214fxu(iogrp), SRF_CO214FXU(iogrp), rnacc*12.*c14fac/dtbgc,0.,cmpflg,'co214fxu') + end if + if (use_CFC) then + call wrtsrf(jcfc11fx(iogrp), SRF_CFC11(iogrp), rnacc*1e3/dtbgc,0.,cmpflg,'cfc11flux') + call wrtsrf(jcfc12fx(iogrp), SRF_CFC12(iogrp), rnacc*1e3/dtbgc,0.,cmpflg,'cfc12flux') + call wrtsrf(jsf6fx(iogrp), SRF_SF6(iogrp), rnacc*1e3/dtbgc,0.,cmpflg,'sf6flux') + end if + if (use_natDIC) then + call wrtsrf(jsrfnatdic(iogrp), SRF_NATDIC(iogrp), rnacc*1e3, 0.,cmpflg,'srfnatdissic') + call wrtsrf(jsrfnatalk(iogrp), SRF_NATALKALI(iogrp),rnacc*1e3, 0.,cmpflg,'srfnattalk') + call wrtsrf(jnatpco2(iogrp), SRF_NATPCO2(iogrp), rnacc, 0.,cmpflg,'natpco2') + call wrtsrf(jnatco2fx(iogrp), SRF_NATCO2FX(iogrp), rnacc*12./dtbgc,0.,cmpflg,'natco2fx') + call wrtsrf(jsrfnatph(iogrp), SRF_NATPH(iogrp), -1., 0.,cmpflg,'srfnatph') + end if + if (use_BROMO) then + call wrtsrf(jbromofx(iogrp), SRF_BROMOFX(iogrp), rnacc*1e3/dtbgc,0.,cmpflg,'bromofx') + call wrtsrf(jsrfbromo(iogrp), SRF_BROMO(iogrp), rnacc*1e3, 0.,cmpflg,'srfbromo') + call wrtsrf(jbromo_prod(iogrp), INT_BROMOPRO(iogrp), rnacc*1e3/dtbgc,0.,cmpflg,'intbromoprod') + call wrtsrf(jbromo_uv(iogrp), INT_BROMOUV(iogrp), rnacc*1e3/dtbgc,0.,cmpflg,'intbromouv') + call wrtsrf(jatmbromo(iogrp), SRF_ATMBROMO(iogrp), rnacc, 0.,cmpflg,'atmbromo') + end if call wrtsrf(jatmco2(iogrp), SRF_ATMCO2(iogrp), rnacc, 0.,cmpflg,'atmco2') -#if defined(BOXATM) - call wrtsrf(jatmo2(iogrp), SRF_ATMO2(iogrp), rnacc, 0.,cmpflg,'atmo2') - call wrtsrf(jatmn2(iogrp), SRF_ATMN2(iogrp), rnacc, 0.,cmpflg,'atmn2') -#endif -#ifdef cisonew - call wrtsrf(jatmc13(iogrp), SRF_ATMC13(iogrp), rnacc, 0.,cmpflg,'atmc13') - call wrtsrf(jatmc14(iogrp), SRF_ATMC14(iogrp), rnacc, 0.,cmpflg,'atmc14') -#endif + if (use_BOXATM) then + call wrtsrf(jatmo2(iogrp), SRF_ATMO2(iogrp), rnacc, 0.,cmpflg,'atmo2') + call wrtsrf(jatmn2(iogrp), SRF_ATMN2(iogrp), rnacc, 0.,cmpflg,'atmn2') + end if + if (use_cisonew) then + call wrtsrf(jatmc13(iogrp), SRF_ATMC13(iogrp), rnacc, 0.,cmpflg,'atmc13') + call wrtsrf(jatmc14(iogrp), SRF_ATMC14(iogrp), rnacc, 0.,cmpflg,'atmc14') + end if ! --- Store 3d layer fields call wrtlyr(jdp(iogrp), LYR_DP(iogrp), rnacc, 0.,cmpflg,'pddpo') @@ -517,42 +516,42 @@ subroutine ncwrt_bgc(iogrp) call wrtlyr(jprefalk(iogrp), LYR_PREFALK(iogrp), 1e3, 0.,cmpflg,'p_talk') call wrtlyr(jprefdic(iogrp), LYR_PREFDIC(iogrp), 1e3, 0.,cmpflg,'p_dic') call wrtlyr(jdicsat(iogrp), LYR_DICSAT(iogrp), 1e3, 0.,cmpflg,'sat_dic') -#ifdef cisonew - call wrtlyr(jdic13(iogrp), LYR_DIC13(iogrp), 1.e3, 0.,cmpflg,'dissic13') - call wrtlyr(jdic14(iogrp), LYR_DIC14(iogrp), 1.e3*c14fac, 0.,cmpflg,'dissic14') - call wrtlyr(jd13c(iogrp), LYR_D13C(iogrp), 1., 0.,cmpflg,'delta13c') - call wrtlyr(jd14c(iogrp), LYR_D14C(iogrp), 1., 0.,cmpflg,'delta14c') - call wrtlyr(jbigd14c(iogrp), LYR_BIGD14C(iogrp), 1., 0.,cmpflg,'bigdelta14c') - call wrtlyr(jpoc13(iogrp), LYR_POC13(iogrp), 1e3, 0.,cmpflg,'detoc13') - call wrtlyr(jdoc13(iogrp), LYR_DOC13(iogrp), 1e3, 0.,cmpflg,'dissoc13') - call wrtlyr(jcalc13(iogrp), LYR_CALC13(iogrp), 1e3, 0.,cmpflg,'calc13') - call wrtlyr(jphyto13(iogrp), LYR_PHYTO13(iogrp), 1e3, 0.,cmpflg,'phyc13') - call wrtlyr(jgrazer13(iogrp), LYR_GRAZER13(iogrp), 1e3, 0.,cmpflg,'zooc13') -#endif -#ifdef AGG - call wrtlyr(jnos(iogrp), LYR_NOS(iogrp), 1., 0.,cmpflg,'nos') - call wrtlyr(jwphy(iogrp), LYR_WPHY(iogrp), 1., 0.,cmpflg,'wphy') - call wrtlyr(jwnos(iogrp), LYR_WNOS(iogrp), 1., 0.,cmpflg,'wnos') - call wrtlyr(jeps(iogrp), LYR_EPS(iogrp), 1., 0.,cmpflg,'eps') - call wrtlyr(jasize(iogrp), LYR_ASIZE(iogrp), 1., 0.,cmpflg,'asize') -#endif -#ifdef CFC - call wrtlyr(jcfc11(iogrp), LYR_CFC11(iogrp), 1e3, 0.,cmpflg,'cfc11') - call wrtlyr(jcfc12(iogrp), LYR_CFC12(iogrp), 1e3, 0.,cmpflg,'cfc12') - call wrtlyr(jsf6(iogrp), LYR_SF6(iogrp), 1e3, 0.,cmpflg,'sf6') -#endif -#ifdef natDIC - call wrtlyr(jnatco3(iogrp), LYR_NATCO3(iogrp), 1e3, 0.,cmpflg,'natco3') - call wrtlyr(jnatalkali(iogrp), LYR_NATALKALI(iogrp),1e3, 0.,cmpflg,'nattalk') - call wrtlyr(jnatdic(iogrp), LYR_NATDIC(iogrp), 1e3, 0.,cmpflg,'natdissic') - call wrtlyr(jnatcalc(iogrp), LYR_NATCALC(iogrp), 1e3, 0.,cmpflg,'natcalc') - call wrtlyr(jnatph(iogrp), LYR_NATPH(iogrp), -1., 0.,cmpflg,'natph') - call wrtlyr(jnatomegaa(iogrp), LYR_NATOMEGAA(iogrp),1., 0.,cmpflg,'natomegaa') - call wrtlyr(jnatomegac(iogrp), LYR_NATOMEGAC(iogrp),1., 0.,cmpflg,'natomegac') -#endif -#ifdef BROMO - call wrtlyr(jbromo(iogrp), LYR_BROMO(iogrp), 1e3, 0.,cmpflg,'bromo') -#endif + if (use_cisonew) then + call wrtlyr(jdic13(iogrp), LYR_DIC13(iogrp), 1.e3, 0.,cmpflg,'dissic13') + call wrtlyr(jdic14(iogrp), LYR_DIC14(iogrp), 1.e3*c14fac, 0.,cmpflg,'dissic14') + call wrtlyr(jd13c(iogrp), LYR_D13C(iogrp), 1., 0.,cmpflg,'delta13c') + call wrtlyr(jd14c(iogrp), LYR_D14C(iogrp), 1., 0.,cmpflg,'delta14c') + call wrtlyr(jbigd14c(iogrp), LYR_BIGD14C(iogrp), 1., 0.,cmpflg,'bigdelta14c') + call wrtlyr(jpoc13(iogrp), LYR_POC13(iogrp), 1e3, 0.,cmpflg,'detoc13') + call wrtlyr(jdoc13(iogrp), LYR_DOC13(iogrp), 1e3, 0.,cmpflg,'dissoc13') + call wrtlyr(jcalc13(iogrp), LYR_CALC13(iogrp), 1e3, 0.,cmpflg,'calc13') + call wrtlyr(jphyto13(iogrp), LYR_PHYTO13(iogrp), 1e3, 0.,cmpflg,'phyc13') + call wrtlyr(jgrazer13(iogrp), LYR_GRAZER13(iogrp), 1e3, 0.,cmpflg,'zooc13') + end if + if (use_AGG) then + call wrtlyr(jnos(iogrp), LYR_NOS(iogrp), 1., 0.,cmpflg,'nos') + call wrtlyr(jwphy(iogrp), LYR_WPHY(iogrp), 1., 0.,cmpflg,'wphy') + call wrtlyr(jwnos(iogrp), LYR_WNOS(iogrp), 1., 0.,cmpflg,'wnos') + call wrtlyr(jeps(iogrp), LYR_EPS(iogrp), 1., 0.,cmpflg,'eps') + call wrtlyr(jasize(iogrp), LYR_ASIZE(iogrp), 1., 0.,cmpflg,'asize') + end if + if (use_CFC) then + call wrtlyr(jcfc11(iogrp), LYR_CFC11(iogrp), 1e3, 0.,cmpflg,'cfc11') + call wrtlyr(jcfc12(iogrp), LYR_CFC12(iogrp), 1e3, 0.,cmpflg,'cfc12') + call wrtlyr(jsf6(iogrp), LYR_SF6(iogrp), 1e3, 0.,cmpflg,'sf6') + end if + if (use_natDIC) then + call wrtlyr(jnatco3(iogrp), LYR_NATCO3(iogrp), 1e3, 0.,cmpflg,'natco3') + call wrtlyr(jnatalkali(iogrp), LYR_NATALKALI(iogrp),1e3, 0.,cmpflg,'nattalk') + call wrtlyr(jnatdic(iogrp), LYR_NATDIC(iogrp), 1e3, 0.,cmpflg,'natdissic') + call wrtlyr(jnatcalc(iogrp), LYR_NATCALC(iogrp), 1e3, 0.,cmpflg,'natcalc') + call wrtlyr(jnatph(iogrp), LYR_NATPH(iogrp), -1., 0.,cmpflg,'natph') + call wrtlyr(jnatomegaa(iogrp), LYR_NATOMEGAA(iogrp),1., 0.,cmpflg,'natomegaa') + call wrtlyr(jnatomegac(iogrp), LYR_NATOMEGAC(iogrp),1., 0.,cmpflg,'natomegac') + end if + if (use_BROMO) then + call wrtlyr(jbromo(iogrp), LYR_BROMO(iogrp), 1e3, 0.,cmpflg,'bromo') + end if ! --- Store 3d level fields call wrtlvl(jlvldic(iogrp), LVL_DIC(iogrp), rnacc*1e3, 0.,cmpflg,'dissiclvl') @@ -580,63 +579,63 @@ subroutine ncwrt_bgc(iogrp) call wrtlvl(jlvlprefalk(iogrp), LVL_PREFALK(iogrp), rnacc*1e3, 0.,cmpflg,'p_talklvl') call wrtlvl(jlvlprefdic(iogrp), LVL_PREFDIC(iogrp), rnacc*1e3, 0.,cmpflg,'p_diclvl') call wrtlvl(jlvldicsat(iogrp), LVL_DICSAT(iogrp), rnacc*1e3, 0.,cmpflg,'sat_diclvl') -#ifdef cisonew - call wrtlvl(jlvldic13(iogrp), LVL_DIC13(iogrp), rnacc*1.e3, 0.,cmpflg,'dissic13lvl') - call wrtlvl(jlvldic14(iogrp), LVL_DIC14(iogrp), rnacc*1.e3*c14fac,0.,cmpflg,'dissic14lvl') - call wrtlvl(jlvld13c(iogrp), LVL_D13C(iogrp), rnacc, 0.,cmpflg,'delta13clvl') - call wrtlvl(jlvld14c(iogrp), LVL_D14C(iogrp), rnacc, 0.,cmpflg,'delta14clvl') - call wrtlvl(jlvlbigd14c(iogrp), LVL_BIGD14C(iogrp), rnacc, 0.,cmpflg,'bigdelta14clvl') - call wrtlvl(jlvlpoc13(iogrp), LVL_POC13(iogrp), rnacc*1e3, 0.,cmpflg,'detoc13lvl') - call wrtlvl(jlvldoc13(iogrp), LVL_DOC13(iogrp), rnacc*1e3, 0.,cmpflg,'dissoc13lvl') - call wrtlvl(jlvlcalc13(iogrp), LVL_CALC13(iogrp), rnacc*1e3, 0.,cmpflg,'calc13lvl') - call wrtlvl(jlvlphyto13(iogrp), LVL_PHYTO13(iogrp), rnacc*1e3, 0.,cmpflg,'phyc13lvl') - call wrtlvl(jlvlgrazer13(iogrp), LVL_GRAZER13(iogrp), rnacc*1e3, 0.,cmpflg,'zooc13lvl') -#endif -#ifdef AGG - call wrtlvl(jlvlnos(iogrp), LVL_NOS(iogrp), rnacc, 0.,cmpflg,'noslvl') - call wrtlvl(jlvlwphy(iogrp), LVL_WPHY(iogrp), rnacc, 0.,cmpflg,'wphylvl') - call wrtlvl(jlvlwnos(iogrp), LVL_WNOS(iogrp), rnacc, 0.,cmpflg,'wnoslvl') - call wrtlvl(jlvleps(iogrp), LVL_EPS(iogrp), rnacc, 0.,cmpflg,'epslvl') - call wrtlvl(jlvlasize(iogrp), LVL_ASIZE(iogrp), rnacc, 0.,cmpflg,'asizelvl') -#endif -#ifdef CFC - call wrtlvl(jlvlcfc11(iogrp), LVL_CFC11(iogrp), rnacc*1e3, 0.,cmpflg,'cfc11lvl') - call wrtlvl(jlvlcfc12(iogrp), LVL_CFC12(iogrp), rnacc*1e3, 0.,cmpflg,'cfc12lvl') - call wrtlvl(jlvlsf6(iogrp), LVL_SF6(iogrp), rnacc*1e3, 0.,cmpflg,'sf6lvl') -#endif -#ifdef natDIC - call wrtlvl(jlvlnatco3(iogrp), LVL_NATCO3(iogrp), rnacc*1e3, 0.,cmpflg,'natco3lvl') - call wrtlvl(jlvlnatalkali(iogrp),LVL_NATALKALI(iogrp),rnacc*1e3, 0.,cmpflg,'nattalklvl') - call wrtlvl(jlvlnatdic(iogrp), LVL_NATDIC(iogrp), rnacc*1e3, 0.,cmpflg,'natdissiclvl') - call wrtlvl(jlvlnatcalc(iogrp), LVL_NATCALC(iogrp), rnacc*1e3, 0.,cmpflg,'natcalclvl') - call wrtlvl(jlvlnatph(iogrp), LVL_NATPH(iogrp), -1., 0.,cmpflg,'natphlvl') - call wrtlvl(jlvlnatomegaa(iogrp),LVL_NATOMEGAA(iogrp),rnacc, 0.,cmpflg,'natomegaalvl') - call wrtlvl(jlvlnatomegac(iogrp),LVL_NATOMEGAC(iogrp),rnacc, 0.,cmpflg,'natomegaclvl') -#endif -#ifdef BROMO - call wrtlvl(jlvlbromo(iogrp), LVL_BROMO(iogrp), rnacc*1e3, 0.,cmpflg,'bromolvl') -#endif + if (use_cisonew) then + call wrtlvl(jlvldic13(iogrp), LVL_DIC13(iogrp), rnacc*1.e3, 0.,cmpflg,'dissic13lvl') + call wrtlvl(jlvldic14(iogrp), LVL_DIC14(iogrp), rnacc*1.e3*c14fac,0.,cmpflg,'dissic14lvl') + call wrtlvl(jlvld13c(iogrp), LVL_D13C(iogrp), rnacc, 0.,cmpflg,'delta13clvl') + call wrtlvl(jlvld14c(iogrp), LVL_D14C(iogrp), rnacc, 0.,cmpflg,'delta14clvl') + call wrtlvl(jlvlbigd14c(iogrp), LVL_BIGD14C(iogrp), rnacc, 0.,cmpflg,'bigdelta14clvl') + call wrtlvl(jlvlpoc13(iogrp), LVL_POC13(iogrp), rnacc*1e3, 0.,cmpflg,'detoc13lvl') + call wrtlvl(jlvldoc13(iogrp), LVL_DOC13(iogrp), rnacc*1e3, 0.,cmpflg,'dissoc13lvl') + call wrtlvl(jlvlcalc13(iogrp), LVL_CALC13(iogrp), rnacc*1e3, 0.,cmpflg,'calc13lvl') + call wrtlvl(jlvlphyto13(iogrp), LVL_PHYTO13(iogrp), rnacc*1e3, 0.,cmpflg,'phyc13lvl') + call wrtlvl(jlvlgrazer13(iogrp), LVL_GRAZER13(iogrp), rnacc*1e3, 0.,cmpflg,'zooc13lvl') + end if + if (use_AGG) then + call wrtlvl(jlvlnos(iogrp), LVL_NOS(iogrp), rnacc, 0.,cmpflg,'noslvl') + call wrtlvl(jlvlwphy(iogrp), LVL_WPHY(iogrp), rnacc, 0.,cmpflg,'wphylvl') + call wrtlvl(jlvlwnos(iogrp), LVL_WNOS(iogrp), rnacc, 0.,cmpflg,'wnoslvl') + call wrtlvl(jlvleps(iogrp), LVL_EPS(iogrp), rnacc, 0.,cmpflg,'epslvl') + call wrtlvl(jlvlasize(iogrp), LVL_ASIZE(iogrp), rnacc, 0.,cmpflg,'asizelvl') + end if + if (use_CFC) then + call wrtlvl(jlvlcfc11(iogrp), LVL_CFC11(iogrp), rnacc*1e3, 0.,cmpflg,'cfc11lvl') + call wrtlvl(jlvlcfc12(iogrp), LVL_CFC12(iogrp), rnacc*1e3, 0.,cmpflg,'cfc12lvl') + call wrtlvl(jlvlsf6(iogrp), LVL_SF6(iogrp), rnacc*1e3, 0.,cmpflg,'sf6lvl') + end if + if (use_natDIC) then + call wrtlvl(jlvlnatco3(iogrp), LVL_NATCO3(iogrp), rnacc*1e3, 0.,cmpflg,'natco3lvl') + call wrtlvl(jlvlnatalkali(iogrp),LVL_NATALKALI(iogrp),rnacc*1e3, 0.,cmpflg,'nattalklvl') + call wrtlvl(jlvlnatdic(iogrp), LVL_NATDIC(iogrp), rnacc*1e3, 0.,cmpflg,'natdissiclvl') + call wrtlvl(jlvlnatcalc(iogrp), LVL_NATCALC(iogrp), rnacc*1e3, 0.,cmpflg,'natcalclvl') + call wrtlvl(jlvlnatph(iogrp), LVL_NATPH(iogrp), -1., 0.,cmpflg,'natphlvl') + call wrtlvl(jlvlnatomegaa(iogrp),LVL_NATOMEGAA(iogrp),rnacc, 0.,cmpflg,'natomegaalvl') + call wrtlvl(jlvlnatomegac(iogrp),LVL_NATOMEGAC(iogrp),rnacc, 0.,cmpflg,'natomegaclvl') + end if + if (use_BROMO) then + call wrtlvl(jlvlbromo(iogrp), LVL_BROMO(iogrp), rnacc*1e3, 0.,cmpflg,'bromolvl') + end if ! --- Store sediment fields -#ifndef sedbypass - call wrtsdm(jpowaic(iogrp), SDM_POWAIC(iogrp), rnacc*1e3, 0.,cmpflg,'powdic') - call wrtsdm(jpowaal(iogrp), SDM_POWAAL(iogrp), rnacc*1e3, 0.,cmpflg,'powalk') - call wrtsdm(jpowaph(iogrp), SDM_POWAPH(iogrp), rnacc*1e3, 0.,cmpflg,'powpho') - call wrtsdm(jpowaox(iogrp), SDM_POWAOX(iogrp), rnacc*1e3, 0.,cmpflg,'powox') - call wrtsdm(jpown2(iogrp), SDM_POWN2(iogrp), rnacc*1e3, 0.,cmpflg,'pown2') - call wrtsdm(jpowno3(iogrp), SDM_POWNO3(iogrp), rnacc*1e3, 0.,cmpflg,'powno3') - call wrtsdm(jpowasi(iogrp), SDM_POWASI(iogrp), rnacc*1e3, 0.,cmpflg,'powsi') - call wrtsdm(jssso12(iogrp), SDM_SSSO12(iogrp), rnacc*1e3, 0.,cmpflg,'ssso12') - call wrtsdm(jssssil(iogrp), SDM_SSSSIL(iogrp), rnacc*1e3, 0.,cmpflg,'ssssil') - call wrtsdm(jsssc12(iogrp), SDM_SSSC12(iogrp), rnacc*1e3, 0.,cmpflg,'sssc12') - call wrtsdm(jssster(iogrp), SDM_SSSTER(iogrp), rnacc, 0.,cmpflg,'ssster') + if (.not. use_sedbypass) then + call wrtsdm(jpowaic(iogrp), SDM_POWAIC(iogrp), rnacc*1e3, 0.,cmpflg,'powdic') + call wrtsdm(jpowaal(iogrp), SDM_POWAAL(iogrp), rnacc*1e3, 0.,cmpflg,'powalk') + call wrtsdm(jpowaph(iogrp), SDM_POWAPH(iogrp), rnacc*1e3, 0.,cmpflg,'powpho') + call wrtsdm(jpowaox(iogrp), SDM_POWAOX(iogrp), rnacc*1e3, 0.,cmpflg,'powox') + call wrtsdm(jpown2(iogrp), SDM_POWN2(iogrp), rnacc*1e3, 0.,cmpflg,'pown2') + call wrtsdm(jpowno3(iogrp), SDM_POWNO3(iogrp), rnacc*1e3, 0.,cmpflg,'powno3') + call wrtsdm(jpowasi(iogrp), SDM_POWASI(iogrp), rnacc*1e3, 0.,cmpflg,'powsi') + call wrtsdm(jssso12(iogrp), SDM_SSSO12(iogrp), rnacc*1e3, 0.,cmpflg,'ssso12') + call wrtsdm(jssssil(iogrp), SDM_SSSSIL(iogrp), rnacc*1e3, 0.,cmpflg,'ssssil') + call wrtsdm(jsssc12(iogrp), SDM_SSSC12(iogrp), rnacc*1e3, 0.,cmpflg,'sssc12') + call wrtsdm(jssster(iogrp), SDM_SSSTER(iogrp), rnacc, 0.,cmpflg,'ssster') - ! --- Store sediment burial fields - call wrtbur(jburssso12(iogrp), BUR_SSSO12(iogrp), rnacc*1e3, 0.,cmpflg,'buro12') - call wrtbur(jbursssc12(iogrp), BUR_SSSC12(iogrp), rnacc*1e3, 0.,cmpflg,'burc12') - call wrtbur(jburssssil(iogrp), BUR_SSSSIL(iogrp), rnacc*1e3, 0.,cmpflg,'bursil') - call wrtbur(jburssster(iogrp), BUR_SSSTER(iogrp), rnacc, 0.,cmpflg,'burter') -#endif + ! --- Store sediment burial fields + call wrtbur(jburssso12(iogrp), BUR_SSSO12(iogrp), rnacc*1e3, 0.,cmpflg,'buro12') + call wrtbur(jbursssc12(iogrp), BUR_SSSC12(iogrp), rnacc*1e3, 0.,cmpflg,'burc12') + call wrtbur(jburssssil(iogrp), BUR_SSSSIL(iogrp), rnacc*1e3, 0.,cmpflg,'bursil') + call wrtbur(jburssster(iogrp), BUR_SSSTER(iogrp), rnacc, 0.,cmpflg,'burter') + end if ! --- close netcdf file call ncfcls @@ -693,51 +692,51 @@ subroutine ncwrt_bgc(iogrp) call inisrf(jcalflx2000(iogrp),0.) call inisrf(jcalflx4000(iogrp),0.) call inisrf(jcalflx_bot(iogrp),0.) -#ifndef sedbypass - call inisrf(jsediffic(iogrp),0.) - call inisrf(jsediffal(iogrp),0.) - call inisrf(jsediffph(iogrp),0.) - call inisrf(jsediffox(iogrp),0.) - call inisrf(jsediffn2(iogrp),0.) - call inisrf(jsediffno3(iogrp),0.) - call inisrf(jsediffsi(iogrp),0.) -#endif -#ifdef cisonew - call inisrf(jco213fxd(iogrp),0.) - call inisrf(jco213fxu(iogrp),0.) - call inisrf(jco214fxd(iogrp),0.) - call inisrf(jco214fxu(iogrp),0.) -#endif -#ifdef CFC - call inisrf(jcfc11fx(iogrp),0.) - call inisrf(jcfc12fx(iogrp),0.) - call inisrf(jsf6fx(iogrp),0.) -#endif -#ifdef natDIC - call inisrf(jsrfnatdic(iogrp),0.) - call inisrf(jsrfnatalk(iogrp),0.) - call inisrf(jnatpco2(iogrp),0.) - call inisrf(jnatco2fx(iogrp),0.) - call inisrf(jsrfnatph(iogrp),0.) -#endif -#ifdef BROMO - call inisrf(jsrfbromo(iogrp),0.) - call inisrf(jbromofx(iogrp),0.) - call inisrf(jbromo_prod(iogrp),0.) - call inisrf(jbromo_uv(iogrp),0.) - call inisrf(jatmbromo(iogrp),0.) -#endif + if (.not. use_sedbypass) then + call inisrf(jsediffic(iogrp),0.) + call inisrf(jsediffal(iogrp),0.) + call inisrf(jsediffph(iogrp),0.) + call inisrf(jsediffox(iogrp),0.) + call inisrf(jsediffn2(iogrp),0.) + call inisrf(jsediffno3(iogrp),0.) + call inisrf(jsediffsi(iogrp),0.) + end if + if (use_cisonew) then + call inisrf(jco213fxd(iogrp),0.) + call inisrf(jco213fxu(iogrp),0.) + call inisrf(jco214fxd(iogrp),0.) + call inisrf(jco214fxu(iogrp),0.) + end if + if (use_CFC) then + call inisrf(jcfc11fx(iogrp),0.) + call inisrf(jcfc12fx(iogrp),0.) + call inisrf(jsf6fx(iogrp),0.) + end if + if (use_natDIC) then + call inisrf(jsrfnatdic(iogrp),0.) + call inisrf(jsrfnatalk(iogrp),0.) + call inisrf(jnatpco2(iogrp),0.) + call inisrf(jnatco2fx(iogrp),0.) + call inisrf(jsrfnatph(iogrp),0.) + end if + if (use_BROMO) then + call inisrf(jsrfbromo(iogrp),0.) + call inisrf(jbromofx(iogrp),0.) + call inisrf(jbromo_prod(iogrp),0.) + call inisrf(jbromo_uv(iogrp),0.) + call inisrf(jatmbromo(iogrp),0.) + end if call inisrf(jatmco2(iogrp),0.) -#if defined(BOXATM) - call inisrf(jatmo2(iogrp),0.) - call inisrf(jatmn2(iogrp),0.) -#endif -#ifdef cisonew - call inisrf(jatmc13(iogrp),0.) - call inisrf(jatmc14(iogrp),0.) -#endif + if (use_BOXATM) then + call inisrf(jatmo2(iogrp),0.) + call inisrf(jatmn2(iogrp),0.) + end if + if (use_cisonew) then + call inisrf(jatmc13(iogrp),0.) + call inisrf(jatmc14(iogrp),0.) + end if call inilyr(jdp(iogrp),0.) call inilyr(jdic(iogrp),0.) @@ -765,42 +764,42 @@ subroutine ncwrt_bgc(iogrp) call inilyr(jprefalk(iogrp),0.) call inilyr(jprefdic(iogrp),0.) call inilyr(jdicsat(iogrp),0.) -#ifdef cisonew - call inilyr(jdic13(iogrp),0.) - call inilyr(jdic14(iogrp),0.) - call inilyr(jd13c(iogrp),0.) - call inilyr(jd14c(iogrp),0.) - call inilyr(jbigd14c(iogrp),0.) - call inilyr(jpoc13(iogrp),0.) - call inilyr(jdoc13(iogrp),0.) - call inilyr(jcalc13(iogrp),0.) - call inilyr(jphyto13(iogrp),0.) - call inilyr(jgrazer13(iogrp),0.) -#endif -#ifdef AGG - call inilyr(jnos(iogrp),0.) - call inilyr(jwphy(iogrp),0.) - call inilyr(jwnos(iogrp),0.) - call inilyr(jeps(iogrp),0.) - call inilyr(jasize(iogrp),0.) -#endif -#ifdef CFC - call inilyr(jcfc11(iogrp),0.) - call inilyr(jcfc12(iogrp),0.) - call inilyr(jsf6(iogrp),0.) -#endif -#ifdef natDIC - call inilyr(jnatco3(iogrp),0.) - call inilyr(jnatalkali(iogrp),0.) - call inilyr(jnatdic(iogrp),0.) - call inilyr(jnatcalc(iogrp),0.) - call inilyr(jnatph(iogrp),0.) - call inilyr(jnatomegaa(iogrp),0.) - call inilyr(jnatomegac(iogrp),0.) -#endif -#ifdef BROMO - call inilyr(jbromo(iogrp),0.) -#endif + if (use_cisonew) then + call inilyr(jdic13(iogrp),0.) + call inilyr(jdic14(iogrp),0.) + call inilyr(jd13c(iogrp),0.) + call inilyr(jd14c(iogrp),0.) + call inilyr(jbigd14c(iogrp),0.) + call inilyr(jpoc13(iogrp),0.) + call inilyr(jdoc13(iogrp),0.) + call inilyr(jcalc13(iogrp),0.) + call inilyr(jphyto13(iogrp),0.) + call inilyr(jgrazer13(iogrp),0.) + end if + if (use_AGG) then + call inilyr(jnos(iogrp),0.) + call inilyr(jwphy(iogrp),0.) + call inilyr(jwnos(iogrp),0.) + call inilyr(jeps(iogrp),0.) + call inilyr(jasize(iogrp),0.) + end if + if (use_CFC) then + call inilyr(jcfc11(iogrp),0.) + call inilyr(jcfc12(iogrp),0.) + call inilyr(jsf6(iogrp),0.) + end if + if (use_natDIC) then + call inilyr(jnatco3(iogrp),0.) + call inilyr(jnatalkali(iogrp),0.) + call inilyr(jnatdic(iogrp),0.) + call inilyr(jnatcalc(iogrp),0.) + call inilyr(jnatph(iogrp),0.) + call inilyr(jnatomegaa(iogrp),0.) + call inilyr(jnatomegac(iogrp),0.) + end if + if (use_BROMO) then + call inilyr(jbromo(iogrp),0.) + end if call inilvl(jlvldic(iogrp),0.) call inilvl(jlvlalkali(iogrp),0.) @@ -827,61 +826,61 @@ subroutine ncwrt_bgc(iogrp) call inilvl(jlvlprefalk(iogrp),0.) call inilvl(jlvlprefdic(iogrp),0.) call inilvl(jlvldicsat(iogrp),0.) -#ifdef cisonew - call inilvl(jlvldic13(iogrp),0.) - call inilvl(jlvldic14(iogrp),0.) - call inilvl(jlvld13c(iogrp),0.) - call inilvl(jlvld14c(iogrp),0.) - call inilvl(jlvlbigd14c(iogrp),0.) - call inilvl(jlvlpoc13(iogrp),0.) - call inilvl(jlvldoc13(iogrp),0.) - call inilvl(jlvlcalc13(iogrp),0.) - call inilvl(jlvlphyto13(iogrp),0.) - call inilvl(jlvlgrazer13(iogrp),0.) -#endif -#ifdef AGG - call inilvl(jlvlnos(iogrp),0.) - call inilvl(jlvlwphy(iogrp),0.) - call inilvl(jlvlwnos(iogrp),0.) - call inilvl(jlvleps(iogrp),0.) - call inilvl(jlvlasize(iogrp),0.) -#endif -#ifdef CFC - call inilvl(jlvlcfc11(iogrp),0.) - call inilvl(jlvlcfc12(iogrp),0.) - call inilvl(jlvlsf6(iogrp),0.) -#endif -#ifdef natDIC - call inilvl(jlvlnatco3(iogrp),0.) - call inilvl(jlvlnatalkali(iogrp),0.) - call inilvl(jlvlnatdic(iogrp),0.) - call inilvl(jlvlnatcalc(iogrp),0.) - call inilvl(jlvlnatph(iogrp),0.) - call inilvl(jlvlnatomegaa(iogrp),0.) - call inilvl(jlvlnatomegac(iogrp),0.) -#endif -#ifdef BROMO - call inilvl(jlvlbromo(iogrp),0.) -#endif + if (use_cisonew) then + call inilvl(jlvldic13(iogrp),0.) + call inilvl(jlvldic14(iogrp),0.) + call inilvl(jlvld13c(iogrp),0.) + call inilvl(jlvld14c(iogrp),0.) + call inilvl(jlvlbigd14c(iogrp),0.) + call inilvl(jlvlpoc13(iogrp),0.) + call inilvl(jlvldoc13(iogrp),0.) + call inilvl(jlvlcalc13(iogrp),0.) + call inilvl(jlvlphyto13(iogrp),0.) + call inilvl(jlvlgrazer13(iogrp),0.) + end if + if (use_AGG) then + call inilvl(jlvlnos(iogrp),0.) + call inilvl(jlvlwphy(iogrp),0.) + call inilvl(jlvlwnos(iogrp),0.) + call inilvl(jlvleps(iogrp),0.) + call inilvl(jlvlasize(iogrp),0.) + end if + if (use_CFC) then + call inilvl(jlvlcfc11(iogrp),0.) + call inilvl(jlvlcfc12(iogrp),0.) + call inilvl(jlvlsf6(iogrp),0.) + end if + if (use_natDIC) then + call inilvl(jlvlnatco3(iogrp),0.) + call inilvl(jlvlnatalkali(iogrp),0.) + call inilvl(jlvlnatdic(iogrp),0.) + call inilvl(jlvlnatcalc(iogrp),0.) + call inilvl(jlvlnatph(iogrp),0.) + call inilvl(jlvlnatomegaa(iogrp),0.) + call inilvl(jlvlnatomegac(iogrp),0.) + end if + if (use_BROMO) then + call inilvl(jlvlbromo(iogrp),0.) + end if -#ifndef sedbypass - call inisdm(jpowaic(iogrp),0.) - call inisdm(jpowaal(iogrp),0.) - call inisdm(jpowaph(iogrp),0.) - call inisdm(jpowaox(iogrp),0.) - call inisdm(jpown2(iogrp),0.) - call inisdm(jpowno3(iogrp),0.) - call inisdm(jpowasi(iogrp),0.) - call inisdm(jssso12(iogrp),0.) - call inisdm(jssssil(iogrp),0.) - call inisdm(jsssc12(iogrp),0.) - call inisdm(jssster(iogrp),0.) + if (.not. use_sedbypass) then + call inisdm(jpowaic(iogrp),0.) + call inisdm(jpowaal(iogrp),0.) + call inisdm(jpowaph(iogrp),0.) + call inisdm(jpowaox(iogrp),0.) + call inisdm(jpown2(iogrp),0.) + call inisdm(jpowno3(iogrp),0.) + call inisdm(jpowasi(iogrp),0.) + call inisdm(jssso12(iogrp),0.) + call inisdm(jssssil(iogrp),0.) + call inisdm(jsssc12(iogrp),0.) + call inisdm(jssster(iogrp),0.) - call inibur(jburssso12(iogrp),0.) - call inibur(jbursssc12(iogrp),0.) - call inibur(jburssssil(iogrp),0.) - call inibur(jburssster(iogrp),0.) -#endif + call inibur(jburssso12(iogrp),0.) + call inibur(jbursssc12(iogrp),0.) + call inibur(jburssssil(iogrp),0.) + call inibur(jburssster(iogrp),0.) + end if nacc_bgc(iogrp)=0 @@ -914,43 +913,40 @@ subroutine hamoccvardef(iogrp,timeunits,calendar,cmpflg) & lvl_opal,lvl_iron,lvl_phosy,lvl_co3,lvl_ph,lvl_omegaa, & & lvl_omegac,lvl_n2o,lvl_prefo2,lvl_o2sat,lvl_prefpo4, & & lvl_prefalk,lvl_prefdic,lvl_dicsat -#ifdef AGG + ! AGG use mo_bgcmean, only: lyr_nos,lyr_wphy,lyr_wnos,lyr_eps, & & lyr_asize,lvl_nos,lvl_wphy,lvl_wnos,lvl_eps,lvl_asize -#endif -#if defined(BOXATM) + + !BOXATM use mo_bgcmean, only: srf_atmo2,srf_atmn2 -#endif -#ifdef BROMO + ! BROMO use mo_bgcmean, only:srf_bromo,srf_bromofx,int_bromopro, & & int_bromouv,srf_atmbromo,lyr_bromo,lvl_bromo -#endif -#ifdef CFC + ! CFC use mo_bgcmean, only: srf_cfc11,srf_cfc12,srf_sf6,lyr_cfc11, & & lyr_cfc12,lyr_sf6,lvl_cfc11,lvl_cfc12,lvl_sf6 -#endif -#ifdef cisonew + ! cisonew use mo_bgcmean, only: srf_co213fxd,srf_co213fxu,srf_co214fxd, & & srf_co214fxu,srf_atmc13,srf_atmc14,lyr_dic13,lyr_dic14, & & lyr_d13c,lyr_d14c,lyr_bigd14c,lyr_poc13,lyr_doc13, & & lyr_calc13,lyr_phyto13,lyr_grazer13,lvl_dic13,lvl_dic14, & & lvl_d13c,lvl_d14c,lvl_bigd14c,lvl_poc13,lvl_doc13, & & lvl_calc13,lvl_phyto13,lvl_grazer13 -#endif -#ifdef natDIC + ! natDIC use mo_bgcmean, only: srf_natdic,srf_natalkali,srf_natpco2, & & srf_natco2fx,srf_natph,lyr_natco3,lyr_natalkali,lyr_natdic, & & lyr_natcalc,lyr_natph,lyr_natomegaa,lyr_natomegac, & & lvl_natalkali,lvl_natdic,lvl_natcalc,lvl_natph, & & lvl_natomegaa,lvl_natomegac,lvl_natco3 -#endif -#ifndef sedbypass + !NOT sedbypass use mo_bgcmean, only: sdm_powaic,sdm_powaal,sdm_powaph,sdm_powaox, & & sdm_pown2,sdm_powno3,sdm_powasi,sdm_ssso12,sdm_ssssil, & & sdm_sssc12,sdm_ssster,bur_ssso12,bur_sssc12,bur_ssssil, & & bur_ssster -#endif + + use mo_ifdefs + implicit none integer iogrp,cmpflg @@ -1074,87 +1070,87 @@ subroutine hamoccvardef(iogrp,timeunits,calendar,cmpflg) & 'CaCO3 flux to sediment',' ','mol Ca m-2 s-1',0) call ncdefvar3d(SRF_N2OFX(iogrp),cmpflg,'p','n2oflux', & & 'N2O flux',' ','mol N2O m-2 s-1',0) -#ifndef sedbypass - call ncdefvar3d(FLX_SEDIFFIC(iogrp),cmpflg,'p','sedfdic', & - & 'diffusive DIC flux to sediment (positive downwards)', & - & ' ','mol C m-2 s-1',0) - call ncdefvar3d(FLX_SEDIFFAL(iogrp),cmpflg,'p','sedfalk', & - & 'diffusive alkalinity flux to sediment (positive downwards)', & - & ' ','mol m-2 s-1',0) - call ncdefvar3d(FLX_SEDIFFPH(iogrp),cmpflg,'p','sedfpho', & - & 'diffusive phosphate flux to sediment (positive downwards)', & - & ' ','mol m-2 s-1',0) - call ncdefvar3d(FLX_SEDIFFOX(iogrp),cmpflg,'p','sedfox', & - & 'diffusive oxygen flux to sediment (positive downwards)', & - & ' ','mol O2 m-2 s-1',0) - call ncdefvar3d(FLX_SEDIFFN2(iogrp),cmpflg,'p','sedfn2', & - & 'diffusive N2 flux to sediment (positive downwards)', & - & ' ','mol N2 m-2 s-1',0) - call ncdefvar3d(FLX_SEDIFFNO3(iogrp),cmpflg,'p','sedfno3', & - & 'diffusive nitrate flux to sediment (positive downwards)', & - & ' ','mol NO3 m-2 s-1',0) - call ncdefvar3d(FLX_SEDIFFSI(iogrp),cmpflg,'p','sedfsi', & - & 'diffusive silica flux to sediment (positive downwards)', & - & ' ','mol Si m-2 s-1',0) -#endif -#ifdef cisonew - call ncdefvar3d(SRF_CO213FXD(iogrp),cmpflg,'p','co213fxd', & - & 'Downward 13CO2 flux',' ','kg C m-2 s-1',0) - call ncdefvar3d(SRF_CO213FXU(iogrp),cmpflg,'p','co213fxu', & - & 'Upward 13CO2 flux',' ','kg C m-2 s-1',0) - call ncdefvar3d(SRF_CO214FXD(iogrp),cmpflg,'p','co214fxd', & - & 'Downward 14CO2 flux',' ','kg C m-2 s-1',0) - call ncdefvar3d(SRF_CO214FXU(iogrp),cmpflg,'p','co214fxu', & - & 'Upward 14CO2 flux',' ','kg C m-2 s-1',0) -#endif -#ifdef CFC - call ncdefvar3d(SRF_CFC11(iogrp),cmpflg,'p','cfc11flux', & - & 'CFC-11 flux',' ','mol CFC12 m-2 s-1',0) - call ncdefvar3d(SRF_CFC12(iogrp), & - & cmpflg,'p','cfc12flux','CFC-12 flux',' ','mol CFC12 m-2 s-1',0) - call ncdefvar3d(SRF_SF6(iogrp), & - & cmpflg,'p','sf6flux','SF-6 flux',' ','mol SF6 m-2 s-1',0) -#endif -#ifdef natDIC - call ncdefvar3d(SRF_NATDIC(iogrp),cmpflg,'p','srfnatdissic', & - & 'Surface natural dissolved inorganic carbon',' ','mol C m-3',0) - call ncdefvar3d(SRF_NATALKALI(iogrp),cmpflg,'p','srfnattalk', & - & 'Surface natural alkalinity',' ','eq m-3',0) - call ncdefvar3d(SRF_NATPCO2(iogrp),cmpflg,'p', & - & 'natpco2','Surface natural PCO2',' ','uatm',0) - call ncdefvar3d(SRF_NATCO2FX(iogrp), & - & cmpflg,'p','natco2fx','Natural CO2 flux',' ','kg C m-2 s-1',0) - call ncdefvar3d(SRF_NATPH(iogrp),cmpflg,'p','srfnatph', & - & 'Surface natural pH',' ','-log10([H+])',0) -#endif -#ifdef BROMO - call ncdefvar3d(SRF_BROMO(iogrp),cmpflg,'p','srfbromo', & - & 'Surface bromoform',' ','mol CHBr3 m-3',0) - call ncdefvar3d(SRF_BROMOfx(iogrp),cmpflg,'p','bromofx', & - & 'Surface bromoform flux',' ','mol CHBr3 m-2 s-1',0) - call ncdefvar3d(INT_BROMOPRO(iogrp),cmpflg,'p','intbromoprod', & - & 'Integrated bromoform production',' ','mol CHBr3 m-2 s-1',0) - call ncdefvar3d(INT_BROMOUV(iogrp),cmpflg,'p','intbromouv', & - & 'Integrated bromoform loss to photolysis',' ', & - & 'mol CHBr3 m-2 s-1',0) - call ncdefvar3d(SRF_ATMBROMO(iogrp),cmpflg,'p', & - & 'atmbromo','Atmospheric bromoform',' ','ppt',0) -#endif + if (.not. use_sedbypass) then + call ncdefvar3d(FLX_SEDIFFIC(iogrp),cmpflg,'p','sedfdic', & + & 'diffusive DIC flux to sediment (positive downwards)', & + & ' ','mol C m-2 s-1',0) + call ncdefvar3d(FLX_SEDIFFAL(iogrp),cmpflg,'p','sedfalk', & + & 'diffusive alkalinity flux to sediment (positive downwards)', & + & ' ','mol m-2 s-1',0) + call ncdefvar3d(FLX_SEDIFFPH(iogrp),cmpflg,'p','sedfpho', & + & 'diffusive phosphate flux to sediment (positive downwards)', & + & ' ','mol m-2 s-1',0) + call ncdefvar3d(FLX_SEDIFFOX(iogrp),cmpflg,'p','sedfox', & + & 'diffusive oxygen flux to sediment (positive downwards)', & + & ' ','mol O2 m-2 s-1',0) + call ncdefvar3d(FLX_SEDIFFN2(iogrp),cmpflg,'p','sedfn2', & + & 'diffusive N2 flux to sediment (positive downwards)', & + & ' ','mol N2 m-2 s-1',0) + call ncdefvar3d(FLX_SEDIFFNO3(iogrp),cmpflg,'p','sedfno3', & + & 'diffusive nitrate flux to sediment (positive downwards)', & + & ' ','mol NO3 m-2 s-1',0) + call ncdefvar3d(FLX_SEDIFFSI(iogrp),cmpflg,'p','sedfsi', & + & 'diffusive silica flux to sediment (positive downwards)', & + & ' ','mol Si m-2 s-1',0) + end if + if (use_cisonew) then + call ncdefvar3d(SRF_CO213FXD(iogrp),cmpflg,'p','co213fxd', & + & 'Downward 13CO2 flux',' ','kg C m-2 s-1',0) + call ncdefvar3d(SRF_CO213FXU(iogrp),cmpflg,'p','co213fxu', & + & 'Upward 13CO2 flux',' ','kg C m-2 s-1',0) + call ncdefvar3d(SRF_CO214FXD(iogrp),cmpflg,'p','co214fxd', & + & 'Downward 14CO2 flux',' ','kg C m-2 s-1',0) + call ncdefvar3d(SRF_CO214FXU(iogrp),cmpflg,'p','co214fxu', & + & 'Upward 14CO2 flux',' ','kg C m-2 s-1',0) + end if + if (use_CFC) then + call ncdefvar3d(SRF_CFC11(iogrp),cmpflg,'p','cfc11flux', & + & 'CFC-11 flux',' ','mol CFC12 m-2 s-1',0) + call ncdefvar3d(SRF_CFC12(iogrp), & + & cmpflg,'p','cfc12flux','CFC-12 flux',' ','mol CFC12 m-2 s-1',0) + call ncdefvar3d(SRF_SF6(iogrp), & + & cmpflg,'p','sf6flux','SF-6 flux',' ','mol SF6 m-2 s-1',0) + end if + if (use_natDIC) then + call ncdefvar3d(SRF_NATDIC(iogrp),cmpflg,'p','srfnatdissic', & + & 'Surface natural dissolved inorganic carbon',' ','mol C m-3',0) + call ncdefvar3d(SRF_NATALKALI(iogrp),cmpflg,'p','srfnattalk', & + & 'Surface natural alkalinity',' ','eq m-3',0) + call ncdefvar3d(SRF_NATPCO2(iogrp),cmpflg,'p', & + & 'natpco2','Surface natural PCO2',' ','uatm',0) + call ncdefvar3d(SRF_NATCO2FX(iogrp), & + & cmpflg,'p','natco2fx','Natural CO2 flux',' ','kg C m-2 s-1',0) + call ncdefvar3d(SRF_NATPH(iogrp),cmpflg,'p','srfnatph', & + & 'Surface natural pH',' ','-log10([H+])',0) + end if + if (use_BROMO) then + call ncdefvar3d(SRF_BROMO(iogrp),cmpflg,'p','srfbromo', & + & 'Surface bromoform',' ','mol CHBr3 m-3',0) + call ncdefvar3d(SRF_BROMOfx(iogrp),cmpflg,'p','bromofx', & + & 'Surface bromoform flux',' ','mol CHBr3 m-2 s-1',0) + call ncdefvar3d(INT_BROMOPRO(iogrp),cmpflg,'p','intbromoprod', & + & 'Integrated bromoform production',' ','mol CHBr3 m-2 s-1',0) + call ncdefvar3d(INT_BROMOUV(iogrp),cmpflg,'p','intbromouv', & + & 'Integrated bromoform loss to photolysis',' ', & + & 'mol CHBr3 m-2 s-1',0) + call ncdefvar3d(SRF_ATMBROMO(iogrp),cmpflg,'p', & + & 'atmbromo','Atmospheric bromoform',' ','ppt',0) + end if call ncdefvar3d(SRF_ATMCO2(iogrp),cmpflg,'p', & & 'atmco2','Atmospheric CO2',' ','ppm',0) -#if defined(BOXATM) - call ncdefvar3d(SRF_ATMO2(iogrp),cmpflg,'p', & - & 'atmo2','Atmospheric O2',' ','ppm',0) - call ncdefvar3d(SRF_ATMN2(iogrp),cmpflg,'p', & - & 'atmn2','Atmospheric N2',' ','ppm',0) -#endif -#ifdef cisonew - call ncdefvar3d(SRF_ATMC13(iogrp),cmpflg,'p', & - & 'atmc13','Atmospheric 13CO2',' ','ppm',0) - call ncdefvar3d(SRF_ATMC14(iogrp),cmpflg,'p', & - & 'atmc14','Atmospheric 14CO2',' ','ppm',0) -#endif + if (use_BOXATM) then + call ncdefvar3d(SRF_ATMO2(iogrp),cmpflg,'p', & + & 'atmo2','Atmospheric O2',' ','ppm',0) + call ncdefvar3d(SRF_ATMN2(iogrp),cmpflg,'p', & + & 'atmn2','Atmospheric N2',' ','ppm',0) + end if + if (use_cisonew) then + call ncdefvar3d(SRF_ATMC13(iogrp),cmpflg,'p', & + & 'atmc13','Atmospheric 13CO2',' ','ppm',0) + call ncdefvar3d(SRF_ATMC14(iogrp),cmpflg,'p', & + & 'atmc14','Atmospheric 14CO2',' ','ppm',0) + end if ! --- define 3d layer fields call ncdefvar3d(LYR_DP(iogrp),cmpflg,'p', & @@ -1209,68 +1205,68 @@ subroutine hamoccvardef(iogrp,timeunits,calendar,cmpflg) & 'p_dic','Preformed DIC',' ','mol C m-3',1) call ncdefvar3d(LYR_DICSAT(iogrp),cmpflg,'p', & & 'sat_dic','Saturated DIC',' ','mol C m-3',1) -#ifdef cisonew - call ncdefvar3d(LYR_DIC13(iogrp),cmpflg,'p', & - & 'dissic13','Dissolved C13',' ','mol 13C m-3',1) - call ncdefvar3d(LYR_DIC14(iogrp),cmpflg,'p', & - & 'dissic14','Dissolved C14',' ','mol 14C m-3',1) - call ncdefvar3d(LYR_D13C(iogrp),cmpflg,'p', & - & 'delta13c','delta13C of DIC',' ','permil',1) - call ncdefvar3d(LYR_D14C(iogrp),cmpflg,'p', & - & 'delta14c','delta14C of DIC',' ','permil',1) - call ncdefvar3d(LYR_BIGD14C(iogrp),cmpflg,'p', & - & 'bigdelta14c','big delta14C of DIC',' ','permil',1) - call ncdefvar3d(LYR_POC13(iogrp),cmpflg,'p', & - & 'detoc13','Detritus13',' ','mol P m-3',1) - call ncdefvar3d(LYR_DOC13(iogrp),cmpflg,'p', & - & 'dissoc13','Dissolved organic carbon13',' ','mol P m-3',1) - call ncdefvar3d(LYR_CALC13(iogrp),cmpflg,'p', & - & 'calc13','Ca13CO3 shells',' ','mol 13C m-3',1) - call ncdefvar3d(LYR_PHYTO13(iogrp),cmpflg,'p', & - & 'phyc13','Phytoplankton13',' ','mol P m-3',1) - call ncdefvar3d(LYR_GRAZER13(iogrp),cmpflg,'p', & - & 'zooc13','Zooplankton13',' ','mol P m-3',1) -#endif -#ifdef AGG - call ncdefvar3d(LYR_NOS(iogrp),cmpflg,'p', & - & 'nos','Marine snow aggregates per cm^3 sea water',' ','1/cm^3',1) - call ncdefvar3d(LYR_WPHY(iogrp),cmpflg,'p', & - & 'wphy','Av. mass sinking speed of marine snow',' ','m/day',1) - call ncdefvar3d(LYR_WNOS(iogrp),cmpflg,'p', & - & 'wnos','Av. number sinking speed of marine snow',' ','m/day',1) - call ncdefvar3d(LYR_EPS(iogrp),cmpflg,'p', & - & 'eps','Av. size distribution exponent',' ','-',1) - call ncdefvar3d(LYR_ASIZE(iogrp),cmpflg,'p', & - & 'asize','Av. size of marine snow aggregates',' ','nb. of cells',1) -#endif -#ifdef CFC - call ncdefvar3d(LYR_CFC11(iogrp),cmpflg,'p', & - & 'cfc11','CFC-11',' ','mol cfc11 m-3',1) - call ncdefvar3d(LYR_CFC12(iogrp),cmpflg,'p', & - & 'cfc12','CFC-12',' ','mol cfc12 m-3',1) - call ncdefvar3d(LYR_SF6(iogrp),cmpflg,'p', & - & 'sf6','SF-6',' ','mol sf6 m-3',1) -#endif -#ifdef natDIC - call ncdefvar3d(LYR_NATCO3(iogrp),cmpflg,'p', & - & 'natco3','Natural Carbonate ions',' ','mol C m-3',1) - call ncdefvar3d(LYR_NATALKALI(iogrp),cmpflg,'p','nattalk', & - & 'Natural alkalinity',' ','eq m-3',1) - call ncdefvar3d(LYR_NATDIC(iogrp),cmpflg,'p','natdissic', & - & 'Natural dissolved inorganic carbon',' ','mol C m-3',1) - call ncdefvar3d(LYR_NATCALC(iogrp),cmpflg,'p','natcalc', & - & 'Natural CaCO3',' ','mol C m-3',1) - call ncdefvar3d(LYR_NATPH(iogrp),cmpflg,'p', & - & 'natph','Natural pH',' ','-log10([H+])',1) - call ncdefvar3d(LYR_NATOMEGAA(iogrp),cmpflg,'p','natomegaa', & - & 'Natural OmegaA',' ','1',1) - call ncdefvar3d(LYR_NATOMEGAC(iogrp),cmpflg,'p','natomegac', & - & 'Natural OmegaC',' ','1',1) -#endif -#ifdef BROMO - call ncdefvar3d(LYR_BROMO(iogrp),cmpflg,'p', & - & 'bromo','Bromoform',' ','mol CHBr3 m-3',1) -#endif + if (use_cisonew) then + call ncdefvar3d(LYR_DIC13(iogrp),cmpflg,'p', & + & 'dissic13','Dissolved C13',' ','mol 13C m-3',1) + call ncdefvar3d(LYR_DIC14(iogrp),cmpflg,'p', & + & 'dissic14','Dissolved C14',' ','mol 14C m-3',1) + call ncdefvar3d(LYR_D13C(iogrp),cmpflg,'p', & + & 'delta13c','delta13C of DIC',' ','permil',1) + call ncdefvar3d(LYR_D14C(iogrp),cmpflg,'p', & + & 'delta14c','delta14C of DIC',' ','permil',1) + call ncdefvar3d(LYR_BIGD14C(iogrp),cmpflg,'p', & + & 'bigdelta14c','big delta14C of DIC',' ','permil',1) + call ncdefvar3d(LYR_POC13(iogrp),cmpflg,'p', & + & 'detoc13','Detritus13',' ','mol P m-3',1) + call ncdefvar3d(LYR_DOC13(iogrp),cmpflg,'p', & + & 'dissoc13','Dissolved organic carbon13',' ','mol P m-3',1) + call ncdefvar3d(LYR_CALC13(iogrp),cmpflg,'p', & + & 'calc13','Ca13CO3 shells',' ','mol 13C m-3',1) + call ncdefvar3d(LYR_PHYTO13(iogrp),cmpflg,'p', & + & 'phyc13','Phytoplankton13',' ','mol P m-3',1) + call ncdefvar3d(LYR_GRAZER13(iogrp),cmpflg,'p', & + & 'zooc13','Zooplankton13',' ','mol P m-3',1) + end if + if (use_AGG) then + call ncdefvar3d(LYR_NOS(iogrp),cmpflg,'p', & + & 'nos','Marine snow aggregates per cm^3 sea water',' ','1/cm^3',1) + call ncdefvar3d(LYR_WPHY(iogrp),cmpflg,'p', & + & 'wphy','Av. mass sinking speed of marine snow',' ','m/day',1) + call ncdefvar3d(LYR_WNOS(iogrp),cmpflg,'p', & + & 'wnos','Av. number sinking speed of marine snow',' ','m/day',1) + call ncdefvar3d(LYR_EPS(iogrp),cmpflg,'p', & + & 'eps','Av. size distribution exponent',' ','-',1) + call ncdefvar3d(LYR_ASIZE(iogrp),cmpflg,'p', & + & 'asize','Av. size of marine snow aggregates',' ','nb. of cells',1) + end if + if (use_CFC) then + call ncdefvar3d(LYR_CFC11(iogrp),cmpflg,'p', & + & 'cfc11','CFC-11',' ','mol cfc11 m-3',1) + call ncdefvar3d(LYR_CFC12(iogrp),cmpflg,'p', & + & 'cfc12','CFC-12',' ','mol cfc12 m-3',1) + call ncdefvar3d(LYR_SF6(iogrp),cmpflg,'p', & + & 'sf6','SF-6',' ','mol sf6 m-3',1) + end if + if (use_natDIC) then + call ncdefvar3d(LYR_NATCO3(iogrp),cmpflg,'p', & + & 'natco3','Natural Carbonate ions',' ','mol C m-3',1) + call ncdefvar3d(LYR_NATALKALI(iogrp),cmpflg,'p','nattalk', & + & 'Natural alkalinity',' ','eq m-3',1) + call ncdefvar3d(LYR_NATDIC(iogrp),cmpflg,'p','natdissic', & + & 'Natural dissolved inorganic carbon',' ','mol C m-3',1) + call ncdefvar3d(LYR_NATCALC(iogrp),cmpflg,'p','natcalc', & + & 'Natural CaCO3',' ','mol C m-3',1) + call ncdefvar3d(LYR_NATPH(iogrp),cmpflg,'p', & + & 'natph','Natural pH',' ','-log10([H+])',1) + call ncdefvar3d(LYR_NATOMEGAA(iogrp),cmpflg,'p','natomegaa', & + & 'Natural OmegaA',' ','1',1) + call ncdefvar3d(LYR_NATOMEGAC(iogrp),cmpflg,'p','natomegac', & + & 'Natural OmegaC',' ','1',1) + end if + if (use_BROMO) then + call ncdefvar3d(LYR_BROMO(iogrp),cmpflg,'p', & + & 'bromo','Bromoform',' ','mol CHBr3 m-3',1) + end if ! --- define 3d level fields call ncdefvar3d(LVL_DIC(iogrp),cmpflg,'p', & @@ -1323,104 +1319,104 @@ subroutine hamoccvardef(iogrp,timeunits,calendar,cmpflg) & 'p_diclvl','Preformed DIC',' ','mol C m-3',2) call ncdefvar3d(LVL_DICSAT(iogrp),cmpflg,'p', & & 'sat_diclvl','Saturated DIC',' ','mol C m-3',2) -#ifdef cisonew - call ncdefvar3d(LVL_DIC13(iogrp),cmpflg,'p', & - & 'dissic13lvl','Dissolved C13',' ','mol 13C m-3',2) - call ncdefvar3d(LVL_DIC14(iogrp),cmpflg,'p', & - & 'dissic14lvl','Dissolved C14',' ','mol 14C m-3',2) - call ncdefvar3d(LVL_D13C(iogrp),cmpflg,'p', & - & 'delta13clvl','delta13C of DIC',' ','permil',2) - call ncdefvar3d(LVL_D14C(iogrp),cmpflg,'p', & - & 'delta14clvl','delta14C of DIC',' ','permil',2) - call ncdefvar3d(LVL_BIGD14C(iogrp),cmpflg,'p', & - & 'bigdelta14clvl','big delta14C of DIC',' ','permil',2) - call ncdefvar3d(LVL_POC13(iogrp),cmpflg,'p', & - & 'detoc13lvl','Detritus13',' ','mol P m-3',2) - call ncdefvar3d(LVL_DOC13(iogrp),cmpflg,'p', & - & 'dissoc13lvl','Dissolved organic carbon13',' ','mol P m-3',2) - call ncdefvar3d(LVL_CALC13(iogrp),cmpflg,'p', & - & 'calc13lvl','Ca13CO3 shells',' ','mol 13C m-3',2) - call ncdefvar3d(LVL_PHYTO13(iogrp),cmpflg,'p', & - & 'phyc13lvl','Phytoplankton13',' ','mol P m-3',2) - call ncdefvar3d(LVL_GRAZER13(iogrp),cmpflg,'p', & - & 'zooc13lvl','Zooplankton13',' ','mol P m-3',2) -#endif -#ifdef AGG - call ncdefvar3d(LVL_NOS(iogrp),cmpflg,'p','noslvl', & - & 'Marine snow aggregates per cm^3 sea water',' ','1/cm^3',2) - call ncdefvar3d(LVL_WPHY(iogrp),cmpflg,'p','wphylvl', & - & 'Av. mass sinking speed of marine snow',' ','m/day',2) - call ncdefvar3d(LVL_WNOS(iogrp),cmpflg,'p','wnoslvl', & - & 'Av. number sinking speed of marine snow',' ','m/day',2) - call ncdefvar3d(LVL_EPS(iogrp),cmpflg,'p','epslvl', & - & 'Av. size distribution exponent',' ','-',2) - call ncdefvar3d(LVL_ASIZE(iogrp),cmpflg,'p','asizelvl', & - & 'Av. size of marine snow aggregates',' ','nb. of cells',2) -#endif -#ifdef CFC - call ncdefvar3d(LVL_CFC11(iogrp),cmpflg,'p', & - & 'cfc11lvl','CFC-11',' ','mol cfc11 m-3',2) - call ncdefvar3d(LVL_CFC12(iogrp),cmpflg,'p', & - & 'cfc12lvl','CFC-12',' ','mol cfc12 m-3',2) - call ncdefvar3d(LVL_SF6(iogrp),cmpflg,'p', & - & 'sf6lvl','SF-6',' ','mol sf6 m-3',2) -#endif -#ifdef natDIC - call ncdefvar3d(LVL_NATCO3(iogrp),cmpflg,'p', & - & 'natco3lvl','Natural Carbonate ions',' ','mol C m-3',2) - call ncdefvar3d(LVL_NATALKALI(iogrp),cmpflg,'p','nattalklvl', & - & 'Natural alkalinity',' ','eq m-3',2) - call ncdefvar3d(LVL_NATDIC(iogrp),cmpflg,'p','natdissiclvl', & - & 'Natual dissolved inorganic carbon',' ','mol C m-3',2) - call ncdefvar3d(LVL_NATCALC(iogrp),cmpflg,'p', & - & 'natcalclvl','Natural CaCO3 shells',' ','mol C m-3',2) - call ncdefvar3d(LVL_NATPH(iogrp),cmpflg,'p', & - & 'natphlvl','Natural pH',' ','-log10([H+])',2) - call ncdefvar3d(LVL_NATOMEGAA(iogrp),cmpflg,'p', & - & 'natomegaalvl','Natural OmegaA',' ','1',2) - call ncdefvar3d(LVL_NATOMEGAC(iogrp),cmpflg,'p', & - & 'natomegaclvl','Natural OmegaC',' ','1',2) -#endif -#ifdef BROMO - call ncdefvar3d(LVL_BROMO(iogrp),cmpflg,'p', & - & 'bromolvl','Bromoform',' ','mol CHBr3 m-3',2) -#endif + if (use_cisonew) then + call ncdefvar3d(LVL_DIC13(iogrp),cmpflg,'p', & + & 'dissic13lvl','Dissolved C13',' ','mol 13C m-3',2) + call ncdefvar3d(LVL_DIC14(iogrp),cmpflg,'p', & + & 'dissic14lvl','Dissolved C14',' ','mol 14C m-3',2) + call ncdefvar3d(LVL_D13C(iogrp),cmpflg,'p', & + & 'delta13clvl','delta13C of DIC',' ','permil',2) + call ncdefvar3d(LVL_D14C(iogrp),cmpflg,'p', & + & 'delta14clvl','delta14C of DIC',' ','permil',2) + call ncdefvar3d(LVL_BIGD14C(iogrp),cmpflg,'p', & + & 'bigdelta14clvl','big delta14C of DIC',' ','permil',2) + call ncdefvar3d(LVL_POC13(iogrp),cmpflg,'p', & + & 'detoc13lvl','Detritus13',' ','mol P m-3',2) + call ncdefvar3d(LVL_DOC13(iogrp),cmpflg,'p', & + & 'dissoc13lvl','Dissolved organic carbon13',' ','mol P m-3',2) + call ncdefvar3d(LVL_CALC13(iogrp),cmpflg,'p', & + & 'calc13lvl','Ca13CO3 shells',' ','mol 13C m-3',2) + call ncdefvar3d(LVL_PHYTO13(iogrp),cmpflg,'p', & + & 'phyc13lvl','Phytoplankton13',' ','mol P m-3',2) + call ncdefvar3d(LVL_GRAZER13(iogrp),cmpflg,'p', & + & 'zooc13lvl','Zooplankton13',' ','mol P m-3',2) + end if + if (use_AGG) then + call ncdefvar3d(LVL_NOS(iogrp),cmpflg,'p','noslvl', & + & 'Marine snow aggregates per cm^3 sea water',' ','1/cm^3',2) + call ncdefvar3d(LVL_WPHY(iogrp),cmpflg,'p','wphylvl', & + & 'Av. mass sinking speed of marine snow',' ','m/day',2) + call ncdefvar3d(LVL_WNOS(iogrp),cmpflg,'p','wnoslvl', & + & 'Av. number sinking speed of marine snow',' ','m/day',2) + call ncdefvar3d(LVL_EPS(iogrp),cmpflg,'p','epslvl', & + & 'Av. size distribution exponent',' ','-',2) + call ncdefvar3d(LVL_ASIZE(iogrp),cmpflg,'p','asizelvl', & + & 'Av. size of marine snow aggregates',' ','nb. of cells',2) + end if + if (use_CFC) then + call ncdefvar3d(LVL_CFC11(iogrp),cmpflg,'p', & + & 'cfc11lvl','CFC-11',' ','mol cfc11 m-3',2) + call ncdefvar3d(LVL_CFC12(iogrp),cmpflg,'p', & + & 'cfc12lvl','CFC-12',' ','mol cfc12 m-3',2) + call ncdefvar3d(LVL_SF6(iogrp),cmpflg,'p', & + & 'sf6lvl','SF-6',' ','mol sf6 m-3',2) + end if + if (use_natDIC) then + call ncdefvar3d(LVL_NATCO3(iogrp),cmpflg,'p', & + & 'natco3lvl','Natural Carbonate ions',' ','mol C m-3',2) + call ncdefvar3d(LVL_NATALKALI(iogrp),cmpflg,'p','nattalklvl', & + & 'Natural alkalinity',' ','eq m-3',2) + call ncdefvar3d(LVL_NATDIC(iogrp),cmpflg,'p','natdissiclvl', & + & 'Natual dissolved inorganic carbon',' ','mol C m-3',2) + call ncdefvar3d(LVL_NATCALC(iogrp),cmpflg,'p', & + & 'natcalclvl','Natural CaCO3 shells',' ','mol C m-3',2) + call ncdefvar3d(LVL_NATPH(iogrp),cmpflg,'p', & + & 'natphlvl','Natural pH',' ','-log10([H+])',2) + call ncdefvar3d(LVL_NATOMEGAA(iogrp),cmpflg,'p', & + & 'natomegaalvl','Natural OmegaA',' ','1',2) + call ncdefvar3d(LVL_NATOMEGAC(iogrp),cmpflg,'p', & + & 'natomegaclvl','Natural OmegaC',' ','1',2) + end if + if (use_BROMO) then + call ncdefvar3d(LVL_BROMO(iogrp),cmpflg,'p', & + & 'bromolvl','Bromoform',' ','mol CHBr3 m-3',2) + end if ! --- define sediment fields -#ifndef sedbypass - call ncdefvar3d(SDM_POWAIC(iogrp),cmpflg,'p', & - & 'powdic','PoWa DIC',' ','mol C m-3',3) - call ncdefvar3d(SDM_POWAAL(iogrp),cmpflg,'p', & - & 'powalk','PoWa alkalinity',' ','eq m-3',3) - call ncdefvar3d(SDM_POWAPH(iogrp),cmpflg,'p', & - & 'powpho','PoWa phosphorus',' ','mol P m-3',3) - call ncdefvar3d(SDM_POWAOX(iogrp),cmpflg,'p', & - & 'powox','PoWa oxygen',' ','mol O2 m-3',3) - call ncdefvar3d(SDM_POWN2(iogrp), cmpflg,'p', & - & 'pown2','PoWa N2',' ','mol N2 m-3',3) - call ncdefvar3d(SDM_POWNO3(iogrp),cmpflg,'p', & - & 'powno3','PoWa nitrate',' ','mol N m-3',3) - call ncdefvar3d(SDM_POWASI(iogrp),cmpflg,'p', & - & 'powsi','PoWa silicate',' ','mol Si m-3',3) - call ncdefvar3d(SDM_SSSO12(iogrp),cmpflg,'p', & - & 'ssso12','Sediment detritus',' ','mol P m-3',3) - call ncdefvar3d(SDM_SSSSIL(iogrp),cmpflg,'p', & - & 'ssssil','Sediment silicate',' ','mol Si m-3',3) - call ncdefvar3d(SDM_SSSC12(iogrp),cmpflg,'p', & - & 'sssc12','Sediment CaCO3',' ','mol C m-3',3) - call ncdefvar3d(SDM_SSSTER(iogrp),cmpflg,'p', & - & 'ssster','Sediment clay',' ','kg m-3',3) + if (.not. use_sedbypass) then + call ncdefvar3d(SDM_POWAIC(iogrp),cmpflg,'p', & + & 'powdic','PoWa DIC',' ','mol C m-3',3) + call ncdefvar3d(SDM_POWAAL(iogrp),cmpflg,'p', & + & 'powalk','PoWa alkalinity',' ','eq m-3',3) + call ncdefvar3d(SDM_POWAPH(iogrp),cmpflg,'p', & + & 'powpho','PoWa phosphorus',' ','mol P m-3',3) + call ncdefvar3d(SDM_POWAOX(iogrp),cmpflg,'p', & + & 'powox','PoWa oxygen',' ','mol O2 m-3',3) + call ncdefvar3d(SDM_POWN2(iogrp), cmpflg,'p', & + & 'pown2','PoWa N2',' ','mol N2 m-3',3) + call ncdefvar3d(SDM_POWNO3(iogrp),cmpflg,'p', & + & 'powno3','PoWa nitrate',' ','mol N m-3',3) + call ncdefvar3d(SDM_POWASI(iogrp),cmpflg,'p', & + & 'powsi','PoWa silicate',' ','mol Si m-3',3) + call ncdefvar3d(SDM_SSSO12(iogrp),cmpflg,'p', & + & 'ssso12','Sediment detritus',' ','mol P m-3',3) + call ncdefvar3d(SDM_SSSSIL(iogrp),cmpflg,'p', & + & 'ssssil','Sediment silicate',' ','mol Si m-3',3) + call ncdefvar3d(SDM_SSSC12(iogrp),cmpflg,'p', & + & 'sssc12','Sediment CaCO3',' ','mol C m-3',3) + call ncdefvar3d(SDM_SSSTER(iogrp),cmpflg,'p', & + & 'ssster','Sediment clay',' ','kg m-3',3) - ! --- define sediment burial fields - call ncdefvar3d(BUR_SSSO12(iogrp), & - & cmpflg,'p','buro12','Burial org carbon',' ','mol P m-2',4) - call ncdefvar3d(BUR_SSSC12(iogrp), & - & cmpflg,'p','burc12','Burial CaCO3',' ','mol C m-2',4) - call ncdefvar3d(BUR_SSSSIL(iogrp), & - & cmpflg,'p','bursil','Burial silicate',' ','mol Si m-2',4) - call ncdefvar3d(BUR_SSSTER(iogrp), & - & cmpflg,'p','burter','Burial clay',' ','kg m-2',4) -#endif + ! --- define sediment burial fields + call ncdefvar3d(BUR_SSSO12(iogrp), & + & cmpflg,'p','buro12','Burial org carbon',' ','mol P m-2',4) + call ncdefvar3d(BUR_SSSC12(iogrp), & + & cmpflg,'p','burc12','Burial CaCO3',' ','mol C m-2',4) + call ncdefvar3d(BUR_SSSSIL(iogrp), & + & cmpflg,'p','bursil','Burial silicate',' ','mol Si m-2',4) + call ncdefvar3d(BUR_SSSTER(iogrp), & + & cmpflg,'p','burter','Burial clay',' ','kg m-2',4) + end if ! --- enddef netcdf file call ncedef diff --git a/hamocc/ocprod.F90 b/hamocc/ocprod.F90 index d98bc43c..f0aa3c1e 100644 --- a/hamocc/ocprod.F90 +++ b/hamocc/ocprod.F90 @@ -94,33 +94,34 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) use mo_vgrid, only: dp_min,dp_min_sink,k0100,k0500,k1000,k2000,k4000,kwrbioz,ptiestu use mod_xc, only: mnproc -#ifdef AGG + ! AGG use mo_biomod, only: alar1,alar2,alar3,alow1,alow2,alow3,asize3d,calmax,cellmass,cellsink,dustd1,dustd2,dustd3,dustsink, & & eps3d,fractdim,fse,fsh,nmldmin,plower,pupper,sinkexp,stick,tmfac,tsfac,vsmall,zdis,wmass,wnumb use mo_param1_bgc, only: iadust,inos use mo_vgrid, only: kmle -#elif defined(WLIN) + + ! WLIN use mo_biomod, only: wmin,wmax,wlin -#endif -#ifdef BROMO + + ! BROMO use mo_param1_bgc, only: ibromo use mo_biomod, only: int_chbr3_prod,int_chbr3_uv,rbro use mo_carbch, only: fbro1,fbro2 use mo_clim_swa, only: swa_clim -#endif -#ifdef cisonew + + ! CISONEW use mo_biomod, only: bifr13,bifr13_perm,bifr14,growth_co2 use mo_param1_bgc, only: icalc13,icalc14,idet13,idet14,idoc13,idoc14,iphy13,iphy14,isco213,isco214,izoo13,izoo14,safediv use mo_sedmnt, only: pror13,pror14,prca13,prca14 use mo_carbch, only: co2star -#endif -#ifdef natDIC + + ! natDIC use mo_param1_bgc, only: inatalkali,inatcalc,inatsco212 -#endif -#ifdef FB_BGC_OCE + + ! FB_BGC_OCE use mo_biomod, only: abs_oce,atten_f -#endif + use mo_ifdefs implicit none @@ -151,10 +152,11 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) real :: dmsprod,dms_bac,dms_uv real :: dtr,dz real :: wpocd,wcald,wopald,dagg -#ifdef sedbypass + + ! sedbypass real :: florca,flcaca,flsil -#endif -#ifdef cisonew + + ! cisonew real :: phygrowth real :: phosy13,phosy14 real :: grazing13,grazing14 @@ -177,11 +179,11 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) real :: rem13,rem14 real :: rco213,rco214,rdoc13,rdoc14,rdet13,rdet14 real :: rphy13,rphy14,rzoo13,rzoo14 -#ifdef sedbypass + + ! sedbypass real :: flor13,flor14,flca13,flca14 -#endif -#endif -#ifdef AGG + + ! AGG real :: aggregate(kpie,kpje,kpke) real :: dustagg(kpie,kpje,kpke) real :: avmass, avnos, anosloss @@ -189,12 +191,10 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) real :: TopM,TopF, snow,fshear,sagg1,sagg2,sagg4 real :: sett_agg,shear_agg,effsti,dfirst,dshagg,dsett real :: wnos,wnosd -#endif -#ifdef BROMO + + ! BROMO real :: bro_beta,bro_uv real :: abs_uv(kpie,kpje,kpke) -#endif - ! set variables for diagnostic output to zero expoor (:,:) = 0. @@ -221,14 +221,15 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) intdms_bac(:,:) = 0. intdms_uv (:,:) = 0. phosy3d (:,:,:) = 0. -#ifdef BROMO - int_chbr3_uv (:,:) = 0. - int_chbr3_prod (:,:) = 0. -#endif -#ifdef AGG - eps3d(:,:,:) = 0. - asize3d(:,:,:) = 0. -#endif + + if (use_BROMO) then + int_chbr3_uv (:,:) = 0. + int_chbr3_prod (:,:) = 0. + end if + if (use_AGG) then + eps3d(:,:,:) = 0. + asize3d(:,:,:) = 0. + end if ! parameter for DMS scheme (dmspar defined in BELEG_PARM) dmsp6 = dmspar(6) @@ -239,25 +240,24 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) dmsp1 = dmspar(1) -#ifdef PBGC_OCNP_TIMESTEP - if (mnproc == 1) then - write(io_stdo_bgc,*)' ' - write(io_stdo_bgc,*)'beginning of OCRPOD ' - endif - CALL INVENTORY_BGC(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask,0) -#endif - + if (use_PBGC_OCNP_TIMESTEP) then + if (mnproc == 1) then + write(io_stdo_bgc,*)' ' + write(io_stdo_bgc,*)'beginning of OCRPOD ' + endif + CALL INVENTORY_BGC(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask,0) + end if ! Calculate swr absorption by water and phytoplankton abs_bgc(:,:,:) = 0. -#ifdef BROMO - abs_uv(:,:,:) = 0. -#endif -#ifdef FB_BGC_OCE - abs_oce(:,:,:) = 0. - abs_oce(:,:,1) = 1. -#endif + if (use_BROMO) then + abs_uv(:,:,:) = 0. + end if + if (use_FB_BGC_OCE) then + abs_oce(:,:,:) = 0. + abs_oce(:,:,1) = 1. + endif !$OMP PARALLEL DO PRIVATE(i,k,absorption,absorption_uv,atten,dz) do j = 1,kpje @@ -277,15 +277,15 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) ! Average light intensity in layer k atten = atten_w + atten_c * max(0.,ocetra(i,j,k,iphy)) abs_bgc(i,j,k) = ((absorption/atten)* (1.-exp(-atten*dz)))/dz -#ifdef BROMO - abs_uv(i,j,k) = ((absorption_uv/atten_uv)*(1.-exp(-atten_uv*dz)))/dz -#endif -#ifdef FB_BGC_OCE - abs_oce(i,j,k) = abs_oce(i,j,k) * absorption - if (k == 2) then - abs_oce(i,j,2) = atten_f * absorption + if (use_BROMO) then + abs_uv(i,j,k) = ((absorption_uv/atten_uv)*(1.-exp(-atten_uv*dz)))/dz + endif + if (use_FB_BGC_OCE) then + abs_oce(i,j,k) = abs_oce(i,j,k) * absorption + if (k == 2) then + abs_oce(i,j,2) = atten_f * absorption + endif endif -#endif ! Radiation intensity I_0 at the top of next layer absorption = absorption * exp(-atten*dz) @@ -305,19 +305,16 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) !$OMP ,phosy,ya,yn,grazing,graton,gratpoc,grawa,bacfra,phymor & !$OMP ,zoomor,excdoc,exud,export,delsil,delcar,dmsprod & !$OMP ,dms_bac,dms_uv,dtr,phofa,temfa,zoothresh,dms_ph,dz & -# ifdef AGG +! use_AGG !$OMP ,avmass,avnos,zmornos & -# endif -# ifdef cisonew +! use_cisonew !$OMP ,rco213,rco214,rphy13,rphy14,rzoo13,rzoo14,grazing13,grazing14 & !$OMP ,graton13,graton14,gratpoc13,gratpoc14,grawa13,grawa14 & !$OMP ,phosy13,phosy14,bacfra13,bacfra14,phymor13,phymor14,zoomor13 & !$OMP ,zoomor14,excdoc13,excdoc14,exud13,exud14,export13,export14 & !$OMP ,delcar13,delcar14,dtr13,dtr14,bifr13,bifr14 & -# endif -# ifdef BROMO +! use_BROMO !$OMP ,bro_beta,bro_uv & -# endif !$OMP ,i,k) loop1: do j = 1,kpje @@ -327,9 +324,9 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) if(pddpo(i,j,k) > dp_min .and. omask(i,j) > 0.5) then -#ifdef AGG - avmass = ocetra(i,j,k,iphy) + ocetra(i,j,k,idet) -#endif /*AGG*/ + if (use_AGG) then + avmass = ocetra(i,j,k,iphy) + ocetra(i,j,k,idet) + end if temp = min(40.,max(-3.,ptho(i,j,k))) phofa = pi_alpha * strahl(i,j) * abs_bgc(i,j,k) @@ -366,73 +363,74 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) excdoc = gammaz*zoothresh ! excretion of doc by zooplankton export = zoomor*(1.-ecan) + phymor + gratpoc ! ecan=.95, gratpoc= .2*grazing -#ifdef cisonew -! calculation of isotope fractionation during photosynthesis (Laws 1997) - if(ocetra(i,j,k,iphy) < phytomi) then - bifr13 = 1. - else - phygrowth = ((ocetra(i,j,k,iphy)+phosy)/ocetra(i,j,k,iphy))/dtb ! Growth rate phytoplankton [1/d] - growth_co2 = phygrowth/(co2star(i,j,k)*1.e6+safediv) ! CO2* in [mol/kg] - bifr13_perm = (6.03 + 5.5*growth_co2)/(0.225 + growth_co2) ! Permil (~20) - bifr13_perm = max(5.,min(26.,bifr13_perm)) ! Limit the range to [5,26] - bifr13 = (1000. - bifr13_perm) / 1000. ! Fractionation factor 13c (~0.98) - endif - - bifr14 = bifr13**2 - -! calculation of 13C and 14C equivalent of biology - rco213 = ocetra(i,j,k,isco213)/(ocetra(i,j,k,isco212)+safediv) - rco214 = ocetra(i,j,k,isco214)/(ocetra(i,j,k,isco212)+safediv) - rphy13 = ocetra(i,j,k,iphy13)/(ocetra(i,j,k,iphy)+safediv) - rphy14 = ocetra(i,j,k,iphy14)/(ocetra(i,j,k,iphy)+safediv) - rzoo13 = ocetra(i,j,k,izoo13)/(ocetra(i,j,k,izoo)+safediv) - rzoo14 = ocetra(i,j,k,izoo14)/(ocetra(i,j,k,izoo)+safediv) - - phosy13 = phosy*bifr13*rco213 - phosy14 = phosy*bifr14*rco214 - - grazing13 = grazing*rphy13 - grazing14 = grazing*rphy14 - - graton13 = epsher*(1.-zinges)*grazing13 - graton14 = epsher*(1.-zinges)*grazing14 - - gratpoc13 = (1.-epsher)*grazing13 - gratpoc14 = (1.-epsher)*grazing14 - - grawa13 = epsher*zinges*grazing13 - grawa14 = epsher*zinges*grazing14 - - bacfra13 = remido*ocetra(i,j,k,idoc13) - bacfra14 = remido*ocetra(i,j,k,idoc14) - - phymor13 = phymor*rphy13 - phymor14 = phymor*rphy14 - - zoomor13 = zoomor*rzoo13 - zoomor14 = zoomor*rzoo14 - - excdoc13 = excdoc*rzoo13 - excdoc14 = excdoc*rzoo14 - - exud13 = exud*rphy13 - exud14 = exud*rphy14 + if (use_cisonew) then + ! calculation of isotope fractionation during photosynthesis (Laws 1997) + if(ocetra(i,j,k,iphy) < phytomi) then + bifr13 = 1. + else + phygrowth = ((ocetra(i,j,k,iphy)+phosy)/ocetra(i,j,k,iphy))/dtb ! Growth rate phytoplankton [1/d] + growth_co2 = phygrowth/(co2star(i,j,k)*1.e6+safediv) ! CO2* in [mol/kg] + bifr13_perm = (6.03 + 5.5*growth_co2)/(0.225 + growth_co2) ! Permil (~20) + bifr13_perm = max(5.,min(26.,bifr13_perm)) ! Limit the range to [5,26] + bifr13 = (1000. - bifr13_perm) / 1000. ! Fractionation factor 13c (~0.98) + endif - export13 = zoomor13*(1.-ecan) + phymor13 + gratpoc13 - export14 = zoomor14*(1.-ecan) + phymor14 + gratpoc14 -#endif -#ifdef AGG - delsil = MIN(ropal*phosy*avsil/(avsil+bkopal),0.5*avsil) - delcar = rcalc*MIN(calmax*phosy,(phosy-delsil/ropal)) -! definition of delcar13/14 for the AGG scheme currently missing -#else - delsil = MIN(ropal*export*avsil/(avsil+bkopal),0.5*avsil) - delcar = rcalc * export * bkopal/(avsil+bkopal) -#ifdef cisonew - delcar13 = rcalc * export13 * bkopal/(avsil+bkopal) - delcar14 = rcalc * export14 * bkopal/(avsil+bkopal) -#endif -#endif + bifr14 = bifr13**2 + + ! calculation of 13C and 14C equivalent of biology + rco213 = ocetra(i,j,k,isco213)/(ocetra(i,j,k,isco212)+safediv) + rco214 = ocetra(i,j,k,isco214)/(ocetra(i,j,k,isco212)+safediv) + rphy13 = ocetra(i,j,k,iphy13)/(ocetra(i,j,k,iphy)+safediv) + rphy14 = ocetra(i,j,k,iphy14)/(ocetra(i,j,k,iphy)+safediv) + rzoo13 = ocetra(i,j,k,izoo13)/(ocetra(i,j,k,izoo)+safediv) + rzoo14 = ocetra(i,j,k,izoo14)/(ocetra(i,j,k,izoo)+safediv) + + phosy13 = phosy*bifr13*rco213 + phosy14 = phosy*bifr14*rco214 + + grazing13 = grazing*rphy13 + grazing14 = grazing*rphy14 + + graton13 = epsher*(1.-zinges)*grazing13 + graton14 = epsher*(1.-zinges)*grazing14 + + gratpoc13 = (1.-epsher)*grazing13 + gratpoc14 = (1.-epsher)*grazing14 + + grawa13 = epsher*zinges*grazing13 + grawa14 = epsher*zinges*grazing14 + + bacfra13 = remido*ocetra(i,j,k,idoc13) + bacfra14 = remido*ocetra(i,j,k,idoc14) + + phymor13 = phymor*rphy13 + phymor14 = phymor*rphy14 + + zoomor13 = zoomor*rzoo13 + zoomor14 = zoomor*rzoo14 + + excdoc13 = excdoc*rzoo13 + excdoc14 = excdoc*rzoo14 + + exud13 = exud*rphy13 + exud14 = exud*rphy14 + + export13 = zoomor13*(1.-ecan) + phymor13 + gratpoc13 + export14 = zoomor14*(1.-ecan) + phymor14 + gratpoc14 + end if + + if (use_AGG) then + delsil = MIN(ropal*phosy*avsil/(avsil+bkopal),0.5*avsil) + delcar = rcalc*MIN(calmax*phosy,(phosy-delsil/ropal)) + ! definition of delcar13/14 for the AGG scheme currently missing + else + delsil = MIN(ropal*export*avsil/(avsil+bkopal),0.5*avsil) + delcar = rcalc * export * bkopal/(avsil+bkopal) + if (use_cisonew) then + delcar13 = rcalc * export13 * bkopal/(avsil+bkopal) + delcar14 = rcalc * export14 * bkopal/(avsil+bkopal) + end if + end if if(with_dmsph) then dms_ph = 1. + (-log10(hi(i,j,1)) - pi_ph(i,j))*dms_gamma @@ -458,81 +456,81 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) ocetra(i,j,k,izoo) = ocetra(i,j,k,izoo)+grawa-excdoc-zoomor ocetra(i,j,k,idoc) = ocetra(i,j,k,idoc)-bacfra+excdoc+exud ocetra(i,j,k,icalc) = ocetra(i,j,k,icalc)+delcar -#ifdef cisonew - dtr13 = bacfra13-phosy13+graton13+ecan*zoomor13 - dtr14 = bacfra14-phosy14+graton14+ecan*zoomor14 - - ocetra(i,j,k,idet13) = ocetra(i,j,k,idet13)+export13 - ocetra(i,j,k,idet14) = ocetra(i,j,k,idet14)+export14 - ocetra(i,j,k,isco213) = ocetra(i,j,k,isco213)-delcar13+rcar*dtr13 - ocetra(i,j,k,isco214) = ocetra(i,j,k,isco214)-delcar14+rcar*dtr14 - ocetra(i,j,k,iphy13) = ocetra(i,j,k,iphy13)+phosy13-grazing13-phymor13-exud13 - ocetra(i,j,k,iphy14) = ocetra(i,j,k,iphy14)+phosy14-grazing14-phymor14-exud14 - ocetra(i,j,k,izoo13) = ocetra(i,j,k,izoo13)+grawa13-excdoc13-zoomor13 - ocetra(i,j,k,izoo14) = ocetra(i,j,k,izoo14)+grawa14-excdoc14-zoomor14 - ocetra(i,j,k,idoc13) = ocetra(i,j,k,idoc13)-bacfra13+excdoc13+exud13 - ocetra(i,j,k,idoc14) = ocetra(i,j,k,idoc14)-bacfra14+excdoc14+exud14 - ocetra(i,j,k,icalc13) = ocetra(i,j,k,icalc13)+delcar13 - ocetra(i,j,k,icalc14) = ocetra(i,j,k,icalc14)+delcar14 -#endif -#ifdef natDIC - ocetra(i,j,k,inatsco212) = ocetra(i,j,k,inatsco212)-delcar+rcar*dtr - ocetra(i,j,k,inatalkali) = ocetra(i,j,k,inatalkali)-2.*delcar-(rnit+1)*dtr - ocetra(i,j,k,inatcalc) = ocetra(i,j,k,inatcalc)+delcar -#endif + if (use_cisonew) then + dtr13 = bacfra13-phosy13+graton13+ecan*zoomor13 + dtr14 = bacfra14-phosy14+graton14+ecan*zoomor14 + + ocetra(i,j,k,idet13) = ocetra(i,j,k,idet13)+export13 + ocetra(i,j,k,idet14) = ocetra(i,j,k,idet14)+export14 + ocetra(i,j,k,isco213) = ocetra(i,j,k,isco213)-delcar13+rcar*dtr13 + ocetra(i,j,k,isco214) = ocetra(i,j,k,isco214)-delcar14+rcar*dtr14 + ocetra(i,j,k,iphy13) = ocetra(i,j,k,iphy13)+phosy13-grazing13-phymor13-exud13 + ocetra(i,j,k,iphy14) = ocetra(i,j,k,iphy14)+phosy14-grazing14-phymor14-exud14 + ocetra(i,j,k,izoo13) = ocetra(i,j,k,izoo13)+grawa13-excdoc13-zoomor13 + ocetra(i,j,k,izoo14) = ocetra(i,j,k,izoo14)+grawa14-excdoc14-zoomor14 + ocetra(i,j,k,idoc13) = ocetra(i,j,k,idoc13)-bacfra13+excdoc13+exud13 + ocetra(i,j,k,idoc14) = ocetra(i,j,k,idoc14)-bacfra14+excdoc14+exud14 + ocetra(i,j,k,icalc13) = ocetra(i,j,k,icalc13)+delcar13 + ocetra(i,j,k,icalc14) = ocetra(i,j,k,icalc14)+delcar14 + end if + if (use_natDIC) then + ocetra(i,j,k,inatsco212) = ocetra(i,j,k,inatsco212)-delcar+rcar*dtr + ocetra(i,j,k,inatalkali) = ocetra(i,j,k,inatalkali)-2.*delcar-(rnit+1)*dtr + ocetra(i,j,k,inatcalc) = ocetra(i,j,k,inatcalc)+delcar + end if ocetra(i,j,k,isilica) = ocetra(i,j,k,isilica)-delsil+dremopal*ocetra(i,j,k,iopal) ocetra(i,j,k,iopal) = ocetra(i,j,k,iopal)+delsil-dremopal*ocetra(i,j,k,iopal) ocetra(i,j,k,iiron) = ocetra(i,j,k,iiron)+dtr*riron & & - relaxfe*MAX(ocetra(i,j,k,iiron)-fesoly,0.) -#ifdef BROMO -! Bromo source from phytoplankton production and sink to photolysis -! Hense and Quack (200) Pg537 Decay time scale is 30days =0.0333/day -! sinks owing to degradation by nitrifiers (Pg 538 of Hense and Quack, -! 2009) is omitted because the magnitude is more than 2 order smaller -! than sink through halide substitution & hydrolysis (Fig. 3) -! Assume that only 30% of incoming radiation are UV (i.e. 50% of non-PAR -! radiation; PAR radiationis assume to be 40% of incoming radiation) - bro_beta = rbro*(fbro1*avsil/(avsil+bkopal)+fbro2*bkopal/(avsil+bkopal)) - if (swa_clim(i,j,1) > 0.) then - bro_uv = 0.0333*dtb*0.3*(strahl(i,j)/swa_clim(i,j,1))*abs_uv(i,j,k)*ocetra(i,j,k,ibromo) - else - bro_uv = 0.0 - endif - ocetra(i,j,k,ibromo) = ocetra(i,j,k,ibromo)+bro_beta*phosy-bro_uv -#endif - -#ifdef AGG -!*********************************************************************** -! effects of biological processes on number of particles: -! photosynthesis creates POM -! exudation deletes POM -! grazing deletes POM; but only the fraction that is not egested as -! fecal pellets again (grawa remains in zoo, graton goes to po4) -! none of the processes at the current time is assumed to change -! the size distribution (subject to change) -! NOTE that phosy, exud etc. are in kmol/m3! -! Thus divide by avmass (kmol/m3) -!********************************************************************** - - if(avmass > 0.) then - avnos = ocetra(i,j,k,inos) - anosloss = (phosy-exud-graton-grawa)*avnos/avmass - ocetra(i,j,k,inos) = ocetra(i,j,k,inos)+anosloss - endif -!*********************************************************************** -! dead zooplankton corpses come with their own, flat distribution -! this flow even takes place if there is neither nos nor mass -! NOTE: zoomor is in kmol/m3!! Thus multiply flow by 1.e+6 -!*********************************************************************** - - zmornos = zoomor * (1.-ecan) * zdis * 1.e+6 - ocetra(i,j,k,inos) = ocetra(i,j,k,inos)+zmornos - -#endif /*AGG*/ + if (use_BROMO) then + ! Bromo source from phytoplankton production and sink to photolysis + ! Hense and Quack (200) Pg537 Decay time scale is 30days =0.0333/day + ! sinks owing to degradation by nitrifiers (Pg 538 of Hense and Quack, + ! 2009) is omitted because the magnitude is more than 2 order smaller + ! than sink through halide substitution & hydrolysis (Fig. 3) + ! Assume that only 30% of incoming radiation are UV (i.e. 50% of non-PAR + ! radiation; PAR radiationis assume to be 40% of incoming radiation) + bro_beta = rbro*(fbro1*avsil/(avsil+bkopal)+fbro2*bkopal/(avsil+bkopal)) + if (swa_clim(i,j,1) > 0.) then + bro_uv = 0.0333*dtb*0.3*(strahl(i,j)/swa_clim(i,j,1))*abs_uv(i,j,k)*ocetra(i,j,k,ibromo) + else + bro_uv = 0.0 + endif + ocetra(i,j,k,ibromo) = ocetra(i,j,k,ibromo)+bro_beta*phosy-bro_uv + end if + + if (use_AGG) then + + !*********************************************************************** + ! effects of biological processes on number of particles: + ! photosynthesis creates POM + ! exudation deletes POM + ! grazing deletes POM; but only the fraction that is not egested as + ! fecal pellets again (grawa remains in zoo, graton goes to po4) + ! none of the processes at the current time is assumed to change + ! the size distribution (subject to change) + ! NOTE that phosy, exud etc. are in kmol/m3! + ! Thus divide by avmass (kmol/m3) + !********************************************************************** + if(avmass > 0.) then + avnos = ocetra(i,j,k,inos) + anosloss = (phosy-exud-graton-grawa)*avnos/avmass + ocetra(i,j,k,inos) = ocetra(i,j,k,inos)+anosloss + endif -! add up for total inventory and output + !*********************************************************************** + ! dead zooplankton corpses come with their own, flat distribution + ! this flow even takes place if there is neither nos nor mass + ! NOTE: zoomor is in kmol/m3!! Thus multiply flow by 1.e+6 + !*********************************************************************** + + zmornos = zoomor * (1.-ecan) * zdis * 1.e+6 + ocetra(i,j,k,inos) = ocetra(i,j,k,inos)+zmornos + end if + + ! add up for total inventory and output dz = pddpo(i,j,k) expoor(i,j) = expoor(i,j) +export*rcar*dz @@ -541,10 +539,12 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) intdmsprod(i,j) = intdmsprod(i,j)+dmsprod*dz intdms_bac(i,j) = intdms_bac(i,j)+dms_bac*dz intdms_uv(i,j) = intdms_uv (i,j)+dms_uv*dz -#ifdef BROMO - int_chbr3_uv(i,j) = int_chbr3_uv (i,j) + bro_uv*dz - int_chbr3_prod(i,j) = int_chbr3_prod (i,j) + bro_beta*phosy*dz -#endif + + if (use_BROMO) then + int_chbr3_uv(i,j) = int_chbr3_uv (i,j) + bro_uv*dz + int_chbr3_prod(i,j) = int_chbr3_prod (i,j) + bro_beta*phosy*dz + end if + intphosy(i,j) = intphosy(i,j) +phosy*rcar*dz ! primary production in kmol C m-2 phosy3d(i,j,k) = phosy*rcar ! primary production in kmol C m-3 @@ -556,24 +556,23 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) !$OMP END PARALLEL DO -#ifdef PBGC_OCNP_TIMESTEP - if (mnproc == 1) then - write(io_stdo_bgc,*)' ' - write(io_stdo_bgc,*)'in OCRPOD after 1st bio prod' + if (use_PBGC_OCNP_TIMESTEP) then + if (mnproc == 1) then + write(io_stdo_bgc,*)' ' + write(io_stdo_bgc,*)'in OCRPOD after 1st bio prod' + endif + CALL INVENTORY_BGC(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask,0) endif - CALL INVENTORY_BGC(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask,0) -#endif !$OMP PARALLEL DO PRIVATE(phythresh,zoothresh,sterph,sterzo,remin & !$OMP ,opalrem,aou,refra,dms_bac,pocrem,docrem,phyrem,dz & -# ifdef AGG +! use_AGG !$OMP ,avmass,avnos,zmornos & -# endif -# ifdef cisonew +! use_cisonew !$OMP ,rphy13,rphy14,rzoo13,rzoo14,rdet13,rdet14,rdoc13,rdoc14 & !$OMP ,sterph13,sterph14,sterzo13,sterzo14,pocrem13,pocrem14 & !$OMP ,docrem13,docrem14,phyrem13,phyrem14 & -# endif +! !$OMP ,i,k) loop2: do j = 1,kpje @@ -581,62 +580,62 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) do k = kwrbioz(i,j)+1,kpke if(pddpo(i,j,k) > dp_min .and. omask(i,j) > 0.5) then -#ifdef AGG - avmass = ocetra(i,j,k,iphy)+ocetra(i,j,k,idet) -#endif /*AGG*/ + if (use_AGG) then + avmass = ocetra(i,j,k,iphy)+ocetra(i,j,k,idet) + endif temp = min(40.,max(-3.,ptho(i,j,k))) phythresh = MAX(0.,(ocetra(i,j,k,iphy)-2.*phytomi)) zoothresh = MAX(0.,(ocetra(i,j,k,izoo)-2.*grami)) sterph = 0.5*dyphy*phythresh ! phytoplankton to detritus sterzo = spemor*zoothresh*zoothresh ! quadratic mortality -#ifdef cisonew - rphy13 = ocetra(i,j,k,iphy13)/(ocetra(i,j,k,iphy)+safediv) - rphy14 = ocetra(i,j,k,iphy14)/(ocetra(i,j,k,iphy)+safediv) - rzoo13 = ocetra(i,j,k,izoo13)/(ocetra(i,j,k,izoo)+safediv) - rzoo14 = ocetra(i,j,k,izoo14)/(ocetra(i,j,k,izoo)+safediv) - rdet13 = ocetra(i,j,k,idet13)/(ocetra(i,j,k,idet)+safediv) - rdet14 = ocetra(i,j,k,idet14)/(ocetra(i,j,k,idet)+safediv) - rdoc13 = ocetra(i,j,k,idoc13)/(ocetra(i,j,k,idoc)+safediv) - rdoc14 = ocetra(i,j,k,idoc14)/(ocetra(i,j,k,idoc)+safediv) - - sterph13 = sterph*rphy13 - sterph14 = sterph*rphy14 - sterzo13 = sterzo*rzoo13 - sterzo14 = sterzo*rzoo14 -#endif + if (use_cisonew) then + rphy13 = ocetra(i,j,k,iphy13)/(ocetra(i,j,k,iphy)+safediv) + rphy14 = ocetra(i,j,k,iphy14)/(ocetra(i,j,k,iphy)+safediv) + rzoo13 = ocetra(i,j,k,izoo13)/(ocetra(i,j,k,izoo)+safediv) + rzoo14 = ocetra(i,j,k,izoo14)/(ocetra(i,j,k,izoo)+safediv) + rdet13 = ocetra(i,j,k,idet13)/(ocetra(i,j,k,idet)+safediv) + rdet14 = ocetra(i,j,k,idet14)/(ocetra(i,j,k,idet)+safediv) + rdoc13 = ocetra(i,j,k,idoc13)/(ocetra(i,j,k,idoc)+safediv) + rdoc14 = ocetra(i,j,k,idoc14)/(ocetra(i,j,k,idoc)+safediv) + + sterph13 = sterph*rphy13 + sterph14 = sterph*rphy14 + sterzo13 = sterzo*rzoo13 + sterzo14 = sterzo*rzoo14 + endif ocetra(i,j,k,iphy) = ocetra(i,j,k,iphy)-sterph ocetra(i,j,k,izoo) = ocetra(i,j,k,izoo)-sterzo -#ifdef cisonew - ocetra(i,j,k,iphy13) = ocetra(i,j,k,iphy13)-sterph13 - ocetra(i,j,k,iphy14) = ocetra(i,j,k,iphy14)-sterph14 - ocetra(i,j,k,izoo13) = ocetra(i,j,k,izoo13)-sterzo13 - ocetra(i,j,k,izoo14) = ocetra(i,j,k,izoo14)-sterzo14 -#endif + if (use_cisonew) then + ocetra(i,j,k,iphy13) = ocetra(i,j,k,iphy13)-sterph13 + ocetra(i,j,k,iphy14) = ocetra(i,j,k,iphy14)-sterph14 + ocetra(i,j,k,izoo13) = ocetra(i,j,k,izoo13)-sterzo13 + ocetra(i,j,k,izoo14) = ocetra(i,j,k,izoo14)-sterzo14 + endif if(ocetra(i,j,k,ioxygen) > 5.e-8) then pocrem = MIN(drempoc*ocetra(i,j,k,idet),0.33*ocetra(i,j,k,ioxygen)/ro2ut) docrem = MIN( remido*ocetra(i,j,k,idoc),0.33*ocetra(i,j,k,ioxygen)/ro2ut) phyrem = MIN(0.5*dyphy*phythresh, 0.33*ocetra(i,j,k,ioxygen)/ro2ut) -#ifdef cisonew - pocrem13 = pocrem*rdet13 - pocrem14 = pocrem*rdet14 - docrem13 = docrem*rdoc13 - docrem14 = docrem*rdoc14 - phyrem13 = phyrem*rphy13 - phyrem14 = phyrem*rphy14 -#endif + if (use_cisonew) then + pocrem13 = pocrem*rdet13 + pocrem14 = pocrem*rdet14 + docrem13 = docrem*rdoc13 + docrem14 = docrem*rdoc14 + phyrem13 = phyrem*rphy13 + phyrem14 = phyrem*rphy14 + endif else pocrem = 0. docrem = 0. phyrem = 0. -#ifdef cisonew - pocrem13 = 0. - docrem13 = 0. - phyrem13 = 0. - pocrem14 = 0. - docrem14 = 0. - phyrem14 = 0. -#endif + if (use_cisonew) then + pocrem13 = 0. + docrem13 = 0. + phyrem13 = 0. + pocrem14 = 0. + docrem14 = 0. + phyrem14 = 0. + endif endif ocetra(i,j,k,idet) = ocetra(i,j,k,idet) - pocrem + sterph + sterzo @@ -652,21 +651,21 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) ocetra(i,j,k,ioxygen) = ocetra(i,j,k,ioxygen)-ro2ut*remin ocetra(i,j,k,iiron) = ocetra(i,j,k,iiron)+remin*riron & & -relaxfe*MAX(ocetra(i,j,k,iiron)-fesoly,0.) -#ifdef natDIC - ocetra(i,j,k,inatsco212) = ocetra(i,j,k,inatsco212)+rcar*remin - ocetra(i,j,k,inatalkali) = ocetra(i,j,k,inatalkali)-(rnit+1)*remin -#endif -#ifdef cisonew - ocetra(i,j,k,idet13) = ocetra(i,j,k,idet13)-pocrem13+sterph13+sterzo13 - ocetra(i,j,k,idet14) = ocetra(i,j,k,idet14)-pocrem14+sterph14+sterzo14 - ocetra(i,j,k,idoc13) = ocetra(i,j,k,idoc13)-docrem13 - ocetra(i,j,k,idoc14) = ocetra(i,j,k,idoc14)-docrem14 - ocetra(i,j,k,iphy13) = ocetra(i,j,k,iphy13)-phyrem13 - ocetra(i,j,k,iphy14) = ocetra(i,j,k,iphy14)-phyrem14 - - ocetra(i,j,k,isco213) = ocetra(i,j,k,isco213)+rcar*(pocrem13+docrem13+phyrem13) - ocetra(i,j,k,isco214) = ocetra(i,j,k,isco214)+rcar*(pocrem14+docrem14+phyrem14) -#endif + if (use_natDIC) then + ocetra(i,j,k,inatsco212) = ocetra(i,j,k,inatsco212)+rcar*remin + ocetra(i,j,k,inatalkali) = ocetra(i,j,k,inatalkali)-(rnit+1)*remin + endif + if (use_cisonew) then + ocetra(i,j,k,idet13) = ocetra(i,j,k,idet13)-pocrem13+sterph13+sterzo13 + ocetra(i,j,k,idet14) = ocetra(i,j,k,idet14)-pocrem14+sterph14+sterzo14 + ocetra(i,j,k,idoc13) = ocetra(i,j,k,idoc13)-docrem13 + ocetra(i,j,k,idoc14) = ocetra(i,j,k,idoc14)-docrem14 + ocetra(i,j,k,iphy13) = ocetra(i,j,k,iphy13)-phyrem13 + ocetra(i,j,k,iphy14) = ocetra(i,j,k,iphy14)-phyrem14 + + ocetra(i,j,k,isco213) = ocetra(i,j,k,isco213)+rcar*(pocrem13+docrem13+phyrem13) + ocetra(i,j,k,isco214) = ocetra(i,j,k,isco214)+rcar*(pocrem14+docrem14+phyrem14) + endif !*********************************************************************** ! as ragueneau (2000) notes, Si(OH)4sat is about 1000 umol, but ! Si(OH)4 varies only between 0-100 umol @@ -693,24 +692,24 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) dz = pddpo(i,j,k) intdms_bac(i,j) = intdms_bac(i,j)+dms_bac*dz -#ifdef AGG -!*********************************************************************** -! loss of snow numbers due to remineralization of poc -! gain of snow numbers due to zooplankton mortality -! NOTE that remin is in kmol/m3. Thus divide by avmass (kmol/m3) -!*********************************************************************** - if(avmass > 0.) then - avnos = ocetra(i,j,k,inos) - ocetra(i,j,k,inos) = ocetra(i,j,k,inos)-remin*avnos/avmass - endif -!*********************************************************************** -! dead zooplankton corpses come with their own, flat distribution -! this flow even takes place if there is neither nos nor mass -! NOTE: zoomor is in kmol/m3!! Thus multiply flow by 1.e+6 -!*********************************************************************** - zmornos = sterzo * zdis * 1.e+6 - ocetra(i,j,k,inos) = ocetra(i,j,k,inos) + zmornos -#endif /*AGG*/ + if (use_AGG) then + !*********************************************************************** + ! loss of snow numbers due to remineralization of poc + ! gain of snow numbers due to zooplankton mortality + ! NOTE that remin is in kmol/m3. Thus divide by avmass (kmol/m3) + !*********************************************************************** + if(avmass > 0.) then + avnos = ocetra(i,j,k,inos) + ocetra(i,j,k,inos) = ocetra(i,j,k,inos)-remin*avnos/avmass + endif + !*********************************************************************** + ! dead zooplankton corpses come with their own, flat distribution + ! this flow even takes place if there is neither nos nor mass + ! NOTE: zoomor is in kmol/m3!! Thus multiply flow by 1.e+6 + !*********************************************************************** + zmornos = sterzo * zdis * 1.e+6 + ocetra(i,j,k,inos) = ocetra(i,j,k,inos) + zmornos + endif/*AGG*/ endif enddo @@ -718,21 +717,19 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) enddo loop2 !$OMP END PARALLEL DO -#ifdef PBGC_OCNP_TIMESTEP - if (mnproc == 1) then - write(io_stdo_bgc,*)' ' - write(io_stdo_bgc,*)'in OCRPOD after poc remin' + if (use_PBGC_OCNP_TIMESTEP) then + if (mnproc == 1) then + write(io_stdo_bgc,*)' ' + write(io_stdo_bgc,*)'in OCRPOD after poc remin' + endif + CALL INVENTORY_BGC(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask,0) endif - CALL INVENTORY_BGC(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask,0) -#endif !$OMP PARALLEL DO PRIVATE(remin,remin2o,dz & -# ifdef AGG +! use_AGG !$OMP ,avmass,avnos & -# endif -#ifdef cisonew +! use_cisonew !$OMP ,rem13,rem14 & -#endif !$OMP ,i,k) loop3: do j = 1,kpje do i = 1,kpie @@ -741,19 +738,19 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) if(ocetra(i,j,k,ioxygen) < 5.e-7 .and. pddpo(i,j,k) > dp_min) then -#ifdef AGG - avmass = ocetra(i,j,k,iphy) + ocetra(i,j,k,idet) -#endif /*AGG*/ + if (use_AGG) then + avmass = ocetra(i,j,k,iphy) + ocetra(i,j,k,idet) + endif remin = 0.05 * drempoc * MIN(ocetra(i,j,k,idet), & & 0.5 * ocetra(i,j,k,iano3) / rdnit1) remin2o = dremn2o * MIN(ocetra(i,j,k,idet), & & 0.003 * ocetra(i,j,k,ian2o) / rdn2o1) -#ifdef cisonew - rem13 = (remin+remin2o)*ocetra(i,j,k,idet13)/(ocetra(i,j,k,idet)+safediv) - rem14 = (remin+remin2o)*ocetra(i,j,k,idet14)/(ocetra(i,j,k,idet)+safediv) -#endif + if (use_cisonew) then + rem13 = (remin+remin2o)*ocetra(i,j,k,idet13)/(ocetra(i,j,k,idet)+safediv) + rem14 = (remin+remin2o)*ocetra(i,j,k,idet14)/(ocetra(i,j,k,idet)+safediv) + endif ocetra(i,j,k,ialkali) = ocetra(i,j,k,ialkali)+(rdnit1-1)*remin-remin2o ocetra(i,j,k,isco212) = ocetra(i,j,k,isco212)+rcar*(remin+remin2o) ocetra(i,j,k,idet) = ocetra(i,j,k,idet)-(remin+remin2o) @@ -762,31 +759,31 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) ocetra(i,j,k,igasnit) = ocetra(i,j,k,igasnit)+rdnit2*remin+rdn2o2*remin2o ocetra(i,j,k,iiron) = ocetra(i,j,k,iiron)+riron*(remin+remin2o) ocetra(i,j,k,ian2o) = ocetra(i,j,k,ian2o)-rdn2o1*remin2o -#ifdef natDIC - ocetra(i,j,k,inatalkali) = ocetra(i,j,k,inatalkali)+(rdnit1-1)*remin-remin2o - ocetra(i,j,k,inatsco212) = ocetra(i,j,k,inatsco212)+rcar*(remin+remin2o) -#endif -#ifdef cisonew - ocetra(i,j,k,isco213) = ocetra(i,j,k,isco213)+rcar*rem13 - ocetra(i,j,k,isco214) = ocetra(i,j,k,isco214)+rcar*rem14 - ocetra(i,j,k,idet13) = ocetra(i,j,k,idet13)-rem13 - ocetra(i,j,k,idet14) = ocetra(i,j,k,idet14)-rem14 -#endif - -! nitrate loss through denitrification in kmol N m-2 + if (use_natDIC) then + ocetra(i,j,k,inatalkali) = ocetra(i,j,k,inatalkali)+(rdnit1-1)*remin-remin2o + ocetra(i,j,k,inatsco212) = ocetra(i,j,k,inatsco212)+rcar*(remin+remin2o) + endif + if (use_cisonew) then + ocetra(i,j,k,isco213) = ocetra(i,j,k,isco213)+rcar*rem13 + ocetra(i,j,k,isco214) = ocetra(i,j,k,isco214)+rcar*rem14 + ocetra(i,j,k,idet13) = ocetra(i,j,k,idet13)-rem13 + ocetra(i,j,k,idet14) = ocetra(i,j,k,idet14)-rem14 + endif + + ! nitrate loss through denitrification in kmol N m-2 dz = pddpo(i,j,k) intdnit(i,j) = intdnit(i,j) + rdnit0*remin*dz -#ifdef AGG -!*********************************************************************** -! loss of snow numbers due to remineralization of poc -! NOTE that remin is in kmol/m3. Thus divide by avmass (kmol/m3) -!*********************************************************************** - if(avmass > 0.) then - avnos = ocetra(i,j,k,inos) - ocetra(i,j,k,inos) = ocetra(i,j,k,inos)-(remin+remin2o)*avnos/avmass - endif -#endif /*AGG*/ + if (use_AGG) then + !*********************************************************************** + ! loss of snow numbers due to remineralization of poc + ! NOTE that remin is in kmol/m3. Thus divide by avmass (kmol/m3) + !*********************************************************************** + if(avmass > 0.) then + avnos = ocetra(i,j,k,inos) + ocetra(i,j,k,inos) = ocetra(i,j,k,inos)-(remin+remin2o)*avnos/avmass + endif + endif/*AGG*/ endif endif @@ -796,13 +793,13 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) !$OMP END PARALLEL DO -#ifdef PBGC_OCNP_TIMESTEP - if (mnproc == 1) then - write(io_stdo_bgc,*)' ' - write(io_stdo_bgc,*)'in OCRPOD after remin n2o' + if (use_PBGC_OCNP_TIMESTEP) then + if (mnproc == 1) then + write(io_stdo_bgc,*)' ' + write(io_stdo_bgc,*)'in OCRPOD after remin n2o' + endif + CALL INVENTORY_BGC(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask,0) endif - CALL INVENTORY_BGC(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask,0) -#endif !sulphate reduction ! introduced 11.5.2007 to improve poc-remineralisation in the @@ -814,12 +811,10 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) ! does it make sense to check for oxygen and nitrate deficit? !$OMP PARALLEL DO PRIVATE(remin & -# ifdef AGG +! use_AGG !$OMP ,avmass,avnos & -# endif -#ifdef cisonew +! use_cisonew !$OMP ,rem13,rem14 & -#endif !$OMP ,i,k) loop4: do j = 1,kpje do i = 1,kpie @@ -827,41 +822,41 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) if(omask(i,j) > 0.5 .and. pddpo(i,j,k) > dp_min) then if(ocetra(i,j,k,ioxygen) < 5.e-7 .and. ocetra(i,j,k,iano3) < 3.e-6) then -#ifdef AGG - avmass = ocetra(i,j,k,iphy)+ocetra(i,j,k,idet) -#endif /*AGG*/ + if (use_AGG) then + avmass = ocetra(i,j,k,iphy)+ocetra(i,j,k,idet) + endif remin = dremsul*ocetra(i,j,k,idet) -#ifdef cisonew - rem13 = remin*ocetra(i,j,k,idet13)/(ocetra(i,j,k,idet)+safediv) - rem14 = remin*ocetra(i,j,k,idet14)/(ocetra(i,j,k,idet)+safediv) -#endif + if (use_cisonew) then + rem13 = remin*ocetra(i,j,k,idet13)/(ocetra(i,j,k,idet)+safediv) + rem14 = remin*ocetra(i,j,k,idet14)/(ocetra(i,j,k,idet)+safediv) + endif ocetra(i,j,k,idet) = ocetra(i,j,k,idet)-remin ocetra(i,j,k,ialkali) = ocetra(i,j,k,ialkali)-(rnit+1)*remin ocetra(i,j,k,isco212) = ocetra(i,j,k,isco212)+rcar*remin ocetra(i,j,k,iphosph) = ocetra(i,j,k,iphosph)+remin ocetra(i,j,k,iano3) = ocetra(i,j,k,iano3)+rnit*remin ocetra(i,j,k,iiron) = ocetra(i,j,k,iiron)+riron*remin -#ifdef natDIC - ocetra(i,j,k,inatalkali) = ocetra(i,j,k,inatalkali)-(rnit+1)*remin - ocetra(i,j,k,inatsco212) = ocetra(i,j,k,inatsco212)+rcar*remin -#endif -#ifdef cisonew - ocetra(i,j,k,idet13) = ocetra(i,j,k,idet13)-rem13 - ocetra(i,j,k,idet14) = ocetra(i,j,k,idet14)-rem14 - ocetra(i,j,k,isco213) = ocetra(i,j,k,isco213)+rcar*rem13 - ocetra(i,j,k,isco214) = ocetra(i,j,k,isco214)+rcar*rem14 -#endif - -#ifdef AGG -!*********************************************************************** -! loss of snow numbers due to remineralization of poc -! NOTE that remin is in kmol/m3. Thus divide by avmass (kmol/m3) -!*********************************************************************** - if(avmass > 0.) then - avnos = ocetra(i,j,k,inos) - ocetra(i,j,k,inos) = ocetra(i,j,k,inos)-remin*avnos/avmass + if (use_natDIC) then + ocetra(i,j,k,inatalkali) = ocetra(i,j,k,inatalkali)-(rnit+1)*remin + ocetra(i,j,k,inatsco212) = ocetra(i,j,k,inatsco212)+rcar*remin + endif + if (use_cisonew) then + ocetra(i,j,k,idet13) = ocetra(i,j,k,idet13)-rem13 + ocetra(i,j,k,idet14) = ocetra(i,j,k,idet14)-rem14 + ocetra(i,j,k,isco213) = ocetra(i,j,k,isco213)+rcar*rem13 + ocetra(i,j,k,isco214) = ocetra(i,j,k,isco214)+rcar*rem14 + endif + + if (use_AGG) then + !*********************************************************************** + ! loss of snow numbers due to remineralization of poc + ! NOTE that remin is in kmol/m3. Thus divide by avmass (kmol/m3) + !*********************************************************************** + if(avmass > 0.) then + avnos = ocetra(i,j,k,inos) + ocetra(i,j,k,inos) = ocetra(i,j,k,inos)-remin*avnos/avmass + endif endif -#endif /*AGG*/ endif endif @@ -871,175 +866,175 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) !$OMP END PARALLEL DO ! end sulphate reduction -#ifdef PBGC_OCNP_TIMESTEP - if (mnproc == 1) then - write(io_stdo_bgc,*)' ' - write(io_stdo_bgc,*)'in OCRPOD after sulphate reduction ' + if (use_PBGC_OCNP_TIMESTEP) then + if (mnproc == 1) then + write(io_stdo_bgc,*)' ' + write(io_stdo_bgc,*)'in OCRPOD after sulphate reduction ' + endif + CALL INVENTORY_BGC(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask,0) endif - CALL INVENTORY_BGC(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask,0) -#endif - - -#ifdef AGG - -!**********************AGGREGATION*************************************** -! General: -! Sinking speed, size distribution and aggregation are calculated -! as in Kriest and Evans, 2000. I assume that opal and calcium carbonate -! sink at the same speed as P (mass). -! -! Sinking speed and aggregation: I assume that if there is no phosphorous mass, -! the sinking speed is the minimum sinking speed of aggregates. I further -! assume that then there are no particles, and that the rate of aggregation -! is 0. This scheme removes no P in the absence of P, but still opal and/or -! calcium carbonate. -! This could or should be changed, because silica as well as carbonate -! shell will add to the aggregate mass, and should be considered. -! Puh. Does anyone know functional relationships between -! size and Si or CaCO3? Perhaps on a later version, I have to -! take the relationship bewteen weight and size? -! -! Size distribution and resulting loss of marine snow aggregates due to -! aggregation (aggregate(i,j,k)) and sinking speed of mass and numbers -! (wmass(i,j,k) and wnumb(i,j,k) are calculated in a loop over 2-kpke. -! -!************************************************************************ - - wmass(:,:,:) = 0.0 - wnumb(:,:,:) = 0.0 - aggregate(:,:,:) = 0.0 - dustagg(:,:,:) = 0.0 - - do k = 1,kpke - do j = 1,kpje - do i = 1,kpie - - if(pddpo(i,j,k) > dp_min .and. omask(i,j) > 0.5) then - -!*********************************************************************** -! Have a special resetting for numbers, that fixes their conc. to one -! depending on mass of marine snow: -! Compartments have already been set to 0 in -! ADVECTION_BGC.h and OCTDIFF_BGC.h. -! Ensure that if there is no mass, there are no particles, and -! that the number of particles is in the right range (this is crude, but -! is supposed to happen only due to numerical errors such as truncation or -! overshoots during advection) -! (1) avnos<>avmass, such that Nbar (=Mass/Nos/cellmass) <=1: decrease numbers -! such that Nbar=1.1 (i.e. 1.1 cells per aggregate, set in BELEG_PARM) -!************************************************************************ - avmass = ocetra(i,j,k,iphy)+ocetra(i,j,k,idet) - snow = avmass*1.e+6 - - if(avmass > 0.) then - -! Set minimum particle number to nmldmin in the mixed layer. This is to prevent -! very small values of nos (and asscociated high sinking speed if there is mass) -! in high latitudes during winter - if ( k <= kmle(i,j) ) then - ocetra(i,j,k,inos) = MAX(nmldmin,ocetra(i,j,k,inos)) - endif - ocetra(i,j,k,inos) = MAX(snow*pupper,ocetra(i,j,k,inos)) - ocetra(i,j,k,inos) = MIN(snow*plower,ocetra(i,j,k,inos)) - - avnos = ocetra(i,j,k,inos) - eps = ((1.+ FractDim)*snow-avnos*cellmass)/(snow-avnos*cellmass) - -! prevent epsilon from becoming exactly one of the values which are -! needed for the division (guide from??js) - if (abs(eps-3.) < 1.e-15) eps = 3.+ vsmall - if (abs(eps-4.) < 1.e-15) eps = 4.+ vsmall - if (abs(eps-3.-SinkExp) < 1.e-15) eps = 3.+SinkExp+vsmall - if (abs(eps-1.-SinkExp-FractDim) < 1.e-15) & - & eps = 1.+SinkExp+FractDim+vsmall - - e1 = 1. - eps - e2 = 2. - eps - e3 = 3. - eps - e4 = 4. - eps - es1 = e1 + SinkExp - es3 = e3 + SinkExp - TopF = (alar1/alow1)**e1 - TopM = TopF * TMFac - -! SINKING SPEED FOR THIS LAYER - wmass(i,j,k) = cellsink * ( (FractDim+e1)/ (FractDim+es1) & - & + TopM * TSFac * SinkExp / (FractDim+es1)) - wnumb(i,j,k) = cellsink * (e1/es1 + TopF*TSFac*SinkExp/es1) - -! AGGREGATION - -! As a first step, assume that shear in the mixed layer is high and -! zero below. - if ( k <= kmle(i,j) ) then - fshear = fsh - else - fshear = 0. - endif - - -! shear kernel: - sagg1 = (TopF-1.) * (TopF*alar3-alow3) * e1 / e4 & - & + 3. * (TopF*alar1-alow1) & - & * (TopF*alar2-alow2) * e1 * e1 / (e2*e3) - sagg2 = TopF*((alar3 + 3. & - & * (alar2*alow1*e1/e2 + alar1*alow2*e1/e3) + alow3*e1/e4) & - & - TopF*alar3*(1.+3*( e1/e2+ e1/e3)+ e1/e4)) - sagg4 = TopF * TopF * 4. * alar3 - shear_agg = (sagg1+sagg2+sagg4) * fshear - -! settlement kernel: - sagg1 = (TopF * TopF * alar2 * TSFac - alow2) & - & * SinkExp / (es3 * e3 * (es3 + e1)) & - & + alow2 * ((1. - TopF * TSFac) / (e3 * es1) & - & - (1. - TopF) / (es3*e1)) - sagg2 = TopF * e1 * (TSFac * ( alow2 - TopF * alar2) / e3 & - & - (alow2 - TopF * alar2 * TSFac) / es3) - sett_agg = (e1*e1*sagg1+sagg2) * fse - - effsti = Stick * (ocetra(i,j,k,iopal)*1.e+6/ropal)/ & - & ((ocetra(i,j,k,iopal) * 1.e+6 / ropal) + snow) - aggregate(i,j,k) = (shear_agg+sett_agg) * effsti * avnos * avnos - -! dust aggregation: -! shear kernel: - dfirst = dustd3 + 3. * dustd2 * alar1 + 3. * dustd1 * alar2 + alar3 - dshagg = e1 * fsh * (dfirst * TopF / e1 - ( & - & (TopF-1.)/e1*dustd3 + 3.*(TopF*alar1-alow1)/e2*dustd2 & - & + 3.*(TopF*alar2-alow2)/e3*dustd1 + (TopF*alar3-alow3)/e4)) - -! settlement kernel: - dsett = fse * dustd2 * ((e1+SinkExp*TopF*TSFac)/es1-dustsink/cellsink) - - dustagg(i,j,k) = effsti * avnos * ocetra(i,j,k,ifdust) & - & * (dshagg+dsett) - - eps3d(i,j,k) = eps - asize3d(i,j,k) = snow / avnos / cellmass - - else + if (use_AGG) then + + !**********************AGGREGATION*************************************** + ! General: + ! Sinking speed, size distribution and aggregation are calculated + ! as in Kriest and Evans, 2000. I assume that opal and calcium carbonate + ! sink at the same speed as P (mass). + ! + ! Sinking speed and aggregation: I assume that if there is no phosphorous mass, + ! the sinking speed is the minimum sinking speed of aggregates. I further + ! assume that then there are no particles, and that the rate of aggregation + ! is 0. This scheme removes no P in the absence of P, but still opal and/or + ! calcium carbonate. + ! This could or should be changed, because silica as well as carbonate + ! shell will add to the aggregate mass, and should be considered. + ! Puh. Does anyone know functional relationships between + ! size and Si or CaCO3? Perhaps on a later version, I have to + ! take the relationship bewteen weight and size? + ! + ! Size distribution and resulting loss of marine snow aggregates due to + ! aggregation (aggregate(i,j,k)) and sinking speed of mass and numbers + ! (wmass(i,j,k) and wnumb(i,j,k) are calculated in a loop over 2-kpke. + ! + !************************************************************************ + + wmass(:,:,:) = 0.0 + wnumb(:,:,:) = 0.0 + aggregate(:,:,:) = 0.0 + dustagg(:,:,:) = 0.0 + + do k = 1,kpke + do j = 1,kpje + do i = 1,kpie + + if(pddpo(i,j,k) > dp_min .and. omask(i,j) > 0.5) then + + !*********************************************************************** + ! Have a special resetting for numbers, that fixes their conc. to one + ! depending on mass of marine snow: + ! Compartments have already been set to 0 in + ! ADVECTION_BGC.h and OCTDIFF_BGC.h. + ! Ensure that if there is no mass, there are no particles, and + ! that the number of particles is in the right range (this is crude, but + ! is supposed to happen only due to numerical errors such as truncation or + ! overshoots during advection) + ! (1) avnos<>avmass, such that Nbar (=Mass/Nos/cellmass) <=1: decrease numbers + ! such that Nbar=1.1 (i.e. 1.1 cells per aggregate, set in BELEG_PARM) + !************************************************************************ + avmass = ocetra(i,j,k,iphy)+ocetra(i,j,k,idet) + snow = avmass*1.e+6 + + if(avmass > 0.) then + + ! Set minimum particle number to nmldmin in the mixed layer. This is to prevent + ! very small values of nos (and asscociated high sinking speed if there is mass) + ! in high latitudes during winter + if ( k <= kmle(i,j) ) then + ocetra(i,j,k,inos) = MAX(nmldmin,ocetra(i,j,k,inos)) + endif + + ocetra(i,j,k,inos) = MAX(snow*pupper,ocetra(i,j,k,inos)) + ocetra(i,j,k,inos) = MIN(snow*plower,ocetra(i,j,k,inos)) + + avnos = ocetra(i,j,k,inos) + eps = ((1.+ FractDim)*snow-avnos*cellmass)/(snow-avnos*cellmass) + + ! prevent epsilon from becoming exactly one of the values which are + ! needed for the division (guide from??js) + if (abs(eps-3.) < 1.e-15) eps = 3.+ vsmall + if (abs(eps-4.) < 1.e-15) eps = 4.+ vsmall + if (abs(eps-3.-SinkExp) < 1.e-15) eps = 3.+SinkExp+vsmall + if (abs(eps-1.-SinkExp-FractDim) < 1.e-15) & + & eps = 1.+SinkExp+FractDim+vsmall + + e1 = 1. - eps + e2 = 2. - eps + e3 = 3. - eps + e4 = 4. - eps + es1 = e1 + SinkExp + es3 = e3 + SinkExp + TopF = (alar1/alow1)**e1 + TopM = TopF * TMFac + + ! SINKING SPEED FOR THIS LAYER + wmass(i,j,k) = cellsink * ( (FractDim+e1)/ (FractDim+es1) & + & + TopM * TSFac * SinkExp / (FractDim+es1)) + wnumb(i,j,k) = cellsink * (e1/es1 + TopF*TSFac*SinkExp/es1) + + ! AGGREGATION + + ! As a first step, assume that shear in the mixed layer is high and + ! zero below. + if ( k <= kmle(i,j) ) then + fshear = fsh + else + fshear = 0. + endif + + + ! shear kernel: + sagg1 = (TopF-1.) * (TopF*alar3-alow3) * e1 / e4 & + & + 3. * (TopF*alar1-alow1) & + & * (TopF*alar2-alow2) * e1 * e1 / (e2*e3) + sagg2 = TopF*((alar3 + 3. & + & * (alar2*alow1*e1/e2 + alar1*alow2*e1/e3) + alow3*e1/e4) & + & - TopF*alar3*(1.+3*( e1/e2+ e1/e3)+ e1/e4)) + sagg4 = TopF * TopF * 4. * alar3 + shear_agg = (sagg1+sagg2+sagg4) * fshear + + ! settlement kernel: + sagg1 = (TopF * TopF * alar2 * TSFac - alow2) & + & * SinkExp / (es3 * e3 * (es3 + e1)) & + & + alow2 * ((1. - TopF * TSFac) / (e3 * es1) & + & - (1. - TopF) / (es3*e1)) + sagg2 = TopF * e1 * (TSFac * ( alow2 - TopF * alar2) / e3 & + & - (alow2 - TopF * alar2 * TSFac) / es3) + sett_agg = (e1*e1*sagg1+sagg2) * fse + + effsti = Stick * (ocetra(i,j,k,iopal)*1.e+6/ropal)/ & + & ((ocetra(i,j,k,iopal) * 1.e+6 / ropal) + snow) + + aggregate(i,j,k) = (shear_agg+sett_agg) * effsti * avnos * avnos + + ! dust aggregation: + ! shear kernel: + dfirst = dustd3 + 3. * dustd2 * alar1 + 3. * dustd1 * alar2 + alar3 + dshagg = e1 * fsh * (dfirst * TopF / e1 - ( & + & (TopF-1.)/e1*dustd3 + 3.*(TopF*alar1-alow1)/e2*dustd2 & + & + 3.*(TopF*alar2-alow2)/e3*dustd1 + (TopF*alar3-alow3)/e4)) + + ! settlement kernel: + dsett = fse * dustd2 * ((e1+SinkExp*TopF*TSFac)/es1-dustsink/cellsink) + + dustagg(i,j,k) = effsti * avnos * ocetra(i,j,k,ifdust) & + & * (dshagg+dsett) + + eps3d(i,j,k) = eps + asize3d(i,j,k) = snow / avnos / cellmass + + else + + wmass(i,j,k) = cellsink + wnumb(i,j,k) = 0. + aggregate(i,j,k) = 0. + dustagg(i,j,k) = 0. + ocetra(i,j,k,inos) = 0. + + eps3d(i,j,k) = 1. + asize3d(i,j,k) = 0. + + endif ! avmass > 0 + + endif ! pddpo > dp_min .and. omask > 0.5 + enddo ! i=1,kpie + enddo ! j=1,kpje + enddo ! k=1,kpke - wmass(i,j,k) = cellsink - wnumb(i,j,k) = 0. - aggregate(i,j,k) = 0. - dustagg(i,j,k) = 0. - ocetra(i,j,k,inos) = 0. - - eps3d(i,j,k) = 1. - asize3d(i,j,k) = 0. - - endif ! avmass > 0 - - endif ! pddpo > dp_min .and. omask > 0.5 - enddo ! i=1,kpie - enddo ! j=1,kpje - enddo ! k=1,kpke - -#endif /*AGG*/ + endif ! @@ -1050,9 +1045,8 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) ! sedimentation=w*dt*C(ks,T+dt) ! !$OMP PARALLEL DO PRIVATE(kdonor,wpoc,wpocd,wcal,wcald,wopal,wopald & -#if defined(AGG) +! use_AGG !$OMP ,wnos,wnosd,dagg & -#endif !$OMP ,i,k) do j = 1,kpje do i = 1,kpie @@ -1069,59 +1063,59 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) if( pddpo(i,j,k) > dp_min ) then tco( 1) = tco( 1) + ocetra(i,j,k,idet )*pddpo(i,j,k) tco( 2) = tco( 2) + ocetra(i,j,k,icalc )*pddpo(i,j,k) -#ifdef natDIC - tco( 3) = tco( 3) + ocetra(i,j,k,inatcalc)*pddpo(i,j,k) -#endif + if (use_natDIC) then + tco( 3) = tco( 3) + ocetra(i,j,k,inatcalc)*pddpo(i,j,k) + endif tco( 4) = tco( 4) + ocetra(i,j,k,iopal )*pddpo(i,j,k) tco( 5) = tco( 5) + ocetra(i,j,k,ifdust)*pddpo(i,j,k) -#if defined(AGG) - tco( 6) = tco( 6) + ocetra(i,j,k,iphy )*pddpo(i,j,k) - tco( 7) = tco( 7) + ocetra(i,j,k,inos )*pddpo(i,j,k) - tco( 8) = tco( 8) + ocetra(i,j,k,iadust)*pddpo(i,j,k) -#endif -#ifdef cisonew - tco( 9) = tco( 9) + ocetra(i,j,k,idet13 )*pddpo(i,j,k) - tco(10) = tco(10) + ocetra(i,j,k,idet14 )*pddpo(i,j,k) - tco(11) = tco(11) + ocetra(i,j,k,icalc13)*pddpo(i,j,k) - tco(12) = tco(12) + ocetra(i,j,k,icalc14)*pddpo(i,j,k) -#endif + if (use_AGG) then + tco( 6) = tco( 6) + ocetra(i,j,k,iphy )*pddpo(i,j,k) + tco( 7) = tco( 7) + ocetra(i,j,k,inos )*pddpo(i,j,k) + tco( 8) = tco( 8) + ocetra(i,j,k,iadust)*pddpo(i,j,k) + endif + if (use_cisonew) then + tco( 9) = tco( 9) + ocetra(i,j,k,idet13 )*pddpo(i,j,k) + tco(10) = tco(10) + ocetra(i,j,k,idet14 )*pddpo(i,j,k) + tco(11) = tco(11) + ocetra(i,j,k,icalc13)*pddpo(i,j,k) + tco(12) = tco(12) + ocetra(i,j,k,icalc14)*pddpo(i,j,k) + endif endif if(pddpo(i,j,k) > dp_min_sink) then -#if defined(AGG) - wpoc = wmass(i,j,k) - wpocd = wmass(i,j,kdonor) - wcal = wmass(i,j,k) - wcald = wmass(i,j,kdonor) - wopal = wmass(i,j,k) - wopald = wmass(i,j,kdonor) - wnos = wnumb(i,j,k) - wnosd = wnumb(i,j,kdonor) - wdust = dustsink - dagg = dustagg(i,j,k) -#elif defined(WLIN) - wpoc = min(wmin+wlin*ptiestu(i,j,k), wmax) - wpocd = min(wmin+wlin*ptiestu(i,j,kdonor),wmax) - wcald = wcal - wopald = wopal - dagg = 0.0 -#else - wpocd = wpoc - wcald = wcal - wopald = wopal - dagg = 0.0 -#endif + if (use_AGG) then + wpoc = wmass(i,j,k) + wpocd = wmass(i,j,kdonor) + wcal = wmass(i,j,k) + wcald = wmass(i,j,kdonor) + wopal = wmass(i,j,k) + wopald = wmass(i,j,kdonor) + wnos = wnumb(i,j,k) + wnosd = wnumb(i,j,kdonor) + wdust = dustsink + dagg = dustagg(i,j,k) + else if (use_WLIN) then + wpoc = min(wmin+wlin*ptiestu(i,j,k), wmax) + wpocd = min(wmin+wlin*ptiestu(i,j,kdonor),wmax) + wcald = wcal + wopald = wopal + dagg = 0.0 + else + wpocd = wpoc + wcald = wcal + wopald = wopal + dagg = 0.0 + end if if( k == 1 ) then wpocd = 0.0 wcald = 0.0 wopald = 0.0 -#if defined(AGG) - wnosd = 0.0 -#elif defined(WLIN) - wpoc = wmin -#endif + if (use_AGG) then + wnosd = 0.0 + else if (use_WLIN) then + wpoc = wmin + end if endif ocetra(i,j,k,idet) = (ocetra(i,j,k ,idet) * pddpo(i,j,k) & @@ -1130,64 +1124,64 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) ocetra(i,j,k,icalc) = (ocetra(i,j,k ,icalc) * pddpo(i,j,k) & & + ocetra(i,j,kdonor,icalc)*wcald)/ & & (pddpo(i,j,k)+wcal) -#ifdef cisonew - ocetra(i,j,k,idet13) = (ocetra(i,j,k ,idet13) * pddpo(i,j,k) & - & + ocetra(i,j,kdonor,idet13)*wpocd)/ & - & (pddpo(i,j,k)+wpoc) - ocetra(i,j,k,idet14) = (ocetra(i,j,k ,idet14) * pddpo(i,j,k) & - & + ocetra(i,j,kdonor,idet14)*wpocd)/ & - & (pddpo(i,j,k)+wpoc) - ocetra(i,j,k,icalc13) = (ocetra(i,j,k ,icalc13) * pddpo(i,j,k) & - & + ocetra(i,j,kdonor,icalc13)*wcald)/ & - & (pddpo(i,j,k)+wcal) - ocetra(i,j,k,icalc14) = (ocetra(i,j,k ,icalc14) * pddpo(i,j,k) & - & + ocetra(i,j,kdonor,icalc14)*wcald)/ & - & (pddpo(i,j,k)+wcal) -#endif -#ifdef natDIC - ocetra(i,j,k,inatcalc) = (ocetra(i,j,k,inatcalc) * pddpo(i,j,k) & - & + ocetra(i,j,kdonor,inatcalc)*wcald)/ & - & (pddpo(i,j,k)+wcal) -#endif + if (use_cisonew) then + ocetra(i,j,k,idet13) = (ocetra(i,j,k ,idet13) * pddpo(i,j,k) & + & + ocetra(i,j,kdonor,idet13)*wpocd)/ & + & (pddpo(i,j,k)+wpoc) + ocetra(i,j,k,idet14) = (ocetra(i,j,k ,idet14) * pddpo(i,j,k) & + & + ocetra(i,j,kdonor,idet14)*wpocd)/ & + & (pddpo(i,j,k)+wpoc) + ocetra(i,j,k,icalc13) = (ocetra(i,j,k ,icalc13) * pddpo(i,j,k) & + & + ocetra(i,j,kdonor,icalc13)*wcald)/ & + & (pddpo(i,j,k)+wcal) + ocetra(i,j,k,icalc14) = (ocetra(i,j,k ,icalc14) * pddpo(i,j,k) & + & + ocetra(i,j,kdonor,icalc14)*wcald)/ & + & (pddpo(i,j,k)+wcal) + endif + if (use_natDIC) then + ocetra(i,j,k,inatcalc) = (ocetra(i,j,k,inatcalc) * pddpo(i,j,k) & + & + ocetra(i,j,kdonor,inatcalc)*wcald)/ & + & (pddpo(i,j,k)+wcal) + endif ocetra(i,j,k,iopal) = (ocetra(i,j,k ,iopal) * pddpo(i,j,k) & & + ocetra(i,j,kdonor,iopal)*wopald)/ & & (pddpo(i,j,k)+wopal) ocetra(i,j,k,ifdust) = (ocetra(i,j,k ,ifdust) * pddpo(i,j,k) & & + ocetra(i,j,kdonor,ifdust)*wdust)/ & & (pddpo(i,j,k)+wdust) - dagg -#ifdef AGG - ocetra(i,j,k,iphy) = (ocetra(i,j,k ,iphy) * pddpo(i,j,k) & - & + ocetra(i,j,kdonor,iphy)*wpocd)/ & - & (pddpo(i,j,k)+wpoc) - ocetra(i,j,k,inos) = (ocetra(i,j,k ,inos)*pddpo(i,j,k) & - & + ocetra(i,j,kdonor,inos)*wnosd)/ & - & (pddpo(i,j,k)+wnos) - aggregate(i,j,k) - ocetra(i,j,k,iadust) = (ocetra(i,j,k ,iadust) * pddpo(i,j,k) & - & + ocetra(i,j,kdonor,iadust)*wpocd)/ & - & (pddpo(i,j,k)+wpoc) + dagg -#endif + if (use_AGG) then + ocetra(i,j,k,iphy) = (ocetra(i,j,k ,iphy) * pddpo(i,j,k) & + & + ocetra(i,j,kdonor,iphy)*wpocd)/ & + & (pddpo(i,j,k)+wpoc) + ocetra(i,j,k,inos) = (ocetra(i,j,k ,inos)*pddpo(i,j,k) & + & + ocetra(i,j,kdonor,inos)*wnosd)/ & + & (pddpo(i,j,k)+wnos) - aggregate(i,j,k) + ocetra(i,j,k,iadust) = (ocetra(i,j,k ,iadust) * pddpo(i,j,k) & + & + ocetra(i,j,kdonor,iadust)*wpocd)/ & + & (pddpo(i,j,k)+wpoc) + dagg + endif kdonor = k else if( pddpo(i,j,k) > dp_min ) then ocetra(i,j,k,idet) = ocetra(i,j,kdonor,idet) ocetra(i,j,k,icalc) = ocetra(i,j,kdonor,icalc) -#ifdef cisonew - ocetra(i,j,k,idet13) = ocetra(i,j,kdonor,idet13) - ocetra(i,j,k,idet14) = ocetra(i,j,kdonor,idet14) - ocetra(i,j,k,icalc13) = ocetra(i,j,kdonor,icalc13) - ocetra(i,j,k,icalc14) = ocetra(i,j,kdonor,icalc14) -#endif -#ifdef natDIC - ocetra(i,j,k,inatcalc) = ocetra(i,j,kdonor,inatcalc) -#endif + if (use_cisonew) then + ocetra(i,j,k,idet13) = ocetra(i,j,kdonor,idet13) + ocetra(i,j,k,idet14) = ocetra(i,j,kdonor,idet14) + ocetra(i,j,k,icalc13) = ocetra(i,j,kdonor,icalc13) + ocetra(i,j,k,icalc14) = ocetra(i,j,kdonor,icalc14) + endif + if (use_natDIC) then + ocetra(i,j,k,inatcalc) = ocetra(i,j,kdonor,inatcalc) + endif ocetra(i,j,k,iopal) = ocetra(i,j,kdonor,iopal) ocetra(i,j,k,ifdust) = ocetra(i,j,kdonor,ifdust) -#ifdef AGG - ocetra(i,j,k,iphy) = ocetra(i,j,kdonor,iphy) - ocetra(i,j,k,inos) = ocetra(i,j,kdonor,inos) - ocetra(i,j,k,iadust) = ocetra(i,j,kdonor,iadust) -#endif + if (use_AGG) then + ocetra(i,j,k,iphy) = ocetra(i,j,kdonor,iphy) + ocetra(i,j,k,inos) = ocetra(i,j,kdonor,inos) + ocetra(i,j,k,iadust) = ocetra(i,j,kdonor,iadust) + endif endif ! pddpo > dp_min_sink @@ -1196,22 +1190,22 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) if( pddpo(i,j,k) > dp_min ) then tcn( 1) = tcn( 1) + ocetra(i,j,k,idet )*pddpo(i,j,k) tcn( 2) = tcn( 2) + ocetra(i,j,k,icalc )*pddpo(i,j,k) -#ifdef natDIC - tcn( 3) = tcn( 3) + ocetra(i,j,k,inatcalc)*pddpo(i,j,k) -#endif + if (use_natDIC) then + tcn( 3) = tcn( 3) + ocetra(i,j,k,inatcalc)*pddpo(i,j,k) + endif tcn( 4) = tcn( 4) + ocetra(i,j,k,iopal )*pddpo(i,j,k) tcn( 5) = tcn( 5) + ocetra(i,j,k,ifdust)*pddpo(i,j,k) -#if defined(AGG) - tcn( 6) = tcn( 6) + ocetra(i,j,k,iphy )*pddpo(i,j,k) - tcn( 7) = tcn( 7) + ocetra(i,j,k,inos )*pddpo(i,j,k) - tcn( 8) = tcn( 8) + ocetra(i,j,k,iadust)*pddpo(i,j,k) -#endif -#ifdef cisonew - tcn( 9) = tcn( 9) + ocetra(i,j,k,idet13 )*pddpo(i,j,k) - tcn(10) = tcn(10) + ocetra(i,j,k,idet14 )*pddpo(i,j,k) - tcn(11) = tcn(11) + ocetra(i,j,k,icalc13)*pddpo(i,j,k) - tcn(12) = tcn(12) + ocetra(i,j,k,icalc14)*pddpo(i,j,k) -#endif + if (use_AGG) then + tcn( 6) = tcn( 6) + ocetra(i,j,k,iphy )*pddpo(i,j,k) + tcn( 7) = tcn( 7) + ocetra(i,j,k,inos )*pddpo(i,j,k) + tcn( 8) = tcn( 8) + ocetra(i,j,k,iadust)*pddpo(i,j,k) + endif + if (use_cisonew) then + tcn( 9) = tcn( 9) + ocetra(i,j,k,idet13 )*pddpo(i,j,k) + tcn(10) = tcn(10) + ocetra(i,j,k,idet14 )*pddpo(i,j,k) + tcn(11) = tcn(11) + ocetra(i,j,k,icalc13)*pddpo(i,j,k) + tcn(12) = tcn(12) + ocetra(i,j,k,icalc14)*pddpo(i,j,k) + endif endif enddo ! loop k=1,kpke @@ -1220,22 +1214,22 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) ! Add fluxes to sediment to new total column inventory tcn( 1) = tcn( 1) + ocetra(i,j,kdonor,idet )*wpoc tcn( 2) = tcn( 2) + ocetra(i,j,kdonor,icalc )*wcal -#ifdef natDIC - tcn( 3) = tcn( 3) + ocetra(i,j,kdonor,inatcalc)*wcal -#endif + if (use_natDIC) then + tcn( 3) = tcn( 3) + ocetra(i,j,kdonor,inatcalc)*wcal + endif tcn( 4) = tcn( 4) + ocetra(i,j,kdonor,iopal )*wopal tcn( 5) = tcn( 5) + ocetra(i,j,kdonor,ifdust)*wdust -#if defined(AGG) - tcn( 6) = tcn( 6) + ocetra(i,j,kdonor,iphy )*wpoc - tcn( 7) = tcn( 7) + ocetra(i,j,kdonor,inos )*wnos - tcn( 8) = tcn( 8) + ocetra(i,j,kdonor,iadust)*wpoc -#endif -#ifdef cisonew - tcn( 9) = tcn( 9) + ocetra(i,j,kdonor,idet13 )*wpoc - tcn(10) = tcn(10) + ocetra(i,j,kdonor,idet14 )*wpoc - tcn(11) = tcn(11) + ocetra(i,j,kdonor,icalc13)*wcal - tcn(12) = tcn(12) + ocetra(i,j,kdonor,icalc14)*wcal -#endif + if (use_AGG) then + tcn( 6) = tcn( 6) + ocetra(i,j,kdonor,iphy )*wpoc + tcn( 7) = tcn( 7) + ocetra(i,j,kdonor,inos )*wnos + tcn( 8) = tcn( 8) + ocetra(i,j,kdonor,iadust)*wpoc + endif + if (use_cisonew) then + tcn( 9) = tcn( 9) + ocetra(i,j,kdonor,idet13 )*wpoc + tcn(10) = tcn(10) + ocetra(i,j,kdonor,idet14 )*wpoc + tcn(11) = tcn(11) + ocetra(i,j,kdonor,icalc13)*wcal + tcn(12) = tcn(12) + ocetra(i,j,kdonor,icalc14)*wcal + endif ! Do columnwise multiplicative mass conservation correction q(:) = 1.0 @@ -1246,55 +1240,56 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) if( pddpo(i,j,k) > dp_min ) then ocetra(i,j,k,idet ) = ocetra(i,j,k,idet )*q(1) ocetra(i,j,k,icalc ) = ocetra(i,j,k,icalc )*q(2) -#ifdef natDIC - ocetra(i,j,k,inatcalc) = ocetra(i,j,k,inatcalc)*q(3) -#endif + if (use_natDIC) then + ocetra(i,j,k,inatcalc) = ocetra(i,j,k,inatcalc)*q(3) + endif ocetra(i,j,k,iopal ) = ocetra(i,j,k,iopal )*q(4) ocetra(i,j,k,ifdust) = ocetra(i,j,k,ifdust)*q(5) -#if defined(AGG) - ocetra(i,j,k,iphy ) = ocetra(i,j,k,iphy )*q(6) - ocetra(i,j,k,inos ) = ocetra(i,j,k,inos )*q(7) - ocetra(i,j,k,iadust) = ocetra(i,j,k,iadust)*q(8) -#endif -#ifdef cisonew - ocetra(i,j,k,idet13 ) = ocetra(i,j,k,idet13 )*q(9) - ocetra(i,j,k,idet14 ) = ocetra(i,j,k,idet14 )*q(10) - ocetra(i,j,k,icalc13) = ocetra(i,j,k,icalc13)*q(11) - ocetra(i,j,k,icalc14) = ocetra(i,j,k,icalc14)*q(12) -#endif + if (use_AGG) then + ocetra(i,j,k,iphy ) = ocetra(i,j,k,iphy )*q(6) + ocetra(i,j,k,inos ) = ocetra(i,j,k,inos )*q(7) + ocetra(i,j,k,iadust) = ocetra(i,j,k,iadust)*q(8) + endif + if (use_cisonew) then + ocetra(i,j,k,idet13 ) = ocetra(i,j,k,idet13 )*q(9) + ocetra(i,j,k,idet14 ) = ocetra(i,j,k,idet14 )*q(10) + ocetra(i,j,k,icalc13) = ocetra(i,j,k,icalc13)*q(11) + ocetra(i,j,k,icalc14) = ocetra(i,j,k,icalc14)*q(12) + endif endif enddo ! Fluxes to sediment, layers thinner than dp_min_sink are ignored. ! Note that kdonor=kbo(i,j) by definition since kbo is the lowermost ! layer thicker than dp_min_sink. -#if defined(AGG) - prorca(i,j) = ocetra(i,j,kdonor,iphy )*wpoc & - & + ocetra(i,j,kdonor,idet )*wpoc - prcaca(i,j) = ocetra(i,j,kdonor,icalc )*wcal - silpro(i,j) = ocetra(i,j,kdonor,iopal )*wopal - produs(i,j) = ocetra(i,j,kdonor,ifdust)*wdust & - & + ocetra(i,j,kdonor,iadust)*wpoc -#ifdef cisonew - pror13(i,j) = ocetra(i,j,kdonor,iphy13)*wpoc & - & + ocetra(i,j,kdonor,idet13)*wpoc - pror14(i,j) = ocetra(i,j,kdonor,iphy14)*wpoc & - & + ocetra(i,j,kdonor,idet14)*wpoc - prca13(i,j) = ocetra(i,j,kdonor,icalc13)*wcal - prca14(i,j) = ocetra(i,j,kdonor,icalc14)*wcal -#endif -#else - prorca(i,j) = ocetra(i,j,kdonor,idet )*wpoc - prcaca(i,j) = ocetra(i,j,kdonor,icalc )*wcal - silpro(i,j) = ocetra(i,j,kdonor,iopal )*wopal - produs(i,j) = ocetra(i,j,kdonor,ifdust)*wdust -#ifdef cisonew - pror13(i,j) = ocetra(i,j,kdonor,idet13 )*wpoc - prca13(i,j) = ocetra(i,j,kdonor,icalc13)*wcal - pror14(i,j) = ocetra(i,j,kdonor,idet14 )*wpoc - prca14(i,j) = ocetra(i,j,kdonor,icalc14)*wcal -#endif -#endif + if (use_AGG) then + prorca(i,j) = ocetra(i,j,kdonor,iphy )*wpoc & + & + ocetra(i,j,kdonor,idet )*wpoc + prcaca(i,j) = ocetra(i,j,kdonor,icalc )*wcal + silpro(i,j) = ocetra(i,j,kdonor,iopal )*wopal + produs(i,j) = ocetra(i,j,kdonor,ifdust)*wdust & + & + ocetra(i,j,kdonor,iadust)*wpoc + + if (use_cisonew) then + pror13(i,j) = ocetra(i,j,kdonor,iphy13)*wpoc & + & + ocetra(i,j,kdonor,idet13)*wpoc + pror14(i,j) = ocetra(i,j,kdonor,iphy14)*wpoc & + & + ocetra(i,j,kdonor,idet14)*wpoc + prca13(i,j) = ocetra(i,j,kdonor,icalc13)*wcal + prca14(i,j) = ocetra(i,j,kdonor,icalc14)*wcal + end if + else + prorca(i,j) = ocetra(i,j,kdonor,idet )*wpoc + prcaca(i,j) = ocetra(i,j,kdonor,icalc )*wcal + silpro(i,j) = ocetra(i,j,kdonor,iopal )*wopal + produs(i,j) = ocetra(i,j,kdonor,ifdust)*wdust + if (use_cisonew) then + pror13(i,j) = ocetra(i,j,kdonor,idet13 )*wpoc + prca13(i,j) = ocetra(i,j,kdonor,icalc13)*wcal + pror14(i,j) = ocetra(i,j,kdonor,idet14 )*wpoc + prca14(i,j) = ocetra(i,j,kdonor,icalc14)*wcal + endif + end if endif ! omask > 0.5 enddo ! loop i=1,kpie @@ -1315,19 +1310,19 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) ! 100 m k = k0100(i,j) if(k > 0) then -#if defined(AGG) - wpoc = wmass(i,j,k) - wcal = wmass(i,j,k) - wopal = wmass(i,j,k) -#elif defined(WLIN) - wpoc = min(wmin+wlin*ptiestu(i,j,k), wmax) -#endif - -#if defined(AGG) - carflx0100(i,j) = (ocetra(i,j,k,idet)+ocetra(i,j,k,iphy))*rcar*wpoc -#else - carflx0100(i,j) = ocetra(i,j,k,idet)*rcar*wpoc -#endif + if (use_AGG) then + wpoc = wmass(i,j,k) + wcal = wmass(i,j,k) + wopal = wmass(i,j,k) + else if (use_WLIN) then + wpoc = min(wmin+wlin*ptiestu(i,j,k), wmax) + end if + + if (use_AGG) then + carflx0100(i,j) = (ocetra(i,j,k,idet)+ocetra(i,j,k,iphy))*rcar*wpoc + else + carflx0100(i,j) = ocetra(i,j,k,idet)*rcar*wpoc + end if bsiflx0100(i,j) = ocetra(i,j,k,iopal)*wopal calflx0100(i,j) = ocetra(i,j,k,icalc)*wcal endif @@ -1335,19 +1330,19 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) ! 500 m k = k0500(i,j) if(k > 0) then -#if defined(AGG) - wpoc = wmass(i,j,k) - wcal = wmass(i,j,k) - wopal = wmass(i,j,k) -#elif defined(WLIN) - wpoc = min(wmin+wlin*ptiestu(i,j,k), wmax) -#endif - -#if defined(AGG) - carflx0500(i,j) = (ocetra(i,j,k,idet)+ocetra(i,j,k,iphy))*rcar*wpoc -#else - carflx0500(i,j) = ocetra(i,j,k,idet)*rcar*wpoc -#endif + if (use_AGG) then + wpoc = wmass(i,j,k) + wcal = wmass(i,j,k) + wopal = wmass(i,j,k) + else if (use_WLIN) then + wpoc = min(wmin+wlin*ptiestu(i,j,k), wmax) + end if + + if (use_AGG) then + carflx0500(i,j) = (ocetra(i,j,k,idet)+ocetra(i,j,k,iphy))*rcar*wpoc + else + carflx0500(i,j) = ocetra(i,j,k,idet)*rcar*wpoc + end if bsiflx0500(i,j) = ocetra(i,j,k,iopal)*wopal calflx0500(i,j) = ocetra(i,j,k,icalc)*wcal endif @@ -1355,19 +1350,19 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) ! 1000 m k = k1000(i,j) if(k > 0) then -#if defined(AGG) - wpoc = wmass(i,j,k) - wcal = wmass(i,j,k) - wopal = wmass(i,j,k) -#elif defined(WLIN) - wpoc = min(wmin+wlin*ptiestu(i,j,k), wmax) -#endif - -#if defined(AGG) - carflx1000(i,j) = (ocetra(i,j,k,idet)+ocetra(i,j,k,iphy))*rcar*wpoc -#else - carflx1000(i,j) = ocetra(i,j,k,idet)*rcar*wpoc -#endif + if (use_AGG) then + wpoc = wmass(i,j,k) + wcal = wmass(i,j,k) + wopal = wmass(i,j,k) + else if (use_WLIN) then + wpoc = min(wmin+wlin*ptiestu(i,j,k), wmax) + end if + + if (use_AGG) then + carflx1000(i,j) = (ocetra(i,j,k,idet)+ocetra(i,j,k,iphy))*rcar*wpoc + else + carflx1000(i,j) = ocetra(i,j,k,idet)*rcar*wpoc + end if bsiflx1000(i,j) = ocetra(i,j,k,iopal)*wopal calflx1000(i,j) = ocetra(i,j,k,icalc)*wcal endif @@ -1375,19 +1370,19 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) ! 2000 m k = k2000(i,j) if(k > 0) then -#if defined(AGG) - wpoc = wmass(i,j,k) - wcal = wmass(i,j,k) - wopal = wmass(i,j,k) -#elif defined(WLIN) - wpoc = min(wmin+wlin*ptiestu(i,j,k), wmax) -#endif - -#if defined(AGG) - carflx2000(i,j) = (ocetra(i,j,k,idet)+ocetra(i,j,k,iphy))*rcar*wpoc -#else - carflx2000(i,j) = ocetra(i,j,k,idet)*rcar*wpoc -#endif + if (use_AGG) then + wpoc = wmass(i,j,k) + wcal = wmass(i,j,k) + wopal = wmass(i,j,k) + else if (use_WLIN) then + wpoc = min(wmin+wlin*ptiestu(i,j,k), wmax) + end if + + if (use_AGG) then + carflx2000(i,j) = (ocetra(i,j,k,idet)+ocetra(i,j,k,iphy))*rcar*wpoc + else + carflx2000(i,j) = ocetra(i,j,k,idet)*rcar*wpoc + end if bsiflx2000(i,j) = ocetra(i,j,k,iopal)*wopal calflx2000(i,j) = ocetra(i,j,k,icalc)*wcal endif @@ -1395,19 +1390,19 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) ! 4000 m k = k4000(i,j) if(k > 0) then -#if defined(AGG) - wpoc = wmass(i,j,k) - wcal = wmass(i,j,k) - wopal = wmass(i,j,k) -#elif defined(WLIN) - wpoc = min(wmin+wlin*ptiestu(i,j,k), wmax) -#endif - -#if defined(AGG) - carflx4000(i,j) = (ocetra(i,j,k,idet)+ocetra(i,j,k,iphy))*rcar*wpoc -#else - carflx4000(i,j) = ocetra(i,j,k,idet)*rcar*wpoc -#endif + if (use_AGG) then + wpoc = wmass(i,j,k) + wcal = wmass(i,j,k) + wopal = wmass(i,j,k) + else if (use_WLIN) then + wpoc = min(wmin+wlin*ptiestu(i,j,k), wmax) + end if + + if (use_AGG) then + carflx4000(i,j) = (ocetra(i,j,k,idet)+ocetra(i,j,k,iphy))*rcar*wpoc + else + carflx4000(i,j) = ocetra(i,j,k,idet)*rcar*wpoc + end if bsiflx4000(i,j) = ocetra(i,j,k,iopal)*wopal calflx4000(i,j) = ocetra(i,j,k,icalc)*wcal endif @@ -1422,78 +1417,72 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) enddo !$OMP END PARALLEL DO + if (use_sedbypass) then + + ! If sediment bypass is activated, fluxes to the sediment are distributed + ! over the water column. Detritus is kept as detritus, while opal and CaCO3 + ! are remineralised instantanously + + !$OMP PARALLEL DO PRIVATE( & + !$OMP dz,florca,flcaca,flsil & + ! use_cisonew + !$OMP ,flor13,flor14,flca13,flca14 & + !$OMP ,i,k) + do j=1,kpje + do i = 1,kpie + if(omask(i,j) > 0.5) then + + ! calculate depth of water column + dz = 0.0 + do k = 1,kpke + + if( pddpo(i,j,k) > dp_min ) dz = dz+pddpo(i,j,k) + + enddo + + florca = prorca(i,j)/dz + flcaca = prcaca(i,j)/dz + flsil = silpro(i,j)/dz + prorca(i,j) = 0. + prcaca(i,j) = 0. + silpro(i,j) = 0. + if (use_cisonew) then + flor13 = pror13(i,j)/dz + flor14 = pror13(i,j)/dz + flca13 = prca13(i,j)/dz + flca14 = prca14(i,j)/dz + pror13(i,j) = 0. + pror14(i,j) = 0. + prca13(i,j) = 0. + prca14(i,j) = 0. + endif - - -#ifdef sedbypass -! If sediment bypass is activated, fluxes to the sediment are distributed -! over the water column. Detritus is kept as detritus, while opal and CaCO3 -! are remineralised instantanously - -!$OMP PARALLEL DO PRIVATE( & -!$OMP dz,florca,flcaca,flsil & -#ifdef cisonew -!$OMP ,flor13,flor14,flca13,flca14 & -#endif -!$OMP ,i,k) - do j=1,kpje - do i = 1,kpie - if(omask(i,j) > 0.5) then - - ! calculate depth of water column - dz = 0.0 - do k = 1,kpke - - if( pddpo(i,j,k) > dp_min ) dz = dz+pddpo(i,j,k) - + do k = 1,kpke + if( pddpo(i,j,k) <= dp_min ) cycle + + ocetra(i,j,k,idet) = ocetra(i,j,k,idet)+florca + ocetra(i,j,k,ialkali) = ocetra(i,j,k,ialkali)+2.*flcaca + ocetra(i,j,k,isco212) = ocetra(i,j,k,isco212)+flcaca + ocetra(i,j,k,isilica) = ocetra(i,j,k,isilica)+flsil + if (use_cisonew) then + ocetra(i,j,k,idet13) = ocetra(i,j,k,idet13)+flor13 + ocetra(i,j,k,idet14) = ocetra(i,j,k,idet14)+flor14 + ocetra(i,j,k,isco213) = ocetra(i,j,k,isco213)+flca13 + ocetra(i,j,k,isco214) = ocetra(i,j,k,isco214)+flca14 + endif + enddo ! k=1,kpke + + endif ! omask > 0.5 enddo + enddo + end if - florca = prorca(i,j)/dz - flcaca = prcaca(i,j)/dz - flsil = silpro(i,j)/dz - prorca(i,j) = 0. - prcaca(i,j) = 0. - silpro(i,j) = 0. -#ifdef cisonew - flor13 = pror13(i,j)/dz - flor14 = pror13(i,j)/dz - flca13 = prca13(i,j)/dz - flca14 = prca14(i,j)/dz - pror13(i,j) = 0. - pror14(i,j) = 0. - prca13(i,j) = 0. - prca14(i,j) = 0. -#endif - - do k = 1,kpke - - if( pddpo(i,j,k) <= dp_min ) cycle - - ocetra(i,j,k,idet) = ocetra(i,j,k,idet)+florca - ocetra(i,j,k,ialkali) = ocetra(i,j,k,ialkali)+2.*flcaca - ocetra(i,j,k,isco212) = ocetra(i,j,k,isco212)+flcaca - ocetra(i,j,k,isilica) = ocetra(i,j,k,isilica)+flsil -#ifdef cisonew - ocetra(i,j,k,idet13) = ocetra(i,j,k,idet13)+flor13 - ocetra(i,j,k,idet14) = ocetra(i,j,k,idet14)+flor14 - ocetra(i,j,k,isco213) = ocetra(i,j,k,isco213)+flca13 - ocetra(i,j,k,isco214) = ocetra(i,j,k,isco214)+flca14 -#endif - enddo ! k=1,kpke - - endif ! omask > 0.5 - enddo - enddo -#endif - - -#ifdef PBGC_OCNP_TIMESTEP - if (mnproc == 1) then - write(io_stdo_bgc,*)' ' - write(io_stdo_bgc,*)'in OCRPOD after sinking poc ' + if (use_PBGC_OCNP_TIMESTEP) then + if (mnproc == 1) then + write(io_stdo_bgc,*)' ' + write(io_stdo_bgc,*)'in OCRPOD after sinking poc ' + endif + CALL INVENTORY_BGC(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask,0) endif - CALL INVENTORY_BGC(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask,0) -#endif - end subroutine ocprod diff --git a/hamocc/powach.F90 b/hamocc/powach.F90 index 540d4c94..fc645814 100644 --- a/hamocc/powach.F90 +++ b/hamocc/powach.F90 @@ -69,11 +69,10 @@ subroutine powach(kpie,kpje,kpke,kbnd,prho,omask,psao,lspin) & issster, ks use mo_vgrid, only: kbo,bolay -#ifdef cisonew + ! cisonew use mo_param1_bgc, only: ipowc13,ipowc14,isssc13,isssc14,issso13,issso14,safediv use mo_sedmnt, only: pror13,pror14,prca13,prca14 -#endif - + use mo_ifdefs implicit none @@ -89,10 +88,11 @@ subroutine powach(kpie,kpje,kpke,kbnd,prho,omask,psao,lspin) real :: sedb1(kpie,0:ks),sediso(kpie,0:ks) real :: solrat(kpie,ks),powcar(kpie,ks) real :: aerob(kpie,ks),anaerob(kpie,ks) -#ifdef cisonew + + ! cisonew real :: aerob13(kpie,ks),anaerob13(kpie,ks) real :: aerob14(kpie,ks),anaerob14(kpie,ks) -#endif + real :: dissot, undsa, posol real :: umfa, denit, saln, rrho, alk, c, sit, pt real :: K1, K2, Kb, Kw, Ks1, Kf, Ksi, K1p, K2p, K3p @@ -133,15 +133,19 @@ subroutine powach(kpie,kpje,kpke,kbnd,prho,omask,psao,lspin) powcar(i,k) = 0. anaerob(i,k)= 0. aerob(i,k) = 0. -#ifdef cisonew - anaerob13(i,k)=0. - aerob13(i,k) =0. - anaerob14(i,k)=0. - aerob14(i,k) =0. -#endif enddo enddo + if (use_cisonew) then + do k = 1, ks + do i = 1, kpie + anaerob13(i,k)=0. + aerob13(i,k) =0. + anaerob14(i,k)=0. + aerob14(i,k) =0. + end do + end do + end if ! calculate bottom ventilation rate for scaling of sediment-water exchange do i = 1, kpie @@ -288,15 +292,19 @@ subroutine powach(kpie,kpje,kpke,kbnd,prho,omask,psao,lspin) endif sedlay(i,j,1,issso12) = & & sedlay(i,j,1,issso12) + prorca(i,j) / (porsol(i,j,1)*seddw(1)) -#ifdef cisonew - sedlay(i,j,1,issso13) = & - & sedlay(i,j,1,issso13) + pror13(i,j) / (porsol(i,j,1)*seddw(1)) - sedlay(i,j,1,issso14) = & - & sedlay(i,j,1,issso14) + pror14(i,j) / (porsol(i,j,1)*seddw(1)) -#endif - endif - enddo + end if + end do + if (use_cisonew) then + do i = 1, kpie + if(omask(i,j) > 0.5) then + sedlay(i,j,1,issso13) = & + & sedlay(i,j,1,issso13) + pror13(i,j) / (porsol(i,j,1)*seddw(1)) + sedlay(i,j,1,issso14) = & + & sedlay(i,j,1,issso14) + pror14(i,j) / (porsol(i,j,1)*seddw(1)) + endif + enddo + end if ! Calculate updated degradation rate from updated concentration. ! Calculate new solid sediment. @@ -309,29 +317,36 @@ subroutine powach(kpie,kpje,kpke,kbnd,prho,omask,psao,lspin) solrat(i,k) = sedlay(i,j,k,issso12) * dissot/(1. + dissot*sediso(i,k)) posol = sediso(i,k)*solrat(i,k) aerob(i,k) = posol*umfa !this has P units: kmol P/m3 of pore water -#ifdef cisonew - rato13 = sedlay(i,j,k,issso13) / (sedlay(i,j,k,issso12) + safediv) - rato14 = sedlay(i,j,k,issso14) / (sedlay(i,j,k,issso12) + safediv) - poso13 = posol*rato13 - poso14 = posol*rato14 - aerob13(i,k) = poso13*umfa !this has P units: kmol P/m3 of pore water - aerob14(i,k) = poso14*umfa !this has P units: kmol P/m3 of pore water -#endif + sedlay(i,j,k,issso12) = sedlay(i,j,k,issso12) - posol powtra(i,j,k,ipowaph) = powtra(i,j,k,ipowaph) + posol*umfa powtra(i,j,k,ipowno3) = powtra(i,j,k,ipowno3) + posol*rnit*umfa powtra(i,j,k,ipowaox) = sediso(i,k) -#ifdef cisonew - sedlay(i,j,k,issso13) = sedlay(i,j,k,issso13) - poso13 - sedlay(i,j,k,issso14) = sedlay(i,j,k,issso14) - poso14 - ! is this correct? no correspondance in the lines above - powtra(i,j,k,ipowc13) = powtra(i,j,k,ipowc13) + poso13*umfa - powtra(i,j,k,ipowc14) = powtra(i,j,k,ipowc14) + poso14*umfa -#endif endif enddo enddo + if (use_cisonew) then + do k = 1, ks + do i = 1, kpie + if(omask(i,j) > 0.5) then + rato13 = sedlay(i,j,k,issso13) / (sedlay(i,j,k,issso12) + safediv) + rato14 = sedlay(i,j,k,issso14) / (sedlay(i,j,k,issso12) + safediv) + poso13 = posol*rato13 + poso14 = posol*rato14 + aerob13(i,k) = poso13*umfa !this has P units: kmol P/m3 of pore water + aerob14(i,k) = poso14*umfa !this has P units: kmol P/m3 of pore water + + sedlay(i,j,k,issso13) = sedlay(i,j,k,issso13) - poso13 + sedlay(i,j,k,issso14) = sedlay(i,j,k,issso14) - poso14 + ! is this correct? no correspondance in the lines above + powtra(i,j,k,ipowc13) = powtra(i,j,k,ipowc13) + poso13*umfa + powtra(i,j,k,ipowc14) = powtra(i,j,k,ipowc14) + poso14*umfa + endif + enddo + enddo + end if + ! Calculate nitrate reduction under anaerobic conditions explicitely !******************************************************************* @@ -345,31 +360,42 @@ subroutine powach(kpie,kpje,kpke,kbnd,prho,omask,psao,lspin) & sedlay(i,j,k,issso12)) umfa = porsol(i,j,k)/porwat(i,j,k) anaerob(i,k) = posol*umfa !this has P units: kmol P/m3 of pore water -#ifdef cisonew - rato13 = sedlay(i,j,k,issso13) / (sedlay(i,j,k,issso12) + safediv) - rato14 = sedlay(i,j,k,issso14) / (sedlay(i,j,k,issso12) + safediv) - poso13 = posol * rato13 - poso14 = posol * rato14 - anaerob13(i,k) = poso13*umfa !this has P units: kmol P/m3 of pore water - anaerob14(i,k) = poso14*umfa !this has P units: kmol P/m3 of pore water -#endif + sedlay(i,j,k,issso12) = sedlay(i,j,k,issso12) - posol powtra(i,j,k,ipowaph) = powtra(i,j,k,ipowaph) + posol*umfa powtra(i,j,k,ipowno3) = powtra(i,j,k,ipowno3) - 98.*posol*umfa powtra(i,j,k,ipown2) = powtra(i,j,k,ipown2) + 57.*posol*umfa -#ifdef cisonew - sedlay(i,j,k,issso13) = sedlay(i,j,k,issso13) - poso13 - sedlay(i,j,k,issso14) = sedlay(i,j,k,issso14) - poso14 - ! is this correct? no corresponance in the lines above - powtra(i,j,k,ipowc13) = powtra(i,j,k,ipowc13) + poso13*umfa - powtra(i,j,k,ipowc14) = powtra(i,j,k,ipowc14) + poso14*umfa -#endif endif endif enddo enddo + ! Denitrification rate constant of POP (disso) [1/sec]*dtbgc + if (use_cisonew) then + denit = sed_denit + do k = 1, ks + do i = 1, kpie + if(omask(i,j) > 0.5) then + if(powtra(i,j,k,ipowaox) < 1.e-6) then + rato13 = sedlay(i,j,k,issso13) / (sedlay(i,j,k,issso12) + safediv) + rato14 = sedlay(i,j,k,issso14) / (sedlay(i,j,k,issso12) + safediv) + poso13 = posol * rato13 + poso14 = posol * rato14 + anaerob13(i,k) = poso13*umfa !this has P units: kmol P/m3 of pore water + anaerob14(i,k) = poso14*umfa !this has P units: kmol P/m3 of pore water + + sedlay(i,j,k,issso13) = sedlay(i,j,k,issso13) - poso13 + sedlay(i,j,k,issso14) = sedlay(i,j,k,issso14) - poso14 + ! is this correct? no corresponance in the lines above + powtra(i,j,k,ipowc13) = powtra(i,j,k,ipowc13) + poso13*umfa + powtra(i,j,k,ipowc14) = powtra(i,j,k,ipowc14) + poso14*umfa + endif + endif + enddo + enddo + end if + ! sulphate reduction in sediments do k = 1, ks do i = 1, kpie @@ -379,26 +405,33 @@ subroutine powach(kpie,kpje,kpke,kbnd,prho,omask,psao,lspin) umfa = porsol(i,j,k) / porwat(i,j,k) !this overwrites anaerob from denitrification. added =anaerob+..., works anaerob(i,k) = anaerob(i,k) + posol*umfa !this has P units: kmol P/m3 of pore water -#ifdef cisonew - rato13 = sedlay(i,j,k,issso13) / (sedlay(i,j,k,issso12)+safediv) - rato14 = sedlay(i,j,k,issso14) / (sedlay(i,j,k,issso12)+safediv) - poso13 = posol * rato13 - poso14 = posol * rato14 - anaerob13(i,k) = anaerob13(i,k) + poso13*umfa !this has P units: kmol P/m3 of pore water - anaerob14(i,k) = anaerob13(i,k) + poso14*umfa !this has P units: kmol P/m3 of pore water -#endif sedlay(i,j,k,issso12) = sedlay(i,j,k,issso12) - posol powtra(i,j,k,ipowaph) = powtra(i,j,k,ipowaph) + posol*umfa powtra(i,j,k,ipowno3) = powtra(i,j,k,ipowno3) + posol*umfa*rno3 -#ifdef cisonew - sedlay(i,j,k,issso13) = sedlay(i,j,k,issso13) - poso13 - sedlay(i,j,k,issso14) = sedlay(i,j,k,issso14) - poso14 -#endif endif endif enddo enddo ! end sulphate reduction + if (use_cisonew) then + do k = 1, ks + do i = 1, kpie + if(omask(i,j) > 0.5) then + if(powtra(i,j,k,ipowaox) < 3.e-6 .and. powtra(i,j,k,ipowno3) < 3.e-6) then + rato13 = sedlay(i,j,k,issso13) / (sedlay(i,j,k,issso12)+safediv) + rato14 = sedlay(i,j,k,issso14) / (sedlay(i,j,k,issso12)+safediv) + poso13 = posol * rato13 + poso14 = posol * rato14 + + anaerob13(i,k) = anaerob13(i,k) + poso13*umfa !this has P units: kmol P/m3 of pore water + anaerob14(i,k) = anaerob13(i,k) + poso14*umfa !this has P units: kmol P/m3 of pore water + sedlay(i,j,k,issso13) = sedlay(i,j,k,issso13) - poso13 + sedlay(i,j,k,issso14) = sedlay(i,j,k,issso14) - poso14 + endif + endif + enddo + enddo ! end sulphate reduction + end if ! Calculate CaCO3-CO3 cycle and simultaneous CO3-undersaturation diffusion !************************************************************************* @@ -491,15 +524,20 @@ subroutine powach(kpie,kpje,kpke,kbnd,prho,omask,psao,lspin) if(omask(i,j) > 0.5) then sedlay(i,j,1,isssc12) = & & sedlay(i,j,1,isssc12) + prcaca(i,j) / (porsol(i,j,1)*seddw(1)) -#ifdef cisonew - sedlay(i,j,1,isssc13) = & - & sedlay(i,j,1,isssc13) + prca13(i,j) / (porsol(i,j,1)*seddw(1)) - sedlay(i,j,1,isssc14) = & - & sedlay(i,j,1,isssc14) + prca14(i,j) / (porsol(i,j,1)*seddw(1)) -#endif endif enddo + if (use_cisonew) then + do i = 1, kpie + if(omask(i,j) > 0.5) then + sedlay(i,j,1,isssc13) = & + & sedlay(i,j,1,isssc13) + prca13(i,j) / (porsol(i,j,1)*seddw(1)) + sedlay(i,j,1,isssc14) = & + & sedlay(i,j,1,isssc14) + prca14(i,j) / (porsol(i,j,1)*seddw(1)) + endif + enddo + end if + ! Calculate updated degradation rate from updated undersaturation. ! Calculate new solid sediment. ! No update of powcar pore water concentration from new undersaturation so far. @@ -513,29 +551,36 @@ subroutine powach(kpie,kpje,kpke,kbnd,prho,omask,psao,lspin) solrat(i,k) = sedlay(i,j,k,isssc12) & & * dissot / (1. + dissot * sediso(i,k)) posol = sediso(i,k) * solrat(i,k) -#ifdef cisonew - ratc13 = sedlay(i,j,k,isssc13) / (sedlay(i,j,k,isssc12) + safediv) - ratc14 = sedlay(i,j,k,isssc14) / (sedlay(i,j,k,isssc12) + safediv) - poso13 = posol * ratc13 - poso14 = posol * ratc14 -#endif + sedlay(i,j,k,isssc12) = sedlay(i,j,k,isssc12) - posol powtra(i,j,k,ipowaic) = powtra(i,j,k,ipowaic) & & + posol * umfa + (aerob(i,k) + anaerob(i,k)) * 122. powtra(i,j,k,ipowaal) = powtra(i,j,k,ipowaal) & & + 2. * posol * umfa - 16. * (aerob(i,k) + anaerob(i,k)) -#ifdef cisonew - sedlay(i,j,k,isssc13) = sedlay(i,j,k,isssc13) - poso13 - sedlay(i,j,k,isssc14) = sedlay(i,j,k,isssc14) - poso14 - powtra(i,j,k,ipowc13) = powtra(i,j,k,ipowc13) + poso13 * umfa & - & + (aerob13(i,k) + anaerob13(i,k)) * 122. - powtra(i,j,k,ipowc14) = powtra(i,j,k,ipowc14) + poso14 * umfa & - & + (aerob14(i,k) + anaerob14(i,k)) * 122. -#endif endif enddo enddo + if (use_cisonew) then + do k = 1, ks + do i = 1, kpie + if(omask(i,j) > 0.5) then + ratc13 = sedlay(i,j,k,isssc13) / (sedlay(i,j,k,isssc12) + safediv) + ratc14 = sedlay(i,j,k,isssc14) / (sedlay(i,j,k,isssc12) + safediv) + poso13 = posol * ratc13 + poso14 = posol * ratc14 + + sedlay(i,j,k,isssc13) = sedlay(i,j,k,isssc13) - poso13 + sedlay(i,j,k,isssc14) = sedlay(i,j,k,isssc14) - poso14 + powtra(i,j,k,ipowc13) = powtra(i,j,k,ipowc13) + poso13 * umfa & + & + (aerob13(i,k) + anaerob13(i,k)) * 122. + powtra(i,j,k,ipowc14) = powtra(i,j,k,ipowc14) + poso14 * umfa & + & + (aerob14(i,k) + anaerob14(i,k)) * 122. + endif + enddo + enddo + end if + enddo j_loop !$OMP END PARALLEL DO @@ -547,33 +592,40 @@ subroutine powach(kpie,kpje,kpke,kbnd,prho,omask,psao,lspin) !ik this is currently assumed to depend on total and corg sedimentation: !ik f(POC) [kg C] / f(total) [kg] = 0.05 !ik thus it is -!$OMP PARALLEL DO PRIVATE(i) + !$OMP PARALLEL DO PRIVATE(i) do j = 1, kpje do i = 1, kpie sedlay(i,j,1,issster) = sedlay(i,j,1,issster) & & + produs(i,j) / (porsol(i,j,1) * seddw(1)) enddo enddo -!$OMP END PARALLEL DO - + !$OMP END PARALLEL DO if(.not. lspin) then -!$OMP PARALLEL DO PRIVATE(i) - do j = 1, kpje - do i = 1, kpie - silpro(i,j) = 0. - prorca(i,j) = 0. - prcaca(i,j) = 0. -#ifdef cisonew - pror13(i,j) = 0. - pror14(i,j) = 0. - prca13(i,j) = 0. - prca14(i,j) = 0. -#endif - produs(i,j) = 0. + !$OMP PARALLEL DO PRIVATE(i) + do j = 1, kpje + do i = 1, kpie + silpro(i,j) = 0. + prorca(i,j) = 0. + prcaca(i,j) = 0. + produs(i,j) = 0. + enddo enddo - enddo -!$OMP END PARALLEL DO + !$OMP END PARALLEL DO + + if (use_cisonew) then + !$OMP PARALLEL DO PRIVATE(i) + do j = 1, kpje + do i = 1, kpie + pror13(i,j) = 0. + pror14(i,j) = 0. + prca13(i,j) = 0. + prca14(i,j) = 0. + produs(i,j) = 0. + enddo + enddo + !$OMP END PARALLEL DO + end if endif end subroutine powach diff --git a/hamocc/profile_gd.F90 b/hamocc/profile_gd.F90 index cdc72971..136d50a7 100644 --- a/hamocc/profile_gd.F90 +++ b/hamocc/profile_gd.F90 @@ -47,12 +47,12 @@ subroutine profile_gd(kpie,kpje,kpke,kbnd,pglon,pglat,omask) use mo_control_bgc, only: io_stdo_bgc use mo_vgrid, only: ptiestw use mo_param1_bgc, only: ialkali,iano3,ioxygen,iphosph,isco212,isilica -#ifdef cisonew - use mo_param1_bgc, only: isco213,isco214 -#endif -#ifdef natDIC - use mo_param1_bgc, only: inatalkali,inatsco212 -#endif +! cisonew +use mo_param1_bgc, only: isco213,isco214 +! natDIC +use mo_param1_bgc, only: inatalkali,inatsco212 +use mo_ifdefs + implicit none integer, intent(in) :: kpie,kpje,kpke,kbnd @@ -82,19 +82,19 @@ subroutine profile_gd(kpie,kpje,kpke,kbnd,pglon,pglat,omask) vname( 1:nflds) = (/ 'dic', 'alk', 'pho', 'nit','sil', 'oxy' /) ifld( 1:nflds) = (/ isco212,ialkali,iphosph,iano3,isilica,ioxygen/) -#ifdef natDIC -no = nflds+1 -nflds = nflds+nread_ndic -vname(no:nflds) = (/'dic', 'alk'/) - ifld(no:nflds) = (/inatsco212,inatalkali/) -#endif - -#ifdef cisonew -no = nflds+1 -nflds = nflds+nread_ciso -vname(no:nflds) = (/'d13', 'd14'/) - ifld(no:nflds) = (/isco213,isco214/) -#endif + if (use_natDIC) then + no = nflds+1 + nflds = nflds+nread_ndic + vname(no:nflds) = (/'dic', 'alk'/) + ifld(no:nflds) = (/inatsco212,inatalkali/) + end if + + if (use_cisonew) then + no = nflds+1 + nflds = nflds+nread_ciso + vname(no:nflds) = (/'d13', 'd14'/) + ifld(no:nflds) = (/isco213,isco214/) + end if do n = 1, nflds ! Loop over tracer diff --git a/hamocc/sedshi.F90 b/hamocc/sedshi.F90 index 44058447..3d2a0071 100644 --- a/hamocc/sedshi.F90 +++ b/hamocc/sedshi.F90 @@ -54,9 +54,10 @@ SUBROUTINE SEDSHI(kpie,kpje,omask) use mo_sedmnt, only: burial,calfa,clafa,oplfa,orgfa,porsol,sedlay,seddw,solfu use mo_biomod, only: rcar use mo_param1_bgc, only: isssc12,issssil,issso12,issster,ks,nsedtra -#ifdef cisonew + ! cisonew use mo_param1_bgc, only: isssc13,isssc14,issso13,issso14 -#endif + use mo_ifdefs + implicit none INTEGER :: kpie,kpje,i,j,k,l,iv @@ -272,20 +273,20 @@ SUBROUTINE SEDSHI(kpie,kpje,omask) frac=porsol(i,j,k)*seddw(k)/(porsol(i,j,k-1)*seddw(k-1)) sedlay(i,j,k,iv)=sedlay(i,j,k,iv)-uebers sedlay(i,j,k-1,iv)=sedlay(i,j,k-1,iv)+uebers*frac -#ifdef cisonew - if(iv.eq.issso12)then - sedlay(i,j,k,issso13) =sedlay(i,j,k,issso13)-uebers - sedlay(i,j,k-1,issso13)=sedlay(i,j,k-1,issso13)+uebers*frac - sedlay(i,j,k,issso14) =sedlay(i,j,k,issso14)-uebers - sedlay(i,j,k-1,issso14)=sedlay(i,j,k-1,issso14)+uebers*frac - endif - if(iv.eq.isssc12)then - sedlay(i,j,k,isssc13) =sedlay(i,j,k,isssc13)-uebers - sedlay(i,j,k-1,isssc13)=sedlay(i,j,k-1,isssc13)+uebers*frac - sedlay(i,j,k,isssc14) =sedlay(i,j,k,isssc14)-uebers - sedlay(i,j,k-1,isssc14)=sedlay(i,j,k-1,isssc14)+uebers*frac - endif -#endif + if (use_cisonew) then + if(iv.eq.issso12)then + sedlay(i,j,k,issso13) =sedlay(i,j,k,issso13)-uebers + sedlay(i,j,k-1,issso13)=sedlay(i,j,k-1,issso13)+uebers*frac + sedlay(i,j,k,issso14) =sedlay(i,j,k,issso14)-uebers + sedlay(i,j,k-1,issso14)=sedlay(i,j,k-1,issso14)+uebers*frac + endif + if(iv.eq.isssc12)then + sedlay(i,j,k,isssc13) =sedlay(i,j,k,isssc13)-uebers + sedlay(i,j,k-1,isssc13)=sedlay(i,j,k-1,isssc13)+uebers*frac + sedlay(i,j,k,isssc14) =sedlay(i,j,k,isssc14)-uebers + sedlay(i,j,k-1,isssc14)=sedlay(i,j,k-1,isssc14)+uebers*frac + endif + end if endif enddo !end i-loop enddo !end j-loop @@ -296,4 +297,4 @@ SUBROUTINE SEDSHI(kpie,kpje,omask) RETURN - END + END SUBROUTINE SEDSHI diff --git a/trc/restart_trcrd.F90 b/trc/restart_trcrd.F90 index bbe636fe..aff3fba1 100644 --- a/trc/restart_trcrd.F90 +++ b/trc/restart_trcrd.F90 @@ -32,8 +32,12 @@ subroutine restart_trcrd(rstfnm_ocn) logical :: error character(len=256) :: rstfnm_ocntrc -#ifdef HAMOCC + ! HAMOCC character(len=256) :: rstfnm_hamocc +#ifdef HAMOCC + logical :: use_hamocc = .true. +#else + logical :: use_hamocc = .false. #endif ! ! --- ------------------------------------------------------------------ @@ -48,14 +52,14 @@ subroutine restart_trcrd(rstfnm_ocn) call xcstop('(restat_trcrd)') stop '(restart_trcrd)' endif -#ifdef HAMOCC - call restart_getfile(rstfnm_ocn, 'rbgc', rstfnm_hamocc, error) - if (error) then - write(lp,*) 'restart_trcrd: could not generate rstfnm_hamocc file!' - call xcstop('(restat_trcrd)') - stop '(restart_trcrd)' - endif -#endif + if (use_HAMOCC) then + call restart_getfile(rstfnm_ocn, 'rbgc', rstfnm_hamocc, error) + if (error) then + write(lp,*) 'restart_trcrd: could not generate rstfnm_hamocc file!' + call xcstop('(restat_trcrd)') + stop '(restart_trcrd)' + endif + end if else call restart_getfile(rstfnm_ocn, 'resttrc', rstfnm_ocntrc, error) if (error) then @@ -63,21 +67,21 @@ subroutine restart_trcrd(rstfnm_ocn) call xcstop('(restat_trcrd)') stop '(restart_trcrd)' endif -#ifdef HAMOCC - call restart_getfile(rstfnm_ocn, 'restbgc', rstfnm_hamocc, error) - if (error) then - write(lp,*) 'restart_trcrd: could not generate rstfnm_hamocc file!' - call xcstop('(restat_trcrd)') - stop '(restart_trcrd)' - endif -#endif + if (use_HAMOCC) then + call restart_getfile(rstfnm_ocn, 'restbgc', rstfnm_hamocc, error) + if (error) then + write(lp,*) 'restart_trcrd: could not generate rstfnm_hamocc file!' + call xcstop('(restat_trcrd)') + stop '(restart_trcrd)' + endif + end if endif endif call xcbcst(rstfnm_ocntrc) -#ifdef HAMOCC - call xcbcst(rstfnm_hamocc) -#endif + if (use_HAMOCC) then + call xcbcst(rstfnm_hamocc) + end if ! ! --- ------------------------------------------------------------------ @@ -86,9 +90,9 @@ subroutine restart_trcrd(rstfnm_ocn) ! call restart_ocntrcrd(rstfnm_ocntrc) -#ifdef HAMOCC - call hamocc_init(1,rstfnm_hamocc) -#endif + if (use_HAMOCC) then + call hamocc_init(1,rstfnm_hamocc) + end if return end subroutine restart_trcrd From 5ceeb79cf34dd823a8d4493fb002779e0241b23f Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Tue, 1 Aug 2023 14:26:24 +0200 Subject: [PATCH 37/52] addition of mod_ifdefs.F90 --- phy/mod_ifdefs.F90 | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 phy/mod_ifdefs.F90 diff --git a/phy/mod_ifdefs.F90 b/phy/mod_ifdefs.F90 new file mode 100644 index 00000000..624060e0 --- /dev/null +++ b/phy/mod_ifdefs.F90 @@ -0,0 +1,22 @@ +module mod_ifdefs + + implicit none + public + +#ifdef TRC + logical, parameter :: use_TRC = .true. +#else + logical, parameter :: use_TRC = .false. +#endif +#ifdef TKE + logical, parameter :: use_TKE = .true. +#else + logical, parameter :: use_TKE = .false. +#endif +#ifdef IDLAGE + logical, parameter :: use_IDLAGE = .true. +#else + logical, parameter :: use_IDLAGE = .false. +#endif + +end module mod_ifdefs From 12e52191d5a73948220e05b089f352b4c22172c6 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Tue, 1 Aug 2023 15:50:02 +0200 Subject: [PATCH 38/52] feature/refactor_ifdefs --- hamocc/powach.F90 | 206 +++++++++++++++++----------------------------- 1 file changed, 76 insertions(+), 130 deletions(-) diff --git a/hamocc/powach.F90 b/hamocc/powach.F90 index fc645814..81cd023f 100644 --- a/hamocc/powach.F90 +++ b/hamocc/powach.F90 @@ -69,10 +69,9 @@ subroutine powach(kpie,kpje,kpke,kbnd,prho,omask,psao,lspin) & issster, ks use mo_vgrid, only: kbo,bolay - ! cisonew + ! cisonew use mo_param1_bgc, only: ipowc13,ipowc14,isssc13,isssc14,issso13,issso14,safediv use mo_sedmnt, only: pror13,pror14,prca13,prca14 - use mo_ifdefs implicit none @@ -88,11 +87,10 @@ subroutine powach(kpie,kpje,kpke,kbnd,prho,omask,psao,lspin) real :: sedb1(kpie,0:ks),sediso(kpie,0:ks) real :: solrat(kpie,ks),powcar(kpie,ks) real :: aerob(kpie,ks),anaerob(kpie,ks) - ! cisonew real :: aerob13(kpie,ks),anaerob13(kpie,ks) real :: aerob14(kpie,ks),anaerob14(kpie,ks) - + ! real :: dissot, undsa, posol real :: umfa, denit, saln, rrho, alk, c, sit, pt real :: K1, K2, Kb, Kw, Ks1, Kf, Ksi, K1p, K2p, K3p @@ -133,19 +131,15 @@ subroutine powach(kpie,kpje,kpke,kbnd,prho,omask,psao,lspin) powcar(i,k) = 0. anaerob(i,k)= 0. aerob(i,k) = 0. - enddo - enddo - - if (use_cisonew) then - do k = 1, ks - do i = 1, kpie + if (use_cisonew) then anaerob13(i,k)=0. aerob13(i,k) =0. anaerob14(i,k)=0. aerob14(i,k) =0. - end do - end do - end if + end if + enddo + enddo + ! calculate bottom ventilation rate for scaling of sediment-water exchange do i = 1, kpie @@ -292,19 +286,15 @@ subroutine powach(kpie,kpje,kpke,kbnd,prho,omask,psao,lspin) endif sedlay(i,j,1,issso12) = & & sedlay(i,j,1,issso12) + prorca(i,j) / (porsol(i,j,1)*seddw(1)) - end if - end do - - if (use_cisonew) then - do i = 1, kpie - if(omask(i,j) > 0.5) then + if (use_cisonew) then sedlay(i,j,1,issso13) = & & sedlay(i,j,1,issso13) + pror13(i,j) / (porsol(i,j,1)*seddw(1)) sedlay(i,j,1,issso14) = & & sedlay(i,j,1,issso14) + pror14(i,j) / (porsol(i,j,1)*seddw(1)) - endif - enddo - end if + end if + endif + enddo + ! Calculate updated degradation rate from updated concentration. ! Calculate new solid sediment. @@ -317,35 +307,28 @@ subroutine powach(kpie,kpje,kpke,kbnd,prho,omask,psao,lspin) solrat(i,k) = sedlay(i,j,k,issso12) * dissot/(1. + dissot*sediso(i,k)) posol = sediso(i,k)*solrat(i,k) aerob(i,k) = posol*umfa !this has P units: kmol P/m3 of pore water - - sedlay(i,j,k,issso12) = sedlay(i,j,k,issso12) - posol - powtra(i,j,k,ipowaph) = powtra(i,j,k,ipowaph) + posol*umfa - powtra(i,j,k,ipowno3) = powtra(i,j,k,ipowno3) + posol*rnit*umfa - powtra(i,j,k,ipowaox) = sediso(i,k) - endif - enddo - enddo - - if (use_cisonew) then - do k = 1, ks - do i = 1, kpie - if(omask(i,j) > 0.5) then + if (use_cisonew) then rato13 = sedlay(i,j,k,issso13) / (sedlay(i,j,k,issso12) + safediv) rato14 = sedlay(i,j,k,issso14) / (sedlay(i,j,k,issso12) + safediv) poso13 = posol*rato13 poso14 = posol*rato14 aerob13(i,k) = poso13*umfa !this has P units: kmol P/m3 of pore water aerob14(i,k) = poso14*umfa !this has P units: kmol P/m3 of pore water - + end if + sedlay(i,j,k,issso12) = sedlay(i,j,k,issso12) - posol + powtra(i,j,k,ipowaph) = powtra(i,j,k,ipowaph) + posol*umfa + powtra(i,j,k,ipowno3) = powtra(i,j,k,ipowno3) + posol*rnit*umfa + powtra(i,j,k,ipowaox) = sediso(i,k) + if (use_cisonew) then sedlay(i,j,k,issso13) = sedlay(i,j,k,issso13) - poso13 sedlay(i,j,k,issso14) = sedlay(i,j,k,issso14) - poso14 ! is this correct? no correspondance in the lines above powtra(i,j,k,ipowc13) = powtra(i,j,k,ipowc13) + poso13*umfa powtra(i,j,k,ipowc14) = powtra(i,j,k,ipowc14) + poso14*umfa - endif - enddo + end if + endif enddo - end if + enddo ! Calculate nitrate reduction under anaerobic conditions explicitely !******************************************************************* @@ -360,41 +343,30 @@ subroutine powach(kpie,kpje,kpke,kbnd,prho,omask,psao,lspin) & sedlay(i,j,k,issso12)) umfa = porsol(i,j,k)/porwat(i,j,k) anaerob(i,k) = posol*umfa !this has P units: kmol P/m3 of pore water - - sedlay(i,j,k,issso12) = sedlay(i,j,k,issso12) - posol - powtra(i,j,k,ipowaph) = powtra(i,j,k,ipowaph) + posol*umfa - powtra(i,j,k,ipowno3) = powtra(i,j,k,ipowno3) - 98.*posol*umfa - powtra(i,j,k,ipown2) = powtra(i,j,k,ipown2) + 57.*posol*umfa - endif - endif - enddo - enddo - - - ! Denitrification rate constant of POP (disso) [1/sec]*dtbgc - if (use_cisonew) then - denit = sed_denit - do k = 1, ks - do i = 1, kpie - if(omask(i,j) > 0.5) then - if(powtra(i,j,k,ipowaox) < 1.e-6) then + if (use_cisonew) then rato13 = sedlay(i,j,k,issso13) / (sedlay(i,j,k,issso12) + safediv) rato14 = sedlay(i,j,k,issso14) / (sedlay(i,j,k,issso12) + safediv) poso13 = posol * rato13 poso14 = posol * rato14 anaerob13(i,k) = poso13*umfa !this has P units: kmol P/m3 of pore water anaerob14(i,k) = poso14*umfa !this has P units: kmol P/m3 of pore water - + end if + sedlay(i,j,k,issso12) = sedlay(i,j,k,issso12) - posol + powtra(i,j,k,ipowaph) = powtra(i,j,k,ipowaph) + posol*umfa + powtra(i,j,k,ipowno3) = powtra(i,j,k,ipowno3) - 98.*posol*umfa + powtra(i,j,k,ipown2) = powtra(i,j,k,ipown2) + 57.*posol*umfa + if (use_cisonew) then sedlay(i,j,k,issso13) = sedlay(i,j,k,issso13) - poso13 sedlay(i,j,k,issso14) = sedlay(i,j,k,issso14) - poso14 ! is this correct? no corresponance in the lines above powtra(i,j,k,ipowc13) = powtra(i,j,k,ipowc13) + poso13*umfa powtra(i,j,k,ipowc14) = powtra(i,j,k,ipowc14) + poso14*umfa - endif + end if endif - enddo + endif enddo - end if + enddo + ! sulphate reduction in sediments do k = 1, ks @@ -405,33 +377,26 @@ subroutine powach(kpie,kpje,kpke,kbnd,prho,omask,psao,lspin) umfa = porsol(i,j,k) / porwat(i,j,k) !this overwrites anaerob from denitrification. added =anaerob+..., works anaerob(i,k) = anaerob(i,k) + posol*umfa !this has P units: kmol P/m3 of pore water - sedlay(i,j,k,issso12) = sedlay(i,j,k,issso12) - posol - powtra(i,j,k,ipowaph) = powtra(i,j,k,ipowaph) + posol*umfa - powtra(i,j,k,ipowno3) = powtra(i,j,k,ipowno3) + posol*umfa*rno3 - endif - endif - enddo - enddo ! end sulphate reduction - - if (use_cisonew) then - do k = 1, ks - do i = 1, kpie - if(omask(i,j) > 0.5) then - if(powtra(i,j,k,ipowaox) < 3.e-6 .and. powtra(i,j,k,ipowno3) < 3.e-6) then + if (use_cisonew) then rato13 = sedlay(i,j,k,issso13) / (sedlay(i,j,k,issso12)+safediv) rato14 = sedlay(i,j,k,issso14) / (sedlay(i,j,k,issso12)+safediv) poso13 = posol * rato13 poso14 = posol * rato14 - anaerob13(i,k) = anaerob13(i,k) + poso13*umfa !this has P units: kmol P/m3 of pore water anaerob14(i,k) = anaerob13(i,k) + poso14*umfa !this has P units: kmol P/m3 of pore water + end if + sedlay(i,j,k,issso12) = sedlay(i,j,k,issso12) - posol + powtra(i,j,k,ipowaph) = powtra(i,j,k,ipowaph) + posol*umfa + powtra(i,j,k,ipowno3) = powtra(i,j,k,ipowno3) + posol*umfa*rno3 + if (use_cisonew) then sedlay(i,j,k,issso13) = sedlay(i,j,k,issso13) - poso13 sedlay(i,j,k,issso14) = sedlay(i,j,k,issso14) - poso14 - endif + end if endif - enddo - enddo ! end sulphate reduction - end if + endif + enddo + enddo ! end sulphate reduction + ! Calculate CaCO3-CO3 cycle and simultaneous CO3-undersaturation diffusion !************************************************************************* @@ -524,19 +489,14 @@ subroutine powach(kpie,kpje,kpke,kbnd,prho,omask,psao,lspin) if(omask(i,j) > 0.5) then sedlay(i,j,1,isssc12) = & & sedlay(i,j,1,isssc12) + prcaca(i,j) / (porsol(i,j,1)*seddw(1)) - endif - enddo - - if (use_cisonew) then - do i = 1, kpie - if(omask(i,j) > 0.5) then + if (use_cisonew) then sedlay(i,j,1,isssc13) = & & sedlay(i,j,1,isssc13) + prca13(i,j) / (porsol(i,j,1)*seddw(1)) sedlay(i,j,1,isssc14) = & & sedlay(i,j,1,isssc14) + prca14(i,j) / (porsol(i,j,1)*seddw(1)) - endif - enddo - end if + end if + endif + enddo ! Calculate updated degradation rate from updated undersaturation. ! Calculate new solid sediment. @@ -551,35 +511,28 @@ subroutine powach(kpie,kpje,kpke,kbnd,prho,omask,psao,lspin) solrat(i,k) = sedlay(i,j,k,isssc12) & & * dissot / (1. + dissot * sediso(i,k)) posol = sediso(i,k) * solrat(i,k) - + if (use_cisonew) then + ratc13 = sedlay(i,j,k,isssc13) / (sedlay(i,j,k,isssc12) + safediv) + ratc14 = sedlay(i,j,k,isssc14) / (sedlay(i,j,k,isssc12) + safediv) + poso13 = posol * ratc13 + poso14 = posol * ratc14 + end if sedlay(i,j,k,isssc12) = sedlay(i,j,k,isssc12) - posol powtra(i,j,k,ipowaic) = powtra(i,j,k,ipowaic) & & + posol * umfa + (aerob(i,k) + anaerob(i,k)) * 122. powtra(i,j,k,ipowaal) = powtra(i,j,k,ipowaal) & & + 2. * posol * umfa - 16. * (aerob(i,k) + anaerob(i,k)) - endif - enddo - enddo - - if (use_cisonew) then - do k = 1, ks - do i = 1, kpie - if(omask(i,j) > 0.5) then - ratc13 = sedlay(i,j,k,isssc13) / (sedlay(i,j,k,isssc12) + safediv) - ratc14 = sedlay(i,j,k,isssc14) / (sedlay(i,j,k,isssc12) + safediv) - poso13 = posol * ratc13 - poso14 = posol * ratc14 - + if (use_cisonew) then sedlay(i,j,k,isssc13) = sedlay(i,j,k,isssc13) - poso13 sedlay(i,j,k,isssc14) = sedlay(i,j,k,isssc14) - poso14 powtra(i,j,k,ipowc13) = powtra(i,j,k,ipowc13) + poso13 * umfa & & + (aerob13(i,k) + anaerob13(i,k)) * 122. powtra(i,j,k,ipowc14) = powtra(i,j,k,ipowc14) + poso14 * umfa & & + (aerob14(i,k) + anaerob14(i,k)) * 122. - endif - enddo + end if + endif enddo - end if + enddo enddo j_loop @@ -592,40 +545,33 @@ subroutine powach(kpie,kpje,kpke,kbnd,prho,omask,psao,lspin) !ik this is currently assumed to depend on total and corg sedimentation: !ik f(POC) [kg C] / f(total) [kg] = 0.05 !ik thus it is - !$OMP PARALLEL DO PRIVATE(i) +!$OMP PARALLEL DO PRIVATE(i) do j = 1, kpje do i = 1, kpie sedlay(i,j,1,issster) = sedlay(i,j,1,issster) & & + produs(i,j) / (porsol(i,j,1) * seddw(1)) enddo enddo - !$OMP END PARALLEL DO +!$OMP END PARALLEL DO + if(.not. lspin) then - !$OMP PARALLEL DO PRIVATE(i) - do j = 1, kpje - do i = 1, kpie - silpro(i,j) = 0. - prorca(i,j) = 0. - prcaca(i,j) = 0. - produs(i,j) = 0. - enddo +!$OMP PARALLEL DO PRIVATE(i) + do j = 1, kpje + do i = 1, kpie + silpro(i,j) = 0. + prorca(i,j) = 0. + prcaca(i,j) = 0. + if (use_cisonew) then + pror13(i,j) = 0. + pror14(i,j) = 0. + prca13(i,j) = 0. + prca14(i,j) = 0. + end if + produs(i,j) = 0. enddo - !$OMP END PARALLEL DO - - if (use_cisonew) then - !$OMP PARALLEL DO PRIVATE(i) - do j = 1, kpje - do i = 1, kpie - pror13(i,j) = 0. - pror14(i,j) = 0. - prca13(i,j) = 0. - prca14(i,j) = 0. - produs(i,j) = 0. - enddo - enddo - !$OMP END PARALLEL DO - end if + enddo +!$OMP END PARALLEL DO endif end subroutine powach From a65eaffa3bf18861f94058c8cc6f58204ed67af5 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Wed, 2 Aug 2023 11:34:29 +0200 Subject: [PATCH 39/52] implemented issues raised in the PR review --- cesm/mod_cesm.F90 | 3 +- cime_config/buildcpp | 4 +- drivers/nuopc/mod_nuopc_methods.F90 | 30 ++-- hamocc/accfields.F90 | 22 +-- hamocc/aufr_bgc.F90 | 47 +++--- hamocc/aufw_bgc.F90 | 21 +-- hamocc/beleg_parm.F90 | 22 +-- hamocc/beleg_vars.F90 | 131 ++++++++-------- hamocc/carchm.F90 | 12 +- hamocc/cyano.F90 | 2 +- hamocc/dipowa.F90 | 2 +- hamocc/hamocc4bcm.F90 | 2 +- hamocc/hamocc_init.F90 | 2 +- hamocc/inventory_bgc.F90 | 4 +- hamocc/mo_apply_ndep.F90 | 2 +- hamocc/mo_apply_rivin.F90 | 2 +- hamocc/mo_bgcmean.F90 | 2 +- hamocc/mo_biomod.F90 | 2 +- hamocc/mo_carbch.F90 | 2 +- hamocc/mo_control_bgc.F90 | 233 ++++++++++++++++++---------- hamocc/mo_ifdefs.F90 | 72 --------- hamocc/mo_intfcblom.F90 | 3 +- hamocc/mo_param1_bgc.F90 | 3 +- hamocc/mo_sedmnt.F90 | 2 +- hamocc/ncout_hamocc.F90 | 6 +- hamocc/ocprod.F90 | 4 +- hamocc/powach.F90 | 2 +- hamocc/profile_gd.F90 | 6 +- hamocc/sedshi.F90 | 4 +- 29 files changed, 304 insertions(+), 345 deletions(-) delete mode 100644 hamocc/mo_ifdefs.F90 diff --git a/cesm/mod_cesm.F90 b/cesm/mod_cesm.F90 index 83a7d3bb..313e304f 100644 --- a/cesm/mod_cesm.F90 +++ b/cesm/mod_cesm.F90 @@ -35,8 +35,7 @@ module mod_cesm use mod_seaice, only: ficem use mod_checksum, only: csdiag, chksummsk #ifdef HAMOCC - use mo_control_bgc, only: do_bgc_aofluxes - use mo_ifdefs, only: use_bromo + use mo_control_bgc, only: do_bgc_aofluxes, use_bromo #endif implicit none diff --git a/cime_config/buildcpp b/cime_config/buildcpp index cc830111..8ea9436f 100644 --- a/cime_config/buildcpp +++ b/cime_config/buildcpp @@ -87,7 +87,6 @@ def buildcpp(case): hamocc_nattrc = case.get_value("HAMOCC_NATTRC") hamocc_sedbypass = case.get_value("HAMOCC_SEDBYPASS") hamocc_ciso = case.get_value("HAMOCC_CISO") - hamocc_vsls = case.get_value("HAMOCC_VSLS") blom_unit = case.get_value("BLOM_UNIT") pio_typename = case.get_value("PIO_TYPENAME", subgroup="OCN") @@ -144,7 +143,8 @@ def buildcpp(case): expect(hamocc_sedbypass, "HAMOCC C-isotopes currently not supported in the sediment module. Use HAMOCC_SEDBYPASS=TRUE") blom_cppdefs = blom_cppdefs + " -Dcisonew" if ocn_grid in ["tnx1v4"]: - # HAMOCC will always compute bromoform flux and dms flux and send to the mediator + # HAMOCC bromoform scheme currently only supported on the tnx1v4 grid + # (no swa-climatology has been created for other grid configurations)" blom_cppdefs = blom_cppdefs + " -DBROMO" if co2type == "prognostic": blom_cppdefs = blom_cppdefs + " -DPROGCO2" diff --git a/drivers/nuopc/mod_nuopc_methods.F90 b/drivers/nuopc/mod_nuopc_methods.F90 index f30249b9..cc26a385 100644 --- a/drivers/nuopc/mod_nuopc_methods.F90 +++ b/drivers/nuopc/mod_nuopc_methods.F90 @@ -46,8 +46,7 @@ module mod_nuopc_methods #ifdef HAMOCC use mo_carbch, only: ocetra use mo_param1_bgc, only: idms, ibromo - use mo_control_bgc, only: do_bgc_aofluxes - use mo_ifdefs + use mo_control_bgc, only: do_bgc_aofluxes, use_BROMO, use_DIAGCO2, use_PROGCO2 #endif implicit none @@ -144,7 +143,7 @@ subroutine fldlist_add(num, fldlist, stdname, index, ungridded_lbound, ungridded integer , intent(inout) :: num type(fldlist_type), intent(inout) :: fldlist(:) character(len=*) , intent(in) :: stdname - integer , intent(out) :: index + integer , intent(out) :: index integer, optional , intent(in) :: ungridded_lbound, ungridded_ubound ! Local parameters. @@ -156,7 +155,7 @@ subroutine fldlist_add(num, fldlist, stdname, index, ungridded_lbound, ungridded #ifdef HAMOCC ! Set the logical flag do_bgc_aofluxes to false in mo_control_bgc since - ! for nuopc/cmeps the dms and bromo fluxes will be computed in the mediator + ! for nuopc/cmeps the dms and bromo fluxes will be computed in the mediator do_bgc_aofluxes = .false. #endif @@ -222,10 +221,9 @@ subroutine blom_advertise_imports(flds_scalar_name, fldsToOcn_num, fldsToOcn, & call fldlist_add(fldsToOcn_num, fldsToOcn, 'Foxx_evap' , index_Foxx_evap) call fldlist_add(fldsToOcn_num, fldsToOcn, 'Foxx_swnet' , index_Foxx_swnet) #ifdef HAMOCC - call fldlist_add(fldsToOcn_num, fldsToOcn, 'Faox_dms', index_Faox_dms) - if (use_BROMO) then - call fldlist_add(fldsToOcn_num, fldsToOcn, 'Faox_brf', index_Faox_brf) - end if + call fldlist_add(fldsToOcn_num, fldsToOcn, 'Faox_dms', index_Faox_dms) + if (use_BROMO) then + call fldlist_add(fldsToOcn_num, fldsToOcn, 'Faox_brf', index_Faox_brf) end if #endif @@ -810,18 +808,18 @@ subroutine blom_importflds(fldlist_num, fldlist) lasl_da(i,j,l2ci) = fval else n = (j - 1)*ii + i - + utmp = fldlist(index_Sw_ustokes)%dataptr(n) vtmp = fldlist(index_Sw_vstokes)%dataptr(n) util1(i,j) = utmp*cosang(i,j) + vtmp*sinang(i,j) util2(i,j) = - utmp*sinang(i,j) + vtmp*cosang(i,j) - + ! Langmuir enhancement factor []. lamult_da(i,j,l2ci) = fldlist(index_Sw_lamult)%dataptr(n) - + ! Surface layer averaged Langmuir number []. lasl_da(i,j,l2ci) = fldlist(index_Sw_hstokes)%dataptr(n) - + endif enddo enddo @@ -831,7 +829,7 @@ subroutine blom_importflds(fldlist_num, fldlist) call fill_global(mval, fval, halo_pv, util2) call fill_global(mval, fval, halo_ps, lamult_da(1-nbdy,1-nbdy,l2ci)) call fill_global(mval, fval, halo_ps, lasl_da(1-nbdy,1-nbdy,l2ci)) - + call xctilr(util1, 1,1, 1,1, halo_pv) call xctilr(util2, 1,1, 1,1, halo_pv) @@ -864,7 +862,7 @@ subroutine blom_importflds(fldlist_num, fldlist) index_co2 = -1 end if - if (index_co2 > 0) then + if (index_co2 > 0) then !$omp parallel do private(i, n) do j = 1, jjcpl do i = 1, ii @@ -1078,7 +1076,7 @@ subroutine blom_exportflds(fldlist_num, fldlist) !$omp end parallel do if (index_So_dms > 0) then - if (associated(fldlist(index_So_dms)%dataptr)) then + if (associated(fldlist(index_So_dms)%dataptr)) then fldlist(index_So_dms)%dataptr(:) = 0._r8 !$omp parallel do private(l, i, n) do j = 1, jjcpl @@ -1094,7 +1092,7 @@ subroutine blom_exportflds(fldlist_num, fldlist) end if if (index_So_brf > 0) then - if (associated(fldlist(index_So_brf)%dataptr)) then + if (associated(fldlist(index_So_brf)%dataptr)) then fldlist(index_So_brf)%dataptr(:) = 0._r8 !$omp parallel do private(l, i, n) do j = 1, jjcpl diff --git a/hamocc/accfields.F90 b/hamocc/accfields.F90 index fa494c2d..c8e20e5f 100644 --- a/hamocc/accfields.F90 +++ b/hamocc/accfields.F90 @@ -72,21 +72,17 @@ SUBROUTINE ACCFIELDS(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask) 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, & & irdin,irdip,irsi,iralk,iriron,irdoc,irdet - ! AGG use mo_biomod, only: asize3d,eps3d,wnumb,wmass use mo_param1_bgc, only: inos use mo_control_bgc, only: dtb - ! BROMO use mo_param1_bgc, only: iatmbromo,ibromo use mo_biomod, only: int_chbr3_prod,int_chbr3_uv use mo_bgcmean, only: jatmbromo,jbromo,jbromo_prod,jbromo_uv,jbromofx,jsrfbromo - ! CFC use mo_param1_bgc, only: iatmf11,iatmf12,iatmsf6,icfc11,icfc12,isf6 use mo_bgcmean, only: jcfc11,jcfc11fx,jcfc12,jcfc12fx,jsf6,jsf6fx - ! cisonew use mo_carbch, only: co213fxd,co213fxu,co214fxd,co214fxu use mo_biomod, only: c14fac,re1312,re14to @@ -94,7 +90,6 @@ SUBROUTINE ACCFIELDS(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask) use mo_param1_bgc, only: iatmc13,iatmc14,icalc13,idet13,idoc13,iphy13,isco213,isco214,izoo13,safediv use mo_bgcmean, only: jatmc13,jatmc14,jbigd14c,jcalc13,jco213fxd,jco213fxu,jco214fxd,jco214fxu,jd13c,jd14c,jdic13,jdic14,& & jdoc13,jgrazer13,jphyto13,jpoc13 - ! natDIC use mo_param1_bgc, only: iatmnco2,inatalkali,inatcalc,inatsco212 use mo_carbch, only: natco3,nathi,natomegaa,natomegac,natpco2d @@ -105,18 +100,17 @@ SUBROUTINE ACCFIELDS(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask) use mo_sedmnt, only: powtra,sedlay,burial use mo_bgcmean, only: jbursssc12,jburssso12,jburssssil,jburssster,jpowaal,jpowaic,jpowaox,jpowaph,jpowaph,jpowasi,jpown2, & & jpowno3,jsssc12,jssso12,jssssil,jssster,accbur,accsdm - ! BOXATM - use mo_bgcmean, only: jatmco2,jatmn2,jatmo2 + use mo_bgcmean, only: jatmco2,jatmn2,jatmo2 + use mo_control_bgc, only: use_BROMO, use_AGG, use_WLIN, use_natDIC, use_CFC, use_sedbypass, use_cisonew, use_BOXATM - use mo_ifdefs, only : use_BROMO, use_AGG, use_WLIN, use_natDIC, use_CFC, use_sedbypass, & - & use_cisonew, use_BOXATM implicit none - INTEGER :: kpie,kpje,kpke - REAL :: pdlxp(kpie,kpje) - REAL :: pdlyp(kpie,kpje) - REAL :: pddpo(kpie,kpje,kpke) - REAL :: omask(kpie,kpje) + + INTEGER , intent(in) :: kpie,kpje,kpke + REAL , intent(in) :: pdlxp(kpie,kpje) + REAL , intent(in) :: pdlyp(kpie,kpje) + REAL , intent(in) :: pddpo(kpie,kpje,kpke) + REAL , intent(in) :: omask(kpie,kpje) ! Local variables INTEGER :: i,j,k,l diff --git a/hamocc/aufr_bgc.F90 b/hamocc/aufr_bgc.F90 index 4b0b6c93..73b5cced 100644 --- a/hamocc/aufr_bgc.F90 +++ b/hamocc/aufr_bgc.F90 @@ -114,52 +114,45 @@ SUBROUTINE AUFR_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & use mod_dia, only: iotype ! AGG use mo_param1_bgc, only: iadust,inos - ! BOXATM use mo_param1_bgc, only: iatmco2,iatmn2,iatmo2 use mo_carbch, only: atm - ! BROMO use mo_param1_bgc, only: ibromo - ! CFC use mo_param1_bgc, only: icfc11,icfc12,isf6 - ! cisonew use mo_carbch, only: ocetra use mo_biomod, only: bifr13,bifr14,c14fac,re1312,re14to,prei13,prei14 use mo_param1_bgc, only: icalc13,icalc14,idet13,idet14,idoc13,idoc14,iphy13,iphy14,isco213,isco214,izoo13,izoo14,safediv, & & issso13,issso14,isssc13,isssc14,ipowc13,ipowc14,iatmc13,iatmc14 use mo_bgcmean, only: jatmo2,jatmn2 - ! natDIC use mo_param1_bgc, only: inatalkali,inatcalc,inatsco212,iatmnco2 use mo_carbch, only: nathi - ! NOT sedbypass use mo_param1_bgc, only: ipowaal,ipowaic,ipowaox,ipowaph,ipowasi,ipown2,ipowno3,isssc12,issso12,issssil,issster,ks + use mo_control_bgc, only: use_cisonew, use_AGG, use_BOXATM, use_BROMO, use_CFC, use_natDIC, use_sedbypass - use mo_ifdefs , only : use_CFC, use_natDIC, use_cisonew, use_BROMO, use_BOXATM, use_AGG, use_sedbypass implicit none - INTEGER :: kpie,kpje,kpke,ntr,ntrbgc,itrbgc - REAL :: trc(1-nbdy:kpie+nbdy,1-nbdy:kpje+nbdy,2*kpke,ntr) - REAL :: omask(kpie,kpje) - INTEGER :: kplyear,kplmon,kplday - character(len=*) :: rstfnm + INTEGER, intent(in) :: kpie,kpje,kpke,ntr,ntrbgc,itrbgc + REAL, intent(inout) :: trc(1-nbdy:kpie+nbdy,1-nbdy:kpje+nbdy,2*kpke,ntr) + REAL, intent(in) :: omask(kpie,kpje) + INTEGER, intent(in) :: kplyear,kplmon,kplday + character(len=*), intent(in) :: rstfnm ! Local variables - REAL :: locetra(kpie,kpje,2*kpke,-1:nocetra) ! local array for reading + REAL, allocatable :: locetra(:,:,:,:) ! local array for reading + INTEGER :: errstat INTEGER :: restyear ! year of restart file INTEGER :: restmonth ! month of restart file INTEGER :: restday ! day of restart file INTEGER :: restdtoce ! time step number from bgc ocean file INTEGER :: idate(5),i,j,k logical :: lread_cfc,lread_nat,lread_iso,lread_atm,lread_bro - ! cisonew - REAL :: rco213,rco214,alpha14,beta13,beta14,d13C_atm,d14cat - - INTEGER ncid,ncstat,ncvarid + REAL :: rco213,rco214,alpha14,beta13,beta14,d13C_atm,d14cat ! cisonew + INTEGER :: ncid,ncstat,ncvarid #ifdef PNETCDF # include @@ -174,7 +167,11 @@ SUBROUTINE AUFR_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & character(len=9) :: stripestr2 integer :: ierr,testio INTEGER :: leninrstfn - +! +! Allocate and initialize local array for reading (locetra) +! + allocate(locetra(kpie,kpje,2*kpke,nocetra),stat=errstat) + if(errstat.ne.0) stop 'not enough memory for locetra allocation' locetra(:,:,:,:) = 0.0 ! ! Open netCDF data file @@ -590,12 +587,12 @@ SUBROUTINE AUFR_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & IF(omask(i,j) .GT. 0.5) THEN rco213=ocetra(i,j,kbo(i,j),isco213)/(ocetra(i,j,kbo(i,j),isco212)+safediv) rco214=ocetra(i,j,kbo(i,j),isco214)/(ocetra(i,j,kbo(i,j),isco212)+safediv) - powtra2(i,j,k,ipowc13)=powtra2(i,j,k,ipowc13)*rco213*bifr13 - powtra2(i,j,k,ipowc14)=powtra2(i,j,k,ipowc14)*rco214*bifr14 - sedlay2(i,j,k,issso13)=sedlay2(i,j,k,issso13)*rco213*bifr13 - sedlay2(i,j,k,issso14)=sedlay2(i,j,k,issso14)*rco214*bifr14 - sedlay2(i,j,k,isssc13)=sedlay2(i,j,k,isssc13)*rco213 - sedlay2(i,j,k,isssc14)=sedlay2(i,j,k,isssc14)*rco214 + powtra2(i,j,k,ipowc13)=powtra2(i,j,k,ipowaic)*rco213*bifr13 + powtra2(i,j,k,ipowc14)=powtra2(i,j,k,ipowaic)*rco214*bifr14 + sedlay2(i,j,k,issso13)=sedlay2(i,j,k,issso12)*rco213*bifr13 + sedlay2(i,j,k,issso14)=sedlay2(i,j,k,issso12)*rco214*bifr14 + sedlay2(i,j,k,isssc13)=sedlay2(i,j,k,isssc12)*rco213 + sedlay2(i,j,k,isssc14)=sedlay2(i,j,k,isssc12)*rco214 ENDIF ENDDO ENDDO @@ -610,7 +607,7 @@ SUBROUTINE AUFR_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & !-------------------------------------------------------------------- ! trc(1:kpie,1:kpje,:,itrbgc:itrbgc+ntrbgc-1)=locetra(:,:,:,:) - + deallocate(locetra) RETURN END SUBROUTINE AUFR_BGC diff --git a/hamocc/aufw_bgc.F90 b/hamocc/aufw_bgc.F90 index 3c6796e3..a494def4 100644 --- a/hamocc/aufw_bgc.F90 +++ b/hamocc/aufw_bgc.F90 @@ -108,30 +108,23 @@ SUBROUTINE AUFW_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & use mod_dia, only: iotype ! AGG use mo_param1_bgc, only: iadust, inos - ! BOXATM use mo_param1_bgc, only: iatmco2,iatmn2,iatmo2 - ! BROMO use mo_param1_bgc, only: ibromo - ! CFC use mo_param1_bgc, only: icfc11,icfc12,isf6 - ! cisonew use mo_param1_bgc, only: icalc13,icalc14,idet13,idet14,idoc13,idoc14,iphy13,iphy14,isco213,isco214,izoo13,izoo14, & & issso13,issso14,isssc13,isssc14,ipowc13,ipowc14,iatmc13,iatmc14, & & iatmnco2,issso13,issso14,isssc13,isssc14,ipowc13,ipowc14,iatmc13,iatmc14 use mo_control_bgc, only: rmasks - ! natDIC use mo_param1_bgc, only: inatalkali,inatcalc,inatsco212 use mo_carbch, only: nathi - ! NOT sedbypass use mo_param1_bgc, only: ipowaal,ipowaic,ipowaox,ipowaph,ipowasi,ipown2,ipowno3,isssc12,issso12,issssil,issster - - use mo_ifdefs + use mo_control_bgc, only: use_cisonew, use_AGG, use_BOXATM, use_BROMO, use_CFC, use_natDIC, use_sedbypass implicit none @@ -143,7 +136,8 @@ SUBROUTINE AUFW_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & ! Local variables INTEGER :: i,j - REAL :: locetra(kpie,kpje,2*kpke,-1:nocetra) + REAL, allocatable :: locetra(:,:,:,:) ! local array for writing + INTEGER :: errstat ! Variables for netcdf INTEGER :: ncid,ncvarid,ncstat,ncoldmod,ncdimst(4) @@ -170,7 +164,12 @@ SUBROUTINE AUFW_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & !-------------------------------------------------------------------- ! testio=0 - locetra(:,:,:,1:)=trc(1:kpie,1:kpje,:,itrbgc:itrbgc+ntrbgc-1) +! +! Allocate and initialize local array for writing (locetra) +! + allocate(locetra(kpie,kpje,2*kpke,nocetra),stat=errstat) + if(errstat.ne.0) stop('not enough memory for locetra allocation') + locetra(:,:,:,1:) = trc(1:kpie,1:kpje,:,itrbgc:itrbgc+ntrbgc-1) idate(1) = kplyear idate(2) = kplmon @@ -944,5 +943,7 @@ SUBROUTINE AUFW_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & WRITE(io_stdo_bgc,*) '***************' ENDIF + deallocate(locetra) + RETURN END SUBROUTINE AUFW_BGC diff --git a/hamocc/beleg_parm.F90 b/hamocc/beleg_parm.F90 index 828ed9a0..2ac8b9bd 100644 --- a/hamocc/beleg_parm.F90 +++ b/hamocc/beleg_parm.F90 @@ -50,26 +50,20 @@ SUBROUTINE BELEG_PARM(kpie,kpje) use mo_control_bgc, only: dtb,io_stdo_bgc use mo_param1_bgc, only: iatmco2,iatmnco2,iatmo2,iatmn2,iatmc13,iatmc14,iatmbromo use mod_xc, only: mnproc - ! AGG use mo_biomod, only: alar1,alar2,alar3,alow1,alow2,alow3,calmax,cellmass,cellsink,dustd1,dustd2,dustd3,dustsink, & & fractdim,fse,fsh,nmldmin,plower,pupper,safe,sinkexp,stick,tmfac,tsfac,vsmall,zdis - ! WLIN use mo_biomod, only: wmin,wmax,wlin - ! BROMO use mo_biomod, only: rbro use mo_carbch, only: atm_bromo,fbro1,fbro2 - ! cisonew use mo_biomod, only: bifr13,bifr14,c14fac,prei13,prei14,re1312,re14to use mo_carbch, only: atm_c13, atm_c14,c14_t_half,c14dec - ! natDI use mo_carbch, only: atm_co2_nat - - use mo_ifdefs + use mo_control_bgc, only: use_natDIC, use_cisonew, use_BROMO, use_AGG, use_WLIN implicit none @@ -145,10 +139,10 @@ SUBROUTINE BELEG_PARM(kpie,kpje) gammaz=0.06*dtb !1/d -excretion rate ecan=0.95 ! fraction of mortality as PO_4 pi_alpha=0.02*0.4 ! initial slope of production vs irradiance curve (alpha) (0.002 for 10 steps per day) - if (use_agg) then + if (use_AGG) then zinges = 0.5 !dimensionless fraction -assimilation efficiency epsher = 0.9 !dimensionless fraction -fraction of grazing egested - else if (use_wlin) then + else if (use_WLIN) then zinges = 0.7 !dimensionless fraction -assimilation efficiency epsher = 0.85 !dimensionless fraction -fraction of grazing egested else @@ -173,7 +167,7 @@ SUBROUTINE BELEG_PARM(kpie,kpje) wcal = 30.*dtb !m/d wopal = 30.*dtb !m/d iris : 60 -! for use_wlin and use_agg +! for use_WLIN and use_AGG wmin = 1.*dtb !m/d minimum sinking speed wmax = 60.*dtb !m/d maximum sinking speed wlin = 60./2400.*dtb !m/d/m constant describing incr. with depth, r/a=1.0 @@ -228,11 +222,11 @@ SUBROUTINE BELEG_PARM(kpie,kpje) fbro1=1.0 fbro2=1.0 - if (use_agg) then + if (use_AGG) then rcalc = 14. ! calcium carbonate to organic phosphorous production ratio ropal = 10.5 ! opal to organic phosphorous production ratio calmax= 0.20 - else if (use_wlin) then + else if (use_WLIN) then rcalc = 33. ! calcium carbonate to organic phosphorous production ratio ropal = 45. ! opal to organic phosphorous production ratio else @@ -384,7 +378,7 @@ SUBROUTINE BELEG_PARM(kpie,kpje) &'* dmspar(5) = ',dmspar(5) ENDIF - if (.not. use_agg) then + if (.not. use_AGG) then dustd1 = 0.0001 !cm = 1 um, boundary between clay and silt dustd2=dustd1*dustd1 dustsink = (9.81 * 86400. / 18. & ! g * sec per day / 18. @@ -409,7 +403,7 @@ SUBROUTINE BELEG_PARM(kpie,kpje) &'****************************************************************' ENDIF - if (use_agg) then + if (use_AGG) then ! parameters needed for the aggregation module SinkExp = 0.62 diff --git a/hamocc/beleg_vars.F90 b/hamocc/beleg_vars.F90 index 07d19d3d..5420a294 100644 --- a/hamocc/beleg_vars.F90 +++ b/hamocc/beleg_vars.F90 @@ -58,35 +58,27 @@ SUBROUTINE BELEG_VARS(kpaufr,kpie,kpje,kpke,kbnd,pddpo,prho,omask, & use mo_param1_bgc, only: ialkali,ian2o,iano3,icalc,idet,idicsat,idms,idoc,ifdust,igasnit,iiron,iopal,ioxygen,iphosph,iphy, & & iprefalk,iprefdic,iprefo2,iprefpo4,isco212,isilica,izoo use mo_vgrid, only: kmle,kbo - ! AGG use mo_biomod, only: cellmass,fractdim use mo_param1_bgc, only: iadust,inos - ! BROMO use mo_param1_bgc, only: ibromo - ! CFC use mo_param1_bgc, only: icfc11,icfc12,isf6 - ! cisonew use mo_biomod, only: bifr13,bifr14,c14fac,re1312,re14to use mo_param1_bgc, only: icalc13,icalc14,idet13,idet14,idoc13,idoc14,iphy13,iphy14,isco213,isco214,izoo13,izoo14,safediv - ! natDIC use mo_param1_bgc, only: inatcalc use mo_carbch, only: nathi,natco3 - ! sedbypass use mo_param1_bgc, only: ipowaal,ipowaic,ipowaox,ipowaph,ipowasi,ipown2,ipowno3,isssc12,issso12,issssil,issster,ks,nsedtra, & & ipowc13,ipowc13,issso13,issso13,isssc13,ipowc14,isssc14,issso14 use mo_sedmnt, only: sedhpl,burial,powtra,sedlay - ! FB_BGC_OCE use mo_biomod, only: abs_oce - - use mo_ifdefs + use mo_control_bgc, only: use_FB_BGC_OCE, use_cisonew, use_AGG, use_CFC, use_natDIC, use_BROMO, use_sedbypass implicit none @@ -106,14 +98,13 @@ SUBROUTINE BELEG_VARS(kpaufr,kpie,kpje,kpke,kbnd,pddpo,prho,omask, & if (use_FB_BGC_OCE) then DO k=1,kpke - DO j=1,kpje - DO i=1,kpie - abs_oce(i,j,k)=1. - ENDDO - ENDDO + DO j=1,kpje + DO i=1,kpie + abs_oce(i,j,k)=1. + ENDDO + ENDDO ENDDO end if - ! ! Initialisation of ocean tracers and sediment ! @@ -235,65 +226,65 @@ SUBROUTINE BELEG_VARS(kpaufr,kpie,kpje,kpke,kbnd,pddpo,prho,omask, & ! Initial values for sediment if (.not. use_sedbypass) then DO k=1,ks - DO j=1,kpje - DO i=1,kpie - IF(omask(i,j) .GT. 0.5) THEN - powtra(i,j,k,ipowaic)=ocetra(i,j,kbo(i,j),isco212) - powtra(i,j,k,ipowaal)=ocetra(i,j,kbo(i,j),ialkali) - powtra(i,j,k,ipowaph)=ocetra(i,j,kbo(i,j),iphosph) - powtra(i,j,k,ipowaox)=ocetra(i,j,kbo(i,j),ioxygen) - powtra(i,j,k,ipown2) =0. - powtra(i,j,k,ipowno3)=ocetra(i,j,kbo(i,j),iano3) - powtra(i,j,k,ipowasi)=ocetra(i,j,kbo(i,j),isilica) - sedlay(i,j,k,issso12)=1.e-8 - sedlay(i,j,k,isssc12)=1.e-8 - sedlay(i,j,k,issster)=30. - sedlay(i,j,k,issssil)=1.e-8 - sedhpl(i,j,k) =hi(i,j,kbo(i,j)) - if (use_cisonew) then - rco213=ocetra(i,j,kbo(i,j),isco213)/(ocetra(i,j,kbo(i,j),isco212)+safediv) - rco214=ocetra(i,j,kbo(i,j),isco214)/(ocetra(i,j,kbo(i,j),isco212)+safediv) - powtra(i,j,k,ipowc13)=powtra(i,j,k,ipowaic)*rco213*bifr13 - powtra(i,j,k,ipowc14)=powtra(i,j,k,ipowaic)*rco214*bifr14 - sedlay(i,j,k,issso13)=sedlay(i,j,k,issso12)*rco213*bifr13 - sedlay(i,j,k,issso14)=sedlay(i,j,k,issso12)*rco214*bifr14 - sedlay(i,j,k,isssc13)=sedlay(i,j,k,isssc12)*rco213 - sedlay(i,j,k,isssc14)=sedlay(i,j,k,isssc12)*rco214 - end if - ELSE - powtra(i,j,k,ipowno3)=rmasks - powtra(i,j,k,ipown2) =rmasks - powtra(i,j,k,ipowaic)=rmasks - powtra(i,j,k,ipowaal)=rmasks - powtra(i,j,k,ipowaph)=rmasks - powtra(i,j,k,ipowaox)=rmasks - powtra(i,j,k,ipowasi)=rmasks - sedlay(i,j,k,issso12)=rmasks - sedlay(i,j,k,isssc12)=rmasks - sedlay(i,j,k,issssil)=rmasks - sedlay(i,j,k,issster)=rmasks - sedlay(i,j,k,issssil)=rmasks - sedhpl(i,j,k) =rmasks - if (use_cisonew) then - powtra(i,j,k,ipowc13)=rmasks - powtra(i,j,k,ipowc14)=rmasks - sedlay(i,j,k,issso13)=rmasks - sedlay(i,j,k,issso14)=rmasks - sedlay(i,j,k,isssc13)=rmasks - sedlay(i,j,k,isssc14)=rmasks - end if - ENDIF - ENDDO - ENDDO + DO j=1,kpje + DO i=1,kpie + IF(omask(i,j) .GT. 0.5) THEN + powtra(i,j,k,ipowaic)=ocetra(i,j,kbo(i,j),isco212) + powtra(i,j,k,ipowaal)=ocetra(i,j,kbo(i,j),ialkali) + powtra(i,j,k,ipowaph)=ocetra(i,j,kbo(i,j),iphosph) + powtra(i,j,k,ipowaox)=ocetra(i,j,kbo(i,j),ioxygen) + powtra(i,j,k,ipown2) =0. + powtra(i,j,k,ipowno3)=ocetra(i,j,kbo(i,j),iano3) + powtra(i,j,k,ipowasi)=ocetra(i,j,kbo(i,j),isilica) + sedlay(i,j,k,issso12)=1.e-8 + sedlay(i,j,k,isssc12)=1.e-8 + sedlay(i,j,k,issster)=30. + sedlay(i,j,k,issssil)=1.e-8 + sedhpl(i,j,k) =hi(i,j,kbo(i,j)) + if (use_cisonew) then + rco213=ocetra(i,j,kbo(i,j),isco213)/(ocetra(i,j,kbo(i,j),isco212)+safediv) + rco214=ocetra(i,j,kbo(i,j),isco214)/(ocetra(i,j,kbo(i,j),isco212)+safediv) + powtra(i,j,k,ipowc13)=powtra(i,j,k,ipowaic)*rco213*bifr13 + powtra(i,j,k,ipowc14)=powtra(i,j,k,ipowaic)*rco214*bifr14 + sedlay(i,j,k,issso13)=sedlay(i,j,k,issso12)*rco213*bifr13 + sedlay(i,j,k,issso14)=sedlay(i,j,k,issso12)*rco214*bifr14 + sedlay(i,j,k,isssc13)=sedlay(i,j,k,isssc12)*rco213 + sedlay(i,j,k,isssc14)=sedlay(i,j,k,isssc12)*rco214 + end if + ELSE + powtra(i,j,k,ipowno3)=rmasks + powtra(i,j,k,ipown2) =rmasks + powtra(i,j,k,ipowaic)=rmasks + powtra(i,j,k,ipowaal)=rmasks + powtra(i,j,k,ipowaph)=rmasks + powtra(i,j,k,ipowaox)=rmasks + powtra(i,j,k,ipowasi)=rmasks + sedlay(i,j,k,issso12)=rmasks + sedlay(i,j,k,isssc12)=rmasks + sedlay(i,j,k,issssil)=rmasks + sedlay(i,j,k,issster)=rmasks + sedlay(i,j,k,issssil)=rmasks + sedhpl(i,j,k) =rmasks + if (use_cisonew) then + powtra(i,j,k,ipowc13)=rmasks + powtra(i,j,k,ipowc14)=rmasks + sedlay(i,j,k,issso13)=rmasks + sedlay(i,j,k,issso14)=rmasks + sedlay(i,j,k,isssc13)=rmasks + sedlay(i,j,k,isssc14)=rmasks + end if + ENDIF + ENDDO + ENDDO ENDDO ! last and final sediment layer DO l=1,nsedtra - DO j=1,kpje - DO i=1,kpie - burial(i,j,l)=0. - ENDDO - ENDDO + DO j=1,kpje + DO i=1,kpie + burial(i,j,l)=0. + ENDDO + ENDDO ENDDO end if diff --git a/hamocc/carchm.F90 b/hamocc/carchm.F90 index f73c7436..2a97a9fa 100644 --- a/hamocc/carchm.F90 +++ b/hamocc/carchm.F90 @@ -110,20 +110,16 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & ! CFC use mo_carbch, only: atm_cfc11_nh,atm_cfc11_sh,atm_cfc12_nh,atm_cfc12_sh,atm_sf6_nh,atm_sf6_sh use mo_param1_bgc, only: iatmf11,iatmf12,iatmsf6,icfc11,icfc12,isf6 - ! cisonew use mo_carbch, only: co213fxd,co213fxu,co214fxd,co214fxu,c14dec use mo_param1_bgc, only: iatmc13,iatmc14,icalc13,icalc14,idet14,idoc14,iphy14,isco213,isco214,izoo14,safediv - ! natDIC use mo_carbch, only: atm_co2_nat,nathi,natco3,natpco2d,natomegaa,natomegac use mo_param1_bgc, only: iatmnco2,inatalkali,inatcalc,inatsco212 - ! sedbypass use mo_sedmnt, only: sedlay,powtra use mo_param1_bgc, only: issso14,isssc14,ipowc14 - - use mo_ifdefs + use mo_control_bgc, only: use_cisonew,use_natDIC,use_CFC,use_BROMO,use_cisonew,use_sedbypass implicit none @@ -172,7 +168,7 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & REAL :: flux14d,flux14u,flux13d,flux13u REAL :: atco213,atco214,pco213,pco214 REAL :: frac_k,frac_aqg,frac_dicg - ! bromo + ! BROMO REAL :: flx_bromo,sch_bromo,kw_bromo,a_bromo,atbrf,Kb1,lsub ! set variables for diagnostic output to zero @@ -495,10 +491,6 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & flx_bromo = kw_bromo*dtbgc* & (atbrf/a_bromo*1e-12*ppao(i,j)*1e-5/(tk*0.083) - ocetra(i,j,1,ibromo)) else - ! Note that the external computation of fluxes is -flx_bromo/dtbgc - ! using above computation of flx_bromo - ! So need to divide by 252.7 and multiply by -dtbgc and in order to use this - ! for the tendency in the tracer update flx_bromo = dtbgc*pflxbromo(i,j) end if ocetra(i,j,1,ibromo) = ocetra(i,j,1,ibromo) + flx_bromo/pddpo(i,j,1) diff --git a/hamocc/cyano.F90 b/hamocc/cyano.F90 index 765ddc75..d80f8e85 100644 --- a/hamocc/cyano.F90 +++ b/hamocc/cyano.F90 @@ -67,7 +67,7 @@ SUBROUTINE CYANO(kpie,kpje,kpke,kbnd,pddpo,omask,ptho) use mo_vgrid, only: kmle ! natDIC use mo_param1_bgc, only: inatalkali - use mo_ifdefs + use mo_control_bgc, only : use_natDIC implicit none diff --git a/hamocc/dipowa.F90 b/hamocc/dipowa.F90 index d38e7ad6..28cb0345 100644 --- a/hamocc/dipowa.F90 +++ b/hamocc/dipowa.F90 @@ -63,7 +63,7 @@ subroutine dipowa(kpie,kpje,kpke,omask,lspin) use mo_param1_bgc, only: ipowc13,ipowc14,isco213,isco214 ! natDIC use mo_param1_bgc, only: ialkali,inatalkali,inatsco212,isco212 - use mo_ifdefs + use mo_control_bgc, only: use_natDIC implicit none diff --git a/hamocc/hamocc4bcm.F90 b/hamocc/hamocc4bcm.F90 index 74bbb2b6..16d8be96 100644 --- a/hamocc/hamocc4bcm.F90 +++ b/hamocc/hamocc4bcm.F90 @@ -99,7 +99,7 @@ SUBROUTINE HAMOCC4BCM(kpie,kpje,kpke,kbnd,kplyear,kplmon,kplday,kldtday,& use mo_param1_bgc, only: iatmbromo !CFC use mo_carbch, only: atm_cfc11_nh,atm_cfc11_sh,atm_cfc12_nh,atm_cfc12_sh,atm_sf6_nh,atm_sf6_sh - use mo_ifdefs + use mo_control_bgc, only: use_PROGCO2,use_DIAGCO2,use_BROMO, use_CFC, use_PBGC_CK_TIMESTEP,use_BOXATM, use_sedbypass implicit none diff --git a/hamocc/hamocc_init.F90 b/hamocc/hamocc_init.F90 index c3e05cf5..ee783ce6 100644 --- a/hamocc/hamocc_init.F90 +++ b/hamocc/hamocc_init.F90 @@ -68,7 +68,7 @@ subroutine hamocc_init(read_rest,rstfnm_hamocc) & blom2hamocc ! BOXATM use mo_intfcblom, only: atm2 - use mo_ifdefs + use mo_control_bgc, only: use_BROMO,use_sedbypass,use_BOXATM implicit none diff --git a/hamocc/inventory_bgc.F90 b/hamocc/inventory_bgc.F90 index 6cf43e76..50c03d71 100644 --- a/hamocc/inventory_bgc.F90 +++ b/hamocc/inventory_bgc.F90 @@ -66,7 +66,7 @@ SUBROUTINE INVENTORY_BGC(kpie,kpje,kpke,dlxp,dlyp,ddpo,omask,iogrp) ! NOT sedbypass use mo_param1_bgc, only: ks use mo_sedmnt, only: porwat,seddw,sedlay,burial,sedhpl,powtra,porsol - use mo_ifdefs + use mo_control_bgc, only: use_PBGC_CK_TIMESTEP,use_BOXATM,use_sedbypass,use_cisonew,use_AGG,use_CFC,use_natDIC,use_BROMO implicit none @@ -697,7 +697,7 @@ subroutine write_netcdf(iogrp) & iphy13,iphy14,isco213,isco214,izoo13,izoo14 ! natDIC use mo_param1_bgc, only: inatalkali,inatcalc,inatsco212 - use mo_ifdefs + use mo_control_bgc, only: use_PBGC_CK_TIMESTEP,use_BOXATM,use_sedbypass,use_cisonew,use_AGG,use_CFC,use_natDIC,use_BROMO implicit none diff --git a/hamocc/mo_apply_ndep.F90 b/hamocc/mo_apply_ndep.F90 index 7e490f76..6a2e8f0c 100644 --- a/hamocc/mo_apply_ndep.F90 +++ b/hamocc/mo_apply_ndep.F90 @@ -88,7 +88,7 @@ subroutine apply_ndep(kpie,kpje,kpke,pddpo,omask,ndep) use mo_control_bgc, only: io_stdo_bgc,dtb,do_ndep use mo_carbch, only: ocetra,ndepflx use mo_param1_bgc, only: iano3,ialkali,inatalkali - use mo_ifdefs + use mo_control_bgc, only: use_natDIC implicit none diff --git a/hamocc/mo_apply_rivin.F90 b/hamocc/mo_apply_rivin.F90 index d3627014..9d6bc6bb 100644 --- a/hamocc/mo_apply_rivin.F90 +++ b/hamocc/mo_apply_rivin.F90 @@ -92,7 +92,7 @@ subroutine apply_rivin(kpie,kpje,kpke,pddpo,omask,rivin) ialkali,inatsco212,inatalkali use mo_vgrid, only: kmle use mo_carbch, only: ocetra,rivinflx - use mo_ifdefs + use mo_control_bgc, only: use_natDIC implicit none diff --git a/hamocc/mo_bgcmean.F90 b/hamocc/mo_bgcmean.F90 index 761f9d4c..acb68e26 100644 --- a/hamocc/mo_bgcmean.F90 +++ b/hamocc/mo_bgcmean.F90 @@ -58,7 +58,7 @@ MODULE mo_bgcmean use mod_nctools, only: ncpack,nccomp,nccopa,ncwrtr use netcdf, only: nf90_fill_double use mo_param1_bgc, only: ks - use mo_ifdefs + use mo_control_bgc, only: use_sedbypass,use_cisonew,use_CFC,use_natDIC,use_BROMO,use_BOXATM,use_AGG IMPLICIT NONE diff --git a/hamocc/mo_biomod.F90 b/hamocc/mo_biomod.F90 index f290f101..f498033f 100644 --- a/hamocc/mo_biomod.F90 +++ b/hamocc/mo_biomod.F90 @@ -127,7 +127,7 @@ SUBROUTINE ALLOC_MEM_BIOMOD(kpie,kpje,kpke) !****************************************************************************** use mod_xc, only: mnproc use mo_control_bgc, only: io_stdo_bgc - use mo_ifdefs + use mo_control_bgc, only: use_FB_BGC_OCE,use_AGG,use_BROMO INTEGER, intent(in) :: kpie,kpje,kpke INTEGER :: errstat diff --git a/hamocc/mo_carbch.F90 b/hamocc/mo_carbch.F90 index e079d404..04234e8a 100644 --- a/hamocc/mo_carbch.F90 +++ b/hamocc/mo_carbch.F90 @@ -110,7 +110,7 @@ SUBROUTINE ALLOC_MEM_CARBCH(kpie,kpje,kpke) use mod_xc, only: mnproc use mo_control_bgc, only: io_stdo_bgc use mo_param1_bgc, only: nocetra,npowtra,natm,nriv - use mo_ifdefs + use mo_control_bgc, only: use_natDIC,use_cisonew INTEGER, intent(in) :: kpie,kpje,kpke INTEGER :: errstat diff --git a/hamocc/mo_control_bgc.F90 b/hamocc/mo_control_bgc.F90 index f15b6b45..0fdd0058 100644 --- a/hamocc/mo_control_bgc.F90 +++ b/hamocc/mo_control_bgc.F90 @@ -16,88 +16,153 @@ ! 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_control_bgc + !*********************************************************************** + ! + !**** *MODULE mo_control_bgc* - control variables for bgc modules. + ! + ! S.Legutke, *MPI-MaD, HH* 28.02.02 + ! + ! Modified + ! -------- + ! J.Schwinger, *Uni Research, Bergen* 2018-04-12 + ! - removed unused variables + ! + ! Purpose + ! ------- + ! - declaration + ! + ! + !********************************************************************** + implicit none - MODULE mo_control_bgc -!*********************************************************************** -! -!**** *MODULE mo_control_bgc* - control variables for bgc modules. -! -! S.Legutke, *MPI-MaD, HH* 28.02.02 -! -! Modified -! -------- -! J.Schwinger, *Uni Research, Bergen* 2018-04-12 -! - removed unused variables -! -! Purpose -! ------- -! - declaration -! -! -!********************************************************************** - implicit none - -! Logical unit number for I/O. - INTEGER, save :: io_stdo_bgc ! standard out. - -! File containing namelists - CHARACTER(LEN=:), ALLOCATABLE, PROTECTED :: bgc_namelist - -! Control variables - REAL, save :: dtbgc ! time step length [sec]. - REAL, save :: dtb ! time step length [days]. - INTEGER, save :: ndtdaybgc ! time steps per day. - - INTEGER, save :: ldtbgc ! time step number from bgc restart file - INTEGER, save :: ldtrunbgc ! actual time steps of run. - - INTEGER, save :: sedspin_yr_s = -1 - INTEGER, save :: sedspin_yr_e = -1 - INTEGER, save :: sedspin_ncyc = -1 - - REAL, save :: rmasks = 0.0 ! value at wet cells in sediment. - REAL, save :: rmasko = 99999.00 ! value at wet cells in ocean. - -! Logical switches set via namelist - LOGICAL, save :: l_3Dvarsedpor = .false. ! apply lon-lat-depth variable sediment porosity via input file - LOGICAL, save :: do_ndep =.true. ! apply n-deposition - LOGICAL, save :: do_rivinpt =.true. ! apply riverine input - LOGICAL, save :: do_sedspinup=.false. ! apply sediment spin-up - LOGICAL, save :: do_oalk =.false. ! apply ocean alkalinization - logical, save :: with_dmsph =.false. ! apply DMS with pH dependence - - logical, save :: do_bgc_aofluxes = .true. ! If true, atm/ocn bgc fluxes are computed within HAMOCC - - contains - - subroutine get_bgc_namelist - !------------------------------------------------------------------------- - ! Get filename for namelist file - !------------------------------------------------------------------------- - use mod_config, only: inst_suffix - use mod_xc, only: xchalt - - implicit none - - logical :: exists - - if (.not. allocated(bgc_namelist)) then - inquire (file='ocn_in'//trim(inst_suffix), exist=exists) - if (exists) then - allocate(character(len=len('ocn_in'//trim(inst_suffix))) :: & - bgc_namelist) - bgc_namelist = 'ocn_in'//trim(inst_suffix) - else - inquire (file='limits', exist=exists) - if (exists) then - allocate(character(len=len('limits')) :: bgc_namelist) - bgc_namelist = 'limits' - else - call xchalt('cannot find limits file') - stop 'cannot find limits file' - endif - endif - endif - end subroutine get_bgc_namelist - - END MODULE mo_control_bgc + ! Logical unit number for I/O. + INTEGER :: io_stdo_bgc ! standard out. + + ! File containing namelists + CHARACTER(LEN=:), ALLOCATABLE, PROTECTED :: bgc_namelist + + ! Control variables + REAL :: dtbgc ! time step length [sec]. + REAL :: dtb ! time step length [days]. + INTEGER :: ndtdaybgc ! time steps per day. + + INTEGER :: ldtbgc ! time step number from bgc restart file + INTEGER :: ldtrunbgc ! actual time steps of run. + + INTEGER :: sedspin_yr_s = -1 + INTEGER :: sedspin_yr_e = -1 + INTEGER :: sedspin_ncyc = -1 + + REAL :: rmasks = 0.0 ! value at wet cells in sediment. + REAL :: rmasko = 99999.00 ! value at wet cells in ocean. + + ! Logical switches set via namelist + LOGICAL :: l_3Dvarsedpor = .false. ! apply lon-lat-depth variable sediment porosity via input file + LOGICAL :: do_ndep =.true. ! apply n-deposition + LOGICAL :: do_rivinpt =.true. ! apply riverine input + LOGICAL :: do_sedspinup=.false. ! apply sediment spin-up + LOGICAL :: do_oalk =.false. ! apply ocean alkalinization + logical :: with_dmsph =.false. ! apply DMS with pH dependence + + logical :: do_bgc_aofluxes = .true. ! If true, atm/ocn bgc fluxes are computed within HAMOCC + +#ifdef BROMO + logical, parameter :: use_BROMO = .true. +#else + logical, parameter :: use_BROMO = .false. +#endif +#ifdef AGG + logical, parameter :: use_AGG = .true. +#else + logical, parameter :: use_AGG = .false. +#endif +#ifdef WLIN + logical, parameter :: use_WLIN = .true. +#else + logical, parameter :: use_WLIN = .false. +#endif +#ifdef natDIC + logical, parameter :: use_natDIC = .true. +#else + logical, parameter :: use_natDIC = .false. +#endif +#ifdef CFC + logical, parameter :: use_CFC = .true. +#else + logical, parameter :: use_CFC = .false. +#endif +#ifdef cisonew + logical, parameter :: use_cisonew = .true. +#else + logical, parameter :: use_cisonew = .false. +#endif +#ifdef PBGC_OCNP_TIMESTEP + logical, parameter :: use_PBGC_OCNP_TIMESTEP = .true. +#else + logical, parameter :: use_PBGC_OCNP_TIMESTEP = .false. +#endif +#ifdef PBGC_CK_TIMESTEP + logical, parameter :: use_PBGC_CK_TIMESTEP = .true. +#else + logical, parameter :: use_PBGC_CK_TIMESTEP = .false. +#endif +#ifdef FB_BGC_OCE + logical, parameter :: use_FB_BGC_OCE = .true. +#else + logical, parameter :: use_FB_BGC_OCE = .false. +#endif +#ifdef BOXATM + logical, parameter :: use_BOXATM = .true. +#else + logical, parameter :: use_BOXATM = .false. +#endif +#ifdef sedbypass + logical, parameter :: use_sedbypass = .true. +#else + logical, parameter :: use_sedbypass = .false. +#endif +#ifdef PROGCO2 + logical, parameter :: use_PROGCO2 = .true. +#else + logical, parameter :: use_PROGCO2 = .false. +#endif +#ifdef DIAGCO2 + logical, parameter :: use_DIAGCO2 = .true. +#else + logical, parameter :: use_DIAGCO2 = .false. +#endif + +contains + + subroutine get_bgc_namelist + !------------------------------------------------------------------------- + ! Get filename for namelist file + !------------------------------------------------------------------------- + use mod_config, only: inst_suffix + use mod_xc, only: xchalt + + implicit none + + logical :: exists + + if (.not. allocated(bgc_namelist)) then + inquire (file='ocn_in'//trim(inst_suffix), exist=exists) + if (exists) then + allocate(character(len=len('ocn_in'//trim(inst_suffix))) :: & + bgc_namelist) + bgc_namelist = 'ocn_in'//trim(inst_suffix) + else + inquire (file='limits', exist=exists) + if (exists) then + allocate(character(len=len('limits')) :: bgc_namelist) + bgc_namelist = 'limits' + else + call xchalt('cannot find limits file') + stop 'cannot find limits file' + endif + endif + endif + end subroutine get_bgc_namelist + +END MODULE mo_control_bgc diff --git a/hamocc/mo_ifdefs.F90 b/hamocc/mo_ifdefs.F90 deleted file mode 100644 index ae53a3ab..00000000 --- a/hamocc/mo_ifdefs.F90 +++ /dev/null @@ -1,72 +0,0 @@ -module mo_ifdefs - - implicit none - public - -#ifdef BROMO - logical, parameter :: use_BROMO = .true. -#else - logical, parameter :: use_BROMO = .false. -#endif -#ifdef AGG - logical, parameter :: use_AGG = .true. -#else - logical, parameter :: use_AGG = .false. -#endif -#ifdef WLIN - logical, parameter :: use_WLIN = .true. -#else - logical, parameter :: use_WLIN = .false. -#endif -#ifdef natDIC - logical, parameter :: use_natDIC = .true. -#else - logical, parameter :: use_natDIC = .false. -#endif -#ifdef CFC - logical, parameter :: use_CFC = .true. -#else - logical, parameter :: use_CFC = .false. -#endif -#ifdef cisonew - logical, parameter :: use_cisonew = .true. -#else - logical, parameter :: use_cisonew = .false. -#endif -#ifdef PBGC_OCNP_TIMESTEP - logical, parameter :: use_PBGC_OCNP_TIMESTEP = .true. -#else - logical, parameter :: use_PBGC_OCNP_TIMESTEP = .false. -#endif -#ifdef PBGC_CK_TIMESTEP - logical, parameter :: use_PBGC_CK_TIMESTEP = .true. -#else - logical, parameter :: use_PBGC_CK_TIMESTEP = .false. -#endif -#ifdef FB_BGC_OCE - logical, parameter :: use_FB_BGC_OCE = .true. -#else - logical, parameter :: use_FB_BGC_OCE = .false. -#endif -#ifdef BOXATM - logical, parameter :: use_BOXATM = .true. -#else - logical, parameter :: use_BOXATM = .false. -#endif -#ifdef sedbypass - logical, parameter :: use_sedbypass = .true. -#else - logical, parameter :: use_sedbypass = .false. -#endif -#ifdef PROGCO2 - logical, parameter :: use_PROGCO2 = .true. -#else - logical, parameter :: use_PROGCO2 = .false. -#endif -#ifdef DIAGCO2 - logical, parameter :: use_DIAGCO2 = .true. -#else - logical, parameter :: use_DIAGCO2 = .false. -#endif - -end module mo_ifdefs diff --git a/hamocc/mo_intfcblom.F90 b/hamocc/mo_intfcblom.F90 index 2c7c30f3..8504b77b 100644 --- a/hamocc/mo_intfcblom.F90 +++ b/hamocc/mo_intfcblom.F90 @@ -63,7 +63,8 @@ module mo_intfcblom ! *atm2* *REAL* - two time-level copy of atm ! !****************************************************************************** - use mo_ifdefs + use mo_control_bgc, only: use_sedbypass,use_BOXATM + implicit none integer, parameter :: nphys=2 diff --git a/hamocc/mo_param1_bgc.F90 b/hamocc/mo_param1_bgc.F90 index d47268b2..51be26b1 100644 --- a/hamocc/mo_param1_bgc.F90 +++ b/hamocc/mo_param1_bgc.F90 @@ -38,7 +38,8 @@ MODULE mo_param1_bgc ! - definition of indices in tracer arrays ! !****************************************************************************** - use mo_ifdefs + use mo_control_bgc, only: use_cisonew + implicit none INTEGER, PARAMETER :: ks=12,ksp=ks+1 ! ks: nb of sediment layers diff --git a/hamocc/mo_sedmnt.F90 b/hamocc/mo_sedmnt.F90 index 16d36ce8..9b4a9db5 100644 --- a/hamocc/mo_sedmnt.F90 +++ b/hamocc/mo_sedmnt.F90 @@ -72,7 +72,7 @@ MODULE mo_sedmnt use mo_param1_bgc, only: ks,ksp,nsedtra,npowtra use mo_control_bgc, only: io_stdo_bgc use mod_xc, only: mnproc - use mo_ifdefs + use mo_control_bgc, only: use_sedbypass,use_cisonew implicit none diff --git a/hamocc/ncout_hamocc.F90 b/hamocc/ncout_hamocc.F90 index 1bf7760e..7e237c63 100644 --- a/hamocc/ncout_hamocc.F90 +++ b/hamocc/ncout_hamocc.F90 @@ -159,8 +159,7 @@ subroutine ncwrt_bgc(iogrp) & inisdm,inibur,wrtsdm,accbur,accsdm,wrtbur ! BOXATM use mo_bgcmean, only: jatmco2,jatmn2,jatmo2,srf_atmo2,srf_atmn2 - - use mo_ifdefs + use mo_control_bgc, only: use_cisonew,use_AGG,use_CFC,use_natDIC,use_BROMO,use_sedbypass,use_BOXATM implicit none @@ -944,8 +943,7 @@ subroutine hamoccvardef(iogrp,timeunits,calendar,cmpflg) & sdm_pown2,sdm_powno3,sdm_powasi,sdm_ssso12,sdm_ssssil, & & sdm_sssc12,sdm_ssster,bur_ssso12,bur_sssc12,bur_ssssil, & & bur_ssster - - use mo_ifdefs + use mo_control_bgc, only: use_cisonew,use_AGG,use_CFC,use_natDIC,use_BROMO,use_sedbypass,use_BOXATM implicit none diff --git a/hamocc/ocprod.F90 b/hamocc/ocprod.F90 index f0aa3c1e..ba701433 100644 --- a/hamocc/ocprod.F90 +++ b/hamocc/ocprod.F90 @@ -120,8 +120,8 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) ! FB_BGC_OCE use mo_biomod, only: abs_oce,atten_f - - use mo_ifdefs + use mo_control_bgc, only: use_BROMO,use_AGG,use_PBGC_OCNP_TIMESTEP,use_FB_BGC_OCE,use_AGG,use_cisonew,use_natDIC,& + & use_WLIN,use_sedbypass implicit none diff --git a/hamocc/powach.F90 b/hamocc/powach.F90 index 81cd023f..01c2c26a 100644 --- a/hamocc/powach.F90 +++ b/hamocc/powach.F90 @@ -68,10 +68,10 @@ subroutine powach(kpie,kpje,kpke,kbnd,prho,omask,psao,lspin) use mo_param1_bgc, only: ioxygen,ipowaal,ipowaic,ipowaox,ipowaph,ipowasi,ipown2,ipowno3,isilica,isssc12,issso12,issssil, & & issster, ks use mo_vgrid, only: kbo,bolay - ! cisonew use mo_param1_bgc, only: ipowc13,ipowc14,isssc13,isssc14,issso13,issso14,safediv use mo_sedmnt, only: pror13,pror14,prca13,prca14 + use mo_control_bgc, only: use_cisonew implicit none diff --git a/hamocc/profile_gd.F90 b/hamocc/profile_gd.F90 index 136d50a7..a31ce46d 100644 --- a/hamocc/profile_gd.F90 +++ b/hamocc/profile_gd.F90 @@ -48,10 +48,10 @@ subroutine profile_gd(kpie,kpje,kpke,kbnd,pglon,pglat,omask) use mo_vgrid, only: ptiestw use mo_param1_bgc, only: ialkali,iano3,ioxygen,iphosph,isco212,isilica ! cisonew -use mo_param1_bgc, only: isco213,isco214 +use mo_param1_bgc, only: isco213,isco214 ! natDIC -use mo_param1_bgc, only: inatalkali,inatsco212 -use mo_ifdefs +use mo_param1_bgc, only: inatalkali,inatsco212 +use mo_control_bgc, only: use_natDIC,use_cisonew implicit none diff --git a/hamocc/sedshi.F90 b/hamocc/sedshi.F90 index 3d2a0071..f3c0d8c2 100644 --- a/hamocc/sedshi.F90 +++ b/hamocc/sedshi.F90 @@ -55,8 +55,8 @@ SUBROUTINE SEDSHI(kpie,kpje,omask) use mo_biomod, only: rcar use mo_param1_bgc, only: isssc12,issssil,issso12,issster,ks,nsedtra ! cisonew - use mo_param1_bgc, only: isssc13,isssc14,issso13,issso14 - use mo_ifdefs + use mo_param1_bgc, only: isssc13,isssc14,issso13,issso14 + use mo_control_bgc, only: use_cisonew implicit none From 8b39950f37933e150ec9e42835a2b98ce0410d6e Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Wed, 2 Aug 2023 12:08:09 +0200 Subject: [PATCH 40/52] removed BROMO ifdef --- phy/restart_wt.F | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/phy/restart_wt.F b/phy/restart_wt.F index 77faa50b..60b5760a 100644 --- a/phy/restart_wt.F +++ b/phy/restart_wt.F @@ -66,6 +66,9 @@ subroutine restart_wt use mod_tke, only: L_scale # endif #endif +#ifdef HAMOCC + use mo_control_bgc, only : use_BROMO +#endif c implicit none c @@ -370,8 +373,10 @@ subroutine restart_wt call wrtrst('mltpot',trim(c5p)//' time',mltpot,ip) call wrtrst('flxco2',trim(c5p)//' time',flxco2,ip) call wrtrst('flxdms',trim(c5p)//' time',flxdms,ip) -#ifdef BROMO - call wrtrst('flxbrf',trim(c5p)//' time',flxbrf,ip) +#ifdef HAMOCC + if (use_BROMO) then + call wrtrst('flxbrf',trim(c5p)//' time',flxbrf,ip) + end if #endif endif c @@ -1046,8 +1051,10 @@ subroutine defvar_restart(c5p,c5u,c5v,c5q) call defvarrst('mltpot',trim(c5p)//' time') call defvarrst('flxco2',trim(c5p)//' time') call defvarrst('flxdms',trim(c5p)//' time') -#ifdef BROMO - call defvarrst('flxbrf',trim(c5p)//' time') +#ifdef HAMOCC + if (use_BROMO) then + call defvarrst('flxbrf',trim(c5p)//' time') + end if #endif endif c From 46b589c9edc8f070b46e153b9862886409f476ca Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Thu, 3 Aug 2023 09:11:33 +0200 Subject: [PATCH 41/52] fixed comment --- hamocc/hamocc4bcm.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hamocc/hamocc4bcm.F90 b/hamocc/hamocc4bcm.F90 index 16d8be96..a14ecf57 100644 --- a/hamocc/hamocc4bcm.F90 +++ b/hamocc/hamocc4bcm.F90 @@ -129,8 +129,8 @@ SUBROUTINE HAMOCC4BCM(kpie,kpje,kpke,kbnd,kplyear,kplmon,kplday,kldtday,& REAL, intent(inout) :: pflxbromo(1-kbnd:kpie+kbnd,1-kbnd:kpje+kbnd) ! NOTE - why are some arguments intent(inout)? - ! If compute_flxdms is .true. then pflxdms will be computed in carchm.F90 - ! If compute_flxdms is .false. then pflxdms is obtained external to blom + ! If do_bgc_aofluxes is .true. then pflxdms will be computed in carchm.F90 (as before) + ! If do_bgc_aofluxes is .false. then pflxdms is obtained external to blom INTEGER :: i,j,k,l INTEGER :: nspin,it From a5c01a20b80945f457d7ca068731e0af63c482bb Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Thu, 12 Oct 2023 14:52:40 +0200 Subject: [PATCH 42/52] removed logical do_bgc_aofluxes --- cesm/mod_cesm.F90 | 12 +----------- drivers/nuopc/mod_nuopc_methods.F90 | 8 +------- hamocc/carchm.F90 | 18 +++++------------- hamocc/hamocc4bcm.F90 | 4 ---- hamocc/mo_control_bgc.F90 | 2 -- 5 files changed, 7 insertions(+), 37 deletions(-) diff --git a/cesm/mod_cesm.F90 b/cesm/mod_cesm.F90 index 313e304f..01969506 100644 --- a/cesm/mod_cesm.F90 +++ b/cesm/mod_cesm.F90 @@ -35,7 +35,7 @@ module mod_cesm use mod_seaice, only: ficem use mod_checksum, only: csdiag, chksummsk #ifdef HAMOCC - use mo_control_bgc, only: do_bgc_aofluxes, use_bromo + use mo_control_bgc, only: use_bromo #endif implicit none @@ -194,16 +194,6 @@ subroutine getfrc_cesm vstokes(i, j) = w1*vstokes_da(i, j, l1ci) + w2*vstokes_da(i, j, l2ci) atmco2(i, j) = w1*atmco2_da(i, j, l1ci) + w2*atmco2_da(i, j, l2ci) atmbrf(i, j) = w1*atmbrf_da(i, j, l1ci) + w2*atmbrf_da(i, j, l2ci) -#ifdef HAMOCC - if (.not. do_bgc_aofluxes) then - ! flxdms is obtained from the mediator - flxdms(i, j) = w1*flxdms_da(i, j, l1ci) + w2*flxdms_da(i, j, l2ci) - if (use_bromo) then - ! flxbrf is obtained from the mediator - flxbrf(i, j) = w1*flxbrf_da(i, j, l1ci) + w2*flxbrf_da(i, j, l2ci) - end if - end if -#endif enddo enddo do l = 1, isu(j) diff --git a/drivers/nuopc/mod_nuopc_methods.F90 b/drivers/nuopc/mod_nuopc_methods.F90 index cc26a385..768da9c9 100644 --- a/drivers/nuopc/mod_nuopc_methods.F90 +++ b/drivers/nuopc/mod_nuopc_methods.F90 @@ -46,7 +46,7 @@ module mod_nuopc_methods #ifdef HAMOCC use mo_carbch, only: ocetra use mo_param1_bgc, only: idms, ibromo - use mo_control_bgc, only: do_bgc_aofluxes, use_BROMO, use_DIAGCO2, use_PROGCO2 + use mo_control_bgc, only: use_BROMO, use_DIAGCO2, use_PROGCO2 #endif implicit none @@ -153,12 +153,6 @@ subroutine fldlist_add(num, fldlist, stdname, index, ungridded_lbound, ungridded ! Local variables. integer :: rc -#ifdef HAMOCC - ! Set the logical flag do_bgc_aofluxes to false in mo_control_bgc since - ! for nuopc/cmeps the dms and bromo fluxes will be computed in the mediator - do_bgc_aofluxes = .false. -#endif - num = num + 1 if (num > fldsMax) then write(lp,'(a,3i6,2(f21.13,3x),d21.5)') subname// & diff --git a/hamocc/carchm.F90 b/hamocc/carchm.F90 index 2a97a9fa..4ddd1339 100644 --- a/hamocc/carchm.F90 +++ b/hamocc/carchm.F90 @@ -101,7 +101,7 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & 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,do_bgc_aofluxes + use mo_control_bgc, only: dtbgc use mo_param1_bgc, only: ialkali,iatmo2,iatmco2,iatmdms,iatmn2,iatmn2o,ian2o,icalc,idicsat,idms,igasnit,ioxygen,iphosph, & & isco212,isilica use mo_vgrid, only: dp_min,kmle,kbo,ptiestu @@ -470,12 +470,8 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & end if ! Surface flux of dms - if (do_bgc_aofluxes) then - ! Note that kwdms already has the open ocean fraction in the term - dmsflux = kwdms*dtbgc*ocetra(i,j,1,idms) - else - dmsflux = -dtbgc*pflxdms(i,j) - end if + ! Note that kwdms already has the open ocean fraction in the term + dmsflux = kwdms*dtbgc*ocetra(i,j,1,idms) ocetra(i,j,1,idms) = ocetra(i,j,1,idms) - dmsflux/pddpo(i,j,1) atmflx(i,j,iatmdms) = dmsflux ! positive to atmosphere [kmol dms m-2 timestep-1] @@ -487,12 +483,8 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & ! [ppp] to [mol L-1] by multiplying with pressure[bar]/(SST[K]*R[L bar K-1 mol-1]); R=0,083 ! [mol L-1] to [kmol m-3] by multiplying with 1 - if (do_bgc_aofluxes) then - flx_bromo = kw_bromo*dtbgc* & - (atbrf/a_bromo*1e-12*ppao(i,j)*1e-5/(tk*0.083) - ocetra(i,j,1,ibromo)) - else - flx_bromo = dtbgc*pflxbromo(i,j) - end if + flx_bromo = kw_bromo*dtbgc* & + (atbrf/a_bromo*1e-12*ppao(i,j)*1e-5/(tk*0.083) - ocetra(i,j,1,ibromo)) ocetra(i,j,1,ibromo) = ocetra(i,j,1,ibromo) + flx_bromo/pddpo(i,j,1) atmflx(i,j,iatmbromo) = -flx_bromo end if diff --git a/hamocc/hamocc4bcm.F90 b/hamocc/hamocc4bcm.F90 index 77972744..372c4363 100644 --- a/hamocc/hamocc4bcm.F90 +++ b/hamocc/hamocc4bcm.F90 @@ -128,10 +128,6 @@ SUBROUTINE HAMOCC4BCM(kpie,kpje,kpke,kbnd,kplyear,kplmon,kplday,kldtday,& REAL, intent(in) :: patmbromo(1-kbnd:kpie+kbnd,1-kbnd:kpje+kbnd) REAL, intent(inout) :: pflxbromo(1-kbnd:kpie+kbnd,1-kbnd:kpje+kbnd) - ! NOTE - why are some arguments intent(inout)? - ! If do_bgc_aofluxes is .true. then pflxdms will be computed in carchm.F90 (as before) - ! If do_bgc_aofluxes is .false. then pflxdms is obtained external to blom - INTEGER :: i,j,k,l INTEGER :: nspin,it LOGICAL :: lspin diff --git a/hamocc/mo_control_bgc.F90 b/hamocc/mo_control_bgc.F90 index 0fdd0058..81c99d37 100644 --- a/hamocc/mo_control_bgc.F90 +++ b/hamocc/mo_control_bgc.F90 @@ -65,8 +65,6 @@ MODULE mo_control_bgc LOGICAL :: do_oalk =.false. ! apply ocean alkalinization logical :: with_dmsph =.false. ! apply DMS with pH dependence - logical :: do_bgc_aofluxes = .true. ! If true, atm/ocn bgc fluxes are computed within HAMOCC - #ifdef BROMO logical, parameter :: use_BROMO = .true. #else From 91ba228015501d90c5aa6624a1c1a6bae4536ee7 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Fri, 13 Oct 2023 12:38:59 +0200 Subject: [PATCH 43/52] changes to get code compiled and working --- drivers/nuopc/mod_nuopc_methods.F90 | 357 ++++++++---------- hamocc/aufr_bgc.F90 | 1 + hamocc/aufw_bgc.F90 | 26 +- hamocc/carchm.F90 | 2 +- hamocc/hamocc_init.F90 | 2 +- hamocc/mo_biomod.F90 | 3 - hamocc/mo_param1_bgc.F90 | 551 +++++++++++++++++----------- hamocc/mo_param_bgc.F90 | 8 +- phy/restart_wt.F | 7 +- trc/mod_tracers.F90 | 3 +- 10 files changed, 516 insertions(+), 444 deletions(-) diff --git a/drivers/nuopc/mod_nuopc_methods.F90 b/drivers/nuopc/mod_nuopc_methods.F90 index 768da9c9..91d964dc 100644 --- a/drivers/nuopc/mod_nuopc_methods.F90 +++ b/drivers/nuopc/mod_nuopc_methods.F90 @@ -23,34 +23,30 @@ module mod_nuopc_methods ! NUOPC cap. ! ------------------------------------------------------------------------------ - use mod_types, only: r8 - use mod_constants, only: rearth, onem - use mod_time, only: nstep, baclin, delt1, dlt + use mod_types, only: r8 + use mod_constants, only: rearth, onem + use mod_time, only: nstep, baclin, delt1, dlt use mod_xc - use mod_grid, only: scuy, scvx, scp2, scuxi, scvyi, plon, plat, & - cosang, sinang - use mod_state, only: u, v, dp, temp, saln, pbu, pbv, ubflxs, vbflxs, sealv - use mod_forcing, only: wavsrc_opt, wavsrc_extern, sprfac, prfac, flxco2, & - flxdms, flxbrf - use mod_difest, only: obldepth - use mod_vcoord, only: vcoord_type_tag, isopyc_bulkml, cntiso_hybrid - use mod_cesm, only: frzpot, mltpot, & - swa_da, nsf_da, hmlt_da, lip_da, sop_da, eva_da, & - 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, atmbrf_da, & - flxdms_da, flxbrf_da, l1ci, l2ci - use mod_utility, only: util1, util2 - use mod_checksum, only: csdiag, chksummsk - use shr_const_mod, only: SHR_CONST_RHOSW, SHR_CONST_LATICE, SHR_CONST_TKFRZ + use mod_grid, only: scuy, scvx, scp2, scuxi, scvyi, plon, plat, cosang, sinang + use mod_state, only: u, v, dp, temp, saln, pbu, pbv, ubflxs, vbflxs, sealv + use mod_forcing, only: wavsrc_opt, wavsrc_extern, sprfac, prfac, flxco2,flxdms, flxbrf + use mod_difest, only: obldepth + use mod_vcoord, only: vcoord_type_tag, isopyc_bulkml, cntiso_hybrid + use mod_cesm, only: frzpot, mltpot, & + swa_da, nsf_da, hmlt_da, lip_da, sop_da, eva_da, & + 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, atmbrf_da, & + flxdms_da, flxbrf_da, l1ci, l2ci + use mod_utility, only: util1, util2 + use mod_checksum, only: csdiag, chksummsk + use shr_const_mod, only: SHR_CONST_RHOSW, SHR_CONST_LATICE, SHR_CONST_TKFRZ #ifdef HAMOCC - use mo_carbch, only: ocetra - use mo_param1_bgc, only: idms, ibromo + use mo_carbch, only: ocetra use mo_control_bgc, only: use_BROMO, use_DIAGCO2, use_PROGCO2 #endif implicit none - private ! Parameters. @@ -79,54 +75,48 @@ module mod_nuopc_methods ! Indices for import fields integer :: & - index_Si_ifrac = - 1, & - index_So_duu10n = - 1, & - index_Fioi_melth = - 1, & - index_Fioi_meltw = - 1, & - index_Fioi_salt = - 1, & - index_Fioi_bcpho = - 1, & - index_Fioi_bcphi = - 1, & - index_Fioi_flxdst = - 1, & - index_Foxx_rofl = - 1, & - index_Foxx_rofi = - 1, & - index_Faox_dms = - 1, & - index_Faox_brf = - 1, & - index_Foxx_tauy = - 1, & - index_Foxx_taux = - 1, & - index_Foxx_lat = - 1, & - index_Foxx_sen = - 1, & - index_Foxx_lwup = - 1, & - index_Foxx_evap = - 1, & - index_Foxx_swnet = - 1, & - index_Sw_lamult = - 1, & - index_Sw_ustokes = - 1, & - index_Sw_vstokes = - 1, & - index_Sw_hstokes = - 1, & - index_Faxa_lwdn = - 1, & - index_Faxa_snow = - 1, & - index_Faxa_rain = - 1, & - index_Sa_pslv = - 1, & - index_Sa_co2diag = - 1, & - index_Sa_co2prog = - 1 + index_Si_ifrac = -1, & + index_So_duu10n = -1, & + index_Fioi_melth = -1, & + index_Fioi_meltw = -1, & + index_Fioi_salt = -1, & + index_Fioi_bcpho = -1, & + index_Fioi_bcphi = -1, & + index_Fioi_flxdst = -1, & + index_Foxx_rofl = -1, & + index_Foxx_rofi = -1, & + index_Foxx_tauy = -1, & + index_Foxx_taux = -1, & + index_Foxx_lat = -1, & + index_Foxx_sen = -1, & + index_Foxx_lwup = -1, & + index_Foxx_evap = -1, & + index_Foxx_swnet = -1, & + index_Sw_lamult = -1, & + index_Sw_ustokes = -1, & + index_Sw_vstokes = -1, & + index_Sw_hstokes = -1, & + index_Faxa_lwdn = -1, & + index_Faxa_snow = -1, & + index_Faxa_rain = -1, & + index_Sa_pslv = -1, & + index_Sa_co2diag = -1, & + index_Sa_co2prog = -1 ! Indices for export fields integer :: & - index_So_omask = - 1, & - index_So_u = - 1, & - index_So_v = - 1, & - index_So_dhdx = - 1, & - index_So_dhdy = - 1, & - index_So_t = - 1, & - index_So_s = - 1, & - index_So_bldepth = - 1, & - index_So_dms = - 1, & - index_So_brf = - 1, & - index_Fioo_q = - 1, & - index_Faoo_fco2_ocn = - 1 - - - ! Set logicals for CPP variables - + index_So_omask = -1, & + index_So_u = -1, & + index_So_v = -1, & + index_So_dhdx = -1, & + index_So_dhdy = -1, & + index_So_t = -1, & + index_So_s = -1, & + index_So_bldepth = -1, & + index_Fioo_q = -1, & + index_Faoo_dms = -1, & + index_Faoo_brf = -1, & + index_Faoo_fco2_ocn = -1 contains @@ -157,8 +147,8 @@ subroutine fldlist_add(num, fldlist, stdname, index, ungridded_lbound, ungridded if (num > fldsMax) then write(lp,'(a,3i6,2(f21.13,3x),d21.5)') subname// & ': BLOM ERROR: number of fields exceeds fldsMax for '//trim(stdname) - call xchalt(subname) - stop subname + call xchalt(subname) + stop subname endif fldlist(num)%stdname = trim(stdname) @@ -214,12 +204,6 @@ subroutine blom_advertise_imports(flds_scalar_name, fldsToOcn_num, fldsToOcn, & call fldlist_add(fldsToOcn_num, fldsToOcn, 'Foxx_lwup' , index_Foxx_lwup) call fldlist_add(fldsToOcn_num, fldsToOcn, 'Foxx_evap' , index_Foxx_evap) call fldlist_add(fldsToOcn_num, fldsToOcn, 'Foxx_swnet' , index_Foxx_swnet) -#ifdef HAMOCC - call fldlist_add(fldsToOcn_num, fldsToOcn, 'Faox_dms', index_Faox_dms) - if (use_BROMO) then - call fldlist_add(fldsToOcn_num, fldsToOcn, 'Faox_brf', index_Faox_brf) - end if -#endif ! From wave: if (wavsrc_opt == wavsrc_extern) then @@ -244,7 +228,6 @@ subroutine blom_advertise_imports(flds_scalar_name, fldsToOcn_num, fldsToOcn, & end subroutine blom_advertise_imports subroutine blom_advertise_exports(flds_scalar_name, fldsFrOcn_num, fldsFrOcn) - ! ------------------------------------------------------------------- ! Determine fldsToOcn for export fields ! ------------------------------------------------------------------- @@ -268,17 +251,17 @@ subroutine blom_advertise_exports(flds_scalar_name, fldsFrOcn_num, fldsFrOcn) call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'Fioo_q' , index_Fioo_q) call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'Faoo_fco2_ocn' , index_Faoo_fco2_ocn) #ifdef HAMOCC - call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'So_dms', index_So_dms) - if (use_BROMO) then - call fldlist_add(fldsFrOcn_num, fldsFrOcn, 'So_brf', index_So_brf) - end if + ! call fldlist_add(fldsToOcn_num, fldsToOcn, 'Faoo_dms', index_Faoo_dms) + ! if (use_BROMO) then + ! call fldlist_add(fldsToOcn_num, fldsToOcn, 'Faoo_brf', index_Faoo_brf) + ! end if #endif end subroutine blom_advertise_exports subroutine blom_logwrite(msg) - ! --------------------------------------------------------------------------- - ! Write message string to standard out from master PE. - ! --------------------------------------------------------------------------- + ! --------------------------------------------------------------------------- + ! Write message string to standard out from master PE. + ! --------------------------------------------------------------------------- ! Input/output arguments. character(len=*), intent(in) :: msg @@ -513,7 +496,7 @@ subroutine blom_accflds call xctilr(sealv, 1,1, 1,1, halo_ps) - !$omp parallel do private(l, i) + !$omp parallel do private(l, i) do j = 1, jj do l = 1, isu(j) do i = max(1, ifu(j,l)), min(ii, ilu(j,l)) @@ -543,12 +526,12 @@ subroutine blom_accflds enddo enddo enddo - !$omp end parallel do + !$omp end parallel do select case (vcoord_type_tag) case (isopyc_bulkml) q = baclin/onem - !$omp parallel do private(l, i) + !$omp parallel do private(l, i) do j = 1, jj do l = 1, isp(j) do i = max(1, ifp(j,l)), min(ii, ilp(j,l)) @@ -556,9 +539,9 @@ subroutine blom_accflds enddo enddo enddo - !$omp end parallel do + !$omp end parallel do case (cntiso_hybrid) - !$omp parallel do private(l, i) + !$omp parallel do private(l, i) do j = 1, jj do l = 1, isp(j) do i = max(1, ifp(j,l)), min(ii, ilp(j,l)) @@ -566,16 +549,17 @@ subroutine blom_accflds enddo enddo enddo - !$omp end parallel do + !$omp end parallel do case default - if (mnproc == 1.and. first_call) & + if (mnproc == 1.and. first_call) then write(lp,*) subname//': unsupported vertical coordinate!' + end if call xcstop(subname) - stop subname + stop subname end select if (index_Faoo_fco2_ocn > 0) then - !$omp parallel do private(l, i) + !$omp parallel do private(l, i) do j = 1, jj do l = 1, isp(j) do i = max(1, ifp(j,l)), min(ii, ilp(j,l)) @@ -583,9 +567,33 @@ subroutine blom_accflds enddo enddo enddo - !$omp end parallel do + !$omp end parallel do endif + if (index_Faoo_dms > 0) then + !$omp parallel do private(l, i) + do j = 1, jj + do l = 1, isp(j) + do i = max(1, ifp(j,l)), min(ii, ilp(j,l)) + acc_fdms(i,j) = acc_fdms(i,j) + flxdms(i,j)*baclin + enddo + enddo + enddo + !$omp end parallel do + end if + + if (index_Faoo_brf > 0) then + !$omp parallel do private(l, i) + do j = 1, jj + do l = 1, isp(j) + do i = max(1, ifp(j,l)), min(ii, ilp(j,l)) + acc_fbrf(i,j) = acc_fbrf(i,j) + flxbrf(i,j)*baclin + enddo + enddo + enddo + !$omp end parallel do + end if + ! ------------------------------------------------------------------------ ! Increment time since last coupling. ! ------------------------------------------------------------------------ @@ -629,7 +637,7 @@ subroutine blom_importflds(fldlist_num, fldlist) l2ci = 3 - l2ci endif - !$omp parallel do private(i, n, afac, utmp, vtmp) + !$omp parallel do private(i, n, afac, utmp, vtmp) do j = 1, jjcpl do i = 1, ii if (ip(i,j) == 0) then @@ -655,7 +663,7 @@ subroutine blom_importflds(fldlist_num, fldlist) endif enddo enddo - !$omp end parallel do + !$omp end parallel do call fill_global(mval, fval, halo_pv, util1) call fill_global(mval, fval, halo_pv, util2) @@ -664,7 +672,7 @@ subroutine blom_importflds(fldlist_num, fldlist) call xctilr(util1, 1,1, 1,1, halo_pv) call xctilr(util2, 1,1, 1,1, halo_pv) - !$omp parallel do private(l, i) + !$omp parallel do private(l, i) do j = 1, jj do l = 1, isu(j) do i = max(1,ifu(j,l)), min(ii,ilu(j,l)) @@ -679,13 +687,13 @@ subroutine blom_importflds(fldlist_num, fldlist) enddo enddo enddo - !$omp end parallel do + !$omp end parallel do - !$omp parallel do private(i, n, afac) + !$omp parallel do private(i, n, afac) do j = 1, jjcpl do i = 1, ii - if (ip(i,j) == 0) then + if (ip(i,j) == 0) then lip_da(i,j,l2ci) = mval sop_da(i,j,l2ci) = mval eva_da(i,j,l2ci) = mval @@ -767,7 +775,7 @@ subroutine blom_importflds(fldlist_num, fldlist) enddo enddo - !$omp end parallel do + !$omp end parallel do if (nreg == 2) then call xctilr(lip_da(1-nbdy,1-nbdy,l2ci), 1,1, 0,0, halo_ps) @@ -893,58 +901,6 @@ subroutine blom_importflds(fldlist_num, fldlist) endif end if - ! DMS flux - - if (index_Faox_dms > 0) then - if (associated(fldlist(index_Faox_dms)%dataptr)) then - !$omp parallel do private(i, n, afac) - do j = 1, jjcpl - do i = 1, ii - n = (j - 1)*ii + i - afac = med2mod_areacor(n) - if (ip(i,j) == 0) then - flxdms_da(i,j,l2ci) = mval - elseif (cplmsk(i,j) == 0) then - flxdms_da(i,j,l2ci) = 0._r8 - else - flxdms_da(i,j,l2ci) = fldlist(index_Faox_dms)%dataptr(n)*afac/62.13 - end if - end do - end do - !$omp end parallel do - if (mnproc == 1 .and. first_call) & - write(lp,*) subname//': prog. dms flux obtained from mediator' - end if - if (nreg == 2) then - call xctilr(flxdms_da(1-nbdy,1-nbdy,l2ci), 1,1, 0,0, halo_ps) - end if - end if - - if (index_Faox_brf > 0) then - if (associated(fldlist(index_Faox_brf)%dataptr)) then - !$omp parallel do private(i, n, afac) - do j = 1, jjcpl - do i = 1, ii - n = (j - 1)*ii + i - afac = med2mod_areacor(n) - if (ip(i,j) == 0) then - flxbrf_da(i,j,l2ci) = mval - elseif (cplmsk(i,j) == 0) then - flxbrf_da(i,j,l2ci) = 0._r8 - else - flxbrf_da(i,j,l2ci) = fldlist(index_Faox_brf)%dataptr(n)*afac/252.7 - end if - end do - end do - !$omp end parallel do - if (mnproc == 1 .and. first_call) & - write(lp,*) subname//': prog. brf flux obtained from mediator' - end if - if (nreg == 2) then - call xctilr(flxbrf_da(1-nbdy,1-nbdy,l2ci), 1,1, 0,0, halo_ps) - end if - end if - if (csdiag) then if (mnproc == 1 .and. first_call) then write(lp,*) subname//':' @@ -966,10 +922,6 @@ 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(atmbrf_da(1-nbdy,1-nbdy,l2ci),ip,1,'atmbrf') - if (index_Faox_dms > 0) then - call chksummsk(flxdms_da(1-nbdy,1-nbdy,l2ci),ip,1,'flxdms_da') - end if endif if (first_call) then @@ -993,7 +945,7 @@ subroutine blom_exportflds(fldlist_num, fldlist) ! Local variables. real(r8) :: tfac, utmp, vtmp - integer :: n, l, i, j + integer :: n, l, i, j logical, save :: first_call = .true. tfac = 1._r8/tlast_coupled @@ -1017,7 +969,7 @@ subroutine blom_exportflds(fldlist_num, fldlist) fldlist(index_So_bldepth)%dataptr(:) = 0._r8 fldlist(index_Fioo_q)%dataptr(:) = 0._r8 - !$omp parallel do private(l, i, n, utmp, vtmp) + !$omp parallel do private(l, i, n, utmp, vtmp) do j = 1, jjcpl do l = 1, isp(j) do i = max(1, ifp(j,l)), min(ii, ilp(j,l)) @@ -1026,8 +978,7 @@ subroutine blom_exportflds(fldlist_num, fldlist) ! Ocean mask []. fldlist(index_So_omask)%dataptr(n) = 1._r8 - ! Surface velocity, interpolated onto scalar points and rotated - ! [m s-1]. + ! Surface velocity, interpolated onto scalar points and rotated [m s-1]. utmp = .5_r8*(acc_u(i,j) + acc_u(i+1,j))*tfac*1.e-2_r8 vtmp = .5_r8*(acc_v(i,j) + acc_v(i,j+1))*tfac*1.e-2_r8 fldlist(index_So_u)%dataptr(n) = utmp*cosang(i,j) & @@ -1046,8 +997,7 @@ subroutine blom_exportflds(fldlist_num, fldlist) + vtmp*cosang(i,j) ! Surface temperature [K]. - fldlist(index_So_t)%dataptr(n) = acc_t(i,j)*tfac & - + SHR_CONST_TKFRZ + fldlist(index_So_t)%dataptr(n) = acc_t(i,j)*tfac + SHR_CONST_TKFRZ ! Surface salinity [g kg-1]. fldlist(index_So_s)%dataptr(n) = acc_s(i,j)*tfac @@ -1057,74 +1007,79 @@ subroutine blom_exportflds(fldlist_num, fldlist) ! Freezing/melting potential [W m-2]. if (acc_frzpot(i,j) > 0._r8) then - fldlist(index_Fioo_q)%dataptr(n) = & - acc_frzpot(i,j)*tfac*mod2med_areacor(n) + fldlist(index_Fioo_q)%dataptr(n) = acc_frzpot(i,j)*tfac*mod2med_areacor(n) else - fldlist(index_Fioo_q)%dataptr(n) = & - mltpot(i,j)*tfac*mod2med_areacor(n) + fldlist(index_Fioo_q)%dataptr(n) = mltpot(i,j)*tfac*mod2med_areacor(n) endif enddo enddo enddo - !$omp end parallel do + !$omp end parallel do - if (index_So_dms > 0) then - if (associated(fldlist(index_So_dms)%dataptr)) then - fldlist(index_So_dms)%dataptr(:) = 0._r8 - !$omp parallel do private(l, i, n) + if (index_Faoo_fco2_ocn > 0) then + ! CO2 flux [kg CO2 m-2 s-1] + if (associated(fldlist(index_Faoo_fco2_ocn)%dataptr)) then + fldlist(index_Faoo_fco2_ocn)%dataptr(:) = 0._r8 + !$omp parallel do private(l, i, n) do j = 1, jjcpl do l = 1, isp(j) do i = max(1, ifp(j,l)), min(ii, ilp(j,l)) n = (j - 1)*ii + i - fldlist(index_So_dms)%dataptr(n) = ocetra(i,j,1,idms) + fldlist(index_Faoo_fco2_ocn)%dataptr(n) = acc_fco2(i,j)*tfac*mod2med_areacor(n) enddo enddo enddo - !$omp end parallel do + !$omp end parallel do + end if + else + if (first_call) then + if (mnproc == 1 .and. first_call) then + write(lp,*) subname//': co2 flux not sent to coupler' + end if end if end if - if (index_So_brf > 0) then - if (associated(fldlist(index_So_brf)%dataptr)) then - fldlist(index_So_brf)%dataptr(:) = 0._r8 + if (index_Faoo_dms > 0) then + ! dms flux (kmol DMS/m^2/s) + fldlist(index_Faoo_dms)%dataptr(:) = 0._r8 !$omp parallel do private(l, i, n) - do j = 1, jjcpl - do l = 1, isp(j) - do i = max(1, ifp(j,l)), min(ii, ilp(j,l)) - n = (j - 1)*ii + i - fldlist(index_So_brf)%dataptr(n) = ocetra(i,j,1,ibromo) - enddo + do j = 1, jjcpl + do l = 1, isp(j) + do i = max(1, ifp(j,l)), min(ii, ilp(j,l)) + n = (j - 1)*ii + i + fldlist(index_Faoo_dms)%dataptr(n) = acc_fdms(i,j)*tfac*mod2med_areacor(n) enddo enddo + enddo !$omp end parallel do + else + if (first_call) then + if (mnproc == 1 .and. first_call) then + write(lp,*) subname//': dms flux not sent to coupler' + end if end if end if - ! ------------------------------------------------------------------------ - ! Provide CO2 flux [kg CO2 m-2 s-1], if requested. - ! ------------------------------------------------------------------------ - - if (index_Faoo_fco2_ocn > 0) then - if (associated(fldlist(index_Faoo_fco2_ocn)%dataptr)) then - fldlist(index_Faoo_fco2_ocn)%dataptr(:) = 0._r8 + if (index_Faoo_brf > 0) then + ! brf flux (kmol BRF/m^2/s) + fldlist(index_Faoo_brf)%dataptr(:) = 0._r8 !$omp parallel do private(l, i, n) - do j = 1, jjcpl - do l = 1, isp(j) - do i = max(1, ifp(j,l)), min(ii, ilp(j,l)) - n = (j - 1)*ii + i - fldlist(index_Faoo_fco2_ocn)%dataptr(n) = & - acc_fco2(i,j)*tfac*mod2med_areacor(n) - enddo + do j = 1, jjcpl + do l = 1, isp(j) + do i = max(1, ifp(j,l)), min(ii, ilp(j,l)) + n = (j - 1)*ii + i + fldlist(index_Faoo_brf)%dataptr(n) = acc_fbrf(i,j)*tfac*mod2med_areacor(n) enddo enddo + enddo !$omp end parallel do - else - if (first_call) then - if (mnproc == 1 .and. first_call) & - write(lp,*) subname//': co2 flux not sent to coupler' + else + if (first_call) then + if (mnproc == 1 .and. first_call) then + write(lp,*) subname//': brf flux not sent to coupler' end if - endif + end if end if if (first_call) then diff --git a/hamocc/aufr_bgc.F90 b/hamocc/aufr_bgc.F90 index 09936562..37318b6b 100644 --- a/hamocc/aufr_bgc.F90 +++ b/hamocc/aufr_bgc.F90 @@ -126,6 +126,7 @@ SUBROUTINE AUFR_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & use mo_biomod, only: bifr13,bifr14,c14fac,re1312,re14to,prei13,prei14 use mo_param1_bgc, only: icalc13,icalc14,idet13,idet14,idoc13,idoc14,iphy13,iphy14,isco213,isco214,izoo13,izoo14,safediv use mo_param1_bgc, only: issso13,issso14,isssc13,isssc14,ipowc13,ipowc14 + use mo_param1_bgc, only: iatmc13,iatmc14,iatmnco2 use mo_bgcmean, only: jatmo2,jatmn2 ! natDIC use mo_param1_bgc, only: inatalkali,inatcalc,inatsco212 diff --git a/hamocc/aufw_bgc.F90 b/hamocc/aufw_bgc.F90 index 5723e7cd..232b8b09 100644 --- a/hamocc/aufw_bgc.F90 +++ b/hamocc/aufw_bgc.F90 @@ -116,7 +116,7 @@ SUBROUTINE AUFW_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & use mo_param1_bgc, only: icfc11,icfc12,isf6 ! cisonew use mo_param1_bgc, only: icalc13,icalc14,idet13,idet14,idoc13,idoc14,iphy13,iphy14,isco213,isco214,izoo13,izoo14 - use mo_param1_bgc, only: issso13,issso14,isssc13,isssc14,ipowc13,ipowc14 + use mo_param1_bgc, only: issso13,issso14,isssc13,isssc14,ipowc13,ipowc14 use mo_param1_bgc, only: iatmnco2,iatmc13,iatmc14 use mo_control_bgc, only: rmasks ! natDIC @@ -852,18 +852,18 @@ SUBROUTINE AUFW_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & CALL write_netcdf_var(ncid,'prefdic',locetra(1,1,1,iprefdic),2*kpke,0) CALL write_netcdf_var(ncid,'dicsat',locetra(1,1,1,idicsat),2*kpke,0) if (use_cisonew) then - CALL write_netcdf_var(ncid,'sco213',locetra(1,1,1,isco213),2*kpke,0) - CALL write_netcdf_var(ncid,'sco214',locetra(1,1,1,isco214),2*kpke,0) - CALL write_netcdf_var(ncid,'doc13',locetra(1,1,1,idoc13),2*kpke,0) - CALL write_netcdf_var(ncid,'doc14',locetra(1,1,1,idoc14),2*kpke,0) - CALL write_netcdf_var(ncid,'poc13',locetra(1,1,1,idet13),2*kpke,0) - CALL write_netcdf_var(ncid,'poc14',locetra(1,1,1,idet14),2*kpke,0) - CALL write_netcdf_var(ncid,'phyto13',locetra(1,1,1,iphy13),2*kpke,0) - CALL write_netcdf_var(ncid,'phyto14',locetra(1,1,1,iphy14),2*kpke,0) - CALL write_netcdf_var(ncid,'grazer13',locetra(1,1,1,izoo13),2*kpke,0) - CALL write_netcdf_var(ncid,'grazer14',locetra(1,1,1,izoo14),2*kpke,0) - CALL write_netcdf_var(ncid,'calciu13',locetra(1,1,1,icalc13),2*kpke,0) - CALL write_netcdf_var(ncid,'calciu14',locetra(1,1,1,icalc14),2*kpke,0) + CALL write_netcdf_var(ncid,'sco213' ,locetra(1,1,1,isco213) ,2*kpke,0) + CALL write_netcdf_var(ncid,'sco214' ,locetra(1,1,1,isco214) ,2*kpke,0) + CALL write_netcdf_var(ncid,'doc13' ,locetra(1,1,1,idoc13) ,2*kpke,0) + CALL write_netcdf_var(ncid,'doc14' ,locetra(1,1,1,idoc14) ,2*kpke,0) + CALL write_netcdf_var(ncid,'poc13' ,locetra(1,1,1,idet13) ,2*kpke,0) + CALL write_netcdf_var(ncid,'poc14' ,locetra(1,1,1,idet14) ,2*kpke,0) + CALL write_netcdf_var(ncid,'phyto13' ,locetra(1,1,1,iphy13) ,2*kpke,0) + CALL write_netcdf_var(ncid,'phyto14' ,locetra(1,1,1,iphy14) ,2*kpke,0) + CALL write_netcdf_var(ncid,'grazer13' ,locetra(1,1,1,izoo13) ,2*kpke,0) + CALL write_netcdf_var(ncid,'grazer14' ,locetra(1,1,1,izoo14) ,2*kpke,0) + CALL write_netcdf_var(ncid,'calciu13' ,locetra(1,1,1,icalc13) ,2*kpke,0) + CALL write_netcdf_var(ncid,'calciu14' ,locetra(1,1,1,icalc14) ,2*kpke,0) end if if (use_AGG) then CALL write_netcdf_var(ncid,'snos',locetra(1,1,1,inos),2*kpke,0) diff --git a/hamocc/carchm.F90 b/hamocc/carchm.F90 index 4056e976..202b3b99 100644 --- a/hamocc/carchm.F90 +++ b/hamocc/carchm.F90 @@ -117,7 +117,7 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & use mo_carbch, only: atm_co2_nat,nathi,natco3,natpco2d,natomegaa,natomegac use mo_param1_bgc, only: iatmnco2,inatalkali,inatcalc,inatsco212 ! sedbypass - use mo_sedmnt, only: sedlay,powtra + use mo_sedmnt, only: sedlay,powtra,burial use mo_param1_bgc, only: issso14,isssc14,ipowc14 use mo_control_bgc, only: use_cisonew,use_natDIC,use_CFC,use_BROMO,use_cisonew,use_sedbypass diff --git a/hamocc/hamocc_init.F90 b/hamocc/hamocc_init.F90 index 018121c9..8cbc29e1 100644 --- a/hamocc/hamocc_init.F90 +++ b/hamocc/hamocc_init.F90 @@ -47,7 +47,7 @@ subroutine hamocc_init(read_rest,rstfnm_hamocc) & sedspin_yr_s,sedspin_yr_e,sedspin_ncyc, & & dtb,dtbgc,io_stdo_bgc,ldtbgc, & & ldtrunbgc,ndtdaybgc,with_dmsph,l_3Dvarsedpor - use mo_param1_bgc, only: ks,init_por2octra_mapping + use mo_param1_bgc, only: ks,init_por2octra_mapping,init_indices use mo_param_bgc, only: ini_parambgc use mo_carbch, only: alloc_mem_carbch,ocetra,atm,atm_co2 use mo_biomod, only: alloc_mem_biomod diff --git a/hamocc/mo_biomod.F90 b/hamocc/mo_biomod.F90 index f498033f..a28e2dc6 100644 --- a/hamocc/mo_biomod.F90 +++ b/hamocc/mo_biomod.F90 @@ -106,16 +106,13 @@ MODULE mo_biomod REAL :: c14fac REAL :: re1312,re14to,prei13,prei14 REAL :: bifr13,bifr14,growth_co2,bifr13_perm - ! AGG REAL :: SinkExp, FractDim, Stick, cellmass, cellsink, fsh, fse REAL :: alow1, alow2,alow3,alar1,alar2,alar3,TSFac,TMFac REAL :: vsmall,safe,pupper,plower,zdis,nmldmin REAL :: dustd1,dustd2,dustd3,dustsink,calmax - ! WLIN REAL :: wmin,wmax,wlin - ! BROMO REAL :: rbro diff --git a/hamocc/mo_param1_bgc.F90 b/hamocc/mo_param1_bgc.F90 index 51be26b1..54199be5 100644 --- a/hamocc/mo_param1_bgc.F90 +++ b/hamocc/mo_param1_bgc.F90 @@ -1,19 +1,19 @@ -! Copyright (C) 2003 P. Wetzel +! Copyright (C) 2003 P. Wetzel ! Copyright (C) 2020 K. Assmann, J. Tjiputra, 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. +! 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 +! 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. +! more details. ! -! You should have received a copy of the GNU Lesser General Public License +! You should have received a copy of the GNU Lesser General Public License ! along with BLOM. If not, see https://www.gnu.org/licenses/. @@ -24,249 +24,364 @@ MODULE mo_param1_bgc ! ! Patrick Wetzel *MPI-Met, HH* 01.09.03 ! -! +! ! Modified ! -------- ! J.Schwinger, *NORCE Climate, Bergen* 2020-05-26 ! -! - To facilitate easier use of 'only-lists' in use statements, make indices +! - To facilitate easier use of 'only-lists' in use statements, make indices ! always defined also in case they are inside a #ifdef directive. -! +! ! ! Purpose ! ------- ! - definition of indices in tracer arrays ! !****************************************************************************** - use mo_control_bgc, only: use_cisonew + !use mo_control_bgc, only: use_cisonew + use mo_control_bgc implicit none - - INTEGER, PARAMETER :: ks=12,ksp=ks+1 ! ks: nb of sediment layers + public + INTEGER, PARAMETER :: ks=12,ksp=ks+1 ! ks: nb of sediment layers REAL, PARAMETER :: safediv = 1.0e-25 ! added to the denominator of isotopic ratios (avoid div. by zero) -! Tracer indices - INTEGER, PARAMETER :: i_base=22, & - & isco212 =1, & - & ialkali =2, & - & iphosph =3, & - & ioxygen =4, & - & igasnit =5, & - & iano3 =6, & - & isilica =7, & - & idoc =8, & - & iphy =9, & - & izoo =10, & - & idet =11, & - & icalc =12, & - & iopal =13, & - & ian2o =14, & - & idms =15, & - & iiron =16, & - & ifdust =17, & - & iprefo2 =18, & - & iprefpo4 =19, & - & iprefalk =20, & - & iprefdic =21, & - & idicsat =22 -#ifdef cisonew - INTEGER, PARAMETER :: i_iso=12, & - & isco213 = i_base+1, & - & isco214 = i_base+2, & - & idoc13 = i_base+3, & - & idoc14 = i_base+4, & - & iphy13 = i_base+5, & - & iphy14 = i_base+6, & - & izoo13 = i_base+7, & - & izoo14 = i_base+8, & - & idet13 = i_base+9, & - & idet14 = i_base+10, & - & icalc13 = i_base+11, & - & icalc14 = i_base+12 -#else - INTEGER, PARAMETER :: i_iso=0, & - & isco213 = -1, & - & isco214 = -1, & - & idoc13 = -1, & - & idoc14 = -1, & - & iphy13 = -1, & - & iphy14 = -1, & - & izoo13 = -1, & - & izoo14 = -1, & - & idet13 = -1, & - & idet14 = -1, & - & icalc13 = -1, & - & icalc14 = -1 -#endif -#ifdef CFC - INTEGER, PARAMETER :: i_cfc=3, & - & icfc11 = i_base+i_iso+1, & - & icfc12 = i_base+i_iso+2, & - & isf6 = i_base+i_iso+3 -#else - INTEGER, PARAMETER :: i_cfc=0, & - & icfc11 = -1, & - & icfc12 = -1, & - & isf6 = -1 -#endif -#ifdef AGG - INTEGER, PARAMETER :: i_agg=2, & - & inos = i_base+i_iso+i_cfc+1, & - & iadust = i_base+i_iso+i_cfc+2 -#else - INTEGER, PARAMETER :: i_agg=0, & - & inos = -1, & - & iadust = -1 -#endif -#ifdef natDIC - INTEGER, PARAMETER :: i_nat_dic=3, & - & inatsco212 = i_base+i_iso+i_cfc+i_agg+1, & - & inatalkali = i_base+i_iso+i_cfc+i_agg+2, & - & inatcalc = i_base+i_iso+i_cfc+i_agg+3 -#else - INTEGER, PARAMETER :: i_nat_dic=0, & - & inatsco212 = -1, & - & inatalkali = -1, & - & inatcalc = -1 -#endif -#ifdef BROMO - INTEGER, PARAMETER :: i_bromo=1, & - & ibromo=i_base+i_iso+i_cfc+i_agg+i_nat_dic+1 -#else - INTEGER, PARAMETER :: i_bromo=0, & - & ibromo=-1 -#endif + ! Tracer indices + integer :: i_base + integer :: isco212 + integer :: ialkali + integer :: iphosph + integer :: ioxygen + integer :: igasnit + integer :: iano3 + integer :: isilica + integer :: idoc + integer :: iphy + integer :: izoo + integer :: idet + integer :: icalc + integer :: iopal + integer :: ian2o + integer :: idms + integer :: iiron + integer :: ifdust + integer :: iprefo2 + integer :: iprefpo4 + integer :: iprefalk + integer :: iprefdic + integer :: idicsat -! total number of advected tracers - INTEGER, PARAMETER :: nocetra=i_base+i_iso+i_cfc+i_agg+i_nat_dic & - +i_bromo + integer :: i_iso + integer :: isco213 + integer :: isco214 + integer :: idoc13 + integer :: idoc14 + integer :: iphy13 + integer :: iphy14 + integer :: izoo13 + integer :: izoo14 + integer :: idet13 + integer :: idet14 + integer :: icalc13 + integer :: icalc14 + integer :: i_cfc + integer :: icfc11 + integer :: icfc12 + integer :: isf6 -! ATMOSPHERE - INTEGER, PARAMETER :: i_base_atm=5, & - & iatmco2=1, & - & iatmo2 =2, & - & iatmn2 =3, & - & iatmn2o=4, & - & iatmdms=5 + integer :: i_agg + integer :: inos + integer :: iadust -#ifdef cisonew - INTEGER, PARAMETER :: i_iso_atm = 2, & - & iatmc13 = i_base_atm+1, & - & iatmc14 = i_base_atm+2 -#else - INTEGER, PARAMETER :: i_iso_atm = 0, & - & iatmc13 = -1, & - & iatmc14 = -1 -#endif + integer :: i_nat_dic + integer :: inatsco212 + integer :: inatalkali + integer :: inatcalc -#ifdef CFC - INTEGER, PARAMETER :: i_cfc_atm = 3, & - & iatmf11 = i_base_atm+i_iso_atm+1, & - & iatmf12 = i_base_atm+i_iso_atm+2, & - & iatmsf6 = i_base_atm+i_iso_atm+3 -#else - INTEGER, PARAMETER :: i_cfc_atm = 0, & - & iatmf11 = -1, & - & iatmf12 = -1, & - & iatmsf6 = -1 -#endif + integer :: i_bromo + integer :: ibromo -#ifdef natDIC - INTEGER, PARAMETER :: i_ndic_atm = 1, & - & iatmnco2 = i_base_atm+i_iso_atm+i_cfc_atm+1 -#else - INTEGER, PARAMETER :: i_ndic_atm = 0, & - & iatmnco2 = -1 -#endif -#ifdef BROMO - INTEGER, PARAMETER :: i_bromo_atm=1, & - & iatmbromo=i_base_atm+i_iso_atm+i_cfc_atm+ & - & i_ndic_atm+1 -#else - INTEGER, PARAMETER :: i_bromo_atm=0, & - & iatmbromo=-1 -#endif + ! total number of advected tracers + integer :: nocetra -! total number of atmosphere tracers - INTEGER, PARAMETER :: natm=i_base_atm+i_iso_atm+i_cfc_atm+i_ndic_atm+i_bromo_atm + ! atmosphere + integer :: i_base_atm + integer :: iatmco2 + integer :: iatmo2 + integer :: iatmn2 + integer :: iatmn2o + integer :: iatmdms + integer :: i_iso_atm + integer :: iatmc13 + integer :: iatmc14 + integer :: i_cfc_atm + integer :: iatmf11 + integer :: iatmf12 + integer :: iatmsf6 + integer :: i_ndic_atm + integer :: iatmnco2 + integer :: i_bromo_atm + integer :: iatmbromo + integer :: natm ! total number of atmosphere tracers -! rivers - integer, parameter :: nriv =7 ! size of river input field - integer, parameter :: irdin =1, & ! dissolved inorganic nitrogen - & irdip =2, & ! dissolved inorganic phosphorous - & irsi =3, & ! dissolved silicate - & iralk =4, & ! alkalinity - & iriron =5, & ! dissolved bioavailable iron - & irdoc =6, & ! dissolved organic carbon - & irdet =7 ! particulate carbon + ! rivers + integer :: nriv ! size of river input field + integer :: irdin ! dissolved inorganic nitrogen + integer :: irdip ! dissolved inorganic phosphorous + integer :: irsi ! dissolved silicate + integer :: iralk ! alkalinity + integer :: iriron ! dissolved bioavailable iron + integer :: irdoc ! dissolved organic carbon + integer :: irdet ! particulate carbon - -! --- sediment - ! sediment solid components - INTEGER, PARAMETER :: i_sed_base = 4 - INTEGER, PARAMETER :: issso12=1, & - & isssc12=2, & - & issssil=3, & - & issster=4 -#ifdef cisonew - INTEGER, PARAMETER :: i_sed_cisonew = 4 - INTEGER, PARAMETER :: issso13 = i_sed_base+1, & - & issso14 = i_sed_base+2, & - & isssc13 = i_sed_base+3, & - & isssc14 = i_sed_base+4 -#else - INTEGER, PARAMETER :: i_sed_cisonew = 0 - INTEGER, PARAMETER :: issso13 = -1, & - & issso14 = -1, & - & isssc13 = -1, & - & isssc14 = -1 -#endif - INTEGER, PARAMETER :: nsedtra = i_sed_base + i_sed_cisonew + ! --- sediment + ! sediment solid components + integer :: i_sed_base + integer :: issso12 + integer :: isssc12 + integer :: issssil + integer :: issster + integer :: i_sed_cisonew + integer :: issso13 + integer :: issso14 + integer :: isssc13 + integer :: isssc14 + integer :: nsedtra - ! sediment pore water components - INTEGER, PARAMETER :: i_pow_base=7 - INTEGER, PARAMETER :: ipowaic=1, & - & ipowaal=2, & - & ipowaph=3, & - & ipowaox=4, & - & ipown2 =5, & - & ipowno3=6, & - & ipowasi=7 -#ifdef cisonew - INTEGER, PARAMETER :: i_pow_cisonew = 2 - INTEGER, PARAMETER :: ipowc13=i_pow_base + 1, & - & ipowc14=i_pow_base + 2 -#else - INTEGER, PARAMETER :: i_pow_cisonew = 0 - INTEGER, PARAMETER :: ipowc13 = -1, & - & ipowc14 = -1 -#endif - INTEGER, PARAMETER :: npowtra = i_pow_base + i_pow_cisonew - - ! Mapping between pore water and ocean tracers needed for pore water diffusion - INTEGER, SAVE :: map_por2octra(-1:npowtra) - - contains + ! sediment pore water components + integer :: i_pow_base + integer :: ipowaic + integer :: ipowaal + integer :: ipowaph + integer :: ipowaox + integer :: ipown2 + integer :: ipowno3 + integer :: ipowasi + integer :: i_pow_cisonew + integer :: ipowc13 + integer :: ipowc14 + integer :: npowtra + + ! Mapping between pore water and ocean tracers needed for pore water diffusion + integer, allocatable :: map_por2octra(:) + + contains subroutine init_por2octra_mapping() - - map_por2octra(ipowaic) = isco212 - map_por2octra(ipowaal) = ialkali - map_por2octra(ipowaph) = iphosph - map_por2octra(ipowaox) = ioxygen - map_por2octra(ipown2) = igasnit - map_por2octra(ipowno3) = iano3 - map_por2octra(ipowasi) = isilica + map_por2octra(ipowaic) = isco212 + map_por2octra(ipowaal) = ialkali + map_por2octra(ipowaph) = iphosph + map_por2octra(ipowaox) = ioxygen + map_por2octra(ipown2) = igasnit + map_por2octra(ipowno3) = iano3 + map_por2octra(ipowasi) = isilica if (use_cisonew) then - map_por2octra(ipowc13) = isco213 + map_por2octra(ipowc13) = isco213 map_por2octra(ipowc14) = isco214 end if - end subroutine init_por2octra_mapping + subroutine init_indices() + + ! Tracer indices + i_base = 22 + isco212 = 1 + ialkali = 2 + iphosph = 3 + ioxygen = 4 + igasnit = 5 + iano3 = 6 + isilica = 7 + idoc = 8 + iphy = 9 + izoo = 10 + idet = 11 + icalc = 12 + iopal = 13 + ian2o = 14 + idms = 15 + iiron = 16 + ifdust = 17 + iprefo2 = 18 + iprefpo4 = 19 + iprefalk = 20 + iprefdic = 21 + idicsat = 22 + if (use_cisonew) then + i_iso = 12 + isco213 = i_base+1 + isco214 = i_base+2 + idoc13 = i_base+3 + idoc14 = i_base+4 + iphy13 = i_base+5 + iphy14 = i_base+6 + izoo13 = i_base+7 + izoo14 = i_base+8 + idet13 = i_base+9 + idet14 = i_base+10 + icalc13 = i_base+11 + icalc14 = i_base+12 + else + i_iso = 0 + isco213 = -1 + isco214 = -1 + idoc13 = -1 + idoc14 = -1 + iphy13 = -1 + iphy14 = -1 + izoo13 = -1 + izoo14 = -1 + idet13 = -1 + idet14 = -1 + icalc13 = -1 + icalc14 = -1 + end if + if (use_CFC) then + i_cfc=3 + icfc11 = i_base+i_iso+1 + icfc12 = i_base+i_iso+2 + isf6 = i_base+i_iso+3 + else + i_cfc=0 + icfc11 = -1 + icfc12 = -1 + isf6 = -1 + end if + if (use_AGG) then + i_agg=2 + inos = i_base+i_iso+i_cfc+1 + iadust = i_base+i_iso+i_cfc+2 + else + i_agg=0 + inos = -1 + iadust = -1 + end if + if (use_natDIC) then + i_nat_dic=3 + inatsco212 = i_base+i_iso+i_cfc+i_agg+1 + inatalkali = i_base+i_iso+i_cfc+i_agg+2 + inatcalc = i_base+i_iso+i_cfc+i_agg+3 + else + i_nat_dic=0 + inatsco212 = -1 + inatalkali = -1 + inatcalc = -1 + end if + if (use_BROMO) then + i_bromo=1 + ibromo=i_base+i_iso+i_cfc+i_agg+i_nat_dic+1 + else + i_bromo=0 + ibromo=-1 + end if + + ! total number of advected tracers + nocetra=i_base+i_iso+i_cfc+i_agg+i_nat_dic +i_bromo + + ! ATMOSPHERE + i_base_atm=5 + iatmco2=1 + iatmo2 =2 + iatmn2 =3 + iatmn2o=4 + iatmdms=5 + if (use_cisonew) then + i_iso_atm = 2 + iatmc13 = i_base_atm+1 + iatmc14 = i_base_atm+2 + else + i_iso_atm = 0 + iatmc13 = -1 + iatmc14 = -1 + end if + if (use_CFC) then + i_cfc_atm = 3 + iatmf11 = i_base_atm+i_iso_atm+1 + iatmf12 = i_base_atm+i_iso_atm+2 + iatmsf6 = i_base_atm+i_iso_atm+3 + else + i_cfc_atm = 0 + iatmf11 = -1 + iatmf12 = -1 + iatmsf6 = -1 + end if + if (use_natDIC) then + i_ndic_atm = 1 + iatmnco2 = i_base_atm+i_iso_atm+i_cfc_atm+1 + else + i_ndic_atm = 0 + iatmnco2 = -1 + end if + if (use_BROMO) then + i_bromo_atm=1 + iatmbromo=i_base_atm+i_iso_atm+i_cfc_atm+ i_ndic_atm+1 + else + i_bromo_atm=0 + iatmbromo=-1 + end if + + ! total number of atmosphere tracers + natm=i_base_atm+i_iso_atm+i_cfc_atm+i_ndic_atm+i_bromo_atm + + ! rivers + nriv =7 + irdin =1 + irdip =2 + irsi =3 + iralk =4 + iriron =5 + irdoc =6 + irdet =7 + + ! --- sediment + ! sediment solid components + i_sed_base = 4 + issso12 = 1 + isssc12 = 2 + issssil = 3 + issster = 4 + if (use_cisonew) then + i_sed_cisonew = 4 + issso13 = i_sed_base+1 + issso14 = i_sed_base+2 + isssc13 = i_sed_base+3 + isssc14 = i_sed_base+4 + else + i_sed_cisonew = 0 + issso13 = -1 + issso14 = -1 + isssc13 = -1 + isssc14 = -1 + end if + nsedtra = i_sed_base + i_sed_cisonew + + ! sediment pore water components + i_pow_base =7 + ipowaic =1 + ipowaal =2 + ipowaph =3 + ipowaox =4 + ipown2 =5 + ipowno3 =6 + ipowasi =7 + if (use_cisonew) then + i_pow_cisonew = 2 + ipowc13=i_pow_base + 1 + ipowc14=i_pow_base + 2 + else + i_pow_cisonew = 0 + ipowc13 = -1 + ipowc14 = -1 + end if + npowtra = i_pow_base + i_pow_cisonew + + allocate(map_por2octra(-1:npowtra)) + + end subroutine init_indices + !****************************************************************************** - END MODULE mo_param1_bgc + END MODULE mo_param1_bgc diff --git a/hamocc/mo_param_bgc.F90 b/hamocc/mo_param_bgc.F90 index 8ca09a72..7623c717 100644 --- a/hamocc/mo_param_bgc.F90 +++ b/hamocc/mo_param_bgc.F90 @@ -50,7 +50,7 @@ module mo_param_bgc & ropal,spemor,tf0,tf1,tf2,tff,wcal,wdust,wopal,wpoc,zinges use mo_sedmnt, only: claydens,o2ut,rno3 use mo_control_bgc, only: io_stdo_bgc,bgc_namelist - use mo_control_bgc, only: use_AGG, use_natDIC, use_BROMO, use_cisonew + use mo_control_bgc, only: use_AGG, use_natDIC, use_BROMO, use_cisonew, use_WLIN use mo_param1_bgc, only: iatmco2,iatmnco2,iatmo2,iatmn2,iatmc13,iatmc14,iatmbromo use mod_xc, only: mnproc ! agg @@ -352,7 +352,7 @@ subroutine ini_param_biol() wpoc = 5. !m/d Sinking speed of detritus iris : 5. wcal = 30. !m/d Sinking speed of CaCO3 shell material wopal = 30. !m/d Sinking speed of opal iris : 60 - if (use_WLIN .and. use_AGG) then + if (use_WLIN .and. .not. use_AGG) then wmin = 1. !m/d minimum sinking speed wmax = 60. !m/d maximum sinking speed wlin = 60./2400. !m/d/m constant describing incr. with depth, r/a=1.0 @@ -456,7 +456,7 @@ subroutine rates_2_timestep() wpoc = wpoc*dtb !m/d Sinking speed detritusiris : 5. wcal = wcal*dtb !m/d Sinking speed CaCO3 wopal = wopal*dtb !m/d Sinking speed opal iris : 60 - if (use_WLIN .and. use_AGG) then + if (use_WLIN .and. .not. use_AGG) then wmin = wmin*dtb !m/d minimum sinking speed wmax = wmax*dtb !m/d maximum sinking speed wlin = wlin*dtb !m/d/m constant describing incr. with depth, r/a=1.0 @@ -620,7 +620,7 @@ subroutine write_parambgc() WRITE(io_stdo_bgc,*) '* fbro1 = ',fbro1 WRITE(io_stdo_bgc,*) '* fbro2 = ',fbro2 end if - if (use_WLIN .and. use_AGG) then + if (use_WLIN .and. .not. use_AGG) then WRITE(io_stdo_bgc,*) '* wmin = ',wmin WRITE(io_stdo_bgc,*) '* wmax = ',wmax WRITE(io_stdo_bgc,*) '* wlin = ',wlin diff --git a/phy/restart_wt.F b/phy/restart_wt.F index 60b5760a..619d8607 100644 --- a/phy/restart_wt.F +++ b/phy/restart_wt.F @@ -62,9 +62,9 @@ subroutine restart_wt use mod_seaice, only: ficem, hicem, hsnwm, iagem #if defined(TRC) && (defined(TKE) || defined(IDLAGE)) use mod_tracers, only: itrtke, itrgls, itriag, trc -# ifdef TKE +#ifdef TKE use mod_tke, only: L_scale -# endif +#endif #endif #ifdef HAMOCC use mo_control_bgc, only : use_BROMO @@ -906,6 +906,9 @@ subroutine defvar_restart(c5p,c5u,c5v,c5q) c --- ------------------------------------------------------------------ use mod_dia use mod_forcing, only: sprfac +#ifdef HAMOCC + use mo_control_bgc, only : use_BROMO +#endif c implicit none c diff --git a/trc/mod_tracers.F90 b/trc/mod_tracers.F90 index 6952fa40..85d27d34 100644 --- a/trc/mod_tracers.F90 +++ b/trc/mod_tracers.F90 @@ -90,7 +90,7 @@ subroutine allocate_tracers ! --------------------------------------------------------------------------- #ifdef HAMOCC - use mo_param1_bgc, only: nocetra + use mo_param1_bgc, only: init_indices, nocetra #endif implicit none @@ -100,6 +100,7 @@ subroutine allocate_tracers ! Number of HAMOCC tracers. #ifdef HAMOCC + call init_indices() ntrbgc = nocetra itrbgc = ntrocn - natr + ntrtke + ntrgls + ntriag + 1 #else From f9ba742674ff5c79ae22bd3c0021d258dfa95ffc Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Fri, 13 Oct 2023 15:38:56 +0200 Subject: [PATCH 44/52] fixed compile problem --- drivers/nuopc/mod_nuopc_methods.F90 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/nuopc/mod_nuopc_methods.F90 b/drivers/nuopc/mod_nuopc_methods.F90 index 91d964dc..bcf1a183 100644 --- a/drivers/nuopc/mod_nuopc_methods.F90 +++ b/drivers/nuopc/mod_nuopc_methods.F90 @@ -856,14 +856,14 @@ subroutine blom_importflds(fldlist_num, fldlist) ! CO2 flux + index_co2 = -1 +#ifdef HAMOCC if (use_DIAGCO2 .and. index_Sa_co2diag > 0) then index_co2 = index_Sa_co2diag else if (use_PROGCO2 .and. index_Sa_co2prog > 0) then index_co2 = index_Sa_co2prog - else - index_co2 = -1 end if - +#endif if (index_co2 > 0) then !$omp parallel do private(i, n) do j = 1, jjcpl From 432d54329cc7cda31113e832fa3e98cf3fd56c6b Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Sun, 15 Oct 2023 15:32:45 +0200 Subject: [PATCH 45/52] addressed problems in PR review for aufr_bgc.F90 --- hamocc/aufr_bgc.F90 | 67 +++++++++++++++++++++++++++------------------ 1 file changed, 41 insertions(+), 26 deletions(-) diff --git a/hamocc/aufr_bgc.F90 b/hamocc/aufr_bgc.F90 index 37318b6b..ab699cf3 100644 --- a/hamocc/aufr_bgc.F90 +++ b/hamocc/aufr_bgc.F90 @@ -5,16 +5,16 @@ ! 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. +! 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 +! 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. +! more details. ! -! You should have received a copy of the GNU Lesser General Public License +! You should have received a copy of the GNU Lesser General Public License ! along with BLOM. If not, see https://www.gnu.org/licenses/. @@ -43,7 +43,7 @@ SUBROUTINE AUFR_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & ! and "NOMPI" ! ! J.Schwinger, *GFI, Bergen* 2014-05-21 -! - adapted code for writing of two time level tracer +! - adapted code for writing of two time level tracer ! and sediment fields ! ! A.Moree, *GFI, Bergen* 2018-04-12 @@ -57,7 +57,7 @@ SUBROUTINE AUFR_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & ! observed d13C and d14C). This is used if c-isotope fields are ! not found in the restart file. ! - consistently organised restart of CFC and natural tracers -! from scratch, i.e. for the case that CFC and natural tracers are +! from scratch, i.e. for the case that CFC and natural tracers are ! not found in the restart file. ! - removed satn2o which is not needed to restart the model ! - added sediment bypass preprocessor option @@ -76,9 +76,9 @@ SUBROUTINE AUFR_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & ! ------- ! The bgc data are read from an extra file, other than the ocean data. ! The time stamp of the bgc restart file (idate) is specified from the -! ocean time stamp through the SBR parameter list of AUFW_BGC. The only -! time control variable proper to the bgc is the time step number -! (idate(5)). It can differ from that of the ocean (idate(4)) by the +! ocean time stamp through the SBR parameter list of AUFW_BGC. The only +! time control variable proper to the bgc is the time step number +! (idate(5)). It can differ from that of the ocean (idate(4)) by the ! difference of the offsets of restart files. ! ! @@ -91,7 +91,7 @@ SUBROUTINE AUFR_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & ! *INTEGER* *ntr* - number of tracers in tracer field ! *INTEGER* *ntrbgc* - number of biogechemical tracers in tracer field ! *INTEGER* *itrbgc* - start index for biogeochemical tracers in tracer field -! *REAL* *trc* - initial/restart tracer field to be passed to the +! *REAL* *trc* - initial/restart tracer field to be passed to the ! ocean model [mol/kg] ! *INTEGER* *kplyear* - year in ocean restart date ! *INTEGER* *kplmon* - month in ocean restart date @@ -102,7 +102,7 @@ SUBROUTINE AUFR_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & ! !************************************************************************** - use netcdf, only: nf90_global,nf90_noerr,nf90_nowrite,nf90_close,nf90_open,nf90_get_att,nf90_inq_varid + use netcdf, only: nf90_global,nf90_noerr,nf90_nowrite,nf90_close,nf90_open,nf90_get_att,nf90_inq_varid use mo_carbch, only: co2star,co3,hi,satoxy use mo_control_bgc, only: io_stdo_bgc,ldtbgc use mo_param1_bgc, only: ialkali,ian2o,iano3,icalc,idet,idicsat,idms,idoc,ifdust,igasnit,iiron,iopal,ioxygen,iphosph,iphy,& @@ -276,7 +276,7 @@ SUBROUTINE AUFR_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & & ,kplday,'/',restday,' !!!' ENDIF - ENDIF + ENDIF ! Find out whether to restart CFCs if (use_CFC) then @@ -380,7 +380,7 @@ SUBROUTINE AUFR_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & end if ! ! Read restart data : ocean aquateous tracer -! +! CALL read_netcdf_var(ncid,'sco212',locetra(1,1,1,isco212),2*kpke,0,iotype) CALL read_netcdf_var(ncid,'alkali',locetra(1,1,1,ialkali),2*kpke,0,iotype) CALL read_netcdf_var(ncid,'phosph',locetra(1,1,1,iphosph),2*kpke,0,iotype) @@ -479,7 +479,6 @@ SUBROUTINE AUFR_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & CALL read_netcdf_var(ncid,'powasi',powtra2(1,1,1,ipowasi),2*ks,0,iotype) if (use_cisonew) then IF(lread_iso) THEN - ! Burial fields for c-isotopes still missing CALL read_netcdf_var(ncid,'ssso13',sedlay2(1,1,1,issso13),2*ks,0,iotype) CALL read_netcdf_var(ncid,'ssso14',sedlay2(1,1,1,issso14),2*ks,0,iotype) CALL read_netcdf_var(ncid,'sssc13',sedlay2(1,1,1,isssc13),2*ks,0,iotype) @@ -559,12 +558,12 @@ SUBROUTINE AUFR_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & ! 13C is read in as delta13C, convert to 13C using model restart total C beta13=locetra(i,j,k,isco213)/1000.+1. locetra(i,j,k,isco213)=locetra(i,j,k,isco212)*beta13*re1312/(1.+beta13*re1312) - - ! 14C is read in as delta14C, convert to 14C using model restart total C, + + ! 14C is read in as delta14C, convert to 14C using model restart total C, ! normalize 14C by c14fac to prevent numerical errors beta14=locetra(i,j,k,isco214)/1000.+1. locetra(i,j,k,isco214)=locetra(i,j,k,isco212)*beta14*re14to/c14fac - + ! Initialise the remaining 13C and 14C fields, using the restart isco212 field rco213=locetra(i,j,k,isco213)/(locetra(i,j,k,isco212)+safediv) rco214=locetra(i,j,k,isco214)/(locetra(i,j,k,isco212)+safediv) @@ -582,12 +581,12 @@ SUBROUTINE AUFR_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & ENDDO ENDDO ENDDO - + if (.not. use_sedbypass) then ! Burial fields for c-isotopes still missing DO k=1,2*ks DO j=1,kpje - DO i=1,kpie + DO i=1,kpie IF(omask(i,j) .GT. 0.5) THEN rco213=ocetra(i,j,kbo(i,j),isco213)/(ocetra(i,j,kbo(i,j),isco212)+safediv) rco214=ocetra(i,j,kbo(i,j),isco214)/(ocetra(i,j,kbo(i,j),isco212)+safediv) @@ -601,13 +600,29 @@ SUBROUTINE AUFR_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & ENDDO ENDDO ENDDO - end if + + DO k=1,2 + DO j=1,kpje + DO i=1,kpie + IF(omask(i,j) .GT. 0.5) THEN + rco213=ocetra(i,j,kbo(i,j),isco213)/(ocetra(i,j,kbo(i,j),isco212)+safediv) + rco214=ocetra(i,j,kbo(i,j),isco214)/(ocetra(i,j,kbo(i,j),isco212)+safediv) + burial2(i,j,k,issso13)=burial2(i,j,k,issso12)*rco213*bifr13 + burial2(i,j,k,issso14)=burial2(i,j,k,issso12)*rco214*bifr14 + burial2(i,j,k,isssc13)=burial2(i,j,k,isssc12)*rco213 + burial2(i,j,k,isssc14)=burial2(i,j,k,isssc12)*rco214 + ENDIF + ENDDO + ENDDO + ENDDO + + end if ! .NOT. use_sedbypass ENDIF ! .NOT. lread_iso - end if + end if ! use_cisonew ! return tracer fields to ocean model (both timelevels); No unit -! conversion here, since tracers in the restart file are in -! BLOM units (mol/kg) +! conversion here, since tracers in the restart file are in +! BLOM units (mol/kg) !-------------------------------------------------------------------- ! trc(1:kpie,1:kpje,:,itrbgc:itrbgc+ntrbgc-1)=locetra(:,:,:,:) From 5aac0da6732466c29c5323f070d00180743b760e Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Sun, 15 Oct 2023 15:33:26 +0200 Subject: [PATCH 46/52] removed reintroduction of buildnml.csh --- cime_config/buildnml.csh | 1674 -------------------------------------- 1 file changed, 1674 deletions(-) delete mode 100644 cime_config/buildnml.csh diff --git a/cime_config/buildnml.csh b/cime_config/buildnml.csh deleted file mode 100644 index caf1f533..00000000 --- a/cime_config/buildnml.csh +++ /dev/null @@ -1,1674 +0,0 @@ -#! /bin/csh -f - -#------------------------------------------------------------------------------ -# Get variables from Case XML-files -#------------------------------------------------------------------------------ - -set CASEROOT = `./xmlquery CASEROOT --value` -set OCN_GRID = `./xmlquery OCN_GRID --value` -set BLOM_VCOORD = `./xmlquery BLOM_VCOORD --value` -set BLOM_UNIT = `./xmlquery BLOM_UNIT --value` -set DIN_LOC_ROOT = `./xmlquery DIN_LOC_ROOT --value` -set RUN_TYPE = `./xmlquery RUN_TYPE --value` -set CONTINUE_RUN = `./xmlquery CONTINUE_RUN --value` -set CASEBUILD = `./xmlquery CASEBUILD --value` -set CCSM_CO2_PPMV = `./xmlquery CCSM_CO2_PPMV --value` -set OCN_NCPL = `./xmlquery OCN_NCPL --value` -set BLOM_COUPLING = `./xmlquery BLOM_COUPLING --value` -set RUNDIR = `./xmlquery RUNDIR --value` -set BLOM_TRACER_MODULES = `./xmlquery BLOM_TRACER_MODULES --value` -set BLOM_RIVER_NUTRIENTS = `./xmlquery BLOM_RIVER_NUTRIENTS --value` -set BLOM_N_DEPOSITION = `./xmlquery BLOM_N_DEPOSITION --value` -set BLOM_NDEP_SCENARIO = `./xmlquery BLOM_NDEP_SCENARIO --value` -set HAMOCC_VSLS = `./xmlquery HAMOCC_VSLS --value` -set HAMOCC_CISO = `./xmlquery HAMOCC_CISO --value` -set HAMOCC_SEDSPINUP = `./xmlquery HAMOCC_SEDSPINUP --value` -set HAMOCC_SEDSPINUP_YR_START = `./xmlquery HAMOCC_SEDSPINUP_YR_START --value` -set HAMOCC_SEDSPINUP_YR_END = `./xmlquery HAMOCC_SEDSPINUP_YR_END --value` -set HAMOCC_SEDSPINUP_NCYCLE = `./xmlquery HAMOCC_SEDSPINUP_NCYCLE --value` -set RUN_STARTDATE = `./xmlquery RUN_STARTDATE --value` -set PIO_TYPENAME_OCN = `./xmlquery PIO_TYPENAME_OCN --value` -set PIO_NETCDF_FORMAT_OCN = `./xmlquery PIO_NETCDF_FORMAT_OCN --value` -set NINST_OCN = `./xmlquery NINST_OCN --value` -set TEST=`./xmlquery TEST --value` - -#------------------------------------------------------------------------------ -# Check if HAMOCC is requested -#------------------------------------------------------------------------------ - -set ecosys = FALSE -set tracers = (`echo $BLOM_TRACER_MODULES`) -if ($#tracers != 0) then - foreach module ($tracers) - if ($module == ecosys) then - set ecosys = TRUE - endif - end -endif - -#------------------------------------------------------------------------------ -# Set RUN_TYPE to 'continue' if CONTINUE_RUN equals TRUE -#------------------------------------------------------------------------------ - -if ("$CONTINUE_RUN" == TRUE) then - set RUN_TYPE = continue -endif - -#------------------------------------------------------------------------------ -# Get start date -#------------------------------------------------------------------------------ - -set YEAR0 = `echo $RUN_STARTDATE | cut -c1-4 ` -set MONTH0 = `echo $RUN_STARTDATE | cut -c6-7 ` -set DAY0 = `echo $RUN_STARTDATE | cut -c9-10` - -#------------------------------------------------------------------------------ -# Set namelist variables -#------------------------------------------------------------------------------ - -#------------------------------ -# set LIMITS defaults -#------------------------------ -set NDAY1 = 0 -set NDAY2 = 0 -set IDATE = $YEAR0$MONTH0$DAY0 -set IDATE0 = $YEAR0$MONTH0$DAY0 -set RUNID = "'unset'" -set EXPCNF = "'cesm'" -set RUNTYP = "'$RUN_TYPE'" -set GRFILE = "'unset'" -set ICFILE = "'unset'" -if ("$BLOM_UNIT" == cgs) then - set PREF = 2000.e5 -else - set PREF = 2000.e4 -endif -set BACLIN = 1800. -set BATROP = 36. -if ("$BLOM_UNIT" == cgs) then - set MDV2HI = 2. - set MDV2LO = .4 - set MDV4HI = 0. - set MDV4LO = 0. - set MDC2HI = 5000.e4 - set MDC2LO = 300.e4 -else - set MDV2HI = .02 - set MDV2LO = .004 - set MDV4HI = 0. - set MDV4LO = 0. - set MDC2HI = 5000. - set MDC2LO = 300. -endif -set VSC2HI = .5 -set VSC2LO = .5 -set VSC4HI = 0. -set VSC4LO = 0. -if ("$BLOM_UNIT" == cgs) then - set CBAR = 5. -else - set CBAR = .05 -endif -set CB = .002 -set CWBDTS = 5.e-5 -set CWBDLS = 25. -set MOMMTH = "'enscon'" -set BMCMTH = "'uc'" -set RMPMTH = "'eitvel'" -set MLRTTP = "'constant'" -set RM0 = 1.2 -set RM5 = 0. -set CE = .06 -set TDFILE = "'unset'" -set NIWGF = 0. -set NIWBF = .35 -set NIWLF = .5 -set SWAMTH = "'jerlov'" -set JWTYPE = 3 -set CHLOPT = "'climatology'" -set CCFILE = "'unset'" -set TRXDAY = 0. -set SRXDAY = 0. -set TRXDPT = 1. -set SRXDPT = 1. -set TRXLIM = 1.5 -set SRXLIM = .5 -set APTFLX = .false. -set APSFLX = .false. -set DITFLX = .false. -set DISFLX = .false. -set SRXBAL = .false. -set SCFILE = "'unset'" -set WAVSRC = "'none'" -set SMTFRC = .true. -set SPRFAC = .false. -set ATM_PATH = "'unset'" -set ITEST = 60 -set JTEST = 60 -set CNSVDI = .false. -set CSDIAG = .false. -set RSTFRQ = 1 -if ("$PIO_NETCDF_FORMAT_OCN" == 64bit_offset) then - set RSTFMT = 1 -else - set RSTFMT = 0 -endif -set RSTCMP = 0 -if ("$PIO_TYPENAME_OCN" == pnetcdf) then - set IOTYPE = 1 -else - set IOTYPE = 0 -endif - -#------------------------------ -# set VCOORD defaults -#------------------------------ -set VCOORD_TYPE = "'$BLOM_VCOORD'" -set RECONSTRUCTION_METHOD = "'ppm'" -set DENSITY_LIMITING = "'monotonic'" -set TRACER_LIMITING = "'non_oscillatory'" -set VELOCITY_LIMITING = "'non_oscillatory'" -set DENSITY_PC_UPPER_BNDR = .false. -set DENSITY_PC_LOWER_BNDR = .false. -set TRACER_PC_UPPER_BNDR = .true. -set TRACER_PC_LOWER_BNDR = .false. -set VELOCITY_PC_UPPER_BNDR = .true. -set VELOCITY_PC_LOWER_BNDR = .false. -set DPMIN_SURFACE = 2.5 -set DPMIN_INFLATION_FACTOR = 1.08 -set DPMIN_INTERIOR = .1 -set DKTZU = 4 -set DKTZL = 1 - -#------------------------------ -# set DIFFUSION defaults -#------------------------------ -set EITMTH = "'gm'" -set EDRITP = "'large scale'" -set EDWMTH = "'smooth'" -set EDDF2D = .false. -set EDSPRS = .true. -set EGC = 0.85 -set EGGAM = 200. -if ("$BLOM_UNIT" == cgs) then - set EGLSMN = 4000.e2 - set EGMNDF = 100.e4 - set EGMXDF = 1500.e4 -else - set EGLSMN = 4000. - set EGMNDF = 100. - set EGMXDF = 1500. -endif -set EGIDFQ = 1. -set TBFILE = "'unset'" -set RHISCF = 0. -set EDANIS = .false. -set REDI3D = .false. -set RHSCTP = .false. -set RI0 = 1.2 -set BDMTYP = 2 -if ("$BLOM_UNIT" == cgs) then - set BDMC1 = 5.e-4 - set BDMC2 = .1 -else - set BDMC1 = 5.e-8 - set BDMC2 = 1.e-5 -endif -set TKEPF = .006 -set SMOBLD = .true. -set LNGMTP = "'none'" -if ("$BLOM_VCOORD" == isopyc_bulkml) then - set BDMLDP = .true. - set LTEDTP = "'layer'" -else - set BDMLDP = .false. - set LTEDTP = "'neutral'" -endif - -#------------------------------ -# set BGCNML defaults -#------------------------------ -set ATM_CO2 = "$CCSM_CO2_PPMV" -if ("$BLOM_RIVER_NUTRIENTS" == TRUE) then - set DO_RIVINPT = .true. -else - set DO_RIVINPT = .false. -endif -if ("$BLOM_N_DEPOSITION" == TRUE) then - set DO_NDEP = .true. - if( "$BLOM_NDEP_SCENARIO" == 1850 && "$OCN_GRID" == tnx2v1) then - set NDEPFNAME = ndep_1850_CMIP6_tnx2v1_20180321.nc - else if( "$BLOM_NDEP_SCENARIO" == 1850 && "$OCN_GRID" == tnx1v4) then - set NDEPFNAME = ndep_1850_CMIP6_tnx1v4_20171106.nc - else if( "$BLOM_NDEP_SCENARIO" == 1850 && "$OCN_GRID" == tnx0.25v4) then - set NDEPFNAME = ndep_1850_CMIP6_tnx0.25v4_20190912.nc - else if( "$BLOM_NDEP_SCENARIO" == 1850 && "$OCN_GRID" == tnx0.125v4) then - set NDEPFNAME = ndep_1850_CMIP6_tnx0.125v4_20221013.nc - else if( "$BLOM_NDEP_SCENARIO" == 2000 && "$OCN_GRID" == tnx2v1) then - set NDEPFNAME = ndep_2000_CMIP6_tnx2v1_20200826.nc - else if( "$BLOM_NDEP_SCENARIO" == 2000 && "$OCN_GRID" == tnx1v4) then - set NDEPFNAME = ndep_2000_CMIP6_tnx1v4_20200826.nc - else if( "$BLOM_NDEP_SCENARIO" == 2000 && "$OCN_GRID" == tnx0.25v4) then - set NDEPFNAME = ndep_2000_CMIP6_tnx0.25v4_20200826.nc - else if( "$BLOM_NDEP_SCENARIO" == hist && "$OCN_GRID" == tnx2v1) then - set NDEPFNAME = ndep_185001-201412_tnx2v1_20190702.nc - else if( "$BLOM_NDEP_SCENARIO" == hist && "$OCN_GRID" == tnx1v4) then - set NDEPFNAME = ndep_185001-201412_tnx1v4_20180613.nc - else if( "$BLOM_NDEP_SCENARIO" == hist && "$OCN_GRID" == tnx0.25v4) then - set NDEPFNAME = ndep_185001-201412_tnx0.25v4_20190705.nc - else if( `echo $BLOM_NDEP_SCENARIO | cut -c1-3` == ssp && "$OCN_GRID" == tnx1v4) then - set NDEPFNAME = ndep_201501-210012-${BLOM_NDEP_SCENARIO}_tnx1v4_20191112.nc - else if( "$BLOM_NDEP_SCENARIO" == UNSET ) then - set DO_NDEP = .false. - set NDEPFNAME = "''" - endif -else - set DO_NDEP = .false. - set NDEPFNAME = "''" -endif -if ("$HAMOCC_SEDSPINUP" == TRUE) then - set DO_SEDSPINUP = .true. - set SEDSPIN_YR_S = $HAMOCC_SEDSPINUP_YR_START - set SEDSPIN_YR_E = $HAMOCC_SEDSPINUP_YR_END - set SEDSPIN_NCYC = $HAMOCC_SEDSPINUP_NCYCLE -else - set DO_SEDSPINUP = .false. - set SEDSPIN_YR_S = -1 - set SEDSPIN_YR_E = -1 - set SEDSPIN_NCYC = -1 -endif -# VSLS is currently only available for the tnx1v4 grid, since a climatlogy file for -# short wave radiation is needed. -if ("$HAMOCC_VSLS" == TRUE && "$OCN_GRID" != tnx1v4) then - echo "$0 ERROR: HAMOCC_VSLS == TRUE not possible with this grid resolution (no swa-climatology available) " - exit -1 -endif -# For the following options, there are currently no switches in Case-XML files. -# These options can be activated by expert users via user namelist. -set DO_OALK = .false. -set BGCOAFX_OALKSCEN = "''" -set BGCOAFX_OALKFILE = "''" -set BGCOAFX_ADDALK = 0.135 -set BGCOAFX_CDRMIP_LATMAX = 70.0 -set BGCOAFX_CDRMIP_LATMIN = -60.0 -set BGCOAFX_RAMP_START = 2025 -set BGCOAFX_RAMP_END = 2035 -set WITH_DMSPH = .false. -set PI_PH_FILE = "''" -set L_3DVARSEDPOR = .false. -set SEDPORFILE = "''" - - -#------------------------------ -# set DIAPHY defaults -#------------------------------ -set GLB_FNAMETAG = "'hd','hm','hy'" -set GLB_AVEPERIO = '1, 30, 365' -if ("$TEST" == TRUE) then - set GLB_FILEFREQ = '1, 30, 365' -else - set GLB_FILEFREQ = '30, 30, 365' -endif -set GLB_COMPFLAG = '0, 0, 0' -if ("$PIO_NETCDF_FORMAT_OCN" == 64bit_offset) then - set GLB_NCFORMAT = '1, 1, 1' -else - set GLB_NCFORMAT = '0, 0, 0' -endif -set H2D_ABSWND = '0, 4, 0' - -set H2D_ALB = '0, 0, 0' - -set H2D_BTMSTR = '0, 4, 0' -set H2D_BRNFLX = '0, 4, 0' -set H2D_BRNPD = '0, 4, 0' - -set H2D_DFL = '0, 0, 0' - -set H2D_EVA = '0, 4, 0' -set H2D_FICE = '0, 4, 0' -set H2D_FMLTFZ = '0, 4, 0' - -set H2D_HICE = '0, 0, 0' - -set H2D_HMLTFZ = '0, 4, 0' - -set H2D_HSNW = '0, 0, 0' -set H2D_IAGE = '0, 0, 0' - -set H2D_IDKEDT = '0, 4, 0' -set H2D_LAMULT = '0, 4, 0' -set H2D_LASL = '0, 4, 0' -set H2D_LIP = '0, 4, 0' - -set H2D_MAXMLD = '4, 4, 0' - -set H2D_MLD = '0, 4, 0' - -set H2D_MLTS = '4, 4, 0' - -set H2D_MLTSMN = '0, 4, 0' -set H2D_MLTSMX = '0, 4, 0' -set H2D_MLTSSQ = '0, 4, 0' -set H2D_MTKEUS = '0, 4, 0' -set H2D_MTKENI = '0, 4, 0' -set H2D_MTKEBF = '0, 4, 0' -set H2D_MTKERS = '0, 4, 0' -set H2D_MTKEPE = '0, 4, 0' -set H2D_MTKEKE = '0, 4, 0' -set H2D_MTY = '0, 4, 0' -set H2D_NSF = '0, 4, 0' -set H2D_PBOT = '0, 4, 0' -set H2D_PSRF = '0, 4, 0' -set H2D_RFIFLX = '0, 4, 0' -set H2D_RNFFLX = '0, 4, 0' -set H2D_SALFLX = '0, 4, 0' -set H2D_SALRLX = '0, 4, 0' -set H2D_SBOT = '0, 4, 0' - -set H2D_SEALV = '4, 4, 0' - -set H2D_SLVSQ = '0, 4, 0' -set H2D_SFL = '0, 4, 0' -set H2D_SOP = '0, 4, 0' -set H2D_SIGMX = '0, 4, 0' - -set H2D_SSS = '4, 4, 0' -set H2D_SSSSQ = '4, 4, 0' -set H2D_SST = '4, 4, 0' -set H2D_SSTSQ = '4, 4, 0' - -set H2D_SURFLX = '0, 4, 0' -set H2D_SURRLX = '0, 4, 0' -set H2D_SWA = '0, 4, 0' - -set H2D_T20D = '4, 4, 0' - -set H2D_TAUX = '0, 4, 0' -set H2D_TAUY = '0, 4, 0' -set H2D_TBOT = '0, 4, 0' - -set H2D_TICE = '0, 0, 0' -set H2D_TSRF = '0, 0, 0' - -set H2D_UB = '0, 4, 0' - -set H2D_UICE = '0, 0, 0' - -set H2D_USTAR = '0, 4, 0' -set H2D_USTAR3 = '0, 4, 0' - -set H2D_USTOKES = '0, 0, 0' - -set H2D_VB = '0, 4, 0' - -set H2D_VICE = '0, 0, 0' -set H2D_VSTOKES = '0, 0, 0' - -set H2D_ZTX = '0, 4, 0' -set LYR_BFSQ = '0, 4, 0' -set LYR_DIFDIA = '0, 4, 0' -set LYR_DIFVMO = '0, 4, 0' -set LYR_DIFVHO = '0, 4, 0' -set LYR_DIFVSO = '0, 4, 0' -set LYR_DIFINT = '0, 4, 0' -set LYR_DIFISO = '0, 4, 0' -set LYR_DP = '0, 4, 0' -set LYR_DZ = '0, 4, 0' -set LYR_SALN = '0, 4, 0' -set LYR_TEMP = '0, 4, 0' - -set LYR_TRC = '0, 0, 0' - -set LYR_UFLX = '0, 4, 0' -set LYR_UTFLX = '0, 4, 0' -set LYR_USFLX = '0, 4, 0' - -set LYR_UMFLTD = '0, 0, 4' -set LYR_UMFLSM = '0, 0, 4' -set LYR_UTFLTD = '0, 0, 4' -set LYR_UTFLSM = '0, 0, 4' -set LYR_UTFLLD = '0, 0, 4' -set LYR_USFLTD = '0, 0, 4' -set LYR_USFLSM = '0, 0, 4' -set LYR_USFLLD = '0, 0, 4' - -set LYR_UVEL = '0, 4, 0' -set LYR_VFLX = '0, 4, 0' -set LYR_VTFLX = '0, 4, 0' -set LYR_VSFLX = '0, 4, 0' - -set LYR_VMFLTD = '0, 0, 4' -set LYR_VMFLSM = '0, 0, 4' -set LYR_VTFLTD = '0, 0, 4' -set LYR_VTFLSM = '0, 0, 4' -set LYR_VTFLLD = '0, 0, 4' -set LYR_VSFLTD = '0, 0, 4' -set LYR_VSFLSM = '0, 0, 4' -set LYR_VSFLLD = '0, 0, 4' - -set LYR_VVEL = '0, 4, 0' -set LYR_WFLX = '0, 4, 0' -set LYR_WFLX2 = '0, 4, 0' -set LYR_PV = '0, 4, 0' -set LYR_TKE = '0, 4, 0' -set LYR_GLS_PSI = '0, 4, 0' -set LYR_IDLAGE = '0, 4, 0' -set LVL_BFSQ = '0, 4, 0' -set LVL_DIFDIA = '0, 4, 0' -set LVL_DIFVMO = '0, 4, 0' -set LVL_DIFVHO = '0, 4, 0' -set LVL_DIFVSO = '0, 4, 0' -set LVL_DIFINT = '0, 4, 0' -set LVL_DIFISO = '0, 4, 0' -set LVL_DZ = '0, 4, 0' -set LVL_SALN = '0, 4, 0' -set LVL_TEMP = '0, 4, 0' - -set LVL_TRC = '0, 0, 0' - -set LVL_UFLX = '0, 4, 0' -set LVL_UTFLX = '0, 4, 0' -set LVL_USFLX = '0, 4, 0' - -set LVL_UMFLTD = '0, 0, 4' -set LVL_UMFLSM = '0, 0, 4' -set LVL_UTFLTD = '0, 0, 4' -set LVL_UTFLSM = '0, 0, 4' -set LVL_UTFLLD = '0, 0, 4' -set LVL_USFLTD = '0, 0, 4' -set LVL_USFLSM = '0, 0, 4' -set LVL_USFLLD = '0, 0, 4' - -set LVL_UVEL = '0, 4, 0' -set LVL_VFLX = '0, 4, 0' -set LVL_VTFLX = '0, 4, 0' -set LVL_VSFLX = '0, 4, 0' - -set LVL_VMFLTD = '0, 0, 4' -set LVL_VMFLSM = '0, 0, 4' -set LVL_VTFLTD = '0, 0, 4' -set LVL_VTFLSM = '0, 0, 4' -set LVL_VTFLLD = '0, 0, 4' -set LVL_VSFLTD = '0, 0, 4' -set LVL_VSFLSM = '0, 0, 4' -set LVL_VSFLLD = '0, 0, 4' - -set LVL_VVEL = '0, 4, 0' -set LVL_WFLX = '0, 4, 0' -set LVL_WFLX2 = '0, 4, 0' -set LVL_PV = '0, 4, 0' -set LVL_TKE = '0, 4, 0' -set LVL_GLS_PSI = '0, 4, 0' -set LVL_IDLAGE = '0, 4, 0' -set MSC_MMFLXL = '0, 4, 0' -set MSC_MMFLXD = '0, 4, 0' -set MSC_MMFTDL = '0, 4, 0' -set MSC_MMFSML = '0, 4, 0' -set MSC_MMFTDD = '0, 4, 0' -set MSC_MMFSMD = '0, 4, 0' -set MSC_MHFLX = '0, 4, 0' -set MSC_MHFTD = '0, 4, 0' -set MSC_MHFSM = '0, 4, 0' -set MSC_MHFLD = '0, 4, 0' -set MSC_MSFLX = '0, 4, 0' -set MSC_MSFTD = '0, 4, 0' -set MSC_MSFSM = '0, 4, 0' -set MSC_MSFLD = '0, 4, 0' -set MSC_VOLTR = '0, 4, 0' -set MSC_MASSGS = '0, 4, 0' -set MSC_VOLGS = '0, 4, 0' -set MSC_SALNGA = '0, 4, 0' -set MSC_TEMPGA = '0, 4, 0' -set MSC_SSSGA = '0, 4, 0' -set MSC_SSTGA = '0, 4, 0' - -#------------------------------ -# set DIABGC defaults -#------------------------------ -set BGC_FNAMETAG = "'hbgcd','hbgcm','hbgcy'" -set BGC_AVEPERIO = '1,30,365' -set BGC_FILEFREQ = '30,30,365' -if ("$TEST" == TRUE) then - set BGC_FILEFREQ = ' 1,30,365' -else - set BGC_FILEFREQ = '30,30,365' -endif -set BGC_COMPFLAG = '0, 0, 0' -if ("$PIO_NETCDF_FORMAT_OCN" == 64bit_offset) then - set BGC_NCFORMAT = '1, 1, 1' -else - set BGC_NCFORMAT = '0, 0, 0' -endif -set BGC_INVENTORY = '0, 1, 0' -set SRF_PHOSPH = '0, 2, 2' -set SRF_OXYGEN = '0, 2, 2' -set SRF_IRON = '0, 2, 2' -set SRF_ANO3 = '0, 2, 2' -set SRF_ALKALI = '4, 2, 2' -set SRF_SILICA = '0, 2, 2' -set SRF_DIC = '4, 2, 2' -set SRF_PHYTO = '4, 2, 2' -set SRF_PH = '0, 2, 2' -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' -set SRF_NIFLUX = '0, 2, 2' -set SRF_N2OFX = '0, 0, 2' -set SRF_DMSFLUX = '0, 2, 2' -set SRF_DMS = '0, 2, 2' -set SRF_DMSPROD = '0, 2, 2' -set SRF_DMS_BAC = '0, 2, 2' -set SRF_DMS_UV = '0, 2, 2' -set SRF_ATMCO2 = '0, 2, 2' -set SRF_ATMO2 = '0, 2, 2' -set SRF_ATMN2 = '0, 2, 2' -set SRF_NATDIC = '0, 2, 2' -set SRF_NATALKALI = '0, 2, 2' -set SRF_NATPH = '0, 2, 2' -set SRF_NATPCO2 = '0, 2, 2' -set SRF_NATCO2FX = '0, 2, 2' -set SRF_CO213FXD = '0, 2, 2' -set SRF_CO213FXU = '0, 2, 2' -set SRF_CO214FXD = '0, 2, 2' -set SRF_CO214FXU = '0, 2, 2' -set SRF_CFC11 = '0, 2, 2' -set SRF_CFC12 = '0, 2, 2' -set SRF_SF6 = '0, 2, 2' -set SRF_BROMO = '0, 2, 2' -set SRF_BROMOFX = '0, 2, 2' -set INT_BROMOPRO = '0, 2, 2' -set INT_BROMOUV = '0, 2, 2' -set INT_PHOSY = '4, 2, 2' -set INT_NFIX = '0, 2, 2' -set INT_DNIT = '0, 2, 2' -if ("$BLOM_N_DEPOSITION" == TRUE) then -set FLX_NDEP = '0, 2, 2' -else -set FLX_NDEP = '0, 0, 0' -endif -set FLX_OALK = '0, 0, 0' -set FLX_CAR0100 = '0, 2, 2' -set FLX_CAR0500 = '0, 2, 2' -set FLX_CAR1000 = '0, 2, 2' -set FLX_CAR2000 = '0, 2, 2' -set FLX_CAR4000 = '0, 2, 2' -set FLX_CAR_BOT = '0, 2, 2' -set FLX_BSI0100 = '0, 2, 2' -set FLX_BSI0500 = '0, 2, 2' -set FLX_BSI1000 = '0, 2, 2' -set FLX_BSI2000 = '0, 2, 2' -set FLX_BSI4000 = '0, 2, 2' -set FLX_BSI_BOT = '0, 2, 2' -set FLX_CAL0100 = '0, 2, 2' -set FLX_CAL0500 = '0, 2, 2' -set FLX_CAL1000 = '0, 2, 2' -set FLX_CAL2000 = '0, 2, 2' -set FLX_CAL4000 = '0, 2, 2' -set FLX_CAL_BOT = '0, 2, 2' -set LYR_PHYTO = '0, 0, 2' -set LYR_GRAZER = '0, 0, 2' -set LYR_DOC = '0, 0, 2' -set LYR_PHOSY = '0, 0, 2' -set LYR_PHOSPH = '0, 0, 2' -set LYR_OXYGEN = '0, 0, 4' -set LYR_IRON = '0, 0, 2' -set LYR_ANO3 = '0, 0, 2' -set LYR_ALKALI = '0, 0, 2' -set LYR_SILICA = '0, 0, 2' -set LYR_DIC = '0, 0, 2' -set LYR_POC = '0, 0, 2' -set LYR_CALC = '0, 0, 2' -set LYR_OPAL = '0, 0, 2' -set LYR_CO3 = '0, 0, 2' -set LYR_N2O = '0, 0, 0' -set LYR_PH = '0, 0, 2' -set LYR_OMEGAC = '0, 0, 2' -set LYR_OMEGAA = '0, 0, 2' -set LYR_PREFO2 = '0, 0, 4' -set LYR_O2SAT = '0, 0, 4' -set LYR_PREFPO4 = '0, 0, 2' -set LYR_PREFALK = '0, 0, 2' -set LYR_PREFDIC = '0, 0, 2' -set LYR_DICSAT = '0, 0, 2' -set LYR_NATDIC = '0, 0, 2' -set LYR_NATALKALI = '0, 0, 2' -set LYR_NATCO3 = '0, 0, 2' -set LYR_NATCALC = '0, 0, 2' -set LYR_NATPH = '0, 0, 2' -set LYR_NATOMEGAC = '0, 0, 2' -set LYR_NATOMEGAA = '0, 0, 2' -set LYR_DIC13 = '0, 0, 2' -set LYR_DIC14 = '0, 0, 2' -set LYR_D13C = '0, 0, 2' -set LYR_D14C = '0, 0, 2' -set LYR_BIGD14C = '0, 0, 2' -set LYR_POC13 = '0, 0, 2' -set LYR_DOC13 = '0, 0, 2' -set LYR_CALC13 = '0, 0, 2' -set LYR_PHYTO13 = '0, 0, 2' -set LYR_GRAZER13 = '0, 0, 2' -set LYR_CFC11 = '0, 0, 2' -set LYR_CFC12 = '0, 0, 2' -set LYR_SF6 = '0, 0, 2' -set LYR_NOS = '0, 0, 2' -set LYR_WPHY = '0, 0, 2' -set LYR_WNOS = '0, 0, 2' -set LYR_EPS = '0, 0, 0' -set LYR_ASIZE = '0, 0, 0' -set LYR_BROMO = '0, 0, 2' -set BGC_DP = '0, 2, 2' -set LVL_PHYTO = '0, 2, 2' -set LVL_GRAZER = '0, 2, 2' -set LVL_DOC = '0, 2, 2' -set LVL_PHOSY = '0, 2, 2' -set LVL_PHOSPH = '0, 2, 2' -set LVL_OXYGEN = '0, 4, 4' -set LVL_IRON = '0, 2, 2' -set LVL_ANO3 = '0, 2, 2' -set LVL_ALKALI = '0, 2, 2' -set LVL_SILICA = '0, 2, 2' -set LVL_DIC = '0, 2, 2' -set LVL_POC = '0, 2, 2' -set LVL_CALC = '0, 2, 2' -set LVL_OPAL = '0, 2, 2' -set LVL_CO3 = '0, 2, 2' -set LVL_N2O = '0, 0, 2' -set LVL_PH = '0, 2, 2' -set LVL_OMEGAC = '0, 2, 2' -set LVL_OMEGAA = '0, 2, 2' -set LVL_PREFO2 = '0, 4, 4' -set LVL_O2SAT = '0, 4, 4' -set LVL_PREFPO4 = '0, 2, 2' -set LVL_PREFALK = '0, 2, 2' -set LVL_PREFDIC = '0, 2, 2' -set LVL_DICSAT = '0, 2, 2' -set LVL_NATDIC = '0, 2, 2' -set LVL_NATALKALI = '0, 2, 2' -set LVL_NATCO3 = '0, 2, 2' -set LVL_NATCALC = '0, 2, 2' -set LVL_NATPH = '0, 2, 2' -set LVL_NATOMEGAC = '0, 2, 2' -set LVL_NATOMEGAA = '0, 2, 2' -set LVL_DIC13 = '0, 2, 2' -set LVL_DIC14 = '0, 2, 2' -set LVL_D13C = '0, 2, 2' -set LVL_POC13 = '0, 2, 2' -set LVL_DOC13 = '0, 2, 2' -set LVL_CALC13 = '0, 2, 2' -set LVL_PHYTO13 = '0, 2, 2' -set LVL_GRAZER13 = '0, 2, 2' -set LVL_CFC11 = '0, 2, 2' -set LVL_CFC12 = '0, 2, 2' -set LVL_SF6 = '0, 2, 2' -set LVL_NOS = '0, 2, 2' -set LVL_WPHY = '0, 2, 2' -set LVL_WNOS = '0, 2, 2' -set LVL_EPS = '0, 0, 0' -set LVL_ASIZE = '0, 0, 0' -set LVL_BROMO = '0, 2, 2' -set FLX_SEDIFFIC = '0, 0, 2' -set FLX_SEDIFFAL = '0, 0, 2' -set FLX_SEDIFFPH = '0, 0, 2' -set FLX_SEDIFFOX = '0, 0, 2' -set FLX_SEDIFFN2 = '0, 0, 2' -set FLX_SEDIFFNO3 = '0, 0, 2' -set FLX_SEDIFFSI = '0, 0, 2' -set SDM_POWAIC = '0, 0, 2' -set SDM_POWAAL = '0, 0, 2' -set SDM_POWAPH = '0, 0, 2' -set SDM_POWAOX = '0, 0, 2' -set SDM_POWN2 = '0, 0, 2' -set SDM_POWNO3 = '0, 0, 2' -set SDM_POWASI = '0, 0, 2' -set SDM_SSSO12 = '0, 0, 2' -set SDM_SSSSIL = '0, 0, 2' -set SDM_SSSC12 = '0, 0, 2' -set SDM_SSSTER = '0, 0, 2' -set BUR_SSSO12 = '0, 0, 2' -set BUR_SSSSIL = '0, 0, 2' -set BUR_SSSC12 = '0, 0, 2' -set BUR_SSSTER = '0, 0, 2' - -# if partial coupling, enable SSS relaxation -if ("$BLOM_COUPLING" =~ *partial*) then - if ("$BLOM_VCOORD" == isopyc_bulkml) then - set SRXDAY = 6. - else - set SRXDAY = 60. - set SRXDPT = 10. - endif - set SPRFAC = .true. - set SRXBAL = .true. -endif - -# set grid dependent parameters -if ("$OCN_GRID" == gx1v5 || "$OCN_GRID" == gx1v6) then - set BACLIN = 1800. - set BATROP = 36. -else if ("$OCN_GRID" == gx3v7) then - set BACLIN = 3600. - set BATROP = 72. -else if ("$OCN_GRID" == tnx2v1 ) then - set BACLIN = 4800. - set BATROP = 96. - set EGC = 0.5 - if ("$BLOM_UNIT" == cgs) then - set EGMXDF = 1000.e4 - else - set EGMXDF = 1000. - endif - set CWMTAG = "'Gibraltar','Gibraltar'" - set CWMEDG = " 'u', 'u'" - set CWMI = " 53, 54" - set CWMJ = " 137, 137" - set CWMWTH = " 30.e3, 30.e3" -else if ("$OCN_GRID" == tnx1.5v1 ) then - set BACLIN = 4800. - set BATROP = 96. - set EGC = 0.5 - if ("$BLOM_UNIT" == cgs) then - set EGMXDF = 1000.e4 - else - set EGMXDF = 1000. - endif -else if ("$OCN_GRID" == tnx1v1 || "$OCN_GRID" == tnx1v3 || "$OCN_GRID" == tnx1v4) then - if ("$OCN_NCPL" == 24) then - set BACLIN = 3600. - set BATROP = 60. - set CWBDTS = .75e-4 - set NIWGF = .4 - set SMTFRC = .false. - if ("$BLOM_VCOORD" == isopyc_bulkml) then - set CE = .5 - endif - else - set BACLIN = 3200. - set BATROP = 64. - endif - set CWMTAG = "'Gibraltar','Gibraltar'" - set CWMEDG = " 'u', 'u'" - set CWMI = " 105, 106" - set CWMJ = " 273, 273" - set CWMWTH = " 30.e3, 30.e3" -else if ("$OCN_GRID" == tnx0.25v1 || "$OCN_GRID" == tnx0.25v3 || "$OCN_GRID" == tnx0.25v4) then - set BACLIN = 900. - set BATROP = 15. - if ("$BLOM_UNIT" == cgs) then - set MDV2HI = .15 - set MDV2LO = .15 - set MDV4HI = 0. - set MDV4LO = 0. - set MDC2HI = 300.e4 - set MDC2LO = 300.e4 - else - set MDV2HI = .0015 - set MDV2LO = .0015 - set MDV4HI = 0. - set MDV4LO = 0. - set MDC2HI = 300. - set MDC2LO = 300. - endif - set VSC2HI = .15 - set VSC2LO = .15 - set VSC4HI = 0.0625 - set VSC4LO = 0.0625 - set CWBDTS = 0.75e-4 - set CWBDLS = 25. - set EDWMTH = "'step'" - set EGC = 0.85 - if ("$BLOM_UNIT" == cgs) then - set EGMXDF = 1500.e4 - else - set EGMXDF = 1500. - endif - if ("$BLOM_VCOORD" == isopyc_bulkml) then - set CE = 1.0 - endif -else if ("$OCN_GRID" == tnx0.125v4) then - set BACLIN = 300. - set BATROP = 6. - set EGMNDF = 0. - set EGMXDF = 0. - set EDWMTH = "'step'" - set CWBDTS = .75e-4 - set CWBDLS = 25 - if ("$BLOM_UNIT" == cgs) then - set MDV2HI = .1 - set MDV2LO = .1 - set MDV4HI = 0. - set MDV4LO = 0. - set MDC2HI = 300.e4 - set MDC2LO = 100.e4 - else - set MDV2HI = .001 - set MDV2LO = .001 - set MDV4HI = 0. - set MDV4LO = 0. - set MDC2HI = 300. - set MDC2LO = 100. - endif - set VSC2HI = 0. - set VSC2LO = 0. - set VSC4HI = .06 - set VSC4LO = .06 - set LTEDTP = "'layer'" -else - echo "OCN_GRID is $OCN_GRID \n" - echo "$0 ERROR: Cannot deal with GRID equal to $OCN_GRID " - exit -1 -endif - -# set grid independent input files (iHAMOCC initial conditions) -set INIDIC = "'$DIN_LOC_ROOT/ocn/blom/inicon/glodapv2_Ct_preind_OMIPinit_20171107.nc'" -set INIALK = "'$DIN_LOC_ROOT/ocn/blom/inicon/glodapv2_At_OMIPinit_20171107.nc'" -set INIPO4 = "'$DIN_LOC_ROOT/ocn/blom/inicon/woa13_phosphate_OMIPinit_20171107.nc'" -set INIOXY = "'$DIN_LOC_ROOT/ocn/blom/inicon/woa13_oxygen_OMIPinit_20171107.nc'" -set ININO3 = "'$DIN_LOC_ROOT/ocn/blom/inicon/woa13_nitrate_OMIPinit_20171107.nc'" -set INISIL = "'$DIN_LOC_ROOT/ocn/blom/inicon/woa13_silicate_OMIPinit_20171107.nc'" -if ("$HAMOCC_CISO" == TRUE) then -set INID13C = "'$DIN_LOC_ROOT/ocn/blom/inicon/d13C_permil_20180609.nc'" -set INID14C = "'$DIN_LOC_ROOT/ocn/blom/inicon/d14C_permil_20180609.nc'" -else -set INID13C = "''" -set INID14C = "''" -endif - -# set grid dependent input files -if ("$OCN_GRID" == tnx2v1) then - set GRFILE = "'$DIN_LOC_ROOT/ocn/blom/grid/grid_tnx2v1_20130206.nc'" - set ICFILE = "'$DIN_LOC_ROOT/ocn/blom/inicon/inicon_tnx2v1_20130419.nc'" - set TDFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/tidal_dissipation_tnx2v1_20130419.nc'" - set MER_ORFILE = "'$DIN_LOC_ROOT/ocn/blom/grid/ocean_regions_tnx2v1_20190826.nc'" - set MER_MIFILE = "'$DIN_LOC_ROOT/ocn/blom/grid/mertra_index_tnx2v1_20190826.dat'" - set SEC_SIFILE = "'$DIN_LOC_ROOT/ocn/blom/grid/section_index_tnx2v1_20190826.dat'" - set SCFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/sss_clim_core_tnx2v1_20130927.nc'" - set FEDEPFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/dustdep_mhw2006_tnx2v1_20130506.nc'" - set SWACLIMFILE = "''" - set SEDPORFILE = "''" - if ("$BLOM_RIVER_NUTRIENTS" == TRUE) then - set RIVINFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/river_nutrients_GNEWS2000_tnx2v1_20170915.nc'" - else - set RIVINFILE = "''" - endif - if ("$BLOM_N_DEPOSITION" == TRUE) then - set NDEPFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/$NDEPFNAME'" - else - set NDEPFILE = "''" - endif -else if ("$OCN_GRID" == tnx1v4) then - set GRFILE = "'$DIN_LOC_ROOT/ocn/blom/grid/grid_tnx1v4_20170622.nc'" - set ICFILE = "'$DIN_LOC_ROOT/ocn/blom/inicon/inicon_tnx1v4_20170622.nc'" - set TDFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/tidal_dissipation_tnx1v4_20170605.nc'" - set MER_ORFILE = "'$DIN_LOC_ROOT/ocn/blom/grid/ocean_regions_tnx1v4_20190729.nc'" - set MER_MIFILE = "'$DIN_LOC_ROOT/ocn/blom/grid/mertra_index_tnx1v4_20190615.dat'" - set SEC_SIFILE = "'$DIN_LOC_ROOT/ocn/blom/grid/section_index_tnx1v4_20190611.dat'" - set CCFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/chlorophyll_concentration_tnx1v4_20170608.nc'" - set SCFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/sss_clim_core_tnx1v4_20170604.nc'" - set FEDEPFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/dustdep_mhw2006_tnx1v4_20171107.nc'" - set SEDPORFILE = "''" - if ("$HAMOCC_VSLS" == TRUE) then - set SWACLIMFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/Annual_clim_swa_tnx1v4_20210415.nc'" - else - set SWACLIMFILE = "''" - endif - if ("$BLOM_RIVER_NUTRIENTS" == TRUE) then - set RIVINFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/river_nutrients_GNEWS2000_tnx1v4_20170820.nc'" - else - set RIVINFILE = "''" - endif - if ("$BLOM_N_DEPOSITION" == TRUE) then - set NDEPFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/$NDEPFNAME'" - else - set NDEPFILE = "''" - endif -else if ("$OCN_GRID" == tnx0.25v4) then - set GRFILE = "'$DIN_LOC_ROOT/ocn/blom/grid/grid_tnx0.25v4_20170622.nc'" - set ICFILE = "'$DIN_LOC_ROOT/ocn/blom/inicon/inicon_tnx0.25v4_20170623.nc'" - set TDFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/tidal_dissipation_tnx0.25v4_20170626.nc'" - set MER_ORFILE = "'$DIN_LOC_ROOT/ocn/blom/grid/ocean_regions_tnx0.25v4_20190612.nc'" - set MER_MIFILE = "'$DIN_LOC_ROOT/ocn/blom/grid/mertra_index_tnx0.25v4_20190701.dat'" - set SEC_SIFILE = "'$DIN_LOC_ROOT/ocn/blom/grid/section_index_tnx0.25v4_20190612.dat'" - set CCFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/chlorophyll_concentration_tnx0.25v4_20170623.nc'" - set SCFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/sss_clim_core_tnx0.25v4_20170623.nc'" - set FEDEPFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/dustdep_mhw2006_tnx0.25v4_20181004.nc'" - set SWACLIMFILE = "''" - set SEDPORFILE = "''" - if ("$BLOM_RIVER_NUTRIENTS" == TRUE) then - set RIVINFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/river_nutrients_GNEWS2000_tnx0.25v4_20170821.nc'" - else - set RIVINFILE = "''" - endif - if ("$BLOM_N_DEPOSITION" == TRUE) then - set NDEPFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/$NDEPFNAME'" - else - set NDEPFILE = "''" - endif -else if ("$OCN_GRID" == tnx0.125v4) then - set GRFILE = "'$DIN_LOC_ROOT/ocn/blom/grid/grid_tnx0.125v4_20221013.nc'" - set ICFILE = "'$DIN_LOC_ROOT/ocn/blom/inicon/inicon_tnx0.125v4_20230318.nc'" - set TDFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/tidal_dissipation_tnx0.125v4_20221013.nc'" - set MER_ORFILE = "'$DIN_LOC_ROOT/ocn/blom/grid/ocean_regions_tnx0.125v4_20221013.nc'" - set MER_MIFILE = "'$DIN_LOC_ROOT/ocn/blom/grid/mertra_index_tnx0.125v4_20221013.dat'" - set SEC_SIFILE = "'$DIN_LOC_ROOT/ocn/blom/grid/section_index_tnx0.125v4_20221013.dat'" - set CCFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/chlorophyll_concentration_tnx0.125v4_20221013.nc'" - set SCFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/sss_clim_core_tnx0.125v4_20221013.nc'" - set FEDEPFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/dustdep_mhw2006_tnx0.125v4_20221013.nc'" - set SWACLIMFILE = "''" - set SEDPORFILE = "''" - if ("$BLOM_RIVER_NUTRIENTS" == TRUE) then - set RIVINFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/river_nutrients_GNEWS2000_tnx0.125v4_20221013.nc'" - else - set RIVINFILE = "''" - endif - if ("$BLOM_N_DEPOSITION" == TRUE) then - set NDEPFILE = "'$DIN_LOC_ROOT/ocn/blom/bndcon/$NDEPFNAME'" - else - set NDEPFILE = "''" - endif -else - echo "$0 ERROR: Cannot deal with GRID = $OCN_GRID " - exit -1 -endif - - -#------------------------------------------------------------------------------ -# Create resolved namelist -#------------------------------------------------------------------------------ -foreach mem ("`seq $NINST_OCN`") - if ( ${NINST_OCN} == '1' ) then - set inststr = '' - else - set inststr = ("`printf '_%4.4d' $mem`") - endif - - # modify namelist variables as specified in user_nl_blom - foreach line ("`grep = $CASEROOT/user_nl_blom$inststr`") - if (`echo "$line" | tr -d ' ' | cut -c -1` != '#') then - set var = `echo "$line" | sed 's/=.*//' | tr '[a-z]' '[A-Z]'` - set val = `echo "$line" | sed 's/.*=//'` - eval 'set $var = "$val"' - endif - end - -cp ocn_in.readme $RUNDIR/. - -cat >! $RUNDIR/ocn_in$inststr << EOF -&LIMITS - NDAY1 = $NDAY1 - NDAY2 = $NDAY2 - IDATE = $IDATE - IDATE0 = $IDATE0 - RUNID = $RUNID - EXPCNF = $EXPCNF - RUNTYP = $RUNTYP - GRFILE = $GRFILE - ICFILE = $ICFILE - PREF = $PREF - BACLIN = $BACLIN - BATROP = $BATROP - MDV2HI = $MDV2HI - MDV2LO = $MDV2LO - MDV4HI = $MDV4HI - MDV4LO = $MDV4LO - MDC2HI = $MDC2HI - MDC2LO = $MDC2LO - VSC2HI = $VSC2HI - VSC2LO = $VSC2LO - VSC4HI = $VSC4HI - VSC4LO = $VSC4LO - CBAR = $CBAR - CB = $CB - CWBDTS = $CWBDTS - CWBDLS = $CWBDLS - MOMMTH = $MOMMTH - BMCMTH = $BMCMTH - RMPMTH = $RMPMTH - MLRTTP = $MLRTTP - RM0 = $RM0 - RM5 = $RM5 - CE = $CE - TDFILE = $TDFILE - NIWGF = $NIWGF - NIWBF = $NIWBF - NIWLF = $NIWLF - SWAMTH = $SWAMTH - JWTYPE = $JWTYPE - CHLOPT = $CHLOPT - CCFILE = $CCFILE - TRXDAY = $TRXDAY - SRXDAY = $SRXDAY - TRXDPT = $TRXDPT - SRXDPT = $SRXDPT - TRXLIM = $TRXLIM - SRXLIM = $SRXLIM - APTFLX = $APTFLX - APSFLX = $APSFLX - DITFLX = $DITFLX - DISFLX = $DISFLX - SRXBAL = $SRXBAL - SCFILE = $SCFILE - WAVSRC = $WAVSRC - SMTFRC = $SMTFRC - SPRFAC = $SPRFAC - ATM_PATH = $ATM_PATH - ITEST = $ITEST - JTEST = $JTEST - CNSVDI = $CNSVDI - CSDIAG = $CSDIAG - RSTFRQ = $RSTFRQ - RSTFMT = $RSTFMT - RSTCMP = $RSTCMP - IOTYPE = $IOTYPE -/ -EOF - -if ("$BLOM_VCOORD" == cntiso_hybrid) then -cat >>! $RUNDIR/ocn_in$inststr << EOF - -&VCOORD - VCOORD_TYPE = $VCOORD_TYPE - RECONSTRUCTION_METHOD = $RECONSTRUCTION_METHOD - DENSITY_LIMITING = $DENSITY_LIMITING - TRACER_LIMITING = $TRACER_LIMITING - VELOCITY_LIMITING = $VELOCITY_LIMITING - DENSITY_PC_UPPER_BNDR = $DENSITY_PC_UPPER_BNDR - DENSITY_PC_LOWER_BNDR = $DENSITY_PC_LOWER_BNDR - TRACER_PC_UPPER_BNDR = $TRACER_PC_UPPER_BNDR - TRACER_PC_LOWER_BNDR = $TRACER_PC_LOWER_BNDR - VELOCITY_PC_UPPER_BNDR = $VELOCITY_PC_UPPER_BNDR - VELOCITY_PC_LOWER_BNDR = $VELOCITY_PC_LOWER_BNDR - DPMIN_SURFACE = $DPMIN_SURFACE - DPMIN_INFLATION_FACTOR = $DPMIN_INFLATION_FACTOR - DPMIN_INTERIOR = $DPMIN_INTERIOR - DKTZU = $DKTZU - DKTZL = $DKTZL -/ -EOF -endif - -cat >>! $RUNDIR/ocn_in$inststr << EOF - -&DIFFUSION - EITMTH = $EITMTH - EDRITP = $EDRITP - EDWMTH = $EDWMTH - EDDF2D = $EDDF2D - EDSPRS = $EDSPRS - EGC = $EGC - EGGAM = $EGGAM - EGLSMN = $EGLSMN - EGMNDF = $EGMNDF - EGMXDF = $EGMXDF - EGIDFQ = $EGIDFQ - TBFILE = $TBFILE - RHISCF = $RHISCF - EDANIS = $EDANIS - REDI3D = $REDI3D - RHSCTP = $RHSCTP - RI0 = $RI0 - BDMTYP = $BDMTYP - BDMC1 = $BDMC1 - BDMC2 = $BDMC2 - BDMLDP = $BDMLDP - TKEPF = $TKEPF - SMOBLD = $SMOBLD - LNGMTP = $LNGMTP - LTEDTP = $LTEDTP -/ -EOF - -if ($?CWMTAG) then -cat >>! $RUNDIR/ocn_in$inststr << EOF - -&CWMOD - CWMTAG = $CWMTAG - CWMEDG = $CWMEDG - CWMI = $CWMI - CWMJ = $CWMJ - CWMWTH = $CWMWTH -/ -EOF -endif - -cat >>! $RUNDIR/ocn_in$inststr << EOF - -&MERDIA - MER_ORFILE = $MER_ORFILE - MER_MIFILE = $MER_MIFILE - MER_REGNAM = 'atlantic_arctic_ocean', 'atlantic_arctic_extended_ocean', 'indian_pacific_ocean', 'global_ocean' - MER_REGFLG(1,:) = 2, 4 - MER_REGFLG(2,:) = 2, 4, 6, 7, 8, 9 - MER_REGFLG(3,:) = 3, 5 - MER_REGFLG(4,:) = 0 - MER_MINLAT = -34., -34., -34., -90. - MER_MAXLAT = 90., 90., 90., 90. -/ - -&SECDIA - SEC_SIFILE = $SEC_SIFILE -/ - -&DIAPHY - GLB_FNAMETAG = $GLB_FNAMETAG - GLB_AVEPERIO = $GLB_AVEPERIO - GLB_FILEFREQ = $GLB_FILEFREQ - GLB_COMPFLAG = $GLB_COMPFLAG - GLB_NCFORMAT = $GLB_NCFORMAT - H2D_ABSWND = $H2D_ABSWND - H2D_ALB = $H2D_ALB - H2D_BTMSTR = $H2D_BTMSTR - H2D_BRNFLX = $H2D_BRNFLX - H2D_BRNPD = $H2D_BRNPD - H2D_DFL = $H2D_DFL - H2D_EVA = $H2D_EVA - H2D_FICE = $H2D_FICE - H2D_FMLTFZ = $H2D_FMLTFZ - H2D_HICE = $H2D_HICE - H2D_HMLTFZ = $H2D_HMLTFZ - H2D_HSNW = $H2D_HSNW - H2D_IAGE = $H2D_IAGE - H2D_IDKEDT = $H2D_IDKEDT - H2D_LAMULT = $H2D_LAMULT - H2D_LASL = $H2D_LASL - H2D_LIP = $H2D_LIP - H2D_MAXMLD = $H2D_MAXMLD - H2D_MLD = $H2D_MLD - H2D_MLTS = $H2D_MLTS - H2D_MLTSMN = $H2D_MLTSMN - H2D_MLTSMX = $H2D_MLTSMX - H2D_MLTSSQ = $H2D_MLTSSQ - H2D_MTKEUS = $H2D_MTKEUS - H2D_MTKENI = $H2D_MTKENI - H2D_MTKEBF = $H2D_MTKEBF - H2D_MTKERS = $H2D_MTKERS - H2D_MTKEPE = $H2D_MTKEPE - H2D_MTKEKE = $H2D_MTKEKE - H2D_MTY = $H2D_MTY - H2D_NSF = $H2D_NSF - H2D_PBOT = $H2D_PBOT - H2D_PSRF = $H2D_PSRF - H2D_RFIFLX = $H2D_RFIFLX - H2D_RNFFLX = $H2D_RNFFLX - H2D_SALFLX = $H2D_SALFLX - H2D_SALRLX = $H2D_SALRLX - H2D_SBOT = $H2D_SBOT - H2D_SEALV = $H2D_SEALV - H2D_SLVSQ = $H2D_SLVSQ - H2D_SFL = $H2D_SFL - H2D_SOP = $H2D_SOP - H2D_SIGMX = $H2D_SIGMX - H2D_SSS = $H2D_SSS - H2D_SSSSQ = $H2D_SSSSQ - H2D_SST = $H2D_SST - H2D_SSTSQ = $H2D_SSTSQ - H2D_SURFLX = $H2D_SURFLX - H2D_SURRLX = $H2D_SURRLX - H2D_SWA = $H2D_SWA - H2D_T20D = $H2D_T20D - H2D_TAUX = $H2D_TAUX - H2D_TAUY = $H2D_TAUY - H2D_TBOT = $H2D_TBOT - H2D_TICE = $H2D_TICE - H2D_TSRF = $H2D_TSRF - H2D_UB = $H2D_UB - H2D_UICE = $H2D_UICE - H2D_USTAR = $H2D_USTAR - H2D_USTAR3 = $H2D_USTAR3 - H2D_USTOKES = $H2D_USTOKES - H2D_VB = $H2D_VB - H2D_VICE = $H2D_VICE - H2D_VSTOKES = $H2D_VSTOKES - H2D_ZTX = $H2D_ZTX - LYR_BFSQ = $LYR_BFSQ - LYR_DIFDIA = $LYR_DIFDIA - LYR_DIFVMO = $LYR_DIFVMO - LYR_DIFVHO = $LYR_DIFVHO - LYR_DIFVSO = $LYR_DIFVSO - LYR_DIFINT = $LYR_DIFINT - LYR_DIFISO = $LYR_DIFISO - LYR_DP = $LYR_DP - LYR_DZ = $LYR_DZ - LYR_SALN = $LYR_SALN - LYR_TEMP = $LYR_TEMP - LYR_TRC = $LYR_TRC - LYR_UFLX = $LYR_UFLX - LYR_UTFLX = $LYR_UTFLX - LYR_USFLX = $LYR_USFLX - LYR_UMFLTD = $LYR_UMFLTD - LYR_UMFLSM = $LYR_UMFLSM - LYR_UTFLTD = $LYR_UTFLTD - LYR_UTFLSM = $LYR_UTFLSM - LYR_UTFLLD = $LYR_UTFLLD - LYR_USFLTD = $LYR_USFLTD - LYR_USFLSM = $LYR_USFLSM - LYR_USFLLD = $LYR_USFLLD - LYR_UVEL = $LYR_UVEL - LYR_VFLX = $LYR_VFLX - LYR_VTFLX = $LYR_VTFLX - LYR_VSFLX = $LYR_VSFLX - LYR_VMFLTD = $LYR_VMFLTD - LYR_VMFLSM = $LYR_VMFLSM - LYR_VTFLTD = $LYR_VTFLTD - LYR_VTFLSM = $LYR_VTFLSM - LYR_VTFLLD = $LYR_VTFLLD - LYR_VSFLTD = $LYR_VSFLTD - LYR_VSFLSM = $LYR_VSFLSM - LYR_VSFLLD = $LYR_VSFLLD - LYR_VVEL = $LYR_VVEL - LYR_WFLX = $LYR_WFLX - LYR_WFLX2 = $LYR_WFLX2 - LYR_PV = $LYR_PV - LYR_TKE = $LYR_TKE - LYR_GLS_PSI = $LYR_GLS_PSI - LYR_IDLAGE = $LYR_IDLAGE - LVL_BFSQ = $LVL_BFSQ - LVL_DIFDIA = $LVL_DIFDIA - LVL_DIFVMO = $LVL_DIFVMO - LVL_DIFVHO = $LVL_DIFVHO - LVL_DIFVSO = $LVL_DIFVSO - LVL_DIFINT = $LVL_DIFINT - LVL_DIFISO = $LVL_DIFISO - LVL_DZ = $LVL_DZ - LVL_SALN = $LVL_SALN - LVL_TEMP = $LVL_TEMP - LVL_TRC = $LVL_TRC - LVL_UFLX = $LVL_UFLX - LVL_UTFLX = $LVL_UTFLX - LVL_USFLX = $LVL_USFLX - LVL_UMFLTD = $LVL_UMFLTD - LVL_UMFLSM = $LVL_UMFLSM - LVL_UTFLTD = $LVL_UTFLTD - LVL_UTFLSM = $LVL_UTFLSM - LVL_UTFLLD = $LVL_UTFLLD - LVL_USFLTD = $LVL_USFLTD - LVL_USFLSM = $LVL_USFLSM - LVL_USFLLD = $LVL_USFLLD - LVL_UVEL = $LVL_UVEL - LVL_VFLX = $LVL_VFLX - LVL_VTFLX = $LVL_VTFLX - LVL_VSFLX = $LVL_VSFLX - LVL_VMFLTD = $LVL_VMFLTD - LVL_VMFLSM = $LVL_VMFLSM - LVL_VTFLTD = $LVL_VTFLTD - LVL_VTFLSM = $LVL_VTFLSM - LVL_VTFLLD = $LVL_VTFLLD - LVL_VSFLTD = $LVL_VSFLTD - LVL_VSFLSM = $LVL_VSFLSM - LVL_VSFLLD = $LVL_VSFLLD - LVL_VVEL = $LVL_VVEL - LVL_WFLX = $LVL_WFLX - LVL_WFLX2 = $LVL_WFLX2 - LVL_PV = $LVL_PV - LVL_TKE = $LVL_TKE - LVL_GLS_PSI = $LVL_GLS_PSI - LVL_IDLAGE = $LVL_IDLAGE - MSC_MMFLXL = $MSC_MMFLXL - MSC_MMFLXD = $MSC_MMFLXD - MSC_MMFTDL = $MSC_MMFTDL - MSC_MMFSML = $MSC_MMFSML - MSC_MMFTDD = $MSC_MMFTDD - MSC_MMFSMD = $MSC_MMFSMD - MSC_MHFLX = $MSC_MHFLX - MSC_MHFTD = $MSC_MHFTD - MSC_MHFSM = $MSC_MHFSM - MSC_MHFLD = $MSC_MHFLD - MSC_MSFLX = $MSC_MSFLX - MSC_MSFTD = $MSC_MSFTD - MSC_MSFSM = $MSC_MSFSM - MSC_MSFLD = $MSC_MSFLD - MSC_VOLTR = $MSC_VOLTR - MSC_MASSGS = $MSC_MASSGS - MSC_VOLGS = $MSC_VOLGS - MSC_SALNGA = $MSC_SALNGA - MSC_TEMPGA = $MSC_TEMPGA - MSC_SSSGA = $MSC_SSSGA - MSC_SSTGA = $MSC_SSTGA -/ -EOF - -if ("$ecosys" == TRUE) then -cat >>! $RUNDIR/ocn_in$inststr << EOF - -&BGCNML - ATM_CO2 = $CCSM_CO2_PPMV - FEDEPFILE = $FEDEPFILE - SWACLIMFILE = $SWACLIMFILE - DO_RIVINPT = $DO_RIVINPT - RIVINFILE = $RIVINFILE - DO_NDEP = $DO_NDEP - NDEPFILE = $NDEPFILE - DO_OALK = $DO_OALK - DO_SEDSPINUP = $DO_SEDSPINUP - SEDSPIN_YR_S = $SEDSPIN_YR_S - SEDSPIN_YR_E = $SEDSPIN_YR_E - SEDSPIN_NCYC = $SEDSPIN_NCYC - INIDIC = $INIDIC - INIALK = $INIALK - INIPO4 = $INIPO4 - INIOXY = $INIOXY - ININO3 = $ININO3 - INISIL = $INISIL - INID13C = $INID13C - INID14C = $INID14C - WITH_DMSPH = $WITH_DMSPH - PI_PH_FILE = $PI_PH_FILE - L_3DVARSEDPOR = $L_3DVARSEDPOR - SEDPORFILE = $SEDPORFILE -/ - -&BGCOAFX - OALKSCEN = $BGCOAFX_OALKSCEN - OALKFILE = $BGCOAFX_OALKFILE - ADDALK = $BGCOAFX_ADDALK - CDRMIP_LATMAX = $BGCOAFX_CDRMIP_LATMAX - CDRMIP_LATMIN = $BGCOAFX_CDRMIP_LATMIN - RAMP_START = $BGCOAFX_RAMP_START - RAMP_END = $BGCOAFX_RAMP_END -/ - -&DIABGC - GLB_FNAMETAG = $BGC_FNAMETAG - GLB_AVEPERIO = $BGC_AVEPERIO - GLB_FILEFREQ = $BGC_FILEFREQ - GLB_COMPFLAG = $BGC_COMPFLAG - GLB_NCFORMAT = $BGC_NCFORMAT - GLB_INVENTORY = $BGC_INVENTORY - SRF_PHOSPH = $SRF_PHOSPH - SRF_OXYGEN = $SRF_OXYGEN - SRF_IRON = $SRF_IRON - SRF_ANO3 = $SRF_ANO3 - SRF_ALKALI = $SRF_ALKALI - SRF_SILICA = $SRF_SILICA - SRF_DIC = $SRF_DIC - SRF_PHYTO = $SRF_PHYTO - SRF_PH = $SRF_PH - SRF_EXPORT = $SRF_EXPORT - 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 - SRF_NIFLUX = $SRF_NIFLUX - SRF_N2OFX = $SRF_N2OFX - SRF_DMSFLUX = $SRF_DMSFLUX - SRF_DMS = $SRF_DMS - SRF_DMSPROD = $SRF_DMSPROD - SRF_DMS_BAC = $SRF_DMS_BAC - SRF_DMS_UV = $SRF_DMS_UV - SRF_ATMCO2 = $SRF_ATMCO2 - SRF_ATMO2 = $SRF_ATMO2 - SRF_ATMN2 = $SRF_ATMN2 - SRF_NATDIC = $SRF_NATDIC - SRF_NATALKALI = $SRF_NATALKALI - SRF_NATPH = $SRF_NATPH - SRF_NATPCO2 = $SRF_NATPCO2 - SRF_NATCO2FX = $SRF_NATCO2FX - SRF_CO213FXD = $SRF_CO213FXD - SRF_CO213FXU = $SRF_CO213FXU - SRF_CO214FXD = $SRF_CO214FXD - SRF_CO214FXU = $SRF_CO214FXU - SRF_CFC11 = $SRF_CFC11 - SRF_CFC12 = $SRF_CFC12 - SRF_SF6 = $SRF_SF6 - SRF_BROMO = $SRF_BROMO - SRF_BROMOFX = $SRF_BROMOFX - INT_BROMOPRO = $INT_BROMOPRO - INT_BROMOUV = $INT_BROMOUV - INT_PHOSY = $INT_PHOSY - INT_NFIX = $INT_NFIX - INT_DNIT = $INT_DNIT - FLX_NDEP = $FLX_NDEP - FLX_OALK = $FLX_OALK - FLX_CAR0100 = $FLX_CAR0100 - FLX_CAR0500 = $FLX_CAR0500 - FLX_CAR1000 = $FLX_CAR1000 - FLX_CAR2000 = $FLX_CAR2000 - FLX_CAR4000 = $FLX_CAR4000 - FLX_CAR_BOT = $FLX_CAR_BOT - FLX_BSI0100 = $FLX_BSI0100 - FLX_BSI0500 = $FLX_BSI0500 - FLX_BSI1000 = $FLX_BSI1000 - FLX_BSI2000 = $FLX_BSI2000 - FLX_BSI4000 = $FLX_BSI4000 - FLX_BSI_BOT = $FLX_BSI_BOT - FLX_CAL0100 = $FLX_CAL0100 - FLX_CAL0500 = $FLX_CAL0500 - FLX_CAL1000 = $FLX_CAL1000 - FLX_CAL2000 = $FLX_CAL2000 - FLX_CAL4000 = $FLX_CAL4000 - FLX_CAL_BOT = $FLX_CAL_BOT - LYR_PHYTO = $LYR_PHYTO - LYR_GRAZER = $LYR_GRAZER - LYR_DOC = $LYR_DOC - LYR_PHOSY = $LYR_PHOSY - LYR_PHOSPH = $LYR_PHOSPH - LYR_OXYGEN = $LYR_OXYGEN - LYR_IRON = $LYR_IRON - LYR_ANO3 = $LYR_ANO3 - LYR_ALKALI = $LYR_ALKALI - LYR_SILICA = $LYR_SILICA - LYR_DIC = $LYR_DIC - LYR_POC = $LYR_POC - LYR_CALC = $LYR_CALC - LYR_OPAL = $LYR_OPAL - LYR_CO3 = $LYR_CO3 - LYR_N2O = $LYR_N2O - LYR_PH = $LYR_PH - LYR_OMEGAC = $LYR_OMEGAC - LYR_OMEGAA = $LYR_OMEGAA - LYR_PREFO2 = $LYR_PREFO2 - LYR_O2SAT = $LYR_O2SAT - LYR_PREFPO4 = $LYR_PREFPO4 - LYR_PREFALK = $LYR_PREFALK - LYR_PREFDIC = $LYR_PREFDIC - LYR_DICSAT = $LYR_DICSAT - LYR_NATDIC = $LYR_NATDIC - LYR_NATALKALI = $LYR_NATALKALI - LYR_NATCO3 = $LYR_NATCO3 - LYR_NATCALC = $LYR_NATCALC - LYR_NATPH = $LYR_NATPH - LYR_NATOMEGAC = $LYR_NATOMEGAC - LYR_NATOMEGAA = $LYR_NATOMEGAA - LYR_DIC13 = $LYR_DIC13 - LYR_DIC14 = $LYR_DIC14 - LYR_D13C = $LYR_D13C - LYR_D14C = $LYR_D14C - LYR_BIGD14C = $LYR_BIGD14C - LYR_POC13 = $LYR_POC13 - LYR_DOC13 = $LYR_DOC13 - LYR_CALC13 = $LYR_CALC13 - LYR_PHYTO13 = $LYR_PHYTO13 - LYR_GRAZER13 = $LYR_GRAZER13 - LYR_CFC11 = $LYR_CFC11 - LYR_CFC12 = $LYR_CFC12 - LYR_SF6 = $LYR_SF6 - LYR_NOS = $LYR_NOS - LYR_WPHY = $LYR_WPHY - LYR_WNOS = $LYR_WNOS - LYR_EPS = $LYR_EPS - LYR_ASIZE = $LYR_ASIZE - LYR_DP = $BGC_DP - LYR_BROMO = $LYR_BROMO - LVL_PHYTO = $LVL_PHYTO - LVL_GRAZER = $LVL_GRAZER - LVL_DOC = $LVL_DOC - LVL_PHOSY = $LVL_PHOSY - LVL_PHOSPH = $LVL_PHOSPH - LVL_OXYGEN = $LVL_OXYGEN - LVL_IRON = $LVL_IRON - LVL_ANO3 = $LVL_ANO3 - LVL_ALKALI = $LVL_ALKALI - LVL_SILICA = $LVL_SILICA - LVL_DIC = $LVL_DIC - LVL_POC = $LVL_POC - LVL_CALC = $LVL_CALC - LVL_OPAL = $LVL_OPAL - LVL_CO3 = $LVL_CO3 - LVL_N2O = $LVL_N2O - LVL_PH = $LVL_PH - LVL_OMEGAC = $LVL_OMEGAC - LVL_OMEGAA = $LVL_OMEGAA - LVL_PREFO2 = $LVL_PREFO2 - LVL_O2SAT = $LVL_O2SAT - LVL_PREFPO4 = $LVL_PREFPO4 - LVL_PREFALK = $LVL_PREFALK - LVL_PREFDIC = $LVL_PREFDIC - LVL_DICSAT = $LVL_DICSAT - LVL_NATDIC = $LVL_NATDIC - LVL_NATALKALI = $LVL_NATALKALI - LVL_NATCO3 = $LVL_NATCO3 - LVL_NATCALC = $LVL_NATCALC - LVL_NATPH = $LVL_NATPH - LVL_NATOMEGAC = $LVL_NATOMEGAC - LVL_NATOMEGAA = $LVL_NATOMEGAA - LVL_DIC13 = $LVL_DIC13 - LVL_DIC14 = $LVL_DIC14 - LVL_D13C = $LVL_D13C - LVL_POC13 = $LVL_POC13 - LVL_DOC13 = $LVL_DOC13 - LVL_CALC13 = $LVL_CALC13 - LVL_PHYTO13 = $LVL_PHYTO13 - LVL_GRAZER13 = $LVL_GRAZER13 - LVL_CFC11 = $LVL_CFC11 - LVL_CFC12 = $LVL_CFC12 - LVL_SF6 = $LVL_SF6 - LVL_NOS = $LVL_NOS - LVL_WPHY = $LVL_WPHY - LVL_WNOS = $LVL_WNOS - LVL_EPS = $LVL_EPS - LVL_ASIZE = $LVL_ASIZE - LVL_BROMO = $LVL_BROMO - FLX_SEDIFFIC = $FLX_SEDIFFIC - FLX_SEDIFFAL = $FLX_SEDIFFAL - FLX_SEDIFFPH = $FLX_SEDIFFPH - FLX_SEDIFFOX = $FLX_SEDIFFOX - FLX_SEDIFFN2 = $FLX_SEDIFFN2 - FLX_SEDIFFNO3 = $FLX_SEDIFFNO3 - FLX_SEDIFFSI = $FLX_SEDIFFSI - SDM_POWAIC = $SDM_POWAIC - SDM_POWAAL = $SDM_POWAAL - SDM_POWAPH = $SDM_POWAPH - SDM_POWAOX = $SDM_POWAOX - SDM_POWN2 = $SDM_POWN2 - SDM_POWNO3 = $SDM_POWNO3 - SDM_POWASI = $SDM_POWASI - SDM_SSSO12 = $SDM_SSSO12 - SDM_SSSSIL = $SDM_SSSSIL - SDM_SSSC12 = $SDM_SSSC12 - SDM_SSSTER = $SDM_SSSTER - BUR_SSSO12 = $BUR_SSSO12 - BUR_SSSSIL = $BUR_SSSSIL - BUR_SSSC12 = $BUR_SSSC12 - BUR_SSSTER = $BUR_SSSTER -/ -EOF -endif - -end ## foreach mem ("`seq $NINST_OCN`") - -#------------------------------------------------------------------------------ -# Generate blom.input_data_list -#------------------------------------------------------------------------------ - -cat > $CASEBUILD/blom.input_data_list << EOF -grid_file = `echo $GRFILE | tr -d '"' | tr -d "'"` -meridional_transport_index_file = `echo $MER_MIFILE | tr -d '"' | tr -d "'"` -meridional_transport_basin_file = `echo $MER_ORFILE | tr -d '"' | tr -d "'"` -section_index_file = `echo $SEC_SIFILE | tr -d '"' | tr -d "'"` -tidal_dissipation_file = `echo $TDFILE | tr -d '"' | tr -d "'"` -EOF -if ($SWAMTH == "'chlorophyll'") then -cat >> $CASEBUILD/blom.input_data_list << EOF -chlorophyll_concentration_file = `echo $CCFILE | tr -d '"' | tr -d "'"` -EOF -endif -if ($SRXDAY != "0.") then -cat >> $CASEBUILD/blom.input_data_list << EOF -sss_climatology_file = `echo $SCFILE | tr -d '"' | tr -d "'"` -EOF -endif - -# iHAMOCC boundary conditions -if ($ecosys == TRUE) then -cat >> $CASEBUILD/blom.input_data_list << EOF -dust_file = `echo $FEDEPFILE | tr -d '"' | tr -d "'"` -EOF - if ($BLOM_RIVER_NUTRIENTS == TRUE) then -cat >> $CASEBUILD/blom.input_data_list << EOF -river_file = `echo $RIVINFILE | tr -d '"' | tr -d "'"` -EOF - endif - if ($BLOM_N_DEPOSITION == TRUE) then -cat >> $CASEBUILD/blom.input_data_list << EOF -n_deposition_file = `echo $NDEPFILE | tr -d '"' | tr -d "'"` -EOF - endif - if ($BGCOAFX_OALKFILE != "''") then -cat >> $CASEBUILD/blom.input_data_list << EOF -oafx_file = `echo $BGCOAFX_OALKFILE | tr -d '"' | tr -d "'"` -EOF - endif - if ($HAMOCC_VSLS == TRUE) then -cat >> $CASEBUILD/blom.input_data_list << EOF -swa_clim_file = `echo $SWACLIMFILE | tr -d '"' | tr -d "'"` -EOF - endif - if ($L_3DVARSEDPOR == TRUE) then -cat >> $CASEBUILD/blom.input_data_list << EOF -sed_porosity_file = `echo $SEDPORFILE | tr -d '"' | tr -d "'"` -EOF - endif -endif - -# BLOM initial conditions -cat >> $CASEBUILD/blom.input_data_list << EOF -inicon_file = `echo $ICFILE | tr -d '"' | tr -d "'"` -EOF - - -# iHAMOCC initial conditions -if ($ecosys == TRUE) then -cat >> $CASEBUILD/blom.input_data_list << EOF -inidic_file = `echo $INIDIC | tr -d '"' | tr -d "'"` -inialk_file = `echo $INIALK | tr -d '"' | tr -d "'"` -inipo4_file = `echo $INIPO4 | tr -d '"' | tr -d "'"` -inioxy_file = `echo $INIOXY | tr -d '"' | tr -d "'"` -inino3_file = `echo $ININO3 | tr -d '"' | tr -d "'"` -inisil_file = `echo $INISIL | tr -d '"' | tr -d "'"` -EOF - if ($HAMOCC_CISO == TRUE) then -cat >> $CASEBUILD/blom.input_data_list << EOF -inic13_file = `echo $INID13C | tr -d '"' | tr -d "'"` -inic14_file = `echo $INID14C | tr -d '"' | tr -d "'"` -EOF - endif - if ($RUN_TYPE == startup) then - if ($ICFILE =~ *.blom.r.*) then -cat >> $CASEBUILD/blom.input_data_list << EOF -inicon_bgc_file = `echo $ICFILE | sed 's/.blom.r./.blom.rbgc./' | tr -d '"' | tr -d "'"` -EOF - else if ($ICFILE =~ *.micom.r.*) then -cat >> $CASEBUILD/blom.input_data_list << EOF -inicon_bgc_file = `echo $ICFILE | sed 's/.micom.r./.micom.rbgc./' | tr -d '"' | tr -d "'"` -EOF - endif - endif -endif - - From 474c929e0c40d187c5791bceabd945287ce9e472 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Sun, 15 Oct 2023 15:41:31 +0200 Subject: [PATCH 47/52] updates for problems discovered in the PR review --- hamocc/carchm.F90 | 4 ++-- hamocc/hamocc_init.F90 | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hamocc/carchm.F90 b/hamocc/carchm.F90 index 202b3b99..b18fc87d 100644 --- a/hamocc/carchm.F90 +++ b/hamocc/carchm.F90 @@ -118,7 +118,7 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & use mo_param1_bgc, only: iatmnco2,inatalkali,inatcalc,inatsco212 ! sedbypass use mo_sedmnt, only: sedlay,powtra,burial - use mo_param1_bgc, only: issso14,isssc14,ipowc14 + use mo_param1_bgc, only: ks,issso14,isssc14,ipowc14 use mo_control_bgc, only: use_cisonew,use_natDIC,use_CFC,use_BROMO,use_cisonew,use_sedbypass implicit none @@ -139,7 +139,7 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & REAL, intent(in) :: pflxbromo(1-kbnd:kpie+kbnd,1-kbnd:kpje+kbnd) ! Local variables - INTEGER :: i,j,k,l,js,ks + INTEGER :: i,j,k,l,js INTEGER, parameter :: niter=20 REAL :: supsat, undsa, dissol diff --git a/hamocc/hamocc_init.F90 b/hamocc/hamocc_init.F90 index 8cbc29e1..018121c9 100644 --- a/hamocc/hamocc_init.F90 +++ b/hamocc/hamocc_init.F90 @@ -47,7 +47,7 @@ subroutine hamocc_init(read_rest,rstfnm_hamocc) & sedspin_yr_s,sedspin_yr_e,sedspin_ncyc, & & dtb,dtbgc,io_stdo_bgc,ldtbgc, & & ldtrunbgc,ndtdaybgc,with_dmsph,l_3Dvarsedpor - use mo_param1_bgc, only: ks,init_por2octra_mapping,init_indices + 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 use mo_biomod, only: alloc_mem_biomod From f1a5062c1157c0b039954e1585feb2caf92f0741 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Mon, 16 Oct 2023 17:53:31 +0200 Subject: [PATCH 48/52] addressed changes requested in code review --- hamocc/accfields.F90 | 121 ++--- hamocc/aufr_bgc.F90 | 115 ++-- hamocc/aufw_bgc.F90 | 1098 +++++++++++++++++++------------------- hamocc/beleg_vars.F90 | 34 +- hamocc/carchm.F90 | 69 +-- hamocc/hamocc4bcm.F90 | 21 +- hamocc/hamocc_init.F90 | 33 +- hamocc/inventory_bgc.F90 | 164 +++--- hamocc/mo_boxatm.F90 | 20 +- hamocc/mo_intfcblom.F90 | 18 +- hamocc/mo_param1_bgc.F90 | 255 +++++---- hamocc/ncout_hamocc.F90 | 356 ++++++------ hamocc/ocprod.F90 | 114 ++-- hamocc/powach.F90 | 21 +- hamocc/sedshi.F90 | 5 +- 15 files changed, 1147 insertions(+), 1297 deletions(-) diff --git a/hamocc/accfields.F90 b/hamocc/accfields.F90 index c8e20e5f..614ad44f 100644 --- a/hamocc/accfields.F90 +++ b/hamocc/accfields.F90 @@ -46,63 +46,49 @@ 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,oalkflx,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 - 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, & - & jsediffic,jsediffal,jsediffph,jsediffox,jsediffn2,jsediffno3,jsediffsi,jco2flux, & - & jco2fxd,jco2fxu,jco3,jdic,jdicsat,jdms,jdms_bac,jdms_uv,jdmsflux,jdmsprod,jdoc,jdp,jeps,jexpoca, & - & jexport,jexposi,jgrazer,jintdnit,jintnfix,jintphosy,jiralk,jirdet,jirdin,jirdip,jirdoc,jiriron, & - & jiron,jirsi,jkwco2,jlvlalkali,jlvlano3,jlvlasize,jlvlbigd14c,jlvlbromo,jlvlcalc,jlvlcalc13, & - & jlvlcfc11,jlvlcfc12,jlvlco3,jlvld13c,jlvld14c,jlvldic,jlvldic13,jlvldic14,jlvldicsat,jlvldoc, & - & jlvldoc13,jlvleps,jlvlgrazer,jlvlgrazer13,jlvliron,jlvln2o,jlvlnatalkali,jlvlnatcalc,jlvlnatco3, & - & jlvlnatdic,jlvlnatomegaa,jlvlnatomegac,jlvlnos,jlvlo2sat,jlvlomegaa,jlvlomegac,jlvlopal,jlvloxygen,& - & 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,joalk, & - & 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,jsrfph,jwnos,jwphy,jndepfx, & - & joalkfx,nbgc,nacc_bgc,bgcwrt,glb_inventory,bgct2d,acclvl,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, & - & irdin,irdip,irsi,iralk,iriron,irdoc,irdet - ! AGG - use mo_biomod, only: asize3d,eps3d,wnumb,wmass - use mo_param1_bgc, only: inos - use mo_control_bgc, only: dtb - ! BROMO - use mo_param1_bgc, only: iatmbromo,ibromo - use mo_biomod, only: int_chbr3_prod,int_chbr3_uv - use mo_bgcmean, only: jatmbromo,jbromo,jbromo_prod,jbromo_uv,jbromofx,jsrfbromo - ! CFC - use mo_param1_bgc, only: iatmf11,iatmf12,iatmsf6,icfc11,icfc12,isf6 - use mo_bgcmean, only: jcfc11,jcfc11fx,jcfc12,jcfc12fx,jsf6,jsf6fx - ! cisonew - use mo_carbch, only: co213fxd,co213fxu,co214fxd,co214fxu - use mo_biomod, only: c14fac,re1312,re14to + use mo_carbch, only: atm,atmflx,co2fxd,co2fxu,co3,hi,kwco2sol,ndepflx,rivinflx,oalkflx,ocetra,omegaa,omegac,pco2d, & + satoxy,sedfluxo,pco2m,kwco2d,co2sold,co2solm, & + co213fxd,co213fxu,co214fxd,co214fxu, natco3,nathi,natomegaa,natomegac,natpco2d + 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, & + asize3d,eps3d,wnumb,wmass, int_chbr3_prod,int_chbr3_uv, c14fac,re1312,re14to + 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, & + jsediffic,jsediffal,jsediffph,jsediffox,jsediffn2,jsediffno3,jsediffsi,jco2flux, & + jco2fxd,jco2fxu,jco3,jdic,jdicsat,jdms,jdms_bac,jdms_uv,jdmsflux,jdmsprod,jdoc,jdp,jeps,jexpoca, & + jexport,jexposi,jgrazer,jintdnit,jintnfix,jintphosy,jiralk,jirdet,jirdin,jirdip,jirdoc,jiriron, & + jiron,jirsi,jkwco2,jlvlalkali,jlvlano3,jlvlasize,jlvlbigd14c,jlvlbromo,jlvlcalc,jlvlcalc13, & + jlvlcfc11,jlvlcfc12,jlvlco3,jlvld13c,jlvld14c,jlvldic,jlvldic13,jlvldic14,jlvldicsat,jlvldoc, & + jlvldoc13,jlvleps,jlvlgrazer,jlvlgrazer13,jlvliron,jlvln2o,jlvlnatalkali,jlvlnatcalc,jlvlnatco3, & + jlvlnatdic,jlvlnatomegaa,jlvlnatomegac,jlvlnos,jlvlo2sat,jlvlomegaa,jlvlomegac,jlvlopal,jlvloxygen, & + 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,joalk, & + 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,jsrfph,jwnos,jwphy,jndepfx, & + joalkfx,nbgc,nacc_bgc,bgcwrt,glb_inventory,bgct2d,acclvl,acclyr,accsrf,bgczlv, & + jatmbromo,jbromo,jbromo_prod,jbromo_uv,jbromofx,jsrfbromo, & + jcfc11,jcfc11fx,jcfc12,jcfc12fx,jsf6,jsf6fx, & + jatmc13,jatmc14,jbigd14c,jcalc13,jco213fxd,jco213fxu,jco214fxd,jco214fxu,jd13c,jd14c,jdic13,jdic14, & + jdoc13,jgrazer13,jphyto13,jpoc13, & + jlvlnatph,jnatalkali,jnatcalc,jnatco2fx,jnatco3,jnatdic,jnatomegaa,jnatomegac,jnatpco2,jnatph, & + jsrfnatalk,jsrfnatdic,jsrfnatph, & + jbursssc12,jburssso12,jburssssil,jburssster,jpowaal,jpowaic,jpowaox,jpowaph,jpowaph,jpowasi,jpown2, & + jpowno3,jsssc12,jssso12,jssssil,jssster,accbur,accsdm, jatmco2,jatmn2,jatmo2 + use mo_control_bgc, only: io_stdo_bgc, & + dtb, use_BROMO, use_AGG, use_WLIN, use_natDIC, use_CFC, use_sedbypass, use_cisonew, use_BOXATM + 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, & + irdin,irdip,irsi,iralk,iriron,irdoc,irdet,inos,iatmbromo,ibromo, & + iatmf11,iatmf12,iatmsf6,icfc11,icfc12,isf6, & + iatmc13,iatmc14,icalc13,idet13,idoc13,iphy13,isco213,isco214,izoo13,safediv, & + iatmnco2,inatalkali,inatcalc,inatsco212, & + ipowaal,ipowaic,ipowaox,ipowaph,ipowasi,ipown2,ipowno3,isssc12,issso12,issssil,issster + use mo_sedmnt, only: powtra,sedlay,burial use mo_vgrid, only: dp_min - use mo_param1_bgc, only: iatmc13,iatmc14,icalc13,idet13,idoc13,iphy13,isco213,isco214,izoo13,safediv - use mo_bgcmean, only: jatmc13,jatmc14,jbigd14c,jcalc13,jco213fxd,jco213fxu,jco214fxd,jco214fxu,jd13c,jd14c,jdic13,jdic14,& - & jdoc13,jgrazer13,jphyto13,jpoc13 - ! natDIC - use mo_param1_bgc, only: iatmnco2,inatalkali,inatcalc,inatsco212 - use mo_carbch, only: natco3,nathi,natomegaa,natomegac,natpco2d - use mo_bgcmean, only: jlvlnatph,jnatalkali,jnatcalc,jnatco2fx,jnatco3,jnatdic,jnatomegaa,jnatomegac,jnatpco2,jnatph, & - & jsrfnatalk,jsrfnatdic,jsrfnatph - ! NOT sedbypass - use mo_param1_bgc, only: ipowaal,ipowaic,ipowaox,ipowaph,ipowasi,ipown2,ipowno3,isssc12,issso12,issssil,issster - use mo_sedmnt, only: powtra,sedlay,burial - use mo_bgcmean, only: jbursssc12,jburssso12,jburssssil,jburssster,jpowaal,jpowaic,jpowaox,jpowaph,jpowaph,jpowasi,jpown2, & - & jpowno3,jsssc12,jssso12,jssssil,jssster,accbur,accsdm - ! BOXATM - use mo_bgcmean, only: jatmco2,jatmn2,jatmo2 - use mo_control_bgc, only: use_BROMO, use_AGG, use_WLIN, use_natDIC, use_CFC, use_sedbypass, use_cisonew, use_BOXATM implicit none @@ -112,17 +98,14 @@ SUBROUTINE ACCFIELDS(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask) REAL , intent(in) :: pddpo(kpie,kpje,kpke) REAL , intent(in) :: omask(kpie,kpje) -! Local variables + ! Local variables INTEGER :: i,j,k,l INTEGER :: ind1(kpie,kpje),ind2(kpie,kpje) REAL :: wghts(kpie,kpje,ddm) - - ! cisonew - REAL :: di12c - REAL :: d13c(kpie,kpje,kpke) - REAL :: d14c(kpie,kpje,kpke) - REAL :: bigd14c(kpie,kpje,kpke) - + REAL :: di12c ! cisonew + REAL :: d13c(kpie,kpje,kpke) ! cisonew + REAL :: d14c(kpie,kpje,kpke) ! cisonew + REAL :: bigd14c(kpie,kpje,kpke) ! cisonew if (use_cisonew) then ! Calculation d13C, d14C and Dd14C: Delta notation for output @@ -146,8 +129,8 @@ SUBROUTINE ACCFIELDS(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask) end if -! Accumulated fluxes for inventory.F90. Note that these are currently not written to restart! -! Division by 2 is to account for leap-frog timestepping (but this is not exact) + ! Accumulated fluxes for inventory.F90. Note that these are currently not written to restart! + ! Division by 2 is to account for leap-frog timestepping (but this is not exact) do j=1,kpje do i=1,kpie if(omask(i,j).gt.0.5) then @@ -261,11 +244,11 @@ SUBROUTINE ACCFIELDS(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask) call accsrf(jbromo_uv,int_chbr3_uv,omask,0) endif -! Accumulate fluxes due to N-deposition, ocean alkalinization + ! Accumulate fluxes due to N-deposition, ocean alkalinization call accsrf(jndepfx,ndepflx,omask,0) call accsrf(joalkfx,oalkflx,omask,0) -! Accumulate the diagnostic mass sinking field + ! Accumulate the diagnostic mass sinking field IF( domassfluxes ) THEN call accsrf(jcarflx0100,carflx0100,omask,0) call accsrf(jbsiflx0100,bsiflx0100,omask,0) @@ -298,7 +281,7 @@ SUBROUTINE ACCFIELDS(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask) call accsrf(jsediffsi,sedfluxo(1,1,ipowasi),omask,0) endif -! Accumulate layer diagnostics + ! Accumulate layer diagnostics call acclyr(jdp,pddpo,pddpo,0) call acclyr(jphyto,ocetra(1,1,1,iphy),pddpo,1) call acclyr(jgrazer,ocetra(1,1,1,izoo),pddpo,1) diff --git a/hamocc/aufr_bgc.F90 b/hamocc/aufr_bgc.F90 index ab699cf3..02da7f23 100644 --- a/hamocc/aufr_bgc.F90 +++ b/hamocc/aufr_bgc.F90 @@ -104,36 +104,25 @@ SUBROUTINE AUFR_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & use netcdf, only: nf90_global,nf90_noerr,nf90_nowrite,nf90_close,nf90_open,nf90_get_att,nf90_inq_varid use mo_carbch, only: co2star,co3,hi,satoxy - use mo_control_bgc, only: io_stdo_bgc,ldtbgc + use mo_carbch, only: ocetra + use mo_carbch, only: atm + use mo_carbch, only: nathi + use mo_control_bgc, only: io_stdo_bgc,ldtbgc,use_cisonew,use_AGG,use_BOXATM,use_BROMO,use_CFC,use_natDIC,use_sedbypass use mo_param1_bgc, only: ialkali,ian2o,iano3,icalc,idet,idicsat,idms,idoc,ifdust,igasnit,iiron,iopal,ioxygen,iphosph,iphy,& - & iprefalk,iprefdic,iprefo2,iprefpo4,isco212,isilica,izoo,nocetra + iprefalk,iprefdic,iprefo2,iprefpo4,isco212,isilica,izoo,nocetra use mo_vgrid, only: kbo use mo_sedmnt, only: sedhpl use mo_intfcblom, only: sedlay2,powtra2,burial2,atm2 use mod_xc, only: nbdy,mnproc,iqr,jqr,xcbcst,xchalt use mod_dia, only: iotype - ! AGG - use mo_param1_bgc, only: iadust,inos - ! BOXATM - use mo_param1_bgc, only: iatmco2,iatmn2,iatmo2 - use mo_carbch, only: atm - ! BROMO - use mo_param1_bgc, only: ibromo - ! CFC - use mo_param1_bgc, only: icfc11,icfc12,isf6 - ! cisonew - use mo_carbch, only: ocetra - use mo_biomod, only: bifr13,bifr14,c14fac,re1312,re14to,prei13,prei14 - use mo_param1_bgc, only: icalc13,icalc14,idet13,idet14,idoc13,idoc14,iphy13,iphy14,isco213,isco214,izoo13,izoo14,safediv - use mo_param1_bgc, only: issso13,issso14,isssc13,isssc14,ipowc13,ipowc14 - use mo_param1_bgc, only: iatmc13,iatmc14,iatmnco2 use mo_bgcmean, only: jatmo2,jatmn2 - ! natDIC - use mo_param1_bgc, only: inatalkali,inatcalc,inatsco212 - use mo_carbch, only: nathi - ! NOT sedbypass - use mo_param1_bgc, only: ipowaal,ipowaic,ipowaox,ipowaph,ipowasi,ipown2,ipowno3,isssc12,issso12,issssil,issster,ks - use mo_control_bgc, only: use_cisonew, use_AGG, use_BOXATM, use_BROMO, use_CFC, use_natDIC, use_sedbypass + use mo_biomod, only: bifr13,bifr14,c14fac,re1312,re14to,prei13,prei14 + use mo_param1_bgc, only: iadust,inos,iatmco2,iatmn2,iatmo2,ibromo,icfc11,icfc12,isf6, & + icalc13,icalc14,idet13,idet14,idoc13,idoc14,iphy13,iphy14,isco213,isco214,izoo13,izoo14,safediv, & + issso13,issso14,isssc13,isssc14,ipowc13,ipowc14, & + iatmc13,iatmc14,iatmnco2, & + inatalkali,inatcalc,inatsco212, & + ipowaal,ipowaic,ipowaox,ipowaph,ipowasi,ipown2,ipowno3,isssc12,issso12,issssil,issster,ks implicit none @@ -168,15 +157,15 @@ SUBROUTINE AUFR_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & character(len=9) :: stripestr2 integer :: ierr,testio INTEGER :: leninrstfn -! -! Allocate and initialize local array for reading (locetra) -! + ! + ! Allocate and initialize local array for reading (locetra) + ! allocate(locetra(kpie,kpje,2*kpke,nocetra),stat=errstat) if(errstat.ne.0) stop 'not enough memory for locetra allocation' locetra(:,:,:,:) = 0.0 -! -! Open netCDF data file -! + ! + ! Open netCDF data file + ! testio=0 IF(mnproc==1 .AND. IOTYPE==0) THEN ncstat = NF90_OPEN(rstfnm,NF90_NOWRITE, ncid) @@ -184,14 +173,13 @@ SUBROUTINE AUFR_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & CALL xchalt('(AUFR: Problem with netCDF1)') stop '(AUFR: Problem with netCDF1)' ENDIF - -! -! Read restart data : date -! + ! + ! Read restart data : date + ! ncstat = NF90_GET_ATT(ncid, NF90_GLOBAL,'date', idate) IF ( ncstat .NE. NF90_NOERR ) THEN CALL xchalt('(AUFR: Problem reading date of restart file)') - stop '(AUFR: Problem reading date of restart file)' + stop '(AUFR: Problem reading date of restart file)' ENDIF restyear = idate(1) restmonth = idate(2) @@ -223,13 +211,13 @@ SUBROUTINE AUFR_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & stop '(AUFR: Problem with netCDF1)' ENDIF -! -! Read restart data : date -! + ! + ! Read restart data : date + ! ncstat = NFMPI_GET_ATT_INT(ncid, NF_GLOBAL,'date', idate) IF ( ncstat .NE. NF_NOERR ) THEN CALL xchalt('(AUFR: Problem reading date of restart file)') - stop '(AUFR: Problem reading date of restart file)' + stop '(AUFR: Problem reading date of restart file)' ENDIF restyear = idate(1) restmonth = idate(2) @@ -253,9 +241,9 @@ SUBROUTINE AUFR_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & endif ENDIF -! -! Compare with date read from ocean restart file -! + ! + ! Compare with date read from ocean restart file + ! IF (mnproc.eq.1) THEN IF ( kplyear .NE. restyear ) THEN @@ -278,7 +266,7 @@ SUBROUTINE AUFR_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & ENDIF -! Find out whether to restart CFCs + ! Find out whether to restart CFCs if (use_CFC) then lread_cfc=.true. IF(IOTYPE==0) THEN @@ -298,7 +286,7 @@ SUBROUTINE AUFR_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & ENDIF end if -! Find out whether to restart natural tracers + ! Find out whether to restart natural tracers if (use_natDIC) then lread_nat=.true. IF(IOTYPE==0) THEN @@ -319,7 +307,7 @@ SUBROUTINE AUFR_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & ENDIF end if -! Find out whether to restart marine carbon isotopes + ! Find out whether to restart marine carbon isotopes if (use_cisonew) then lread_iso=.true. IF(IOTYPE==0) THEN @@ -339,7 +327,7 @@ SUBROUTINE AUFR_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & ENDIF end if -! Find out whether to restart Bromoform + ! Find out whether to restart Bromoform if (use_BROMO) then lread_bro=.true. IF(IOTYPE==0) THEN @@ -359,7 +347,7 @@ SUBROUTINE AUFR_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & ENDIF end if -! Find out whether to restart atmosphere + ! Find out whether to restart atmosphere if (use_BOXATM) then lread_atm=.true. IF(IOTYPE==0) THEN @@ -378,9 +366,9 @@ SUBROUTINE AUFR_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & WRITE(io_stdo_bgc,*) ' Initialising atmosphere from scratch ' ENDIF end if -! -! Read restart data : ocean aquateous tracer -! + ! + ! Read restart data : ocean aquateous tracer + ! CALL read_netcdf_var(ncid,'sco212',locetra(1,1,1,isco212),2*kpke,0,iotype) CALL read_netcdf_var(ncid,'alkali',locetra(1,1,1,ialkali),2*kpke,0,iotype) CALL read_netcdf_var(ncid,'phosph',locetra(1,1,1,iphosph),2*kpke,0,iotype) @@ -449,17 +437,16 @@ SUBROUTINE AUFR_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & CALL read_netcdf_var(ncid,'bromo',locetra(1,1,1,ibromo),2*kpke,0,iotype) ENDIF end if -! -! Read restart data : diagnostic ocean fields (needed for bit to bit reproducability) -! + ! + ! Read restart data : diagnostic ocean fields (needed for bit to bit reproducability) + ! CALL read_netcdf_var(ncid,'hi',hi(1,1,1),kpke,0,iotype) CALL read_netcdf_var(ncid,'co3',co3(1,1,1),kpke,0,iotype) CALL read_netcdf_var(ncid,'co2star',co2star(1,1,1),kpke,0,iotype) CALL read_netcdf_var(ncid,'satoxy',satoxy(1,1,1),kpke,0,iotype) - -! -! Read restart data : sediment variables. -! + ! + ! Read restart data : sediment variables. + ! if (.not. use_sedbypass) then CALL read_netcdf_var(ncid,'ssso12',sedlay2(1,1,1,issso12),2*ks,0,iotype) CALL read_netcdf_var(ncid,'sssc12',sedlay2(1,1,1,isssc12),2*ks,0,iotype) @@ -492,9 +479,9 @@ SUBROUTINE AUFR_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & ENDIF endif end if -! -! Read restart data: atmosphere -! + ! + ! Read restart data: atmosphere + ! if (use_BOXATM) then IF(lread_atm) THEN CALL read_netcdf_var(ncid,'atmco2',atm2(1,1,1,iatmco2),2,0,iotype) @@ -620,11 +607,11 @@ SUBROUTINE AUFR_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & ENDIF ! .NOT. lread_iso end if ! use_cisonew -! return tracer fields to ocean model (both timelevels); No unit -! conversion here, since tracers in the restart file are in -! BLOM units (mol/kg) -!-------------------------------------------------------------------- -! + ! return tracer fields to ocean model (both timelevels); No unit + ! conversion here, since tracers in the restart file are in + ! BLOM units (mol/kg) + !-------------------------------------------------------------------- + ! trc(1:kpie,1:kpje,:,itrbgc:itrbgc+ntrbgc-1)=locetra(:,:,:,:) deallocate(locetra) diff --git a/hamocc/aufw_bgc.F90 b/hamocc/aufw_bgc.F90 index 232b8b09..8636d550 100644 --- a/hamocc/aufw_bgc.F90 +++ b/hamocc/aufw_bgc.F90 @@ -18,7 +18,7 @@ ! along with BLOM. If not, see https://www.gnu.org/licenses/. - SUBROUTINE AUFW_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & + SUBROUTINE AUFW_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & kplyear,kplmon,kplday,kpldtoce,omask,rstfnm) !****************************************************************************** ! @@ -96,35 +96,24 @@ SUBROUTINE AUFW_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & ! *CHAR* *rstfnm* - restart file name-informations ! !************************************************************************** - use netcdf, only: nf90_64bit_offset,nf90_global,nf90_noerr,nf90_nofill,nf90_def_dim,nf90_enddef,nf90_close, & - & nf90_create,nf90_put_att,nf90_set_fill - use mo_carbch, only: co2star,co3, hi,satoxy - use mo_control_bgc, only: io_stdo_bgc,ldtbgc,rmasko - use mo_param1_bgc, only: ialkali, ian2o,iano3,icalc,idet,idicsat,idms,idoc,ifdust,igasnit,iiron,iopal,ioxygen,iphosph,iphy, & - & iprefalk,iprefdic,iprefo2,iprefpo4,isco212,isilica,izoo,ks,nocetra + use netcdf, only: nf90_64bit_offset,nf90_global,nf90_noerr,nf90_nofill,nf90_def_dim,nf90_enddef,nf90_close, & + nf90_create,nf90_put_att,nf90_set_fill + use mo_carbch, only: co2star,co3,hi,satoxy,nathi + use mo_control_bgc, only: io_stdo_bgc,ldtbgc,rmasko, & + use_cisonew, use_AGG, use_BOXATM, use_BROMO, use_CFC, use_natDIC, use_sedbypass use mo_sedmnt, only: sedhpl use mo_intfcblom, only: sedlay2,powtra2,burial2,atm2 use mod_xc, only: nbdy,itdm,jtdm,mnproc,iqr,jqr,xchalt use mod_dia, only: iotype - ! AGG - use mo_param1_bgc, only: iadust, inos - ! BOXATM - use mo_param1_bgc, only: iatmco2,iatmn2,iatmo2 - ! BROMO - use mo_param1_bgc, only: ibromo - ! CFC - use mo_param1_bgc, only: icfc11,icfc12,isf6 - ! cisonew - use mo_param1_bgc, only: icalc13,icalc14,idet13,idet14,idoc13,idoc14,iphy13,iphy14,isco213,isco214,izoo13,izoo14 - use mo_param1_bgc, only: issso13,issso14,isssc13,isssc14,ipowc13,ipowc14 - use mo_param1_bgc, only: iatmnco2,iatmc13,iatmc14 use mo_control_bgc, only: rmasks - ! natDIC - use mo_param1_bgc, only: inatalkali,inatcalc,inatsco212 - use mo_carbch, only: nathi - ! NOT sedbypass - use mo_param1_bgc, only: ipowaal,ipowaic,ipowaox,ipowaph,ipowasi,ipown2,ipowno3,isssc12,issso12,issssil,issster - use mo_control_bgc, only: use_cisonew, use_AGG, use_BOXATM, use_BROMO, use_CFC, use_natDIC, use_sedbypass + use mo_param1_bgc, only: ialkali, ian2o,iano3,icalc,idet,idicsat,idms,idoc,ifdust,igasnit,iiron,iopal,ioxygen,iphosph,iphy, & + iprefalk,iprefdic,iprefo2,iprefpo4,isco212,isilica,izoo,ks,nocetra, & + iadust, inos,iatmco2,iatmn2,iatmo2,ibromo,icfc11,icfc12,isf6, & + icalc13,icalc14,idet13,idet14,idoc13,idoc14,iphy13,iphy14,isco213,isco214,izoo13,izoo14, & + issso13,issso14,isssc13,isssc14,ipowc13,ipowc14, & + iatmnco2,iatmc13,iatmc14, & + inatalkali,inatcalc,inatsco212, & + ipowaal,ipowaic,ipowaox,ipowaph,ipowasi,ipown2,ipowno3,isssc12,issso12,issssil,issster implicit none @@ -158,17 +147,16 @@ SUBROUTINE AUFW_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & save /xcmpii/ #endif -! pass tracer fields in from ocean model, note that both timelevels -! are passed into the local array locetra; No unit conversion here, -! tracers in the restart file are written in mol/kg -!-------------------------------------------------------------------- -! + ! pass tracer fields in from ocean model, note that both timelevels + ! are passed into the local array locetra; No unit conversion here, + ! tracers in the restart file are written in mol/kg + !-------------------------------------------------------------------- + ! testio=0 -! -! Allocate and initialize local array for writing (locetra) -! - locetra(:,:,:,:) = trc(1:kpie,1:kpje,:,itrbgc:itrbgc+ntrbgc-1) ! TODO - is this right? - !locetra(:,:,:,1:) = trc(1:kpie,1:kpje,:,itrbgc:itrbgc+ntrbgc-1) + ! + ! Initialize local array for writing (locetra) + ! + locetra(:,:,:,:) = trc(1:kpie,1:kpje,:,itrbgc:itrbgc+ntrbgc-1) idate(1) = kplyear idate(2) = kplmon @@ -176,18 +164,17 @@ SUBROUTINE AUFW_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & idate(4) = kpldtoce idate(5) = ldtbgc IF (mnproc.eq.1) THEN - WRITE(io_stdo_bgc,*) ' ' - WRITE(io_stdo_bgc,*) 'Writing restart file at date :' & - &,'YY=',idate(1),' MM=',idate(2),' day=',idate(3) - WRITE(io_stdo_bgc,*) 'Ocean model step number is ',idate(4) - WRITE(io_stdo_bgc,*) 'Bgc model step number is ',idate(5) + WRITE(io_stdo_bgc,*) ' ' + WRITE(io_stdo_bgc,*) 'Writing restart file at date :' & + &,'YY=',idate(1),' MM=',idate(2),' day=',idate(3) + WRITE(io_stdo_bgc,*) 'Ocean model step number is ',idate(4) + WRITE(io_stdo_bgc,*) 'Bgc model step number is ',idate(5) ENDIF rmissing = rmasko - -! -! Open netCDF data file -! + ! + ! Open netCDF data file + ! IF(mnproc==1 .AND. IOTYPE==0) THEN write(io_stdo_bgc,*) 'BGC RESTART ',rstfnm ncstat = NF90_CREATE(rstfnm,NF90_64BIT_OFFSET,ncid) @@ -213,22 +200,21 @@ SUBROUTINE AUFW_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & stop '(AUFW: Problem with netCDF1)' ENDIF #endif - if(testio .eq. 0) then CALL xchalt('(AUFW: Problem with namelist iotype)') stop '(AUFW: Problem with namelist iotype)' endif ENDIF -! -! Define dimension -! ---------------------------------------------------------------------- -! + ! + ! Define dimension + ! ---------------------------------------------------------------------- + ! IF(mnproc==1 .AND. IOTYPE==0) THEN - ncstat = NF90_DEF_DIM(ncid, 'lon', itdm, nclonid) - IF ( ncstat .NE. NF90_NOERR ) THEN - call xchalt('(AUFW: Problem with netCDF2)') - stop '(AUFW: Problem with netCDF2)' + ncstat = NF90_DEF_DIM(ncid, 'lon', itdm, nclonid) + IF ( ncstat .NE. NF90_NOERR ) THEN + call xchalt('(AUFW: Problem with netCDF2)') + stop '(AUFW: Problem with netCDF2)' ENDIF ncstat = NF90_DEF_DIM(ncid, 'lat', jtdm, nclatid) @@ -317,13 +303,14 @@ SUBROUTINE AUFW_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & stop '(AUFW: Problem with PnetCDF7)' ENDIF #endif - ENDIF - -! -! Define global attributes -! ---------------------------------------------------------------------- -! - IF(mnproc==1 .AND. IOTYPE==0) THEN + ENDIF !mnproc==1 .AND. IOTYPE==0 + + ! + ! Define global attributes + ! ---------------------------------------------------------------------- + ! + IF (mnproc==1 .AND. IOTYPE==0) THEN + ncstat = NF90_PUT_ATT(ncid, NF90_GLOBAL,'title' & &, 'Restart data for marine bgc modules') IF ( ncstat .NE. NF90_NOERR ) THEN @@ -358,8 +345,8 @@ SUBROUTINE AUFW_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & stop '(AUFW: Problem with netCDF11)' ENDIF -!PNETCDF - ELSE IF (IOTYPE==1) THEN + ELSE IF (IOTYPE==1) THEN + #ifdef PNETCDF clen=len('Restart data for marine bgc modules') ncstat = NFMPI_PUT_ATT_TEXT(ncid, NF_GLOBAL,'title' & @@ -398,571 +385,568 @@ SUBROUTINE AUFW_BGC(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc, & ENDIF #endif - ENDIF -! -! Define variables : advected ocean tracer -! ---------------------------------------------------------------------- -! + ENDIF ! IOTYPE == 1 + ! + ! Define variables : advected ocean tracer + ! ---------------------------------------------------------------------- + ! + IF((mnproc==1 .AND. IOTYPE==0) .OR. IOTYPE==1) THEN + ncdimst(1) = nclonid + ncdimst(2) = nclatid + ncdimst(3) = nclev2id + ncdimst(4) = 0 + ENDIF + + CALL NETCDF_DEF_VARDB(ncid,6,'sco212',3,ncdimst,ncvarid, & + & 6,'mol/kg',13, 'Dissolved CO2',rmissing,10,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,6,'alkali',3,ncdimst,ncvarid, & + & 6,'mol/kg',10,'Alkalinity',rmissing,11,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,6,'phosph',3,ncdimst,ncvarid, & + & 6,'mol/kg',19,'Dissolved phosphate',rmissing,12,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,6,'oxygen',3,ncdimst,ncvarid, & + & 6,'mol/kg',16,'Dissolved oxygen', & + rmissing,13,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,6,'gasnit',3,ncdimst,ncvarid, & + & 6,'mol/kg',21,'Gaseous nitrogen (N2)', & + rmissing,14,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,4,'ano3',3,ncdimst,ncvarid, & + & 6,'mol/kg',17,'Dissolved nitrate', & + rmissing,15,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,6,'silica',3,ncdimst,ncvarid, & + & 6,'mol/kg',22,'Silicid acid (Si(OH)4)', & + rmissing,16,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,3,'doc',3,ncdimst,ncvarid, & + & 6,'mol/kg',24,'Dissolved organic carbon', & + & rmissing,17,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,3,'poc',3,ncdimst,ncvarid, & + & 6,'mol/kg',25,'Particulate organic carbon', & + & rmissing,18,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,5,'phyto',3,ncdimst,ncvarid, & + & 7,'molP/kg',27,'Phytoplankton concentration', & + & rmissing,19,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,6,'grazer',3,ncdimst,ncvarid, & + & 7,'molP/kg',25,'Zooplankton concentration', & + & rmissing,20,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,6,'calciu',3,ncdimst,ncvarid, & + & 6,'mol/kg',17,'Calcium carbonate', & + & rmissing,21,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,4,'opal',3,ncdimst,ncvarid, & + & 6,'mol/kg',15,'Biogenic silica', & + & rmissing,22,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,3,'n2o',3,ncdimst,ncvarid, & + & 6,'mol/kg',12,'laughing gas', & + & rmissing,23,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,3,'dms',3,ncdimst,ncvarid, & + & 6,'mol/kg',15 ,'DiMethylSulfide', & + & rmissing,24,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,5,'fdust',3,ncdimst,ncvarid, & + & 5,'kg/kg',19,'Non-aggregated dust', & + & rmissing,25,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,4,'iron',3,ncdimst,ncvarid, & + & 6,'mol/kg',14,'Dissolved iron', & + & rmissing,26,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,6,'prefo2',3,ncdimst,ncvarid, & + & 6,'mol/kg',16,'Preformed oxygen', & + rmissing,27,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,7,'prefpo4',3,ncdimst,ncvarid, & + & 6,'mol/kg',19,'Preformed phosphate', & + rmissing,28,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,7,'prefalk',3,ncdimst,ncvarid, & + & 6,'mol/kg',20,'Preformed alkalinity', & + rmissing,29,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,7,'prefdic',3,ncdimst,ncvarid, & + & 6,'mol/kg',13,'Preformed dic', & + rmissing,30,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,6,'dicsat',3,ncdimst,ncvarid, & + & 6,'mol/kg',13,'Saturated dic', & + rmissing,31,io_stdo_bgc) + + if (use_cisonew) then + CALL NETCDF_DEF_VARDB(ncid,6,'sco213',3,ncdimst,ncvarid, & + & 6,'mol/kg',15, 'Dissolved CO213',rmissing,32,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,6,'sco214',3,ncdimst,ncvarid, & + & 6,'mol/kg',15, 'Dissolved CO214',rmissing,33,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,5,'doc13',3,ncdimst,ncvarid, & + & 6,'mol/kg',24,'Dissolved organic carb13', & + & rmissing,34,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,5,'doc14',3,ncdimst,ncvarid, & + & 6,'mol/kg',24,'Dissolved organic carb14', & + & rmissing,35,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,5,'poc13',3,ncdimst,ncvarid, & + & 7,'molC/kg',28,'Particulate organic carbon13', & + & rmissing,36,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,5,'poc14',3,ncdimst,ncvarid, & + & 7,'molC/kg',28,'Particulate organic carbon14', & + & rmissing,37,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,7,'phyto13',3,ncdimst,ncvarid, & + & 7,'molP/kg',27,'Phytoplankton concentr. 13c', & + & rmissing,38,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,7,'phyto14',3,ncdimst,ncvarid, & + & 7,'molP/kg',27,'Phytoplankton concentr. 14c', & + & rmissing,39,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,8,'grazer13',3,ncdimst,ncvarid, & + & 7,'molP/kg',25,'Zooplankton concentr. 13c', & + & rmissing,40,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,8,'grazer14',3,ncdimst,ncvarid, & + & 7,'molP/kg',25,'Zooplankton concentr. 14c', & + & rmissing,41,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,8,'calciu13',3,ncdimst,ncvarid, & + & 7,'molC/kg',19,'Calcium carbonate13', & + & rmissing,42,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,8,'calciu14',3,ncdimst,ncvarid, & + & 7,'molC/kg',19,'Calcium carbonate14', & + & rmissing,43,io_stdo_bgc) + end if + if (use_AGG) then + CALL NETCDF_DEF_VARDB(ncid,4,'snos',3,ncdimst,ncvarid, & + & 3,'1/g',38,'marine snow aggregates per g sea water', & + & rmissing,44,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,5,'adust',3,ncdimst,ncvarid, & + & 4,'g/kg',15,'Aggregated dust', & + & rmissing,45,io_stdo_bgc) + end if + if (use_CFC) then + CALL NETCDF_DEF_VARDB(ncid,5,'cfc11',3,ncdimst,ncvarid, & + & 6,'mol/kg',5,'CFC11', & + & rmissing,47,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,5,'cfc12',3,ncdimst,ncvarid, & + & 6,'mol/kg',5,'CFC12', & + & rmissing,48,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,3,'sf6',3,ncdimst,ncvarid, & + & 6,'mol/kg',4,'SF-6', & + & rmissing,49,io_stdo_bgc) + end if + if (use_natDIC) then + CALL NETCDF_DEF_VARDB(ncid,9,'natsco212',3,ncdimst,ncvarid, & + & 6,'mol/kg',21, 'Natural dissolved CO2',rmissing,50,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,9,'natalkali',3,ncdimst,ncvarid, & + & 6,'mol/kg',18,'Natural alkalinity',rmissing,51,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,9,'natcalciu',3,ncdimst,ncvarid, & + & 6,'mol/kg',25,'Natural calcium carbonate', & + & rmissing,52,io_stdo_bgc) + end if + if (use_BROMO) then + CALL NETCDF_DEF_VARDB(ncid,5,'bromo',3,ncdimst,ncvarid, & + & 6,'mol/kg',9,'Bromoform',rmissing,47,io_stdo_bgc) + end if + + ! + ! Define variables : diagnostic ocean fields + ! ---------------------------------------------------------------------- + ! + IF((mnproc==1 .AND. IOTYPE==0) .OR. IOTYPE==1) THEN + ncdimst(1) = nclonid + ncdimst(2) = nclatid + ncdimst(3) = nclevid + ncdimst(4) = 0 + ENDIF + + CALL NETCDF_DEF_VARDB(ncid,2,'hi',3,ncdimst,ncvarid, & + & 6,'mol/kg',26,'Hydrogen ion concentration', & + & rmissing,60,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,3,'co3',3,ncdimst,ncvarid, & + & 6,'mol/kg',25,'Dissolved carbonate (CO3)', & + & rmissing,61,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,7,'co2star',3,ncdimst,ncvarid, & + & 6,'mol/kg',20,'Dissolved CO2 (CO2*)', & + & rmissing,62,io_stdo_bgc) + + CALL NETCDF_DEF_VARDB(ncid,6,'satoxy',3,ncdimst,ncvarid, & + & 6,'mol/kg',16 ,'Saturated oxygen', & + & rmissing,63,io_stdo_bgc) + + if (use_natDIC) then + CALL NETCDF_DEF_VARDB(ncid,5,'nathi',3,ncdimst,ncvarid, & + & 6,'mol/kg',34,'Natural hydrogen ion concentration', & + & rmissing,64,io_stdo_bgc) + end if + ! + ! Define variables : sediment + ! ---------------------------------------------------------------------- + ! + if (.not. use_sedbypass) then + IF((mnproc==1 .AND. IOTYPE==0) .OR. IOTYPE==1) THEN - ncdimst(1) = nclonid - ncdimst(2) = nclatid - ncdimst(3) = nclev2id - ncdimst(4) = 0 + ncdimst(1) = nclonid + ncdimst(2) = nclatid + ncdimst(3) = ncks2id + ncdimst(4) = 0 ENDIF - CALL NETCDF_DEF_VARDB(ncid,6,'sco212',3,ncdimst,ncvarid, & - & 6,'mol/kg',13, 'Dissolved CO2',rmissing,10,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,6,'alkali',3,ncdimst,ncvarid, & - & 6,'mol/kg',10,'Alkalinity',rmissing,11,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,6,'phosph',3,ncdimst,ncvarid, & - & 6,'mol/kg',19,'Dissolved phosphate',rmissing,12,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,6,'oxygen',3,ncdimst,ncvarid, & - & 6,'mol/kg',16,'Dissolved oxygen', & - rmissing,13,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,6,'gasnit',3,ncdimst,ncvarid, & - & 6,'mol/kg',21,'Gaseous nitrogen (N2)', & - rmissing,14,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,4,'ano3',3,ncdimst,ncvarid, & - & 6,'mol/kg',17,'Dissolved nitrate', & - rmissing,15,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,6,'silica',3,ncdimst,ncvarid, & - & 6,'mol/kg',22,'Silicid acid (Si(OH)4)', & - rmissing,16,io_stdo_bgc) + CALL NETCDF_DEF_VARDB(ncid,6,'ssso12',3,ncdimst,ncvarid, & + & 9,'kmol/m**3',35,'Sediment accumulated organic carbon', & + & rmissing,70,io_stdo_bgc) - CALL NETCDF_DEF_VARDB(ncid,3,'doc',3,ncdimst,ncvarid, & - & 6,'mol/kg',24,'Dissolved organic carbon', & - & rmissing,17,io_stdo_bgc) + CALL NETCDF_DEF_VARDB(ncid,6,'sssc12',3,ncdimst,ncvarid, & + & 9,'kmol/m**3',38,'Sediment accumulated calcium carbonate', & + & rmissing,71,io_stdo_bgc) - CALL NETCDF_DEF_VARDB(ncid,3,'poc',3,ncdimst,ncvarid, & - & 6,'mol/kg',25,'Particulate organic carbon', & - & rmissing,18,io_stdo_bgc) + CALL NETCDF_DEF_VARDB(ncid,6,'ssssil',3,ncdimst,ncvarid, & + & 9,'kmol/m**3',25,'Sediment accumulated opal', & + & rmissing,72,io_stdo_bgc) - CALL NETCDF_DEF_VARDB(ncid,5,'phyto',3,ncdimst,ncvarid, & - & 7,'molP/kg',27,'Phytoplankton concentration', & - & rmissing,19,io_stdo_bgc) + CALL NETCDF_DEF_VARDB(ncid,6,'ssster',3,ncdimst,ncvarid, & + & 7,'kg/m**3',25,'Sediment accumulated clay', & + & rmissing,73,io_stdo_bgc) - CALL NETCDF_DEF_VARDB(ncid,6,'grazer',3,ncdimst,ncvarid, & - & 7,'molP/kg',25,'Zooplankton concentration', & - & rmissing,20,io_stdo_bgc) + CALL NETCDF_DEF_VARDB(ncid,6,'powaic',3,ncdimst,ncvarid, & + & 9,'kmol/m**3',23,'Sediment pore water CO2', & + & rmissing,74,io_stdo_bgc) - CALL NETCDF_DEF_VARDB(ncid,6,'calciu',3,ncdimst,ncvarid, & - & 6,'mol/kg',17,'Calcium carbonate', & - & rmissing,21,io_stdo_bgc) + CALL NETCDF_DEF_VARDB(ncid,6,'powaal',3,ncdimst,ncvarid, & + & 9,'kmol/m**3',30,'Sediment pore water alkalinity', & + & rmissing,75,io_stdo_bgc) - CALL NETCDF_DEF_VARDB(ncid,4,'opal',3,ncdimst,ncvarid, & - & 6,'mol/kg',15,'Biogenic silica', & - & rmissing,22,io_stdo_bgc) + CALL NETCDF_DEF_VARDB(ncid,6,'powaph',3,ncdimst,ncvarid, & + & 9,'kmol/m**3',29,'Sediment pore water phosphate', & + & rmissing,76,io_stdo_bgc) - CALL NETCDF_DEF_VARDB(ncid,3,'n2o',3,ncdimst,ncvarid, & - & 6,'mol/kg',12,'laughing gas', & - & rmissing,23,io_stdo_bgc) + CALL NETCDF_DEF_VARDB(ncid,6,'powaox',3,ncdimst,ncvarid, & + & 9,'kmol/m**3',26,'Sediment pore water oxygen', & + & rmissing,77,io_stdo_bgc) - CALL NETCDF_DEF_VARDB(ncid,3,'dms',3,ncdimst,ncvarid, & - & 6,'mol/kg',15 ,'DiMethylSulfide', & - & rmissing,24,io_stdo_bgc) + CALL NETCDF_DEF_VARDB(ncid,5,'pown2',3,ncdimst,ncvarid, & + & 9,'kmol/m**3',36,'Sediment pore water gaseous nitrogen', & + & rmissing,78,io_stdo_bgc) - CALL NETCDF_DEF_VARDB(ncid,5,'fdust',3,ncdimst,ncvarid, & - & 5,'kg/kg',19,'Non-aggregated dust', & - & rmissing,25,io_stdo_bgc) + CALL NETCDF_DEF_VARDB(ncid,6,'powno3',3,ncdimst,ncvarid, & + & 9,'kmol/m**3',33,'Sediment pore water nitrate (NO3)', & + & rmissing,79,io_stdo_bgc) - CALL NETCDF_DEF_VARDB(ncid,4,'iron',3,ncdimst,ncvarid, & - & 6,'mol/kg',14,'Dissolved iron', & - & rmissing,26,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,6,'prefo2',3,ncdimst,ncvarid, & - & 6,'mol/kg',16,'Preformed oxygen', & - rmissing,27,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,7,'prefpo4',3,ncdimst,ncvarid, & - & 6,'mol/kg',19,'Preformed phosphate', & - rmissing,28,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,7,'prefalk',3,ncdimst,ncvarid, & - & 6,'mol/kg',20,'Preformed alkalinity', & - rmissing,29,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,7,'prefdic',3,ncdimst,ncvarid, & - & 6,'mol/kg',13,'Preformed dic', & - rmissing,30,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,6,'dicsat',3,ncdimst,ncvarid, & - & 6,'mol/kg',13,'Saturated dic', & - rmissing,31,io_stdo_bgc) + CALL NETCDF_DEF_VARDB(ncid,6,'powasi',3,ncdimst,ncvarid, & + & 9,'kmol/m**3',42,'Sediment pore water silicid acid (Si(OH)4)',& + & rmissing,80,io_stdo_bgc) if (use_cisonew) then - CALL NETCDF_DEF_VARDB(ncid,6,'sco213',3,ncdimst,ncvarid, & - & 6,'mol/kg',15, 'Dissolved CO213',rmissing,32,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,6,'sco214',3,ncdimst,ncvarid, & - & 6,'mol/kg',15, 'Dissolved CO214',rmissing,33,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,5,'doc13',3,ncdimst,ncvarid, & - & 6,'mol/kg',24,'Dissolved organic carb13', & - & rmissing,34,io_stdo_bgc) + CALL NETCDF_DEF_VARDB(ncid,6,'ssso13',3,ncdimst,ncvarid, & + & 9,'kmol/m**3',37,'Sediment accumulated organic carbon13', & + & rmissing,81,io_stdo_bgc) - CALL NETCDF_DEF_VARDB(ncid,5,'doc14',3,ncdimst,ncvarid, & - & 6,'mol/kg',24,'Dissolved organic carb14', & - & rmissing,35,io_stdo_bgc) + CALL NETCDF_DEF_VARDB(ncid,6,'ssso14',3,ncdimst,ncvarid, & + & 9,'kmol/m**3',37,'Sediment accumulated organic carbon14', & + & rmissing,82,io_stdo_bgc) - CALL NETCDF_DEF_VARDB(ncid,5,'poc13',3,ncdimst,ncvarid, & - & 7,'molC/kg',28,'Particulate organic carbon13', & - & rmissing,36,io_stdo_bgc) + CALL NETCDF_DEF_VARDB(ncid,6,'sssc13',3,ncdimst,ncvarid, & + & 9,'kmol/m**3',40,'Sediment accumulated calcium carbonate13', & + & rmissing,83,io_stdo_bgc) - CALL NETCDF_DEF_VARDB(ncid,5,'poc14',3,ncdimst,ncvarid, & - & 7,'molC/kg',28,'Particulate organic carbon14', & - & rmissing,37,io_stdo_bgc) + CALL NETCDF_DEF_VARDB(ncid,6,'sssc14',3,ncdimst,ncvarid, & + & 9,'kmol/m**3',40,'Sediment accumulated calcium carbonate14', & + & rmissing,84,io_stdo_bgc) - CALL NETCDF_DEF_VARDB(ncid,7,'phyto13',3,ncdimst,ncvarid, & - & 7,'molP/kg',27,'Phytoplankton concentr. 13c', & - & rmissing,38,io_stdo_bgc) + CALL NETCDF_DEF_VARDB(ncid,6,'powc13',3,ncdimst,ncvarid, & + & 9,'kmol/m**3',25,'Sediment pore water DIC13', & + & rmissing,85,io_stdo_bgc) - CALL NETCDF_DEF_VARDB(ncid,7,'phyto14',3,ncdimst,ncvarid, & - & 7,'molP/kg',27,'Phytoplankton concentr. 14c', & - & rmissing,39,io_stdo_bgc) + CALL NETCDF_DEF_VARDB(ncid,6,'powc14',3,ncdimst,ncvarid, & + & 9,'kmol/m**3',25,'Sediment pore water DIC14', & + & rmissing,86,io_stdo_bgc) - CALL NETCDF_DEF_VARDB(ncid,8,'grazer13',3,ncdimst,ncvarid, & - & 7,'molP/kg',25,'Zooplankton concentr. 13c', & - & rmissing,40,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,8,'grazer14',3,ncdimst,ncvarid, & - & 7,'molP/kg',25,'Zooplankton concentr. 14c', & - & rmissing,41,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,8,'calciu13',3,ncdimst,ncvarid, & - & 7,'molC/kg',19,'Calcium carbonate13', & - & rmissing,42,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,8,'calciu14',3,ncdimst,ncvarid, & - & 7,'molC/kg',19,'Calcium carbonate14', & - & rmissing,43,io_stdo_bgc) - end if - if (use_AGG) then - CALL NETCDF_DEF_VARDB(ncid,4,'snos',3,ncdimst,ncvarid, & - & 3,'1/g',38,'marine snow aggregates per g sea water', & - & rmissing,44,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,5,'adust',3,ncdimst,ncvarid, & - & 4,'g/kg',15,'Aggregated dust', & - & rmissing,45,io_stdo_bgc) - end if - if (use_CFC) then - CALL NETCDF_DEF_VARDB(ncid,5,'cfc11',3,ncdimst,ncvarid, & - & 6,'mol/kg',5,'CFC11', & - & rmissing,47,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,5,'cfc12',3,ncdimst,ncvarid, & - & 6,'mol/kg',5,'CFC12', & - & rmissing,48,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,3,'sf6',3,ncdimst,ncvarid, & - & 6,'mol/kg',4,'SF-6', & - & rmissing,49,io_stdo_bgc) - end if - if (use_natDIC) then - CALL NETCDF_DEF_VARDB(ncid,9,'natsco212',3,ncdimst,ncvarid, & - & 6,'mol/kg',21, 'Natural dissolved CO2',rmissing,50,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,9,'natalkali',3,ncdimst,ncvarid, & - & 6,'mol/kg',18,'Natural alkalinity',rmissing,51,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,9,'natcalciu',3,ncdimst,ncvarid, & - & 6,'mol/kg',25,'Natural calcium carbonate', & - & rmissing,52,io_stdo_bgc) - end if - if (use_BROMO) then - CALL NETCDF_DEF_VARDB(ncid,5,'bromo',3,ncdimst,ncvarid, & - & 6,'mol/kg',9,'Bromoform',rmissing,47,io_stdo_bgc) + CALL NETCDF_DEF_VARDB(ncid,6,'powc14',3,ncdimst,ncvarid, & + & 9,'kmol/m**3',25,'Sediment pore water DIC14', & + & rmasks,86,io_stdo_bgc) end if -! -! Define variables : diagnostic ocean fields -! ---------------------------------------------------------------------- -! IF((mnproc==1 .AND. IOTYPE==0) .OR. IOTYPE==1) THEN - ncdimst(1) = nclonid - ncdimst(2) = nclatid - ncdimst(3) = nclevid - ncdimst(4) = 0 + ncdimst(1) = nclonid + ncdimst(2) = nclatid + ncdimst(3) = ncksid + ncdimst(4) = 0 ENDIF - CALL NETCDF_DEF_VARDB(ncid,2,'hi',3,ncdimst,ncvarid, & - & 6,'mol/kg',26,'Hydrogen ion concentration', & - & rmissing,60,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,3,'co3',3,ncdimst,ncvarid, & - & 6,'mol/kg',25,'Dissolved carbonate (CO3)', & - & rmissing,61,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,7,'co2star',3,ncdimst,ncvarid, & - & 6,'mol/kg',20,'Dissolved CO2 (CO2*)', & - & rmissing,62,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,6,'satoxy',3,ncdimst,ncvarid, & - & 6,'mol/kg',16 ,'Saturated oxygen', & - & rmissing,63,io_stdo_bgc) - - if (use_natDIC) then - CALL NETCDF_DEF_VARDB(ncid,5,'nathi',3,ncdimst,ncvarid, & - & 6,'mol/kg',34,'Natural hydrogen ion concentration', & - & rmissing,64,io_stdo_bgc) - end if + CALL NETCDF_DEF_VARDB(ncid,6,'sedhpl',3,ncdimst,ncvarid, & + & 9,'kmol/m**2',34,'Sediment accumulated hydrogen ions', & + & rmissing,87,io_stdo_bgc) ! - ! Define variables : sediment + ! Define variables : sediment burial ! ---------------------------------------------------------------------- ! - if (.not. use_sedbypass) then + IF((mnproc==1 .AND. IOTYPE==0) .OR. IOTYPE==1) THEN + ncdimst(1) = nclonid + ncdimst(2) = nclatid + ncdimst(3) = nctlvl2id + ncdimst(4) = 0 + ENDIF - IF((mnproc==1 .AND. IOTYPE==0) .OR. IOTYPE==1) THEN - ncdimst(1) = nclonid - ncdimst(2) = nclatid - ncdimst(3) = ncks2id - ncdimst(4) = 0 - ENDIF + CALL NETCDF_DEF_VARDB(ncid,7,'bur_o12',3,ncdimst,ncvarid, & + & 9,'kmol/m**2',30,'Burial layer of organic carbon', & + & rmissing,90,io_stdo_bgc) - CALL NETCDF_DEF_VARDB(ncid,6,'ssso12',3,ncdimst,ncvarid, & - & 9,'kmol/m**3',35,'Sediment accumulated organic carbon', & - & rmissing,70,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,6,'sssc12',3,ncdimst,ncvarid, & - & 9,'kmol/m**3',38,'Sediment accumulated calcium carbonate', & - & rmissing,71,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,6,'ssssil',3,ncdimst,ncvarid, & - & 9,'kmol/m**3',25,'Sediment accumulated opal', & - & rmissing,72,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,6,'ssster',3,ncdimst,ncvarid, & - & 7,'kg/m**3',25,'Sediment accumulated clay', & - & rmissing,73,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,6,'powaic',3,ncdimst,ncvarid, & - & 9,'kmol/m**3',23,'Sediment pore water CO2', & - & rmissing,74,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,6,'powaal',3,ncdimst,ncvarid, & - & 9,'kmol/m**3',30,'Sediment pore water alkalinity', & - & rmissing,75,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,6,'powaph',3,ncdimst,ncvarid, & - & 9,'kmol/m**3',29,'Sediment pore water phosphate', & - & rmissing,76,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,6,'powaox',3,ncdimst,ncvarid, & - & 9,'kmol/m**3',26,'Sediment pore water oxygen', & - & rmissing,77,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,5,'pown2',3,ncdimst,ncvarid, & - & 9,'kmol/m**3',36,'Sediment pore water gaseous nitrogen', & - & rmissing,78,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,6,'powno3',3,ncdimst,ncvarid, & - & 9,'kmol/m**3',33,'Sediment pore water nitrate (NO3)', & - & rmissing,79,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,6,'powasi',3,ncdimst,ncvarid, & - & 9,'kmol/m**3',42,'Sediment pore water silicid acid (Si(OH)4)',& - & rmissing,80,io_stdo_bgc) - - if (use_cisonew) then - CALL NETCDF_DEF_VARDB(ncid,6,'ssso13',3,ncdimst,ncvarid, & - & 9,'kmol/m**3',37,'Sediment accumulated organic carbon13', & - & rmissing,81,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,6,'ssso14',3,ncdimst,ncvarid, & - & 9,'kmol/m**3',37,'Sediment accumulated organic carbon14', & - & rmissing,82,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,6,'sssc13',3,ncdimst,ncvarid, & - & 9,'kmol/m**3',40,'Sediment accumulated calcium carbonate13', & - & rmissing,83,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,6,'sssc14',3,ncdimst,ncvarid, & - & 9,'kmol/m**3',40,'Sediment accumulated calcium carbonate14', & - & rmissing,84,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,6,'powc13',3,ncdimst,ncvarid, & - & 9,'kmol/m**3',25,'Sediment pore water DIC13', & - & rmissing,85,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,6,'powc14',3,ncdimst,ncvarid, & - & 9,'kmol/m**3',25,'Sediment pore water DIC14', & - & rmissing,86,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,6,'powc14',3,ncdimst,ncvarid, & - & 9,'kmol/m**3',25,'Sediment pore water DIC14', & - & rmasks,86,io_stdo_bgc) - end if - - IF((mnproc==1 .AND. IOTYPE==0) .OR. IOTYPE==1) THEN - ncdimst(1) = nclonid - ncdimst(2) = nclatid - ncdimst(3) = ncksid - ncdimst(4) = 0 - ENDIF + CALL NETCDF_DEF_VARDB(ncid,7,'bur_c12',3,ncdimst,ncvarid, & + & 9,'kmol/m**2',33,'Burial layer of calcium carbonate', & + & rmissing,91,io_stdo_bgc) - CALL NETCDF_DEF_VARDB(ncid,6,'sedhpl',3,ncdimst,ncvarid, & - & 9,'kmol/m**2',34,'Sediment accumulated hydrogen ions', & - & rmissing,87,io_stdo_bgc) - ! - ! Define variables : sediment burial - ! ---------------------------------------------------------------------- - ! - IF((mnproc==1 .AND. IOTYPE==0) .OR. IOTYPE==1) THEN - ncdimst(1) = nclonid - ncdimst(2) = nclatid - ncdimst(3) = nctlvl2id - ncdimst(4) = 0 - ENDIF + CALL NETCDF_DEF_VARDB(ncid,7,'bur_sil',3,ncdimst,ncvarid, & + & 9,'kmol/m**2',20,'Burial layer of opal', & + & rmissing,92,io_stdo_bgc) - CALL NETCDF_DEF_VARDB(ncid,7,'bur_o12',3,ncdimst,ncvarid, & - & 9,'kmol/m**2',30,'Burial layer of organic carbon', & - & rmissing,90,io_stdo_bgc) + CALL NETCDF_DEF_VARDB(ncid,8,'bur_clay',3,ncdimst,ncvarid, & + & 7,'kg/m**2',20,'Burial layer of clay', & + & rmissing,93,io_stdo_bgc) - CALL NETCDF_DEF_VARDB(ncid,7,'bur_c12',3,ncdimst,ncvarid, & - & 9,'kmol/m**2',33,'Burial layer of calcium carbonate', & - & rmissing,91,io_stdo_bgc) + if (use_cisonew) then + CALL NETCDF_DEF_VARDB(ncid,8,'bur_o13',3,ncdimst,ncvarid, & + & 9,'kmol/m**2',27,'Burial layer of organic 13C', & + & rmissing,94,io_stdo_bgc) - CALL NETCDF_DEF_VARDB(ncid,7,'bur_sil',3,ncdimst,ncvarid, & - & 9,'kmol/m**2',20,'Burial layer of opal', & - & rmissing,92,io_stdo_bgc) + CALL NETCDF_DEF_VARDB(ncid,8,'bur_o14',3,ncdimst,ncvarid, & + & 9,'kmol/m**2',27,'Burial layer of organic 14C', & + & rmissing,95,io_stdo_bgc) - CALL NETCDF_DEF_VARDB(ncid,8,'bur_clay',3,ncdimst,ncvarid, & - & 7,'kg/m**2',20,'Burial layer of clay', & - & rmissing,93,io_stdo_bgc) + CALL NETCDF_DEF_VARDB(ncid,8,'bur_c13',3,ncdimst,ncvarid, & + & 9,'kmol/m**2',23,'Burial layer of Ca13CO3', & + & rmissing,96,io_stdo_bgc) - if (use_cisonew) then - CALL NETCDF_DEF_VARDB(ncid,8,'bur_o13',3,ncdimst,ncvarid, & - & 9,'kmol/m**2',27,'Burial layer of organic 13C', & - & rmissing,94,io_stdo_bgc) + CALL NETCDF_DEF_VARDB(ncid,8,'bur_c14',3,ncdimst,ncvarid, & + & 9,'kmol/m**2',23,'Burial layer of Ca14CO3', & + & rmissing,97,io_stdo_bgc) + end if - CALL NETCDF_DEF_VARDB(ncid,8,'bur_o14',3,ncdimst,ncvarid, & - & 9,'kmol/m**2',27,'Burial layer of organic 14C', & - & rmissing,95,io_stdo_bgc) + end if ! not sedbypass + ! + ! Define variables: atmosphere + ! ---------------------------------------------------------------------- + ! + if (use_BOXATM) then - CALL NETCDF_DEF_VARDB(ncid,8,'bur_c13',3,ncdimst,ncvarid, & - & 9,'kmol/m**2',23,'Burial layer of Ca13CO3', & - & rmissing,96,io_stdo_bgc) + IF((mnproc==1 .AND. IOTYPE==0) .OR. IOTYPE==1) THEN + ncdimst(1) = nclonid + ncdimst(2) = nclatid + ncdimst(3) = nctlvl2id + ncdimst(4) = 0 + ENDIF - CALL NETCDF_DEF_VARDB(ncid,8,'bur_c14',3,ncdimst,ncvarid, & - & 9,'kmol/m**2',23,'Burial layer of Ca14CO3', & - & rmissing,97,io_stdo_bgc) - end if + CALL NETCDF_DEF_VARDB(ncid,6,'atmco2',3,ncdimst,ncvarid, & + & 3,'ppm',15,'atmospheric CO2', & + & rmissing,101,io_stdo_bgc) - end if ! not sedbypass - ! - ! Define variables: atmosphere - ! ---------------------------------------------------------------------- - ! - if (use_BOXATM) then - IF((mnproc==1 .AND. IOTYPE==0) .OR. IOTYPE==1) THEN - ncdimst(1) = nclonid - ncdimst(2) = nclatid - ncdimst(3) = nctlvl2id - ncdimst(4) = 0 - ENDIF + CALL NETCDF_DEF_VARDB(ncid,5,'atmo2',3,ncdimst,ncvarid, & + & 3,'ppm',14,'atmospheric O2', & + & rmissing,102,io_stdo_bgc) - CALL NETCDF_DEF_VARDB(ncid,6,'atmco2',3,ncdimst,ncvarid, & - & 3,'ppm',15,'atmospheric CO2', & - & rmissing,101,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,5,'atmo2',3,ncdimst,ncvarid, & - & 3,'ppm',14,'atmospheric O2', & - & rmissing,102,io_stdo_bgc) - - CALL NETCDF_DEF_VARDB(ncid,5,'atmn2',3,ncdimst,ncvarid, & - & 3,'ppm',14,'atmospheric N2', & - & rmissing,103,io_stdo_bgc) - - if (use_cisonew) then - CALL NETCDF_DEF_VARDB(ncid,6,'atmc13',3,ncdimst,ncvarid, & - & 3,'ppm',17,'atmospheric 13CO2', & - & rmissing,104,io_stdo_bgc) - CALL NETCDF_DEF_VARDB(ncid,6,'atmc14',3,ncdimst,ncvarid, & - & 3,'ppm',17,'atmospheric 14CO2', & - & rmissing,105,io_stdo_bgc) - end if - if (use_natDIC) then - CALL NETCDF_DEF_VARDB(ncid,7,'atmnco2',3,ncdimst,ncvarid, & - & 3,'ppm',23,'natural atmospheric CO2', & - & rmissing,106,io_stdo_bgc) - end if + CALL NETCDF_DEF_VARDB(ncid,5,'atmn2',3,ncdimst,ncvarid, & + & 3,'ppm',14,'atmospheric N2', & + & rmissing,103,io_stdo_bgc) + + if (use_cisonew) then + CALL NETCDF_DEF_VARDB(ncid,6,'atmc13',3,ncdimst,ncvarid, & + & 3,'ppm',17,'atmospheric 13CO2', & + & rmissing,104,io_stdo_bgc) + CALL NETCDF_DEF_VARDB(ncid,6,'atmc14',3,ncdimst,ncvarid, & + & 3,'ppm',17,'atmospheric 14CO2', & + & rmissing,105,io_stdo_bgc) end if + if (use_natDIC) then + CALL NETCDF_DEF_VARDB(ncid,7,'atmnco2',3,ncdimst,ncvarid, & + & 3,'ppm',23,'natural atmospheric CO2', & + & rmissing,106,io_stdo_bgc) + end if + end if ! if (use_BOXATM) - IF(mnproc==1 .AND. IOTYPE==0) THEN - ncstat = NF90_ENDDEF(ncid) + IF (mnproc==1 .AND. IOTYPE==0) THEN + ncstat = NF90_ENDDEF(ncid) IF ( ncstat .NE. NF90_NOERR ) THEN - call xchalt('(AUFW: Problem with netCDF00)') - stop '(AUFW: Problem with netCDF00)' + call xchalt('(AUFW: Problem with netCDF00)') + stop '(AUFW: Problem with netCDF00)' ENDIF - -! -! Set fill mode -! ---------------------------------------------------------------------- -! + ! + ! Set fill mode + ! ---------------------------------------------------------------------- + ! ncstat = NF90_SET_FILL(ncid,NF90_NOFILL, ncoldmod) IF ( ncstat .NE. NF90_NOERR ) THEN - call xchalt('(AUFW: Problem with netCDF97)') + call xchalt('(AUFW: Problem with netCDF97)') stop '(AUFW: Problem with netCDF97)' ENDIF + ELSE IF (IOTYPE==1) THEN - - ELSE IF(IOTYPE==1) THEN #ifdef PNETCDF ncstat = NFMPI_ENDDEF(ncid) - IF ( ncstat .NE. NF_NOERR ) THEN call xchalt('(AUFW: Problem with PnetCDF00)') stop '(AUFW: Problem with PnetCDF00)' ENDIF #endif - ENDIF -! -! Write restart data : ocean aquateous tracer -!-------------------------------------------------------------------- -! - CALL write_netcdf_var(ncid,'sco212',locetra(1,1,1,isco212),2*kpke,0) - CALL write_netcdf_var(ncid,'alkali',locetra(1,1,1,ialkali),2*kpke,0) - CALL write_netcdf_var(ncid,'phosph',locetra(1,1,1,iphosph),2*kpke,0) - CALL write_netcdf_var(ncid,'oxygen',locetra(1,1,1,ioxygen),2*kpke,0) - CALL write_netcdf_var(ncid,'gasnit',locetra(1,1,1,igasnit),2*kpke,0) - CALL write_netcdf_var(ncid,'ano3',locetra(1,1,1,iano3),2*kpke,0) - CALL write_netcdf_var(ncid,'silica',locetra(1,1,1,isilica),2*kpke,0) - CALL write_netcdf_var(ncid,'doc',locetra(1,1,1,idoc),2*kpke,0) - CALL write_netcdf_var(ncid,'poc',locetra(1,1,1,idet),2*kpke,0) - CALL write_netcdf_var(ncid,'phyto',locetra(1,1,1,iphy),2*kpke,0) - CALL write_netcdf_var(ncid,'grazer',locetra(1,1,1,izoo),2*kpke,0) - CALL write_netcdf_var(ncid,'calciu',locetra(1,1,1,icalc),2*kpke,0) - CALL write_netcdf_var(ncid,'opal',locetra(1,1,1,iopal),2*kpke,0) - CALL write_netcdf_var(ncid,'n2o',locetra(1,1,1,ian2o),2*kpke,0) - CALL write_netcdf_var(ncid,'dms',locetra(1,1,1,idms),2*kpke,0) - CALL write_netcdf_var(ncid,'fdust',locetra(1,1,1,ifdust),2*kpke,0) - CALL write_netcdf_var(ncid,'iron',locetra(1,1,1,iiron),2*kpke,0) - CALL write_netcdf_var(ncid,'prefo2',locetra(1,1,1,iprefo2),2*kpke,0) - CALL write_netcdf_var(ncid,'prefpo4',locetra(1,1,1,iprefpo4),2*kpke,0) - CALL write_netcdf_var(ncid,'prefalk',locetra(1,1,1,iprefalk),2*kpke,0) - CALL write_netcdf_var(ncid,'prefdic',locetra(1,1,1,iprefdic),2*kpke,0) - CALL write_netcdf_var(ncid,'dicsat',locetra(1,1,1,idicsat),2*kpke,0) + ENDIF + ! + ! Write restart data : ocean aquateous tracer + !-------------------------------------------------------------------- + ! + CALL write_netcdf_var(ncid,'sco212',locetra(1,1,1,isco212),2*kpke,0) + CALL write_netcdf_var(ncid,'alkali',locetra(1,1,1,ialkali),2*kpke,0) + CALL write_netcdf_var(ncid,'phosph',locetra(1,1,1,iphosph),2*kpke,0) + CALL write_netcdf_var(ncid,'oxygen',locetra(1,1,1,ioxygen),2*kpke,0) + CALL write_netcdf_var(ncid,'gasnit',locetra(1,1,1,igasnit),2*kpke,0) + CALL write_netcdf_var(ncid,'ano3',locetra(1,1,1,iano3),2*kpke,0) + CALL write_netcdf_var(ncid,'silica',locetra(1,1,1,isilica),2*kpke,0) + CALL write_netcdf_var(ncid,'doc',locetra(1,1,1,idoc),2*kpke,0) + CALL write_netcdf_var(ncid,'poc',locetra(1,1,1,idet),2*kpke,0) + CALL write_netcdf_var(ncid,'phyto',locetra(1,1,1,iphy),2*kpke,0) + CALL write_netcdf_var(ncid,'grazer',locetra(1,1,1,izoo),2*kpke,0) + CALL write_netcdf_var(ncid,'calciu',locetra(1,1,1,icalc),2*kpke,0) + CALL write_netcdf_var(ncid,'opal',locetra(1,1,1,iopal),2*kpke,0) + CALL write_netcdf_var(ncid,'n2o',locetra(1,1,1,ian2o),2*kpke,0) + CALL write_netcdf_var(ncid,'dms',locetra(1,1,1,idms),2*kpke,0) + CALL write_netcdf_var(ncid,'fdust',locetra(1,1,1,ifdust),2*kpke,0) + CALL write_netcdf_var(ncid,'iron',locetra(1,1,1,iiron),2*kpke,0) + CALL write_netcdf_var(ncid,'prefo2',locetra(1,1,1,iprefo2),2*kpke,0) + CALL write_netcdf_var(ncid,'prefpo4',locetra(1,1,1,iprefpo4),2*kpke,0) + CALL write_netcdf_var(ncid,'prefalk',locetra(1,1,1,iprefalk),2*kpke,0) + CALL write_netcdf_var(ncid,'prefdic',locetra(1,1,1,iprefdic),2*kpke,0) + CALL write_netcdf_var(ncid,'dicsat',locetra(1,1,1,idicsat),2*kpke,0) + if (use_cisonew) then + CALL write_netcdf_var(ncid,'sco213' ,locetra(1,1,1,isco213) ,2*kpke,0) + CALL write_netcdf_var(ncid,'sco214' ,locetra(1,1,1,isco214) ,2*kpke,0) + CALL write_netcdf_var(ncid,'doc13' ,locetra(1,1,1,idoc13) ,2*kpke,0) + CALL write_netcdf_var(ncid,'doc14' ,locetra(1,1,1,idoc14) ,2*kpke,0) + CALL write_netcdf_var(ncid,'poc13' ,locetra(1,1,1,idet13) ,2*kpke,0) + CALL write_netcdf_var(ncid,'poc14' ,locetra(1,1,1,idet14) ,2*kpke,0) + CALL write_netcdf_var(ncid,'phyto13' ,locetra(1,1,1,iphy13) ,2*kpke,0) + CALL write_netcdf_var(ncid,'phyto14' ,locetra(1,1,1,iphy14) ,2*kpke,0) + CALL write_netcdf_var(ncid,'grazer13' ,locetra(1,1,1,izoo13) ,2*kpke,0) + CALL write_netcdf_var(ncid,'grazer14' ,locetra(1,1,1,izoo14) ,2*kpke,0) + CALL write_netcdf_var(ncid,'calciu13' ,locetra(1,1,1,icalc13) ,2*kpke,0) + CALL write_netcdf_var(ncid,'calciu14' ,locetra(1,1,1,icalc14) ,2*kpke,0) + end if + if (use_AGG) then + CALL write_netcdf_var(ncid,'snos',locetra(1,1,1,inos),2*kpke,0) + CALL write_netcdf_var(ncid,'adust',locetra(1,1,1,iadust),2*kpke,0) + end if + if (use_CFC) then + CALL write_netcdf_var(ncid,'cfc11',locetra(1,1,1,icfc11),2*kpke,0) + CALL write_netcdf_var(ncid,'cfc12',locetra(1,1,1,icfc12),2*kpke,0) + CALL write_netcdf_var(ncid,'sf6',locetra(1,1,1,isf6),2*kpke,0) + end if + if (use_natDIC) then + CALL write_netcdf_var(ncid,'natsco212',locetra(1,1,1,inatsco212),2*kpke,0) + CALL write_netcdf_var(ncid,'natalkali',locetra(1,1,1,inatalkali),2*kpke,0) + CALL write_netcdf_var(ncid,'natcalciu',locetra(1,1,1,inatcalc),2*kpke,0) + end if + if (use_BROMO) then + CALL write_netcdf_var(ncid,'bromo',locetra(1,1,1,ibromo),2*kpke,0) + end if + + ! + ! Write restart data : diagtnostic ocean fields + ! + CALL write_netcdf_var(ncid,'hi',hi(1,1,1),kpke,0) + CALL write_netcdf_var(ncid,'co3',co3(1,1,1),kpke,0) + CALL write_netcdf_var(ncid,'co2star',co2star(1,1,1),kpke,0) + CALL write_netcdf_var(ncid,'satoxy',satoxy(1,1,1),kpke,0) + if (use_natDIC) then + CALL write_netcdf_var(ncid,'nathi',nathi(1,1,1),kpke,0) + end if + ! + ! Write restart data : sediment variables. + ! + if (.not. use_sedbypass) then + CALL write_netcdf_var(ncid,'ssso12',sedlay2(1,1,1,issso12),2*ks,0) + CALL write_netcdf_var(ncid,'sssc12',sedlay2(1,1,1,isssc12),2*ks,0) + CALL write_netcdf_var(ncid,'ssssil',sedlay2(1,1,1,issssil),2*ks,0) + CALL write_netcdf_var(ncid,'ssster',sedlay2(1,1,1,issster),2*ks,0) + CALL write_netcdf_var(ncid,'bur_o12',burial2(1,1,1,issso12),2,0) + CALL write_netcdf_var(ncid,'bur_c12',burial2(1,1,1,isssc12),2,0) + CALL write_netcdf_var(ncid,'bur_sil',burial2(1,1,1,issssil),2,0) + CALL write_netcdf_var(ncid,'bur_clay',burial2(1,1,1,issster),2,0) + CALL write_netcdf_var(ncid,'sedhpl',sedhpl(1,1,1),ks,0) + CALL write_netcdf_var(ncid,'powaic',powtra2(1,1,1,ipowaic),2*ks,0) + CALL write_netcdf_var(ncid,'powaal',powtra2(1,1,1,ipowaal),2*ks,0) + CALL write_netcdf_var(ncid,'powaph',powtra2(1,1,1,ipowaph),2*ks,0) + CALL write_netcdf_var(ncid,'powaox',powtra2(1,1,1,ipowaox),2*ks,0) + CALL write_netcdf_var(ncid,'pown2',powtra2(1,1,1,ipown2),2*ks,0) + CALL write_netcdf_var(ncid,'powno3',powtra2(1,1,1,ipowno3),2*ks,0) + CALL write_netcdf_var(ncid,'powasi',powtra2(1,1,1,ipowasi),2*ks,0) if (use_cisonew) then - CALL write_netcdf_var(ncid,'sco213' ,locetra(1,1,1,isco213) ,2*kpke,0) - CALL write_netcdf_var(ncid,'sco214' ,locetra(1,1,1,isco214) ,2*kpke,0) - CALL write_netcdf_var(ncid,'doc13' ,locetra(1,1,1,idoc13) ,2*kpke,0) - CALL write_netcdf_var(ncid,'doc14' ,locetra(1,1,1,idoc14) ,2*kpke,0) - CALL write_netcdf_var(ncid,'poc13' ,locetra(1,1,1,idet13) ,2*kpke,0) - CALL write_netcdf_var(ncid,'poc14' ,locetra(1,1,1,idet14) ,2*kpke,0) - CALL write_netcdf_var(ncid,'phyto13' ,locetra(1,1,1,iphy13) ,2*kpke,0) - CALL write_netcdf_var(ncid,'phyto14' ,locetra(1,1,1,iphy14) ,2*kpke,0) - CALL write_netcdf_var(ncid,'grazer13' ,locetra(1,1,1,izoo13) ,2*kpke,0) - CALL write_netcdf_var(ncid,'grazer14' ,locetra(1,1,1,izoo14) ,2*kpke,0) - CALL write_netcdf_var(ncid,'calciu13' ,locetra(1,1,1,icalc13) ,2*kpke,0) - CALL write_netcdf_var(ncid,'calciu14' ,locetra(1,1,1,icalc14) ,2*kpke,0) + CALL write_netcdf_var(ncid,'ssso13',sedlay2(1,1,1,issso13),2*ks,0) + CALL write_netcdf_var(ncid,'ssso14',sedlay2(1,1,1,issso14),2*ks,0) + CALL write_netcdf_var(ncid,'sssc13',sedlay2(1,1,1,isssc13),2*ks,0) + CALL write_netcdf_var(ncid,'sssc14',sedlay2(1,1,1,isssc14),2*ks,0) + CALL write_netcdf_var(ncid,'bur_o13',burial2(1,1,1,issso13),2,0) + CALL write_netcdf_var(ncid,'bur_o14',burial2(1,1,1,issso14),2,0) + CALL write_netcdf_var(ncid,'bur_c13',burial2(1,1,1,isssc13),2,0) + CALL write_netcdf_var(ncid,'bur_c14',burial2(1,1,1,isssc14),2,0) + CALL write_netcdf_var(ncid,'powc13',powtra2(1,1,1,ipowc13),2*ks,0) + CALL write_netcdf_var(ncid,'powc14',powtra2(1,1,1,ipowc14),2*ks,0) end if - if (use_AGG) then - CALL write_netcdf_var(ncid,'snos',locetra(1,1,1,inos),2*kpke,0) - CALL write_netcdf_var(ncid,'adust',locetra(1,1,1,iadust),2*kpke,0) - end if - if (use_CFC) then - CALL write_netcdf_var(ncid,'cfc11',locetra(1,1,1,icfc11),2*kpke,0) - CALL write_netcdf_var(ncid,'cfc12',locetra(1,1,1,icfc12),2*kpke,0) - CALL write_netcdf_var(ncid,'sf6',locetra(1,1,1,isf6),2*kpke,0) + end if + ! + ! Write restart data: atmosphere. + ! + if (use_BOXATM) then + CALL write_netcdf_var(ncid,'atmco2',atm2(1,1,1,iatmco2),2,0) + CALL write_netcdf_var(ncid,'atmo2',atm2(1,1,1,iatmo2),2,0) + CALL write_netcdf_var(ncid,'atmn2',atm2(1,1,1,iatmn2),2,0) + if (use_cisonew) then + CALL write_netcdf_var(ncid,'atmc13',atm2(1,1,1,iatmc13),2,0) + CALL write_netcdf_var(ncid,'atmc14',atm2(1,1,1,iatmc14),2,0) end if if (use_natDIC) then - CALL write_netcdf_var(ncid,'natsco212',locetra(1,1,1,inatsco212),2*kpke,0) - CALL write_netcdf_var(ncid,'natalkali',locetra(1,1,1,inatalkali),2*kpke,0) - CALL write_netcdf_var(ncid,'natcalciu',locetra(1,1,1,inatcalc),2*kpke,0) - end if - if (use_BROMO) then - CALL write_netcdf_var(ncid,'bromo',locetra(1,1,1,ibromo),2*kpke,0) + CALL write_netcdf_var(ncid,'atmnco2',atm2(1,1,1,iatmnco2),2,0) end if + end if -! -! Write restart data : diagtnostic ocean fields -! - CALL write_netcdf_var(ncid,'hi',hi(1,1,1),kpke,0) - CALL write_netcdf_var(ncid,'co3',co3(1,1,1),kpke,0) - CALL write_netcdf_var(ncid,'co2star',co2star(1,1,1),kpke,0) - CALL write_netcdf_var(ncid,'satoxy',satoxy(1,1,1),kpke,0) - if (use_natDIC) then - CALL write_netcdf_var(ncid,'nathi',nathi(1,1,1),kpke,0) - end if -! -! Write restart data : sediment variables. -! - if (.not. use_sedbypass) then - CALL write_netcdf_var(ncid,'ssso12',sedlay2(1,1,1,issso12),2*ks,0) - CALL write_netcdf_var(ncid,'sssc12',sedlay2(1,1,1,isssc12),2*ks,0) - CALL write_netcdf_var(ncid,'ssssil',sedlay2(1,1,1,issssil),2*ks,0) - CALL write_netcdf_var(ncid,'ssster',sedlay2(1,1,1,issster),2*ks,0) - CALL write_netcdf_var(ncid,'bur_o12',burial2(1,1,1,issso12),2,0) - CALL write_netcdf_var(ncid,'bur_c12',burial2(1,1,1,isssc12),2,0) - CALL write_netcdf_var(ncid,'bur_sil',burial2(1,1,1,issssil),2,0) - CALL write_netcdf_var(ncid,'bur_clay',burial2(1,1,1,issster),2,0) - CALL write_netcdf_var(ncid,'sedhpl',sedhpl(1,1,1),ks,0) - CALL write_netcdf_var(ncid,'powaic',powtra2(1,1,1,ipowaic),2*ks,0) - CALL write_netcdf_var(ncid,'powaal',powtra2(1,1,1,ipowaal),2*ks,0) - CALL write_netcdf_var(ncid,'powaph',powtra2(1,1,1,ipowaph),2*ks,0) - CALL write_netcdf_var(ncid,'powaox',powtra2(1,1,1,ipowaox),2*ks,0) - CALL write_netcdf_var(ncid,'pown2',powtra2(1,1,1,ipown2),2*ks,0) - CALL write_netcdf_var(ncid,'powno3',powtra2(1,1,1,ipowno3),2*ks,0) - CALL write_netcdf_var(ncid,'powasi',powtra2(1,1,1,ipowasi),2*ks,0) - if (use_cisonew) then - CALL write_netcdf_var(ncid,'ssso13',sedlay2(1,1,1,issso13),2*ks,0) - CALL write_netcdf_var(ncid,'ssso14',sedlay2(1,1,1,issso14),2*ks,0) - CALL write_netcdf_var(ncid,'sssc13',sedlay2(1,1,1,isssc13),2*ks,0) - CALL write_netcdf_var(ncid,'sssc14',sedlay2(1,1,1,isssc14),2*ks,0) - CALL write_netcdf_var(ncid,'bur_o13',burial2(1,1,1,issso13),2,0) - CALL write_netcdf_var(ncid,'bur_o14',burial2(1,1,1,issso14),2,0) - CALL write_netcdf_var(ncid,'bur_c13',burial2(1,1,1,isssc13),2,0) - CALL write_netcdf_var(ncid,'bur_c14',burial2(1,1,1,isssc14),2,0) - CALL write_netcdf_var(ncid,'powc13',powtra2(1,1,1,ipowc13),2*ks,0) - CALL write_netcdf_var(ncid,'powc14',powtra2(1,1,1,ipowc14),2*ks,0) - end if - end if -! -! Write restart data: atmosphere. -! - if (use_BOXATM) then - CALL write_netcdf_var(ncid,'atmco2',atm2(1,1,1,iatmco2),2,0) - CALL write_netcdf_var(ncid,'atmo2',atm2(1,1,1,iatmo2),2,0) - CALL write_netcdf_var(ncid,'atmn2',atm2(1,1,1,iatmn2),2,0) - if (use_cisonew) then - CALL write_netcdf_var(ncid,'atmc13',atm2(1,1,1,iatmc13),2,0) - CALL write_netcdf_var(ncid,'atmc14',atm2(1,1,1,iatmc14),2,0) - end if - if (use_natDIC) then - CALL write_netcdf_var(ncid,'atmnco2',atm2(1,1,1,iatmnco2),2,0) - end if - end if - - - IF(mnproc==1 .AND. IOTYPE==0) THEN - ncstat = NF90_CLOSE(ncid) - IF ( ncstat .NE. NF90_NOERR ) THEN - call xchalt('(AUFW: netCDF200)') - stop '(AUFW: netCDF200)' - ENDIF - ELSE IF(IOTYPE==1) THEN + IF(mnproc==1 .AND. IOTYPE==0) THEN + ncstat = NF90_CLOSE(ncid) + IF ( ncstat .NE. NF90_NOERR ) THEN + call xchalt('(AUFW: netCDF200)') + stop '(AUFW: netCDF200)' + ENDIF + ELSE IF(IOTYPE==1) THEN #ifdef PNETCDF - ncstat = NFMPI_CLOSE(ncid) - IF ( ncstat .NE. NF_NOERR ) THEN - call xchalt('(AUFW: PnetCDF200)') - stop '(AUFW: PnetCDF200)' - ENDIF -#endif + ncstat = NFMPI_CLOSE(ncid) + IF ( ncstat .NE. NF_NOERR ) THEN + call xchalt('(AUFW: PnetCDF200)') + stop '(AUFW: PnetCDF200)' ENDIF +#endif + ENDIF - IF (mnproc.eq.1) THEN + IF (mnproc.eq.1) THEN WRITE(io_stdo_bgc,*) 'End of AUFW_BGC' WRITE(io_stdo_bgc,*) '***************' - ENDIF + ENDIF - RETURN - END SUBROUTINE AUFW_BGC + RETURN + END SUBROUTINE AUFW_BGC diff --git a/hamocc/beleg_vars.F90 b/hamocc/beleg_vars.F90 index 2f20e089..f531dfca 100644 --- a/hamocc/beleg_vars.F90 +++ b/hamocc/beleg_vars.F90 @@ -54,30 +54,18 @@ SUBROUTINE BELEG_VARS(kpaufr,kpie,kpje,kpke,kbnd,pddpo,prho,omask, & use mo_carbch, only: co2star,co3,hi,ocetra use mo_biomod, only: fesoly - use mo_control_bgc, only: rmasks + use mo_control_bgc, only: rmasks,use_FB_BGC_OCE, use_cisonew, use_AGG, use_CFC, use_natDIC, use_BROMO, use_sedbypass use mo_param1_bgc, only: ialkali,ian2o,iano3,icalc,idet,idicsat,idms,idoc,ifdust,igasnit,iiron,iopal,ioxygen,iphosph,iphy, & - & iprefalk,iprefdic,iprefo2,iprefpo4,isco212,isilica,izoo + iprefalk,iprefdic,iprefo2,iprefpo4,isco212,isilica,izoo, & + iadust,inos,ibromo,icfc11,icfc12,isf6, & + icalc13,icalc14,idet13,idet14,idoc13,idoc14,iphy13,iphy14,isco213,isco214,izoo13,izoo14,safediv, & + inatcalc, & + ipowaal,ipowaic,ipowaox,ipowaph,ipowasi,ipown2,ipowno3,isssc12,issso12,issssil,issster,ks,nsedtra, & + ipowc13,ipowc13,issso13,issso13,isssc13,ipowc14,isssc14,issso14 use mo_vgrid, only: kmle,kbo - ! AGG - use mo_biomod, only: cellmass,fractdim - use mo_param1_bgc, only: iadust,inos - ! BROMO - use mo_param1_bgc, only: ibromo - ! CFC - use mo_param1_bgc, only: icfc11,icfc12,isf6 - ! cisonew - use mo_biomod, only: bifr13,bifr14,c14fac,re1312,re14to - use mo_param1_bgc, only: icalc13,icalc14,idet13,idet14,idoc13,idoc14,iphy13,iphy14,isco213,isco214,izoo13,izoo14,safediv - ! natDIC - use mo_param1_bgc, only: inatcalc + use mo_biomod, only: cellmass,fractdim,bifr13,bifr14,c14fac,re1312,re14to,abs_oce use mo_carbch, only: nathi,natco3 - ! sedbypass - use mo_param1_bgc, only: ipowaal,ipowaic,ipowaox,ipowaph,ipowasi,ipown2,ipowno3,isssc12,issso12,issssil,issster,ks,nsedtra, & - & ipowc13,ipowc13,issso13,issso13,isssc13,ipowc14,isssc14,issso14 use mo_sedmnt, only: sedhpl,burial,powtra,sedlay - ! FB_BGC_OCE - use mo_biomod, only: abs_oce - use mo_control_bgc, only: use_FB_BGC_OCE, use_cisonew, use_AGG, use_CFC, use_natDIC, use_BROMO, use_sedbypass implicit none @@ -90,10 +78,8 @@ SUBROUTINE BELEG_VARS(kpaufr,kpie,kpje,kpke,kbnd,pddpo,prho,omask, & ! local variables INTEGER :: i,j,k,l - ! cisonew - REAL :: rco213,rco214,beta13,beta14 - ! AGG - REAL :: snow + REAL :: rco213,rco214,beta13,beta14 ! cisonew + REAL :: snow ! AGG if (use_FB_BGC_OCE) then DO k=1,kpke diff --git a/hamocc/carchm.F90 b/hamocc/carchm.F90 index b18fc87d..f5da6bbd 100644 --- a/hamocc/carchm.F90 +++ b/hamocc/carchm.F90 @@ -20,8 +20,8 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & pdlxp,pdlyp,pddpo,prho,pglat,omask, & - psicomo,ppao,pfu10,ptho,psao, & - pflxdms,pflxbromo) + psicomo,ppao,pfu10,ptho,psao) + !****************************************************************************** ! !**** *CARCHM* - . @@ -89,8 +89,6 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & ! *REAL* *pfu10* - forcing field wind speed. ! *REAL* *ptho* - potential temperature. ! *REAL* *psao* - salinity [psu]. -! *REAL* *pflxdms* - input dms flux that is already computed -! *REAL* *pflxbromo* - input bromo flux that is already computed ! ! Externals ! --------- @@ -100,26 +98,20 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & 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 + oxyco,tzero + use mo_control_bgc, only: dtbgc,use_cisonew,use_natDIC,use_CFC,use_BROMO,use_cisonew,use_sedbypass use mo_param1_bgc, only: ialkali,iatmo2,iatmco2,iatmdms,iatmn2,iatmn2o,ian2o,icalc,idicsat,idms,igasnit,ioxygen,iphosph, & - & isco212,isilica + isco212,isilica, & + iatmf11,iatmf12,iatmsf6,icfc11,icfc12,isf6, & + iatmc13,iatmc14,icalc13,icalc14,idet14,idoc14,iphy14,isco213,isco214,izoo14,safediv, & + iatmnco2,inatalkali,inatcalc,inatsco212, & + ks,issso14,isssc14,ipowc14, & + iatmbromo,ibromo use mo_vgrid, only: dp_min,kmle,kbo,ptiestu - - use mo_param1_bgc, only: iatmbromo,ibromo - ! CFC - use mo_carbch, only: atm_cfc11_nh,atm_cfc11_sh,atm_cfc12_nh,atm_cfc12_sh,atm_sf6_nh,atm_sf6_sh - use mo_param1_bgc, only: iatmf11,iatmf12,iatmsf6,icfc11,icfc12,isf6 - ! cisonew - use mo_carbch, only: co213fxd,co213fxu,co214fxd,co214fxu,c14dec - use mo_param1_bgc, only: iatmc13,iatmc14,icalc13,icalc14,idet14,idoc14,iphy14,isco213,isco214,izoo14,safediv - ! natDIC - use mo_carbch, only: atm_co2_nat,nathi,natco3,natpco2d,natomegaa,natomegac - use mo_param1_bgc, only: iatmnco2,inatalkali,inatcalc,inatsco212 - ! sedbypass + use mo_carbch, only: atm_cfc11_nh,atm_cfc11_sh,atm_cfc12_nh,atm_cfc12_sh,atm_sf6_nh,atm_sf6_sh, & + co213fxd,co213fxu,co214fxd,co214fxu,c14dec, & + atm_co2_nat,nathi,natco3,natpco2d,natomegaa,natomegac use mo_sedmnt, only: sedlay,powtra,burial - use mo_param1_bgc, only: ks,issso14,isssc14,ipowc14 - use mo_control_bgc, only: use_cisonew,use_natDIC,use_CFC,use_BROMO,use_cisonew,use_sedbypass implicit none @@ -135,13 +127,10 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & REAL, intent(in) :: pfu10(1-kbnd:kpie+kbnd,1-kbnd:kpje+kbnd) REAL, intent(in) :: ptho(1-kbnd:kpie+kbnd,1-kbnd:kpje+kbnd,kpke) REAL, intent(in) :: psao(1-kbnd:kpie+kbnd,1-kbnd:kpje+kbnd,kpke) - REAL, intent(in) :: pflxdms(1-kbnd:kpie+kbnd,1-kbnd:kpje+kbnd) - REAL, intent(in) :: pflxbromo(1-kbnd:kpie+kbnd,1-kbnd:kpje+kbnd) ! Local variables INTEGER :: i,j,k,l,js INTEGER, parameter :: niter=20 - REAL :: supsat, undsa, dissol REAL :: rpp0,fluxd,fluxu REAL :: kwco2,kwo2,kwn2,kwdms,kwn2o @@ -154,22 +143,18 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & REAL :: Kh,Khd,K1,K2,Kb,K1p,K2p,K3p,Ksi,Kw,Ks1,Kf,Kspc,Kspa REAL :: tc,ta,sit,pt,ah1,ac,cu,cb,cc,tc_sat REAL :: omega - ! CFC - REAL :: atm_cfc11,atm_cfc12,atm_sf6,fact - REAL :: sch_11,sch_12,sch_sf,kw_11,kw_12,kw_sf - REAL :: flx11,flx12,flxsf,a_11,a_12,a_sf - ! natDIC - REAL :: natcu,natcb,natcc - REAL :: natpco2,natfluxd,natfluxu,natomega - REAL :: natsupsat,natundsa,natdissol - ! cisonew - REAL :: rco213,rco214 - REAL :: dissol13,dissol14 - REAL :: flux14d,flux14u,flux13d,flux13u - REAL :: atco213,atco214,pco213,pco214 - REAL :: frac_k,frac_aqg,frac_dicg - ! BROMO - REAL :: flx_bromo,sch_bromo,kw_bromo,a_bromo,atbrf,Kb1,lsub + REAL :: atm_cfc11,atm_cfc12,atm_sf6,fact ! CFC + REAL :: sch_11,sch_12,sch_sf,kw_11,kw_12,kw_sf ! CFC + REAL :: flx11,flx12,flxsf,a_11,a_12,a_sf ! CFC + REAL :: natcu,natcb,natcc ! natDIC + REAL :: natpco2,natfluxd,natfluxu,natomega ! natDIC + REAL :: natsupsat,natundsa,natdissol ! natDIC + REAL :: rco213,rco214 ! cisonew + REAL :: dissol13,dissol14 ! cisonew + REAL :: flux14d,flux14u,flux13d,flux13u ! cisonew + REAL :: atco213,atco214,pco213,pco214 ! cisonew + REAL :: frac_k,frac_aqg,frac_dicg ! cisonew + REAL :: flx_bromo,sch_bromo,kw_bromo,a_bromo,atbrf,Kb1,lsub ! BROMO ! set variables for diagnostic output to zero atmflx (:,:,:)=0. @@ -204,16 +189,12 @@ SUBROUTINE CARCHM(kpie,kpje,kpke,kbnd, & !$OMP ,cu,cb,cc,pco2,rpp0,scco2,scdms,sco2,oxy,ani,anisa,Xconvxa & !$OMP ,kwco2,kwdms,kwo2,atco2,ato2,atn2,fluxd,fluxu,oxflux,tc_sat & !$OMP ,niflux,n2oflux,dmsflux,omega,supsat,undsa,dissol & -! CFC !$OMP ,sch_11,sch_12,sch_sf,kw_11,kw_12,kw_sf,a_11,a_12,a_sf,flx11 & !$OMP ,flx12,flxsf,atm_cfc11,atm_cfc12,atm_sf6 & -! natDIC !$OMP ,natcu,natcb,natcc,natpco2,natfluxd,natfluxu,natomega & !$OMP ,natsupsat,natundsa,natdissol & -! cisonew !$OMP ,atco213,atco214,rco213,rco214,pco213,pco214,frac_aqg & !$OMP ,frac_dicg,flux13d,flux13u,flux14d,flux14u,dissol13,dissol14 & -! !$OMP ,flx_bromo,sch_bromo,kw_bromo,a_bromo,atbrf,Kb1,lsub & !$OMP ,j,i) DO k=1,kpke diff --git a/hamocc/hamocc4bcm.F90 b/hamocc/hamocc4bcm.F90 index 372c4363..458f866b 100644 --- a/hamocc/hamocc4bcm.F90 +++ b/hamocc/hamocc4bcm.F90 @@ -75,31 +75,27 @@ SUBROUTINE HAMOCC4BCM(kpie,kpje,kpke,kbnd,kplyear,kplmon,kplday,kldtday,& ! *REAL* *psao* - salinity [psu.]. ! *REAL* *patmco2* - atmospheric CO2 concentration [ppm] used in ! fully coupled mode (prognostic/diagnostic CO2). -! *REAL* *pflxco2* - CO2 flux [kg/m^2/s]. ! *REAL* *pflxdms* - DMS flux [kg/m^2/s]. +! *REAL* *pflxco2* - CO2 flux [kg/m^2/s]. ! *REAL* *patmbromo* - atmospheric bromoform concentration [ppt] used in ! fully coupled mode. -! *REAL* *pflxbromo* - Bromoform flux [kg/m^2/s]. ! !****************************************************************************** use mod_xc, only: mnproc - use mo_carbch, only: atmflx,ocetra,atm + use mo_carbch, only: atmflx,ocetra,atm,& + atm_cfc11_nh,atm_cfc11_sh,atm_cfc12_nh,atm_cfc12_sh,atm_sf6_nh,atm_sf6_sh 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,nriv + do_sedspinup,sedspin_yr_s,sedspin_yr_e,sedspin_ncyc, & + use_PROGCO2,use_DIAGCO2,use_BROMO, use_CFC, use_PBGC_CK_TIMESTEP,& + use_BOXATM, use_sedbypass + use mo_param1_bgc, only: iatmco2,iatmdms,nocetra,nriv,iatmbromo use mo_vgrid, only: set_vgrid use mo_apply_fedep, only: apply_fedep use mo_apply_rivin, only: apply_rivin use mo_apply_ndep, only: apply_ndep use mo_apply_oafx, only: apply_oafx - ! BOXATM use mo_boxatm, only: update_boxatm - ! BROMO - use mo_param1_bgc, only: iatmbromo - ! CFC - use mo_carbch, only: atm_cfc11_nh,atm_cfc11_sh,atm_cfc12_nh,atm_cfc12_sh,atm_sf6_nh,atm_sf6_sh - use mo_control_bgc, only: use_PROGCO2,use_DIAGCO2,use_BROMO, use_CFC, use_PBGC_CK_TIMESTEP,use_BOXATM, use_sedbypass implicit none @@ -266,8 +262,7 @@ SUBROUTINE HAMOCC4BCM(kpie,kpje,kpke,kbnd,kplyear,kplmon,kplday,kldtday,& end if CALL CARCHM(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,prho,pglat,omask, & - psicomo,ppao,pfu10,ptho,psao,& - pflxdms,pflxbromo) + psicomo,ppao,pfu10,ptho,psao) if (use_PBGC_CK_TIMESTEP ) then IF (mnproc.eq.1) THEN diff --git a/hamocc/hamocc_init.F90 b/hamocc/hamocc_init.F90 index 018121c9..64ace65d 100644 --- a/hamocc/hamocc_init.F90 +++ b/hamocc/hamocc_init.F90 @@ -38,15 +38,16 @@ 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,nfu,xchalt + use mod_xc, only: ii,jj,kk,idm,jdm,kdm,nbdy,isp,ifp,ilp, & + mnproc,lp,nfu,xchalt use mod_grid, only: plon,plat 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 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_BROMO,use_sedbypass,use_BOXATM 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 @@ -61,16 +62,12 @@ subroutine hamocc_init(read_rest,rstfnm_hamocc) use mo_read_pi_ph, only: ini_pi_ph,pi_ph_file use mo_read_sedpor, only: read_sedpor,sedporfile use mo_clim_swa, only: ini_swa_clim,swaclimfile - use mo_Gdata_read, only: inidic,inialk,inipo4,inioxy,inino3, & - & inisil,inid13c,inid14c - use mo_intfcblom, only: alloc_mem_intfcblom,nphys, & - & bgc_dx,bgc_dy,bgc_dp,bgc_rho, & - & omask,sedlay2,powtra2,burial2, & - & blom2hamocc - ! BOXATM - use mo_intfcblom, only: atm2 - use mo_control_bgc, only: use_BROMO,use_sedbypass,use_BOXATM - + use mo_Gdata_read, only: inidic,inialk,inipo4,inioxy,inino3, & + inisil,inid13c,inid14c + use mo_intfcblom, only: alloc_mem_intfcblom,nphys, & + bgc_dx,bgc_dy,bgc_dp,bgc_rho, & + omask,sedlay2,powtra2,burial2, & + blom2hamocc,atm2 implicit none integer, intent(in) :: read_rest @@ -81,7 +78,7 @@ subroutine hamocc_init(read_rest,rstfnm_hamocc) real :: sed_por(idm,jdm,ks) = 0. namelist /bgcnml/ atm_co2,fedepfile,do_rivinpt,rivinfile,do_ndep,ndepfile, & - & do_oalk,do_sedspinup,sedspin_yr_s, & + & do_oalk,do_sedspinup,sedspin_yr_s, & & sedspin_yr_e,sedspin_ncyc, & & inidic,inialk,inipo4,inioxy,inino3,inisil, & & inid13c,inid14c,swaclimfile, & diff --git a/hamocc/inventory_bgc.F90 b/hamocc/inventory_bgc.F90 index 50c03d71..3a4b99a1 100644 --- a/hamocc/inventory_bgc.F90 +++ b/hamocc/inventory_bgc.F90 @@ -52,17 +52,17 @@ SUBROUTINE INVENTORY_BGC(kpie,kpje,kpke,dlxp,dlyp,ddpo,omask,iogrp) ! none. ! !********************************************************************** - use mod_xc, only: mnproc,ips,nbdy,xcsum + 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_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, & & irdin,irdip,irsi,iralk,irdoc,irdet,nocetra,npowtra,nsedtra,nriv use mo_vgrid, only: dp_min - + ! NOT sedbypass use mo_param1_bgc, only: ks use mo_sedmnt, only: porwat,seddw,sedlay,burial,sedhpl,powtra,porsol @@ -100,8 +100,8 @@ SUBROUTINE INVENTORY_BGC(kpie,kpje,kpke,dlxp,dlyp,ddpo,omask,iogrp) real :: zsedlayto(nsedtra) ! Sum : Sediment layer tracers real :: zburial(nsedtra) ! Sum : Sediment burial tracers !--- oceanic tracers - real :: zocetratot(-1:nocetra) ! Sum : Ocean tracers - real :: zocetratoc(-1:nocetra) ! Mean concentration of ocean racers + real :: zocetratot(nocetra) ! Sum : Ocean tracers + real :: zocetratoc(nocetra) ! Mean concentration of ocean racers !--- additional ocean tracer real :: zhito ! Total hydrogen ion tracer real :: zco3to ! Total dissolved carbonate (CO3) tracer @@ -149,7 +149,7 @@ SUBROUTINE INVENTORY_BGC(kpie,kpje,kpke,dlxp,dlyp,ddpo,omask,iogrp) ENDDO ENDDO ENDDO - + CALL xcsum(zsedtotvol,ztmp1,ips) DO l=1,npowtra @@ -162,7 +162,7 @@ SUBROUTINE INVENTORY_BGC(kpie,kpje,kpke,dlxp,dlyp,ddpo,omask,iogrp) ENDDO ENDDO ENDDO - + CALL xcsum(zpowtratot(l),ztmp1,ips) zpowtratoc(l) = zpowtratot(l)/zsedtotvol ENDDO @@ -170,7 +170,7 @@ SUBROUTINE INVENTORY_BGC(kpie,kpje,kpke,dlxp,dlyp,ddpo,omask,iogrp) !=== non aqueous sediment tracer !---------------------------------------------------------------------- zburial = sum2d_array(burial, nsedtra) - + DO l=1,nsedtra ztmp1(:,:)=0.0 DO k=1,ks @@ -181,10 +181,10 @@ SUBROUTINE INVENTORY_BGC(kpie,kpje,kpke,dlxp,dlyp,ddpo,omask,iogrp) ENDDO ENDDO ENDDO - + CALL xcsum(zsedlayto(l),ztmp1,ips) ENDDO - + ztmp1(:,:)=0.0 DO k=1,ks DO j=1,kpje @@ -194,7 +194,7 @@ SUBROUTINE INVENTORY_BGC(kpie,kpje,kpke,dlxp,dlyp,ddpo,omask,iogrp) ENDDO ENDDO ENDDO - + CALL xcsum(zsedhplto,ztmp1,ips) end if ! not sedbypass @@ -353,97 +353,78 @@ SUBROUTINE INVENTORY_BGC(kpie,kpje,kpke,dlxp,dlyp,ddpo,omask,iogrp) ! & (zocetratot(idet)+zocetratot(idoc)+zocetratot(iphy) & ! & +zocetratot(izoo))*rcar+zocetratot(isco212)+zocetratot(icalc) + + totalcarbon= & + (zocetratot(idet)+zocetratot(idoc)+zocetratot(iphy) & + + zocetratot(izoo))*rcar+zocetratot(isco212)+zocetratot(icalc) & + + zpowtratot(ipowaic)+zsedlayto(isssc12)+zsedlayto(issso12)*rcar & + + zburial(isssc12)+zburial(issso12)*rcar & + + zprorca*rcar+zprcaca + if (use_BOXATM) then - totalcarbon= & - & (zocetratot(idet)+zocetratot(idoc)+zocetratot(iphy) & - & +zocetratot(izoo))*rcar+zocetratot(isco212)+zocetratot(icalc) & - & +zpowtratot(ipowaic)+zsedlayto(isssc12)+zsedlayto(issso12)*rcar & - & +zburial(isssc12)+zburial(issso12)*rcar & - & +zprorca*rcar+zprcaca & - & +zatmco2*ppm2con + totalcarbon = totalcarbon + zatmco2*ppm2con else - totalcarbon= & - & (zocetratot(idet)+zocetratot(idoc)+zocetratot(iphy) & - & +zocetratot(izoo))*rcar+zocetratot(isco212)+zocetratot(icalc) & - & +zpowtratot(ipowaic)+zsedlayto(isssc12)+zsedlayto(issso12)*rcar & - & +zburial(isssc12)+zburial(issso12)*rcar & - & +zprorca*rcar+zprcaca & - & +co2flux + totalcarbon = totalcarbon + co2flux end if + totalnitr= & + (zocetratot(idet)+zocetratot(idoc)+zocetratot(iphy) & + + zocetratot(izoo))*rnit+zocetratot(iano3)+zocetratot(igasnit)*2 & + + zpowtratot(ipowno3)+zpowtratot(ipown2)*2 & + + zsedlayto(issso12)*rnit+zburial(issso12)*rnit & + + zocetratot(ian2o)*2 & + - sndepflux & + + zprorca*rnit + if (use_BOXATM) then - totalnitr= & - & (zocetratot(idet)+zocetratot(idoc)+zocetratot(iphy) & - & +zocetratot(izoo))*rnit+zocetratot(iano3)+zocetratot(igasnit)*2 & - & +zpowtratot(ipowno3)+zpowtratot(ipown2)*2 & - & +zsedlayto(issso12)*rnit+zburial(issso12)*rnit & - & +zocetratot(ian2o)*2 & - & - sndepflux & - & +zprorca*rnit & - & +zatmn2*ppm2con*2 + totalnitr = totalnitr + zatmn2*ppm2con*2 else - totalnitr= & - & (zocetratot(idet)+zocetratot(idoc)+zocetratot(iphy) & - & +zocetratot(izoo))*rnit+zocetratot(iano3)+zocetratot(igasnit)*2 & - & +zpowtratot(ipowno3)+zpowtratot(ipown2)*2 & - & +zsedlayto(issso12)*rnit+zburial(issso12)*rnit & - & +zocetratot(ian2o)*2 & - & - sndepflux & - & +zprorca*rnit & - & +sn2flux*2+sn2oflux*2 + totalnitr = totalnitr + sn2flux*2+sn2oflux*2 end if - totalphos= & - & zocetratot(idet)+zocetratot(idoc)+zocetratot(iphy) & - & +zocetratot(izoo)+zocetratot(iphosph) & - & +zpowtratot(ipowaph)+zsedlayto(issso12) & - & +zburial(issso12) & - & +zprorca - - totalsil= & - & zocetratot(isilica)+zocetratot(iopal) & - & +zpowtratot(ipowasi)+zsedlayto(issssil)+zburial(issssil) & - & +zsilpro + totalphos= & + zocetratot(idet)+zocetratot(idoc)+zocetratot(iphy) & + + zocetratot(izoo)+zocetratot(iphosph) & + + zpowtratot(ipowaph)+zsedlayto(issso12) & + + zburial(issso12) & + + zprorca + + totalsil= & + zocetratot(isilica)+zocetratot(iopal) & + + zpowtratot(ipowasi)+zsedlayto(issssil)+zburial(issssil) & + + zsilpro + + totaloxy= & + (zocetratot(idet)+zocetratot(idoc)+zocetratot(iphy) & + + zocetratot(izoo))*(-24.)+zocetratot(ioxygen) & + + zocetratot(iphosph)*2 +zocetratot(isco212)+zocetratot(icalc) & + + zocetratot(iano3)*1.5+zocetratot(ian2o)*0.5 & + + zsedlayto(issso12)*(-24.) + zsedlayto(isssc12) & + !+ zburial(issso12)*(-24.) + zburial(isssc12) & + + zpowtratot(ipowno3)*1.5+zpowtratot(ipowaic) & + + zpowtratot(ipowaox)+zpowtratot(ipowaph)*2 & + - sndepflux*1.5 & + + zprorca*(-24.)+zprcaca if (use_BOXATM) then - totaloxy= & - & (zocetratot(idet)+zocetratot(idoc)+zocetratot(iphy) & - & +zocetratot(izoo))*(-24.)+zocetratot(ioxygen) & - & +zocetratot(iphosph)*2 +zocetratot(isco212)+zocetratot(icalc) & - & +zocetratot(iano3)*1.5+zocetratot(ian2o)*0.5 & - & +zsedlayto(issso12)*(-24.) + zsedlayto(isssc12) & - !& +zburial(issso12)*(-24.) + zburial(isssc12) & - & +zpowtratot(ipowno3)*1.5+zpowtratot(ipowaic) & - & +zpowtratot(ipowaox)+zpowtratot(ipowaph)*2 & - & - sndepflux*1.5 & - & +zprorca*(-24.)+zprcaca & - & +zatmo2*ppm2con+zatmco2*ppm2con + totaloxy = totaloxy + zatmo2*ppm2con+zatmco2*ppm2con else - totaloxy= & - & (zocetratot(idet)+zocetratot(idoc)+zocetratot(iphy) & - & +zocetratot(izoo))*(-24.)+zocetratot(ioxygen) & - & +zocetratot(iphosph)*2 +zocetratot(isco212)+zocetratot(icalc) & - & +zocetratot(iano3)*1.5+zocetratot(ian2o)*0.5 & - & +zsedlayto(issso12)*(-24.) + zsedlayto(isssc12) & - !& +zburial(issso12)*(-24.) + zburial(isssc12) & - & +zpowtratot(ipowno3)*1.5+zpowtratot(ipowaic) & - & +zpowtratot(ipowaox)+zpowtratot(ipowaph)*2 & - & - sndepflux*1.5 & - & +zprorca*(-24.)+zprcaca & - & +so2flux+sn2oflux*0.5+co2flux + totaloxy = totaloxy + so2flux+sn2oflux*0.5+co2flux end if IF (do_rivinpt) THEN - totalcarbon = totalcarbon - (srivflux(irdoc)+srivflux(irdet))*rcar & - & -(srivflux(iralk)+srivflux(irdin)+srivflux(irdip)) ! =sco212 - totalnitr = totalnitr - (srivflux(irdoc)+srivflux(irdet))*rnit & - & - srivflux(irdin) - totalphos = totalphos & - & -(srivflux(irdoc)+srivflux(irdet)+srivflux(irdip)) - totalsil = totalsil - srivflux(irsi) - totaloxy = totaloxy - (srivflux(irdoc)+srivflux(irdet))*(-24.) & - & - srivflux(irdin)*1.5 - srivflux(irdip)*2. & - & - (srivflux(iralk)+srivflux(irdin)+srivflux(irdip)) ! =sco212 + totalcarbon = totalcarbon & + - (srivflux(irdoc)+srivflux(irdet))*rcar -(srivflux(iralk)+srivflux(irdin)+srivflux(irdip)) ! =sco212 + totalnitr = totalnitr & + - (srivflux(irdoc)+srivflux(irdet))*rnit - srivflux(irdin) + totalphos = totalphos & + -(srivflux(irdoc)+srivflux(irdet)+srivflux(irdip)) + totalsil = totalsil & + - srivflux(irsi) + totaloxy = totaloxy & + - (srivflux(irdoc)+srivflux(irdet))*(-24.) & + - srivflux(irdin)*1.5 - srivflux(irdip)*2. & + - (srivflux(iralk)+srivflux(irdin)+srivflux(irdip)) ! =sco212 ENDIF !=== Compute sediment fluxes @@ -544,7 +525,7 @@ subroutine write_stdout & ' ',zpowtratoc(l),' ',zsedtotvol ENDDO WRITE(io_stdo_bgc,*) ' ' - + !=== non aqueous sediment tracer !------------------------------------------------------------------ WRITE(io_stdo_bgc,*) ' ' @@ -553,7 +534,7 @@ subroutine write_stdout WRITE(io_stdo_bgc,*) & & '----------------------------------------------------' WRITE(io_stdo_bgc,*) ' [kmol]' - + DO l=1,nsedtra WRITE(io_stdo_bgc,*) 'Sediment No. ',l,' ', zsedlayto(l) WRITE(io_stdo_bgc,*) 'Burial No. ',l,' ', zburial(l) @@ -1920,4 +1901,3 @@ end subroutine nccheck END SUBROUTINE INVENTORY_BGC - diff --git a/hamocc/mo_boxatm.F90 b/hamocc/mo_boxatm.F90 index 41777e3b..3216dea1 100644 --- a/hamocc/mo_boxatm.F90 +++ b/hamocc/mo_boxatm.F90 @@ -54,14 +54,10 @@ 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 - use mo_param1_bgc, only: iatmco2 - ! cisonew - use mo_param1_bgc, only: iatmc13,iatmc14,isco214,idet14,icalc14,idoc14 - use mo_param1_bgc, only: iphy14,izoo14,ipowc14,issso14,isssc14 - use mo_carbch, only: c14dec, ocetra + use mo_carbch, only: atmflx, atm, c14dec, ocetra + use mo_param1_bgc, only: iatmco2,iatmc13,iatmc14,isco214,idet14,icalc14,idoc14, & + iphy14,izoo14,ipowc14,issso14,isssc14 use mo_biomod, only: rcar - ! sedbypass use mo_sedmnt, only: powtra,sedlay,seddw,porwat,porsol implicit none @@ -71,15 +67,13 @@ subroutine update_boxatm(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask) REAL, intent(in) :: pddpo(kpie,kpje,kpke),omask(kpie,kpje) 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 - ! cisonew - REAL :: ztmp2(1-nbdy:kpie+nbdy,1-nbdy:kpje+nbdy) - REAL :: co213flux, co213flux_ppm - REAL :: co214flux, co214flux_ppm - REAL :: totc14dec, vol + 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 diff --git a/hamocc/mo_intfcblom.F90 b/hamocc/mo_intfcblom.F90 index 8504b77b..2c6537b9 100644 --- a/hamocc/mo_intfcblom.F90 +++ b/hamocc/mo_intfcblom.F90 @@ -67,21 +67,21 @@ module mo_intfcblom implicit none - integer, parameter :: nphys=2 + integer, parameter :: nphys=2 - real, allocatable, save :: bgc_dx(:,:),bgc_dy(:,:) - real, allocatable, save :: bgc_dp(:,:,:) - real, allocatable, save :: bgc_rho(:,:,:) - real, allocatable, save :: omask(:,:) + real, allocatable :: bgc_dx(:,:),bgc_dy(:,:) + real, allocatable :: bgc_dp(:,:,:) + real, allocatable :: bgc_rho(:,:,:) + real, allocatable :: omask(:,:) ! Two time-level copy of sediment fields - real, allocatable, save :: sedlay2(:,:,:,:) - real, allocatable, save :: powtra2(:,:,:,:) - real, allocatable, save :: burial2(:,:,:,:) + real, allocatable :: sedlay2(:,:,:,:) + real, allocatable :: powtra2(:,:,:,:) + real, allocatable :: burial2(:,:,:,:) ! Two time level copy of prognostic atmosphere field ! used if BOXATM is activated - real, allocatable, save :: atm2(:,:,:,:) + real, allocatable :: atm2(:,:,:,:) contains !****************************************************************************** diff --git a/hamocc/mo_param1_bgc.F90 b/hamocc/mo_param1_bgc.F90 index 54199be5..ae3a4506 100644 --- a/hamocc/mo_param1_bgc.F90 +++ b/hamocc/mo_param1_bgc.F90 @@ -32,14 +32,15 @@ MODULE mo_param1_bgc ! - To facilitate easier use of 'only-lists' in use statements, make indices ! always defined also in case they are inside a #ifdef directive. ! -! ! Purpose ! ------- ! - definition of indices in tracer arrays ! !****************************************************************************** - !use mo_control_bgc, only: use_cisonew - use mo_control_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_PROGCO2, use_DIAGCO2 implicit none public @@ -47,127 +48,153 @@ MODULE mo_param1_bgc INTEGER, PARAMETER :: ks=12,ksp=ks+1 ! ks: nb of sediment layers REAL, PARAMETER :: safediv = 1.0e-25 ! added to the denominator of isotopic ratios (avoid div. by zero) + ! ------------------ ! Tracer indices + ! ------------------ + integer :: i_base - integer :: isco212 - integer :: ialkali - integer :: iphosph - integer :: ioxygen - integer :: igasnit - integer :: iano3 - integer :: isilica - integer :: idoc - integer :: iphy - integer :: izoo - integer :: idet - integer :: icalc - integer :: iopal - integer :: ian2o - integer :: idms - integer :: iiron - integer :: ifdust - integer :: iprefo2 - integer :: iprefpo4 - integer :: iprefalk - integer :: iprefdic - integer :: idicsat - - integer :: i_iso - integer :: isco213 - integer :: isco214 - integer :: idoc13 - integer :: idoc14 - integer :: iphy13 - integer :: iphy14 - integer :: izoo13 - integer :: izoo14 - integer :: idet13 - integer :: idet14 - integer :: icalc13 - integer :: icalc14 - - integer :: i_cfc - integer :: icfc11 - integer :: icfc12 - integer :: isf6 - - integer :: i_agg - integer :: inos - integer :: iadust - - integer :: i_nat_dic - integer :: inatsco212 - integer :: inatalkali - integer :: inatcalc - - integer :: i_bromo - integer :: ibromo - - ! total number of advected tracers + integer, protected :: isco212 + integer, protected :: ialkali + integer, protected :: iphosph + integer, protected :: ioxygen + integer, protected :: igasnit + integer, protected :: iano3 + integer, protected :: isilica + integer, protected :: idoc + integer, protected :: iphy + integer, protected :: izoo + integer, protected :: idet + integer, protected :: icalc + integer, protected :: iopal + integer, protected :: ian2o + integer, protected :: idms + integer, protected :: iiron + integer, protected :: ifdust + integer, protected :: iprefo2 + integer, protected :: iprefpo4 + integer, protected :: iprefalk + integer, protected :: iprefdic + integer, protected :: idicsat + + ! cisonew + integer, protected :: i_iso + integer, protected :: isco213 + integer, protected :: isco214 + integer, protected :: idoc13 + integer, protected :: idoc14 + integer, protected :: iphy13 + integer, protected :: iphy14 + integer, protected :: izoo13 + integer, protected :: izoo14 + integer, protected :: idet13 + integer, protected :: idet14 + integer, protected :: icalc13 + integer, protected :: icalc14 + + !CFC + integer, protected :: i_cfc + integer, protected :: icfc11 + integer, protected :: icfc12 + integer, protected :: isf6 + + ! AGG + integer, protected :: i_agg + integer, protected :: inos + integer, protected :: iadust + + ! natDIC + integer, protected :: i_nat_dic + integer, protected :: inatsco212 + integer, protected :: inatalkali + integer, protected :: inatcalc + + ! BROMO + integer, protected :: i_bromo + integer, protected :: ibromo + + ! total number of advected tracers(set by allocate_tracers in mod_tracers.F90) integer :: nocetra + ! ------------------ ! atmosphere - integer :: i_base_atm - integer :: iatmco2 - integer :: iatmo2 - integer :: iatmn2 - integer :: iatmn2o - integer :: iatmdms - - integer :: i_iso_atm - integer :: iatmc13 - integer :: iatmc14 - integer :: i_cfc_atm - integer :: iatmf11 - integer :: iatmf12 - integer :: iatmsf6 - integer :: i_ndic_atm - integer :: iatmnco2 - integer :: i_bromo_atm - integer :: iatmbromo - integer :: natm ! total number of atmosphere tracers + ! ------------------ + + integer, protected :: i_base_atm + integer, protected :: iatmco2 + integer, protected :: iatmo2 + integer, protected :: iatmn2 + integer, protected :: iatmn2o + integer, protected :: iatmdms + ! cisonew atm + integer, protected :: i_iso_atm + integer, protected :: iatmc13 + integer, protected :: iatmc14 + + ! CFC atm + integer, protected :: i_cfc_atm + integer, protected :: iatmf11 + integer, protected :: iatmf12 + integer, protected :: iatmsf6 + + ! natDIC atm + integer, protected :: i_ndic_atm + integer, protected :: iatmnco2 + + ! BROMO atm + integer, protected :: i_bromo_atm + integer, protected :: iatmbromo + + integer, protected :: natm ! total number of atmosphere tracers + + ! ------------------ ! rivers - integer :: nriv ! size of river input field - integer :: irdin ! dissolved inorganic nitrogen - integer :: irdip ! dissolved inorganic phosphorous - integer :: irsi ! dissolved silicate - integer :: iralk ! alkalinity - integer :: iriron ! dissolved bioavailable iron - integer :: irdoc ! dissolved organic carbon - integer :: irdet ! particulate carbon - - ! --- sediment + ! ------------------ + + integer, protected :: nriv ! size of river input field + integer, protected :: irdin ! dissolved inorganic nitrogen + integer, protected :: irdip ! dissolved inorganic phosphorous + integer, protected :: irsi ! dissolved silicate + integer, protected :: iralk ! alkalinity + integer, protected :: iriron ! dissolved bioavailable iron + integer, protected :: irdoc ! dissolved organic carbon + integer, protected :: irdet ! particulate carbon + + ! ------------------ + ! sediment + ! ------------------ ! sediment solid components - integer :: i_sed_base - integer :: issso12 - integer :: isssc12 - integer :: issssil - integer :: issster - - integer :: i_sed_cisonew - integer :: issso13 - integer :: issso14 - integer :: isssc13 - integer :: isssc14 - integer :: nsedtra + integer, protected :: i_sed_base + integer, protected :: issso12 + integer, protected :: isssc12 + integer, protected :: issssil + integer, protected :: issster + + ! ciso sediment + integer, protected :: i_sed_cisonew + integer, protected :: issso13 + integer, protected :: issso14 + integer, protected :: isssc13 + integer, protected :: isssc14 + integer, protected :: nsedtra ! sediment pore water components - integer :: i_pow_base - integer :: ipowaic - integer :: ipowaal - integer :: ipowaph - integer :: ipowaox - integer :: ipown2 - integer :: ipowno3 - integer :: ipowasi - integer :: i_pow_cisonew - integer :: ipowc13 - integer :: ipowc14 - integer :: npowtra - - ! Mapping between pore water and ocean tracers needed for pore water diffusion - integer, allocatable :: map_por2octra(:) + integer, protected :: i_pow_base + integer, protected :: ipowaic + integer, protected :: ipowaal + integer, protected :: ipowaph + integer, protected :: ipowaox + integer, protected :: ipown2 + integer, protected :: ipowno3 + integer, protected :: ipowasi + integer, protected :: i_pow_cisonew + integer, protected :: ipowc13 + integer, protected :: ipowc14 + integer, protected :: npowtra ! computed in init_indices + + ! Mapping between pore water and ocean tracers needed for pore + ! water diffusion + integer, protected, allocatable :: map_por2octra(:) contains diff --git a/hamocc/ncout_hamocc.F90 b/hamocc/ncout_hamocc.F90 index 7e237c63..dfb79d06 100644 --- a/hamocc/ncout_hamocc.F90 +++ b/hamocc/ncout_hamocc.F90 @@ -23,143 +23,133 @@ subroutine ncwrt_bgc(iogrp) ! --- output routine for HAMOCC diagnostic fields ! --- ------------------------------------------- ! - use mod_time, only: date0,date,calendar,nstep,nstep_in_day, & - & nday_of_year,time0,time + use mod_time, only: date0,date,calendar,nstep,nstep_in_day, & + nday_of_year,time0,time use mod_xc, only: kdm,mnproc,itdm,jtdm,lp use mod_grid, only: depths - use mod_dia, only: diafnm,sigmar1,iotype,ddm,depthslev, & - & depthslev_bnds - use mo_control_bgc, only: dtbgc + use mod_dia, only: diafnm,sigmar1,iotype,ddm,depthslev, & + depthslev_bnds + use mo_control_bgc, only: dtbgc,use_cisonew,use_AGG,use_CFC,use_natDIC, & + use_BROMO,use_sedbypass,use_BOXATM use mo_vgrid, only: k0100,k0500,k1000,k2000,k4000 use mo_param1_bgc, only: ks - use mod_nctools, only: ncwrt1,ncdims,nctime,ncfcls,ncfopn, & - & ncdimc - use mo_bgcmean, only: domassfluxes, & - & flx_ndep,flx_oalk, & - & flx_cal0100,flx_cal0500,flx_cal1000, & - & flx_cal2000,flx_cal4000,flx_cal_bot, & - & flx_car0100,flx_car0500,flx_car1000, & - & flx_car2000,flx_car4000,flx_car_bot, & - & flx_bsi0100,flx_bsi0500,flx_bsi1000, & - & flx_bsi2000,flx_bsi4000,flx_bsi_bot, & - & flx_sediffic,flx_sediffal,flx_sediffph, & - & flx_sediffox,flx_sediffn2,flx_sediffno3, & - & flx_sediffsi, & - & jsediffic,jsediffal,jsediffph,jsediffox, & - & jsediffn2,jsediffno3,jsediffsi, & - & 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, & - & jco2fxd,jco2fxu,jco3,jdic,jdicsat, & - & jdms,jdms_bac,jdms_uv,jdmsflux,jdmsprod, & - & jdoc,jdp,jeps,jexpoca,jexport,jexposi, & - & jgrazer, & - & jintdnit,jintnfix,jintphosy,jiron,jirsi, & - & jkwco2,jlvlalkali,jlvlano3,jlvlasize, & - & jlvlbigd14c,jlvlbromo,jlvlcalc,jlvlcalc13, & - & jlvlcfc11,jlvlcfc12,jlvlco3,jlvld13c, & - & jlvld14c,jlvldic,jlvldic13,jlvldic14, & - & jlvldicsat,jlvldoc,jlvldoc13,jlvleps, & - & jlvlgrazer,jlvlgrazer13,jlvliron,jlvln2o, & - & jlvlnatalkali,jlvlnatcalc,jlvlnatco3, & - & jlvlnatdic,jlvlnatomegaa,jlvlnatomegac, & - & jlvlnos,jlvlo2sat,jlvlomegaa,jlvlomegac, & - & jlvlopal,jlvloxygen,jlvlph,jlvlphosph, & - & jlvlphosy,jlvlphyto,jlvlphyto13,jlvlpoc, & - & jlvlpoc13,jlvlprefalk,jlvlprefdic, & - & jlvlprefo2,jlvlprefpo4,jlvlsf6,jlvlsilica, & - & jlvlwnos,jlvlwphy,jn2o, & - & jn2ofx,jndepfx,jniflux,jnos,joalkfx, & - & 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, & - & jsrfoxygen,jsrfphosph,jsrfphyto,jsrfsilica,jsrfph, & - & jwnos,jwphy, & - & lyr_dp,lyr_dic,lyr_alkali,lyr_phosph, & - & lyr_oxygen,lyr_ano3,lyr_silica,lyr_doc, & - & lyr_phyto,lyr_grazer,lyr_poc,lyr_calc, & - & lyr_opal,lyr_iron,lyr_phosy,lyr_co3,lyr_ph, & - & lyr_omegaa,lyr_omegac,lyr_n2o,lyr_prefo2, & - & lyr_o2sat,lyr_prefpo4,lyr_prefalk, & - & lyr_prefdic,lyr_dicsat, & - & lvl_dic,lvl_alkali, & - & lvl_phosph,lvl_oxygen,lvl_ano3,lvl_silica, & - & lvl_doc,lvl_phyto,lvl_grazer,lvl_poc, & - & lvl_calc,lvl_opal,lvl_iron,lvl_phosy, & - & lvl_co3,lvl_ph,lvl_omegaa,lvl_omegac, & - & 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, & - & srf_export,srf_exposi,srf_expoca,srf_dic, & - & srf_alkali,srf_phosph,srf_oxygen,srf_ano3, & - & srf_silica,srf_iron,srf_phyto,srf_ph, & - & int_phosy,int_nfix,int_dnit, & - & nbgc,nacc_bgc,bgcwrt,glb_inventory,bgct2d, & - & nbgcmax,glb_ncformat,glb_compflag, & - & glb_fnametag,filefq_bgc,diagfq_bgc, & - & filemon_bgc,fileann_bgc,ip,wrtlyr,wrtlvl,wrtsrf, & - & loglyr,loglvl,logsrf,inilvl,inilyr,inisrf, & - & msklvl,msksrf,finlyr - ! AGG - use mo_bgcmean, only: lyr_nos,lyr_wphy, lyr_wnos,lyr_eps, & - & lyr_asize,lvl_nos,lvl_wphy,lvl_wnos,lvl_eps, & - & lvl_asize - ! BROMO - use mo_bgcmean, only: jbromo,jbromofx,jsrfbromo,jbromo_prod, & - & jbromo_uv,jatmbromo,lvl_bromo,srf_bromofx, & - & srf_bromo,int_bromopro,int_bromouv, & - & srf_atmbromo,lyr_bromo - ! CFC - use mo_bgcmean,only: jcfc11,jcfc12,jsf6,jcfc11fx,jcfc12fx,jsf6fx, & - & lvl_cfc11,lvl_cfc12,lvl_sf6,srf_cfc11, & - & srf_cfc12,srf_sf6,lyr_cfc11,lyr_cfc12, & - & lyr_sf6 - - ! cisonew + use mod_nctools, only: ncwrt1,ncdims,nctime,ncfcls,ncfopn,ncdimc + use mo_bgcmean, only: domassfluxes, & + flx_ndep,flx_oalk, & + flx_cal0100,flx_cal0500,flx_cal1000, & + flx_cal2000,flx_cal4000,flx_cal_bot, & + flx_car0100,flx_car0500,flx_car1000, & + flx_car2000,flx_car4000,flx_car_bot, & + flx_bsi0100,flx_bsi0500,flx_bsi1000, & + flx_bsi2000,flx_bsi4000,flx_bsi_bot, & + flx_sediffic,flx_sediffal,flx_sediffph, & + flx_sediffox,flx_sediffn2,flx_sediffno3,flx_sediffsi, & + jsediffic,jsediffal,jsediffph,jsediffox, & + jsediffn2,jsediffno3,jsediffsi, & + 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, & + jco2fxd,jco2fxu,jco3,jdic,jdicsat, & + jdms,jdms_bac,jdms_uv,jdmsflux,jdmsprod, & + jdoc,jdp,jeps,jexpoca,jexport,jexposi, & + jgrazer, & + jintdnit,jintnfix,jintphosy,jiron,jirsi, & + jkwco2,jlvlalkali,jlvlano3,jlvlasize, & + jlvlbigd14c,jlvlbromo,jlvlcalc,jlvlcalc13, & + jlvlcfc11,jlvlcfc12,jlvlco3,jlvld13c, & + jlvld14c,jlvldic,jlvldic13,jlvldic14, & + jlvldicsat,jlvldoc,jlvldoc13,jlvleps, & + jlvlgrazer,jlvlgrazer13,jlvliron,jlvln2o, & + jlvlnatalkali,jlvlnatcalc,jlvlnatco3, & + jlvlnatdic,jlvlnatomegaa,jlvlnatomegac, & + jlvlnos,jlvlo2sat,jlvlomegaa,jlvlomegac, & + jlvlopal,jlvloxygen,jlvlph,jlvlphosph, & + jlvlphosy,jlvlphyto,jlvlphyto13,jlvlpoc, & + jlvlpoc13,jlvlprefalk,jlvlprefdic, & + jlvlprefo2,jlvlprefpo4,jlvlsf6,jlvlsilica, & + jlvlwnos,jlvlwphy,jn2o, & + jn2ofx,jndepfx,jniflux,jnos,joalkfx, & + 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, & + jsrfoxygen,jsrfphosph,jsrfphyto,jsrfsilica,jsrfph, & + jwnos,jwphy, & + lyr_dp,lyr_dic,lyr_alkali,lyr_phosph, & + lyr_oxygen,lyr_ano3,lyr_silica,lyr_doc, & + lyr_phyto,lyr_grazer,lyr_poc,lyr_calc, & + lyr_opal,lyr_iron,lyr_phosy,lyr_co3,lyr_ph, & + lyr_omegaa,lyr_omegac,lyr_n2o,lyr_prefo2, & + lyr_o2sat,lyr_prefpo4,lyr_prefalk, & + lyr_prefdic,lyr_dicsat, & + lvl_dic,lvl_alkali, & + lvl_phosph,lvl_oxygen,lvl_ano3,lvl_silica, & + lvl_doc,lvl_phyto,lvl_grazer,lvl_poc, & + lvl_calc,lvl_opal,lvl_iron,lvl_phosy, & + lvl_co3,lvl_ph,lvl_omegaa,lvl_omegac, & + 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, & + srf_export,srf_exposi,srf_expoca,srf_dic, & + srf_alkali,srf_phosph,srf_oxygen,srf_ano3, & + srf_silica,srf_iron,srf_phyto,srf_ph, & + int_phosy,int_nfix,int_dnit, & + nbgc,nacc_bgc,bgcwrt,glb_inventory,bgct2d, & + nbgcmax,glb_ncformat,glb_compflag, & + glb_fnametag,filefq_bgc,diagfq_bgc, & + filemon_bgc,fileann_bgc,ip,wrtlyr,wrtlvl,wrtsrf, & + loglyr,loglvl,logsrf,inilvl,inilyr,inisrf, & + msklvl,msksrf,finlyr, & + lyr_nos,lyr_wphy, lyr_wnos,lyr_eps, & + lyr_asize,lvl_nos,lvl_wphy,lvl_wnos,lvl_eps, & + lvl_asize, & + jbromo,jbromofx,jsrfbromo,jbromo_prod, & + jbromo_uv,jatmbromo,lvl_bromo,srf_bromofx, & + srf_bromo,int_bromopro,int_bromouv, & + srf_atmbromo,lyr_bromo, & + jcfc11,jcfc12,jsf6,jcfc11fx,jcfc12fx,jsf6fx, & + lvl_cfc11,lvl_cfc12,lvl_sf6,srf_cfc11, & + srf_cfc12,srf_sf6,lyr_cfc11,lyr_cfc12, & + lyr_sf6, & + jdic13,jdic14,jd13c,jd14c,jbigd14c,jpoc13, & + jdoc13,jcalc13,jphyto13,jgrazer13,jco213fxd, & + jco213fxu,jco214fxd,jco214fxu,jatmc13, & + jatmc14,jdic13,jdic14,jd13c,jd14c,jbigd14c, & + srf_co213fxd,srf_co213fxu,srf_co214fxd, & + srf_co214fxu,srf_atmc13,srf_atmc14,lyr_dic13, & + lyr_dic14,lyr_d13c,lyr_d14c,lyr_bigd14c, & + lyr_poc13,lyr_doc13,lyr_calc13,lyr_phyto13, & + lyr_grazer13,lvl_dic13,lvl_dic14,lvl_d13c, & + lvl_d14c,lvl_bigd14c,lvl_poc13,lvl_doc13, & + lvl_calc13,lvl_phyto13,lvl_grazer13, & + jnatalkali,jnatdic,jnatcalc,jnatco3,jnatph, & + jnatomegaa,jnatomegac,jlvlnatph, & + jsrfnatdic,jsrfnatalk,jsrfnatph, & + jnatpco2,jnatco2fx,lyr_natco3, & + lyr_natalkali,lyr_natdic,lyr_natph,lyr_natcalc, & + lyr_natomegaa,lyr_natomegac,lvl_natco3, & + lvl_natalkali,lvl_natdic,lvl_natph,lvl_natcalc, & + lvl_natomegaa,lvl_natomegac,srf_natdic, & + srf_natalkali,srf_natpco2,srf_natco2fx,srf_natph, & + jpowaic,jpowaal,jpowaph,jpowaox,jpown2, & + jpowno3,jpowasi,jssso12,jssssil,jssster, & + jsssc12,jbursssc12,jburssssil,jburssster, & + sdm_powaic,sdm_powaal,sdm_powaph,sdm_powaox, & + sdm_pown2,sdm_powno3,sdm_powasi,sdm_ssso12, & + sdm_ssssil,sdm_sssc12,sdm_ssster,jburssso12, & + bur_sssc12,bur_ssssil,bur_ssster,bur_ssso12, & + inisdm,inibur,wrtsdm,accbur,accsdm,wrtbur, & + jatmco2,jatmn2,jatmo2,srf_atmo2,srf_atmn2 use mo_biomod, only: c14fac - use mo_bgcmean, only: jdic13,jdic14,jd13c,jd14c,jbigd14c,jpoc13, & - & jdoc13,jcalc13,jphyto13,jgrazer13,jco213fxd, & - & jco213fxu,jco214fxd,jco214fxu,jatmc13, & - & jatmc14,jdic13,jdic14,jd13c,jd14c,jbigd14c, & - & srf_co213fxd,srf_co213fxu,srf_co214fxd, & - & srf_co214fxu,srf_atmc13,srf_atmc14,lyr_dic13, & - & lyr_dic14,lyr_d13c,lyr_d14c,lyr_bigd14c, & - & lyr_poc13,lyr_doc13,lyr_calc13,lyr_phyto13, & - & lyr_grazer13,lvl_dic13,lvl_dic14,lvl_d13c, & - & lvl_d14c,lvl_bigd14c,lvl_poc13,lvl_doc13, & - & lvl_calc13,lvl_phyto13,lvl_grazer13 - ! natDIC - use mo_bgcmean, only: jnatalkali,jnatdic,jnatcalc,jnatco3,jnatph, & - & jnatomegaa,jnatomegac,jlvlnatph, & - & jsrfnatdic,jsrfnatalk,jsrfnatph, & - & jnatpco2,jnatco2fx,lyr_natco3, & - & lyr_natalkali,lyr_natdic,lyr_natph,lyr_natcalc, & - & lyr_natomegaa,lyr_natomegac,lvl_natco3, & - & lvl_natalkali,lvl_natdic,lvl_natph,lvl_natcalc, & - & lvl_natomegaa,lvl_natomegac,srf_natdic, & - & srf_natalkali,srf_natpco2,srf_natco2fx,srf_natph - ! NOT sedbypass - use mo_bgcmean, only: jpowaic,jpowaal,jpowaph,jpowaox,jpown2, & - & jpowno3,jpowasi,jssso12,jssssil,jssster, & - & jsssc12,jbursssc12,jburssssil,jburssster, & - & sdm_powaic,sdm_powaal,sdm_powaph,sdm_powaox, & - & sdm_pown2,sdm_powno3,sdm_powasi,sdm_ssso12, & - & sdm_ssssil,sdm_sssc12,sdm_ssster,jburssso12, & - & bur_sssc12,bur_ssssil,bur_ssster,bur_ssso12, & - & inisdm,inibur,wrtsdm,accbur,accsdm,wrtbur - ! BOXATM - use mo_bgcmean, only: jatmco2,jatmn2,jatmo2,srf_atmo2,srf_atmn2 - use mo_control_bgc, only: use_cisonew,use_AGG,use_CFC,use_natDIC,use_BROMO,use_sedbypass,use_BOXATM implicit none @@ -887,63 +877,53 @@ end subroutine ncwrt_bgc subroutine hamoccvardef(iogrp,timeunits,calendar,cmpflg) - use mod_nctools, only:ncdefvar,ncattr,ncfopn,ncdimc,ncdims, & - & 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, & - & srf_iron,srf_phyto,srf_ph,int_phosy,int_nfix,int_dnit, & - & flx_ndep,flx_oalk,flx_car0100,flx_car0500, & - & flx_car1000,flx_car2000,flx_car4000,flx_car_bot, & - & flx_bsi0100,flx_bsi0500,flx_bsi1000,flx_bsi2000,flx_bsi4000, & - & flx_bsi_bot,flx_cal0100,flx_cal0500,flx_cal1000,flx_cal2000, & - & flx_cal4000,flx_cal_bot,flx_sediffic,flx_sediffal, & - & flx_sediffph,flx_sediffox,flx_sediffn2,flx_sediffno3, & - & flx_sediffsi,srf_n2ofx,srf_atmco2,lyr_dp,lyr_dic, & - & lyr_alkali,lyr_phosph,lyr_oxygen,lyr_ano3,lyr_silica,lyr_doc, & - & lyr_phyto,lyr_grazer,lyr_poc,lyr_calc,lyr_opal,lyr_iron, & - & lyr_phosy,lyr_co3,lyr_ph,lyr_omegaa,lyr_omegac,lyr_n2o, & - & lyr_prefo2,lyr_o2sat,lyr_prefpo4,lyr_prefalk,lyr_prefdic, & - & lyr_dicsat,lvl_dic,lvl_alkali,lvl_phosph,lvl_oxygen,lvl_ano3, & - & lvl_silica,lvl_doc,lvl_phyto,lvl_grazer,lvl_poc,lvl_calc, & - & lvl_opal,lvl_iron,lvl_phosy,lvl_co3,lvl_ph,lvl_omegaa, & - & lvl_omegac,lvl_n2o,lvl_prefo2,lvl_o2sat,lvl_prefpo4, & - & lvl_prefalk,lvl_prefdic,lvl_dicsat - ! AGG - use mo_bgcmean, only: lyr_nos,lyr_wphy,lyr_wnos,lyr_eps, & - & lyr_asize,lvl_nos,lvl_wphy,lvl_wnos,lvl_eps,lvl_asize - - !BOXATM - use mo_bgcmean, only: srf_atmo2,srf_atmn2 - ! BROMO - use mo_bgcmean, only:srf_bromo,srf_bromofx,int_bromopro, & - & int_bromouv,srf_atmbromo,lyr_bromo,lvl_bromo - ! CFC - use mo_bgcmean, only: srf_cfc11,srf_cfc12,srf_sf6,lyr_cfc11, & - & lyr_cfc12,lyr_sf6,lvl_cfc11,lvl_cfc12,lvl_sf6 - ! cisonew - use mo_bgcmean, only: srf_co213fxd,srf_co213fxu,srf_co214fxd, & - & srf_co214fxu,srf_atmc13,srf_atmc14,lyr_dic13,lyr_dic14, & - & lyr_d13c,lyr_d14c,lyr_bigd14c,lyr_poc13,lyr_doc13, & - & lyr_calc13,lyr_phyto13,lyr_grazer13,lvl_dic13,lvl_dic14, & - & lvl_d13c,lvl_d14c,lvl_bigd14c,lvl_poc13,lvl_doc13, & - & lvl_calc13,lvl_phyto13,lvl_grazer13 - ! natDIC - use mo_bgcmean, only: srf_natdic,srf_natalkali,srf_natpco2, & - & srf_natco2fx,srf_natph,lyr_natco3,lyr_natalkali,lyr_natdic, & - & lyr_natcalc,lyr_natph,lyr_natomegaa,lyr_natomegac, & - & lvl_natalkali,lvl_natdic,lvl_natcalc,lvl_natph, & - & lvl_natomegaa,lvl_natomegac,lvl_natco3 - !NOT sedbypass - use mo_bgcmean, only: sdm_powaic,sdm_powaal,sdm_powaph,sdm_powaox, & - & sdm_pown2,sdm_powno3,sdm_powasi,sdm_ssso12,sdm_ssssil, & - & sdm_sssc12,sdm_ssster,bur_ssso12,bur_sssc12,bur_ssssil, & - & bur_ssster - use mo_control_bgc, only: use_cisonew,use_AGG,use_CFC,use_natDIC,use_BROMO,use_sedbypass,use_BOXATM + use mod_nctools, only:ncdefvar,ncattr,ncfopn,ncdimc,ncdims, & + 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, & + srf_iron,srf_phyto,srf_ph,int_phosy,int_nfix,int_dnit, & + flx_ndep,flx_oalk,flx_car0100,flx_car0500, & + flx_car1000,flx_car2000,flx_car4000,flx_car_bot, & + flx_bsi0100,flx_bsi0500,flx_bsi1000,flx_bsi2000,flx_bsi4000, & + flx_bsi_bot,flx_cal0100,flx_cal0500,flx_cal1000,flx_cal2000, & + flx_cal4000,flx_cal_bot,flx_sediffic,flx_sediffal, & + flx_sediffph,flx_sediffox,flx_sediffn2,flx_sediffno3, & + flx_sediffsi,srf_n2ofx,srf_atmco2,lyr_dp,lyr_dic, & + lyr_alkali,lyr_phosph,lyr_oxygen,lyr_ano3,lyr_silica,lyr_doc, & + lyr_phyto,lyr_grazer,lyr_poc,lyr_calc,lyr_opal,lyr_iron, & + lyr_phosy,lyr_co3,lyr_ph,lyr_omegaa,lyr_omegac,lyr_n2o, & + lyr_prefo2,lyr_o2sat,lyr_prefpo4,lyr_prefalk,lyr_prefdic, & + lyr_dicsat,lvl_dic,lvl_alkali,lvl_phosph,lvl_oxygen,lvl_ano3, & + lvl_silica,lvl_doc,lvl_phyto,lvl_grazer,lvl_poc,lvl_calc, & + lvl_opal,lvl_iron,lvl_phosy,lvl_co3,lvl_ph,lvl_omegaa, & + lvl_omegac,lvl_n2o,lvl_prefo2,lvl_o2sat,lvl_prefpo4, & + lvl_prefalk,lvl_prefdic,lvl_dicsat, & + lyr_nos,lyr_wphy,lyr_wnos,lyr_eps, & + lyr_asize,lvl_nos,lvl_wphy,lvl_wnos,lvl_eps,lvl_asize, & + srf_atmo2,srf_atmn2, srf_bromo,srf_bromofx,int_bromopro, & + int_bromouv,srf_atmbromo,lyr_bromo,lvl_bromo, & + srf_cfc11,srf_cfc12,srf_sf6,lyr_cfc11, & + lyr_cfc12,lyr_sf6,lvl_cfc11,lvl_cfc12,lvl_sf6, & + srf_co213fxd,srf_co213fxu,srf_co214fxd, & + srf_co214fxu,srf_atmc13,srf_atmc14,lyr_dic13,lyr_dic14, & + lyr_d13c,lyr_d14c,lyr_bigd14c,lyr_poc13,lyr_doc13, & + lyr_calc13,lyr_phyto13,lyr_grazer13,lvl_dic13,lvl_dic14, & + lvl_d13c,lvl_d14c,lvl_bigd14c,lvl_poc13,lvl_doc13, & + lvl_calc13,lvl_phyto13,lvl_grazer13, & + srf_natdic,srf_natalkali,srf_natpco2, & + srf_natco2fx,srf_natph,lyr_natco3,lyr_natalkali,lyr_natdic, & + lyr_natcalc,lyr_natph,lyr_natomegaa,lyr_natomegac, & + lvl_natalkali,lvl_natdic,lvl_natcalc,lvl_natph, & + lvl_natomegaa,lvl_natomegac,lvl_natco3, & + sdm_powaic,sdm_powaal,sdm_powaph,sdm_powaox, & + sdm_pown2,sdm_powno3,sdm_powasi,sdm_ssso12,sdm_ssssil, & + sdm_sssc12,sdm_ssster,bur_ssso12,bur_sssc12,bur_ssssil,bur_ssster + use mo_control_bgc, only: use_cisonew,use_AGG,use_CFC,use_natDIC,use_BROMO, & + use_sedbypass,use_BOXATM implicit none diff --git a/hamocc/ocprod.F90 b/hamocc/ocprod.F90 index 1ea1ccbc..1e3de4e7 100644 --- a/hamocc/ocprod.F90 +++ b/hamocc/ocprod.F90 @@ -80,42 +80,28 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) ! *REAL* *ptho* - potential temperature [deg C]. ! !****************************************************************************** - use mo_carbch, only: dmspar,ocetra,satoxy,hi - use mo_sedmnt, only: prcaca,produs,prorca,silpro + use mo_carbch, only: dmspar,ocetra,satoxy,hi,fbro1,fbro2,co2star + use mo_sedmnt, only: prcaca,produs,prorca,silpro,pror13,pror14,prca13,prca14 use mo_biomod, only: atten_c,atten_uv,atten_w,bkopal,bkphy,bkzoo,bsiflx0100,bsiflx0500,bsiflx1000,bsiflx2000,bsiflx4000, & - & bsiflx_bot,calflx0100,calflx0500,calflx1000,calflx2000,calflx4000,calflx_bot,carflx0100,carflx0500, & - & carflx1000,carflx2000,carflx4000,carflx_bot,dremn2o,dremopal,drempoc,dremsul,dyphy,ecan,epsher,fesoly, & - & gammap,gammaz,grami,grazra,expoor,exposi,expoca,intdnit,intdms_bac,intdmsprod,intdms_uv,intphosy, & - & phosy3d,pi_alpha,phytomi,rcalc,rcar,rdn2o1,rdn2o2,rdnit0,rdnit1,rdnit2,relaxfe,remido, & - & riron,rnit,strahl,rnoi,ro2ut,ropal,spemor,wcal,wdust,wopal,wpoc,zinges + bsiflx_bot,calflx0100,calflx0500,calflx1000,calflx2000,calflx4000,calflx_bot,carflx0100,carflx0500, & + carflx1000,carflx2000,carflx4000,carflx_bot,dremn2o,dremopal,drempoc,dremsul,dyphy,ecan,epsher,fesoly, & + gammap,gammaz,grami,grazra,expoor,exposi,expoca,intdnit,intdms_bac,intdmsprod,intdms_uv,intphosy, & + phosy3d,pi_alpha,phytomi,rcalc,rcar,rdn2o1,rdn2o2,rdnit0,rdnit1,rdnit2,relaxfe,remido, & + riron,rnit,strahl,rnoi,ro2ut,ropal,spemor,wcal,wdust,wopal,wpoc,zinges use mo_param1_bgc, only: ialkali,ian2o,iano3,icalc,idet,idms,idoc,ifdust,igasnit,iiron,iopal,ioxygen,iphosph,iphy,isco212, & - & isilica,izoo - use mo_control_bgc, only: dtb,io_stdo_bgc,with_dmsph + isilica,izoo,iadust,inos,ibromo, & + icalc13,icalc14,idet13,idet14,idoc13,idoc14,iphy13,iphy14,isco213,isco214,izoo13,izoo14,safediv, & + inatalkali,inatcalc,inatsco212 + use mo_control_bgc, only: dtb,io_stdo_bgc,with_dmsph, & + use_BROMO,use_AGG,use_PBGC_OCNP_TIMESTEP,use_FB_BGC_OCE,use_AGG,use_cisonew,use_natDIC, & + use_WLIN,use_sedbypass use mo_vgrid, only: dp_min,dp_min_sink,k0100,k0500,k1000,k2000,k4000,kwrbioz,ptiestu use mod_xc, only: mnproc - ! AGG - use mo_biomod, only: alar1,alar2,alar3,alow1,alow2,alow3,asize3d,calmax,cellmass,cellsink,dustd1,dustd2,dustd3,dustsink, & - & eps3d,fractdim,fse,fsh,nmldmin,plower,pupper,sinkexp,stick,tmfac,tsfac,vsmall,zdis,wmass,wnumb - use mo_param1_bgc, only: iadust,inos + use mo_biomod, only: alar1,alar2,alar3,alow1,alow2,alow3,asize3d,calmax,cellmass,cellsink,dustd1,dustd2,dustd3,dustsink, & + eps3d,fractdim,fse,fsh,nmldmin,plower,pupper,sinkexp,stick,tmfac,tsfac,vsmall,zdis,wmass,wnumb, & + wmin,wmax,wlin,int_chbr3_prod,int_chbr3_uv,rbro,bifr13,bifr13_perm,bifr14,growth_co2,abs_oce,atten_f use mo_vgrid, only: kmle - ! WLIN - use mo_biomod, only: wmin,wmax,wlin - ! BROMO - use mo_param1_bgc, only: ibromo - use mo_biomod, only: int_chbr3_prod,int_chbr3_uv,rbro - use mo_carbch, only: fbro1,fbro2 use mo_clim_swa, only: swa_clim - ! CISONEW - use mo_biomod, only: bifr13,bifr13_perm,bifr14,growth_co2 - use mo_param1_bgc, only: icalc13,icalc14,idet13,idet14,idoc13,idoc14,iphy13,iphy14,isco213,isco214,izoo13,izoo14,safediv - use mo_sedmnt, only: pror13,pror14,prca13,prca14 - use mo_carbch, only: co2star - ! natDIC - use mo_param1_bgc, only: inatalkali,inatcalc,inatsco212 - ! FB_BGC_OCE - use mo_biomod, only: abs_oce,atten_f - use mo_control_bgc, only: use_BROMO,use_AGG,use_PBGC_OCNP_TIMESTEP,use_FB_BGC_OCE,use_AGG,use_cisonew,use_natDIC,& - & use_WLIN,use_sedbypass implicit none @@ -127,29 +113,26 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) real, intent(in) :: pi_ph(kpie,kpje) ! Local varaibles + integer, parameter :: nsinkmax = 12 + real , parameter :: dms_gamma = 0.87 ! dms_ph scaling factor integer :: i,j,k,l integer :: is,kdonor - integer, parameter :: nsinkmax = 12 - real, parameter :: dms_gamma = 0.87 ! dms_ph scaling factor real :: abs_bgc(kpie,kpje,kpke) real :: tco(nsinkmax),tcn(nsinkmax),q(nsinkmax) real :: dmsp1,dmsp2,dmsp3,dmsp4,dmsp5,dmsp6,dms_ph - real :: atten,avphy,avanut,avanfe,pho,xa,xn,ya,yn,phosy, & - & avgra,grazing,avsil,avdic,graton, & - & gratpoc,grawa,bacfra,phymor,zoomor,excdoc,exud, & - & export, delsil, delcar, sterph, sterzo, remin, & - & docrem, opalrem, remin2o, aou,refra,pocrem,phyrem - + real :: atten,avphy,avanut,avanfe,pho,xa,xn,ya,yn,phosy + real :: avgra,grazing,avsil,avdic,graton + real :: gratpoc,grawa,bacfra,phymor,zoomor,excdoc,exud + real :: export, delsil, delcar, sterph, sterzo, remin + real :: docrem, opalrem, remin2o, aou,refra,pocrem,phyrem real :: zoothresh,phythresh real :: temp,temfa,phofa ! temperature and irradiation factor for photosynthesis real :: absorption,absorption_uv real :: dmsprod,dms_bac,dms_uv real :: dtr,dz real :: wpocd,wcald,wopald,dagg - ! sedbypass real :: florca,flcaca,flsil - ! cisonew real :: phygrowth real :: phosy13,phosy14 @@ -173,10 +156,8 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) real :: rem13,rem14 real :: rco213,rco214,rdoc13,rdoc14,rdet13,rdet14 real :: rphy13,rphy14,rzoo13,rzoo14 - ! sedbypass real :: flor13,flor14,flca13,flca14 - ! AGG real :: aggregate(kpie,kpje,kpke) real :: dustagg(kpie,kpje,kpke) @@ -185,7 +166,6 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) real :: TopM,TopF, snow,fshear,sagg1,sagg2,sagg4 real :: sett_agg,shear_agg,effsti,dfirst,dshagg,dsett real :: wnos,wnosd - ! BROMO real :: bro_beta,bro_uv real :: abs_uv(kpie,kpje,kpke) @@ -299,15 +279,12 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) !$OMP ,phosy,ya,yn,grazing,graton,gratpoc,grawa,bacfra,phymor & !$OMP ,zoomor,excdoc,exud,export,delsil,delcar,dmsprod & !$OMP ,dms_bac,dms_uv,dtr,phofa,temfa,zoothresh,dms_ph,dz & -! use_AGG !$OMP ,avmass,avnos,zmornos & -! use_cisonew !$OMP ,rco213,rco214,rphy13,rphy14,rzoo13,rzoo14,grazing13,grazing14 & !$OMP ,graton13,graton14,gratpoc13,gratpoc14,grawa13,grawa14 & !$OMP ,phosy13,phosy14,bacfra13,bacfra14,phymor13,phymor14,zoomor13 & !$OMP ,zoomor14,excdoc13,excdoc14,exud13,exud14,export13,export14 & !$OMP ,delcar13,delcar14,dtr13,dtr14,bifr13,bifr14 & -! use_BROMO !$OMP ,bro_beta,bro_uv & !$OMP ,i,k) @@ -378,37 +355,37 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) rphy14 = ocetra(i,j,k,iphy14)/(ocetra(i,j,k,iphy)+safediv) rzoo13 = ocetra(i,j,k,izoo13)/(ocetra(i,j,k,izoo)+safediv) rzoo14 = ocetra(i,j,k,izoo14)/(ocetra(i,j,k,izoo)+safediv) - + phosy13 = phosy*bifr13*rco213 phosy14 = phosy*bifr14*rco214 - + grazing13 = grazing*rphy13 grazing14 = grazing*rphy14 - + graton13 = epsher*(1.-zinges)*grazing13 graton14 = epsher*(1.-zinges)*grazing14 - + gratpoc13 = (1.-epsher)*grazing13 gratpoc14 = (1.-epsher)*grazing14 - + grawa13 = epsher*zinges*grazing13 grawa14 = epsher*zinges*grazing14 - + bacfra13 = remido*ocetra(i,j,k,idoc13) bacfra14 = remido*ocetra(i,j,k,idoc14) - + phymor13 = phymor*rphy13 phymor14 = phymor*rphy14 - + zoomor13 = zoomor*rzoo13 zoomor14 = zoomor*rzoo14 - + excdoc13 = excdoc*rzoo13 excdoc14 = excdoc*rzoo14 - + exud13 = exud*rphy13 exud14 = exud*rphy14 - + export13 = zoomor13*(1.-ecan) + phymor13 + gratpoc13 export14 = zoomor14*(1.-ecan) + phymor14 + gratpoc14 end if @@ -453,7 +430,7 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) if (use_cisonew) then dtr13 = bacfra13-phosy13+graton13+ecan*zoomor13 dtr14 = bacfra14-phosy14+graton14+ecan*zoomor14 - + ocetra(i,j,k,idet13) = ocetra(i,j,k,idet13)+export13 ocetra(i,j,k,idet14) = ocetra(i,j,k,idet14)+export14 ocetra(i,j,k,isco213) = ocetra(i,j,k,isco213)-delcar13+rcar*dtr13 @@ -519,7 +496,7 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) ! this flow even takes place if there is neither nos nor mass ! NOTE: zoomor is in kmol/m3!! Thus multiply flow by 1.e+6 !*********************************************************************** - + zmornos = zoomor * (1.-ecan) * zdis * 1.e+6 ocetra(i,j,k,inos) = ocetra(i,j,k,inos)+zmornos end if @@ -560,13 +537,10 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) !$OMP PARALLEL DO PRIVATE(phythresh,zoothresh,sterph,sterzo,remin & !$OMP ,opalrem,aou,refra,dms_bac,pocrem,docrem,phyrem,dz & -! use_AGG !$OMP ,avmass,avnos,zmornos & -! use_cisonew !$OMP ,rphy13,rphy14,rzoo13,rzoo14,rdet13,rdet14,rdoc13,rdoc14 & !$OMP ,sterph13,sterph14,sterzo13,sterzo14,pocrem13,pocrem14 & !$OMP ,docrem13,docrem14,phyrem13,phyrem14 & -! !$OMP ,i,k) loop2: do j = 1,kpje @@ -720,9 +694,7 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) endif !$OMP PARALLEL DO PRIVATE(remin,remin2o,dz & -! use_AGG !$OMP ,avmass,avnos & -! use_cisonew !$OMP ,rem13,rem14 & !$OMP ,i,k) loop3: do j = 1,kpje @@ -730,8 +702,6 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) do k = kwrbioz(i,j)+1,kpke if(omask(i,j) > 0.5) then if(ocetra(i,j,k,ioxygen) < 5.e-7 .and. pddpo(i,j,k) > dp_min) then - - if (use_AGG) then avmass = ocetra(i,j,k,iphy) + ocetra(i,j,k,idet) endif @@ -805,9 +775,7 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) ! does it make sense to check for oxygen and nitrate deficit? !$OMP PARALLEL DO PRIVATE(remin & -! use_AGG !$OMP ,avmass,avnos & -! use_cisonew !$OMP ,rem13,rem14 & !$OMP ,i,k) loop4: do j = 1,kpje @@ -1039,7 +1007,6 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) ! sedimentation=w*dt*C(ks,T+dt) ! !$OMP PARALLEL DO PRIVATE(kdonor,wpoc,wpocd,wcal,wcald,wopal,wopald & -! use_AGG !$OMP ,wnos,wnosd,dagg & !$OMP ,i,k) do j = 1,kpje @@ -1419,7 +1386,6 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) !$OMP PARALLEL DO PRIVATE( & !$OMP dz,florca,flcaca,flsil & - ! use_cisonew !$OMP ,flor13,flor14,flca13,flca14 & !$OMP ,i,k) do j=1,kpje @@ -1429,11 +1395,11 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) ! calculate depth of water column dz = 0.0 do k = 1,kpke - + if( pddpo(i,j,k) > dp_min ) dz = dz+pddpo(i,j,k) - + enddo - + florca = prorca(i,j)/dz flcaca = prcaca(i,j)/dz flsil = silpro(i,j)/dz @@ -1453,7 +1419,7 @@ subroutine ocprod(kpie,kpje,kpke,kbnd,pdlxp,pdlyp,pddpo,omask,ptho,pi_ph) do k = 1,kpke if( pddpo(i,j,k) <= dp_min ) cycle - + ocetra(i,j,k,idet) = ocetra(i,j,k,idet)+florca ocetra(i,j,k,ialkali) = ocetra(i,j,k,ialkali)+2.*flcaca ocetra(i,j,k,isco212) = ocetra(i,j,k,isco212)+flcaca diff --git a/hamocc/powach.F90 b/hamocc/powach.F90 index 01c2c26a..b43a0bc6 100644 --- a/hamocc/powach.F90 +++ b/hamocc/powach.F90 @@ -62,16 +62,12 @@ subroutine powach(kpie,kpje,kpke,kbnd,prho,omask,psao,lspin) use mo_carbch, only: co3,keqb,ocetra,sedfluxo use mo_chemcon, only: calcon use mo_sedmnt, only: porwat,porsol,powtra,produs,prcaca,prorca,rno3,seddw,sedhpl,sedlay,silpro,disso_sil,silsat,disso_poc, & - & sed_denit,disso_caco3 + sed_denit,disso_caco3,pror13,pror14,prca13,prca14 use mo_biomod, only: rnit,ro2ut - use mo_control_bgc, only: dtbgc + use mo_control_bgc, only: dtbgc,use_cisonew use mo_param1_bgc, only: ioxygen,ipowaal,ipowaic,ipowaox,ipowaph,ipowasi,ipown2,ipowno3,isilica,isssc12,issso12,issssil, & - & issster, ks + issster,ks,ipowc13,ipowc14,isssc13,isssc14,issso13,issso14,safediv use mo_vgrid, only: kbo,bolay - ! cisonew - use mo_param1_bgc, only: ipowc13,ipowc14,isssc13,isssc14,issso13,issso14,safediv - use mo_sedmnt, only: pror13,pror14,prca13,prca14 - use mo_control_bgc, only: use_cisonew implicit none @@ -83,22 +79,17 @@ subroutine powach(kpie,kpje,kpke,kbnd,prho,omask,psao,lspin) ! Local variables integer :: i,j,k,l - real :: sedb1(kpie,0:ks),sediso(kpie,0:ks) real :: solrat(kpie,ks),powcar(kpie,ks) real :: aerob(kpie,ks),anaerob(kpie,ks) - ! cisonew - real :: aerob13(kpie,ks),anaerob13(kpie,ks) - real :: aerob14(kpie,ks),anaerob14(kpie,ks) - ! + real :: aerob13(kpie,ks),anaerob13(kpie,ks) ! cisonew + real :: aerob14(kpie,ks),anaerob14(kpie,ks) ! cisonew real :: dissot, undsa, posol real :: umfa, denit, saln, rrho, alk, c, sit, pt real :: K1, K2, Kb, Kw, Ks1, Kf, Ksi, K1p, K2p, K3p real :: ah1, ac, cu, cb, cc, satlev real :: ratc13, ratc14, rato13, rato14, poso13, poso14 - - ! number of iterations for carchm_solve - integer, parameter :: niter = 5 + integer, parameter :: niter = 5 ! number of iterations for carchm_solve !****************************************************************************** ! accelerated sediment diff --git a/hamocc/sedshi.F90 b/hamocc/sedshi.F90 index 3908de7a..e5415364 100644 --- a/hamocc/sedshi.F90 +++ b/hamocc/sedshi.F90 @@ -53,9 +53,8 @@ SUBROUTINE SEDSHI(kpie,kpje,omask) use mo_sedmnt, only: burial,calfa,clafa,oplfa,orgfa,porsol,sedlay,seddw,solfu use mo_biomod, only: rcar - use mo_param1_bgc, only: isssc12,issssil,issso12,issster,ks,nsedtra - ! cisonew - use mo_param1_bgc, only: isssc13,isssc14,issso13,issso14 + use mo_param1_bgc, only: isssc12,issssil,issso12,issster,ks,nsedtra, & + isssc13,isssc14,issso13,issso14 use mo_control_bgc, only: use_cisonew implicit none From 3168fd50ed11bf045c3b874d2c61b36290513c4f Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Mon, 16 Oct 2023 18:40:20 +0200 Subject: [PATCH 49/52] added back in ci.yml that was removed in the merge --- .github/workflows/ci.yml | 157 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 157 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..8938e2c3 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,157 @@ +name: Continuous Integration testing +on: [push, pull_request] + +env: + # This version of Meson should be available as an EasyBuild on Fram and Betzy + MESON_VERSION: '0.55.1' +jobs: + build: + name: Build BLOM on Github provided OS + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest] + mpi: [true, false] + openmp: ['enabled', 'disabled'] + exclude: + # Do not build on macOS with MPI as that is having some dependency issues + - os: macos-latest + mpi: true + steps: + - name: Install dependencies - Ubuntu + run: | + sudo apt update + sudo apt install -y libnetcdff-dev mpi-default-dev ninja-build + if: runner.os == 'Linux' + + - name: Install dependencies - macOS + run: brew install netcdf-fortran open-mpi ninja + env: + HOMEBREW_NO_INSTALL_CLEANUP: 1 + if: runner.os == 'macOS' + + - name: Setup Python for newer version of Meson + uses: actions/setup-python@v2 + + - name: Install Meson + run: python -m pip install meson==${{ env.MESON_VERSION }} + + - name: Checkout code + uses: actions/checkout@v2 + with: + submodules: 'recursive' + + - name: Build + env: + CC: gcc-12 + FC: gfortran-12 + run: | + meson setup builddir -Dmpi=${{ matrix.mpi }} -Dopenmp=${{ matrix.openmp }} --buildtype=debugoptimized + meson compile -C builddir + + - name: Test code + if: ${{ matrix.mpi == false }} + run: | + ulimit -s 65532 + meson test -C builddir + + - name: Upload test log + if: ${{ matrix.mpi == false }} + uses: actions/upload-artifact@v2 + with: + name: testlog-${{ runner.os }}-gcc + path: builddir/meson-logs/testlog.txt + + intel: + name: Build BLOM using Intel compilers + runs-on: ubuntu-20.04 + strategy: + fail-fast: false + matrix: + mpi: [true, false] + openmp: ['enabled', 'disabled'] + # Tell Meson to use Intel compilers + env: + CC: icc + FC: ifort + NFDIR: '/opt/netcdf' + steps: + - name: Install dependencies + run: | + sudo apt update + sudo apt install -y ninja-build libnetcdf-dev + - name: Cache Intel setup + id: cache-intel + uses: actions/cache@v2 + with: + path: /opt/intel/ + key: intel-${{ runner.os }}-compiler + + - name: Setup Intel compiler + if: steps.cache-intel.outputs.cache-hit != 'true' + run: | + wget -q https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB + sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB + sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main" + sudo apt update + sudo apt install -y\ + intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic\ + intel-oneapi-compiler-fortran intel-oneapi-mpi-devel + + - name: Cache netCDF install + id: cache-netcdf + uses: actions/cache@v2 + with: + path: ${{ env.NFDIR }} + key: netcdf-4.5.2-${{ runner.os }}-intel + + - name: Checkout netCDF for compiling with Intel + if: steps.cache-netcdf.outputs.cache-hit != 'true' + uses: actions/checkout@v2 + with: + repository: 'Unidata/netcdf-fortran' + ref: 'v4.5.2' + + - name: Compile and install custom netCDF + if: steps.cache-netcdf.outputs.cache-hit != 'true' + run: | + source /opt/intel/oneapi/setvars.sh + ./configure --prefix="$NFDIR" + make + sudo make install + + - name: Setup netCDF environment + run: | + echo "${NFDIR}/bin" >> $GITHUB_PATH + echo "PKG_CONFIG_PATH=${NFDIR}/lib/pkgconfig" >> $GITHUB_ENV + + - name: Setup Python for newer version of Meson + uses: actions/setup-python@v2 + + - name: Install Meson + run: python -m pip install meson==${{ env.MESON_VERSION }} + + - name: Checkout code + uses: actions/checkout@v2 + with: + submodules: 'recursive' + + - name: Build with Intel compilers + run: | + source /opt/intel/oneapi/setvars.sh + meson setup builddir -Dmpi=${{ matrix.mpi }} -Dopenmp=${{ matrix.openmp }} --buildtype=debugoptimized + meson compile -C builddir + + - name: Test code + if: ${{ matrix.mpi == false }} + run: | + source /opt/intel/oneapi/setvars.sh + meson test -C builddir + + - name: Upload test log + uses: actions/upload-artifact@v2 + if: ${{ matrix.mpi == false }} + with: + name: testlog-${{ runner.os }}-intel + path: builddir/meson-logs/testlog.txt From 4867c47f212b58ae41017752fc29d85184ecbc2c Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Mon, 16 Oct 2023 22:06:06 +0200 Subject: [PATCH 50/52] more cleanup of use statements --- hamocc/mo_param_bgc.F90 | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/hamocc/mo_param_bgc.F90 b/hamocc/mo_param_bgc.F90 index 7623c717..ca6a95d5 100644 --- a/hamocc/mo_param_bgc.F90 +++ b/hamocc/mo_param_bgc.F90 @@ -43,29 +43,19 @@ module mo_param_bgc ! !****************************************************************************** - use mo_carbch, only: atm,atm_co2,atm_n2,atm_o2,dmspar + use mo_carbch, only: atm,atm_co2,atm_n2,atm_o2,dmspar, & + atm_bromo,fbro1,fbro2,atm_c13, atm_c14,c14_t_half,c14dec,atm_co2_nat use mo_biomod, only: atten_c,atten_f,atten_uv,atten_w,bkopal,bkphy,bkopal,bkzoo,bluefix,ctochl,dremn2o,dremopal, & - & drempoc,dremsul,dyphy,ecan,epsher,fesoly,fetune,gammap,gammaz,grami,grazra,perc_diron,phytomi, & - & pi_alpha,rcalc,rcar, rdn2o1,rdn2o2,rdnit0,rdnit1,rdnit2,relaxfe,remido,riron,rnit,rnoi,ro2ut, & - & ropal,spemor,tf0,tf1,tf2,tff,wcal,wdust,wopal,wpoc,zinges + drempoc,dremsul,dyphy,ecan,epsher,fesoly,fetune,gammap,gammaz,grami,grazra,perc_diron,phytomi, & + pi_alpha,rcalc,rcar, rdn2o1,rdn2o2,rdnit0,rdnit1,rdnit2,relaxfe,remido,riron,rnit,rnoi,ro2ut, & + ropal,spemor,tf0,tf1,tf2,tff,wcal,wdust,wopal,wpoc,zinges, & + alar1,alar2,alar3,alow1,alow2,alow3,calmax,cellmass,cellsink,dustd1,dustd2,dustd3,dustsink, & + fractdim,fse,fsh,nmldmin,plower,pupper,safe,sinkexp,stick,tmfac,tsfac,vsmall,zdis,wmin,wmax,wlin,rbro, & + bifr13,bifr14,c14fac,prei13,prei14,re1312,re14to use mo_sedmnt, only: claydens,o2ut,rno3 - use mo_control_bgc, only: io_stdo_bgc,bgc_namelist - use mo_control_bgc, only: use_AGG, use_natDIC, use_BROMO, use_cisonew, use_WLIN + use mo_control_bgc, only: io_stdo_bgc,bgc_namelist,use_AGG,use_natDIC,use_BROMO,use_cisonew,use_WLIN use mo_param1_bgc, only: iatmco2,iatmnco2,iatmo2,iatmn2,iatmc13,iatmc14,iatmbromo use mod_xc, only: mnproc - ! agg - use mo_biomod, only: alar1,alar2,alar3,alow1,alow2,alow3,calmax,cellmass,cellsink,dustd1,dustd2,dustd3,dustsink, & - & fractdim,fse,fsh,nmldmin,plower,pupper,safe,sinkexp,stick,tmfac,tsfac,vsmall,zdis - ! wlin - use mo_biomod, only: wmin,wmax,wlin - ! bromo - use mo_biomod, only: rbro - use mo_carbch, only: atm_bromo,fbro1,fbro2 - ! cisonew - use mo_biomod, only: bifr13,bifr14,c14fac,prei13,prei14,re1312,re14to - use mo_carbch, only: atm_c13, atm_c14,c14_t_half,c14dec - ! natDIC - use mo_carbch, only: atm_co2_nat implicit none @@ -108,7 +98,6 @@ subroutine ini_parambgc(kpie,kpje) call write_parambgc() ! write out used parameters and calculate back rates from /dtb to /d.. end subroutine - !--------------------------------------------------------------------------------------------------------------------------------- subroutine ini_param_atm() ! @@ -374,7 +363,6 @@ subroutine read_bgcnamelist() ! Note that afterward, i) rates need to be adjusted for timestep ! and some depending parameters need re-calculation ! - integer :: iounit namelist /bgcparams/ bkphy,dyphy,bluefix,bkzoo,grazra,spemor,gammap,gammaz,ecan,zinges,epsher,bkopal,rcalc,ropal, & From f22d8dc116ff7da5ee5bc5ed9673c18f56e8d1f9 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Mon, 16 Oct 2023 22:15:15 +0200 Subject: [PATCH 51/52] fixed issue in PR review --- hamocc/mo_param_bgc.F90 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hamocc/mo_param_bgc.F90 b/hamocc/mo_param_bgc.F90 index ca6a95d5..ee201c39 100644 --- a/hamocc/mo_param_bgc.F90 +++ b/hamocc/mo_param_bgc.F90 @@ -63,8 +63,7 @@ module mo_param_bgc public :: ini_parambgc - ! Module-wide parameters (used in more than one subroutine) - REAL :: dustd1, dustd2, dustsink !AGG + ! Module-wide variables used in more than one subroutine REAL :: beta13, alpha14, d14cat, d13c_atm ! cisonew contains From 4c816e66fd7c77a7b1827089b59fba6d21af69e6 Mon Sep 17 00:00:00 2001 From: Tomas Torsvik Date: Tue, 17 Oct 2023 08:31:12 +0200 Subject: [PATCH 52/52] Add 'ecosys' option to CI intel compiler build --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8938e2c3..fe5e00b7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -71,6 +71,7 @@ jobs: matrix: mpi: [true, false] openmp: ['enabled', 'disabled'] + ecosys: [true, false] # Tell Meson to use Intel compilers env: CC: icc