Skip to content

Commit cc710f9

Browse files
committed
move map mesh migrate out of flood block
map mesh migrate foro r2o maps should happen always, even if flood is not present
1 parent 4d8c83c commit cc710f9

File tree

1 file changed

+58
-58
lines changed

1 file changed

+58
-58
lines changed

driver-moab/main/prep_ocn_mod.F90

Lines changed: 58 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -837,85 +837,85 @@ subroutine prep_ocn_init(infodata, atm_c2_ocn, atm_c2_ice, ice_c2_ocn, rof_c2_oc
837837

838838
#endif
839839

840-
if (iamroot_CPLID) then
841-
write(logunit,*) ' '
842-
write(logunit,F00) 'Initializing mapper_Rr2o_ice'
843-
end if
844-
! is this the same map as above ?
845-
call seq_map_init_rcfile(mapper_Rr2o_ice, rof(1), ocn(1), &
846-
'seq_maps.rc', 'rof2ocn_ice_rmapname:', 'rof2ocn_ice_rmaptype:',samegrid_ro, &
847-
'mapper_Rr2o_ice initialization', esmf_map_flag, no_match )
840+
if (iamroot_CPLID) then
841+
write(logunit,*) ' '
842+
write(logunit,F00) 'Initializing mapper_Rr2o_ice'
843+
end if
844+
! is this the same map as above ?
845+
call seq_map_init_rcfile(mapper_Rr2o_ice, rof(1), ocn(1), &
846+
'seq_maps.rc', 'rof2ocn_ice_rmapname:', 'rof2ocn_ice_rmaptype:',samegrid_ro, &
847+
'mapper_Rr2o_ice initialization', esmf_map_flag, no_match )
848848
! us the same one for mapper_Rr2o_ice and mapper_Fr2o
849849
#ifdef HAVE_MOAB
850850
! now take care of the mapper for MOAB mapper_Rr2o_ice
851+
if (iamroot_CPLID) then
852+
write(logunit,*) ' '
853+
write(logunit,F00) 'Initializing MOAB mapper_Rr2o_ice same as mapper_Rr2o_liq'
854+
end if
855+
856+
! If loading map from disk, then load the R2O_ice map
857+
if (.not. compute_maps_online_r2o) then
858+
type_grid = 3 ! this is type of grid
859+
arearead = 0 ! no need for areas
860+
call moab_map_init_rcfile( mbrxid, mboxid, mbintxro, type_grid, &
861+
'seq_maps.rc', 'rof2ocn_ice_rmapname:', 'rof2ocn_ice_rmaptype:', samegrid_ro, &
862+
arearead, wgtIdFr2oi, 'mapper_Rr2o_ice moab initialization', esmf_map_flag, wgtIdFr2ol )
863+
end if
864+
mapper_Rr2o_ice%src_mbid = mbrxid
865+
mapper_Rr2o_ice%tgt_mbid = mboxid
866+
mapper_Rr2o_ice%intx_mbid = mbintxro
867+
mapper_Rr2o_ice%src_context = rof(1)%cplcompid
868+
mapper_Rr2o_ice%intx_context = rmapid ! read map is the same context as intersection now
869+
mapper_Rr2o_ice%weight_identifier = wgtIdFr2oi
870+
mapper_Rr2o_ice%mbname = 'mapper_Rr2o_ice'
871+
#endif
872+
if (flood_present) then
851873
if (iamroot_CPLID) then
852874
write(logunit,*) ' '
853-
write(logunit,F00) 'Initializing MOAB mapper_Rr2o_ice same as mapper_Rr2o_liq'
875+
write(logunit,F00) 'Initializing mapper_Fr2o'
854876
end if
855-
856-
! If loading map from disk, then load the R2O_ice map
857-
if (.not. compute_maps_online_r2o) then
858-
type_grid = 3 ! this is type of grid
859-
arearead = 0 ! no need for areas
860-
call moab_map_init_rcfile( mbrxid, mboxid, mbintxro, type_grid, &
861-
'seq_maps.rc', 'rof2ocn_ice_rmapname:', 'rof2ocn_ice_rmaptype:', samegrid_ro, &
862-
arearead, wgtIdFr2oi, 'mapper_Rr2o_ice moab initialization', esmf_map_flag, wgtIdFr2ol )
863-
end if
864-
mapper_Rr2o_ice%src_mbid = mbrxid
865-
mapper_Rr2o_ice%tgt_mbid = mboxid
866-
mapper_Rr2o_ice%intx_mbid = mbintxro
867-
mapper_Rr2o_ice%src_context = rof(1)%cplcompid
868-
mapper_Rr2o_ice%intx_context = rmapid ! read map is the same context as intersection now
869-
mapper_Rr2o_ice%weight_identifier = wgtIdFr2oi
870-
mapper_Rr2o_ice%mbname = 'mapper_Rr2o_ice'
871-
#endif
872-
if (flood_present) then
873-
if (iamroot_CPLID) then
874-
write(logunit,*) ' '
875-
write(logunit,F00) 'Initializing mapper_Fr2o'
876-
end if
877-
no_match = .true. ! force to create a new mapper object
878-
call seq_map_init_rcfile( mapper_Fr2o, rof(1), ocn(1), &
877+
no_match = .true. ! force to create a new mapper object
878+
call seq_map_init_rcfile( mapper_Fr2o, rof(1), ocn(1), &
879879
'seq_maps.rc', 'rof2ocn_fmapname:', 'rof2ocn_fmaptype:',samegrid_ro, &
880880
string='mapper_Fr2o initialization', esmf_map=esmf_map_flag, no_match=no_match )
881881

882882
#ifdef HAVE_MOAB
883-
! now take care of the mapper for MOAB mapper_Fr2o
884-
if (iamroot_CPLID) then
885-
write(logunit,*) ' '
886-
write(logunit,F00) 'Initializing MOAB mapper_Fr2o'
887-
end if
888-
! If loading map from disk, then load the scalar map as well
883+
! now take care of the mapper for MOAB mapper_Fr2o
884+
if (iamroot_CPLID) then
885+
write(logunit,*) ' '
886+
write(logunit,F00) 'Initializing MOAB mapper_Fr2o'
887+
end if
888+
! If loading map from disk, then load the scalar map as well
889889
if (.not. compute_maps_online_r2o) then
890890
type_grid = 3 ! this is type of grid
891891
arearead = 0 ! no need for areas
892892
call moab_map_init_rcfile( mbrxid, mboxid, mbintxro, type_grid, &
893893
'seq_maps.rc', 'rof2ocn_fmapname:', 'rof2ocn_fmaptype:', samegrid_ro, &
894894
arearead, wgtIdFr2o, 'mapper_Fr2o MOAB initialization', esmf_map_flag, wgtIdFr2ol )
895895

896-
context_id = rmapid ! ocn(1)%cplcompid
897-
! this creates a parallel communication graph between mbrxid and mbintxro,
898-
! with ids rof(1)%cplcompid, rmapid (rmapid is 100*src+tgt)
899-
! this will be used in send/receive mappers
900-
ierr = iMOAB_MigrateMapMesh ( mbrxid, mbintxro, mpicom_CPLID, mpigrp_CPLID, &
901-
mpigrp_CPLID, type_grid, rof(1)%cplcompid, context_id )
902-
if (ierr .ne. 0) then
903-
write(logunit,*) subname,' error in migrating rof mesh for map rof c2 ocn '
904-
call shr_sys_abort(subname//' ERROR in migrating rof mesh for map rof c2 ocn ')
905-
endif
906-
907896
end if
908897

909-
mapper_Fr2o%src_mbid = mbrxid
910-
mapper_Fr2o%tgt_mbid = mboxid ! special
911-
mapper_Fr2o%intx_mbid = mbintxro
912-
mapper_Fr2o%src_context = rof(1)%cplcompid
913-
mapper_Fr2o%intx_context = rmapid ! read map is the same context as intersection now
914-
mapper_Fr2o%weight_identifier = wgtIdFr2o
915-
mapper_Fr2o%mbname = 'mapper_Fr2o'
898+
mapper_Fr2o%src_mbid = mbrxid
899+
mapper_Fr2o%tgt_mbid = mboxid ! special
900+
mapper_Fr2o%intx_mbid = mbintxro
901+
mapper_Fr2o%src_context = rof(1)%cplcompid
902+
mapper_Fr2o%intx_context = rmapid ! read map is the same context as intersection now
903+
mapper_Fr2o%weight_identifier = wgtIdFr2o
904+
mapper_Fr2o%mbname = 'mapper_Fr2o'
916905
#endif
917-
endif
906+
endif
918907

908+
context_id = rmapid ! ocn(1)%cplcompid
909+
! this creates a parallel communication graph between mbrxid and mbintxro,
910+
! with ids rof(1)%cplcompid, rmapid (rmapid is 100*src+tgt)
911+
! 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
919919
ierr = iMOAB_ComputeCommGraph( mbrxid, mbintxro, mpicom_CPLID, mpigrp_CPLID, mpigrp_CPLID, &
920920
type_grid, type_grid, rof(1)%cplcompid, rmapid )
921921
if (ierr .ne. 0) then

0 commit comments

Comments
 (0)