From cc7f725dbcb1296a55d23c41a90c1d9481742138 Mon Sep 17 00:00:00 2001 From: alperaltuntas Date: Thu, 31 Jan 2019 07:55:44 -0700 Subject: [PATCH 1/6] apply oda tracer increments only if da is active --- src/core/MOM.F90 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/core/MOM.F90 b/src/core/MOM.F90 index 1a590bb5b8..cf9e4b677c 100644 --- a/src/core/MOM.F90 +++ b/src/core/MOM.F90 @@ -1153,7 +1153,9 @@ subroutine step_MOM_thermo(CS, G, GV, u, v, h, tv, fluxes, dtdia, & call enable_averaging(dtdia, Time_end_thermo, CS%diag) - call apply_oda_tracer_increments(dtdia,G,tv,h,CS%odaCS) + if (associated(CS%odaCS)) then + call apply_oda_tracer_increments(dtdia,G,tv,h,CS%odaCS) + endif if (update_BBL) then ! Calculate the BBL properties and store them inside visc (u,h). From 1241da85129fd42a5e2e34609b48ade2513b97df Mon Sep 17 00:00:00 2001 From: Gustavo Marques Date: Wed, 20 Feb 2019 15:55:38 -0700 Subject: [PATCH 2/6] Add new way of calculating latent heat --- config_src/mct_driver/MOM_surface_forcing.F90 | 41 +++++++++++++------ 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/config_src/mct_driver/MOM_surface_forcing.F90 b/config_src/mct_driver/MOM_surface_forcing.F90 index 84713622ca..153424980c 100644 --- a/config_src/mct_driver/MOM_surface_forcing.F90 +++ b/config_src/mct_driver/MOM_surface_forcing.F90 @@ -203,8 +203,8 @@ module MOM_surface_forcing !! See \ref section_ocn_import for a summary of the surface fluxes that are !! passed from MCT to MOM6, including fluxes that need to be included in !! the future. -subroutine convert_IOB_to_fluxes(IOB, fluxes, Time, G, CS, & - sfc_state, restore_salt, restore_temp) +subroutine convert_IOB_to_fluxes(IOB, fluxes, Time, G, CS, sfc_state, & + restore_salt, restore_temp) type(ice_ocean_boundary_type), & target, intent(in) :: IOB !< An ice-ocean boundary type with fluxes to drive @@ -213,7 +213,6 @@ subroutine convert_IOB_to_fluxes(IOB, fluxes, Time, G, CS, & type(forcing), intent(inout) :: fluxes !< A structure containing pointers to !! all possible mass, heat or salt flux forcing fields. !! Unused fields have NULL ptrs. - type(time_type), intent(in) :: Time !< The time of the fluxes, used for interpolating the !! salinity to the right time, when it is being restored. type(ocean_grid_type), intent(inout) :: G !< The ocean's grid structure @@ -241,7 +240,6 @@ subroutine convert_IOB_to_fluxes(IOB, fluxes, Time, G, CS, & integer :: i, j, k, is, ie, js, je, Isq, Ieq, Jsq, Jeq, i0, j0 integer :: isd, ied, jsd, jed, IsdB, IedB, JsdB, JedB, isr, ier, jsr, jer - integer :: isc_bnd, iec_bnd, jsc_bnd, jec_bnd logical :: restore_salinity ! local copy of the argument restore_salt, if it ! is present, or false (no restoring) otherwise. @@ -392,9 +390,8 @@ subroutine convert_IOB_to_fluxes(IOB, fluxes, Time, G, CS, & enddo; enddo endif - !i0 = is - isc_bnd ; j0 = js - jsc_bnd ??? - i0 = 0; j0 = 0 ! TODO: is this right? - + ! obtain fluxes from IOB + i0 = 0; j0 = 0 do j=js,je ; do i=is,ie ! liquid precipitation (rain) if (associated(fluxes%lprec)) & @@ -453,8 +450,27 @@ subroutine convert_IOB_to_fluxes(IOB, fluxes, Time, G, CS, & fluxes%meltw(i,j) = G%mask2dT(i,j) * IOB%meltw(i-i0,j-j0) ! latent heat flux (W/m^2) - if (associated(fluxes%latent)) & - fluxes%latent(i,j) = G%mask2dT(i,j) * IOB%latent_flux(i-i0,j-j0) + ! old method, latent = IOB%q_flux(i-i0,j-j0)*CS%latent_heat_vapor + !if (associated(fluxes%latent)) & + ! fluxes%latent(i,j) = G%mask2dT(i,j) * IOB%latent_flux(i-i0,j-j0) + ! new method + fluxes%latent(i,j) = 0.0 + ! contribution from frozen ppt + if (associated(fluxes%fprec)) then + fluxes%latent(i,j) = fluxes%latent(i,j) + IOB%fprec(i-i0,j-j0)*CS%latent_heat_fusion + fluxes%latent_fprec_diag(i,j) = G%mask2dT(i,j) * IOB%fprec(i-i0,j-j0)*CS%latent_heat_fusion + endif + ! contribution from frozen runoff + if (associated(fluxes%frunoff)) then + fluxes%latent(i,j) = fluxes%latent(i,j) + IOB%rofi_flux(i-i0,j-j0)*CS%latent_heat_fusion + fluxes%latent_frunoff_diag(i,j) = G%mask2dT(i,j) * IOB%rofi_flux(i-i0,j-j0)*CS%latent_heat_fusion + endif + ! contribution from evaporation + if (associated(IOB%q_flux)) then + fluxes%latent(i,j) = fluxes%latent(i,j) + IOB%q_flux(i-i0,j-j0)*CS%latent_heat_vapor + fluxes%latent_evap_diag(i,j) = G%mask2dT(i,j) * IOB%q_flux(i-i0,j-j0)*CS%latent_heat_vapor + endif + fluxes%latent(i,j) = G%mask2dT(i,j) * fluxes%latent(i,j) if (associated(IOB%sw_flux_vis_dir)) & fluxes%sw_vis_dir(i,j) = G%mask2dT(i,j) * IOB%sw_flux_vis_dir(i-i0,j-j0) @@ -574,10 +590,11 @@ subroutine convert_IOB_to_forces(IOB, forces, index_bounds, Time, G, CS) IsdB = G%IsdB ; IedB = G%IedB ; JsdB = G%JsdB ; JedB = G%JedB isr = is-isd+1 ; ier = ie-isd+1 ; jsr = js-jsd+1 ; jer = je-jsd+1 - !isc_bnd = index_bounds(1) ; iec_bnd = index_bounds(2) - !jsc_bnd = index_bounds(3) ; jec_bnd = index_bounds(4) + isc_bnd = index_bounds(1) ; iec_bnd = index_bounds(2) + jsc_bnd = index_bounds(3) ; jec_bnd = index_bounds(4) + !if (is_root_pe()) write(*,*)'isc_bnd, jsc_bnd, iec_bnd, jec_bnd',isc_bnd, jsc_bnd, iec_bnd, jec_bnd !i0 = is - isc_bnd ; j0 = js - jsc_bnd - i0 = 0; j0 = 0 ! TODO: is this right? + i0 = 0; j0 = 0 ! TODO: is this right? Irho0 = 1.0/CS%Rho0 From 72945e459c5f90107181adb85f81649aaa04c18c Mon Sep 17 00:00:00 2001 From: Gustavo Marques Date: Wed, 20 Feb 2019 15:58:45 -0700 Subject: [PATCH 3/6] Comment lines with index_bounds --- config_src/mct_driver/MOM_surface_forcing.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config_src/mct_driver/MOM_surface_forcing.F90 b/config_src/mct_driver/MOM_surface_forcing.F90 index 153424980c..358b823a5f 100644 --- a/config_src/mct_driver/MOM_surface_forcing.F90 +++ b/config_src/mct_driver/MOM_surface_forcing.F90 @@ -590,8 +590,8 @@ subroutine convert_IOB_to_forces(IOB, forces, index_bounds, Time, G, CS) IsdB = G%IsdB ; IedB = G%IedB ; JsdB = G%JsdB ; JedB = G%JedB isr = is-isd+1 ; ier = ie-isd+1 ; jsr = js-jsd+1 ; jer = je-jsd+1 - isc_bnd = index_bounds(1) ; iec_bnd = index_bounds(2) - jsc_bnd = index_bounds(3) ; jec_bnd = index_bounds(4) + !isc_bnd = index_bounds(1) ; iec_bnd = index_bounds(2) + !jsc_bnd = index_bounds(3) ; jec_bnd = index_bounds(4) !if (is_root_pe()) write(*,*)'isc_bnd, jsc_bnd, iec_bnd, jec_bnd',isc_bnd, jsc_bnd, iec_bnd, jec_bnd !i0 = is - isc_bnd ; j0 = js - jsc_bnd i0 = 0; j0 = 0 ! TODO: is this right? From a5fe8c00614d69661665cb60237d04e4eccd7176 Mon Sep 17 00:00:00 2001 From: Gustavo Marques Date: Thu, 21 Feb 2019 10:16:36 -0700 Subject: [PATCH 4/6] Fix rotations in import and export subroutines --- config_src/mct_driver/ocn_cap_methods.F90 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/config_src/mct_driver/ocn_cap_methods.F90 b/config_src/mct_driver/ocn_cap_methods.F90 index ee965366be..701158e677 100644 --- a/config_src/mct_driver/ocn_cap_methods.F90 +++ b/config_src/mct_driver/ocn_cap_methods.F90 @@ -50,11 +50,11 @@ subroutine ocn_import(x2o, ind, grid, ice_ocean_boundary, ocean_public, logunit, ! rotate taux and tauy from true zonal/meridional to local coordinates ! taux ice_ocean_boundary%u_flux(i,j) = GRID%cos_rot(i,j) * x2o(ind%x2o_Foxx_taux,k) & - + GRID%sin_rot(i,j) * x2o(ind%x2o_Foxx_tauy,k) + - GRID%sin_rot(i,j) * x2o(ind%x2o_Foxx_tauy,k) ! tauy ice_ocean_boundary%v_flux(i,j) = GRID%cos_rot(i,j) * x2o(ind%x2o_Foxx_tauy,k) & - - GRID%sin_rot(i,j) * x2o(ind%x2o_Foxx_taux,k) + + GRID%sin_rot(i,j) * x2o(ind%x2o_Foxx_taux,k) ! liquid precipitation (rain) ice_ocean_boundary%lprec(i,j) = x2o(ind%x2o_Faxa_rain,k) @@ -186,9 +186,9 @@ subroutine ocn_export(ind, ocn_public, grid, o2x, dt_int, ncouple_per_day) o2x(ind%o2x_So_t, n) = ocn_public%t_surf(ig,jg) * grid%mask2dT(i,j) o2x(ind%o2x_So_s, n) = ocn_public%s_surf(ig,jg) * grid%mask2dT(i,j) ! rotate ocn current from local tripolar grid to true zonal/meridional (inverse transformation) - o2x(ind%o2x_So_u, n) = (grid%cos_rot(i,j) * ocn_public%u_surf(ig,jg) - & + o2x(ind%o2x_So_u, n) = (grid%cos_rot(i,j) * ocn_public%u_surf(ig,jg) + & grid%sin_rot(i,j) * ocn_public%v_surf(ig,jg)) * grid%mask2dT(i,j) - o2x(ind%o2x_So_v, n) = (grid%cos_rot(i,j) * ocn_public%v_surf(ig,jg) + & + o2x(ind%o2x_So_v, n) = (grid%cos_rot(i,j) * ocn_public%v_surf(ig,jg) - & grid%sin_rot(i,j) * ocn_public%u_surf(ig,jg)) * grid%mask2dT(i,j) ! boundary layer depth (m) @@ -268,8 +268,8 @@ subroutine ocn_export(ind, ocn_public, grid, o2x, dt_int, ncouple_per_day) n = 0 do j=grid%jsc, grid%jec ; do i=grid%isc,grid%iec n = n+1 - o2x(ind%o2x_So_dhdx, n) = grid%cos_rot(i,j) * sshx(i,j) - grid%sin_rot(i,j) * sshy(i,j) - o2x(ind%o2x_So_dhdy, n) = grid%cos_rot(i,j) * sshy(i,j) + grid%sin_rot(i,j) * sshx(i,j) + o2x(ind%o2x_So_dhdx, n) = grid%cos_rot(i,j) * sshx(i,j) + grid%sin_rot(i,j) * sshy(i,j) + o2x(ind%o2x_So_dhdy, n) = grid%cos_rot(i,j) * sshy(i,j) - grid%sin_rot(i,j) * sshx(i,j) enddo; enddo end subroutine ocn_export From adfd67e4a0baf587fb4e178574cb3ae38c489649 Mon Sep 17 00:00:00 2001 From: Gustavo Marques Date: Thu, 21 Feb 2019 10:21:53 -0700 Subject: [PATCH 5/6] Fix line length --- config_src/mct_driver/ocn_cap_methods.F90 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/config_src/mct_driver/ocn_cap_methods.F90 b/config_src/mct_driver/ocn_cap_methods.F90 index a5c98a83dc..b0381f9a36 100644 --- a/config_src/mct_driver/ocn_cap_methods.F90 +++ b/config_src/mct_driver/ocn_cap_methods.F90 @@ -123,8 +123,10 @@ subroutine ocn_import(x2o, ind, grid, ice_ocean_boundary, ocean_public, logunit, write(logunit,F01)'import: day, secs, j, i, lwrad = ',day,secs,j,i,ice_ocean_boundary%lw_flux(i,j) write(logunit,F01)'import: day, secs, j, i, q_flux = ',day,secs,j,i,ice_ocean_boundary%q_flux(i,j) write(logunit,F01)'import: day, secs, j, i, t_flux = ',day,secs,j,i,ice_ocean_boundary%t_flux(i,j) - write(logunit,F01)'import: day, secs, j, i, seaice_melt_heat = ',day,secs,j,i,ice_ocean_boundary%seaice_melt_heat(i,j) - write(logunit,F01)'import: day, secs, j, i, seaice_melt = ',day,secs,j,i,ice_ocean_boundary%seaice_melt(i,j) + write(logunit,F01)'import: day, secs, j, i, seaice_melt_heat = ',day,secs,j,i, & + ice_ocean_boundary%seaice_melt_heat(i,j) + write(logunit,F01)'import: day, secs, j, i, seaice_melt = ',day,secs,j,i, & + ice_ocean_boundary%seaice_melt(i,j) write(logunit,F01)'import: day, secs, j, i, latent_flux = ',& day,secs,j,i,ice_ocean_boundary%latent_flux(i,j) write(logunit,F01)'import: day, secs, j, i, runoff = ',& From e502a97b2b724ba67b3178ff3ebd939d3924234b Mon Sep 17 00:00:00 2001 From: Gustavo Marques Date: Thu, 21 Feb 2019 10:45:38 -0700 Subject: [PATCH 6/6] Fix another line length --- src/core/MOM_forcing_type.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/MOM_forcing_type.F90 b/src/core/MOM_forcing_type.F90 index 701f25aac0..c0a3c9cc70 100644 --- a/src/core/MOM_forcing_type.F90 +++ b/src/core/MOM_forcing_type.F90 @@ -1457,7 +1457,7 @@ subroutine register_forcing_type_diags(Time, diag, use_temperature, handles, use 'W m-2') handles%id_net_heat_surface = register_diag_field('ocean_model', 'net_heat_surface',diag%axesT1, Time, & - 'Surface ocean heat flux from SW+LW+lat+sens+mass transfer+frazil+restore+seaice_melt_heat or flux adjustments',& + 'Surface ocean heat flux from SW+LW+lat+sens+mass transfer+frazil+restore+seaice_melt_heat or flux adjustments',& 'W m-2',& standard_name='surface_downward_heat_flux_in_sea_water', cmor_field_name='hfds', & cmor_standard_name='surface_downward_heat_flux_in_sea_water', &