Skip to content

Commit

Permalink
Merge branch '/iulian787/remove_shr_dependency' (PR #6168)
Browse files Browse the repository at this point in the history
mpas framework should not depend on driver-moab/shr
mpas ocean cannot be built in standalone mode with MOAB, because of this

[BFB]
  • Loading branch information
rljacob authored Feb 1, 2024
2 parents 318d612 + 3dd1cf4 commit 4cc2ced
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 13 deletions.
2 changes: 1 addition & 1 deletion components/mpas-framework/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -1113,7 +1113,7 @@ ifeq "$(USE_GPUAWARE)" "true"
@echo $(GPUAWARE_MESSAGE)
endif
ifeq "$(USE_MOAB)" "true"
@echo $(MOAB_MESSAGE)
@echo $(MOAB_MESSAGE)
endif
@echo "*******************************************************************************"
clean:
Expand Down
8 changes: 4 additions & 4 deletions components/mpas-framework/src/driver/mpas_subdriver.F
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ subroutine mpas_init(corelist, domain_ptr, mpi_comm)
use mpas_timekeeping, only : mpas_get_clock_time, mpas_get_time
use mpas_bootstrapping, only : mpas_bootstrap_framework_phase1, mpas_bootstrap_framework_phase2
use mpas_log
#ifdef HAVE_MOAB
use iMOAB, only: iMOAB_Initialize
#endif

implicit none

Expand Down Expand Up @@ -89,9 +92,6 @@ subroutine mpas_init(corelist, domain_ptr, mpi_comm)
logical :: streamsExists
integer :: mesh_iotype
integer, save :: domainID = 0
#ifdef HAVE_MOAB
integer, external :: iMOAB_InitializeFortran
#endif
interface
subroutine xml_stream_parser(xmlname, mgr_p, comm, ierr) bind(c)
use iso_c_binding, only : c_char, c_ptr, c_int
Expand Down Expand Up @@ -303,7 +303,7 @@ end subroutine xml_stream_get_attributes
call mpas_build_stream_filename(ref_time, start_time, filename_interval, mesh_filename_temp, blockID, mesh_filename, ierr)
end if
#ifdef HAVE_MOAB
ierr = iMOAB_InitializeFortran()
ierr = iMOAB_Initialize()
if ( ierr /= 0 ) then
call mpas_log_write('cannot initialize MOAB', messageType=MPAS_LOG_CRIT)
else
Expand Down
11 changes: 4 additions & 7 deletions components/mpas-framework/src/framework/mpas_moabmesh.F
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ subroutine init_moab_mpas(domain, ext_comp_id, pidmoab)
iMOAB_ResolveSharedEntities, iMOAB_DetermineGhostEntities, &
iMOAB_DefineTagStorage, iMOAB_SetIntTagStorage , &
iMOAB_UpdateMeshInfo, iMOAB_SetDoubleTagStorage
use seq_flds_mod, only: seq_flds_dom_fields

type (domain_type), intent(inout) :: domain
integer , intent(in) :: ext_comp_id
Expand Down Expand Up @@ -187,14 +186,12 @@ subroutine init_moab_mpas(domain, ext_comp_id, pidmoab)
data(n)=areaCell(ic) / (sphere_radius * sphere_radius)
enddo

! add domain tags
tagname=trim(seq_flds_dom_fields)//C_NULL_CHAR
tagtype = 1
tagname='area'//C_NULL_CHAR
tagtype = 1 ! dense, real
numco = 1
ierr = iMOAB_DefineTagStorage(pid, tagname, tagtype, numco, tagindex )
if (ierr > 0 ) &
call errorout(ierr, 'Error: fail to define domain tags ')
call errorout(ierr, 'fail to define area tag')

tagname='area'//C_NULL_CHAR
ierr = iMOAB_SetDoubleTagStorage ( pid, tagname, nCellsSolve , ent_type, data)
if (ierr > 0 ) &
call errorout(ierr,'Error: fail to set area tag ')
Expand Down
8 changes: 7 additions & 1 deletion components/mpas-ocean/driver/ocn_comp_mct.F
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,13 @@ end subroutine xml_stream_get_attributes
write(ocnLogUnit,*) 'Fail to set MOAB fields '
endif


! add domain tags
tagname=trim(seq_flds_dom_fields)//C_NULL_CHAR
tagtype = 1
ierr = iMOAB_DefineTagStorage(MPOID, tagname, tagtype, numco, tagindex )
if ( ierr /= 0 ) then
write(ocnLogUnit,*) 'Fail to set define dom fields '
endif
ent_type = 1 ! cells


Expand Down
9 changes: 9 additions & 0 deletions components/mpas-seaice/driver/ice_comp_mct.F
Original file line number Diff line number Diff line change
Expand Up @@ -753,6 +753,15 @@ end subroutine xml_stream_get_attributes
if ( ierrmb /= 0 ) then
call mpas_log_write('cannot set tags for MOAB x2i fields to zero' // trim(seq_flds_x2i_fields), MPAS_LOG_ERR)
endif

! add domain tags
tagname=trim(seq_flds_dom_fields)//C_NULL_CHAR
tagtype = 1
ierrmb = iMOAB_DefineTagStorage(MPSIID, tagname, tagtype, numco, tagindex )
if ( ierrmb /= 0 ) then
call mpas_log_write('Fail to set define dom fields ', MPAS_LOG_ERR)
endif

#endif


Expand Down

0 comments on commit 4cc2ced

Please sign in to comment.