Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RFLO_CopyTopologyLevels.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: copy topology and BC data to all coarse grids.
26 !
27 ! Description: none.
28 !
29 ! Input: regions = dimensions and topology on finest grid.
30 !
31 ! Output: regions = dimensions and topology on all coarse grids.
32 !
33 ! Notes: conducted only for currently active regions on the own processor.
34 !
35 !******************************************************************************
36 !
37 ! $Id: RFLO_CopyTopologyLevels.F90,v 1.4 2008/12/06 08:44:06 mtcampbe Exp $
38 !
39 ! Copyright: (c) 2001 by the University of Illinois
40 !
41 !******************************************************************************
42 
43 SUBROUTINE rflo_copytopologylevels( regions )
44 
45  USE moddatatypes
46  USE modbndpatch, ONLY : t_patch
47  USE moddatastruct, ONLY : t_region
48  USE modglobal, ONLY : t_global
50  USE moderror
51  USE modparameters
52  IMPLICIT NONE
53 
54 ! ... parameters
55  TYPE(t_region), POINTER :: regions(:)
56 
57 ! ... loop variables
58  INTEGER :: ireg, ilev, ipatch
59 
60 ! ... local variables
61  INTEGER :: nlevels, npatches, ipc, jpc, kpc, bctype, errorflag
62 
63  TYPE(t_patch), POINTER :: patch, patchprev
64  TYPE(t_global), POINTER :: global
65 
66 !******************************************************************************
67 
68  global => regions(1)%global
69 
70  CALL registerfunction( global,'RFLO_CopyTopologyLevels',&
71  'RFLO_CopyTopologyLevels.F90' )
72 
73 ! loop over all regions
74 
75  DO ireg=1,global%nRegions
76  IF (regions(ireg)%procid==global%myProcid .AND. & ! region active and
77  regions(ireg)%active==active) THEN ! on my processor
78 
79  nlevels = regions(ireg)%nGridLevels
80  npatches = regions(ireg)%nPatches
81 
82 ! --- loop over coarse grid levels
83 
84  DO ilev=2,nlevels
85  ipc = regions(ireg)%levels(ilev-1)%grid%ipc ! no. of physical cells
86  jpc = regions(ireg)%levels(ilev-1)%grid%jpc
87  kpc = regions(ireg)%levels(ilev-1)%grid%kpc
88  regions(ireg)%levels(ilev)%grid%ipc = ipc/2
89  regions(ireg)%levels(ilev)%grid%jpc = jpc/2
90  regions(ireg)%levels(ilev)%grid%kpc = kpc/2
91 
92 ! ----- loop over patches
93 
94  ALLOCATE( regions(ireg)%levels(ilev)%patches(npatches),stat=errorflag )
95  global%error = errorflag
96  IF (global%error /= 0) CALL errorstop( global,err_allocate,&
97  __line__ )
98 
99  DO ipatch=1,npatches
100  patchprev => regions(ireg)%levels(ilev-1)%patches(ipatch)
101  patch => regions(ireg)%levels(ilev )%patches(ipatch)
102 
103 ! ------- current patch
104 
105  patch%bcType = patchprev%bcType
106  patch%bcCoupled = patchprev%bcCoupled
107  patch%srcRegion = patchprev%srcRegion
108  patch%srcPatch = patchprev%srcPatch
109  patch%align = patchprev%align
110  patch%lbound = patchprev%lbound
111  patch%l1beg = (patchprev%l1beg-1)/2 + 1
112  patch%l1end = patchprev%l1end/2
113  patch%l2beg = (patchprev%l2beg-1)/2 + 1
114  patch%l2end = patchprev%l2end/2
115  patch%srcLbound = patchprev%srcLbound
116 
117  patch%mixt%bcSet = patchprev%mixt%bcSet
118  patch%mixt%distrib = patchprev%mixt%distrib
119  patch%mixt%nData = patchprev%mixt%nData
120  patch%mixt%nSwitches = patchprev%mixt%nSwitches
121 
122 ! ------- source patch (if there is an adjacent region)
123 
124  bctype = patch%bcType
125 
126  IF ((bctype>=bc_regionconf .AND. bctype<=bc_regionconf+bc_range) .OR.&
127  (bctype>=bc_regionint .AND. bctype<=bc_regionint +bc_range) .OR.&
128  (bctype>=bc_regnonconf .AND. bctype<=bc_regnonconf+bc_range) .OR.&
129  (bctype>=bc_tra_peri .AND. bctype<=bc_tra_peri +bc_range) .OR.&
130  (bctype>=bc_rot_peri .AND. bctype<=bc_rot_peri +bc_range)) THEN
131  IF (patch%srcL1beg < patch%srcL1end) THEN
132  patch%srcL1beg = (patchprev%srcL1beg-1)/2 + 1
133  patch%srcL1end = patchprev%srcL1end/2
134  ELSE
135  patch%srcL1beg = patchprev%srcL1beg/2
136  patch%srcL1end = (patchprev%srcL1end-1)/2 + 1
137  ENDIF
138  IF (patch%srcL2beg < patch%srcL2end) THEN
139  patch%srcL2beg = (patchprev%srcL2beg-1)/2 + 1
140  patch%srcL2end = patchprev%srcL2end/2
141  ELSE
142  patch%srcL2beg = patchprev%srcL2beg/2
143  patch%srcL2end = (patchprev%srcL2end-1)/2 + 1
144  ENDIF
145  ELSE ! no adjacent region
146  patch%srcL1beg = patchprev%srcL1beg
147  patch%srcL1end = patchprev%srcL1end
148  patch%srcL2beg = patchprev%srcL2beg
149  patch%srcL2end = patchprev%srcL2end
150  ENDIF ! bcType
151 
152 ! ------- distributions of boundary values
153 
154  IF ((bctype>=bc_slipwall .AND. bctype<=bc_slipwall +bc_range) .OR.&
155  (bctype>=bc_noslipwall .AND. bctype<=bc_noslipwall+bc_range) .OR.&
156  (bctype>=bc_inflow .AND. bctype<=bc_inflow +bc_range) .OR.&
157  (bctype>=bc_outflow .AND. bctype<=bc_outflow +bc_range) .OR.&
158  (bctype>=bc_farfield .AND. bctype<=bc_farfield +bc_range) .OR.&
159  (bctype>=bc_injection .AND. bctype<=bc_injection +bc_range)) THEN
160  CALL rflo_copyboundarydata( global,patchprev,patch )
161  ENDIF ! bcType
162 
163  ENDDO ! iPatch
164 
165  ENDDO ! iLev
166 
167  ENDIF ! active region on my processor
168  ENDDO ! iReg
169 
170 ! finalize
171 
172  CALL deregisterfunction( global )
173 
174 END SUBROUTINE rflo_copytopologylevels
175 
176 !******************************************************************************
177 !
178 ! RCS Revision history:
179 !
180 ! $Log: RFLO_CopyTopologyLevels.F90,v $
181 ! Revision 1.4 2008/12/06 08:44:06 mtcampbe
182 ! Updated license.
183 !
184 ! Revision 1.3 2008/11/19 22:17:20 mtcampbe
185 ! Added Illinois Open Source License/Copyright
186 !
187 ! Revision 1.2 2006/08/19 15:38:00 mparmar
188 ! Renamed patch variables
189 !
190 ! Revision 1.1 2004/11/29 21:25:16 wasistho
191 ! lower to upper case
192 !
193 ! Revision 1.6 2003/11/20 16:40:34 mdbrandy
194 ! Backing out RocfluidMP changes from 11-17-03
195 !
196 ! Revision 1.3 2003/05/15 02:57:01 jblazek
197 ! Inlined index function.
198 !
199 ! Revision 1.2 2002/10/25 18:36:19 jblazek
200 ! Replaced [io]stat=global%error with local errorFlag for Rocflo.
201 !
202 ! Revision 1.1 2002/10/19 00:40:30 jblazek
203 ! Added utility (rflosurf) to write out surface grids for GenX.
204 !
205 ! Revision 1.6 2002/09/27 00:57:10 jblazek
206 ! Changed makefiles - no makelinks needed.
207 !
208 ! Revision 1.5 2002/09/05 17:40:21 jblazek
209 ! Variable global moved into regions().
210 !
211 ! Revision 1.4 2002/03/18 23:11:33 jblazek
212 ! Finished multiblock and MPI.
213 !
214 ! Revision 1.3 2002/02/27 18:38:20 jblazek
215 ! Changed extrapol. to dummy cells at injection boundaries and slip walls.
216 !
217 ! Revision 1.2 2002/02/21 23:25:06 jblazek
218 ! Blocks renamed as regions.
219 !
220 ! Revision 1.1 2002/01/23 03:51:25 jblazek
221 ! Added low-level time-stepping routines.
222 !
223 ! Revision 1.5 2002/01/11 17:20:19 jblazek
224 ! Added time stamp or iteration number to file names.
225 !
226 ! Revision 1.4 2001/12/22 00:09:39 jblazek
227 ! Added routines to store grid and solution.
228 !
229 ! Revision 1.3 2001/12/19 23:09:22 jblazek
230 ! Added routines to read grid and solution.
231 !
232 ! Revision 1.2 2001/12/08 00:18:42 jblazek
233 ! Added routines to read BC input file.
234 !
235 ! Revision 1.1.1.1 2001/12/03 21:44:04 jblazek
236 ! Import of RocfluidMP
237 !
238 !******************************************************************************
239 
240 
241 
242 
243 
244 
245 
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine rflo_copytopologylevels(regions)
Definition: patch.h:74
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine rflo_copyboundarydata(global, patchPrev, patch)
subroutine deregisterfunction(global)
Definition: ModError.F90:469