Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PLAG_GetCellIndicesOutflow.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: Search algorithm for cell indices
26 ! for outflow boundary conditions
27 ! since no geometry information is available for dummy cells.
28 !
29 ! Description: none.
30 !
31 ! Input: region = current region.
32 !
33 ! Output: region%levels%plag%aiv
34 ! region%levels%plag%aivOld
35 !
36 ! Notes: Test only if particle is no longer in inner cells.
37 !
38 !******************************************************************************
39 !
40 ! $Id: PLAG_GetCellIndicesOutflow.F90,v 1.3 2008/12/06 08:44:33 mtcampbe Exp $
41 !
42 ! Copyright: (c) 2002 by the University of Illinois
43 !
44 !******************************************************************************
45 
46 SUBROUTINE plag_getcellindicesoutflow( region )
47 
48  USE moddatatypes
49  USE modpartlag, ONLY : t_plag, t_plag_input
50  USE modbndpatch, ONLY : t_patch
51  USE moddatastruct, ONLY : t_region
52  USE modglobal, ONLY : t_global
56  USE moderror
57  USE modparameters
59  IMPLICIT NONE
60 
61 #include "Indexing.h"
62 
63 ! ... parameters
64  TYPE(t_region) :: region
65 
66 ! ... loop variables
67  INTEGER :: ipatch, ipcls
68 
69 ! ... local variables
70  CHARACTER(CHRLEN) :: rcsidentstring
71 
72  INTEGER :: bctype, ilev, lbound, npatches, npcls
73  INTEGER :: icoff, ijcoff, inoff, ijnoff, ijknpatch
74  INTEGER :: icplag, ipcbeg, ipcend, ibeg, iend, idir
75  INTEGER :: jcplag, jpcbeg, jpcend, jbeg, jend, jdir
76  INTEGER :: kcplag, kpcbeg, kpcend, kbeg, kend, kdir
77 
78  INTEGER, POINTER, DIMENSION(:,:) :: paiv, paivold
79 
80  LOGICAL :: lboundskip(6)
81 
82  REAL(RFREAL) :: dpgrid, sgn
83  REAL(RFREAL), DIMENSION(3) :: diffpos, facecentroid, posplag, sface
84  REAL(RFREAL), POINTER, DIMENSION(:,:) :: pcv, psi, psj, psk
85  REAL(RFREAL), POINTER, DIMENSION(:,:,:) :: pfc
86 
87  TYPE(t_patch), POINTER :: ppatch
88  TYPE(t_plag), POINTER :: pplag
89  TYPE(t_global), POINTER :: global
90 
91 !******************************************************************************
92 
93  rcsidentstring = &
94  '$RCSfile: PLAG_GetCellIndicesOutflow.F90,v $ $Revision: 1.3 $'
95 
96  global => region%global
97 
98  CALL registerfunction( global, 'PLAG_GetCellIndicesOutflow',&
99  'PLAG_GetCellIndicesOutflow.F90' )
100 
101 ! Get dimensions --------------------------------------------------------------
102 
103  ilev = region%currLevel
104  npcls = region%levels(ilev)%plag%nPcls
105 
106  IF (npcls == 0) goto 999 ! exit if no particles
107 
108  npatches = region%nPatches
109 
110  CALL rflo_getdimensphys( region,ilev,ipcbeg,ipcend, &
111  jpcbeg,jpcend,kpcbeg,kpcend )
112 
113  CALL rflo_getcelloffset( region,ilev,icoff,ijcoff )
114  CALL rflo_getnodeoffset( region,ilev,inoff,ijnoff )
115 
116 ! Set pointers ----------------------------------------------------------------
117 
118  pplag => region%levels(ilev)%plag
119  paiv => pplag%aiv
120  paivold => pplag%aivOld
121  pcv => pplag%cv
122 
123  psi => region%levels(ilev)%plag%si
124  psj => region%levels(ilev)%plag%sj
125  psk => region%levels(ilev)%plag%sk
126 
127  pfc => region%levels(ilev)%plag%fc
128 
129 ! Loop over Lagrangian particles ----------------------------------------------
130 
131  DO ipcls = 1, npcls
132 
133  icplag = paiv(aiv_plag_indexi,ipcls)
134  jcplag = paiv(aiv_plag_indexj,ipcls)
135  kcplag = paiv(aiv_plag_indexk,ipcls)
136 
137 ! - Cycle if particle is not adjacent to a boundary ---------------------------
138 
139  IF (ipcbeg < icplag .AND. icplag < ipcend .AND. &
140  jpcbeg < jcplag .AND. jcplag < jpcend .AND. &
141  kpcbeg < kcplag .AND. kcplag < kpcend ) cycle
142 
143  posplag(xcoord:zcoord) = pcv(cv_plag_xpos:cv_plag_zpos,ipcls)
144 
145 ! - Set lboundSkip(:) to .TRUE. for values of lbound adjacent to a boundary ---
146 
147  lboundskip(1:6) = .true.
148 
149  IF (icplag <= ipcbeg) lboundskip(1) = .false. ! to include ipcbeg = ipcend
150  IF (icplag >= ipcend) lboundskip(2) = .false. ! case, ELSE IF not used here
151 
152  IF (jcplag <= jpcbeg) lboundskip(3) = .false.
153  IF (jcplag >= jpcend) lboundskip(4) = .false.
154 
155  IF (kcplag <= kpcbeg) lboundskip(5) = .false.
156  IF (kcplag >= kpcend) lboundskip(6) = .false.
157 
158 ! - Loop over patches ---------------------------------------------------------
159 
160  DO ipatch=1,npatches
161 
162  ppatch => region%levels(ilev)%patches(ipatch)
163  lbound = ppatch%lbound
164  IF (lboundskip(lbound)) cycle
165 
166  bctype = ppatch%bcType
167 
168 ! - Select outflow boundary condition type ------------------------------------
169 
170  IF ( bctype>=bc_outflow .AND. bctype<=bc_outflow+bc_range ) THEN
171 
172 ! ----- Check if particle cell is within (physical cells of) patch ------------
173 
174  CALL rflo_getpatchindices( region,ppatch,ilev, &
175  ibeg,iend,jbeg,jend,kbeg,kend )
176 
177  IF ( ibeg <= icplag .AND. icplag <= iend .AND. &
178  jbeg <= jcplag .AND. jcplag <= jend .AND. &
179  kbeg <= kcplag .AND. kcplag <= kend ) THEN
180 
181 ! ------- Select correct face vector and make it point inwards ----------------
182 
183  CALL rflo_getpatchdirection( ppatch,idir,jdir,kdir )
184 
185  IF (lbound==1 .OR. lbound==3 .OR. lbound==5) THEN
186  sgn = -1.0_rfreal
187  ijknpatch = indijk(icplag,jcplag,kcplag,inoff,ijnoff)
188  ELSE
189  sgn = +1.0_rfreal
190  ijknpatch = indijk(icplag-idir,jcplag-jdir,kcplag-kdir,inoff,ijnoff)
191  ENDIF ! lbound
192 
193  SELECT CASE (lbound)
194 
195  CASE(1,2)
196  sface(1:3) = sgn*psi(xcoord:zcoord, ijknpatch)
197  facecentroid(1:3) = pfc(xcoord:zcoord,icoord,ijknpatch)
198 
199  CASE(3,4)
200  sface(1:3) = sgn*psj(xcoord:zcoord, ijknpatch)
201  facecentroid(1:3) = pfc(xcoord:zcoord,jcoord,ijknpatch)
202 
203  CASE(5,6)
204  sface(1:3) = sgn*psk(xcoord:zcoord, ijknpatch)
205  facecentroid(1:3) = pfc(xcoord:zcoord,kcoord,ijknpatch)
206 
207  END SELECT ! lbound
208 
209  diffpos(1:3) = posplag(1:3)-facecentroid(1:3)
210  dpgrid = dot_product(sface,diffpos)
211 
212 ! ------- Test for particle exiting computational domain ----------------------
213 
214  IF ( dpgrid < 0.0_rfreal ) THEN
215 
216  paivold(aiv_plag_icells,ipcls) = paiv(aiv_plag_icells,ipcls)
217  paivold(aiv_plag_indexi,ipcls) = icplag
218  paivold(aiv_plag_indexj,ipcls) = jcplag
219  paivold(aiv_plag_indexk,ipcls) = kcplag
220 
221  icplag = icplag - idir ! update indices to new (dummy) cell
222  jcplag = jcplag - jdir
223  kcplag = kcplag - kdir
224 
225  paiv( aiv_plag_icells,ipcls) = indijk(icplag,jcplag,kcplag,icoff,ijcoff)
226  paiv( aiv_plag_indexi,ipcls) = icplag
227  paiv( aiv_plag_indexj,ipcls) = jcplag
228  paiv( aiv_plag_indexk,ipcls) = kcplag
229 
230  ENDIF ! dpGrid
231  ENDIF ! iCPlag, jCPlag, kCPlag
232  ENDIF ! bcType
233  ENDDO ! iPatch
234  ENDDO ! iPcls
235 
236 ! finalize --------------------------------------------------------------------
237 
238 999 CONTINUE
239  CALL deregisterfunction( global )
240 
241 END SUBROUTINE plag_getcellindicesoutflow
242 
243 !******************************************************************************
244 !
245 ! RCS Revision history:
246 !
247 ! $Log: PLAG_GetCellIndicesOutflow.F90,v $
248 ! Revision 1.3 2008/12/06 08:44:33 mtcampbe
249 ! Updated license.
250 !
251 ! Revision 1.2 2008/11/19 22:17:46 mtcampbe
252 ! Added Illinois Open Source License/Copyright
253 !
254 ! Revision 1.1 2004/12/01 20:57:34 fnajjar
255 ! Initial revision after changing case
256 !
257 ! Revision 1.5 2003/11/03 21:21:51 fnajjar
258 ! Changed definition of face vectors pointing to PLAG datastructure
259 !
260 ! Revision 1.4 2003/05/15 02:57:05 jblazek
261 ! Inlined index function.
262 !
263 ! Revision 1.3 2003/05/01 22:58:30 jferry
264 ! overhauled structure in order to optimize performance
265 !
266 ! Revision 1.2 2003/01/16 20:15:11 f-najjar
267 ! Removed iRegionGlobal
268 !
269 ! Revision 1.1 2002/10/25 14:15:43 f-najjar
270 ! Initial Import of Rocpart
271 !
272 !******************************************************************************
273 
274 
275 
276 
277 
278 
279 
**********************************************************************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 ibeg
subroutine rflo_getpatchdirection(patch, idir, jdir, kdir)
subroutine plag_getcellindicesoutflow(region)
**********************************************************************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 kpcbeg
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine rflo_getpatchindices(region, patch, iLev, ibeg, iend, jbeg, jend, kbeg, kend)
**********************************************************************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 jpcbeg
**********************************************************************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 ipcend
subroutine rflo_getnodeoffset(region, iLev, iNodeOffset, ijNodeOffset)
**********************************************************************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 jdir
**********************************************************************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 knode iend
**********************************************************************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 ipcbeg
**********************************************************************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 idir
subroutine rflo_getcelloffset(region, iLev, iCellOffset, ijCellOffset)
**********************************************************************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 jpcend
**********************************************************************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 knode jend
**********************************************************************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 kdir
**********************************************************************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 knode jbeg
long double dot_product(pnt vec1, pnt vec2)
**********************************************************************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 knode kbeg
subroutine deregisterfunction(global)
Definition: ModError.F90:469
subroutine rflo_getdimensphys(region, iLev, ipcbeg, ipcend, jpcbeg, jpcend, kpcbeg, kpcend)