62 TYPE(t_region
),
POINTER :: regions(:)
68 INTEGER,
PARAMETER :: n_rvar = 1
69 INTEGER,
PARAMETER :: n_ivar_extra = 1
70 INTEGER,
PARAMETER :: randstate_offset = n_ivar_extra+1
71 INTEGER,
PARAMETER :: n_randstate = rand_total_size+n_ivar_extra
73 CHARACTER(2*CHRLEN+18) :: fname, fhead
74 CHARACTER(CHRLEN) :: rcsidentstring,
msg
77 INTEGER ::
status(mpi_status_size)
79 INTEGER :: errorflag, mti, randstate(n_randstate,1)
81 REAL(RFREAL) :: rvar(n_rvar,1)
89 global => regions(1)%global
92 'RFLO_ReadRandomState.F90' )
98 fhead = trim(global%inDir)//trim(global%casename)
100 SELECT CASE(global%solutFormat)
102 fhead = trim(fhead)//
'.randa_'
104 fhead = trim(fhead)//
'.randb_'
106 CALL
errorstop( global,err_unknown_format,__line__ )
109 IF (global%flowType == flow_unsteady)
THEN
110 WRITE(fname,
'(A,ES11.5)') trim(fhead), global%timeStamp
112 WRITE(fname,
'(A,I6.6)') trim(fhead), global%currentIter
115 INQUIRE(file=fname,exist=fileexists)
117 IF (.NOT.fileexists)
THEN
118 IF (global%myProcid == masterproc .AND. &
119 global%currentTime > 0._rfreal)
THEN
120 WRITE(stdout,
'(A)') solver_name// &
121 '### WARNING: No Random State file found: '// &
122 'Random Number Generator re-initialized'
129 IF (global%myProcid == masterproc)
THEN
131 SELECT CASE(global%solutFormat)
133 OPEN(if_rand_state,file=fname,
form=
'formatted',
status=
'old', &
136 OPEN(if_rand_state,file=fname,
form=
'unformatted',
status=
'old', &
139 CALL
errorstop( global,err_unknown_format,__line__ )
142 global%error = errorflag
143 IF (global%error /= 0) &
144 CALL
errorstop( global,err_file_open,__line__,
'File: '//trim(fname) )
151 IF (global%flowType==flow_unsteady.AND.global%currentTime/=rvar(1,1))
THEN
152 WRITE(
msg,1000) rvar(1,1),global%currentTime
153 CALL
errorstop( global,err_time_solution,__line__,
msg//
' File: '// &
161 DO ireg=1,global%nRegions
165 IF (global%myProcid == masterproc)
THEN
168 n_randstate,1,randstate )
170 IF (randstate(1,1) /= ireg) &
171 CALL
errorstop( global,err_region_number,__line__,
'File: '// &
177 mti = randstate(rand_mti_index+randstate_offset,1)
179 IF (mti < 0 .OR. mti > rand_buffer_size) &
180 CALL
errorstop( global,err_exceeds_decl_mem,__line__ )
183 IF (regions(ireg)%procid /= masterproc)
THEN
185 CALL mpi_send( randstate,n_randstate,mpi_integer, &
186 regions(ireg)%procid,ireg, &
187 global%mpiComm,global%mpierr )
188 IF (global%mpierr /=0) CALL
errorstop( global,err_mpi_trouble,__line__ )
194 IF (regions(ireg)%procid == global%myProcid)
THEN
196 CALL mpi_recv( randstate,n_randstate,mpi_integer,masterproc,ireg, &
197 global%mpiComm,
status,global%mpierr )
198 IF (global%mpierr /=0) CALL
errorstop( global,err_mpi_trouble,__line__ )
207 IF (regions(ireg)%procid == global%myProcid)
THEN
208 DO i=0,rand_total_size-1
209 regions(ireg)%randData%mt(
i) = randstate(
i+randstate_offset,1)
217 IF (global%myProcid == masterproc)
THEN
218 CLOSE(if_rand_state,iostat=errorflag)
219 global%error = errorflag
220 IF (global%error /= 0) &
221 CALL
errorstop( global,err_file_close,__line__,
'File: '//trim(fname) )
227 1000
FORMAT(
'Time in file is= ',es12.5,
' but it should be= ',es12.5,
'.')
subroutine registerfunction(global, funName, fileName)
int status() const
Obtain the status of the attribute.
subroutine rflo_readdatafileint(global, fileId, form, nDim1, nDim2, ivar)
**********************************************************************Rocstar Simulation Suite Illinois Rocstar LLC All rights reserved ****Illinois Rocstar LLC IL **www illinoisrocstar com **sales illinoisrocstar com WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **Arising OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE **********************************************************************INTERFACE SUBROUTINE form
subroutine rflo_readrandomstate(regions)
subroutine errorstop(global, errorCode, errorLine, addMessage)
subroutine deregisterfunction(global)
subroutine rflo_readdatafilereal(global, fileId, form, nDim1, nDim2, var)