Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RFLU_ModRelatedPatches.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: Suite of routines for transforming data on related patches.
26 !
27 ! Description: None.
28 !
29 ! Notes: None.
30 !
31 ! ******************************************************************************
32 !
33 ! $Id: RFLU_ModRelatedPatches.F90,v 1.5 2008/12/06 08:44:23 mtcampbe Exp $
34 !
35 ! Copyright: (c) 2006 by the University of Illinois
36 !
37 ! ******************************************************************************
38 
40 
41  USE moddatatypes
42  USE modparameters
43  USE moderror
44  USE modglobal, ONLY: t_global
45  USE modbndpatch, ONLY: t_patch
46  USE moddatastruct, ONLY: t_region
47  USE modgrid, ONLY: t_grid
48  USE modmpi
49 
50  IMPLICIT NONE
51 
52  PRIVATE
53  PUBLIC :: rflu_relp_transformvector, &
55 
56 
57 ! ******************************************************************************
58 ! Declarations and definitions
59 ! ******************************************************************************
60 
61  CHARACTER(CHRLEN) :: &
62  RCSIdentString = '$RCSfile: RFLU_ModRelatedPatches.F90,v $ $Revision: 1.5 $'
63 
64 ! ******************************************************************************
65 ! Routines
66 ! ******************************************************************************
67 
68  CONTAINS
69 
70 
71 
72 
73 
74 ! ******************************************************************************
75 !
76 ! Purpose: Wrapper for transforming data for virtual cells associated with
77 ! periodic patches.
78 !
79 ! Description: None.
80 !
81 ! Input:
82 ! pRegion Pointer to region
83 ! pPatch Pointer to patch
84 !
85 ! Output: None.
86 !
87 ! Notes: None.
88 !
89 ! ******************************************************************************
90 
91  SUBROUTINE rflu_relp_periodicwrapper(pRegion,pPatch)
92 
93  IMPLICIT NONE
94 
95 ! ******************************************************************************
96 ! Declarations and definitions
97 ! ******************************************************************************
98 
99 ! ==============================================================================
100 ! Arguments
101 ! ==============================================================================
102 
103  TYPE(t_patch), POINTER :: ppatch
104  TYPE(t_region), POINTER :: pregion
105 
106 ! ==============================================================================
107 ! Local variables
108 ! ==============================================================================
109 
110  INTEGER :: errorflag,icg,icl
111  REAL(RFREAL) :: ct,ex,ey,ez,st,theta
112  REAL(RFREAL) :: v(3),vr(3)
113  REAL(RFREAL) :: rotmat(3,3)
114  REAL(RFREAL), DIMENSION(:,:), POINTER :: pvar
115  TYPE(t_global), POINTER :: global
116  TYPE(t_grid), POINTER :: pgrid
117 
118 ! ******************************************************************************
119 ! Start
120 ! ******************************************************************************
121 
122  global => pregion%global
123 
124  CALL registerfunction(global,'RFLU_RELP_PeriodicWrapper',&
125  'RFLU_ModRelatedPatches.F90')
126 
127 ! ******************************************************************************
128 ! Set pointers and variables
129 ! ******************************************************************************
130 
131  pgrid => pregion%grid
132 
133 ! ******************************************************************************
134 ! Check boundary condition - defensive coding
135 ! ******************************************************************************
136 
137  IF ( ppatch%bcType /= bc_periodic ) THEN
138  CALL errorstop(global,err_bc_invalid,__line__)
139  END IF ! pPatch%bcType
140 
141 ! ******************************************************************************
142 ! Define rotation matrix
143 ! ******************************************************************************
144 
145  theta = ppatch%angleRelated
146 
147  ct = cos(theta)
148  st = sin(theta)
149 
150  SELECT CASE ( ppatch%axisRelated )
151  CASE ( 1 )
152  ex = 1.0_rfreal
153  ey = 0.0_rfreal
154  ez = 0.0_rfreal
155  CASE ( 2 )
156  ex = 0.0_rfreal
157  ey = 1.0_rfreal
158  ez = 0.0_rfreal
159  CASE ( 3 )
160  ex = 0.0_rfreal
161  ey = 0.0_rfreal
162  ez = 1.0_rfreal
163  CASE default
164  CALL errorstop(global,err_reached_default,__line__)
165  END SELECT ! pPatch%axisRelated
166 
167  rotmat(1,1) = ct + (1.0_rfreal-ct)*ex*ex
168  rotmat(1,2) = (1.0_rfreal-ct)*ex*ey - st*ez
169  rotmat(1,3) = (1.0_rfreal-ct)*ex*ez + st*ey
170 
171  rotmat(2,1) = (1.0_rfreal-ct)*ey*ex + st*ez
172  rotmat(2,2) = ct + (1.0_rfreal-ct)*ey*ey
173  rotmat(2,3) = (1.0_rfreal-ct)*ey*ez - st*ex
174 
175  rotmat(3,1) = (1.0_rfreal-ct)*ez*ex - st*ey
176  rotmat(3,2) = (1.0_rfreal-ct)*ez*ey + st*ex
177  rotmat(3,3) = ct + (1.0_rfreal-ct)*ez*ez
178 
179 ! ******************************************************************************
180 ! Mixture
181 ! ******************************************************************************
182 
183  pvar => pregion%mixt%cv
184 
185  DO icl = 1,ppatch%nBCellsVirt
186  icg = ppatch%bvc(icl)
187 
188  v(1) = pvar(cv_mixt_xmom,icg)
189  v(2) = pvar(cv_mixt_ymom,icg)
190  v(3) = pvar(cv_mixt_zmom,icg)
191 
192  vr = matmul(rotmat,v)
193 
194  pvar(cv_mixt_xmom,icg) = vr(1)
195  pvar(cv_mixt_ymom,icg) = vr(2)
196  pvar(cv_mixt_zmom,icg) = vr(3)
197  END DO ! icl
198 
199 ! ******************************************************************************
200 ! Physical modules
201 ! ******************************************************************************
202 
203 ! TO DO
204 !
205 ! END TO DO
206 
207 ! ******************************************************************************
208 ! End
209 ! ******************************************************************************
210 
211  CALL deregisterfunction(global)
212 
213  END SUBROUTINE rflu_relp_periodicwrapper
214 
215 
216 
217 
218 
219 
220 ! ******************************************************************************
221 !
222 ! Purpose: Wrapper for transforming data for virtual cells associated with
223 ! symmetry patches.
224 !
225 ! Description: None.
226 !
227 ! Input:
228 ! pRegion Pointer to region
229 ! pPatch Pointer to patch
230 !
231 ! Output: None.
232 !
233 ! Notes: None.
234 !
235 ! ******************************************************************************
236 
237  SUBROUTINE rflu_relp_symmetrywrapper(pRegion,pPatch)
238 
239  USE modinterfaces, ONLY: reflectvector
240 
241  IMPLICIT NONE
242 
243 ! ******************************************************************************
244 ! Declarations and definitions
245 ! ******************************************************************************
246 
247 ! ==============================================================================
248 ! Arguments
249 ! ==============================================================================
250 
251  TYPE(t_patch), POINTER :: ppatch
252  TYPE(t_region), POINTER :: pregion
253 
254 ! ==============================================================================
255 ! Local variables
256 ! ==============================================================================
257 
258  INTEGER :: icg,icl
259  REAL(RFREAL) :: nx,ny,nz,vx,vy,vz
260  REAL(RFREAL), DIMENSION(:,:), POINTER :: pvar
261  TYPE(t_global), POINTER :: global
262  TYPE(t_grid), POINTER :: pgrid
263 
264 ! ******************************************************************************
265 ! Start
266 ! ******************************************************************************
267 
268  global => pregion%global
269 
270  CALL registerfunction(global,'RFLU_RELP_SymmetryWrapper',&
271  'RFLU_ModRelatedPatches.F90')
272 
273 ! ******************************************************************************
274 ! Check boundary condition - defensive coding
275 ! ******************************************************************************
276 
277  IF ( ppatch%bcType /= bc_symmetry ) THEN
278  CALL errorstop(global,err_bc_invalid,__line__)
279  END IF ! pPatch%bcType
280 
281 ! ******************************************************************************
282 ! Get patch normal
283 ! ******************************************************************************
284 
285  nx = ppatch%pn(xcoord)
286  ny = ppatch%pn(ycoord)
287  nz = ppatch%pn(zcoord)
288 
289 ! ******************************************************************************
290 ! Mixture
291 ! ******************************************************************************
292 
293  pvar => pregion%mixt%cv
294 
295  DO icl = 1,ppatch%nBCellsVirt
296  icg = ppatch%bvc(icl)
297 
298  vx = pvar(cv_mixt_xmom,icg)
299  vy = pvar(cv_mixt_ymom,icg)
300  vz = pvar(cv_mixt_zmom,icg)
301 
302  CALL reflectvector(nx,ny,nz,vx,vy,vz)
303 
304  pvar(cv_mixt_xmom,icg) = vx
305  pvar(cv_mixt_ymom,icg) = vy
306  pvar(cv_mixt_zmom,icg) = vz
307  END DO ! icl
308 
309 ! ******************************************************************************
310 ! Physical modules
311 ! ******************************************************************************
312 
313 ! TO DO
314 !
315 ! END TO DO
316 
317 ! ******************************************************************************
318 ! End
319 ! ******************************************************************************
320 
321  CALL deregisterfunction(global)
322 
323  END SUBROUTINE rflu_relp_symmetrywrapper
324 
325 
326 
327 
328 
329 
330 
331 ! ******************************************************************************
332 !
333 ! Purpose: Transform vector.
334 !
335 ! Description: None.
336 !
337 ! Input:
338 ! pRegion Pointer to region
339 ! pPatch Pointer to patch
340 ! vx x-component of vector
341 ! vy y-component of vector
342 ! vz z-component of vector
343 !
344 ! Output:
345 ! vx x-component of transformed vector
346 ! vy y-component of transformed vector
347 ! vz z-component of transformed vector
348 !
349 ! Notes: None.
350 !
351 ! ******************************************************************************
352 
353  SUBROUTINE rflu_relp_transformvector(pRegion,pPatch,vx,vy,vz)
354 
355  IMPLICIT NONE
356 
357 ! ******************************************************************************
358 ! Declarations and definitions
359 ! ******************************************************************************
360 
361 ! ==============================================================================
362 ! Arguments
363 ! ==============================================================================
364 
365  REAL(RFREAL), INTENT(INOUT) :: vx,vy,vz
366  TYPE(t_patch), POINTER :: ppatch
367  TYPE(t_region), POINTER :: pregion
368 
369 ! ==============================================================================
370 ! Local variables
371 ! ==============================================================================
372 
373  REAL(RFREAL) :: v(4),vt(4)
374  TYPE(t_global), POINTER :: global
375 
376 ! ******************************************************************************
377 ! Start
378 ! ******************************************************************************
379 
380  global => pregion%global
381 
382  CALL registerfunction(global,'RFLU_RELP_TransformVector',&
383  'RFLU_ModRelatedPatches.F90')
384 
385 ! ******************************************************************************
386 ! Check boundary condition - defensive coding
387 ! ******************************************************************************
388 
389  IF ( ppatch%bcType /= bc_periodic ) THEN
390  CALL errorstop(global,err_bc_invalid,__line__)
391  END IF ! pPatch%bcType
392 
393 ! ******************************************************************************
394 ! Transform vector
395 ! ******************************************************************************
396 
397  v(1) = vx
398  v(2) = vy
399  v(3) = vz
400  v(4) = 1.0_rfreal
401 
402  vt = matmul(ppatch%tm,v)
403 
404  vx = vt(1)
405  vy = vt(2)
406  vz = vt(3)
407 
408 ! ******************************************************************************
409 ! End
410 ! ******************************************************************************
411 
412  CALL deregisterfunction(global)
413 
414  END SUBROUTINE rflu_relp_transformvector
415 
416 
417 
418 
419 
420 
421 ! ******************************************************************************
422 !
423 ! Purpose: Wrapper for transforming data for virtual cells associated with
424 ! periodic patches.
425 !
426 ! Description: None.
427 !
428 ! Input:
429 ! pRegion Pointer to region
430 !
431 ! Output: None.
432 !
433 ! Notes: None.
434 !
435 ! ******************************************************************************
436 
437  SUBROUTINE rflu_relp_transformwrapper(pRegion)
438 
439  IMPLICIT NONE
440 
441 ! ******************************************************************************
442 ! Declarations and definitions
443 ! ******************************************************************************
444 
445 ! ==============================================================================
446 ! Arguments
447 ! ==============================================================================
448 
449  TYPE(t_region), POINTER :: pregion
450 
451 ! ==============================================================================
452 ! Local variables
453 ! ==============================================================================
454 
455  INTEGER :: errorflag,ipatch
456  TYPE(t_global), POINTER :: global
457  TYPE(t_grid), POINTER :: pgrid
458  TYPE(t_patch), POINTER :: ppatch
459 
460 ! ******************************************************************************
461 ! Start
462 ! ******************************************************************************
463 
464  global => pregion%global
465 
466  CALL registerfunction(global,'RFLU_RELP_TransformWrapper',&
467  'RFLU_ModRelatedPatches.F90')
468 
469 ! ******************************************************************************
470 ! Set pointers
471 ! ******************************************************************************
472 
473  pgrid => pregion%grid
474 
475 ! ******************************************************************************
476 ! Loop over patches
477 ! ******************************************************************************
478 
479  DO ipatch = 1,pgrid%nPatches
480  ppatch => pregion%patches(ipatch)
481 
482  IF ( ppatch%nBCellsVirt > 0 ) THEN
483  SELECT CASE ( ppatch%bcType )
484  CASE ( bc_periodic )
485  CALL rflu_relp_periodicwrapper(pregion,ppatch)
486  CASE ( bc_symmetry )
487  CALL rflu_relp_symmetrywrapper(pregion,ppatch)
488  CASE default
489  CALL errorstop(global,err_reached_default,__line__)
490  END SELECT ! pPatch%bcType
491  END IF ! pPatch%nBCellsVirt
492  END DO ! iPatch
493 
494 ! ******************************************************************************
495 ! End
496 ! ******************************************************************************
497 
498  CALL deregisterfunction(global)
499 
500  END SUBROUTINE rflu_relp_transformwrapper
501 
502 
503 
504 
505 
506 
507 
508 
509 
510 ! ******************************************************************************
511 ! End
512 ! ******************************************************************************
513 
514 END MODULE rflu_modrelatedpatches
515 
516 
517 ! ******************************************************************************
518 !
519 ! RCS Revision history:
520 !
521 ! $Log: RFLU_ModRelatedPatches.F90,v $
522 ! Revision 1.5 2008/12/06 08:44:23 mtcampbe
523 ! Updated license.
524 !
525 ! Revision 1.4 2008/11/19 22:17:34 mtcampbe
526 ! Added Illinois Open Source License/Copyright
527 !
528 ! Revision 1.3 2006/08/19 16:09:51 fnajjar
529 ! Added routine to transform vector
530 !
531 ! Revision 1.2 2006/04/07 15:19:20 haselbac
532 ! Removed tabs
533 !
534 ! Revision 1.1 2006/03/25 21:38:54 haselbac
535 ! Initial revision
536 !
537 ! ******************************************************************************
538 
539 
540 
541 
542 
543 
544 
545 
546 
547 
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine rflu_relp_periodicwrapper(pRegion, pPatch)
*********************************************************************Illinois Open Source License ****University of Illinois NCSA **Open Source License University of Illinois All rights reserved ****Developed free of to any person **obtaining a copy of this software and associated documentation to deal with the Software without including without limitation the rights to and or **sell copies of the and to permit persons to whom the **Software is furnished to do subject to the following this list of conditions and the following disclaimers ****Redistributions in binary form must reproduce the above **copyright this list of conditions and the following **disclaimers in the documentation and or other materials **provided with the distribution ****Neither the names of the Center for Simulation of Advanced the University of nor the names of its **contributors may be used to endorse or promote products derived **from this Software without specific prior written permission ****THE SOFTWARE IS PROVIDED AS 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 v
Definition: roccomf90.h:20
subroutine reflectvector(nx, ny, nz, xComp, yComp, zComp)
NT & sin
subroutine, public rflu_relp_transformwrapper(pRegion)
subroutine, public rflu_relp_transformvector(pRegion, pPatch, vx, vy, vz)
subroutine rflu_relp_symmetrywrapper(pRegion, pPatch)
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469
NT & cos