Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RFLO_GenerateCoarseGrids.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: generate coarse grids from the finest grid.
26 !
27 ! Description: the coarse grids are generated by omitting every second
28 ! grid node in all three directions (standard coarsening).
29 !
30 ! Input: region = current region.
31 !
32 ! Output: region%levels%grid%xyz = grid coordinates.
33 !
34 ! Notes: none.
35 !
36 !******************************************************************************
37 !
38 ! $Id: RFLO_GenerateCoarseGrids.F90,v 1.3 2008/12/06 08:44:06 mtcampbe Exp $
39 !
40 ! Copyright: (c) 2001 by the University of Illinois
41 !
42 !******************************************************************************
43 
44 SUBROUTINE rflo_generatecoarsegrids( region )
45 
46  USE moddatatypes
47  USE moddatastruct, ONLY : t_region
49  USE moderror
50  USE modparameters
51  IMPLICIT NONE
52 
53 #include "Indexing.h"
54 
55 ! ... parameters
56  TYPE(t_region) :: region
57 
58 ! ... loop variables
59  INTEGER :: ilev, i, j, k
60 
61 ! ... local variables
62  INTEGER :: ipnbegf, ipnendf, jpnbegf, jpnendf, kpnbegf, kpnendf
63  INTEGER :: ipnbegc, ipnendc, jpnbegc, jpnendc, kpnbegc, kpnendc
64  INTEGER :: iofffine, ijofffine, ioffcoarse, ijoffcoarse, ijkf, ijkc
65  INTEGER :: ii, jj, kk
66 
67  REAL(RFREAL), POINTER :: xyzfine(:,:), xyzcoarse(:,:)
68 
69 !******************************************************************************
70 
71  CALL registerfunction( region%global,'RFLO_GenerateCoarseGrids',&
72  'RFLO_GenerateCoarseGrids.F90' )
73 
74 ! loop over higher levels (>1)
75 
76  DO ilev=2,region%nGridLevels
77 
78  xyzfine => region%levels(ilev-1)%grid%xyz
79  xyzcoarse => region%levels(ilev )%grid%xyz
80 
81  CALL rflo_getdimensphysnodes( region,ilev-1,ipnbegf,ipnendf, &
82  jpnbegf,jpnendf,kpnbegf,kpnendf )
83  CALL rflo_getdimensphysnodes( region,ilev ,ipnbegc,ipnendc, &
84  jpnbegc,jpnendc,kpnbegc,kpnendc )
85  CALL rflo_getnodeoffset( region,ilev-1,iofffine ,ijofffine )
86  CALL rflo_getnodeoffset( region,ilev ,ioffcoarse,ijoffcoarse )
87 
88  DO k=kpnbegc,kpnendc
89  kk = (k-kpnbegc)*2 + kpnbegf
90  DO j=jpnbegc,jpnendc
91  jj = (j-jpnbegc)*2 + jpnbegf
92  DO i=ipnbegc,ipnendc
93  ii = (i-ipnbegc)*2 + ipnbegf
94  ijkf = indijk(ii,jj,kk,iofffine ,ijofffine )
95  ijkc = indijk(i ,j ,k ,ioffcoarse,ijoffcoarse)
96  xyzcoarse(xcoord,ijkc) = xyzfine(xcoord,ijkf)
97  xyzcoarse(ycoord,ijkc) = xyzfine(ycoord,ijkf)
98  xyzcoarse(zcoord,ijkc) = xyzfine(zcoord,ijkf)
99  ENDDO ! i
100  ENDDO ! j
101  ENDDO ! k
102 
103  ENDDO ! iLev
104 
105 ! finalize
106 
107  CALL deregisterfunction( region%global )
108 
109 END SUBROUTINE rflo_generatecoarsegrids
110 
111 !******************************************************************************
112 !
113 ! RCS Revision history:
114 !
115 ! $Log: RFLO_GenerateCoarseGrids.F90,v $
116 ! Revision 1.3 2008/12/06 08:44:06 mtcampbe
117 ! Updated license.
118 !
119 ! Revision 1.2 2008/11/19 22:17:20 mtcampbe
120 ! Added Illinois Open Source License/Copyright
121 !
122 ! Revision 1.1 2004/11/29 21:25:16 wasistho
123 ! lower to upper case
124 !
125 ! Revision 1.6 2003/11/20 16:40:34 mdbrandy
126 ! Backing out RocfluidMP changes from 11-17-03
127 !
128 ! Revision 1.3 2003/05/15 02:57:01 jblazek
129 ! Inlined index function.
130 !
131 ! Revision 1.2 2002/09/05 17:40:19 jblazek
132 ! Variable global moved into regions().
133 !
134 ! Revision 1.1 2002/06/07 16:40:36 jblazek
135 ! Grid & solution for all regions in one file.
136 !
137 !******************************************************************************
138 
139 
140 
141 
142 
143 
144 
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)
subroutine rflo_generatecoarsegrids(region)
blockLoc i
Definition: read.cpp:79
subroutine rflo_getdimensphysnodes(region, iLev, ipnbeg, ipnend, jpnbeg, jpnend, kpnbeg, kpnend)
j indices j
Definition: Indexing.h:6
subroutine deregisterfunction(global)
Definition: ModError.F90:469