diff --git a/CMakeListsMachine.txt b/CMakeListsMachine.txt index 3abb27a5a..df22d57bd 100644 --- a/CMakeListsMachine.txt +++ b/CMakeListsMachine.txt @@ -163,6 +163,31 @@ ELSE() ENDIF() ENDIF() +# ========================================================================= +# CHECK SUPPORT FOR VARIOUS FORTRAN (2003,2008) FEATURES +# ========================================================================= +INCLUDE(CheckSourceCompiles) +CHECK_SOURCE_COMPILES(Fortran +"MODULE F03MOD +IMPLICIT NONE +PRIVATE +CONTAINS +! Check for MOVE_ALLOC feature +SUBROUTINE F03_MOVE_ALLOC() +REAL,ALLOCATABLE::a(:,:),b(:,:) +ALLOCATE(a(3,3)) +CALL MOVE_ALLOC(a,b) +END SUBROUTINE F03_MOVE_ALLOC +END MODULE F03MOD + +PROGRAM F03PROG +END" +Fortran2003Check) + +IF(NOT Fortran2003Check) + MESSAGE(ERROR "Failed to compile basic Fortran2003 programm! Please ensure your compiler is up-to-date!") +ENDIF() + MESSAGE(STATUS "Compiling with [${CMAKE_Fortran_COMPILER_ID}] (v${CMAKE_Fortran_COMPILER_VERSION}) fortran compiler using [${PICLAS_INSTRUCTION}] instruction") # ========================================================================= diff --git a/src/particles/restart/particle_readin.f90 b/src/particles/restart/particle_readin.f90 index 33e98f3f1..643d5c3d3 100644 --- a/src/particles/restart/particle_readin.f90 +++ b/src/particles/restart/particle_readin.f90 @@ -282,11 +282,7 @@ SUBROUTINE ParticleReadin() DO iProc = 2,nProcessors MPIoffsetPartRecv(iProc) = SUM(MPInPartRecv(1:iProc-1)) END DO - - DEALLOCATE(PartInt) - ALLOCATE(PartInt(PartIntSize,FirstElemInd:LastElemInd)) - PartInt = PartIntTmp - DEALLOCATE(PartIntTmp) + CALL MOVE_ALLOC(PartIntTmp,PartInt) PartIntExists = .TRUE. locnPart = PartInt(ELEM_LastPartInd,LastElemInd)-PartInt(ELEM_FirstPartInd,FirstElemInd) @@ -308,12 +304,8 @@ SUBROUTINE ParticleReadin() ! Communicate PartData over MPI CALL MPI_ALLTOALLV(PartData,counts_send,disp_send,MPI_STRUCT,PartDataTmp,counts_recv,disp_recv,MPI_STRUCT,MPI_COMM_WORLD,iError) END ASSOCIATE - - DEALLOCATE(PartData) - ALLOCATE(PartData(PartDataSize,offsetnPart+1_IK:offsetnPart+locnPart)) - PartData = PartDataTmp - DEALLOCATE(PartDataTmp) - PartDataExists = .TRUE. + CALL MOVE_ALLOC(PartDataTmp,PartData) + PartDataExists = .TRUE. ! ------------------------------------------------ ! DSMC-specific arrays @@ -337,11 +329,7 @@ SUBROUTINE ParticleReadin() ! Communicate VibQuantData over MPI CALL MPI_ALLTOALLV(VibQuantData,counts_send,disp_send,MPI_STRUCT,VibQuantDataTmp,counts_recv,disp_recv,MPI_STRUCT,MPI_COMM_WORLD,iError) END ASSOCIATE - - DEALLOCATE(VibQuantData) - ALLOCATE(VibQuantData(MaxQuantNum,offsetnPart+1_IK:offsetnPart+locnPart)) - VibQuantData = VibQuantDataTmp - DEALLOCATE(VibQuantDataTmp) + CALL MOVE_ALLOC(VibQuantDataTmp,VibQuantData) END IF ! Electronic @@ -363,11 +351,7 @@ SUBROUTINE ParticleReadin() ! Communicate ElecDistriData over MPI CALL MPI_ALLTOALLV(ElecDistriData,counts_send,disp_send,MPI_STRUCT,ElecDistriDataTmp,counts_recv,disp_recv,MPI_STRUCT,MPI_COMM_WORLD,iError) END ASSOCIATE - - DEALLOCATE(ElecDistriData) - ALLOCATE(ElecDistriData(MaxElecQuant,offsetnPart+1_IK:offsetnPart+locnPart)) - ElecDistriData = ElecDistriDataTmp - DEALLOCATE(ElecDistriDataTmp) + CALL MOVE_ALLOC(ElecDistriDataTmp,ElecDistriData) END IF ! Ambipolar Diffusion @@ -389,11 +373,7 @@ SUBROUTINE ParticleReadin() ! Communicate AD_Data over MPI CALL MPI_ALLTOALLV(AD_Data,counts_send,disp_send,MPI_STRUCT,AD_DataTmp,counts_recv,disp_recv,MPI_STRUCT,MPI_COMM_WORLD,iError) END ASSOCIATE - - DEALLOCATE(AD_Data) - ALLOCATE(AD_Data(3,offsetnPart+1_IK:offsetnPart+locnPart)) - AD_Data = AD_DataTmp - DEALLOCATE(AD_DataTmp) + CALL MOVE_ALLOC(AD_DataTmp,AD_Data) END IF END IF ! useDSMC diff --git a/src/restart/restart_field.f90 b/src/restart/restart_field.f90 index 4b45eda49..728c631dc 100644 --- a/src/restart/restart_field.f90 +++ b/src/restart/restart_field.f90 @@ -234,11 +234,7 @@ SUBROUTINE FieldRestart() CALL MPI_TYPE_COMMIT(MPI_STRUCT,iError) CALL MPI_ALLTOALLV(U,counts_send,disp_send,MPI_STRUCT,UTmp,counts_recv,disp_recv,MPI_STRUCT,MPI_COMM_WORLD,iError) END ASSOCIATE - - DEALLOCATE(U) - ALLOCATE(U(PP_nVar,0:PP_N,0:PP_N,0:PP_N,nElems)) - U = UTmp - DEALLOCATE(UTmp) + CALL MOVE_ALLOC(UTmp,U) END IF ! ALLOCATED(U) #endif /*USE_HDG*/