Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PLAG_RFLU_Update.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: Update step for PLAG module.
26 !
27 ! Description: None.
28 !
29 ! Input:
30 ! pRegion Pointer to region
31 ! iStage Current RK stage
32 !
33 ! Output: None.
34 !
35 ! Notes:
36 ! 1. This corresponds to Part IV Steps 10d and Part V in RocfluidMP
37 ! framework description.
38 !
39 ! ******************************************************************************
40 !
41 ! $Id: PLAG_RFLU_Update.F90,v 1.22 2008/12/06 08:44:35 mtcampbe Exp $
42 !
43 ! Copyright: (c) 2004-2005 by the University of Illinois
44 !
45 ! ******************************************************************************
46 
47 SUBROUTINE plag_rflu_update(pRegion,iStage)
48 
49  USE moddatatypes
50  USE modglobal, ONLY: t_global
51  USE moddatastruct, ONLY: t_region
52  USE modpartlag, ONLY: t_plag
53  USE moderror
54  USE modmpi
55 
56  USE modparameters
58 
59  USE modinterfaces, ONLY: rflu_decideprint, &
61 
65  plag_updatedatastruct
66 
70 
71  IMPLICIT NONE
72 
73 ! ******************************************************************************
74 ! Declarations and definitions
75 ! ******************************************************************************
76 
77 ! ==============================================================================
78 ! Arguments
79 ! ==============================================================================
80 
81  INTEGER, INTENT(IN) :: istage
82  TYPE(t_region), POINTER :: pregion
83 
84 ! ==============================================================================
85 ! Locals
86 ! ==============================================================================
87 
88  CHARACTER(CHRLEN) :: rcsidentstring
89  LOGICAL :: doprint
90  INTEGER :: ireg
91  TYPE(t_global), POINTER :: global
92  TYPE(t_plag), POINTER :: pplag
93 
94 ! ******************************************************************************
95 ! Start
96 ! ******************************************************************************
97 
98  rcsidentstring = '$RCSfile: PLAG_RFLU_Update.F90,v $ $Revision: 1.22 $'
99 
100  global => pregion%global
101 
102  CALL registerfunction(global,'PLAG_RFLU_Update',&
103  'PLAG_RFLU_Update.F90')
104 
105 ! ******************************************************************************
106 ! Set variables and pointers
107 ! ******************************************************************************
108 
109  pplag => pregion%plag
110 
111  ireg = pregion%iRegionGlobal
112 
113 ! ******************************************************************************
114 ! Initialize send counters even for null nPcls
115 ! ******************************************************************************
116 
117  CALL plag_rflu_initsendcounters(pregion)
118 
119 ! ******************************************************************************
120 ! Main algorithm for discrete particle evolution
121 ! ******************************************************************************
122 
123  IF ( pplag%nPcls > 0 ) THEN
124 
125 ! ==============================================================================
126 ! Calculate RHS for position vector
127 ! ==============================================================================
128 
129  CALL plag_calcrhsposition(pregion)
130 
131 ! ==============================================================================
132 ! Invoke RK Update
133 ! ==============================================================================
134 
135  CALL rkupdategeneric(pregion,var_type_point,istage,1,pplag%nPcls,1, &
136  pplag%nCv,pplag%cv,pplag%cvOld,pplag%rhs,pplag%rhsSum)
137 
138 ! TEMPORARY
139 ! ==============================================================================
140 ! Create New location for particle search testing
141 ! ==============================================================================
142 !
143 ! CALL PLAG_CreateLocation(pRegion)
144 ! END TEMPORARY
145 
146 ! ==============================================================================
147 ! Determine total distance travelled
148 ! ==============================================================================
149 
150  CALL plag_rflu_computedisttot(pregion)
151 
152 ! ==============================================================================
153 ! Invoke particle location search. NOTE brute-force and Octree cannot deal
154 ! with particles hitting the wall and bouncing. They should only be used for
155 ! testing purposes.
156 ! ==============================================================================
157 
158  SELECT CASE ( pregion%plagInput%findPclMethod )
159  CASE ( find_pcl_method_traj_fast )
160  CALL plag_rflu_findcellstrajfast(pregion,1,pplag%nPcls)
161  CASE ( find_pcl_method_traj_safe )
162  CALL plag_rflu_findcellstrajsafe(pregion,1,pplag%nPcls)
163  CASE ( find_pcl_method_brute )
164  CALL plag_rflu_findcellsbrutemod(pregion)
165  CASE ( find_pcl_method_oct )
166  CALL plag_rflu_findcellsoctmod(pregion)
167  CASE ( find_pcl_method_lohner )
168  CALL plag_rflu_findcellslohner(pregion)
169  CASE default
170  CALL errorstop(global,err_reached_default,__line__)
171  END SELECT ! pRegion%plagInput%findPclMethod
172 
173 ! ==============================================================================
174 ! Update particle data structure
175 ! Note: done for serial computations, else for parallel runs
176 ! update performed in PLAG_RFLU_CommDriver
177 ! ==============================================================================
178 
179  IF ( global%nRegions == 1 ) &
180  CALL plag_updatedatastruct(pregion)
181  END IF ! nPcls
182 
183 ! ******************************************************************************
184 ! Invoke injection algorithm at last RK stage
185 ! ******************************************************************************
186 
187  IF ( istage == global%nrkSteps ) THEN
188  CALL plag_rflu_injectiondriver(pregion)
189  END IF ! iStage
190 
191 ! ******************************************************************************
192 ! Print number of particles in the domain
193 ! ******************************************************************************
194 
195 ! TEMPORARY
196 ! IF ( iStage == global%nrkSteps ) THEN
197 ! doPrint = RFLU_DecidePrint(global)
198 ! IF ( (global%verbLevel > VERBOSE_NONE) .AND. (doPrint .EQV. .TRUE.) ) &
199 ! WRITE(STDOUT,'(A,I4,I8)') 'iReg: nPcls = ',iReg,pPlag%nPcls
200 ! END IF ! iStage
201 ! END TEMPORARY
202 
203 ! ******************************************************************************
204 ! Invoke breakup algorithm at last RK stage
205 ! ******************************************************************************
206 
207  IF ( pregion%plagInput%breakupModel > plag_breakup_nomodel .AND. &
208  istage == global%nrkSteps ) THEN
209  CALL plag_calcbreakup(pregion,ireg)
210  END IF ! pRegion%plagInput%breakupModel
211 
212 ! ******************************************************************************
213 ! Invoke memory reallocation at last RK stage and for non null size
214 ! ******************************************************************************
215 
216  IF ( pplag%nPcls > 0 .AND. istage == global%nrkSteps ) THEN
217  CALL plag_reallocmemwrapper(pregion)
218  END IF ! pPlag%nPcls
219 
220 ! ******************************************************************************
221 ! End
222 ! ******************************************************************************
223 
224  CALL deregisterfunction( global )
225 
226 END SUBROUTINE plag_rflu_update
227 
228 ! ******************************************************************************
229 !
230 ! RCS Revision history:
231 !
232 ! $Log: PLAG_RFLU_Update.F90,v $
233 ! Revision 1.22 2008/12/06 08:44:35 mtcampbe
234 ! Updated license.
235 !
236 ! Revision 1.21 2008/11/19 22:17:48 mtcampbe
237 ! Added Illinois Open Source License/Copyright
238 !
239 ! Revision 1.20 2007/03/20 22:04:07 fnajjar
240 ! Turned off printing of number of particles for each region separately
241 !
242 ! Revision 1.19 2006/05/20 19:08:24 fnajjar
243 ! Fixed bug by moving initialization of nPclsSend out IF nPcls Statement
244 !
245 ! Revision 1.18 2006/04/07 15:19:24 haselbac
246 ! Removed tabs
247 !
248 ! Revision 1.17 2005/12/19 16:47:12 fnajjar
249 ! Added if statement to call PLAG_UpdateDataStruc for single region
250 !
251 ! Revision 1.16 2005/05/18 22:21:29 fnajjar
252 ! Added init of send counters, comp of distTot
253 !
254 ! Revision 1.15 2005/05/02 21:59:02 haselbac
255 ! Adapted to changes in interface of PLAG_RFLU_FindCellsTraj routines
256 !
257 ! Revision 1.14 2005/04/27 14:57:58 fnajjar
258 ! Included module call to PLAG_RFLU_ModFindCells
259 !
260 ! Revision 1.13 2005/03/11 02:28:16 haselbac
261 ! Adapted to new PLAG_RFLU_FindCellsTrajXYZ routines
262 !
263 ! Revision 1.12 2005/01/01 21:32:21 haselbac
264 ! Added routine to find particle cells using Aptes method
265 !
266 ! Revision 1.11 2004/11/17 16:42:41 haselbac
267 ! Replaced RKUpdate call with call to RkUpdateGeneric
268 !
269 ! Revision 1.10 2004/11/06 21:08:41 fnajjar
270 ! Bug fix: added interface entries for particle-cell search routines
271 !
272 ! Revision 1.9 2004/11/06 18:48:44 fnajjar
273 ! Added doPrint statement to decide printout for nPcls
274 !
275 ! Revision 1.8 2004/11/05 21:50:09 fnajjar
276 ! Updated calls to particle-cell search routines
277 !
278 ! Revision 1.7 2004/10/11 22:10:01 haselbac
279 ! Renamed procedures, changed IF to SELECT
280 !
281 ! Revision 1.6 2004/10/08 22:11:20 haselbac
282 ! Added brute-force search option for finding particle positions
283 !
284 ! Revision 1.5 2004/07/29 16:32:22 fnajjar
285 ! Removed temporary io flag for cleaner version
286 !
287 ! Revision 1.4 2004/07/29 16:05:36 fnajjar
288 ! Removed temporary io file after memory reallocation
289 !
290 ! Revision 1.3 2004/07/28 18:58:54 fnajjar
291 ! Included dynamic memory reallocation call
292 !
293 ! Revision 1.2 2004/05/05 20:59:55 fnajjar
294 ! Clean up; removed output statements
295 !
296 ! Revision 1.1 2004/03/26 21:33:24 fnajjar
297 ! Initial import for RFLU-specific update routine
298 !
299 ! ******************************************************************************
300 
301 
302 
303 
304 
305 
306 
subroutine, public plag_rflu_findcellsoctmod(pRegion)
subroutine, public plag_rflu_findcellstrajfast(pRegion, iPclBeg, iPclEnd)
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine plag_rflu_injectiondriver(pRegion)
subroutine rkupdategeneric(region, varType, iStage, icBeg, icEnd, ivBeg, ivEnd, cv, cvOld, rhs, rhsSum)
subroutine, public plag_rflu_findcellsbrutemod(pRegion)
subroutine plag_calcbreakup(region, iReg)
subroutine plag_rflu_update(pRegion, iStage)
subroutine, public plag_rflu_initsendcounters(pRegion)
subroutine, public plag_rflu_findcellslohner(pRegion)
subroutine, public plag_rflu_computedisttot(pRegion)
subroutine plag_calcrhsposition(region)
LOGICAL function rflu_decideprint(global)
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469
subroutine, public plag_reallocmemwrapper(pRegion)
subroutine, public plag_rflu_findcellstrajsafe(pRegion, iPclBeg, iPclEnd)