Skip to content

Commit

Permalink
Merge branch 'dev/ncar' into add_nuopc_cap
Browse files Browse the repository at this point in the history
Conflicts:
	config_src/mct_driver/ocn_cap_methods.F90
	src/core/MOM_forcing_type.F90
  • Loading branch information
gustavo-marques committed Apr 15, 2019
2 parents e9a067f + 25ff7c8 commit e5238f5
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 17 deletions.
37 changes: 27 additions & 10 deletions config_src/mct_driver/MOM_surface_forcing.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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)) &
Expand Down Expand Up @@ -453,8 +450,27 @@ subroutine convert_IOB_to_fluxes(IOB, fluxes, Time, G, CS, &
fluxes%seaice_melt(i,j) = G%mask2dT(i,j) * IOB%seaice_melt(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)
Expand Down Expand Up @@ -576,8 +592,9 @@ subroutine convert_IOB_to_forces(IOB, forces, index_bounds, Time, G, CS)

!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

Expand Down
12 changes: 6 additions & 6 deletions config_src/mct_driver/ocn_cap_methods.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -188,9 +188,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)
Expand Down Expand Up @@ -270,8 +270,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
Expand Down
4 changes: 3 additions & 1 deletion src/core/MOM.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down

0 comments on commit e5238f5

Please sign in to comment.