Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PLAG_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 flow file for particles in ASCII ROCFLU format.
26 !
27 ! Description: None.
28 !
29 ! Input:
30 ! pRegion Pointer to region
31 !
32 ! Output: None.
33 !
34 ! Notes: None.
35 !
36 ! ******************************************************************************
37 !
38 ! $Id: PLAG_RFLU_WriteSolutionASCII.F90,v 1.8 2008/12/06 08:44:35 mtcampbe Exp $
39 !
40 ! Copyright: (c) 2004 by the University of Illinois
41 !
42 ! ******************************************************************************
43 
44 SUBROUTINE plag_rflu_writesolutionascii(pRegion)
45 
46  USE modglobal, ONLY: t_global
47  USE moddatatypes
48  USE modparameters
49  USE moderror
50  USE modgrid, ONLY: t_grid
51  USE modbndpatch, ONLY: t_patch
52  USE moddatastruct, ONLY: t_region
53  USE modpartlag, ONLY: t_plag,t_tile_plag
54  USE modmpi
55 
57 
59 
60  IMPLICIT NONE
61 
62 ! ******************************************************************************
63 ! Declarations and definitions
64 ! ******************************************************************************
65 
66 ! ==============================================================================
67 ! Local variables
68 ! ==============================================================================
69 
70  CHARACTER(CHRLEN) :: ifilename,sectionstring,rcsidentstring
71  INTEGER :: errorflag,icont,ifile,ifl,imass,ipatch,ivar,j,ncont,nvars
72  REAL(RFREAL), DIMENSION(:,:), POINTER :: pcv
73  TYPE(t_grid), POINTER :: pgrid
74  TYPE(t_global), POINTER :: global
75  TYPE(t_patch), POINTER :: ppatch
76  TYPE(t_plag), POINTER :: pplag
77  TYPE(t_tile_plag), POINTER :: ptileplag
78 
79 ! ==============================================================================
80 ! Arguments
81 ! ==============================================================================
82 
83  TYPE(t_region), POINTER :: pregion
84 
85 ! ******************************************************************************
86 ! Start, open file
87 ! ******************************************************************************
88 
89  rcsidentstring = '$RCSfile: PLAG_RFLU_WriteSolutionASCII.F90,v $ $Revision: 1.8 $'
90 
91  global => pregion%global
92 
93  CALL registerfunction(global,'PLAG_RFLU_WriteSolutionASCII',&
94  'PLAG_RFLU_WriteSolutionASCII.F90')
95 
96  IF ( global%myProcid == masterproc .AND. &
97  global%verbLevel > verbose_none ) THEN
98  WRITE(stdout,'(A,1X,A)') solver_name,'Writing ASCII particle file...'
99  END IF ! global%verbLevel
100 
101  CALL buildfilenameunsteady(global,filedest_outdir,'.plag_sola', &
102  pregion%iRegionGlobal,global%currentTime, &
103  ifilename)
104 
105  ifile = if_solut
106  OPEN(ifile,file=ifilename,form="FORMATTED",status="UNKNOWN",iostat=errorflag)
107  global%error = errorflag
108  IF ( global%error /= err_none ) THEN
109  CALL errorstop(global,err_file_open,__line__,ifilename)
110  END IF ! global%error
111 
112 ! ==============================================================================
113 ! Header and general information
114 ! ==============================================================================
115 
116  IF ( global%myProcid == masterproc .AND. &
117  global%verbLevel > verbose_low ) THEN
118  WRITE(stdout,'(A,3X,A)') solver_name,'Header information...'
119  END IF ! global%verbLevel
120 
121  sectionstring = '# ROCFLU particle file'
122  WRITE(ifile,'(A)') sectionstring
123 
124  sectionstring = '# Precision and range'
125  WRITE(ifile,'(A)') sectionstring
126  WRITE(ifile,'(2(I8))') precision(1.0_rfreal),range(1.0_rfreal)
127 
128  sectionstring = '# Physical time'
129  WRITE(ifile,'(A)') sectionstring
130  WRITE(ifile,'(E23.16)') global%currentTime
131 
132 ! ==============================================================================
133 ! Dimensions
134 ! ==============================================================================
135 
136  pgrid => pregion%grid
137  pplag => pregion%plag
138 
139  ncont = pregion%plagInput%nCont
140 
141  nvars = 13 ! Hard-coded for now
142 
143  sectionstring = '# Dimensions'
144  WRITE(ifile,'(A)') sectionstring
145  WRITE(ifile,'(2(I8))') pplag%nPcls,nvars
146 
147 ! ==============================================================================
148 ! State vector
149 ! ==============================================================================
150 
151  IF ( global%myProcid == masterproc .AND. &
152  global%verbLevel > verbose_low ) THEN
153  WRITE(stdout,'(A,3X,A)') solver_name,'Conserved variables...'
154  END IF ! global%verbLevel
155 
156  sectionstring = '# Particle x-momentum'
157  WRITE(ifile,'(A)') sectionstring
158  WRITE(ifile,'(5(E23.16))') (pplag%cv(cv_plag_xmom,j),j=1,pplag%nPcls)
159 
160  sectionstring = '# Particle y-momentum'
161  WRITE(ifile,'(A)') sectionstring
162  WRITE(ifile,'(5(E23.16))') (pplag%cv(cv_plag_ymom,j),j=1,pplag%nPcls)
163 
164  sectionstring = '# Particle z-momentum'
165  WRITE(ifile,'(A)') sectionstring
166  WRITE(ifile,'(5(E23.16))') (pplag%cv(cv_plag_zmom,j),j=1,pplag%nPcls)
167 
168  sectionstring = '# Particle energy'
169  WRITE(ifile,'(A)') sectionstring
170  WRITE(ifile,'(5(E23.16))') (pplag%cv(cv_plag_ener,j),j=1,pplag%nPcls)
171 
172  sectionstring = '# Particle x-location'
173  WRITE(ifile,'(A)') sectionstring
174  WRITE(ifile,'(5(E23.16))') (pplag%cv(cv_plag_xpos,j),j=1,pplag%nPcls)
175 
176  sectionstring = '# Particle y-location'
177  WRITE(ifile,'(A)') sectionstring
178  WRITE(ifile,'(5(E23.16))') (pplag%cv(cv_plag_ypos,j),j=1,pplag%nPcls)
179 
180  sectionstring = '# Particle z-location'
181  WRITE(ifile,'(A)') sectionstring
182  WRITE(ifile,'(5(E23.16))') (pplag%cv(cv_plag_zpos,j),j=1,pplag%nPcls)
183 
184  sectionstring = '# Particle vapor energy'
185  WRITE(ifile,'(A)') sectionstring
186  WRITE(ifile,'(5(E23.16))') (pplag%cv(cv_plag_enervapor,j),j=1,pplag%nPcls)
187 
188  DO icont = 1,pregion%plagInput%nCont
189  imass = pplag%cvPlagMass(icont)
190 
191  sectionstring = '# Particle mass'
192  WRITE(ifile,'(A)') sectionstring
193  WRITE(ifile,'(5(E23.16))') (pplag%cv(imass,j),j=1,pplag%nPcls)
194  END DO ! iCont
195 
196 ! ==============================================================================
197 ! Additional variables
198 ! ==============================================================================
199 
200  IF ( global%myProcid == masterproc .AND. &
201  global%verbLevel > verbose_low ) THEN
202  WRITE(stdout,'(A,3X,A)') solver_name,'Additional variables...'
203  END IF ! global%verbLevel
204 
205  sectionstring = '# Particle superloading'
206  WRITE(ifile,'(A)') sectionstring
207  WRITE(ifile,'(5(E23.16))') (pplag%arv(arv_plag_spload,j),j=1,pplag%nPcls)
208 
209  sectionstring = '# Particle initial identifier'
210  WRITE(ifile,'(A)') sectionstring
211  WRITE(ifile,'(5(I8))') (pplag%aiv(aiv_plag_pidini,j),j=1,pplag%nPcls)
212 
213  sectionstring = '# Particle initial region'
214  WRITE(ifile,'(A)') sectionstring
215  WRITE(ifile,'(5(I8))') (pplag%aiv(aiv_plag_regini,j),j=1,pplag%nPcls)
216 
217  sectionstring = '# Particle cell'
218  WRITE(ifile,'(A)') sectionstring
219  WRITE(ifile,'(5(I8))') (pplag%aiv(aiv_plag_icells,j),j=1,pplag%nPcls)
220 
221 ! ==============================================================================
222 ! Patch data
223 ! ==============================================================================
224 
225  IF ( global%myProcid == masterproc .AND. &
226  global%verbLevel > verbose_low ) THEN
227  WRITE(stdout,'(A,3X,A)') solver_name,'Patch data...'
228  END IF ! global%verbLevel
229 
230  sectionstring = '# Patch data'
231  WRITE(ifile,'(A)') sectionstring
232 
233  DO ipatch = 1,pgrid%nPatches
234  ppatch => pregion%patches(ipatch)
235 
236  IF ( (ppatch%bcType >= bc_injection .AND. ppatch%bcType <= bc_injection + bc_range) .OR. &
237  (ppatch%bcType >= bc_inflow .AND. ppatch%bcType <= bc_inflow + bc_range) ) THEN
238  ptileplag => ppatch%tilePlag
239 
240  DO ifl = 1,ppatch%nBFaces
241  WRITE(ifile,'(2(E23.16))') ptileplag%cv(cv_tile_momnrm,ifl), &
242  ptileplag%cv(cv_tile_ener ,ifl)
243  END DO ! ifl
244 
245  DO icont = 1,ncont
246  imass = ptileplag%cvTileMass(icont)
247  WRITE(ifile,'(5(E23.16))') (ptileplag%cv(imass,ifl), &
248  ifl=1,ppatch%nBFaces)
249  END DO ! iCont
250 
251  DO ifl = 1,ppatch%nBFaces
252  WRITE(ifile,'(3(E23.16))') ptileplag%dv(dv_tile_countdown,ifl), &
253  ptileplag%dv(dv_tile_diam ,ifl), &
254  ptileplag%dv(dv_tile_spload ,ifl)
255  END DO ! ifl
256  END IF ! pPatch%bcType
257  END DO ! iPatch
258 
259 ! ==============================================================================
260 ! End marker
261 ! ==============================================================================
262 
263  IF ( global%myProcid == masterproc .AND. &
264  global%verbLevel > verbose_low ) THEN
265  WRITE(stdout,'(A,3X,A)') solver_name,'End marker...'
266  END IF ! global%verbLevel
267 
268  sectionstring = '# End'
269  WRITE(ifile,'(A)') sectionstring
270 
271 ! ==============================================================================
272 ! Close file
273 ! ==============================================================================
274 
275  CLOSE(ifile,iostat=errorflag)
276  global%error = errorflag
277  IF ( global%error /= err_none ) THEN
278  CALL errorstop(global,err_file_close,__line__,ifilename)
279  END IF ! global%error
280 
281  IF ( global%myProcid == masterproc .AND. &
282  global%verbLevel > verbose_none ) THEN
283  WRITE(stdout,'(A,1X,A)') solver_name,'Writing ASCII particle file done.'
284  END IF ! global%verbLevel
285 
286  CALL deregisterfunction(global)
287 
288 ! ******************************************************************************
289 ! End
290 ! ******************************************************************************
291 
292 END SUBROUTINE plag_rflu_writesolutionascii
293 
294 
295 ! ******************************************************************************
296 !
297 ! RCS Revision history:
298 !
299 ! $Log: PLAG_RFLU_WriteSolutionASCII.F90,v $
300 ! Revision 1.8 2008/12/06 08:44:35 mtcampbe
301 ! Updated license.
302 !
303 ! Revision 1.7 2008/11/19 22:17:48 mtcampbe
304 ! Added Illinois Open Source License/Copyright
305 !
306 ! Revision 1.6 2006/09/18 20:37:02 fnajjar
307 ! Activated tile datastructure for inflow bc
308 !
309 ! Revision 1.5 2005/01/21 17:23:10 fnajjar
310 ! Included vapor energy in IO capability
311 !
312 ! Revision 1.4 2004/06/16 23:03:09 fnajjar
313 ! Renamed DV_TILE_TIMEFCTR to DV_TILE_COUNTDOWN for CRE kernel
314 !
315 ! Revision 1.3 2004/06/16 20:01:21 haselbac
316 ! Added use of ModBuildFileNames, cosmetics
317 !
318 ! Revision 1.2 2004/03/05 23:19:33 haselbac
319 ! Added writing of additional patch data and modified writing of constituents
320 !
321 ! Revision 1.1 2004/02/26 21:00:52 haselbac
322 ! Initial revision
323 !
324 ! ******************************************************************************
325 
326 
327 
328 
329 
330 
331 
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
int status() const
Obtain the status of the attribute.
Definition: Attribute.h:240
subroutine plag_rflu_writesolutionascii(pRegion)
**********************************************************************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 deregisterfunction(global)
Definition: ModError.F90:469
subroutine buildfilenameunsteady(global, dest, ext, id, tm, fileName)