Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RFLO_LaplaceGridSmoo.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: smooth the distribution of grid points by solving simplified
26 ! Laplace equation in physical space.
27 !
28 ! Description: none.
29 !
30 ! Input: regions = data of all grid regions.
31 !
32 ! Output: regions%levels%grid%xyz = new grid coordinates
33 ! resid = convergence of the Jacobi iteration.
34 !
35 ! Notes: none.
36 !
37 !******************************************************************************
38 !
39 ! $Id: RFLO_LaplaceGridSmoo.F90,v 1.3 2008/12/06 08:44:07 mtcampbe Exp $
40 !
41 ! Copyright: (c) 2003 by the University of Illinois
42 !
43 !******************************************************************************
44 
45 SUBROUTINE rflo_laplacegridsmoo( regions,resid )
46 
47  USE moddatatypes
48  USE modbndpatch, ONLY : t_patch
49  USE modglobal, ONLY : t_global
50  USE moddatastruct, ONLY : t_region
51  USE modgrid, ONLY : t_grid
58  USE moderror
59  USE modparameters
60  IMPLICIT NONE
61 
62 #include "Indexing.h"
63 
64 ! ... parameters
65  REAL(RFREAL) :: resid
66 
67  TYPE(t_region), POINTER :: regions(:)
68 
69 ! ... loop variables
70  INTEGER :: ireg, ipatch, ijk, i, j, k
71 
72 ! ... local variables
73  INTEGER :: ipnbeg, ipnend, jpnbeg, jpnend, kpnbeg, kpnend, inoff, ijnoff
74  INTEGER :: bctype, iregsrc, ipatchsrc
75 
76  REAL(RFREAL) :: dx, dy, dz
77  REAL(RFREAL), POINTER :: xyz(:,:), xyzold(:,:)
78 
79  TYPE(t_global), POINTER :: global
80  TYPE(t_grid), POINTER :: grid, gridold, gridsrc
81  TYPE(t_patch), POINTER :: patch, patchsrc
82 
83 !******************************************************************************
84 
85  global => regions(1)%global
86 
87  CALL registerfunction( global,'RFLO_LaplaceGridSmoo',&
88  'RFLO_LaplaceGridSmoo.F90' )
89 
90 ! smooth grid region-wise -----------------------------------------------------
91 
92  resid = 0._rfreal
93 
94  DO ireg=1,global%nRegions
95  IF (regions(ireg)%procid==global%myProcid .AND. & ! region active and
96  regions(ireg)%active==active .AND. & ! on my processor
97  regions(ireg)%mixtInput%moveGrid) THEN ! and moving
98 
99 ! --- compute movements in the interior and along the boundaries
100 
101  CALL rflo_laplacegridsolve( regions(ireg) )
102 
103 ! --- zero out movements along certain boundaries
104 
105  DO ipatch=1,regions(ireg)%nPatches
106  patch => regions(ireg)%levels(1)%patches(ipatch)
107  bctype = patch%bcType
108  IF ((bctype>=bc_inflow .AND. bctype<=bc_inflow +bc_range) .OR. &
109  (bctype>=bc_outflow .AND. bctype<=bc_outflow +bc_range) .OR. &
110  (bctype>=bc_slipwall .AND. bctype<=bc_slipwall +bc_range) .OR. &
111  (bctype>=bc_noslipwall .AND. bctype<=bc_noslipwall+bc_range) .OR. &
112  (bctype>=bc_farfield .AND. bctype<=bc_farfield +bc_range) .OR. &
113  (bctype>=bc_injection .AND. bctype<=bc_injection +bc_range) .OR. &
114  (bctype>=bc_tra_peri .AND. bctype<=bc_tra_peri +bc_range) .OR. &
115  (bctype>=bc_rot_peri .AND. bctype<=bc_rot_peri +bc_range)) THEN
116  CALL rflo_laplacegridpatch( regions(ireg),patch )
117  ENDIF ! bcType
118  ENDDO ! iPatch
119 
120  CALL rflo_getdimensphysnodes( regions(ireg),1,ipnbeg,ipnend, &
121  jpnbeg,jpnend,kpnbeg,kpnend )
122  CALL rflo_getnodeoffset( regions(ireg),1,inoff,ijnoff )
123 
124  xyz => regions(ireg)%levels(1)%grid%xyz
125  xyzold => regions(ireg)%levels(1)%grid%xyzOld
126 
127  DO k=kpnbeg,kpnend
128  DO j=jpnbeg,jpnend
129  DO i=ipnbeg,ipnend
130  ijk = indijk(i,j,k,inoff,ijnoff)
131  dx = xyz(xcoord,ijk) - xyzold(xcoord,ijk)
132  dy = xyz(ycoord,ijk) - xyzold(ycoord,ijk)
133  dz = xyz(zcoord,ijk) - xyzold(zcoord,ijk)
134  resid = resid + dx*dx + dy*dy +dz*dz
135  ENDDO
136  ENDDO
137  ENDDO
138 
139  ENDIF ! region on this processor and active, grid moving
140  ENDDO ! iReg
141 
142 ! fix interfaces between regions ----------------------------------------------
143 ! copy / send deformations
144 
145  DO ireg=1,global%nRegions
146  IF (regions(ireg)%procid==global%myProcid .AND. & ! region active and
147  regions(ireg)%active==active .AND. & ! on my processor
148  regions(ireg)%mixtInput%moveGrid) THEN ! and moving
149 
150  grid => regions(ireg)%levels(1)%grid
151  gridold => regions(ireg)%levels(1)%gridOld
152 
153  DO ipatch=1,regions(ireg)%nPatches
154  patch => regions(ireg)%levels(1)%patches(ipatch)
155  bctype = patch%bcType
156  IF ((bctype>=bc_regionconf .AND. bctype<=bc_regionconf+bc_range) .OR. &
157  (bctype>=bc_tra_peri .AND. bctype<=bc_tra_peri +bc_range) .OR. &
158  (bctype>=bc_rot_peri .AND. bctype<=bc_rot_peri +bc_range)) THEN
159  iregsrc = patch%srcRegion
160  ipatchsrc = patch%srcPatch
161  patchsrc => regions(iregsrc)%levels(1)%patches(ipatchsrc)
162  gridsrc => regions(iregsrc)%levels(1)%grid
163 
164  IF (regions(iregsrc)%procid == global%myProcid) THEN
165  CALL rflo_exchangednodecopy( regions(ireg),regions(iregsrc), &
166  patch,patchsrc,.true., &
167  grid%xyz,gridsrc%xyz )
168  ELSE
169  CALL rflo_exchangednodesend( regions(ireg),regions(iregsrc), &
170  patch,grid%xyz )
171  ENDIF
172  ENDIF ! bcType
173  ENDDO ! iPatch
174 
175  ENDIF ! region on this processor and active, grid moving
176  ENDDO ! iReg
177 
178 ! receive deformations
179 
180  DO ireg=1,global%nRegions
181  IF (regions(ireg)%procid==global%myProcid .AND. & ! region active and
182  regions(ireg)%active==active .AND. & ! on my processor
183  regions(ireg)%mixtInput%moveGrid) THEN ! and moving
184 
185  grid => regions(ireg)%levels(1)%grid
186  gridold => regions(ireg)%levels(1)%gridOld
187 
188  DO ipatch=1,regions(ireg)%nPatches
189  patch => regions(ireg)%levels(1)%patches(ipatch)
190  bctype = patch%bcType
191  IF ((bctype>=bc_regionconf .AND. bctype<=bc_regionconf+bc_range) .OR. &
192  (bctype>=bc_tra_peri .AND. bctype<=bc_tra_peri +bc_range) .OR. &
193  (bctype>=bc_rot_peri .AND. bctype<=bc_rot_peri +bc_range)) THEN
194  iregsrc = patch%srcRegion
195  ipatchsrc = patch%srcPatch
196  patchsrc => regions(iregsrc)%levels(1)%patches(ipatchsrc)
197  gridsrc => regions(iregsrc)%levels(1)%grid
198 
199  IF (regions(iregsrc)%procid /= global%myProcid) THEN
200  CALL rflo_exchangednoderecv( regions(ireg),regions(iregsrc), &
201  patch,patchsrc,.true.,grid%xyz )
202  ENDIF
203  ENDIF ! bcType
204  ENDDO ! iPatch
205 
206  ENDIF ! region on this processor and active, grid moving
207  ENDDO ! iReg
208 
209 ! clear send requests
210 
211  DO ireg=1,global%nRegions
212  IF (regions(ireg)%procid==global%myProcid .AND. & ! region active and
213  regions(ireg)%active==active .AND. & ! on my processor
214  regions(ireg)%mixtInput%moveGrid) THEN ! and moving
215  CALL rflo_clearsendrequests( regions,ireg,.true. )
216  ENDIF
217  ENDDO
218 
219 ! update grid, dummy, corner and edge cells -----------------------------------
220 
221  DO ireg=1,global%nRegions
222  IF (regions(ireg)%procid==global%myProcid .AND. & ! region active and
223  regions(ireg)%active==active .AND. & ! on my processor
224  regions(ireg)%mixtInput%moveGrid) THEN ! and moving
225 
226 ! --- change xyz from deformations to coordinates
227 
228  xyz => regions(ireg)%levels(1)%grid%xyz
229  xyzold => regions(ireg)%levels(1)%gridOld%xyz
230 
231  DO ijk=lbound(xyz,2),ubound(xyz,2)
232  xyz(xcoord,ijk) = xyz(xcoord,ijk) + xyzold(xcoord,ijk)
233  xyz(ycoord,ijk) = xyz(ycoord,ijk) + xyzold(ycoord,ijk)
234  xyz(zcoord,ijk) = xyz(zcoord,ijk) + xyzold(zcoord,ijk)
235  ENDDO
236 
237 ! --- update coarse grids and dummy cells
238 
239  CALL rflo_generatecoarsegrids( regions(ireg) ) ! coarsen finest grid
240  CALL rflo_copygeometrydummy( regions(ireg) ) ! copy to dummy nodes
241  CALL rflo_extrapolategeometry( regions(ireg) ) ! extrapolate
242  ENDIF ! region on this processor and active, grid moving
243  ENDDO ! iReg
244 
245  CALL rflo_exchangegeometry( regions ) ! exchange geometry
246 
247 ! finalize --------------------------------------------------------------------
248 
249  CALL deregisterfunction( global )
250 
251 END SUBROUTINE rflo_laplacegridsmoo
252 
253 !******************************************************************************
254 !
255 ! RCS Revision history:
256 !
257 ! $Log: RFLO_LaplaceGridSmoo.F90,v $
258 ! Revision 1.3 2008/12/06 08:44:07 mtcampbe
259 ! Updated license.
260 !
261 ! Revision 1.2 2008/11/19 22:17:20 mtcampbe
262 ! Added Illinois Open Source License/Copyright
263 !
264 ! Revision 1.1 2004/11/29 21:25:16 wasistho
265 ! lower to upper case
266 !
267 ! Revision 1.5 2003/11/20 16:40:34 mdbrandy
268 ! Backing out RocfluidMP changes from 11-17-03
269 !
270 ! Revision 1.2 2003/08/25 21:51:23 jblazek
271 ! Full version of global grid motion scheme.
272 !
273 ! Revision 1.1 2003/08/11 21:51:17 jblazek
274 ! Added basic global grid smoothing scheme.
275 !
276 !******************************************************************************
277 
278 
279 
280 
281 
282 
283 
subroutine rflo_copygeometrydummy(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 jpnbeg
j indices k indices k
Definition: Indexing.h:6
NT dx
**********************************************************************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 kpnbeg
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine rflo_extrapolategeometry(region)
subroutine rflo_exchangednoderecv(region, regionSrc, patch, patchSrc, average, dNode)
subroutine rflo_changeinteriorgrid(region, boundMoved, edgeMoved, arcLen12, arcLen34, arcLen56, xyzOld, xyz)
**********************************************************************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 jpnend
subroutine rflo_getnodeoffset(region, iLev, iNodeOffset, ijNodeOffset)
Definition: patch.h:74
subroutine rflo_calcfacevectors(region)
subroutine rflo_exchangegeometry(regions)
subroutine rflo_generatecoarsegrids(region)
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 ipnbeg
subroutine rflo_clearsendrequests(regions, iReg, geometry)
RT dz() const
Definition: Direction_3.h:133
subroutine rflo_laplacegridpatch(region, patch)
subroutine rflo_getdimensphysnodes(region, iLev, ipnbeg, ipnend, jpnbeg, jpnend, kpnbeg, kpnend)
j indices j
Definition: Indexing.h:6
NT dy
subroutine rflo_laplacegridsolve(region)
subroutine rflo_exchangednodecopy(region, regionSrc, patch, patchSrc, average, dNode, dNodeSrc)
subroutine grid(bp)
Definition: setup_py.f90:257
subroutine deregisterfunction(global)
Definition: ModError.F90:469
**********************************************************************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 ipnend
subroutine rflo_exchangednodesend(region, regionSrc, patch, dNode)
subroutine rflo_laplacegridsmoo(regions, resid)