Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RVAV_ReadComparisonsSection.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: reads the #RVAV_COMPARISONS section of a file (until # is
26 ! encountered at the end of all the comparison lists), read
27 ! just ONE keyword and store the associated numerical value.
28 !
29 ! Description:
30 !
31 ! Input: IF_RVAV_INPUT = file number and the file RVAV_Input.inp
32 !
33 ! Output: none
34 !
35 ! Notes: none.
36 !
37 !******************************************************************************
38 !
39 ! $Id: RVAV_ReadComparisonsSection.F90,v 1.3 2008/12/06 08:45:08 mtcampbe Exp $
40 !
41 ! Copyright: (c) 2002 by the University of Illinois
42 !
43 !******************************************************************************
44 
45 SUBROUTINE rvav_readcomparisonssection( global )
46 
47  USE moddatatypes
48  USE modglobal, ONLY : t_global
49  USE moderror
50  USE modparameters
52  USE rvav_modglobal
53  IMPLICIT NONE
54 
55 ! ... parameter variables
56  TYPE(t_global), POINTER :: global
57 
58 ! ... loop variables
59  INTEGER :: ival, n
60 
61 ! ... local variables
62  CHARACTER(256) :: line, key
63 
64  INTEGER :: nc
65  INTEGER :: nrows, ncols, errorflag
66 
67  LOGICAL :: defined
68 
69  REAL(RFREAL), DIMENSION(:,:), ALLOCATABLE :: valss1, valss2
70 
71 !******************************************************************************
72 
73  CALL registerfunction( global, 'RVAV_ReadComparisonsSection',&
74  'RVAV_ReadComparisonsSection.F90' )
75 
76 ! read lines from file until # or EOF found
77 
78  defined = .false. ! initial status
79  ncols = 12 ! this value is fixed. each stream has 12 columns
80 
81  key = "RVAV_NUMBER_OF_COMPARISONS"
82  nc = len_trim(key)
83 
84  DO
85  READ(if_rvav_input,'(A256)',err=10,end=10) line
86  IF (line(1:1) == '#') EXIT
87 
88  IF (line(1:nc) == trim(key)) THEN
89 
90  READ(line(nc+1:256),*,err=10,end=10) nrows
91 
92  globalrvav%nComparisons = nrows
93  IF (globalrvav%nComparisons > 0) THEN
94  ALLOCATE( globalrvav%RVAVcompare(1:globalrvav%nComparisons), &
95  stat=errorflag )
96  global%error = errorflag
97  IF (global%error /= 0) CALL errorstop( global, err_allocate,__line__ )
98  ALLOCATE( valss1(nrows,ncols),stat=errorflag )
99  global%error = errorflag
100  IF (global%error /= 0) CALL errorstop( global, err_allocate,__line__ )
101  ALLOCATE( valss2(nrows,ncols),stat=errorflag )
102  global%error = errorflag
103  IF (global%error /= 0) CALL errorstop( global, err_allocate,__line__ )
104 
105  defined = .true.
106 
107  DO ival=1,globalrvav%nComparisons
108 
109 ! ... read in the first row corresponding to stream one (S1)
110  READ(if_rvav_input,*,err=10,end=10) (valss1(ival,n), n=1,ncols)
111 
112 ! ... read in the second row corresponding to stream two (S2)
113  READ(if_rvav_input,*,err=10,end=10) (valss2(ival,n), n=1,ncols)
114 
115 ! ... assign values that are read in to RVAVcompare(ival)%<fields>
116 ! ... NOTE: data type RVAVcompare is defined in RVAV_ModGlobal.F90
117 
118  globalrvav%RVAVcompare(ival)%operationS1 = valss1(ival,1)
119  globalrvav%RVAVcompare(ival)%VariableIndexS1 = valss1(ival,2)
120  globalrvav%RVAVcompare(ival)%blockS1 = valss1(ival,3)
121  globalrvav%RVAVcompare(ival)%ibegS1 = valss1(ival,4)
122  globalrvav%RVAVcompare(ival)%iendS1 = valss1(ival,5)
123  globalrvav%RVAVcompare(ival)%ijumpS1 = valss1(ival,6)
124  globalrvav%RVAVcompare(ival)%jbegS1 = valss1(ival,7)
125  globalrvav%RVAVcompare(ival)%jendS1 = valss1(ival,8)
126  globalrvav%RVAVcompare(ival)%jjumpS1 = valss1(ival,9)
127  globalrvav%RVAVcompare(ival)%kbegS1 = valss1(ival,10)
128  globalrvav%RVAVcompare(ival)%kendS1 = valss1(ival,11)
129  globalrvav%RVAVcompare(ival)%kjumpS1 = valss1(ival,12)
130 
131  globalrvav%RVAVcompare(ival)%operationS2 = valss2(ival,1)
132  globalrvav%RVAVcompare(ival)%VariableIndexS2 = valss2(ival,2)
133  globalrvav%RVAVcompare(ival)%blockS2 = valss2(ival,3)
134  globalrvav%RVAVcompare(ival)%ibegS2 = valss2(ival,4)
135  globalrvav%RVAVcompare(ival)%iendS2 = valss2(ival,5)
136  globalrvav%RVAVcompare(ival)%ijumpS2 = valss2(ival,6)
137  globalrvav%RVAVcompare(ival)%jbegS2 = valss2(ival,7)
138  globalrvav%RVAVcompare(ival)%jendS2 = valss2(ival,8)
139  globalrvav%RVAVcompare(ival)%jjumpS2 = valss2(ival,9)
140  globalrvav%RVAVcompare(ival)%kbegS2 = valss2(ival,10)
141  globalrvav%RVAVcompare(ival)%kendS2 = valss2(ival,11)
142  globalrvav%RVAVcompare(ival)%kjumpS2 = valss2(ival,12)
143 
144 ! ... check read sanity
145 
146  IF ( global%verbLevel/=verbose_none ) THEN
147  WRITE(stdout,'(/,A)') 'ReadComparisonSection'
148  WRITE(stdout,'(A,I5)') 'nComparisons = ',globalrvav%nComparisons
149  WRITE(stdout,'(/,A,I5)') 'Stream1',ival
150  WRITE(stdout,'(A,I5)') ' operationS1 =',globalrvav%RVAVcompare(ival)%operationS1
151  WRITE(stdout,'(A,I5)') ' variableIndexS1 =',globalrvav%RVAVcompare(ival)%VariableIndexS1
152  WRITE(stdout,'(A,I5)') ' ibegS1 = ',globalrvav%RVAVcompare(ival)%ibegS1
153  WRITE(stdout,'(A,I5)') ' iendS1 = ',globalrvav%RVAVcompare(ival)%iendS1
154  WRITE(stdout,'(A,I5)') ' ijumpS1 = ',globalrvav%RVAVcompare(ival)%ijumpS1
155  WRITE(stdout,'(A,I5)') ' jbegS1 = ',globalrvav%RVAVcompare(ival)%jbegS1
156  WRITE(stdout,'(A,I5)') ' jendS1 = ',globalrvav%RVAVcompare(ival)%jendS1
157  WRITE(stdout,'(A,I5)') ' jjumpS1 = ',globalrvav%RVAVcompare(ival)%jjumpS1
158  WRITE(stdout,'(A,I5)') ' kbegS1 = ',globalrvav%RVAVcompare(ival)%kbegS1
159  WRITE(stdout,'(A,I5)') ' kendS1 = ',globalrvav%RVAVcompare(ival)%kendS1
160  WRITE(stdout,'(A,I5)') ' kjumpS1 = ',globalrvav%RVAVcompare(ival)%kjumpS1
161  WRITE(stdout,'(/,A)') 'Stream2'
162  WRITE(stdout,'(A,I5)') ' operationS2 =',globalrvav%RVAVcompare(ival)%operationS2
163  WRITE(stdout,'(A,I5)') ' variableIndexS2 =',globalrvav%RVAVcompare(ival)%VariableIndexS2
164  WRITE(stdout,'(A,I5)') ' ibegS2 = ',globalrvav%RVAVcompare(ival)%ibegS2
165  WRITE(stdout,'(A,I5)') ' iendS2 = ',globalrvav%RVAVcompare(ival)%iendS2
166  WRITE(stdout,'(A,I5)') ' ijumpS1 = ',globalrvav%RVAVcompare(ival)%ijumpS2
167  WRITE(stdout,'(A,I5)') ' jbegS2 = ',globalrvav%RVAVcompare(ival)%jbegS2
168  WRITE(stdout,'(A,I5)') ' jendS2 = ',globalrvav%RVAVcompare(ival)%jendS2
169  WRITE(stdout,'(A,I5)') ' jjumpS2 = ',globalrvav%RVAVcompare(ival)%jjumpS2
170  WRITE(stdout,'(A,I5)') ' kbegS2 = ',globalrvav%RVAVcompare(ival)%kbegS2
171  WRITE(stdout,'(A,I5)') ' kendS2 = ',globalrvav%RVAVcompare(ival)%kendS2
172  WRITE(stdout,'(A,I5)') ' kjumpS3 = ',globalrvav%RVAVcompare(ival)%kjumpS2
173  WRITE(stdout,'(/,A)') 'END ReadComparisonSection'
174  END IF ! verbLevel
175 
176  ENDDO ! ival
177 
178  DEALLOCATE( valss1,stat=errorflag )
179  global%error = errorflag
180  IF (global%error /= 0) CALL errorstop( global,err_deallocate,__line__ )
181  DEALLOCATE( valss2,stat=errorflag )
182  global%error = errorflag
183  IF (global%error /= 0) CALL errorstop( global,err_deallocate,__line__ )
184 
185  ENDIF ! nComparisons
186  ENDIF ! line
187 
188  ENDDO ! <empty>
189 
190 ! finalize
191 
192  CALL deregisterfunction( global )
193  goto 999
194 
195 10 CONTINUE
196  CALL errorstop( global,err_file_read,__line__ )
197 
198 999 CONTINUE
199 
200 END SUBROUTINE rvav_readcomparisonssection
201 
202 !******************************************************************************
203 !
204 ! RCS Revision history:
205 !
206 ! $Log: RVAV_ReadComparisonsSection.F90,v $
207 ! Revision 1.3 2008/12/06 08:45:08 mtcampbe
208 ! Updated license.
209 !
210 ! Revision 1.2 2008/11/19 22:18:19 mtcampbe
211 ! Added Illinois Open Source License/Copyright
212 !
213 ! Revision 1.1 2004/12/01 22:46:35 fnajjar
214 ! Initial revision after changing case
215 !
216 ! Revision 1.4 2003/05/15 02:57:08 jblazek
217 ! Inlined index function.
218 !
219 ! Revision 1.3 2002/10/12 03:20:51 jblazek
220 ! Replaced [io]stat=global%error with local errorFlag for Rocflo.
221 !
222 ! Revision 1.2 2002/09/10 00:01:45 f-najjar
223 ! Variable global moved into regions()
224 !
225 ! Revision 1.1.1.1 2002/06/03 21:41:29 f-najjar
226 ! Initial Import of RocVaV
227 !
228 !******************************************************************************
229 
230 
231 
232 
233 
234 
235 
CImg< T > & line(const unsigned int y0)
Get a line.
Definition: CImg.h:18421
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine rvav_readcomparisonssection(global)
const NT & n
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
static T_Key key
Definition: vinci_lass.c:76
subroutine deregisterfunction(global)
Definition: ModError.F90:469