diff --git a/config_src/drivers/nuopc_cap/mom_cap.F90 b/config_src/drivers/nuopc_cap/mom_cap.F90 index 354c6be8d2..e0e618c76e 100644 --- a/config_src/drivers/nuopc_cap/mom_cap.F90 +++ b/config_src/drivers/nuopc_cap/mom_cap.F90 @@ -443,6 +443,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) logical :: existflag logical :: use_waves ! If true, the wave modules are active. character(len=40) :: wave_method ! Wave coupling method. + logical :: use_MARBL ! If true, MARBL tracers are being used. integer :: userRc integer :: localPet integer :: localPeCount @@ -720,6 +721,8 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) call get_domain_extent(ocean_public%domain, isc, iec, jsc, jec) + call query_ocean_state(ocean_state, use_waves=use_waves, wave_method=wave_method, use_MARBL=use_MARBL) + allocate(Ice_ocean_boundary% u_flux (isc:iec,jsc:jec), & Ice_ocean_boundary% v_flux (isc:iec,jsc:jec), & Ice_ocean_boundary% t_flux (isc:iec,jsc:jec), & @@ -763,22 +766,20 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) Ice_ocean_boundary% hrofi_glc (isc:iec,jsc:jec), & source=0.0) - ! Needed for MARBL - ! These are allocated separately to make it easier to pull out - ! of the cesm_coupled block if other models want to add BGC - allocate(Ice_ocean_boundary% nhx_dep (isc:iec,jsc:jec), & - Ice_ocean_boundary% noy_dep (isc:iec,jsc:jec), & - Ice_ocean_boundary% atm_fine_dust_flux (isc:iec,jsc:jec), & - Ice_ocean_boundary% atm_coarse_dust_flux (isc:iec,jsc:jec),& - Ice_ocean_boundary% seaice_dust_flux (isc:iec,jsc:jec), & - Ice_ocean_boundary% atm_bc_flux (isc:iec,jsc:jec), & - Ice_ocean_boundary% seaice_bc_flux (isc:iec,jsc:jec), & - Ice_ocean_boundary% atm_co2_prog (isc:iec,jsc:jec), & - Ice_ocean_boundary% atm_co2_diag (isc:iec,jsc:jec), & - source=0.0) + if (use_MARBL) then + allocate(Ice_ocean_boundary% nhx_dep (isc:iec,jsc:jec), & + Ice_ocean_boundary% noy_dep (isc:iec,jsc:jec), & + Ice_ocean_boundary% atm_fine_dust_flux (isc:iec,jsc:jec), & + Ice_ocean_boundary% atm_coarse_dust_flux (isc:iec,jsc:jec),& + Ice_ocean_boundary% seaice_dust_flux (isc:iec,jsc:jec), & + Ice_ocean_boundary% atm_bc_flux (isc:iec,jsc:jec), & + Ice_ocean_boundary% seaice_bc_flux (isc:iec,jsc:jec), & + Ice_ocean_boundary% atm_co2_prog (isc:iec,jsc:jec), & + Ice_ocean_boundary% atm_co2_diag (isc:iec,jsc:jec), & + source=0.0) + endif endif - call query_ocean_state(ocean_state, use_waves=use_waves, wave_method=wave_method) if (use_waves) then if (wave_method == "EFACTOR") then allocate( Ice_ocean_boundary%lamult(isc:iec,jsc:jec), source=0.0) @@ -850,7 +851,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) ungridded_lbound=1, ungridded_ubound=Ice_ocean_boundary%ice_ncat) endif - if (cesm_coupled) then + if (cesm_coupled .and. use_MARBL) then ! Fields needed for MARBL call fld_list_add(fldsToOcn_num, fldsToOcn, "Faxa_ndep" , "will provide", & !-> nitrogen deposition ungridded_lbound=1, ungridded_ubound=2) @@ -890,7 +891,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) call fld_list_add(fldsFrOcn_num, fldsFrOcn, "So_dhdy" , "will provide") call fld_list_add(fldsFrOcn_num, fldsFrOcn, "Fioo_q" , "will provide") call fld_list_add(fldsFrOcn_num, fldsFrOcn, "So_bldepth" , "will provide") - if (cesm_coupled) then + if (cesm_coupled .and. use_MARBL) then call fld_list_add(fldsFrOcn_num, fldsFrOcn, "Faoo_fco2_ocn", "will provide") endif diff --git a/config_src/drivers/nuopc_cap/mom_ocean_model_nuopc.F90 b/config_src/drivers/nuopc_cap/mom_ocean_model_nuopc.F90 index 329f436e48..a83576028a 100644 --- a/config_src/drivers/nuopc_cap/mom_ocean_model_nuopc.F90 +++ b/config_src/drivers/nuopc_cap/mom_ocean_model_nuopc.F90 @@ -148,6 +148,7 @@ module MOM_ocean_model_nuopc logical :: use_ice_shelf !< If true, the ice shelf model is enabled. logical,public :: use_waves !< If true use wave coupling. character(len=40) :: wave_method !< Wave coupling method. + logical,public :: use_MARBL !< If true, use MARBL tracers. logical :: icebergs_alter_ocean !< If true, the icebergs can change ocean the !! ocean dynamics and forcing fluxes. @@ -256,7 +257,6 @@ subroutine ocean_model_init(Ocean_sfc, OS, Time_init, Time_in, gas_fields_ocn, i !! min(HFrz, OBLD), where OBLD is the boundary layer depth. !! If HFrz <= 0 (default), melt potential will not be computed. logical :: use_melt_pot !< If true, allocate melt_potential array - logical :: use_MARBL !< If true, allocate surface co2 array ! This include declares and sets the variable "version". @@ -380,14 +380,14 @@ subroutine ocean_model_init(Ocean_sfc, OS, Time_init, Time_in, gas_fields_ocn, i call get_param(param_file, mdl, "USE_WAVES", OS%Use_Waves, & "If true, enables surface wave modules.", default=.false.) - call get_param(param_file, mdl, "USE_MARBL_TRACERS", use_MARBL, & + call get_param(param_file, mdl, "USE_MARBL_TRACERS", OS%use_MARBL, & default=.false., do_not_log=.true.) ! Consider using a run-time flag to determine whether to do the diagnostic ! vertical integrals, since the related 3-d sums are not negligible in cost. call allocate_surface_state(OS%sfc_state, OS%grid, use_temperature, & do_integrals=.true., gas_fields_ocn=gas_fields_ocn, & - use_meltpot=use_melt_pot, use_marbl_tracers=use_MARBL) + use_meltpot=use_melt_pot, use_marbl_tracers=OS%use_MARBL) call surface_forcing_init(Time_in, OS%grid, OS%US, param_file, OS%diag, & OS%forcing_CSp, OS%restore_salinity, OS%restore_temp, OS%use_waves) @@ -1057,7 +1057,7 @@ end subroutine ocean_model_flux_init !> This interface allows certain properties that are stored in the ocean_state_type to be !! obtained. -subroutine query_ocean_state(OS, use_waves, NumWaveBands, Wavenumbers, unscale, wave_method) +subroutine query_ocean_state(OS, use_waves, NumWaveBands, Wavenumbers, unscale, wave_method, use_MARBL) type(ocean_state_type), intent(in) :: OS !< The structure with the complete ocean state logical, optional, intent(out) :: use_waves !< Indicates whether surface waves are in use integer, optional, intent(out) :: NumWaveBands !< If present, this gives the number of @@ -1067,6 +1067,7 @@ subroutine query_ocean_state(OS, use_waves, NumWaveBands, Wavenumbers, unscale, logical, optional, intent(in) :: unscale !< If present and true, undo any dimensional !! rescaling and return dimensional values in MKS units character(len=40), optional, intent(out) :: wave_method !< Wave coupling method. + logical, optional, intent(out) :: use_MARBL !< Indicates whether MARBL is in use. logical :: undo_scaling undo_scaling = .false. ; if (present(unscale)) undo_scaling = unscale @@ -1079,6 +1080,7 @@ subroutine query_ocean_state(OS, use_waves, NumWaveBands, Wavenumbers, unscale, call query_wave_properties(OS%Waves, WaveNumbers=WaveNumbers) endif if (present(wave_method)) wave_method = OS%wave_method + if (present(use_MARBL)) use_MARBL = OS%use_MARBL end subroutine query_ocean_state diff --git a/config_src/drivers/nuopc_cap/mom_surface_forcing_nuopc.F90 b/config_src/drivers/nuopc_cap/mom_surface_forcing_nuopc.F90 index ccf23201b6..f103487dbc 100644 --- a/config_src/drivers/nuopc_cap/mom_surface_forcing_nuopc.F90 +++ b/config_src/drivers/nuopc_cap/mom_surface_forcing_nuopc.F90 @@ -615,11 +615,12 @@ subroutine convert_IOB_to_fluxes(IOB, fluxes, index_bounds, Time, valid_time, G, ! Copy MARBL-specific IOB fields into fluxes; also set some MARBL-specific forcings to other values ! (constants, values from netCDF, etc) - call convert_driver_fields_to_forcings(IOB%atm_fine_dust_flux, IOB%atm_coarse_dust_flux, & - IOB%seaice_dust_flux, IOB%atm_bc_flux, IOB%seaice_bc_flux, & - IOB%nhx_dep, IOB%noy_dep, IOB%atm_co2_prog, IOB%atm_co2_diag, & - IOB%afracr, IOB%swnet_afracr, IOB%ifrac_n, IOB%swpen_ifrac_n, & - Time, G, US, i0, j0, fluxes, CS%marbl_forcing_CSp) + if (CS%use_marbl_tracers) & + call convert_driver_fields_to_forcings(IOB%atm_fine_dust_flux, IOB%atm_coarse_dust_flux, & + IOB%seaice_dust_flux, IOB%atm_bc_flux, IOB%seaice_bc_flux, & + IOB%nhx_dep, IOB%noy_dep, IOB%atm_co2_prog, IOB%atm_co2_diag, & + IOB%afracr, IOB%swnet_afracr, IOB%ifrac_n, IOB%swpen_ifrac_n, & + Time, G, US, i0, j0, fluxes, CS%marbl_forcing_CSp) ! wave to ocean coupling if ( associated(IOB%lamult)) then