Skip to content

Commit

Permalink
Merge pull request #12257 from drjfloyd/master
Browse files Browse the repository at this point in the history
FDS Source: Always make a random seed, and RND_SEED.
  • Loading branch information
drjfloyd authored Nov 30, 2023
2 parents 13e0b4d + 046fbfc commit 39bd06e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
5 changes: 4 additions & 1 deletion Manuals/FDS_User_Guide/FDS_User_Guide.tex
Original file line number Diff line number Diff line change
Expand Up @@ -8714,6 +8714,8 @@ \subsection{Default Initial Velocity Field}

FDS initializes the flow field with a very small amount of ``noise'' to prevent the development of a perfectly symmetric flow when the boundary and initial conditions are perfectly symmetric. To turn this off, set {\ct NOISE=F} To control the amount of noise, set {\ct NOISE\_VELOCITY}. Its default value is 0.005~m/s.

FDS uses a predefined random seed for the random number generator which ensures that each mesh is seeded with a different number. A predefined seed means that all simulations will use the same sequence of random numbers for a given mesh. You can change the random seed by specifying {\ct RND\_SEED} on the {\ct MISC} line. This defines a constant value that is added to the predefined random seed on each mesh.

\subsection{Turning off the Flow Field}
\label{info:freeze_velocity}

Expand Down Expand Up @@ -12077,7 +12079,8 @@ \section{\texorpdfstring{{\tt MISC}}{MISC} (Miscellaneous Parameters)}
{\ct RAMP\_GZ} & Character & Section~\ref{info:GVEC} & & \\ \hline
{\ct RESTART} & Logical & Section~\ref{info:restart} & & {\ct F} \\ \hline
{\ct RESTART\_CHID} & Character & Section~\ref{info:restart} & & {\ct CHID} \\ \hline
{\ct SC} & Real & Section~\ref{info:LES} & & 0.5 \\ \hline
{\ct RND\_SEED} & Integer & Section~\ref{info:restart} & & \\ \hline
{\ct SC} & Real & Section~\ref{info:NOISE} & & 0.5 \\ \hline
{\ct SHARED\_FILE\_SYSTEM} & Logical & Section~\ref{info:multimesh} & & {\ct T} \\ \hline
{\ct SIMULATION\_MODE} & Character & Section~\ref{Sim_Mode} & & {\ct 'VLES'} \\ \hline
{\ct SMOKE3D\_16} & Logical & Section~\ref{info:smoke16} & & {\ct F} \\ \hline
Expand Down
3 changes: 3 additions & 0 deletions Source/cons.f90
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ MODULE GLOBAL_CONSTANTS
INTEGER, PARAMETER :: OBST_CONE_TYPE=3 !< Flag for OB\%SHAPE_TYPE
INTEGER, PARAMETER :: OBST_BOX_TYPE=4 !< Flag for OB\%SHAPE_TYPE


INTEGER :: FUEL_INDEX=0 !< Index for FUEL in SIMPLE_CHEMISTRY model
INTEGER :: O2_INDEX=0 !< Index for O2 in SIMPLE_CHEMISTRY model
INTEGER :: N2_INDEX=0 !< Index for N2 in SIMPLE_CHEMISTRY model
Expand All @@ -159,6 +160,8 @@ MODULE GLOBAL_CONSTANTS
INTEGER :: STOP_STATUS=NO_STOP !< Indicator of whether and why to stop the job
INTEGER :: INPUT_FILE_LINE_NUMBER=0 !< Indicator of what line in the input file is being read

INTEGER :: RND_SEED=0 !< User RANDOM_SEED

! Miscellaneous logical constants

LOGICAL :: HVAC_DEBUG=.FALSE. !< Output known hvac values to smokeview
Expand Down
4 changes: 3 additions & 1 deletion Source/init.f90
Original file line number Diff line number Diff line change
Expand Up @@ -4881,14 +4881,16 @@ SUBROUTINE INITIAL_NOISE(NM)
CALL RANDOM_SEED(SIZE=SIZE_RND)
ALLOCATE(SEED_RND(SIZE_RND),STAT=IZERO)
CALL CHKMEMERR('INITIAL_NOISE','SEED_RND',IZERO)
SEED_RND = 2819 * 13*NM
SEED_RND = 2819 * 13*NM + RND_SEED
CALL RANDOM_SEED(PUT=SEED_RND)
DEALLOCATE(SEED_RND)

DO I=1,NM
CALL RANDOM_NUMBER(RN2)
ENDDO

IF (.NOT. NOISE) RETURN

! Point to local mesh variables

CALL POINT_TO_MESH(NM)
Expand Down
2 changes: 1 addition & 1 deletion Source/main.f90
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ PROGRAM FDS

DO NM=LOWER_MESH_INDEX,UPPER_MESH_INDEX
IF (TGA_SURF_INDEX>0) CYCLE
IF (NOISE) CALL INITIAL_NOISE(NM)
CALL INITIAL_NOISE(NM)
IF (PERIODIC_TEST==1) CALL NS_ANALYTICAL_SOLUTION(NM,T_BEGIN,RK_STAGE=2)
IF (PERIODIC_TEST==2) CALL UVW_INIT(NM,UVW_FILE)
IF (PERIODIC_TEST==3) CALL COMPRESSION_WAVE(NM,0._EB,3)
Expand Down

0 comments on commit 39bd06e

Please sign in to comment.