@@ -17,10 +17,14 @@ module ocean_model_mod
1717use MOM, only : get_ocean_stocks, step_offline
1818use MOM_coms, only : field_chksum
1919use MOM_constants, only : CELSIUS_KELVIN_OFFSET, hlf
20+ use MOM_coupler_types, only : coupler_1d_bc_type, coupler_2d_bc_type
21+ use MOM_coupler_types, only : coupler_type_spawn, coupler_type_write_chksums
22+ use MOM_coupler_types, only : coupler_type_initialized, coupler_type_copy_data
23+ use MOM_coupler_types, only : coupler_type_set_diags, coupler_type_send_data
2024use MOM_diag_mediator, only : diag_ctrl, enable_averaging, disable_averaging
2125use MOM_diag_mediator, only : diag_mediator_close_registration, diag_mediator_end
22- use MOM_domains, only : pass_var, pass_vector, AGRID, BGRID_NE, CGRID_NE
23- use MOM_domains, only : TO_ALL, Omit_Corners
26+ use MOM_domains, only : MOM_domain_type, domain2d, clone_MOM_domain, get_domain_extent
27+ use MOM_domains, only : pass_var, pass_vector, AGRID, BGRID_NE, CGRID_NE, TO_ALL, Omit_Corners
2428use MOM_error_handler, only : MOM_error, MOM_mesg, FATAL, WARNING, is_root_pe
2529use MOM_error_handler, only : callTree_enter, callTree_leave
2630use MOM_EOS, only : gsw_sp_from_sr, gsw_pt_from_ct
@@ -31,7 +35,7 @@ module ocean_model_mod
3135use MOM_forcing_type, only : forcing_diagnostics, mech_forcing_diags
3236use MOM_get_input, only : Get_MOM_Input, directories
3337use MOM_grid, only : ocean_grid_type
34- use MOM_io, only : close_file, file_exists, read_data, write_version_number
38+ use MOM_io, only : close_file, file_exists, read_data, write_version_number, stdout
3539use MOM_marine_ice, only : iceberg_forces, iceberg_fluxes, marine_ice_init, marine_ice_CS
3640use MOM_restart, only : MOM_restart_CS, save_restart
3741use MOM_string_functions, only : uppercase
@@ -52,14 +56,6 @@ module ocean_model_mod
5256use MOM_ice_shelf, only : add_shelf_forces, ice_shelf_end, ice_shelf_save_restart
5357use MOM_wave_interface, only: wave_parameters_CS, MOM_wave_interface_init
5458use MOM_wave_interface, only: MOM_wave_interface_init_lite, Update_Surface_Waves
55- use coupler_types_mod, only : coupler_1d_bc_type, coupler_2d_bc_type
56- use coupler_types_mod, only : coupler_type_spawn, coupler_type_write_chksums
57- use coupler_types_mod, only : coupler_type_initialized, coupler_type_copy_data
58- use coupler_types_mod, only : coupler_type_set_diags, coupler_type_send_data
59- use mpp_domains_mod, only : domain2d, mpp_get_layout, mpp_get_global_domain
60- use mpp_domains_mod, only : mpp_define_domains, mpp_get_compute_domain, mpp_get_data_domain
61- use atmos_ocean_fluxes_mod, only : aof_set_coupler_flux
62- use fms_mod, only : stdout
6359
6460#include < MOM_memory.h>
6561
@@ -107,7 +103,7 @@ module ocean_model_mod
107103 ! ! points of the two velocity components. Valid entries
108104 ! ! include AGRID, BGRID_NE, CGRID_NE, BGRID_SW, and CGRID_SW,
109105 ! ! corresponding to the community-standard Arakawa notation.
110- ! ! (These are named integers taken from mpp_parameter_mod .)
106+ ! ! (These are named integers taken from the MOM_domains module .)
111107 ! ! Following MOM5, stagger is BGRID_NE by default when the
112108 ! ! ocean is initialized, but here it is set to -999 so that
113109 ! ! a global max across ocean and non-ocean processors can be
@@ -391,14 +387,8 @@ subroutine ocean_model_init(Ocean_sfc, OS, Time_init, Time_in, wind_stagger, gas
391387 call MOM_wave_interface_init_lite(param_file)
392388 endif
393389
394- if (associated (OS% grid% Domain% maskmap)) then
395- call initialize_ocean_public_type(OS% grid% Domain% mpp_domain, Ocean_sfc, &
396- OS% diag, maskmap= OS% grid% Domain% maskmap, &
397- gas_fields_ocn= gas_fields_ocn)
398- else
399- call initialize_ocean_public_type(OS% grid% Domain% mpp_domain, Ocean_sfc, &
400- OS% diag, gas_fields_ocn= gas_fields_ocn)
401- endif
390+ call initialize_ocean_public_type(OS% grid% Domain, Ocean_sfc, OS% diag, &
391+ gas_fields_ocn= gas_fields_ocn)
402392
403393 ! This call can only occur here if the coupler_bc_type variables have been
404394 ! initialized already using the information from gas_fields_ocn.
@@ -513,8 +503,7 @@ subroutine update_ocean_model(Ice_ocean_boundary, OS, Ocean_sfc, time_start_upda
513503 (/ is,is,ie,ie/ ), (/ js,js,je,je/ ), as_needed= .true. )
514504
515505 ! Translate Ice_ocean_boundary into fluxes and forces.
516- call mpp_get_compute_domain(Ocean_sfc% Domain, index_bnds(1 ), index_bnds(2 ), &
517- index_bnds(3 ), index_bnds(4 ))
506+ call get_domain_extent(Ocean_sfc% Domain, index_bnds(1 ), index_bnds(2 ), index_bnds(3 ), index_bnds(4 ))
518507
519508 if (do_dyn) then
520509 call convert_IOB_to_forces(Ice_ocean_boundary, OS% forces, index_bnds, OS% Time_dyn, OS% grid, OS% US, &
@@ -733,7 +722,7 @@ end subroutine ocean_model_end
733722subroutine ocean_model_save_restart (OS , Time , directory , filename_suffix )
734723 type (ocean_state_type), pointer :: OS ! < A pointer to the structure containing the
735724 ! ! internal ocean state (in).
736- type (time_type), intent (in ) :: Time ! < The model time at this call, needed for mpp_write calls .
725+ type (time_type), intent (in ) :: Time ! < The model time at this call, needed for writing files .
737726 character (len=* ), optional , intent (in ) :: directory ! < An optional directory into which to
738727 ! ! write these restart files.
739728 character (len=* ), optional , intent (in ) :: filename_suffix ! < An optional suffix (e.g., a time-stamp)
@@ -765,16 +754,12 @@ subroutine ocean_model_save_restart(OS, Time, directory, filename_suffix)
765754end subroutine ocean_model_save_restart
766755
767756! > Initialize the public ocean type
768- subroutine initialize_ocean_public_type (input_domain , Ocean_sfc , diag , maskmap , &
769- gas_fields_ocn )
770- type (domain2D), intent (in ) :: input_domain ! < The ocean model domain description
757+ subroutine initialize_ocean_public_type (input_domain , Ocean_sfc , diag , gas_fields_ocn )
758+ type (MOM_domain_type), intent (in ) :: input_domain ! < The ocean model domain description
771759 type (ocean_public_type), intent (inout ) :: Ocean_sfc ! < A structure containing various publicly
772- ! ! visible ocean surface properties after initialization, whose
773- ! ! elements are allocated here.
774- type (diag_ctrl), intent (in ) :: diag ! < A structure that regulates diagnsotic output
775- logical , dimension (:,:), &
776- optional , intent (in ) :: maskmap ! < A mask indicating which virtual processors
777- ! ! are actually in use. If missing, all are used.
760+ ! ! visible ocean surface properties after
761+ ! ! initialization, whose elements are allocated here.
762+ type (diag_ctrl), intent (in ) :: diag ! < A structure that regulates diagnostic output
778763 type (coupler_1d_bc_type), &
779764 optional , intent (in ) :: gas_fields_ocn ! < If present, this type describes the
780765 ! ! ocean and surface-ice fields that will participate
@@ -786,14 +771,9 @@ subroutine initialize_ocean_public_type(input_domain, Ocean_sfc, diag, maskmap,
786771 ! and have no halos.
787772 integer :: isc, iec, jsc, jec
788773
789- call mpp_get_layout(input_domain,layout)
790- call mpp_get_global_domain(input_domain, xsize= xsz, ysize= ysz)
791- if (PRESENT (maskmap)) then
792- call mpp_define_domains((/ 1 ,xsz,1 ,ysz/ ),layout,Ocean_sfc% Domain, maskmap= maskmap)
793- else
794- call mpp_define_domains((/ 1 ,xsz,1 ,ysz/ ),layout,Ocean_sfc% Domain)
795- endif
796- call mpp_get_compute_domain(Ocean_sfc% Domain, isc, iec, jsc, jec)
774+ call clone_MOM_domain(input_domain, Ocean_sfc% Domain, halo_size= 0 , symmetric= .false. )
775+
776+ call get_domain_extent(Ocean_sfc% Domain, isc, iec, jsc, jec)
797777
798778 allocate ( Ocean_sfc% t_surf (isc:iec,jsc:jec), &
799779 Ocean_sfc% s_surf (isc:iec,jsc:jec), &
@@ -849,8 +829,7 @@ subroutine convert_state_to_ocean_type(sfc_state, Ocean_sfc, G, US, patm, press_
849829 is = G% isc ; ie = G% iec ; js = G% jsc ; je = G% jec
850830 call pass_vector(sfc_state% u, sfc_state% v, G% Domain)
851831
852- call mpp_get_compute_domain(Ocean_sfc% Domain, isc_bnd, iec_bnd, &
853- jsc_bnd, jec_bnd)
832+ call get_domain_extent(Ocean_sfc% Domain, isc_bnd, iec_bnd, jsc_bnd, jec_bnd)
854833 if (present (patm)) then
855834 ! Check that the inidicies in patm are (isc_bnd:iec_bnd,jsc_bnd:jec_bnd).
856835 if (.not. present (press_to_z)) call MOM_error(FATAL, &
@@ -1044,20 +1023,17 @@ subroutine ocean_model_data2D_get(OS, Ocean, name, array2D, isc, jsc)
10441023 integer , intent (in ) :: isc ! < The starting i-index of array2D
10451024 integer , intent (in ) :: jsc ! < The starting j-index of array2D
10461025
1047- integer :: g_isc, g_iec, g_jsc, g_jec,g_isd, g_ied, g_jsd, g_jed, i, j
1026+ integer :: g_isc, g_iec, g_jsc, g_jec, g_isd, g_ied, g_jsd, g_jed, i, j
10481027
10491028 if (.not. associated (OS)) return
10501029 if (.not. OS% is_ocean_pe) return
10511030
1052- ! The problem is %areaT is on MOM domain but Ice_Ocean_Boundary%... is on mpp domain.
1053- ! We want to return the MOM data on the mpp (compute) domain
1054- ! Get MOM domain extents
1055- call mpp_get_compute_domain(OS% grid% Domain% mpp_domain, g_isc, g_iec, g_jsc, g_jec)
1056- call mpp_get_data_domain (OS% grid% Domain% mpp_domain, g_isd, g_ied, g_jsd, g_jed)
1031+ ! The problem is that %areaT is on MOM domain but Ice_Ocean_Boundary%... is on a haloless domain.
1032+ ! We want to return the MOM data on the haloless (compute) domain
1033+ call get_domain_extent(OS% grid% Domain, g_isc, g_iec, g_jsc, g_jec, g_isd, g_ied, g_jsd, g_jed)
10571034
10581035 g_isc = g_isc- g_isd+1 ; g_iec = g_iec- g_isd+1 ; g_jsc = g_jsc- g_jsd+1 ; g_jec = g_jec- g_jsd+1
10591036
1060-
10611037 select case (name)
10621038 case (' area' )
10631039 array2D(isc:,jsc:) = OS% US% L_to_m** 2 * OS% grid% areaT(g_isc:g_iec,g_jsc:g_jec)
@@ -1127,7 +1103,7 @@ subroutine ocean_public_type_chksum(id, timestep, ocn)
11271103 ! ! visible ocean surface fields.
11281104 integer :: n, m, outunit
11291105
1130- outunit = stdout()
1106+ outunit = stdout
11311107
11321108 write (outunit,* ) " BEGIN CHECKSUM(ocean_type):: " , id, timestep
11331109 write (outunit,100 ) ' ocean%t_surf ' , field_chksum(ocn% t_surf )
@@ -1180,8 +1156,7 @@ subroutine ocean_model_get_UV_surf(OS, Ocean, name, array2D, isc, jsc)
11801156 G = > OS% grid
11811157 is = G% isc ; ie = G% iec ; js = G% jsc ; je = G% jec
11821158
1183- call mpp_get_compute_domain(Ocean% Domain, isc_bnd, iec_bnd, &
1184- jsc_bnd, jec_bnd)
1159+ call get_domain_extent(Ocean% Domain, isc_bnd, iec_bnd, jsc_bnd, jec_bnd)
11851160
11861161 i0 = is - isc_bnd ; j0 = js - jsc_bnd
11871162
0 commit comments