Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
Random number generation corrected
  • Loading branch information
OuroPablo authored Mar 16, 2018
1 parent e8f1396 commit 71ea284
Showing 1 changed file with 35 additions and 22 deletions.
57 changes: 35 additions & 22 deletions source/SEM.for
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
IMPLICIT NONE
DOUBLE PRECISION :: VOL,Ly,Lz,ENNE,XMIN,XMAX,YMIN,TI
DOUBLE PRECISION :: YMAX,ZMIN,ZMAX,PI,U0,HU,RIZ,RDIVz,UAVE(3)
DOUBLE PRECISION :: SIGMA_VALUE,NE_SEM,MAXVSEM,MINVSEM
DOUBLE PRECISION :: SIGMA_VALUE,NE_SEM,MAXVSEM,MINVSEM,rrandom
INTEGER :: DIVY,DIVZ,IY,IZ,II,N,I,J,M,IT,IGLOBAL
INTEGER,allocatable,dimension(:)::lsy,lsz,ley,lez
!THE BOX DIMENSIONS ARE DIFINED AS [XLENGHT] * [Ly] * [Lz]
Expand Down Expand Up @@ -111,17 +111,22 @@

UAVE = UAVE / (DIVY * DIVZ)
VOL = (XMAX - XMIN) * (YMAX - YMIN) * (ZMAX - ZMIN)

call RANDOM_SEED()
!GENERATION OF THE EDDY LOCATION INSIDE THE BOX AND INITIALIZATION OF THE [Ksem] VECTOR
DO II=1,N
X_EDDY(1,II) = (XMAX - XMIN) * RAND() + XMIN
X_EDDY(2,II) = (YMAX - YMIN) * RAND() + YMIN
X_EDDY(3,II) = (ZMAX - ZMIN) * RAND() + ZMIN

call RANDOM_NUMBER(rrandom)
X_EDDY(1,II) = (XMAX - XMIN) * rrandom + XMIN
X_EDDY(2,II) = (YMAX - YMIN) * rrandom + YMIN
X_EDDY(3,II) = (ZMAX - ZMIN) * rrandom + ZMIN
Ksem(II) = 0
!INITIALIZATION OF THE INTENSITIES. FOR EVERY DIRECTION THE AVERAGE INTENSITY VALUE IS CALCULATED AND
!IT IS FORCED TO BE LOWER THAN THE [VLIM] VALUE
EPSILO(1,II) = (RAND()*2.0D0 - 1.0D0)
EPSILO(2,II) = (RAND()*2.0D0 - 1.0D0)
EPSILO(3,II) = (RAND()*2.0D0 - 1.0D0)
call RANDOM_NUMBER(rrandom)
EPSILO(1,II) = (rrandom*2.0D0 - 1.0D0)
EPSILO(2,II) = (rrandom*2.0D0 - 1.0D0)
EPSILO(3,II) = (rrandom*2.0D0 - 1.0D0)
END DO
!INITIALIZATION OF THE [R(3,3)] MATRIX WITH THE CHOLENSKY DECOMPOSITION
!OF THE REYNOLDS STRESS TENSOR
Expand Down Expand Up @@ -196,42 +201,50 @@
!THE SEM BOX DEFINED EARLIER
!WHEN A EDDY IS RE-GENERATE THE Ksem(I) FACTOR ASSUME THE 1 VALUE. THIS VALUE IS USED LATER TO
!GENERATE A NEW INTENSITY FOR THE NEW EDDY

IF (X_EDDY(1,II) > XMAX) THEN
call RANDOM_NUMBER(rrandom)
X_EDDY(1,II) = XMIN
X_EDDY(2,II) = (YMAX - YMIN) * RAND() + YMIN
X_EDDY(3,II) = (ZMAX - ZMIN) * RAND() + ZMIN
X_EDDY(2,II) = (YMAX - YMIN) * rrandom + YMIN
X_EDDY(3,II) = (ZMAX - ZMIN) * rrandom + ZMIN
Ksem(II) = 1
ELSE IF (X_EDDY(1,II) < XMIN) THEN
call RANDOM_NUMBER(rrandom)
X_EDDY(1,II) = XMAX
X_EDDY(2,II) = (YMAX - YMIN) * RAND() + ZMIN
X_EDDY(3,II) = (ZMAX - ZMIN) * RAND() + ZMIN
X_EDDY(2,II) = (YMAX - YMIN) * rrandom + ZMIN
X_EDDY(3,II) = (ZMAX - ZMIN) * rrandom + ZMIN
Ksem(II) = 1
ELSE IF (X_EDDY(2,II) > YMAX) THEN
X_EDDY(1,II) = (XMAX - XMIN) * RAND() + XMIN
call RANDOM_NUMBER(rrandom)
X_EDDY(1,II) = (XMAX - XMIN) * rrandom + XMIN
X_EDDY(2,II) = YMIN
X_EDDY(3,II) = (ZMAX - ZMIN) * RAND() + ZMIN
X_EDDY(3,II) = (ZMAX - ZMIN) * rrandom + ZMIN
Ksem(II) = 1
ELSE IF (X_EDDY(2,II) < YMIN) THEN
X_EDDY(1,II) = (XMAX - XMIN) * RAND() + XMIN
call RANDOM_NUMBER(rrandom)
X_EDDY(1,II) = (XMAX - XMIN) * rrandom + XMIN
X_EDDY(2,II) = YMAX
X_EDDY(3,II) = (ZMAX - ZMIN) * RAND() + ZMIN
X_EDDY(3,II) = (ZMAX - ZMIN) * rrandom + ZMIN
Ksem(II) = 1
ELSE IF (X_EDDY(3,II) > ZMAX) THEN
X_EDDY(1,II) = (XMAX - XMIN) * RAND() + XMIN
X_EDDY(2,II) = (YMAX - YMIN) * RAND() + ZMIN
call RANDOM_NUMBER(rrandom)
X_EDDY(1,II) = (XMAX - XMIN) * rrandom + XMIN
X_EDDY(2,II) = (YMAX - YMIN) * rrandom + ZMIN
X_EDDY(3,II) = ZMIN
Ksem(II) = 1
ELSE IF (X_EDDY(3,II) < ZMIN) THEN
X_EDDY(1,II) = (XMAX - XMIN) * RAND() + XMIN
X_EDDY(2,II) = (YMAX - YMIN) * RAND() + ZMIN
call RANDOM_NUMBER(rrandom)
X_EDDY(1,II) = (XMAX - XMIN) * rrandom + XMIN
X_EDDY(2,II) = (YMAX - YMIN) * rrandom + ZMIN
X_EDDY(3,II) = ZMAX
Ksem(II) = 1
END IF
!INTENSITY GENERATION FOR THE RE-CREATED EDDIES. WE ARE USING THE Ksem FACTOR AS EXPLAINED FATOR.
IF (Ksem(II)== 1) THEN
EPSILO(3,II) = (RAND()*2.0D0 - 1.0D0)
EPSILO(2,II) = (RAND()*2.0D0 - 1.0D0)
EPSILO(1,II) = (RAND()*2.0D0 - 1.0D0)
call RANDOM_NUMBER(rrandom)
EPSILO(3,II) = (rrandom*2.0D0 - 1.0D0)
EPSILO(2,II) = (rrandom*2.0D0 - 1.0D0)
EPSILO(1,II) = (rrandom*2.0D0 - 1.0D0)
END IF
Ksem(II) = 0
END DO
Expand Down

0 comments on commit 71ea284

Please sign in to comment.