Skip to content

Commit

Permalink
added functionality for ENERGY spectra of TGV
Browse files Browse the repository at this point in the history
  • Loading branch information
TakisCFD authored Jul 1, 2021
1 parent c77aa96 commit 70fa61f
Show file tree
Hide file tree
Showing 5 changed files with 247 additions and 8 deletions.
3 changes: 2 additions & 1 deletion CODE/declarations.f90
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ MODULE DECLARATION
REAL::LAMZ !FLAGS TO BE USED FOR RESTARTING
REAL::ALPHA,BETA !FLAGS TO BE USED FOR RESTARTING
REAL::OUT_TIME !FINAL TIME TO WRITE OUTPUT FOR UNSTEADY SIMULATIONS
REAL::EVERY_TIME !FINAL TIME TO WRITE OUTPUT FOR UNSTEADY SIMULATIONS
REAL::XPER !PERIODICITY IN X AXIS
REAL::YPER !PERIODICITY IN Y AXIS
REAL::ZPER !PERIODICITY IN Z AXIS
Expand Down Expand Up @@ -407,7 +408,7 @@ MODULE DECLARATION
real,allocatable,dimension(:)::VQR,VQR1,XQR,MATRIX_B,MATRIX_X,BASEFACEVAL,BASEFACGVAL,MOMENT,WEIGHTINV,VECTOR,INTBS,XDER,YDER,ZDER
integer,allocatable,dimension(:)::permutation,permutationg

!$OMP THREADPRIVATE(NORMALVECT,MODEU,Q,R,QT,WEFF,MATRIX_A,LSQM,XCC,vgg,VELLSQMAT,MATRIX_SOLUTION,MATRIXFACE,JUSTCHECK,PDIM,XQR,VQR,VQR1,PQR,INVR,LSCQM,LSCQM2,ivgt)
!$OMP THREADPRIVATE(NORMALVECT,DELTAF,VELNorMAL,MODEU,Q,R,QT,WEFF,MATRIX_A,LSQM,XCC,vgg,VELLSQMAT,MATRIX_SOLUTION,MATRIXFACE,JUSTCHECK,PDIM,XQR,VQR,VQR1,PQR,INVR,LSCQM,LSCQM2,ivgt)
!$OMP THREADPRIVATE(QFF,RFF,QTFF,INVRFF,AINVJT,MATRIX_B,MATRIX_X,BASEFACEVAL,BASEFACGVAL,MOMENT,WEIGHTINV,VECTOR,INTBS,PERMUTATION,PERMUTATIONG,XDER,YDER,ZDER)


Expand Down
8 changes: 4 additions & 4 deletions CODE/implicit_time.f90
Original file line number Diff line number Diff line change
Expand Up @@ -2611,7 +2611,7 @@ SUBROUTINE RELAXATION_LUMFREE(N)
du1=zero
call EXHBOUNDHIGHER2(N)

!$OMP MASTER
!$OMP DO
DO I=1,kmaxe !FORWARD SWEEP !loop 1
iconsidered=i
b1_imp=zero
Expand Down Expand Up @@ -2654,11 +2654,11 @@ SUBROUTINE RELAXATION_LUMFREE(N)


END DO
!$OMP END MASTER
!$OMP END DO

call EXHBOUNDHIGHERlu(N)

!$OMP MASTER
!$OMP DO
DO I=kmaxe,1,-1 !FORWARD SWEEP !loop 1
iconsidered=i
b1_imp=zero
Expand Down Expand Up @@ -2686,7 +2686,7 @@ SUBROUTINE RELAXATION_LUMFREE(N)


END DO
!$OMP END MASTER
!$OMP END DO



Expand Down
208 changes: 208 additions & 0 deletions CODE/io.f90
Original file line number Diff line number Diff line change
Expand Up @@ -17155,10 +17155,218 @@ END SUBROUTINE FIX_NODES_LOCAL



SUBROUTINE CHECKPOINTv4(N)
!> @brief
!> This subroutine is writing the checkpointing files
IMPLICIT NONE
INTEGER,INTENT(IN)::N
INTEGER,ALLOCATABLE,DIMENSION(:)::ICELL,ICELLA
REAL,ALLOCATABLE,DIMENSION(:)::VALUESA,VALUESS
REAL,ALLOCATABLE,DIMENSION(:,:)::xbin
INTEGER::I,K,KMAXE,J,JK,ICPUID,nvar,IMAXP,DUMG,DUML,jj,igfs
CHARACTER(LEN=20)::PROC,RESTFILE,PROC3
REAL,ALLOCATABLE,DIMENSION(:)::IGINT,TGINT
KMAXE=XMPIELRANK(N)
igfs=t

WRITE(PROC3,FMT='(I10)') igfs
RESTFILE="REST_"//TRIM(ADJUSTL(PROC3))//".dat"!//TRIM(ADJUSTL(PROC4))

ICPUID=N

IF (N.EQ.0)THEN
OPEN(1086,FILE=RESTFILE,FORM='UNFORMATTED',STATUS='REPLACE',ACTION='WRITE')
end if

KMAXE=XMPIELRANK(N)

DUMG=KMAXE


call mpi_barrier(mpi_comm_world,IERROR) !NOT NEEDED

CALL MPI_ALLREDUCE(DUMG,DUML,1,MPI_INTEGER,MPI_MAX,MPI_COMM_WORLD,IERROR)
IMAXP=DUML

ALLOCATE(ICELL(IMAXP))
ICELL=0

DO I=1,KMAXE
ICELL(I)=IELEM(N,I)%IHEXGL
END DO


IF (N.EQ.0)THEN
ALLOCATE(ICELLA(IMAXP*ISIZE))
ICELLA=0

END IF

call MPI_GATHER(ICELL,IMAXP,MPI_INTEGER,icella,imaxp,mpi_integer,0,MPI_COMM_WORLD,IERROR)

deallocate (icell)

IF (N.EQ.0) then
ALLOCATE(VALUESA(IMAXP*ISIZE))
allocate(xbin(imaxe,5+turbulenceequations+passivescalar))
VALUESA=ZERO
END IF


ALLOCATE(VALUESS(imaxp));VALUESS=ZERO


do jj=1,5
DO I=1,KMAXE
LEFTV(1:NOF_vARIABLES)=U_C(I)%VAL(1,1:NOF_vARIABLES)
CALL CONS2PRIM(N)
VALUESS(I)=leftv(jj)
END DO
call MPI_GATHER(VALUESS,imaxp,MPI_DOUBLE_PRECISION,VALUESA,imaxp,mpi_DOUBLE_PRECISION,0,MPI_COMM_WORLD,IERROR)

IF (N.EQ.0)THEN
do i=1,imaxp*isize
if (icella(i).gt.0)then
xbin(icella(i),jj)=valuesa(i)
end if
end do
end if

end do



! CALL MPI_BARRIER(MPI_COMM_WORLD,IERROR)

IF (N.EQ.0)THEN

DO I=1,IMAXE
WRITE(1086)XBIN(i,1:nof_Variables)
END DO

DEALLOCATE(XBIN,ICELLA,VALUESA)
close(1086)
END IF

DEALLOCATE(VALUESS)







END SUBROUTINE CHECKPOINTv4


SUBROUTINE CHECKPOINTv3(N)
!> @brief
!> This subroutine is writing the checkpointing files
IMPLICIT NONE
INTEGER,INTENT(IN)::N
INTEGER,ALLOCATABLE,DIMENSION(:)::ICELL,ICELLA
REAL,ALLOCATABLE,DIMENSION(:)::VALUESA,VALUESS
REAL,ALLOCATABLE,DIMENSION(:,:)::xbin
INTEGER::I,K,KMAXE,J,JK,ICPUID,nvar,IMAXP,DUMG,DUML,jj
CHARACTER(LEN=20)::PROC,RESTFILE,PROC3
REAL,ALLOCATABLE,DIMENSION(:)::IGINT,TGINT
KMAXE=XMPIELRANK(N)



RESTFILE="CORD.dat"

ICPUID=N

IF (N.EQ.0)THEN
OPEN(1086,FILE=RESTFILE,FORM='UNFORMATTED',STATUS='REPLACE',ACTION='WRITE')
end if

KMAXE=XMPIELRANK(N)

DUMG=KMAXE


call mpi_barrier(mpi_comm_world,IERROR) !NOT NEEDED

CALL MPI_ALLREDUCE(DUMG,DUML,1,MPI_INTEGER,MPI_MAX,MPI_COMM_WORLD,IERROR)
IMAXP=DUML

ALLOCATE(ICELL(IMAXP))
ICELL=0

DO I=1,KMAXE
ICELL(I)=IELEM(N,I)%IHEXGL
END DO


IF (N.EQ.0)THEN
ALLOCATE(ICELLA(IMAXP*ISIZE))
ICELLA=0

END IF

call MPI_GATHER(ICELL,IMAXP,MPI_INTEGER,icella,imaxp,mpi_integer,0,MPI_COMM_WORLD,IERROR)

deallocate (icell)

IF (N.EQ.0) then
ALLOCATE(VALUESA(IMAXP*ISIZE))
allocate(xbin(imaxe,3))
VALUESA=ZERO
END IF


ALLOCATE(VALUESS(imaxp));VALUESS=ZERO


do jj=1,3
DO I=1,KMAXE
IF (JJ.EQ.1)THEN
VALUESS(I)=IELEM(N,I)%XXC
END IF
IF (JJ.EQ.2)THEN
VALUESS(I)=IELEM(N,I)%YYC
END IF
IF (JJ.EQ.3)THEN
VALUESS(I)=IELEM(N,I)%ZZC
END IF
END DO
call MPI_GATHER(VALUESS,imaxp,MPI_DOUBLE_PRECISION,VALUESA,imaxp,mpi_DOUBLE_PRECISION,0,MPI_COMM_WORLD,IERROR)

IF (N.EQ.0)THEN
do i=1,imaxp*isize
if (icella(i).gt.0)then
xbin(icella(i),jj)=valuesa(i)
end if
end do
end if

end do



! CALL MPI_BARRIER(MPI_COMM_WORLD,IERROR)

IF (N.EQ.0)THEN

DO I=1,IMAXE
WRITE(1086)XBIN(i,1:3)
END DO

DEALLOCATE(XBIN,ICELLA,VALUESA)
close(1086)
END IF

DEALLOCATE(VALUESS)







END SUBROUTINE CHECKPOINTv3



Expand Down
4 changes: 2 additions & 2 deletions CODE/memory.f90
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ SUBROUTINE IMPALLOCATE(N)

IF (RELAX.EQ.3)THEN

ALLOCATE (IMPDIAG_MF(KMAXE),DELTAF(1:nof_Variables+TURBULENCEEQUATIONS+PASSIVESCALAR))
ALLOCATE (IMPDIAG_MF(KMAXE))
ALLOCATE (IMPOFF_MF(KMAXE,INTERF))
ALLOCATE (IMPdu(KMAXE,1:nof_Variables+TURBULENCEEQUATIONS+PASSIVESCALAR))

Expand Down Expand Up @@ -1690,7 +1690,7 @@ SUBROUTINE MEMORY2

if (relax.eq.3)then

ALLOCATE(B1_imp(1:nof_Variables),DU1(1:nof_Variables))
ALLOCATE(B1_imp(1:nof_Variables),DU1(1:nof_Variables),DELTAF(1:nof_Variables+TURBULENCEEQUATIONS+PASSIVESCALAR))
IF ((TURBULENCE.GT.0).OR.(PASSIVESCALAR.GT.0))THEN
ALLOCATE(DUT1(1:TURBULENCEEQUATIONS+PASSIVESCALAR))
ALLOCATE(B1T(1:TURBULENCEEQUATIONS+PASSIVESCALAR))
Expand Down
32 changes: 31 additions & 1 deletion CODE/time_p.f90
Original file line number Diff line number Diff line change
Expand Up @@ -4069,14 +4069,20 @@ SUBROUTINE TIME_MARCHING(N)
IMPLICIT NONE
INTEGER,INTENT(IN)::N
real,dimension(1:5)::DUMMYOUT,DUMMYIN
INTEGER::I,KMAXE
INTEGER::I,KMAXE,TTIME
REAL::CPUT1,CPUT2,CPUT3,CPUT4,CPUT5,CPUT6,CPUT8,timec3,TIMEC1,TIMEC4,TIMEC8,TOTV1,TOTV2,DUMEtg1,DUMEtg2,TOTK
kill=0
T=RES_TIME
iscoun=1

EVERY_TIME=RES_TIME+1.0D0


!$OMP BARRIER
!$OMP MASTER
IF (INITCOND.eq.95)THEN
CALL CHECKPOINTv3(N)
end if
CPUT1=CPUX1(1)
CPUT4=CPUX1(1)
CPUT5=CPUX1(1)
Expand Down Expand Up @@ -4190,9 +4196,17 @@ SUBROUTINE TIME_MARCHING(N)

if (rungekutta.GE.11)then
dt=timestep
IF (INITCOND.eq.95)THEN
DT=MIN(DT,OUT_TIME-T,EVERY_TIME-T)
ELSE
DT=MIN(DT,OUT_TIME-T)
END IF
else
IF (INITCOND.eq.95)THEN
DT=MIN(DT,OUT_TIME-T,EVERY_TIME-T)
ELSE
DT=MIN(DT,OUT_TIME-T)
END IF
end if

!$OMP END MASTER
Expand Down Expand Up @@ -4332,6 +4346,22 @@ SUBROUTINE TIME_MARCHING(N)
CPUT1=MPI_WTIME()
END IF

IF (INITCOND.eq.95)THEN
if (mod(T, 1.0D0) .eq. 0) then
CALL VOLUME_SOLUTION_WRITE
if (outsurf.eq.1)then
call surface_SOLUTION_WRITE
end if
IF (INITCOND.eq.95)THEN
CALL CHECKPOINTv4(N)
END IF
EVERY_TIME=EVERY_TIME+1.0D0


END IF
END IF




IF (TIMEC8.GE.IEVERYAV)THEN
Expand Down

0 comments on commit 70fa61f

Please sign in to comment.