@@ -11,27 +11,27 @@ module ocn_comp_mct
1111! !REVISION HISTORY:
1212!
1313! !USES:
14- use ESMF, only: ESMF_clock, ESMF_time, ESMF_timeInterval
15- use ESMF, only: ESMF_ClockGet, ESMF_TimeGet, ESMF_TimeIntervalGet
16- use seq_cdata_mod, only: seq_cdata
17- use seq_cdata_mod, only: seq_cdata_setptrs
18- use mct_mod, only: mct_gsMap, mct_gsmap_init, mct_gsMap_lsize, mct_gsmap_orderedpoints
19- use mct_mod, only: mct_aVect, mct_aVect_init, mct_aVect_zero, mct_aVect_nRattr
20- use mct_mod, only: mct_gGrid, mct_gGrid_init, mct_gGrid_importRAttr, mct_gGrid_importIAttr
21- use seq_flds_mod, only: seq_flds_x2o_fields, &
14+ use ESMF, only: ESMF_clock, ESMF_time, ESMF_timeInterval
15+ use ESMF, only: ESMF_ClockGet, ESMF_TimeGet, ESMF_TimeIntervalGet
16+ use seq_cdata_mod, only: seq_cdata
17+ use seq_cdata_mod, only: seq_cdata_setptrs
18+ use mct_mod, only: mct_gsMap, mct_gsmap_init, mct_gsMap_lsize, mct_gsmap_orderedpoints
19+ use mct_mod, only: mct_aVect, mct_aVect_init, mct_aVect_zero, mct_aVect_nRattr
20+ use mct_mod, only: mct_gGrid, mct_gGrid_init, mct_gGrid_importRAttr, mct_gGrid_importIAttr
21+ use seq_flds_mod, only: seq_flds_x2o_fields, &
2222 seq_flds_o2x_fields, &
2323 SEQ_FLDS_DOM_COORD, &
2424 SEQ_FLDS_DOM_other
25- use seq_infodata_mod, only: seq_infodata_type, &
25+ use seq_infodata_mod, only: seq_infodata_type, &
2626 seq_infodata_GetData, &
2727 seq_infodata_start_type_start, &
2828 seq_infodata_start_type_cont, &
2929 seq_infodata_start_type_brnch, &
3030 seq_infodata_PutData
31- use seq_comm_mct, only: seq_comm_name, seq_comm_inst, seq_comm_suffix
32- use seq_timemgr_mod, only: seq_timemgr_EClockGetData, seq_timemgr_RestartAlarmIsOn
33- use perf_mod, only: t_startf, t_stopf
34- use shr_kind_mod, only: SHR_KIND_R8
31+ use seq_comm_mct, only: seq_comm_name, seq_comm_inst, seq_comm_suffix
32+ use seq_timemgr_mod, only: seq_timemgr_EClockGetData, seq_timemgr_RestartAlarmIsOn
33+ use perf_mod, only: t_startf, t_stopf
34+ use shr_kind_mod, only: SHR_KIND_R8
3535
3636
3737 ! From MOM6
@@ -44,8 +44,7 @@ module ocn_comp_mct
4444 use MOM_error_handler, only: MOM_error, FATAL, is_root_pe
4545 use MOM_time_manager, only: time_type, set_date, set_calendar_type, NOLEAP
4646 use coupler_indices, only: coupler_indices_init, cpl_indices
47- use coupler_indices, only: ocn_export
48-
47+ use coupler_indices, only: ocn_export, fill_ice_ocean_bnd
4948!
5049! !PUBLIC MEMBER FUNCTIONS:
5150 implicit none
@@ -70,8 +69,9 @@ module ocn_comp_mct
7069 type MCT_MOM_Data
7170 type (ocean_state_type), pointer :: ocn_state = > NULL () ! < Private state of ocean
7271 type (ocean_public_type), pointer :: ocn_public = > NULL () ! < Public state of ocean
73- type (ocean_grid_type), pointer :: grid = > NULL () ! A pointer to a grid structure
74-
72+ type (ocean_grid_type), pointer :: grid = > NULL () ! < A pointer to a grid structure
73+ type (surface), pointer :: ocn_surface = > NULL () ! < A pointer to the ocean surface state
74+ type (ice_ocean_boundary_type) :: ice_ocean_boundary ! < A pointer to the ice ocean boundary type
7575 type (seq_infodata_type), pointer :: infodata
7676
7777 type (cpl_indices), public :: ind ! < Variable IDs
@@ -123,7 +123,8 @@ subroutine ocn_init_mct( EClock, cdata_o, x2o_o, o2x_o, NLFilename )
123123 integer :: lsize, nsend, nrecv
124124 logical :: ldiag_cpl = .false.
125125 integer :: ni, nj
126-
126+ integer :: isc, iec, jsc, jec ! < Indices for the start and end of the domain
127+ ! ! in the x and y dir., respectively.
127128 ! mct variables (these are local for now)
128129 integer :: MOM_MCT_ID
129130 type (mct_gsMap), pointer :: MOM_MCT_gsMap = > NULL () ! 2d, points to cdata
@@ -241,6 +242,7 @@ subroutine ocn_init_mct( EClock, cdata_o, x2o_o, o2x_o, NLFilename )
241242
242243 call t_stopf(' MOM_init' )
243244
245+
244246 !- --------------------------------------------------------------------
245247 ! Initialize MCT attribute vectors and indices
246248 !- --------------------------------------------------------------------
@@ -311,6 +313,29 @@ subroutine ocn_init_mct( EClock, cdata_o, x2o_o, o2x_o, NLFilename )
311313 ! Size of global domain
312314 call get_global_grid_size(glb% grid, ni, nj)
313315
316+ ! allocate ice_ocean_boundary
317+ isc = glb% grid% isc; iec = glb% grid% iec;
318+ jsc = glb% grid% jsc; jec = glb% grid% jec;
319+ allocate (glb% ice_ocean_boundary% u_flux(isc:iec,jsc:jec)); glb% ice_ocean_boundary% u_flux(:,:) = 0.0
320+ allocate (glb% ice_ocean_boundary% v_flux(isc:iec,jsc:jec)); glb% ice_ocean_boundary% v_flux(:,:) = 0.0
321+ allocate (glb% ice_ocean_boundary% t_flux(isc:iec,jsc:jec)); glb% ice_ocean_boundary% t_flux(:,:) = 0.0
322+ allocate (glb% ice_ocean_boundary% q_flux(isc:iec,jsc:jec)); glb% ice_ocean_boundary% q_flux(:,:) = 0.0
323+ allocate (glb% ice_ocean_boundary% salt_flux(isc:iec,jsc:jec)); glb% ice_ocean_boundary% salt_flux(:,:) = 0.0
324+ allocate (glb% ice_ocean_boundary% lw_flux(isc:iec,jsc:jec)); glb% ice_ocean_boundary% lw_flux(:,:) = 0.0
325+ allocate (glb% ice_ocean_boundary% sw_flux_vis_dir(isc:iec,jsc:jec)); glb% ice_ocean_boundary% sw_flux_vis_dir(:,:) = 0.0
326+ allocate (glb% ice_ocean_boundary% sw_flux_vis_dif(isc:iec,jsc:jec)); glb% ice_ocean_boundary% sw_flux_vis_dif(:,:) = 0.0
327+ allocate (glb% ice_ocean_boundary% sw_flux_nir_dir(isc:iec,jsc:jec)); glb% ice_ocean_boundary% sw_flux_nir_dir(:,:) = 0.0
328+ allocate (glb% ice_ocean_boundary% sw_flux_nir_dif(isc:iec,jsc:jec)); glb% ice_ocean_boundary% sw_flux_nir_dif(:,:) = 0.0
329+ allocate (glb% ice_ocean_boundary% lprec(isc:iec,jsc:jec)); glb% ice_ocean_boundary% lprec(:,:) = 0.0
330+ allocate (glb% ice_ocean_boundary% fprec(isc:iec,jsc:jec)); glb% ice_ocean_boundary% fprec(:,:) = 0.0
331+ allocate (glb% ice_ocean_boundary% runoff(isc:iec,jsc:jec)); glb% ice_ocean_boundary% runoff(:,:) = 0.0
332+ allocate (glb% ice_ocean_boundary% calving(isc:iec,jsc:jec)); glb% ice_ocean_boundary% calving(:,:) = 0.0
333+ allocate (glb% ice_ocean_boundary% runoff_hflx(isc:iec,jsc:jec)); glb% ice_ocean_boundary% runoff_hflx(:,:) = 0.0
334+ allocate (glb% ice_ocean_boundary% calving_hflx(isc:iec,jsc:jec)); glb% ice_ocean_boundary% calving_hflx(:,:) = 0.0
335+ allocate (glb% ice_ocean_boundary% p(isc:iec,jsc:jec)); glb% ice_ocean_boundary% p(:,:) = 0.0
336+ allocate (glb% ice_ocean_boundary% mi(isc:iec,jsc:jec)); glb% ice_ocean_boundary% mi(:,:) = 0.0
337+
338+
314339 if (debug .and. root_pe().eq. pe_here()) print * , " calling seq_infodata_putdata"
315340
316341 call seq_infodata_PutData( glb% infodata, &
@@ -341,9 +366,6 @@ subroutine ocn_run_mct( EClock, cdata_o, x2o_o, o2x_o)
341366 type (time_type) :: coupling_timestep ! Coupled time interval to pass to MOM6
342367 character (len= 128 ) :: err_msg
343368
344- ! Might need to be in glb to live on heap
345- type (ice_ocean_boundary_type) :: Ice_ocean_boundary
346-
347369 ! Translate the current time (start of coupling interval)
348370 call ESMF_ClockGet(EClock, currTime= current_time, rc= rc)
349371 call ESMF_TimeGet(current_time, yy= year, mm= month, dd= day, h= hour, m= minute, s= seconds, rc= rc)
@@ -380,10 +402,12 @@ subroutine ocn_run_mct( EClock, cdata_o, x2o_o, o2x_o)
380402 ! \todo Let MOM6 know to write restart...
381403 if (debug .and. is_root_pe()) write (6 ,* ) ' ocn_run_mct, write_restart_at_eod=' , write_restart_at_eod
382404
383- ! call ocn_imprt goes her
405+ ! fill ice ocean boundary
406+ call fill_ice_ocean_bnd(glb% ice_ocean_boundary, glb% grid, x2o_o% rattr, glb% ind)
407+ if (debug .and. is_root_pe()) write (6 ,* ) ' fill_ice_ocean_bnd'
384408
385- ! call update_ocean_model(ice_ocean_boundary, glb%ocn_state, glb%ocn_public, &
386- ! time_start, coupling_timestep)
409+ ! call update_ocean_model(glb% ice_ocean_boundary, glb%ocn_state, glb%ocn_public, &
410+ ! time_start, coupling_timestep)
387411
388412 end subroutine ocn_run_mct
389413
0 commit comments