Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PLAG_BinSortSpatialDist.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: sort particle entering nozzle by bins.
26 !
27 ! Description: none.
28 !
29 ! Input: iReg = region number
30 ! iLev = current level
31 ! region = region data (dimensions, plag variables)
32 ! iRegBin = region number to bin
33 !
34 ! Output: to plot file.
35 !
36 ! Notes: none.
37 !
38 !******************************************************************************
39 !
40 ! $Id: PLAG_BinSortSpatialDist.F90,v 1.3 2008/12/06 08:45:07 mtcampbe Exp $
41 !
42 ! Copyright: (c) 2004 by the University of Illinois
43 !
44 !******************************************************************************
45 
46 SUBROUTINE plag_binsortspatialdist ( iReg, iLev, region, iRegBin )
47 
48  USE moddatatypes
49  USE moderror
50  USE modpartlag, ONLY : t_plag, t_plag_input
51  USE moddatastruct, ONLY : t_region
52  USE modglobal, ONLY : t_global
53 
54  USE modmpi
55  USE modparameters
57  IMPLICIT NONE
58 
59 ! ... parameters
60  INTEGER :: ireg, ilev, iregbin
61 
62  TYPE(t_region) :: region
63 
64 ! ... loop variables
65  INTEGER :: i,j
66 
67 ! ... local variables
68  CHARACTER(CHRLEN) :: rcsidentstring
69  CHARACTER(CHRLEN+4) :: fname
70 
71  INTEGER :: errorflag, ndimplag
72  INTEGER :: pidini,regini,icell,indexi,indexj,indexk
73  INTEGER :: ibin,nbins
74  INTEGER :: icontal,icontalox
75  INTEGER, POINTER :: cvmass(:)
76  INTEGER, POINTER :: aiv(:,:)
77  INTEGER, DIMENSION(0:500) :: sizebin
78 
79  REAL(RFREAL) :: diammicron,deltay,xposplag,yposplag,yposplagshift
80  REAL(RFREAL) :: massl,yheight,yheightchan,yheightnozz,yheightmin
81  REAL(RFREAL) :: xminrange
82  REAL(RFREAL), DIMENSION(0:500) :: compalbin,compaloxbin,diam32bin,diam43bin,&
83  diam2bin,diam3bin,diam4bin,massalbin, &
84  massaloxbin,masstotbin,uvelbin,vvelbin, &
85  volbin,wvelbin,xmombin,ybin,ymombin,zmombin
86  REAL(RFREAL), POINTER :: cv(:,:), dv(:,:)
87 
88  TYPE(t_global), POINTER :: global
89 
90 !******************************************************************************
91 
92  rcsidentstring = '$RCSfile: PLAG_BinSortSpatialDist.F90,v $ $Revision: 1.3 $'
93 
94  global => region%global
95 
96  CALL registerfunction( global,'PLAG_BinSortSpatialDist', 'PLAG_BinSortSpatialDist.F90' )
97 
98 ! set parameters --------------------------------------------------------------
99 
100  ndimplag = region%levels(ilev)%plag%nPcls
101 
102  sizebin(0:500) = 0
103  diam2bin(0:500) = 0.0_rfreal
104  diam3bin(0:500) = 0.0_rfreal
105  diam4bin(0:500) = 0.0_rfreal
106  diam32bin(0:500) = 0.0_rfreal
107  diam43bin(0:500) = 0.0_rfreal
108 
109  nbins=20
110 
111  icontal = 1
112  icontalox = 2
113  compalbin(0:500) = 0.0_rfreal
114  compaloxbin(0:500) = 0.0_rfreal
115 
116  massalbin(0:500) = 0.0_rfreal
117  massaloxbin(0:500) = 0.0_rfreal
118  masstotbin(0:500) = 0.0_rfreal
119  volbin(0:500) = 0.0_rfreal
120 
121  uvelbin(0:500) = 0.0_rfreal
122  vvelbin(0:500) = 0.0_rfreal
123  wvelbin(0:500) = 0.0_rfreal
124 
125  xmombin(0:500) = 0.0_rfreal
126  ymombin(0:500) = 0.0_rfreal
127  zmombin(0:500) = 0.0_rfreal
128 
129  IF (ireg /= iregbin) goto 1999
130 
131  print*,'PLAG_BinSortSpatialDist: iRegBin, nDimPlag = ',iregbin,ndimplag
132 
133 ! set values ------------------------------------------------------------------
134 
135 ! TEMPORARY: Data Pertinent to c1
136 
137  yheightchan = 0.09_rfreal
138  yheightnozz = 0.0481267_rfreal
139 
140  SELECT CASE (iregbin)
141  CASE(41)
142  yheight = yheightchan
143  yheightmin = 0.0_rfreal
144  xminrange = 0.0_rfreal
145 
146  CASE(52)
147  yheight = yheightnozz
148  yheightmin = 0.0209367_rfreal
149  xminrange = 0.465_rfreal
150 
151  CASE default
152  yheight = 1.0_rfreal
153  END SELECT ! iRegBin
154 
155  deltay = yheight/REAL(nbins,kind=rfreal)
156  ybin(1) = yheightmin
157 
158  DO i = 2, nbins+1
159  ybin(i) = ybin(i-1) +deltay
160  END DO ! i
161 
162 ! set pointers ----------------------------------------------------------------
163 
164  aiv => region%levels(ilev)%plag%aiv
165  cv => region%levels(ilev)%plag%cv
166  dv => region%levels(ilev)%plag%dv
167  cvmass => region%levels(ilev)%plag%cvPlagMass
168 
169 ! determine size ---------------------------------------------------------------
170 
171  DO i = 1, ndimplag
172  xposplag = cv(cv_plag_xpos,i)
173 
174  IF ( xposplag >= xminrange ) THEN
175  yposplag = cv(cv_plag_ypos,i)
176  yposplagshift = yposplag -yheightmin
177 
178  ibin=nint(yposplagshift/deltay)
179  sizebin(ibin) = sizebin(ibin)+1
180 
181  diammicron = dv(dv_plag_diam,i)*1.0e+06_rfreal
182  massl = sum( cv(cvmass(:),i) )
183 
184  massalbin(ibin) = massalbin(ibin) +cv(cvmass(icontal),i)
185  massaloxbin(ibin) = massaloxbin(ibin) +cv(cvmass(icontalox),i)
186  masstotbin(ibin) = masstotbin(ibin) +massl
187  diam2bin(ibin) = diam2bin(ibin) +diammicron**2
188  diam3bin(ibin) = diam3bin(ibin) +diammicron**3
189  diam4bin(ibin) = diam4bin(ibin) +diammicron**4
190 
191  xmombin(ibin) = xmombin(ibin) +cv(cv_plag_xmom,i)
192  ymombin(ibin) = ymombin(ibin) +cv(cv_plag_ymom,i)
193  zmombin(ibin) = zmombin(ibin) +cv(cv_plag_zmom,i)
194  ENDIF ! xPosPlag
195  ENDDO ! i
196 
197  DO ibin = 1, nbins
198  IF ( sizebin(ibin) > 0 ) THEN
199  compalbin(ibin) = massalbin(ibin)/masstotbin(ibin)
200  compaloxbin(ibin) = massaloxbin(ibin)/masstotbin(ibin)
201 
202  diam43bin(ibin) = diam4bin(ibin)/diam3bin(ibin)
203  diam32bin(ibin) = diam3bin(ibin)/diam2bin(ibin)
204 
205  uvelbin(ibin) = xmombin(ibin)/masstotbin(ibin)
206  vvelbin(ibin) = ymombin(ibin)/masstotbin(ibin)
207  wvelbin(ibin) = zmombin(ibin)/masstotbin(ibin)
208  END IF ! sizeBin
209  ENDDO ! iBin
210 
211 ! open file and write the header ----------------------------------------------
212 
213  WRITE(fname,'(A,I2,A,1PE11.5,A)') &
214  trim(global%casename)//'.plag_ydist_bin_reg_',iregbin,'_',global%currentTime,'.dat'
215  OPEN(if_plot,file=fname,status='unknown',form='formatted',iostat=errorflag)
216  global%error = errorflag
217  IF (global%error /= 0) CALL errorstop( global,err_file_open,__line__,fname )
218 
219  IF (global%currentTime <= 0._rfreal) THEN
220  WRITE(if_plot,1005,err=10) trim(global%casename),global%timeStamp
221  ELSE
222  WRITE(if_plot,1005,err=10) trim(global%casename),global%currentTime
223  ENDIF
224 
225  WRITE(if_plot,1010,err=10) 'iBin yBin size compAl compAlOx diam32 diam43 u v w'
226 
227  WRITE(if_plot,1015) iregbin, nbins
228 
229  DO ibin = 1, nbins
230  WRITE(if_plot,1020,err=10) ibin,(ybin(ibin)-yheightmin)/yheight,sizebin(ibin),&
231  nint(compalbin(ibin)*100.0_rfreal),&
232  nint(compaloxbin(ibin)*100.0_rfreal), &
233  nint(diam32bin(ibin)),nint(diam43bin(ibin)),&
234  uvelbin(ibin),vvelbin(ibin),wvelbin(ibin)
235  ENDDO ! iBin
236 
237 ! close file, handle errors ---------------------------------------------------
238 
239  CLOSE(if_plot,iostat=errorflag)
240  global%error = errorflag
241  IF (global%error /= 0) CALL errorstop( global,err_file_close,__line__,fname )
242 
243 ! open file and write the header for time-averaging ---------------------------
244 
245  WRITE(fname,'(A,I2,A,1PE11.5,A)') &
246  trim(global%casename)//'.plag_cv_ydist_bin_reg_',iregbin,'_',global%currentTime,'.dat'
247  OPEN(if_plot,file=fname,status='unknown',form='formatted',iostat=errorflag)
248  global%error = errorflag
249  IF (global%error /= 0) CALL errorstop( global,err_file_open,__line__,fname )
250 
251  IF (global%currentTime <= 0._rfreal) THEN
252  WRITE(if_plot,1005,err=10) trim(global%casename),global%timeStamp
253  ELSE
254  WRITE(if_plot,1005,err=10) trim(global%casename),global%currentTime
255  ENDIF
256 
257  WRITE(if_plot,1010,err=10) 'iBin yBin size massAl massAlOxBin massTot diam2 diam3 diam4 xMom yMom zMom '
258 
259  WRITE(if_plot,1015) iregbin, nbins
260 
261  DO ibin = 1, nbins
262  WRITE(if_plot,1030,err=10) ibin,(ybin(ibin)-yheightmin)/yheight,sizebin(ibin),&
263  massalbin(ibin),massaloxbin(ibin),masstotbin(ibin),&
264  diam2bin(ibin),diam3bin(ibin),diam4bin(ibin),&
265  xmombin(ibin),ymombin(ibin),zmombin(ibin)
266  ENDDO ! iBin
267 
268 ! close file, handle errors ---------------------------------------------------
269 
270  CLOSE(if_plot,iostat=errorflag)
271  global%error = errorflag
272  IF (global%error /= 0) CALL errorstop( global,err_file_close,__line__,fname )
273 
274 1999 CONTINUE
275  CALL deregisterfunction( global )
276  goto 999
277 
278 10 CONTINUE
279  CALL errorstop( global,err_file_write,__line__,fname )
280 
281 ! formats ---------------------------------------------------------------------
282 
283 1005 FORMAT('TITLE="',a,'. Time: ',1pe11.5,'."')
284 1010 FORMAT('VARIABLES= ',a)
285 1015 FORMAT('ZONE T="',i5.5,'", I=',i10,', F=POINT')
286 1020 FORMAT(1x,i5,1x,1pe12.5,5(1x,i5),3(1x,1pe12.5))
287 1030 FORMAT(1x,i5,1x,1pe12.5,1x,i5,9(1x,1e23.16))
288 
289 999 CONTINUE
290 END SUBROUTINE plag_binsortspatialdist
291 
292 !******************************************************************************
293 !
294 ! RCS Revision history:
295 !
296 ! $Log: PLAG_BinSortSpatialDist.F90,v $
297 ! Revision 1.3 2008/12/06 08:45:07 mtcampbe
298 ! Updated license.
299 !
300 ! Revision 1.2 2008/11/19 22:18:18 mtcampbe
301 ! Added Illinois Open Source License/Copyright
302 !
303 ! Revision 1.1 2004/11/13 22:00:00 fnajjar
304 ! Initial import
305 !
306 !******************************************************************************
307 
308 
309 
310 
311 
312 
313 
Tfloat sum() const
Return the sum of all the pixel values in an image.
Definition: CImg.h:13022
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
int status() const
Obtain the status of the attribute.
Definition: Attribute.h:240
subroutine plag_binsortspatialdist(iReg, iLev, region, iRegBin)
blockLoc i
Definition: read.cpp:79
void int int REAL * x
Definition: read.cpp:74
**********************************************************************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
**********************************************************************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 icell
virtual std::ostream & print(std::ostream &os) const
j indices j
Definition: Indexing.h:6
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469
RT a() const
Definition: Line_2.h:140