Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RFLO_MoveGridBlocks.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: redistribute grid nodes according to the movement of the
26 ! boundaries. This function distributes the deformations
27 ! in block-wise manner without any global smoothing.
28 !
29 ! Description: none.
30 !
31 ! Input: regions = data of all grid regions.
32 !
33 ! Output: regions%levels%grid%xyz = new grid coordinates.
34 !
35 ! Notes: grid%xyz temporarily stores nodal displacements. The deformation
36 ! is applied to the finest grid first.
37 !
38 !******************************************************************************
39 !
40 ! $Id: RFLO_MoveGridBlocks.F90,v 1.6 2008/12/06 08:44:27 mtcampbe Exp $
41 !
42 ! Copyright: (c) 2001 by the University of Illinois
43 !
44 !******************************************************************************
45 
46 SUBROUTINE rflo_movegridblocks( regions )
47 
48  USE moddatatypes
49  USE modglobal, ONLY : t_global
50  USE moddatastruct, ONLY : t_region
51  USE modgrid, ONLY : t_grid
58  USE moderror
59  USE modmpi
60  USE modparameters
61  IMPLICIT NONE
62 
63 #ifdef GENX
64  include 'roccomf90.h'
65 #endif
66 
67 ! ... parameters
68  TYPE(t_region), POINTER :: regions(:)
69 
70 ! ... loop variables
71  INTEGER :: ireg
72 
73 ! ... local variables
74  LOGICAL :: somemoved, someremesh
75 
76  INTEGER :: iremesh, jremesh, nremesh
77 
78  TYPE(t_grid), POINTER :: grid, gridold
79  TYPE(t_global), POINTER :: global
80 #ifdef GENX
81  DOUBLE PRECISION :: dalpha
82 #endif
83 
84 !******************************************************************************
85 
86  global => regions(1)%global
87 
88  CALL registerfunction( global,'RFLO_MoveGridBlocks',&
89  'RFLO_MoveGridBlocks.F90' )
90 
91 #ifdef GENX
92 ! update geometry buffers -----------------------------------------------------
93 
94  dalpha = global%dtMin/global%dTimeSystem
95  CALL com_call_function( global%genxHandleGm,1,dalpha )
96 #endif
97 
98 ! receive and distribute deformations for each region -------------------------
99 
100  CALL rflo_movegridsurfaces( regions,somemoved )
101 
102 ! fix interfaces between regions ----------------------------------------------
103 
104  IF (somemoved) THEN
105  CALL rflo_movegridinterfaces( regions )
106  ENDIF
107 
108 ! update grid, dummy, corner and edge cells -----------------------------------
109 
110  IF (somemoved) THEN
111  DO ireg=1,global%nRegions
112  IF (regions(ireg)%procid==global%myProcid .AND. & ! region active and
113  regions(ireg)%active==active .AND. & ! on my processor
114  regions(ireg)%mixtInput%moveGrid) THEN ! and moving
115 
116 ! ----- change the interior grid
117 
118  grid => regions(ireg)%levels(1)%grid
119  gridold => regions(ireg)%levels(1)%gridOld
120  CALL rflo_changeinteriorgrid( regions(ireg),grid%boundMoved, &
121  grid%edgeMoved,grid%arcLen12, &
122  grid%arcLen34,grid%arcLen56, &
123  gridold%xyzOld,grid%xyz )
124 
125 ! ----- update coarse grids and dummy cells
126 
127  CALL rflo_generatecoarsegrids( regions(ireg) ) ! coarsen finest grid
128  CALL rflo_copygeometrydummy( regions(ireg) ) ! copy to dummy nodes
129  CALL rflo_extrapolategeometry( regions(ireg) ) ! extrapolate
130  ENDIF ! region on this processor and active, grid moving
131  ENDDO ! iReg
132  CALL rflo_exchangegeometry( regions ) ! exchange geometry
133  ENDIF
134 
135 ! calculate new metrics and grid speeds ---------------------------------------
136 
137  someremesh = .false.
138  iremesh = 0
139  DO ireg=1,global%nRegions
140  IF (regions(ireg)%procid==global%myProcid .AND. & ! region active and
141  regions(ireg)%active==active .AND. & ! on my processor
142  regions(ireg)%mixtInput%moveGrid) THEN ! and moving
143  CALL rflo_calcfacevectors( regions(ireg) ) ! faces
144  CALL rflo_calccontrolvolumes( regions(ireg) ) ! volumes
145  CALL rflo_calccellcentroids( regions(ireg) ) ! cell centroids
146  IF (regions(ireg)%mixtInput%faceEdgeAvg==fe_avg_linear) &
147  CALL rflo_c2favgcoeffs( regions(ireg) ) ! cell2face averaging
148  CALL rflo_c2eavgcoeffs( regions(ireg) ) ! cell2edge averaging
149  CALL rflo_checkmetrics( ireg,regions(ireg) ) ! check metrics
150 ! IF (regions(iReg)%levels(1)%grid%remesh==1) THEN
151 ! CALL RFLO_GridRemesh( regions(iReg) ) ! grid remeshing
152 ! iRemesh=1
153 ! ENDIF
154  CALL rflo_calcgridspeeds( regions(ireg) ) ! grid speeds
155  ENDIF ! region on this processor and active, grid moving
156  ENDDO ! iReg
157 
158 ! recompute grid metrics due to remeshing -------------------------------------
159 
160 #ifdef MPI
161  CALL mpi_allreduce( iremesh, nremesh, 1, mpi_integer, mpi_sum, &
162  global%mpiComm, global%mpierr )
163  IF (global%mpierr /=0 ) CALL errorstop( global,err_mpi_trouble,__line__ )
164  IF (nremesh > 0) someremesh = .true.
165 #endif
166 
167  IF (someremesh) THEN
168  CALL rflo_exchangegeometry( regions ) ! exchange geometry
169  DO ireg=1,global%nRegions
170  IF (regions(ireg)%procid==global%myProcid .AND. & ! region active and
171  regions(ireg)%active==active .AND. & ! on my processor
172  iremesh==1) THEN ! and remeshing
173  CALL rflo_calcfacevectors( regions(ireg) ) ! faces
174  CALL rflo_calccontrolvolumes( regions(ireg) ) ! volumes
175  CALL rflo_calccellcentroids( regions(ireg) ) ! cell centroids
176  IF (regions(ireg)%mixtInput%faceEdgeAvg==fe_avg_linear) &
177  CALL rflo_c2favgcoeffs( regions(ireg) ) ! cell2face averaging
178  CALL rflo_c2eavgcoeffs( regions(ireg) ) ! cell2edge averaging
179  ENDIF ! region on this processor and active, grid moving
180  ENDDO ! iReg
181  ENDIF
182 
183 ! finalize --------------------------------------------------------------------
184 
185  CALL deregisterfunction( global )
186 
187 END SUBROUTINE rflo_movegridblocks
188 
189 !******************************************************************************
190 !
191 ! RCS Revision history:
192 !
193 ! $Log: RFLO_MoveGridBlocks.F90,v $
194 ! Revision 1.6 2008/12/06 08:44:27 mtcampbe
195 ! Updated license.
196 !
197 ! Revision 1.5 2008/11/19 22:17:38 mtcampbe
198 ! Added Illinois Open Source License/Copyright
199 !
200 ! Revision 1.4 2006/03/05 19:13:46 wasistho
201 ! set computational space coordinates from initial grid
202 !
203 ! Revision 1.3 2005/05/28 05:52:38 wasistho
204 ! refrain from grid remeshing
205 !
206 ! Revision 1.2 2005/05/27 01:51:24 wasistho
207 ! added remeshing
208 !
209 ! Revision 1.1 2004/11/29 20:51:39 wasistho
210 ! lower to upper case
211 !
212 ! Revision 1.8 2004/09/02 02:35:20 wasistho
213 ! added face-edge averaging input-option parameter in Rocflo
214 !
215 ! Revision 1.7 2004/08/03 22:46:27 wasistho
216 ! added RFLO_c2eAvgCoeffs
217 !
218 ! Revision 1.6 2004/07/30 17:26:18 wasistho
219 ! provide cell2face averaging coefficients
220 !
221 ! Revision 1.5 2003/11/20 16:40:39 mdbrandy
222 ! Backing out RocfluidMP changes from 11-17-03
223 !
224 ! Revision 1.1 2003/08/11 21:51:18 jblazek
225 ! Added basic global grid smoothing scheme.
226 !
227 ! Revision 1.15 2003/05/15 02:57:04 jblazek
228 ! Inlined index function.
229 !
230 ! Revision 1.14 2003/05/09 17:01:03 jiao
231 ! Renamed the COM_call_function_handlers to COM_call_function.
232 !
233 ! Revision 1.13 2003/05/06 20:05:39 jblazek
234 ! Corrected bug in grid motion (corner "averaging").
235 !
236 ! Revision 1.12 2003/04/10 00:30:06 jblazek
237 ! Corrected bug in grid movement algorithm.
238 !
239 ! Revision 1.11 2003/03/14 22:05:11 jblazek
240 ! Improved mesh motion algorithm - node movement exchaged between blocks.
241 !
242 ! Revision 1.10 2002/10/12 03:20:50 jblazek
243 ! Replaced [io]stat=global%error with local errorFlag for Rocflo.
244 !
245 ! Revision 1.9 2002/09/20 22:22:36 jblazek
246 ! Finalized integration into GenX.
247 !
248 ! Revision 1.8 2002/09/05 17:40:21 jblazek
249 ! Variable global moved into regions().
250 !
251 ! Revision 1.7 2002/08/29 23:32:28 jblazek
252 ! Changed name of index pointer for grid speeds.
253 !
254 ! Revision 1.6 2002/08/27 20:44:31 jblazek
255 ! Implemented calculation of grid speeds.
256 !
257 ! Revision 1.5 2002/08/20 00:13:24 jblazek
258 ! Removed print statements.
259 !
260 ! Revision 1.4 2002/08/20 00:07:55 jblazek
261 ! Corrected dimension of arcLen56.
262 !
263 ! Revision 1.3 2002/08/15 19:48:05 jblazek
264 ! Implemented grid deformation capability.
265 !
266 ! Revision 1.2 2002/02/21 23:25:06 jblazek
267 ! Blocks renamed as regions.
268 !
269 ! Revision 1.1 2002/01/16 22:03:35 jblazek
270 ! Added time-stepping routines.
271 !
272 !******************************************************************************
273 
274 
275 
276 
277 
278 
279 
subroutine rflo_copygeometrydummy(region)
subroutine rflo_calccellcentroids(region)
subroutine rflo_c2eavgcoeffs(region)
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine rflo_extrapolategeometry(region)
subroutine rflo_c2favgcoeffs(region)
subroutine rflo_changeinteriorgrid(region, boundMoved, edgeMoved, arcLen12, arcLen34, arcLen56, xyzOld, xyz)
subroutine rflo_movegridinterfaces(regions)
subroutine rflo_calccontrolvolumes(region)
subroutine rflo_calcfacevectors(region)
subroutine rflo_exchangegeometry(regions)
subroutine rflo_movegridsurfaces(regions, someMoved)
subroutine rflo_generatecoarsegrids(region)
subroutine rflo_calcgridspeeds(region)
subroutine rflo_gridremesh(region)
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine grid(bp)
Definition: setup_py.f90:257
subroutine deregisterfunction(global)
Definition: ModError.F90:469
subroutine rflo_checkmetrics(iReg, region)
subroutine rflo_movegridblocks(regions)