Skip to content

Commit

Permalink
[skip ci] Eliminate MPI stuff for now since it causes compilation iss…
Browse files Browse the repository at this point in the history
…ues.
  • Loading branch information
raback committed Jan 9, 2025
1 parent ffd3992 commit bd68819
Showing 1 changed file with 32 additions and 25 deletions.
57 changes: 32 additions & 25 deletions fem/src/modules/LevelSet/LevelSetDistance.F90
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ SUBROUTINE LevelSetDistance( Model,Solver,Timestep,TransientSimulation )
REAL(KIND=dp), ALLOCATABLE :: ElemVelo(:,:), SurfaceFlux(:)
REAL(KIND=dp) :: at,totat,st,totst
CHARACTER(LEN=MAX_NAME_LEN) :: LevelSetVariableName
INTEGER status(MPI_STATUS_SIZE)

SAVE ElementNodes, ElemVelo, Direction, ZeroNodes, TimesVisited, &
Distance, DistancePerm, ExtractAllocated, DistanceAllocated
Expand Down Expand Up @@ -182,35 +181,43 @@ SUBROUTINE LevelSetDistance( Model,Solver,Timestep,TransientSimulation )
CALL Info( 'LevelSetDistance',Message, Level=4 )
recZeroLevels = ZeroLevels

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! BEGIN of SENDING-RECEIVING ZeroLevels array
! BEGIN of SENDING-RECEIVING ZeroLevels array
IF (Parallel) THEN
nPEs=ParEnv % PEs
CALL MPI_AllGather(ZeroLevels,1,MPI_INTEGER,pZeroLevels,1,MPI_INTEGER,ELMER_COMM_WORLD, ierr)
recZeroLevels = SUM(pZeroLevels(1:nPEs))
ALLOCATE(send(ZeroLevels),recv(recZeroLevels),recZeroNodes(recZeroLevels,2,2))
disps(1)=0
Do i=2,nPes
disps(i)=disps(i-1)+pZeroLevels(i-1)
END DO
DO i=1,2
DO j=1,2
IF (ZeroLevels.GT.0) send(1:ZeroLevels)=ZeroNodes(1:ZeroLevels,i,j)
CALL MPI_AllGatherv(send,ZeroLevels,MPI_DOUBLE_PRECISION,recv,&
pZeroLevels,disps,MPI_DOUBLE_PRECISION,ELMER_COMM_WORLD, ierr)
recZeroNodes(1:recZeroLevels,i,j)=recv(1:recZeroLevels)
#if 0
BLOCK
INTEGER status(MPI_STATUS_SIZE)

nPEs=ParEnv % PEs
CALL MPI_AllGather(ZeroLevels,1,MPI_INTEGER,pZeroLevels,1,MPI_INTEGER,ELMER_COMM_WORLD, ierr)
recZeroLevels = SUM(pZeroLevels(1:nPEs))
ALLOCATE(send(ZeroLevels),recv(recZeroLevels),recZeroNodes(recZeroLevels,2,2))
disps(1)=0
Do i=2,nPes
disps(i)=disps(i-1)+pZeroLevels(i-1)
END DO
DO i=1,2
DO j=1,2
IF (ZeroLevels > 0) send(1:ZeroLevels) = ZeroNodes(1:ZeroLevels,i,j)
CALL MPI_AllGatherv(send,ZeroLevels,MPI_DOUBLE_PRECISION,recv,&
pZeroLevels,disps,MPI_DOUBLE_PRECISION,ELMER_COMM_WORLD, ierr)
recZeroNodes(1:recZeroLevels,i,j) = recv(1:recZeroLevels)
END DO
END DO
END DO

ZeroLevels=recZeroLevels
IF (size(ZeroNodes,1).LT.ZeroLevels) THEN
DEALLOCATE(ZeroNodes)
ALLOCATE(ZeroNodes(ZeroLevels,2,2))
END IF
ZeroNodes(1:ZeroLevels,1:2,1:2)=recZeroNodes(1:recZeroLevels,1:2,1:2)
ZeroLevels=recZeroLevels
IF (SIZE(ZeroNodes,1) < ZeroLevels) THEN
DEALLOCATE(ZeroNodes)
ALLOCATE(ZeroNodes(ZeroLevels,2,2))
END IF
ZeroNodes(1:ZeroLevels,1:2,1:2) = recZeroNodes(1:recZeroLevels,1:2,1:2)

DEALLOCATE(send,recv,recZeroNodes)
DEALLOCATE(send,recv,recZeroNodes)
END BLOCK
#else
CALL Fatal('LevelSetDistance','Subroutine not compiled with MPI!')
#endif
ENDIF
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! END of SENDING-RECEIVING ZeroLevels array
! END of SENDING-RECEIVING ZeroLevels array

IF( ZeroLevels == 0) THEN
CALL Warn('LevelSetDistance','The does not seem to be a zero level-set present, exiting...')
Expand Down

0 comments on commit bd68819

Please sign in to comment.