Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RFLU_ModInterpolation.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 to carry out interpolation operations.
26 !
27 ! Description: None.
28 !
29 ! Notes: None.
30 ! 1. Removed RFLU_InterpCells2FacesPatches because it uses bf2bg
31 ! and bf2bg is being removed as bGradFace is moved from pRegion to patch
32 !
33 ! ******************************************************************************
34 !
35 ! $Id: RFLU_ModInterpolation.F90,v 1.21 2008/12/06 08:44:22 mtcampbe Exp $
36 !
37 ! Copyright: (c) 2002-2005 by the University of Illinois
38 !
39 ! ******************************************************************************
40 
42 
43  USE moddatatypes
44  USE moderror
45  USE modparameters
46  USE modglobal, ONLY: t_global
47  USE modbndpatch, ONLY: t_patch
48  USE moddatastruct, ONLY: t_region
49  USE modgrid, ONLY: t_grid
50  USE modtools, ONLY: compfact
51  USE modmpi
52 
54 
56 
57  IMPLICIT NONE
58 
59  PRIVATE
60  PUBLIC :: rflu_interpcells2face, &
65 
66  SAVE
67 
68 ! ******************************************************************************
69 ! Declarations and definitions
70 ! ******************************************************************************
71 
72  CHARACTER(CHRLEN) :: RCSIdentString = &
73  '$RCSfile: RFLU_ModInterpolation.F90,v $ $Revision: 1.21 $'
74 
75 
76 ! ******************************************************************************
77 ! Routines
78 ! ******************************************************************************
79 
80  CONTAINS
81 
82 
83 
84 ! ******************************************************************************
85 !
86 ! Purpose: Interpolation from cells to single face.
87 !
88 ! Description: None.
89 !
90 ! Input:
91 ! pRegion Pointer to region data
92 ! ifg Global face index
93 ! src Source array of cell data
94 !
95 ! Output:
96 ! dst Destination array of face data
97 !
98 ! Notes: None.
99 !
100 ! ******************************************************************************
101 
102  SUBROUTINE rflu_interpcells2face(pRegion,ifg,src,dst)
103 
104  IMPLICIT NONE
105 
106 ! ******************************************************************************
107 ! Declarations and definitions
108 ! ******************************************************************************
109 
110 ! ==============================================================================
111 ! Arguments
112 ! ==============================================================================
113 
114  INTEGER, INTENT(IN) :: ifg
115  REAL(RFREAL), DIMENSION(:,:), INTENT(IN) :: src
116  REAL(RFREAL), DIMENSION(:), INTENT(OUT) :: dst
117  TYPE(t_region), POINTER :: pregion
118 
119 ! ==============================================================================
120 ! Locals
121 ! ==============================================================================
122 
123  INTEGER :: errorflag,icg,idst,ienddst,iendsrc,isrc,isl
124  REAL(RFREAL) :: c11,c12,c13,c14,c22,c23,c24,c33,c34,c44,dx,dy,dz, &
125  r11,r12,r13,r14,r22,r23,r24,r33,r34,r44,term,wti
126  TYPE(t_grid), POINTER :: pgrid
127  TYPE(t_global), POINTER :: global
128 
129 ! ******************************************************************************
130 ! Start
131 ! ******************************************************************************
132 
133  global => pregion%global
134 
135  CALL registerfunction(global,'RFLU_InterpCells2Face',&
136  'RFLU_ModInterpolation.F90')
137 
138 ! ******************************************************************************
139 ! Set pointers and variables
140 ! ******************************************************************************
141 
142  pgrid => pregion%grid
143 
144  iendsrc = ubound(src,1)
145  ienddst = ubound(dst,1)
146 
147 ! ******************************************************************************
148 ! Get face weights
149 ! ******************************************************************************
150 
151 ! ==============================================================================
152 ! Select appropriate dimensionality
153 ! ==============================================================================
154 
155  SELECT CASE ( pregion%mixtInput%dimens )
156 
157 ! ------------------------------------------------------------------------------
158 ! Two dimensions
159 ! ------------------------------------------------------------------------------
160 
161  CASE ( 2 )
162  r11 = pgrid%f2cs(ifg)%xyzMoms(xyz_mom_11)
163  r12 = pgrid%f2cs(ifg)%xyzMoms(xyz_mom_12)
164  r22 = pgrid%f2cs(ifg)%xyzMoms(xyz_mom_22)
165  r13 = pgrid%f2cs(ifg)%xyzMoms(xyz_mom_13)
166  r23 = pgrid%f2cs(ifg)%xyzMoms(xyz_mom_23)
167  r33 = pgrid%f2cs(ifg)%xyzMoms(xyz_mom_33)
168 
169  c11 = 1.0_rfreal/r11
170  c22 = 1.0_rfreal/r22
171  c33 = 1.0_rfreal/r33
172 
173  c12 = - c11*r12
174  c13 = -(c11*r13 + c12*c22*r23)
175 
176  c23 = - c22*r23
177 
178 ! ------------------------------------------------------------------------------
179 ! Three dimensions
180 ! ------------------------------------------------------------------------------
181 
182  CASE ( 3 )
183  r11 = pgrid%f2cs(ifg)%xyzMoms(xyz_mom_11)
184  r12 = pgrid%f2cs(ifg)%xyzMoms(xyz_mom_12)
185  r22 = pgrid%f2cs(ifg)%xyzMoms(xyz_mom_22)
186  r13 = pgrid%f2cs(ifg)%xyzMoms(xyz_mom_13)
187  r23 = pgrid%f2cs(ifg)%xyzMoms(xyz_mom_23)
188  r33 = pgrid%f2cs(ifg)%xyzMoms(xyz_mom_33)
189  r14 = pgrid%f2cs(ifg)%xyzMoms(xyz_mom_14)
190  r24 = pgrid%f2cs(ifg)%xyzMoms(xyz_mom_24)
191  r34 = pgrid%f2cs(ifg)%xyzMoms(xyz_mom_34)
192  r44 = pgrid%f2cs(ifg)%xyzMoms(xyz_mom_44)
193 
194  c11 = 1.0_rfreal/r11
195  c22 = 1.0_rfreal/r22
196  c33 = 1.0_rfreal/r33
197  c44 = 1.0_rfreal/r44
198 
199  c12 = - c11*r12
200  c13 = -(c11*r13 + c12*c22*r23)
201  c14 = -(c11*r14 + c12*c22*r24 + c13*c33*r34)
202 
203  c23 = - c22*r23
204  c24 = -(c22*r24 + c23*c33*r34)
205 
206  c34 = - c33*r34
207 
208 ! ------------------------------------------------------------------------------
209 ! Default
210 ! ------------------------------------------------------------------------------
211 
212  CASE default
213  CALL errorstop(global,err_reached_default,__line__)
214  END SELECT ! pRegion%mixtInput%dimens
215 
216 ! ******************************************************************************
217 ! Initialize destination array
218 ! ******************************************************************************
219 
220  DO idst = 1,ienddst ! Explicit loop because of Frost problems
221  dst(idst) = 0.0_rfreal
222  END DO ! iDst
223 
224 ! ******************************************************************************
225 ! Loop over stencil members and interpolate
226 ! ******************************************************************************
227 
228 ! ==============================================================================
229 ! Select appropriate dimensionality
230 ! ==============================================================================
231 
232  SELECT CASE ( pregion%mixtInput%dimens )
233 
234 ! ------------------------------------------------------------------------------
235 ! Two dimensions
236 ! ------------------------------------------------------------------------------
237 
238  CASE ( 2 )
239  DO isl = 1,pgrid%f2cs(ifg)%nCellMembs
240  icg = pgrid%f2cs(ifg)%cellMembs(isl)
241 
242  dx = pgrid%cofg(xcoord,icg) - pgrid%fc(xcoord,ifg)
243  dy = pgrid%cofg(ycoord,icg) - pgrid%fc(ycoord,ifg)
244 
245  term = 1.0_rfreal/sqrt(dx*dx + dy*dy)
246 
247  dx = term*dx
248  dy = term*dy
249 
250  wti = term*c33*c33*(term + c23*dy + c13*dx)
251 
252  idst = 1
253 
254  DO isrc = 1,iendsrc
255  dst(idst) = dst(idst) + wti*src(isrc,icg)
256 
257  idst = idst + 1
258  END DO ! iSrc
259  END DO ! isl
260 
261 ! ------------------------------------------------------------------------------
262 ! Three dimensions
263 ! ------------------------------------------------------------------------------
264 
265  CASE ( 3 )
266  DO isl = 1,pgrid%f2cs(ifg)%nCellMembs
267  icg = pgrid%f2cs(ifg)%cellMembs(isl)
268 
269  dx = pgrid%cofg(xcoord,icg) - pgrid%fc(xcoord,ifg)
270  dy = pgrid%cofg(ycoord,icg) - pgrid%fc(ycoord,ifg)
271  dz = pgrid%cofg(zcoord,icg) - pgrid%fc(zcoord,ifg)
272 
273  term = 1.0_rfreal/sqrt(dx*dx + dy*dy + dz*dz)
274 
275  dx = term*dx
276  dy = term*dy
277  dz = term*dz
278 
279  wti = term*c44*c44*(term + c34*dz + c24*dy + c14*dx)
280 
281  idst = 1
282 
283  DO isrc = 1,iendsrc
284  dst(idst) = dst(idst) + wti*src(isrc,icg)
285 
286  idst = idst + 1
287  END DO ! iSrc
288  END DO ! isl
289 
290 ! ------------------------------------------------------------------------------
291 ! Default
292 ! ------------------------------------------------------------------------------
293 
294  CASE default
295  CALL errorstop(global,err_reached_default,__line__)
296  END SELECT ! pRegion%mixtInput%dimens
297 
298 ! ******************************************************************************
299 ! End
300 ! ******************************************************************************
301 
302  CALL deregisterfunction(global)
303 
304  END SUBROUTINE rflu_interpcells2face
305 
306 
307 
308 
309 
310 ! ******************************************************************************
311 !
312 ! Purpose: Interpolation from cells to single face on single patch.
313 !
314 ! Description: None.
315 !
316 ! Input:
317 ! pRegion Pointer to region data
318 ! pPatch Pointer to patch data
319 ! ifg Global face index
320 ! src Source array of cell data
321 !
322 ! Output:
323 ! dst Destination array of face data
324 !
325 ! Notes: None.
326 !
327 ! ******************************************************************************
328 
329  SUBROUTINE rflu_interpcells2facepatch(pRegion,pPatch,ifl,src,dst)
330 
331  IMPLICIT NONE
332 
333 ! ******************************************************************************
334 ! Declarations and definitions
335 ! ******************************************************************************
336 
337 ! ==============================================================================
338 ! Arguments
339 ! ==============================================================================
340 
341  INTEGER, INTENT(IN) :: ifl
342  REAL(RFREAL), DIMENSION(:,:), INTENT(IN) :: src
343  REAL(RFREAL), DIMENSION(:), INTENT(OUT) :: dst
344  TYPE(t_patch), POINTER :: ppatch
345  TYPE(t_region), POINTER :: pregion
346 
347 ! ==============================================================================
348 ! Locals
349 ! ==============================================================================
350 
351  INTEGER :: errorflag,icg,idst,ienddst,iendsrc,isrc,isl
352  REAL(RFREAL) :: c11,c12,c13,c14,c22,c23,c24,c33,c34,c44,dx,dy,dz, &
353  r11,r12,r13,r14,r22,r23,r24,r33,r34,r44,term,wti
354  TYPE(t_grid), POINTER :: pgrid
355  TYPE(t_global), POINTER :: global
356 
357 ! ******************************************************************************
358 ! Start
359 ! ******************************************************************************
360 
361  global => pregion%global
362 
363  CALL registerfunction(global,'RFLU_InterpCells2FacePatch',&
364  'RFLU_ModInterpolation.F90')
365 
366 ! ******************************************************************************
367 ! Set pointers and variables
368 ! ******************************************************************************
369 
370  pgrid => pregion%grid
371 
372  iendsrc = ubound(src,1)
373  ienddst = ubound(dst,1)
374 
375 ! ******************************************************************************
376 ! Get face weights
377 ! ******************************************************************************
378 
379  SELECT CASE ( pregion%mixtInput%dimens )
380  CASE ( 2 )
381  r11 = ppatch%bf2cs(ifl)%xyzMoms(xyz_mom_11)
382  r12 = ppatch%bf2cs(ifl)%xyzMoms(xyz_mom_12)
383  r22 = ppatch%bf2cs(ifl)%xyzMoms(xyz_mom_22)
384  r13 = ppatch%bf2cs(ifl)%xyzMoms(xyz_mom_13)
385  r23 = ppatch%bf2cs(ifl)%xyzMoms(xyz_mom_23)
386  r33 = ppatch%bf2cs(ifl)%xyzMoms(xyz_mom_33)
387 
388  c11 = 1.0_rfreal/r11
389  c22 = 1.0_rfreal/r22
390  c33 = 1.0_rfreal/r33
391 
392  c12 = - c11*r12
393  c13 = -(c11*r13 + c12*c22*r23)
394 
395  c23 = - c22*r23
396  CASE ( 3 )
397  r11 = ppatch%bf2cs(ifl)%xyzMoms(xyz_mom_11)
398  r12 = ppatch%bf2cs(ifl)%xyzMoms(xyz_mom_12)
399  r22 = ppatch%bf2cs(ifl)%xyzMoms(xyz_mom_22)
400  r13 = ppatch%bf2cs(ifl)%xyzMoms(xyz_mom_13)
401  r23 = ppatch%bf2cs(ifl)%xyzMoms(xyz_mom_23)
402  r33 = ppatch%bf2cs(ifl)%xyzMoms(xyz_mom_33)
403  r14 = ppatch%bf2cs(ifl)%xyzMoms(xyz_mom_14)
404  r24 = ppatch%bf2cs(ifl)%xyzMoms(xyz_mom_24)
405  r34 = ppatch%bf2cs(ifl)%xyzMoms(xyz_mom_34)
406  r44 = ppatch%bf2cs(ifl)%xyzMoms(xyz_mom_44)
407 
408  c11 = 1.0_rfreal/r11
409  c22 = 1.0_rfreal/r22
410  c33 = 1.0_rfreal/r33
411  c44 = 1.0_rfreal/r44
412 
413  c12 = - c11*r12
414  c13 = -(c11*r13 + c12*c22*r23)
415  c14 = -(c11*r14 + c12*c22*r24 + c13*c33*r34)
416 
417  c23 = - c22*r23
418  c24 = -(c22*r24 + c23*c33*r34)
419 
420  c34 = - c33*r34
421  CASE default
422  CALL errorstop(global,err_reached_default,__line__)
423  END SELECT ! pRegion%mixtInput%dimens
424 
425 ! ******************************************************************************
426 ! Initialize destination array
427 ! ******************************************************************************
428 
429  DO idst = 1,ienddst ! Explicit loop because of Frost problems
430  dst(idst) = 0.0_rfreal
431  END DO ! iDst
432 
433 ! ******************************************************************************
434 ! Loop over stencil members and interpolate
435 ! ******************************************************************************
436 
437  SELECT CASE ( pregion%mixtInput%dimens )
438  CASE ( 2 )
439  DO isl = 1,ppatch%bf2cs(ifl)%nCellMembs
440  icg = ppatch%bf2cs(ifl)%cellMembs(isl)
441 
442  dx = pgrid%cofg(xcoord,icg) - ppatch%fc(xcoord,ifl)
443  dy = pgrid%cofg(ycoord,icg) - ppatch%fc(ycoord,ifl)
444 
445  term = 1.0_rfreal/sqrt(dx*dx + dy*dy)
446 
447  dx = term*dx
448  dy = term*dy
449 
450  wti = term*c33*c33*(term + c23*dy + c13*dx)
451 
452  idst = 1
453 
454  DO isrc = 1,iendsrc
455  dst(idst) = dst(idst) + wti*src(isrc,icg)
456 
457  idst = idst + 1
458  END DO ! iSrc
459  END DO ! isl
460  CASE ( 3 )
461  DO isl = 1,ppatch%bf2cs(ifl)%nCellMembs
462  icg = ppatch%bf2cs(ifl)%cellMembs(isl)
463 
464  dx = pgrid%cofg(xcoord,icg) - ppatch%fc(xcoord,ifl)
465  dy = pgrid%cofg(ycoord,icg) - ppatch%fc(ycoord,ifl)
466  dz = pgrid%cofg(zcoord,icg) - ppatch%fc(zcoord,ifl)
467 
468  term = 1.0_rfreal/sqrt(dx*dx + dy*dy + dz*dz)
469 
470  dx = term*dx
471  dy = term*dy
472  dz = term*dz
473 
474  wti = term*c44*c44*(term + c34*dz + c24*dy + c14*dx)
475 
476  idst = 1
477 
478  DO isrc = 1,iendsrc
479  dst(idst) = dst(idst) + wti*src(isrc,icg)
480 
481  idst = idst + 1
482  END DO ! iSrc
483  END DO ! isl
484  CASE default
485  CALL errorstop(global,err_reached_default,__line__)
486  END SELECT ! pRegion%mixtInput%dimens
487 
488 ! ******************************************************************************
489 ! End
490 ! ******************************************************************************
491 
492  CALL deregisterfunction(global)
493 
494  END SUBROUTINE rflu_interpcells2facepatch
495 
496 
497 
498 
499 
500 
501 
502 ! ******************************************************************************
503 !
504 ! Purpose: Interpolation from cells to faces.
505 !
506 ! Description: None.
507 !
508 ! Input:
509 ! pRegion Pointer to region data
510 ! src Source array of cell data
511 !
512 ! Output:
513 ! dst Destination array of face data
514 !
515 ! Notes:
516 ! 1. Could call RFLU_InterpCells2Face for each face, but do not do so for
517 ! performance reasons (repeated call with src array)
518 !
519 ! ******************************************************************************
520 
521  SUBROUTINE rflu_interpcells2faces(pRegion,src,dst)
522 
523  IMPLICIT NONE
524 
525 ! ******************************************************************************
526 ! Declarations and definitions
527 ! ******************************************************************************
528 
529 ! ==============================================================================
530 ! Arguments
531 ! ==============================================================================
532 
533  REAL(RFREAL), DIMENSION(:,:), INTENT(IN) :: src
534  REAL(RFREAL), DIMENSION(:,:), INTENT(OUT) :: dst
535  TYPE(t_region), POINTER :: pregion
536 
537 ! ==============================================================================
538 ! Locals
539 ! ==============================================================================
540 
541  INTEGER :: errorflag,icg,idst,ienddst,iendsrc,ifg,isl,isrc
542  REAL(RFREAL) :: c11,c12,c13,c14,c22,c23,c24,c33,c34,c44,dx,dy,dz, &
543  r11,r12,r13,r14,r22,r23,r24,r33,r34,r44,term,wti
544  TYPE(t_grid), POINTER :: pgrid
545  TYPE(t_global), POINTER :: global
546 
547 ! ******************************************************************************
548 ! Start
549 ! ******************************************************************************
550 
551  global => pregion%global
552 
553  CALL registerfunction(global,'RFLU_InterpCells2Faces',&
554  'RFLU_ModInterpolation.F90')
555 
556 ! ******************************************************************************
557 ! Set pointers and variables
558 ! ******************************************************************************
559 
560  pgrid => pregion%grid
561 
562  iendsrc = ubound(src,1)
563  ienddst = ubound(dst,1)
564 
565 ! ******************************************************************************
566 ! Loop over faces and interpolate from cells in stencil
567 ! ******************************************************************************
568 
569 ! ==============================================================================
570 ! Select appropriate dimensionality
571 ! ==============================================================================
572 
573  SELECT CASE ( pregion%mixtInput%dimens )
574 
575 ! --- Two dimensions -----------------------------------------------------------
576 
577  CASE ( 2 )
578  DO ifg = 1,pgrid%nFaces
579  r11 = pgrid%f2cs(ifg)%xyzMoms(xyz_mom_11)
580  r12 = pgrid%f2cs(ifg)%xyzMoms(xyz_mom_12)
581  r22 = pgrid%f2cs(ifg)%xyzMoms(xyz_mom_22)
582  r13 = pgrid%f2cs(ifg)%xyzMoms(xyz_mom_13)
583  r23 = pgrid%f2cs(ifg)%xyzMoms(xyz_mom_23)
584  r33 = pgrid%f2cs(ifg)%xyzMoms(xyz_mom_33)
585 
586  c11 = 1.0_rfreal/r11
587  c22 = 1.0_rfreal/r22
588  c33 = 1.0_rfreal/r33
589 
590  c12 = - c11*r12
591  c13 = -(c11*r13 + c12*c22*r23)
592 
593  c23 = - c22*r23
594 
595  DO idst = 1,ienddst ! Explicit loop because of Frost problems
596  dst(idst,ifg) = 0.0_rfreal
597  END DO ! iDst
598 
599  DO isl = 1,pgrid%f2cs(ifg)%nCellMembs
600  icg = pgrid%f2cs(ifg)%cellMembs(isl)
601 
602  dx = pgrid%cofg(xcoord,icg) - pgrid%fc(xcoord,ifg)
603  dy = pgrid%cofg(ycoord,icg) - pgrid%fc(ycoord,ifg)
604 
605  term = 1.0_rfreal/sqrt(dx*dx + dy*dy)
606 
607  dx = term*dx
608  dy = term*dy
609 
610  wti = term*c33*c33*(term + c23*dy + c13*dx)
611 
612  idst = 1
613 
614  DO isrc = 1,iendsrc
615  dst(idst,ifg) = dst(idst,ifg) + wti*src(isrc,icg)
616 
617  idst = idst + 1
618  END DO ! iSrc
619  END DO ! isl
620  END DO ! ifg
621 
622 ! --- Three dimensions ---------------------------------------------------------
623 
624  CASE ( 3 )
625  DO ifg = 1,pgrid%nFaces
626  r11 = pgrid%f2cs(ifg)%xyzMoms(xyz_mom_11)
627  r12 = pgrid%f2cs(ifg)%xyzMoms(xyz_mom_12)
628  r22 = pgrid%f2cs(ifg)%xyzMoms(xyz_mom_22)
629  r13 = pgrid%f2cs(ifg)%xyzMoms(xyz_mom_13)
630  r23 = pgrid%f2cs(ifg)%xyzMoms(xyz_mom_23)
631  r33 = pgrid%f2cs(ifg)%xyzMoms(xyz_mom_33)
632  r14 = pgrid%f2cs(ifg)%xyzMoms(xyz_mom_14)
633  r24 = pgrid%f2cs(ifg)%xyzMoms(xyz_mom_24)
634  r34 = pgrid%f2cs(ifg)%xyzMoms(xyz_mom_34)
635  r44 = pgrid%f2cs(ifg)%xyzMoms(xyz_mom_44)
636 
637  c11 = 1.0_rfreal/r11
638  c22 = 1.0_rfreal/r22
639  c33 = 1.0_rfreal/r33
640  c44 = 1.0_rfreal/r44
641 
642  c12 = - c11*r12
643  c13 = -(c11*r13 + c12*c22*r23)
644  c14 = -(c11*r14 + c12*c22*r24 + c13*c33*r34)
645 
646  c23 = - c22*r23
647  c24 = -(c22*r24 + c23*c33*r34)
648 
649  c34 = - c33*r34
650 
651  DO idst = 1,ienddst ! Explicit loop because of Frost problems
652  dst(idst,ifg) = 0.0_rfreal
653  END DO ! iDst
654 
655  DO isl = 1,pgrid%f2cs(ifg)%nCellMembs
656  icg = pgrid%f2cs(ifg)%cellMembs(isl)
657 
658  dx = pgrid%cofg(xcoord,icg) - pgrid%fc(xcoord,ifg)
659  dy = pgrid%cofg(ycoord,icg) - pgrid%fc(ycoord,ifg)
660  dz = pgrid%cofg(zcoord,icg) - pgrid%fc(zcoord,ifg)
661 
662  term = 1.0_rfreal/sqrt(dx*dx + dy*dy + dz*dz)
663 
664  dx = term*dx
665  dy = term*dy
666  dz = term*dz
667 
668  wti = term*c44*c44*(term + c34*dz + c24*dy + c14*dx)
669 
670  idst = 1
671 
672  DO isrc = 1,iendsrc
673  dst(idst,ifg) = dst(idst,ifg) + wti*src(isrc,icg)
674 
675  idst = idst + 1
676  END DO ! iSrc
677  END DO ! isl
678  END DO ! ifg
679 
680 ! --- Default -------------------------------------------------------------------
681 
682  CASE default
683  CALL errorstop(global,err_reached_default,__line__)
684  END SELECT ! pRegion%mixtInput%dimens
685 
686 ! ******************************************************************************
687 ! End
688 ! ******************************************************************************
689 
690  CALL deregisterfunction(global)
691 
692  END SUBROUTINE rflu_interpcells2faces
693 
694 
695 
696 
697 
698 
699 
700 ! ******************************************************************************
701 !
702 ! Purpose: Interpolation from cells to vertices.
703 !
704 ! Description: None.
705 !
706 ! Input:
707 ! pRegion Pointer to region data
708 ! orderNominal Nominal order of accuracy
709 ! nVar Number of variables
710 ! src Source data array of cell data
711 !
712 ! Output:
713 ! dst Destination data array of vertex data
714 !
715 ! Notes: None.
716 !
717 ! ******************************************************************************
718 
719  SUBROUTINE rflu_interpcells2verts(pRegion,orderNominal,nVar,src,dst)
720 
721  IMPLICIT NONE
722 
723 ! ******************************************************************************
724 ! Declarations and definitions
725 ! ******************************************************************************
726 
727 ! ==============================================================================
728 ! Arguments
729 ! ==============================================================================
730 
731  INTEGER, INTENT(IN) :: nvar,ordernominal
732  REAL(RFREAL), DIMENSION(:,:), INTENT(IN) :: src
733  REAL(RFREAL), DIMENSION(:,:), INTENT(OUT) :: dst
734  TYPE(t_region), POINTER :: pregion
735 
736 ! ==============================================================================
737 ! Locals
738 ! ==============================================================================
739 
740  INTEGER :: errorflag,icg,isl,ivg,ivar,nrows,orderactual,scount
741  REAL(RFREAL), DIMENSION(:,:), ALLOCATABLE :: dr,wts
742  TYPE(t_grid), POINTER :: pgrid
743  TYPE(t_global), POINTER :: global
744 
745 ! ******************************************************************************
746 ! Start
747 ! ******************************************************************************
748 
749  global => pregion%global
750 
751  CALL registerfunction(global,'RFLU_InterpCells2Verts',&
752  'RFLU_ModInterpolation.F90')
753 
754  IF ( global%myProcid == masterproc ) THEN
755  IF ( global%verbLevel > verbose_none ) THEN
756  WRITE(stdout,'(A,1X,A)') solver_name, &
757  'Interpolating from cells to vertices...'
758  END IF ! global%verbLevel
759 
760  IF ( global%verbLevel > verbose_low ) THEN
761  WRITE(stdout,'(A,3X,A)') solver_name,'Method: Proper'
762  END IF ! global%verbLevel > VERBOSE_LOW
763  END IF ! global%verbLevel
764 
765 ! ******************************************************************************
766 ! Set pointers
767 ! ******************************************************************************
768 
769  pgrid => pregion%grid
770 
771 ! ******************************************************************************
772 ! Loop over vertices and interpolate from cells in stencil
773 ! ******************************************************************************
774 
775  DO ivg = 1,pgrid%nVertTot
776  nrows = pgrid%v2cs(ivg)%nCellMembs
777 
778  orderactual = ordernominal
779 
780  ALLOCATE(dr(xcoord:zcoord,nrows),stat=errorflag)
781  global%error = errorflag
782  IF ( global%error /= err_none ) THEN
783  CALL errorstop(global,err_allocate,__line__,'dr')
784  END IF ! global%error
785 
786  ALLOCATE(wts(1,nrows),stat=errorflag)
787  global%error = errorflag
788  IF ( global%error /= err_none ) THEN
789  CALL errorstop(global,err_allocate,__line__,'wts')
790  END IF ! global%error
791 
792  DO isl = 1,pgrid%v2cs(ivg)%nCellMembs
793  icg = pgrid%v2cs(ivg)%cellMembs(isl)
794 
795  dr(xcoord,isl) = pgrid%cofg(xcoord,icg) - pgrid%xyz(xcoord,ivg)
796  dr(ycoord,isl) = pgrid%cofg(ycoord,icg) - pgrid%xyz(ycoord,ivg)
797  dr(zcoord,isl) = pgrid%cofg(zcoord,icg) - pgrid%xyz(zcoord,ivg)
798  END DO ! isl
799 
800 ! ==============================================================================
801 ! Compute interpolation weights
802 ! ==============================================================================
803 
804  CALL rflu_computestencilweights(global,pregion%mixtInput%dimens, &
805  compwts_mode_adapt,compwts_scal_invdist, &
806  deriv_degree_0,orderactual,nrows,dr, &
807  wts,scount)
808 
809 ! ==============================================================================
810 ! Initialize destination array
811 ! ==============================================================================
812 
813  DO ivar = 1,nvar ! Explicit loop because of ASCI White problems
814  dst(ivar,ivg) = 0.0_rfreal
815  END DO ! iVar
816 
817 ! ==============================================================================
818 ! Interpolate
819 ! ==============================================================================
820 
821  DO isl = 1,pgrid%v2cs(ivg)%nCellMembs
822  icg = pgrid%v2cs(ivg)%cellMembs(isl)
823 
824  DO ivar = 1,nvar
825  dst(ivar,ivg) = dst(ivar,ivg) + wts(1,isl)*src(ivar,icg)
826  END DO ! iVar
827  END DO ! isl
828 
829 ! ==============================================================================
830 ! Deallocate memory
831 ! ==============================================================================
832 
833  DEALLOCATE(dr,stat=errorflag)
834  global%error = errorflag
835  IF ( global%error /= err_none ) THEN
836  CALL errorstop(global,err_deallocate,__line__,'dr')
837  END IF ! global%error
838 
839  DEALLOCATE(wts,stat=errorflag)
840  global%error = errorflag
841  IF ( global%error /= err_none ) THEN
842  CALL errorstop(global,err_deallocate,__line__,'wts')
843  END IF ! global%error
844  END DO ! ivg
845 
846 ! ******************************************************************************
847 ! End
848 ! ******************************************************************************
849 
850  IF ( global%myProcid == masterproc .AND. &
851  global%verbLevel > verbose_none ) THEN
852  WRITE(stdout,'(A,1X,A)') solver_name, &
853  'Interpolating from cells to vertices done.'
854  END IF ! global%verbLevel
855 
856  CALL deregisterfunction(global)
857 
858  END SUBROUTINE rflu_interpcells2verts
859 
860 
861 
862 
863 
864 
865 
866 ! ******************************************************************************
867 !
868 ! Purpose: Interpolation from cells to vertices by simple averaging.
869 !
870 ! Description: None.
871 !
872 ! Input:
873 ! pRegion Pointer to region data
874 ! nVar Number of variables
875 ! src Source data array of cell data
876 !
877 ! Output:
878 ! dst Destination data array of vertex data
879 !
880 ! Notes: None.
881 !
882 ! ******************************************************************************
883 
884  SUBROUTINE rflu_interpsimplecells2verts(pRegion,nVar,src,dst)
885 
886  IMPLICIT NONE
887 
888 ! ******************************************************************************
889 ! Declarations and definitions
890 ! ******************************************************************************
891 
892 ! ==============================================================================
893 ! Arguments
894 ! ==============================================================================
895 
896  INTEGER, INTENT(IN) :: nvar
897  REAL(RFREAL), DIMENSION(:,:), INTENT(IN) :: src
898  REAL(RFREAL), DIMENSION(:,:), INTENT(OUT) :: dst
899  TYPE(t_region), POINTER :: pregion
900 
901 ! ==============================================================================
902 ! Locals
903 ! ==============================================================================
904 
905  INTEGER :: icg,icl,ivg,ivar,ncells,v2cbeg,v2cend
906  REAL(RFREAL) :: wt
907  TYPE(t_grid), POINTER :: pgrid
908  TYPE(t_global), POINTER :: global
909 
910 ! ******************************************************************************
911 ! Start
912 ! ******************************************************************************
913 
914  global => pregion%global
915 
916  CALL registerfunction(global,'RFLU_InterpSimpleCells2Verts',&
917  'RFLU_ModInterpolation.F90')
918 
919  IF ( global%myProcid == masterproc ) THEN
920  IF ( global%verbLevel > verbose_none ) THEN
921  WRITE(stdout,'(A,1X,A)') solver_name, &
922  'Interpolating from cells to vertices...'
923  END IF ! global%verbLevel
924 
925  IF ( global%verbLevel > verbose_low ) THEN
926  WRITE(stdout,'(A,3X,A)') solver_name,'Method: Simple'
927  END IF ! global%verbLevel > VERBOSE_LOW
928  END IF ! global%verbLevel
929 
930 ! ******************************************************************************
931 ! Set pointers
932 ! ******************************************************************************
933 
934  pgrid => pregion%grid
935 
936 ! ******************************************************************************
937 ! Loop over vertices and interpolate from cells in stencil
938 ! ******************************************************************************
939 
940  DO ivg = 1,pgrid%nVertTot
941  v2cbeg = pgrid%v2cInfo(v2c_beg,ivg)
942  v2cend = pgrid%v2cInfo(v2c_end,ivg)
943 
944  ncells = v2cend - v2cbeg + 1
945 
946 ! ==============================================================================
947 ! Initialize destination array
948 ! ==============================================================================
949 
950  DO ivar = 1,nvar ! Explicit loop because of ASCI White problems
951  dst(ivar,ivg) = 0.0_rfreal
952  END DO ! iVar
953 
954 ! ==============================================================================
955 ! Interpolate
956 ! ==============================================================================
957 
958  wt = 1.0_rfreal/REAL(nCells,RFREAL)
959 
960  DO icl = 1,ncells
961  icg = pgrid%v2c(v2cbeg+icl-1)
962 
963  DO ivar = 1,nvar
964  dst(ivar,ivg) = dst(ivar,ivg) + wt*src(ivar,icg)
965  END DO ! iVar
966  END DO ! isl
967  END DO ! ivg
968 
969 ! ******************************************************************************
970 ! End
971 ! ******************************************************************************
972 
973  IF ( global%myProcid == masterproc .AND. &
974  global%verbLevel > verbose_none ) THEN
975  WRITE(stdout,'(A,1X,A)') solver_name, &
976  'Interpolating from cells to vertices done.'
977  END IF ! global%verbLevel
978 
979  CALL deregisterfunction(global)
980 
981  END SUBROUTINE rflu_interpsimplecells2verts
982 
983 
984 
985 
986 
987 
988 ! ******************************************************************************
989 ! End
990 ! ******************************************************************************
991 
992 END MODULE rflu_modinterpolation
993 
994 
995 ! ******************************************************************************
996 !
997 ! RCS Revision history:
998 !
999 ! $Log: RFLU_ModInterpolation.F90,v $
1000 ! Revision 1.21 2008/12/06 08:44:22 mtcampbe
1001 ! Updated license.
1002 !
1003 ! Revision 1.20 2008/11/19 22:17:33 mtcampbe
1004 ! Added Illinois Open Source License/Copyright
1005 !
1006 ! Revision 1.19 2006/08/19 15:39:23 mparmar
1007 ! Removed RFLU_InterpCells2FacesPatches routine
1008 !
1009 ! Revision 1.18 2006/04/07 15:19:19 haselbac
1010 ! Removed tabs
1011 !
1012 ! Revision 1.17 2005/10/05 13:57:47 haselbac
1013 ! Adapted to changes in module contents
1014 !
1015 ! Revision 1.16 2005/03/09 14:56:49 haselbac
1016 ! Added code for 2d interpolation
1017 !
1018 ! Revision 1.15 2004/07/21 15:00:06 haselbac
1019 ! Added RFLU_InterpSimpleCells2Verts, cosmetics
1020 !
1021 ! Revision 1.14 2004/03/18 03:31:56 haselbac
1022 ! Added routines for interp from cells to faces, clean-up
1023 !
1024 ! Revision 1.13 2004/01/22 16:03:59 haselbac
1025 ! Made contents of modules PRIVATE, only procs PUBLIC, to avoid errors on ALC
1026 ! and titan
1027 !
1028 ! Revision 1.12 2003/12/04 03:28:52 haselbac
1029 ! Complete rewrite
1030 !
1031 ! Revision 1.11 2003/07/22 15:39:14 haselbac
1032 ! Added Nullify routines, distinction betw PUBLIC and PRIVATE members
1033 !
1034 ! Revision 1.10 2003/07/22 02:05:14 haselbac
1035 ! Added comp of proper wghts for cell-to-vertex interp
1036 !
1037 ! Revision 1.9 2003/03/15 18:12:59 haselbac
1038 ! Now also interpolate to dummy vertices
1039 !
1040 ! Revision 1.8 2003/01/28 16:34:29 haselbac
1041 ! Cosmetics only
1042 !
1043 ! Revision 1.7 2002/10/09 20:47:53 haselbac
1044 ! Fixed bug in RFLU_DestroyInterpolant: Missing errorFlag declaration
1045 !
1046 ! Revision 1.6 2002/10/08 15:49:21 haselbac
1047 ! {IO}STAT=global%error replaced by {IO}STAT=errorFlag - SGI problem
1048 !
1049 ! Revision 1.5 2002/09/09 15:09:41 haselbac
1050 ! global now under regions
1051 !
1052 ! Revision 1.4 2002/07/25 15:02:59 haselbac
1053 ! Only write out for MASTERPROC
1054 !
1055 ! Revision 1.3 2002/06/17 13:39:45 haselbac
1056 ! Prefixed SOLVER_NAME to all screen output
1057 !
1058 ! Revision 1.2 2002/05/04 16:39:51 haselbac
1059 ! Added PRIVATE attribute to RCSIdentString
1060 !
1061 ! Revision 1.1 2002/04/11 18:48:48 haselbac
1062 ! Initial revision
1063 !
1064 ! ******************************************************************************
1065 
1066 
1067 
1068 
1069 
1070 
1071 
1072 
1073 
1074 
1075 
subroutine, public rflu_computestencilweights(global, dimens, wtsMode, scalMode, derivDegree, orderNominal, nRows, dr, wts, sCount)
INTEGER function compfact(n)
Definition: ModTools.F90:156
subroutine, public rflu_interpsimplecells2verts(pRegion, nVar, src, dst)
NT dx
subroutine rflu_invertmatrixsvd(global, nRows, nCols, a, aInv, sCount)
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
double sqrt(double d)
Definition: double.h:73
subroutine, public rflu_interpcells2face(pRegion, ifg, src, dst)
RT dz() const
Definition: Direction_3.h:133
NT dy
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine, public rflu_interpcells2facepatch(pRegion, pPatch, ifl, src, dst)
subroutine deregisterfunction(global)
Definition: ModError.F90:469
subroutine, public rflu_interpcells2verts(pRegion, orderNominal, nVar, src, dst)
subroutine, public rflu_interpcells2faces(pRegion, src, dst)