Skip to content

Commit 8b38141

Browse files
committed
Wrapped global data
1 parent 970f848 commit 8b38141

2 files changed

Lines changed: 29 additions & 23 deletions

File tree

config_src/mct_driver/coupler_indices.F90

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,13 @@ module coupler_indices
7979

8080
end type cpl_indices
8181

82-
! Module data for storing
83-
type(cpl_indices), public :: ind
84-
8582
contains
8683

87-
subroutine coupler_indices_init( )
84+
subroutine coupler_indices_init(ind)
85+
86+
type(cpl_indices), intent(inout) :: ind
87+
88+
! Local Variables
8889

8990
type(mct_aVect) :: o2x ! temporary
9091
type(mct_aVect) :: x2o ! temporary

config_src/mct_driver/ocn_comp_mct.F90

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ module ocn_comp_mct
3737
use MOM_grid, only: ocean_grid_type, get_global_grid_size
3838
use MOM_error_handler, only: MOM_error, FATAL, is_root_pe
3939
use MOM_time_manager, only: time_type, set_date, set_calendar_type, NOLEAP
40-
use coupler_indices, only: coupler_indices_init
40+
use coupler_indices, only: coupler_indices_init, cpl_indices
4141
use ocn_import_export, only: SBUFF_SUM, ocn_Export, mom_sum_buffer
4242

4343
!
@@ -61,11 +61,16 @@ module ocn_comp_mct
6161
private :: ocn_domain_mct
6262

6363
! !PRIVATE MODULE VARIABLES
64-
type(ocean_state_type), pointer :: ocn_state => NULL() ! Private state of ocean
65-
type(ocean_public_type), pointer :: ocn_surface => NULL() ! Public surface state of ocean
64+
type MCT_MOM_Data
65+
type(ocean_state_type), pointer :: ocn_state => NULL() !< Private state of ocean
66+
type(ocean_public_type), pointer :: ocn_surface => NULL() !< Public surface state of ocean
6667

67-
type(seq_infodata_type), pointer :: &
68-
infodata
68+
type(seq_infodata_type), pointer :: infodata
69+
70+
type(cpl_indices), public :: ind !< Variable IDs
71+
72+
end type
73+
type(MCT_MOM_Data) :: glb
6974

7075
!=======================================================================
7176

@@ -148,17 +153,17 @@ subroutine ocn_init_mct( EClock, cdata_o, x2o_o, o2x_o, NLFilename )
148153

149154
! set (actually, get from mct) the cdata pointers:
150155
call seq_cdata_setptrs(cdata_o, id=MOM_MCT_ID, mpicom=mpicom_ocn, &
151-
gsMap=MOM_MCT_gsMap, dom=MOM_MCT_dom, infodata=infodata)
156+
gsMap=MOM_MCT_gsMap, dom=MOM_MCT_dom, infodata=glb%infodata)
152157

153158
!---------------------------------------------------------------------
154159
! Initialize the model run
155160
!---------------------------------------------------------------------
156161

157-
call coupler_indices_init()
162+
call coupler_indices_init(glb%ind)
158163

159-
call seq_infodata_GetData( infodata, case_name=runid )
164+
call seq_infodata_GetData( glb%infodata, case_name=runid )
160165

161-
call seq_infodata_GetData( infodata, start_type=starttype)
166+
call seq_infodata_GetData( glb%infodata, start_type=starttype)
162167

163168
if ( trim(starttype) == trim(seq_infodata_start_type_start)) then
164169
runtype = "initial"
@@ -195,13 +200,13 @@ subroutine ocn_init_mct( EClock, cdata_o, x2o_o, o2x_o, NLFilename )
195200
npes = num_pes()
196201
pe0 = root_pe()
197202

198-
allocate(ocn_surface)
199-
ocn_surface%is_ocean_PE = .true.
200-
allocate(ocn_surface%pelist(npes))
201-
ocn_surface%pelist(:) = (/(i,i=pe0,pe0+npes)/)
203+
allocate(glb%ocn_surface)
204+
glb%ocn_surface%is_ocean_PE = .true.
205+
allocate(glb%ocn_surface%pelist(npes))
206+
glb%ocn_surface%pelist(:) = (/(i,i=pe0,pe0+npes)/)
202207

203208
! initialize the MOM6 model
204-
call ocean_model_init(ocn_surface, ocn_state, time_init, time_in)
209+
call ocean_model_init(glb%ocn_surface, glb%ocn_state, time_init, time_in)
205210

206211
call t_stopf('MOM_init')
207212

@@ -276,14 +281,14 @@ subroutine ocn_init_mct( EClock, cdata_o, x2o_o, o2x_o, NLFilename )
276281
if (debug .and. root_pe().eq.pe_here()) print *, "calling get_state_pointers"
277282

278283
! Size of global domain
279-
call get_state_pointers(ocn_state, grid=grid)
284+
call get_state_pointers(glb%ocn_state, grid=grid)
280285
call get_global_grid_size(grid, ni, nj)
281286

282287
if (debug .and. root_pe().eq.pe_here()) print *, "calling seq_infodata_putdata"
283288

284-
call seq_infodata_PutData( infodata, &
289+
call seq_infodata_PutData( glb%infodata, &
285290
ocn_nx = ni , ocn_ny = nj)
286-
call seq_infodata_PutData( infodata, &
291+
call seq_infodata_PutData( glb%infodata, &
287292
ocn_prognostic=.true., ocnrof_prognostic=.true.)
288293

289294

@@ -373,7 +378,7 @@ subroutine ocn_SetGSMap_mct(mpicom_ocn, MOM_MCT_ID, gsMap_ocn, gsMap3d_ocn)
373378
type(ocean_grid_type), pointer :: grid => NULL() ! A pointer to a grid structure
374379
integer, allocatable :: gindex(:) ! Indirect indices
375380

376-
call get_state_pointers(ocn_state, grid=grid)
381+
call get_state_pointers(glb%ocn_state, grid=grid)
377382
if (.not. associated(grid)) call MOM_error(FATAL, 'ocn_comp_mct.F90, ocn_SetGSMap_mct():' // &
378383
'grid returned from get_state_pointers() was not associated!')
379384

@@ -433,7 +438,7 @@ subroutine ocn_domain_mct( lsize, gsMap_ocn, dom_ocn)
433438
real(kind=SHR_REAL_R8) :: m2_to_rad2
434439
type(ocean_grid_type), pointer :: grid => NULL() ! A pointer to a grid structure
435440

436-
call get_state_pointers(ocn_state, grid=grid)
441+
call get_state_pointers(glb%ocn_state, grid=grid)
437442

438443
! set coords to lat and lon, and areas to rad^2
439444
call mct_gGrid_init(GGrid=dom_ocn, CoordChars=trim(seq_flds_dom_coord), &

0 commit comments

Comments
 (0)