Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RFLO_C2fAvgCoeffsDummyConn.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: Extrapolate coefficient from the interior domain or at the patch
26 ! to the dummy points at connecting boundaries.
27 !
28 ! Description: Dummy values of connecting bnd has been computed in prev. step
29 ! up to second outerst layer. They are copied to the
30 ! outerst layer in this routine.
31 !
32 ! Input: region = current region data
33 ! lbound = patch boundary ID
34 ! i,j,kdir = direction identifier
35 ! i,j,kndBeg = i,j,k begin index
36 ! i,j,kndEnd = i,j,k end index
37 !
38 ! Output: Averaging coefficients c2fCoI, c2fCoJ, c2fCoK at outerst layer of
39 ! conn. bc.
40 !
41 ! Notes: Mother routine = RFLO_C2fAvgCoeffsDummy.
42 !
43 !******************************************************************************
44 !
45 ! $Id: RFLO_C2fAvgCoeffsDummyConn.F90,v 1.3 2008/12/06 08:44:25 mtcampbe Exp $
46 !
47 ! Copyright: (c) 2001 by the University of Illinois
48 !
49 !******************************************************************************
50 
51 SUBROUTINE rflo_c2favgcoeffsdummyconn( region,lbound,idir,jdir,kdir, &
52  indbeg,indend,jndbeg,jndend,kndbeg,kndend )
53 
54  USE moddatatypes
55  USE moddatastruct, ONLY : t_region
56  USE modglobal, ONLY : t_global
58  USE moderror
59  USE modparameters
60  IMPLICIT NONE
61 
62 #include "Indexing.h"
63 
64 ! ... parameters
65  TYPE(t_region) :: region
66  INTEGER :: lbound,idir,jdir,kdir
67  INTEGER :: indbeg, indend, jndbeg, jndend, kndbeg, kndend
68 
69 ! ... loop variables
70  INTEGER :: i, j, k, idum, jdum, kdum
71 
72 ! ... local variables
73  TYPE(t_global), POINTER :: global
74 
75  INTEGER :: ilev, inoff, ijnoff
76  INTEGER :: ijkni, ijknj, ijknk, ijknd
77  INTEGER :: ig(3), jg(3), kg(3)
78  INTEGER :: idumb(3), jdumb(3), kdumb(3), idume(3), jdume(3), kdume(3)
79 
80 !******************************************************************************
81 
82  global => region%global
83  CALL registerfunction( global,'RFLO_C2fAvgCoeffsDummyConn',&
84  'RFLO_C2fAvgCoeffsDummyConn.F90' )
85 
86 ! get dimensions -------------------------------------------------------------
87 
88  ilev = region%currLevel
89  CALL rflo_getnodeoffset( region,ilev,inoff,ijnoff )
90 
91  idumb(:) = -idir*region%nDumCells
92  jdumb(:) = -jdir*region%nDumCells
93  kdumb(:) = -kdir*region%nDumCells
94  idume(:) = idumb(:)
95  jdume(:) = jdumb(:)
96  kdume(:) = kdumb(:)
97 
98  ig(:) = -idir*(region%nDumCells-1)
99  jg(:) = -jdir*(region%nDumCells-1)
100  kg(:) = -kdir*(region%nDumCells-1)
101 
102 ! 2D loop over patch nodes ----------------------------------------------------
103 
104  DO k=kndbeg,kndend
105  DO j=jndbeg,jndend
106  DO i=indbeg,indend
107 
108  ijkni = indijk(i+ig(1),j+jg(1),k+kg(1),inoff,ijnoff) ! i reference
109  ijknj = indijk(i+ig(2),j+jg(2),k+kg(2),inoff,ijnoff) ! j reference
110  ijknk = indijk(i+ig(3),j+jg(3),k+kg(3),inoff,ijnoff) ! k reference
111 
112 ! ----- 1D loop in direction normal to patch to define grads at dummy faces
113 
114  DO idum=idumb(1),idume(1)
115  DO jdum=jdumb(1),jdume(1)
116  DO kdum=kdumb(1),kdume(1)
117  ijknd = indijk(i+idum,j+jdum,k+kdum,inoff,ijnoff)
118  region%levels(ilev)%grid%c2fCoI(2,ijknd) = &
119  region%levels(ilev)%grid%c2fCoI(2,ijkni)
120  region%levels(ilev)%grid%c2fCoI(1,ijknd) = &
121  1._rfreal-region%levels(ilev)%grid%c2fCoI(2,ijknd)
122  ENDDO
123  ENDDO
124  ENDDO
125 
126  DO idum=idumb(2),idume(2)
127  DO jdum=jdumb(2),jdume(2)
128  DO kdum=kdumb(2),kdume(2)
129  ijknd = indijk(i+idum,j+jdum,k+kdum,inoff,ijnoff)
130  region%levels(ilev)%grid%c2fCoJ(2,ijknd) = &
131  region%levels(ilev)%grid%c2fCoJ(2,ijknj)
132  region%levels(ilev)%grid%c2fCoJ(1,ijknd) = &
133  1._rfreal-region%levels(ilev)%grid%c2fCoJ(2,ijknd)
134  ENDDO
135  ENDDO
136  ENDDO
137 
138  DO idum=idumb(3),idume(3)
139  DO jdum=jdumb(3),jdume(3)
140  DO kdum=kdumb(3),kdume(3)
141  ijknd = indijk(i+idum,j+jdum,k+kdum,inoff,ijnoff)
142  region%levels(ilev)%grid%c2fCoK(2,ijknd) = &
143  region%levels(ilev)%grid%c2fCoK(2,ijknk)
144  region%levels(ilev)%grid%c2fCoK(1,ijknd) = &
145  1._rfreal-region%levels(ilev)%grid%c2fCoK(2,ijknd)
146  ENDDO
147  ENDDO
148  ENDDO
149 
150  ENDDO ! i
151  ENDDO ! j
152  ENDDO ! k
153 
154 ! copy coefficients from region boundary to patch edge
155 
156  CALL avgcopatchedge
157 
158 ! finalize --------------------------------------------------------------------
159 
160  CALL deregisterfunction( global )
161 
162 ! ==============================================================================
163 ! subroutine for copying to patch edges
164 ! ==============================================================================
165 
166 CONTAINS
167 
168  SUBROUTINE avgcopatchedge
169 
170 ! ... local variables
171 
172  INTEGER :: inbeg, inend, jnbeg, jnend, knbeg, knend
173  INTEGER :: ijkn, ijkn1, iref, jref, kref
174  REAL(RFREAL), POINTER :: avgco(:,:)
175 
176  IF (lbound==1 .OR. lbound==3 .OR. lbound==5) THEN
177  inbeg = indbeg-idir*region%nDumCells
178  jnbeg = jndbeg-jdir*region%nDumCells
179  knbeg = kndbeg-kdir*region%nDumCells
180  inend = indend-idir
181  jnend = jndend-jdir
182  knend = kndend-kdir
183  ELSE
184  inbeg = indbeg
185  jnbeg = jndbeg
186  knbeg = kndbeg
187  inend = indend-idir*region%nDumCells
188  jnend = jndend-jdir*region%nDumCells
189  knend = kndend-kdir*region%nDumCells
190  ENDIF
191 
192  IF ((lbound==1).OR.(lbound==2)) THEN
193  avgco => region%levels(ilev)%grid%c2fCoI
194  IF (lbound==1) THEN
195  iref = indend
196  ELSE
197  iref = indbeg-1
198  ENDIF
199  DO i=inbeg,inend
200  DO k=knbeg,knend-1
201  ijkn = indijk(i ,jnbeg ,k,inoff,ijnoff)
202  ijkn1 = indijk(iref ,jnbeg ,k,inoff,ijnoff)
203  IF (avgco(1,ijkn)==0._rfreal .OR. avgco(2,ijkn)==0._rfreal) THEN
204  avgco(:,ijkn)=avgco(:,ijkn1)
205  ENDIF
206  ijkn = indijk(i ,jnend ,k,inoff,ijnoff)
207  ijkn1 = indijk(iref ,jnend ,k,inoff,ijnoff)
208  IF (avgco(1,ijkn)==0._rfreal .OR. avgco(2,ijkn)==0._rfreal) THEN
209  avgco(:,ijkn)=avgco(:,ijkn1)
210  ENDIF
211  END DO
212  DO j=jnbeg,jnend-1
213  ijkn = indijk(i ,j,knbeg ,inoff,ijnoff)
214  ijkn1 = indijk(iref ,j,knbeg ,inoff,ijnoff)
215  IF (avgco(1,ijkn)==0._rfreal .OR. avgco(2,ijkn)==0._rfreal) THEN
216  avgco(:,ijkn)=avgco(:,ijkn1)
217  ENDIF
218  ijkn = indijk(i ,j,knend ,inoff,ijnoff)
219  ijkn1 = indijk(iref ,j,knend ,inoff,ijnoff)
220  IF (avgco(1,ijkn)==0._rfreal .OR. avgco(2,ijkn)==0._rfreal) THEN
221  avgco(:,ijkn)=avgco(:,ijkn1)
222  ENDIF
223  END DO
224  END DO
225  ELSEIF ((lbound==3).OR.(lbound==4)) THEN
226  avgco => region%levels(ilev)%grid%c2fCoJ
227  IF (lbound==3) THEN
228  jref = jndend
229  ELSE
230  jref = jndbeg-1
231  ENDIF
232  DO j=jnbeg,jnend
233  DO k=knbeg,knend-1
234  ijkn = indijk(inbeg ,j ,k,inoff,ijnoff)
235  ijkn1 = indijk(inbeg ,jref ,k,inoff,ijnoff)
236  IF (avgco(1,ijkn)==0._rfreal .OR. avgco(2,ijkn)==0._rfreal) THEN
237  avgco(:,ijkn)=avgco(:,ijkn1)
238  ENDIF
239  ijkn = indijk(inend ,j ,k,inoff,ijnoff)
240  ijkn1 = indijk(inend ,jref ,k,inoff,ijnoff)
241  IF (avgco(1,ijkn)==0._rfreal .OR. avgco(2,ijkn)==0._rfreal) THEN
242  avgco(:,ijkn)=avgco(:,ijkn1)
243  ENDIF
244  END DO
245  DO i=inbeg,inend-1
246  ijkn = indijk(i,j ,knbeg ,inoff,ijnoff)
247  ijkn1 = indijk(i,jref ,knbeg ,inoff,ijnoff)
248  IF (avgco(1,ijkn)==0._rfreal .OR. avgco(2,ijkn)==0._rfreal) THEN
249  avgco(:,ijkn)=avgco(:,ijkn1)
250  ENDIF
251  ijkn = indijk(i,j ,knend ,inoff,ijnoff)
252  ijkn1 = indijk(i,jref ,knend ,inoff,ijnoff)
253  IF (avgco(1,ijkn)==0._rfreal .OR. avgco(2,ijkn)==0._rfreal) THEN
254  avgco(:,ijkn)=avgco(:,ijkn1)
255  ENDIF
256  END DO
257  END DO
258  ELSEIF ((lbound==5).OR.(lbound==6)) THEN
259  avgco => region%levels(ilev)%grid%c2fCoK
260  IF (lbound==5) THEN
261  kref = kndend
262  ELSE
263  kref = kndbeg-1
264  ENDIF
265  DO k=knbeg,knend
266  DO i=inbeg,inend-1
267  ijkn = indijk(i,jnbeg ,k ,inoff,ijnoff)
268  ijkn1 = indijk(i,jnbeg ,kref ,inoff,ijnoff)
269  IF (avgco(1,ijkn)==0._rfreal .OR. avgco(2,ijkn)==0._rfreal) THEN
270  avgco(:,ijkn)=avgco(:,ijkn1)
271  ENDIF
272  ijkn = indijk(i,jnend ,k ,inoff,ijnoff)
273  ijkn1 = indijk(i,jnend ,kref ,inoff,ijnoff)
274  IF (avgco(1,ijkn)==0._rfreal .OR. avgco(2,ijkn)==0._rfreal) THEN
275  avgco(:,ijkn)=avgco(:,ijkn1)
276  ENDIF
277  END DO
278  DO j=jnbeg,jnend-1
279  ijkn = indijk(inbeg ,j,k ,inoff,ijnoff)
280  ijkn1 = indijk(inbeg ,j,kref ,inoff,ijnoff)
281  IF (avgco(1,ijkn)==0._rfreal .OR. avgco(2,ijkn)==0._rfreal) THEN
282  avgco(:,ijkn)=avgco(:,ijkn1)
283  ENDIF
284  ijkn = indijk(inend ,j,k ,inoff,ijnoff)
285  ijkn1 = indijk(inend ,j,kref ,inoff,ijnoff)
286  IF (avgco(1,ijkn)==0._rfreal .OR. avgco(2,ijkn)==0._rfreal) THEN
287  avgco(:,ijkn)=avgco(:,ijkn1)
288  ENDIF
289  END DO
290  END DO
291  END IF
292 
293  END SUBROUTINE avgcopatchedge
294 
295 END SUBROUTINE rflo_c2favgcoeffsdummyconn
296 
297 !******************************************************************************
298 !
299 ! RCS Revision history:
300 !
301 ! $Log: RFLO_C2fAvgCoeffsDummyConn.F90,v $
302 ! Revision 1.3 2008/12/06 08:44:25 mtcampbe
303 ! Updated license.
304 !
305 ! Revision 1.2 2008/11/19 22:17:36 mtcampbe
306 ! Added Illinois Open Source License/Copyright
307 !
308 ! Revision 1.1 2004/11/29 20:51:38 wasistho
309 ! lower to upper case
310 !
311 ! Revision 1.3 2004/08/03 00:52:08 wasistho
312 ! changed avgCo to c2fCo in the description
313 !
314 ! Revision 1.2 2004/08/02 19:32:43 wasistho
315 ! changed grid%avgCo to grid%c2fCo
316 !
317 ! Revision 1.1 2004/07/30 17:30:31 wasistho
318 ! initial import routines starting with RFLO_c2fAvg...
319 !
320 !
321 !
322 !******************************************************************************
323 
324 
325 
326 
327 
328 
329 
j indices k indices k
Definition: Indexing.h:6
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
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
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 idir
j indices j
Definition: Indexing.h:6
**********************************************************************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
subroutine deregisterfunction(global)
Definition: ModError.F90:469
subroutine avgcopatchedge
subroutine rflo_c2favgcoeffsdummyconn(region, lbound, idir, jdir, kdir, indBeg, indEnd, jndBeg, jndEnd, kndBeg, kndEnd)