@@ -420,7 +420,6 @@ subroutine prep_ocn_init(infodata, atm_c2_ocn, atm_c2_ice, ice_c2_ocn, rof_c2_oc
420420 ' seq_maps.rc' ,' atm2ocn_fmapname:' ,' atm2ocn_fmaptype:' ,samegrid_ao, &
421421 ' mapper_Fa2o initialization' , esmf_map_flag, no_match)
422422 call shr_sys_flush(logunit)
423- #ifdef HAVE_MOAB
424423 ! Call moab intx only if atm and ocn are init in moab
425424 if ((mbaxid .ge. 0 ) .and. (mboxid .ge. 0 )) then
426425 if (iamroot_CPLID) then
@@ -605,8 +604,7 @@ subroutine prep_ocn_init(infodata, atm_c2_ocn, atm_c2_ice, ice_c2_ocn, rof_c2_oc
605604 endif ! if (.not. samegrid_ao)
606605
607606 endif ! if ((mbaxid .ge. 0) .and. (mboxid .ge. 0))
608- ! endif HAVE_MOAB
609- #endif
607+
610608 end if ! if (atm_present)
611609
612610 ! atm_c2_ice flag is here because ICE and OCN are constrained to be on the same
@@ -694,7 +692,6 @@ subroutine prep_ocn_init(infodata, atm_c2_ocn, atm_c2_ice, ice_c2_ocn, rof_c2_oc
694692 write (logunit,F00) ' Initializing mapper_SFi2o'
695693 end if
696694 call seq_map_init_rearrolap(mapper_SFi2o, ice(1 ), ocn(1 ), ' mapper_SFi2o' )
697- #ifdef HAVE_MOAB
698695 if ( (mbixid .ge. 0 ) .and. (mboxid .ge. 0 )) then
699696 if (iamroot_CPLID) then
700697 write (logunit,* ) ' '
@@ -737,7 +734,6 @@ subroutine prep_ocn_init(infodata, atm_c2_ocn, atm_c2_ice, ice_c2_ocn, rof_c2_oc
737734 mapper_SFi2o% intx_context = ocn(1 )% cplcompid
738735 mapper_SFi2o% mbname = ' mapper_SFi2o'
739736 endif
740- #endif
741737 endif ! if (ice_present)
742738 call shr_sys_flush(logunit)
743739
@@ -754,7 +750,6 @@ subroutine prep_ocn_init(infodata, atm_c2_ocn, atm_c2_ice, ice_c2_ocn, rof_c2_oc
754750 call seq_comm_getData(CPLID, mpicom= mpicom_CPLID, iamroot= iamroot_CPLID)
755751 call seq_comm_getData(CPLID, mpigrp= mpigrp_CPLID) ! second group, the coupler group CPLID is global variable
756752
757- #ifdef HAVE_MOAB
758753 appname = " ROF_OCN_COU" // CHAR (0 )
759754 ! rmapid is a unique external number of MOAB app that takes care of map between rof and ocn mesh
760755 rmapid = 100 * rof(1 )% cplcompid + ocn(1 )% cplcompid ! something different, to differentiate it
@@ -835,7 +830,6 @@ subroutine prep_ocn_init(infodata, atm_c2_ocn, atm_c2_ice, ice_c2_ocn, rof_c2_oc
835830 mapper_Rr2o_liq% weight_identifier = wgtIdFr2ol
836831 mapper_Rr2o_liq% mbname = ' mapper_Rr2o_liq'
837832
838- #endif
839833
840834 if (iamroot_CPLID) then
841835 write (logunit,* ) ' '
@@ -846,7 +840,6 @@ subroutine prep_ocn_init(infodata, atm_c2_ocn, atm_c2_ice, ice_c2_ocn, rof_c2_oc
846840 ' seq_maps.rc' , ' rof2ocn_ice_rmapname:' , ' rof2ocn_ice_rmaptype:' ,samegrid_ro, &
847841 ' mapper_Rr2o_ice initialization' , esmf_map_flag, no_match )
848842! us the same one for mapper_Rr2o_ice and mapper_Fr2o
849- #ifdef HAVE_MOAB
850843! now take care of the mapper for MOAB mapper_Rr2o_ice
851844 if (iamroot_CPLID) then
852845 write (logunit,* ) ' '
@@ -868,7 +861,6 @@ subroutine prep_ocn_init(infodata, atm_c2_ocn, atm_c2_ice, ice_c2_ocn, rof_c2_oc
868861 mapper_Rr2o_ice% intx_context = rmapid ! read map is the same context as intersection now
869862 mapper_Rr2o_ice% weight_identifier = wgtIdFr2oi
870863 mapper_Rr2o_ice% mbname = ' mapper_Rr2o_ice'
871- #endif
872864 if (flood_present) then
873865 if (iamroot_CPLID) then
874866 write (logunit,* ) ' '
@@ -878,8 +870,6 @@ subroutine prep_ocn_init(infodata, atm_c2_ocn, atm_c2_ice, ice_c2_ocn, rof_c2_oc
878870 call seq_map_init_rcfile( mapper_Fr2o, rof(1 ), ocn(1 ), &
879871 ' seq_maps.rc' , ' rof2ocn_fmapname:' , ' rof2ocn_fmaptype:' ,samegrid_ro, &
880872 string= ' mapper_Fr2o initialization' , esmf_map= esmf_map_flag, no_match= no_match )
881-
882- #ifdef HAVE_MOAB
883873 ! now take care of the mapper for MOAB mapper_Fr2o
884874 if (iamroot_CPLID) then
885875 write (logunit,* ) ' '
@@ -892,30 +882,29 @@ subroutine prep_ocn_init(infodata, atm_c2_ocn, atm_c2_ice, ice_c2_ocn, rof_c2_oc
892882 call moab_map_init_rcfile( mbrxid, mboxid, mbintxro, type_grid, &
893883 ' seq_maps.rc' , ' rof2ocn_fmapname:' , ' rof2ocn_fmaptype:' , samegrid_ro, &
894884 arearead, wgtIdFr2o, ' mapper_Fr2o MOAB initialization' , esmf_map_flag, wgtIdFr2ol )
895-
896885 end if
897-
898886 mapper_Fr2o% src_mbid = mbrxid
899887 mapper_Fr2o% tgt_mbid = mboxid ! special
900888 mapper_Fr2o% intx_mbid = mbintxro
901889 mapper_Fr2o% src_context = rof(1 )% cplcompid
902890 mapper_Fr2o% intx_context = rmapid ! read map is the same context as intersection now
903891 mapper_Fr2o% weight_identifier = wgtIdFr2o
904892 mapper_Fr2o% mbname = ' mapper_Fr2o'
905- #endif
906893 endif
907894
908- context_id = rmapid ! ocn(1)%cplcompid
895+ context_id = rmapid ! ocn(1)%cplcompid*100+rof(1)%cplcompid
896+ type_grid = 3 ! this is type of grid
897+ if (.not. compute_maps_online_r2o) then
898+ ierr = iMOAB_MigrateMapMesh ( mbrxid, mbintxro, mpicom_CPLID, mpigrp_CPLID, &
899+ mpigrp_CPLID, type_grid, rof(1 )% cplcompid, context_id )
900+ if (ierr .ne. 0 ) then
901+ write (logunit,* ) subname,' error in migrating rof mesh for map rof c2 ocn '
902+ call shr_sys_abort(subname// ' ERROR in migrating rof mesh for map rof c2 ocn ' )
903+ endif
904+ endif
909905 ! this creates a parallel communication graph between mbrxid and mbintxro,
910906 ! with ids rof(1)%cplcompid, rmapid (rmapid is 100*src+tgt)
911907 ! this will be used in send/receive mappers
912- type_grid = 3 ! this is type of grid
913- ierr = iMOAB_MigrateMapMesh ( mbrxid, mbintxro, mpicom_CPLID, mpigrp_CPLID, &
914- mpigrp_CPLID, type_grid, rof(1 )% cplcompid, context_id )
915- if (ierr .ne. 0 ) then
916- write (logunit,* ) subname,' error in migrating rof mesh for map rof c2 ocn '
917- call shr_sys_abort(subname// ' ERROR in migrating rof mesh for map rof c2 ocn ' )
918- endif
919908 ierr = iMOAB_ComputeCommGraph( mbrxid, mbintxro, mpicom_CPLID, mpigrp_CPLID, mpigrp_CPLID, &
920909 type_grid, type_grid, rof(1 )% cplcompid, rmapid )
921910 if (ierr .ne. 0 ) then
0 commit comments