Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PLAG_RFLU_WriteSolutionBinary.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 binary 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_WriteSolutionBinary.F90,v 1.6 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_writesolutionbinary(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 = &
90  '$RCSfile: PLAG_RFLU_WriteSolutionBinary.F90,v $ $Revision: 1.6 $'
91 
92  global => pregion%global
93 
94  CALL registerfunction(global,'PLAG_RFLU_WriteSolutionBinary',&
95  'PLAG_RFLU_WriteSolutionBinary.F90')
96 
97  IF ( global%myProcid == masterproc .AND. &
98  global%verbLevel > verbose_none ) THEN
99  WRITE(stdout,'(A,1X,A)') solver_name,'Writing binary particle file...'
100  END IF ! global%verbLevel
101 
102  CALL buildfilenameunsteady(global,filedest_outdir,'.plag_sol', &
103  pregion%iRegionGlobal,global%currentTime, &
104  ifilename)
105 
106  ifile = if_solut
107  OPEN(ifile,file=ifilename,form="UNFORMATTED",status="UNKNOWN",&
108  iostat=errorflag)
109  global%error = errorflag
110  IF ( global%error /= err_none ) THEN
111  CALL errorstop(global,err_file_open,__line__,ifilename)
112  END IF ! global%error
113 
114 ! ==============================================================================
115 ! Header and general information
116 ! ==============================================================================
117 
118  IF ( global%myProcid == masterproc .AND. &
119  global%verbLevel > verbose_low ) THEN
120  WRITE(stdout,'(A,3X,A)') solver_name,'Header information...'
121  END IF ! global%verbLevel
122 
123  sectionstring = '# ROCFLU particle file'
124  WRITE(ifile) sectionstring
125 
126  sectionstring = '# Precision and range'
127  WRITE(ifile) sectionstring
128  WRITE(ifile) precision(1.0_rfreal),range(1.0_rfreal)
129 
130  sectionstring = '# Physical time'
131  WRITE(ifile) sectionstring
132  WRITE(ifile) global%currentTime
133 
134 ! ==============================================================================
135 ! Dimensions
136 ! ==============================================================================
137 
138  pgrid => pregion%grid
139  pplag => pregion%plag
140 
141  ncont = pregion%plagInput%nCont
142 
143  nvars = 13 ! Hard-coded for now
144 
145  sectionstring = '# Dimensions'
146  WRITE(ifile) sectionstring
147  WRITE(ifile) pplag%nPcls,nvars
148 
149 ! ==============================================================================
150 ! State vector
151 ! ==============================================================================
152 
153  IF ( global%myProcid == masterproc .AND. &
154  global%verbLevel > verbose_low ) THEN
155  WRITE(stdout,'(A,3X,A)') solver_name,'Conserved variables...'
156  END IF ! global%verbLevel
157 
158  sectionstring = '# Particle x-momentum'
159  WRITE(ifile) sectionstring
160  WRITE(ifile) (pplag%cv(cv_plag_xmom,j),j=1,pplag%nPcls)
161 
162  sectionstring = '# Particle y-momentum'
163  WRITE(ifile) sectionstring
164  WRITE(ifile) (pplag%cv(cv_plag_ymom,j),j=1,pplag%nPcls)
165 
166  sectionstring = '# Particle z-momentum'
167  WRITE(ifile) sectionstring
168  WRITE(ifile) (pplag%cv(cv_plag_zmom,j),j=1,pplag%nPcls)
169 
170  sectionstring = '# Particle energy'
171  WRITE(ifile) sectionstring
172  WRITE(ifile) (pplag%cv(cv_plag_ener,j),j=1,pplag%nPcls)
173 
174  sectionstring = '# Particle x-location'
175  WRITE(ifile) sectionstring
176  WRITE(ifile) (pplag%cv(cv_plag_xpos,j),j=1,pplag%nPcls)
177 
178  sectionstring = '# Particle y-location'
179  WRITE(ifile) sectionstring
180  WRITE(ifile) (pplag%cv(cv_plag_ypos,j),j=1,pplag%nPcls)
181 
182  sectionstring = '# Particle z-location'
183  WRITE(ifile) sectionstring
184  WRITE(ifile) (pplag%cv(cv_plag_zpos,j),j=1,pplag%nPcls)
185 
186  sectionstring = '# Particle vapor energy'
187  WRITE(ifile) sectionstring
188  WRITE(ifile) (pplag%cv(cv_plag_enervapor,j),j=1,pplag%nPcls)
189 
190  DO icont = 1,pregion%plagInput%nCont
191  imass = pplag%cvPlagMass(icont)
192 
193  sectionstring = '# Particle mass'
194  WRITE(ifile) sectionstring
195  WRITE(ifile) (pplag%cv(imass,j),j=1,pplag%nPcls)
196  END DO ! iCont
197 
198 ! ==============================================================================
199 ! Additional variables
200 ! ==============================================================================
201 
202  IF ( global%myProcid == masterproc .AND. &
203  global%verbLevel > verbose_low ) THEN
204  WRITE(stdout,'(A,3X,A)') solver_name,'Additional variables...'
205  END IF ! global%verbLevel
206 
207  sectionstring = '# Particle superloading'
208  WRITE(ifile) sectionstring
209  WRITE(ifile) (pplag%arv(arv_plag_spload,j),j=1,pplag%nPcls)
210 
211  sectionstring = '# Particle initial identifier'
212  WRITE(ifile) sectionstring
213  WRITE(ifile) (pplag%aiv(aiv_plag_pidini,j),j=1,pplag%nPcls)
214 
215  sectionstring = '# Particle initial region'
216  WRITE(ifile) sectionstring
217  WRITE(ifile) (pplag%aiv(aiv_plag_regini,j),j=1,pplag%nPcls)
218 
219  sectionstring = '# Particle cell'
220  WRITE(ifile) sectionstring
221  WRITE(ifile) (pplag%aiv(aiv_plag_icells,j),j=1,pplag%nPcls)
222 
223 ! ==============================================================================
224 ! Patch data
225 ! ==============================================================================
226 
227  IF ( global%myProcid == masterproc .AND. &
228  global%verbLevel > verbose_low ) THEN
229  WRITE(stdout,'(A,3X,A)') solver_name,'Patch data...'
230  END IF ! global%verbLevel
231 
232  sectionstring = '# Patch data'
233  WRITE(ifile) sectionstring
234 
235  DO ipatch = 1,pgrid%nPatches
236  ppatch => pregion%patches(ipatch)
237 
238  IF ( (ppatch%bcType >= bc_injection .AND. ppatch%bcType <= bc_injection + bc_range) .OR. &
239  (ppatch%bcType >= bc_inflow .AND. ppatch%bcType <= bc_inflow + bc_range) ) THEN
240  ptileplag => ppatch%tilePlag
241 
242  DO ifl = 1,ppatch%nBFaces
243  WRITE(ifile) ptileplag%cv(cv_tile_momnrm,ifl), &
244  ptileplag%cv(cv_tile_ener ,ifl)
245  END DO ! ifl
246 
247  DO icont = 1,ncont
248  imass = ptileplag%cvTileMass(icont)
249  WRITE(ifile) (ptileplag%cv(imass,ifl), &
250  ifl=1,ppatch%nBFaces)
251  END DO ! iCont
252 
253  DO ifl = 1,ppatch%nBFaces
254  WRITE(ifile) ptileplag%dv(dv_tile_countdown,ifl), &
255  ptileplag%dv(dv_tile_diam ,ifl), &
256  ptileplag%dv(dv_tile_spload ,ifl)
257  END DO ! ifl
258  END IF ! pPatch%bcType
259  END DO ! iPatch
260 
261 ! ==============================================================================
262 ! End marker
263 ! ==============================================================================
264 
265  IF ( global%myProcid == masterproc .AND. &
266  global%verbLevel > verbose_low ) THEN
267  WRITE(stdout,'(A,3X,A)') solver_name,'End marker...'
268  END IF ! global%verbLevel
269 
270  sectionstring = '# End'
271  WRITE(ifile) sectionstring
272 
273 ! ==============================================================================
274 ! Close file
275 ! ==============================================================================
276 
277  CLOSE(ifile,iostat=errorflag)
278  global%error = errorflag
279  IF ( global%error /= err_none ) THEN
280  CALL errorstop(global,err_file_close,__line__,ifilename)
281  END IF ! global%error
282 
283  IF ( global%myProcid == masterproc .AND. &
284  global%verbLevel > verbose_none ) THEN
285  WRITE(stdout,'(A,1X,A)') solver_name,'Writing binary particle file done.'
286  END IF ! global%verbLevel
287 
288  CALL deregisterfunction(global)
289 
290 ! ******************************************************************************
291 ! End
292 ! ******************************************************************************
293 
294 END SUBROUTINE plag_rflu_writesolutionbinary
295 
296 
297 ! ******************************************************************************
298 !
299 ! RCS Revision history:
300 !
301 ! $Log: PLAG_RFLU_WriteSolutionBinary.F90,v $
302 ! Revision 1.6 2008/12/06 08:44:35 mtcampbe
303 ! Updated license.
304 !
305 ! Revision 1.5 2008/11/19 22:17:48 mtcampbe
306 ! Added Illinois Open Source License/Copyright
307 !
308 ! Revision 1.4 2006/09/18 20:37:02 fnajjar
309 ! Activated tile datastructure for inflow bc
310 !
311 ! Revision 1.3 2006/05/06 18:49:53 fnajjar
312 ! Bug fix in write statement for string End
313 !
314 ! Revision 1.2 2005/01/21 17:23:10 fnajjar
315 ! Included vapor energy in IO capability
316 !
317 ! Revision 1.1 2004/08/23 23:06:53 fnajjar
318 ! Initial revision
319 !
320 ! Revision 1.4 2004/06/16 23:03:09 fnajjar
321 ! ******************************************************************************
322 
323 
324 
325 
326 
327 
328 
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
int status() const
Obtain the status of the attribute.
Definition: Attribute.h:240
**********************************************************************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 plag_rflu_writesolutionbinary(pRegion)
subroutine buildfilenameunsteady(global, dest, ext, id, tm, fileName)