Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ReadRandomSection.F90
Go to the documentation of this file.
1 ! *********************************************************************
2 ! * Rocstar Simulation Suite *
3 ! * Copyright@2015, Illinois Rocstar LLC. All rights reserved. *
4 ! * *
5 ! * Illinois Rocstar LLC *
6 ! * Champaign, IL *
7 ! * www.illinoisrocstar.com *
8 ! * sales@illinoisrocstar.com *
9 ! * *
10 ! * License: See LICENSE file in top level of distribution package or *
11 ! * http://opensource.org/licenses/NCSA *
12 ! *********************************************************************
13 ! *********************************************************************
14 ! * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, *
15 ! * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES *
16 ! * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND *
17 ! * NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR *
18 ! * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
19 ! * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
20 ! * Arising FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
21 ! * USE OR OTHER DEALINGS WITH THE SOFTWARE. *
22 ! *********************************************************************
23 !******************************************************************************
24 !
25 ! Purpose: read in user input related to random number generation
26 !
27 ! Description: none.
28 !
29 ! Input: user input file.
30 !
31 ! Output: global%randSeedOffset
32 !
33 ! Notes:
34 !
35 ! * The value of global%randSeedOffset should be 0 typically (the default).
36 ! It can be set to 1, 2, 3, etc. to perform runs in the same configuration,
37 ! but with the random number generators (in each region) seeded differently.
38 !
39 ! * Example input section:
40 !
41 !-----
42 ! # RANDOM
43 ! SEED_OFFSET 0 ! Offset for seed of RNG (default = 0, otherwise: 1,2,3,etc)
44 ! #
45 !-----
46 !
47 !******************************************************************************
48 !
49 ! $Id: ReadRandomSection.F90,v 1.5 2008/12/06 08:44:10 mtcampbe Exp $
50 !
51 ! Copyright: (c) 2003 by the University of Illinois
52 !
53 !******************************************************************************
54 
55 SUBROUTINE readrandomsection( global )
56 
57  USE moddatatypes
58  USE modglobal, ONLY : t_global
59  USE modinterfaces, ONLY : readsection
60  USE moderror
61  USE modparameters
62  IMPLICIT NONE
63 
64 ! ... parameters
65  TYPE(t_global), POINTER :: global
66 
67 ! ... local variables
68  INTEGER, PARAMETER :: nkeys_max = 10
69 
70  CHARACTER(CHRLEN) :: keys(nkeys_max)
71 
72  INTEGER :: ikeyseedoffset,ikeyseedtype,nkeys
73 
74  LOGICAL :: defined(nkeys_max)
75 
76  REAL(RFREAL) :: vals(nkeys_max)
77 
78 !******************************************************************************
79 
80  CALL registerfunction( global,'ReadRandomSection',&
81  'ReadRandomSection.F90' )
82 
83 ! begin -----------------------------------------------------------------------
84 
85 ! define keys
86 
87  ikeyseedoffset = 1
88  ikeyseedtype = 2
89  nkeys = 2
90 
91  keys(ikeyseedoffset) = 'SEEDOFFSET'
92  keys(ikeyseedtype) = 'SEEDTYPE'
93 
94  IF (nkeys > nkeys_max) CALL errorstop( global,err_exceeds_decl_mem,__line__ )
95 
96  CALL readsection( global,if_input,nkeys,keys,vals,defined )
97 
98  IF (defined(ikeyseedoffset).eqv..true.) global%randSeedOffset = &
99  abs(nint(vals(ikeyseedoffset)))
100 
101  IF (defined(ikeyseedtype).eqv..true.) global%randSeedType = &
102  abs(nint(vals(ikeyseedtype)))
103 
104 ! finalize --------------------------------------------------------------------
105 
106  CALL deregisterfunction( global )
107 
108 END SUBROUTINE readrandomsection
109 
110 !******************************************************************************
111 !
112 ! RCS Revision history:
113 !
114 ! $Log: ReadRandomSection.F90,v $
115 ! Revision 1.5 2008/12/06 08:44:10 mtcampbe
116 ! Updated license.
117 !
118 ! Revision 1.4 2008/11/19 22:17:23 mtcampbe
119 ! Added Illinois Open Source License/Copyright
120 !
121 ! Revision 1.3 2008/10/23 18:20:55 mtcampbe
122 ! Crazy number of changes to track and fix initialization and
123 ! restart bugs. Many improperly formed logical expressions
124 ! were fixed, and bug in allocation for data associated with
125 ! the BC_INFLOWVELTEMP boundary condition squashed in
126 ! RFLO_ReadBcInflowVelSection.F90.
127 !
128 ! Revision 1.2 2005/12/01 17:08:07 fnajjar
129 ! Added reading of randSeedType and code cleanup to remove underscore from OFFSET
130 !
131 ! Revision 1.1 2004/12/01 16:50:46 haselbac
132 ! Initial revision after changing case
133 !
134 ! Revision 1.1 2003/11/21 22:33:10 fnajjar
135 ! Updated Random Number Generator
136 !
137 !******************************************************************************
138 
139 
140 
141 
142 
143 
144 
subroutine readrandomsection(global)
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine readsection(global, fileID, nvals, keys, vals, defined)
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469