Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TURB_rFLU_WriteSolutionASCII.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: Write solution file for turbulence in ASCII ROCFLU format.
26 !
27 ! Description: None.
28 !
29 ! Input: region = Pointer to region
30 !
31 ! Output: None.
32 !
33 ! Notes: None.
34 !
35 ! ******************************************************************************
36 !
37 ! $Id: TURB_rFLU_WriteSolutionASCII.F90,v 1.5 2008/12/06 08:44:45 mtcampbe Exp $
38 !
39 ! Copyright: (c) 2004 by the University of Illinois
40 !
41 ! ******************************************************************************
42 
43 SUBROUTINE turb_rflu_writesolutionascii( region ) ! PUBLIC
44 
45  USE moddatatypes
46  USE modglobal, ONLY : t_global
47  USE moddatastruct, ONLY: t_region
48  USE modgrid, ONLY : t_grid
49  USE moderror
50  USE modmpi
51  USE modparameters
52 
55 
57 
58  IMPLICIT NONE
59 
60 ! ... arguments
61  TYPE(t_region), POINTER :: region
62 
63 ! ... loop variables
64  INTEGER :: i, j
65 
66 ! ... local variables
67  CHARACTER(CHRLEN) :: ifilename,sectionstring,rcsidentstring
68  TYPE(t_grid), POINTER :: grid
69  TYPE(t_global), POINTER :: global
70 
71  INTEGER :: errorflag,ifile,nvars
72  REAL(RFREAL) :: currenttime
73  REAL(RFREAL), DIMENSION(:,:), POINTER :: tv, tcv, vort
74  REAL(RFREAL), DIMENSION(:), POINTER :: lens
75 
76 ! ******************************************************************************
77 ! Start, open file
78 ! ******************************************************************************
79 
80  rcsidentstring = '$RCSfile: TURB_rFLU_WriteSolutionASCII.F90,v $ $Revision: 1.5 $'
81 
82  global => region%global
83 
84  CALL registerfunction(global,'TURB_RFLU_WriteSolutionASCII',&
85  'TURB_rFLU_WriteSolutionASCII.F90')
86 
87  IF ( global%myProcid == masterproc .AND. &
88  global%verbLevel > verbose_none ) THEN
89  WRITE(stdout,'(A,1X,A)') solver_name,'Writing ASCII turbulence file...'
90  END IF ! global%verbLevel
91 
92  IF ( global%flowType == flow_unsteady ) THEN
93  CALL buildfilenameunsteady(global,filedest_outdir,'.turba', &
94  region%iRegionGlobal,global%currentTime, &
95  ifilename)
96 
97  IF ( global%myProcid == masterproc .AND. &
98  global%verbLevel > verbose_none ) THEN
99  WRITE(stdout,'(A,3X,A,1X,I5.5)') solver_name,'Global region:', &
100  region%iRegionGlobal
101  WRITE(stdout,'(A,3X,A,1X,1PE11.5)') solver_name,'Current time:', &
102  global%currentTime
103  END IF ! global%verbLevel
104  ELSE
105  CALL buildfilenamesteady(global,filedest_outdir,'.turba', &
106  region%iRegionGlobal,global%currentIter,ifilename)
107 
108  IF ( global%myProcid == masterproc .AND. &
109  global%verbLevel > verbose_none ) THEN
110  WRITE(stdout,'(A,3X,A,1X,I5.5)') solver_name,'Global region:', &
111  region%iRegionGlobal
112  WRITE(stdout,'(A,3X,A,1X,I6.6)') solver_name,'Current iteration '// &
113  'number:',global%currentIter
114  END IF ! global%verbLevel
115  ENDIF ! global%flowType
116 
117  ifile = if_solut
118  OPEN(ifile,file=ifilename,form="FORMATTED",status="UNKNOWN", &
119  iostat=errorflag)
120  global%error = errorflag
121  IF ( global%error /= err_none ) THEN
122  CALL errorstop(global,err_file_open,__line__,ifilename)
123  END IF ! global%error
124 
125 ! ==============================================================================
126 ! Header and general information
127 ! ==============================================================================
128 
129  IF ( global%myProcid == masterproc .AND. &
130  global%verbLevel > verbose_low ) THEN
131  WRITE(stdout,'(A,3X,A)') solver_name,'Header information...'
132  END IF ! global%verbLevel
133 
134  sectionstring = '# ROCTURB solution file'
135  WRITE(ifile,'(A)') sectionstring
136 
137  sectionstring = '# Precision and range'
138  WRITE(ifile,'(A)') sectionstring
139  WRITE(ifile,'(2(I8))') precision(1.0_rfreal),range(1.0_rfreal)
140 
141  sectionstring = '# Initial residual'
142  WRITE(ifile,'(A)') sectionstring
143  WRITE(ifile,'(E23.16)') global%resInit
144 
145  sectionstring = '# Physical time'
146  WRITE(ifile,'(A)') sectionstring
147  WRITE(ifile,'(E23.16)') global%currentTime
148 
149  sectionstring = '# Esg1Sum'
150  WRITE(ifile,'(A)') sectionstring
151  WRITE(ifile,'(E23.16)') global%esg1Sum
152 
153  sectionstring = '# Esg4Sum'
154  WRITE(ifile,'(A)') sectionstring
155  WRITE(ifile,'(E23.16)') global%esg4Sum
156 
157 ! ==============================================================================
158 ! Dimensions
159 ! ==============================================================================
160 
161  nvars = region%turbInput%nOutField
162 
163  grid => region%grid
164 
165  sectionstring = '# Dimensions'
166  WRITE(ifile,'(A)') sectionstring
167  WRITE(ifile,'(2(I8))') grid%nCellsTot,nvars
168 
169 ! ==============================================================================
170 ! Eddy viscosity
171 ! ==============================================================================
172 
173  IF ( global%myProcid == masterproc .AND. &
174  global%verbLevel > verbose_low ) THEN
175  WRITE(stdout,'(A,3X,A)') solver_name,'Eddy viscosity...'
176  END IF ! global%verbLevel
177 
178  sectionstring = '# Eddy viscosity'
179  WRITE(ifile,'(A)') sectionstring
180 
181  IF (region%turbInput%modelClass == model_les) THEN
182  tv => region%mixt%tv
183  WRITE(ifile,'(5(E23.16))') (tv(tv_mixt_muet,j),j=1,grid%nCellsTot)
184  ELSEIF (region%turbInput%modelClass == model_rans) THEN
185  tcv => region%turb%cv
186  WRITE(ifile,'(5(E23.16))') (tcv(cv_sa_nutil,j),j=1,grid%nCellsTot)
187  ENDIF
188 
189 ! ==============================================================================
190 ! Total vorticity
191 ! ==============================================================================
192 
193  IF ( nvars > 1 ) THEN
194  IF ( global%myProcid == masterproc .AND. &
195  global%verbLevel > verbose_low ) THEN
196  WRITE(stdout,'(A,3X,A)') solver_name,'Total vorticity...'
197  END IF ! global%verbLevel
198 
199  sectionstring = '# Total vorticity'
200  WRITE(ifile,'(A)') sectionstring
201 
202  vort => region%turb%vort
203  WRITE(ifile,'(5(E23.16))') (sqrt( vort(xcoord,j)**2 + &
204  vort(ycoord,j)**2 + &
205  vort(zcoord,j)**2 ),j=1,grid%nCellsTot)
206  ENDIF
207 
208 ! ==============================================================================
209 ! RaNS or DES length scale
210 ! ==============================================================================
211 
212  IF ( nvars > 2 ) THEN
213  IF (region%turbInput%modelClass == model_rans) THEN
214 
215  IF ( global%myProcid == masterproc .AND. &
216  global%verbLevel > verbose_low ) THEN
217  WRITE(stdout,'(A,3X,A)') solver_name,'Model length scale...'
218  END IF ! global%verbLevel
219 
220  sectionstring = '# RANS length scale'
221  WRITE(ifile,'(A)') sectionstring
222 
223  lens => region%turb%lens
224  WRITE(ifile,'(5(E23.16))') (lens(j),j=1,grid%nCellsTot)
225  ENDIF
226  ENDIF
227 
228 ! ==============================================================================
229 ! End marker
230 ! ==============================================================================
231 
232  IF ( global%myProcid == masterproc .AND. &
233  global%verbLevel > verbose_low ) THEN
234  WRITE(stdout,'(A,3X,A)') solver_name,'End marker...'
235  END IF ! global%verbLevel
236 
237  sectionstring = '# End'
238  WRITE(ifile,'(A)') sectionstring
239 
240 ! ==============================================================================
241 ! Close file
242 ! ==============================================================================
243 
244  CLOSE(ifile,iostat=errorflag)
245  global%error = errorflag
246  IF ( global%error /= err_none ) THEN
247  CALL errorstop(global,err_file_close,__line__,ifilename)
248  END IF ! global%error
249 
250  IF ( global%myProcid == masterproc .AND. &
251  global%verbLevel > verbose_none ) THEN
252  WRITE(stdout,'(A,1X,A)') solver_name,'Writing ASCII flow file done.'
253  END IF ! global%verbLevel
254 
255  CALL deregisterfunction(global)
256 
257 ! ******************************************************************************
258 ! End
259 ! ******************************************************************************
260 
261 END SUBROUTINE turb_rflu_writesolutionascii
262 
263 
264 ! ******************************************************************************
265 !
266 ! RCS Revision history:
267 !
268 ! $Log: TURB_rFLU_WriteSolutionASCII.F90,v $
269 ! Revision 1.5 2008/12/06 08:44:45 mtcampbe
270 ! Updated license.
271 !
272 ! Revision 1.4 2008/11/19 22:17:57 mtcampbe
273 ! Added Illinois Open Source License/Copyright
274 !
275 ! Revision 1.3 2006/01/10 07:14:31 wasistho
276 ! fixed screen print vort to lengthscale
277 !
278 ! Revision 1.2 2004/06/16 20:01:32 haselbac
279 ! Added use of ModBuildFileNames, cosmetics
280 !
281 ! Revision 1.1 2004/03/27 02:19:15 wasistho
282 ! added routines specific for Rocflu
283 !
284 ! ******************************************************************************
285 
286 
287 
288 
289 
290 
291 
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
int status() const
Obtain the status of the attribute.
Definition: Attribute.h:240
double sqrt(double d)
Definition: double.h:73
subroutine turb_rflu_writesolutionascii(region)
blockLoc i
Definition: read.cpp:79
**********************************************************************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
j indices j
Definition: Indexing.h:6
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine grid(bp)
Definition: setup_py.f90:257
subroutine deregisterfunction(global)
Definition: ModError.F90:469
subroutine buildfilenamesteady(global, dest, ext, id, it, fileName)
subroutine buildfilenameunsteady(global, dest, ext, id, tm, fileName)