Skip to content

Commit

Permalink
changes to MOM6 to get nuopc and mct caps similar
Browse files Browse the repository at this point in the history
  • Loading branch information
Mariana Vertenstein committed May 29, 2018
1 parent b10f343 commit 3d1962c
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 50 deletions.
71 changes: 31 additions & 40 deletions config_src/nuopc_driver/MOM_ocean_model.F90
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,15 @@ module MOM_ocean_model
type(domain2d) :: Domain !< The domain for the surface fields.
logical :: is_ocean_pe !< .true. on processors that run the ocean model.
character(len=32) :: instance_name = '' !< A name that can be used to identify
!! this instance of an ocean model, for example
!! in ensembles when writing messages.
!! this instance of an ocean model, for example
!! in ensembles when writing messages.
integer, pointer, dimension(:) :: pelist => NULL() !< The list of ocean PEs.
logical, pointer, dimension(:,:) :: maskmap =>NULL() !< A pointer to an array
!! indicating which logical processors are actually used for
!! the ocean code. The other logical processors would be all
!! land points and are not assigned to actual processors.
!! This need not be assigned if all logical processors are used.
!! indicating which logical processors are actually
!! used for the ocean code. The other logical
!! processors would be all land points and are not
!! assigned to actual processors. This need not be
!! assigned if all logical processors are used.

integer :: stagger = -999 !< The staggering relative to the tracer points
!! points of the two velocity components. Valid entries
Expand Down Expand Up @@ -251,13 +252,6 @@ subroutine ocean_model_init(Ocean_sfc, OS, Time_init, Time_in, gas_fields_ocn)
! Because of the way that indicies and domains are handled, Ocean_sfc must have
! been used in a previous call to initialize_ocean_type.

! Arguments: Ocean_sfc - A structure containing various publicly visible ocean
! surface properties after initialization, this is intent(out).
! (out,private) OS - A structure whose internal contents are private
! to ocean_model_mod that may be used to contain all
! information about the ocean's interior state.
! (in) Time_init - The start time for the coupled model's calendar.
! (in) Time_in - The time at which to initialize the ocean model.
real :: Rho0 ! The Boussinesq ocean density, in kg m-3.
real :: G_Earth ! The gravitational acceleration in m s-2.
! This include declares and sets the variable "version".
Expand Down Expand Up @@ -457,31 +451,32 @@ subroutine update_ocean_model(Ice_ocean_boundary, OS, Ocean_sfc, &
!! cumulative thermodynamic fluxes from the ocean,
!! like frazil, have been used and should be reset.

type(time_type) :: Master_time ! This allows step_MOM to temporarily change
! the time that is seen by internal modules.
type(time_type) :: Time1 ! The value of the ocean model's time at the
! start of a call to step_MOM.
integer :: index_bnds(4) ! The computational domain index bounds in the
! ice-ocean boundary type.
real :: weight ! Flux accumulation weight
real :: dt_coupling ! The coupling time step in seconds.
integer :: nts ! The number of baroclinic dynamics time steps
! within dt_coupling.
real :: dt_therm ! A limited and quantized version of OS%dt_therm (sec)
real :: dt_dyn ! The dynamics time step in sec.
real :: dtdia ! The diabatic time step in sec.
real :: t_elapsed_seg ! The elapsed time in this update segment, in s.
! local variables
type(time_type) :: Master_time !< This allows step_MOM to temporarily change
!! the time that is seen by internal modules.
type(time_type) :: Time1 !< The value of the ocean model's time at the
!! start of a call to step_MOM.
integer :: index_bnds(4) ! The computational domain index bounds in the ice-ocn boundary type
real :: weight !< Flux accumulation weight
real :: dt_coupling !< The coupling time step in seconds.

integer :: nts ! The number of baroclinic dynamics time steps
! within dt_coupling.
real :: dt_therm ! A limited and quantized version of OS%dt_therm (sec)
real :: dt_dyn ! The dynamics time step in sec.
real :: dtdia ! The diabatic time step in sec.
real :: t_elapsed_seg ! The elapsed time in this update segment, in s.
integer :: n, n_max, n_last_thermo
type(time_type) :: Time2 ! A temporary time.
type(time_type) :: Time2 ! A temporary time.
logical :: thermo_does_span_coupling ! If true, thermodynamic forcing spans
! multiple dynamic timesteps.
logical :: do_dyn ! If true, step the ocean dynamics and transport.
logical :: do_thermo ! If true, step the ocean thermodynamics.
logical :: step_thermo ! If true, take a thermodynamic step.
logical :: do_dyn ! If true, step the ocean dynamics and transport.
logical :: do_thermo ! If true, step the ocean thermodynamics.
logical :: step_thermo ! If true, take a thermodynamic step.
integer :: secs, days
integer :: is, ie, js, je

call callTree_enter("update_ocean_model(), ocean_model_MOM.F90")
call callTree_enter("update_ocean_model(), MOM_ocean_model.F90")
call get_time(Ocean_coupling_time_step, secs, days)
dt_coupling = 86400.0*real(days) + real(secs)

Expand Down Expand Up @@ -923,17 +918,13 @@ subroutine convert_state_to_ocean_type(sfc_state, Ocean_sfc, G, &

if (Ocean_sfc%stagger == AGRID) then
do j=jsc_bnd,jec_bnd ; do i=isc_bnd,iec_bnd
Ocean_sfc%u_surf(i,j) = G%mask2dT(i+i0,j+j0) * &
0.5*(sfc_state%u(I+i0,j+j0)+sfc_state%u(I-1+i0,j+j0))
Ocean_sfc%v_surf(i,j) = G%mask2dT(i+i0,j+j0) * &
0.5*(sfc_state%v(i+i0,J+j0)+sfc_state%v(i+i0,J-1+j0))
Ocean_sfc%u_surf(i,j) = G%mask2dT(i+i0,j+j0) * 0.5*(sfc_state%u(I+i0,j+j0)+sfc_state%u(I-1+i0,j+j0))
Ocean_sfc%v_surf(i,j) = G%mask2dT(i+i0,j+j0) * 0.5*(sfc_state%v(i+i0,J+j0)+sfc_state%v(i+i0,J-1+j0))
enddo ; enddo
elseif (Ocean_sfc%stagger == BGRID_NE) then
do j=jsc_bnd,jec_bnd ; do i=isc_bnd,iec_bnd
Ocean_sfc%u_surf(i,j) = G%mask2dBu(I+i0,J+j0) * &
0.5*(sfc_state%u(I+i0,j+j0)+sfc_state%u(I+i0,j+j0+1))
Ocean_sfc%v_surf(i,j) = G%mask2dBu(I+i0,J+j0) * &
0.5*(sfc_state%v(i+i0,J+j0)+sfc_state%v(i+i0+1,J+j0))
Ocean_sfc%u_surf(i,j) = G%mask2dBu(I+i0,J+j0) * 0.5*(sfc_state%u(I+i0,j+j0)+sfc_state%u(I+i0,j+j0+1))
Ocean_sfc%v_surf(i,j) = G%mask2dBu(I+i0,J+j0) * 0.5*(sfc_state%v(i+i0,J+j0)+sfc_state%v(i+i0+1,J+j0))
enddo ; enddo
elseif (Ocean_sfc%stagger == CGRID_NE) then
do j=jsc_bnd,jec_bnd ; do i=isc_bnd,iec_bnd
Expand Down
6 changes: 4 additions & 2 deletions config_src/nuopc_driver/MOM_surface_forcing.F90
Original file line number Diff line number Diff line change
Expand Up @@ -215,11 +215,12 @@ subroutine convert_IOB_to_fluxes(IOB, fluxes, index_bounds, Time, G, CS, &
type(surface_forcing_CS),pointer :: CS !< A pointer to the control structure returned by a
!! previous call to surface_forcing_init.
type(surface), intent(in) :: sfc_state !< A structure containing fields that describe the
!! surface state of the ocean.
!! surface state of the ocean.
logical, optional, intent(in) :: restore_salt !< If true, salinity is restored to a target value.
logical, optional, intent(in) :: restore_temp !< If true, temperature is restored to a target value.


! local variables
real, dimension(SZI_(G),SZJ_(G)) :: &
data_restore, & ! The surface value toward which to restore (g/kg or degC)
SST_anom, & ! Instantaneous sea surface temperature anomalies from a target value (deg C)
Expand Down Expand Up @@ -476,6 +477,7 @@ subroutine convert_IOB_to_fluxes(IOB, fluxes, index_bounds, Time, G, CS, &
fluxes%sw_nir_dir(i,j) = G%mask2dT(i,j) * IOB%sw_flux_nir_dir(i-i0,j-j0)
if (associated(IOB%sw_flux_nir_dif)) &
fluxes%sw_nir_dif(i,j) = G%mask2dT(i,j) * IOB%sw_flux_nir_dif(i-i0,j-j0)

fluxes%sw(i,j) = fluxes%sw_vis_dir(i,j) + fluxes%sw_vis_dif(i,j) + &
fluxes%sw_nir_dir(i,j) + fluxes%sw_nir_dif(i,j)

Expand Down Expand Up @@ -588,7 +590,7 @@ subroutine convert_IOB_to_forces(IOB, forces, index_bounds, Time, G, CS)
rigidity_at_h, & ! Ice rigidity at tracer points (m3 s-1)
taux_at_h, & ! Zonal wind stresses at h points (Pa)
tauy_at_h ! Meridional wind stresses at h points (Pa)

real :: gustiness ! unresolved gustiness that contributes to ustar (Pa)
real :: Irho0 ! inverse of the mean density in (m^3/kg)
real :: taux2, tauy2 ! squared wind stresses (Pa^2)
Expand Down
4 changes: 2 additions & 2 deletions config_src/nuopc_driver/mom_cap.F90
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ module mom_cap_mod
use MOM_get_input, only: Get_MOM_Input, directories
use MOM_domains, only: pass_var
#ifdef MOM6_CAP
use ocean_model_mod, only: ice_ocean_boundary_type
use MOM_ocean_model, only: ice_ocean_boundary_type
use MOM_grid, only: ocean_grid_type
#else
use ocean_types_mod, only: ice_ocean_boundary_type, ocean_grid_type
Expand Down Expand Up @@ -732,7 +732,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
call fms_init(mpi_comm_mom)
call constants_init
call field_manager_init
call set_calendar_type (JULIAN )
call set_calendar_type (JULIAN)
call diag_manager_init
! this ocean connector will be driven at set interval
dt_cpld = DT_OCEAN
Expand Down
12 changes: 6 additions & 6 deletions config_src/nuopc_driver/mom_cap_methods.F90
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ module mom_cap_methods

! mct modules
use ESMF
use perf_mod, only: t_startf, t_stopf
use ocean_model_mod, only: ocean_public_type, ocean_state_type
use ocean_model_mod, only: ice_ocean_boundary_type
use MOM_grid, only: ocean_grid_type
use MOM_domains, only: pass_var
use mpp_domains_mod, only: mpp_get_compute_domain
use perf_mod, only: t_startf, t_stopf
use MOM_ocean_model, only: ocean_public_type, ocean_state_type
use MOM_surface_forcing, only: ice_ocean_boundary_type
use MOM_grid, only: ocean_grid_type
use MOM_domains, only: pass_var
use mpp_domains_mod, only: mpp_get_compute_domain

! By default make data private
implicit none; private
Expand Down

0 comments on commit 3d1962c

Please sign in to comment.