Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RFLU_ModWeights.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 compute stencil weights.
26 !
27 ! Description: None.
28 !
29 ! Notes: None.
30 !
31 ! ******************************************************************************
32 !
33 ! $Id: RFLU_ModWeights.F90,v 1.16 2008/12/06 08:44:25 mtcampbe Exp $
34 !
35 ! Copyright: (c) 2003-2006 by the University of Illinois
36 !
37 ! ******************************************************************************
38 
40 
41  USE modglobal, ONLY: t_global
42  USE modparameters
43  USE moddatatypes
44  USE moderror
45  USE modbndpatch, ONLY: t_patch
46  USE moddatastruct, ONLY: t_region
47  USE modgrid, ONLY: t_grid
48  USE modmixture, ONLY: t_mixt_input
49  USE modmpi
50 
51  IMPLICIT NONE
52 
53  PRIVATE
54  PUBLIC :: rflu_createwtsbf2cwrapper, &
64 
65 ! ******************************************************************************
66 ! Declarations and definitions
67 ! ******************************************************************************
68 
69  CHARACTER(CHRLEN) :: RCSIdentString = &
70  '$RCSfile: RFLU_ModWeights.F90,v $ $Revision: 1.16 $'
71 
72 ! ******************************************************************************
73 ! Routines
74 ! ******************************************************************************
75 
76  CONTAINS
77 
78 
79 
80 
81 
82 
83 ! *******************************************************************************
84 !
85 ! Purpose: Create weights for boundary face-to-cell stencil.
86 !
87 ! Description: None.
88 !
89 ! Input:
90 ! pRegion Pointer to region
91 ! pPatch Pointer to patch
92 ! orderInput Desired order
93 !
94 ! Output: None.
95 !
96 ! Notes: None.
97 !
98 ! ******************************************************************************
99 
100  SUBROUTINE rflu_createwtsbf2c(pRegion,pPatch,orderInput)
101 
102  IMPLICIT NONE
103 
104 ! ******************************************************************************
105 ! Declarations and definitions
106 ! ******************************************************************************
107 
108 ! ==============================================================================
109 ! Arguments
110 ! ==============================================================================
111 
112  INTEGER, INTENT(IN) :: orderinput
113  TYPE(t_patch), POINTER :: ppatch
114  TYPE(t_region), POINTER :: pregion
115 
116 ! ==============================================================================
117 ! Locals
118 ! ==============================================================================
119 
120  INTEGER :: errorflag,ifl,order
121  TYPE(t_global), POINTER :: global
122  TYPE(t_grid), POINTER :: pgrid
123 
124 ! ******************************************************************************
125 ! Start
126 ! ******************************************************************************
127 
128  global => pregion%global
129 
130  CALL registerfunction(global,'RFLU_CreateWtsBF2C',&
131  'RFLU_ModWeights.F90')
132 
133  IF ( global%myProcid == masterproc .AND. &
134  global%verbLevel > verbose_none ) THEN
135  WRITE(stdout,'(A,1X,A)') solver_name, &
136  'Creating boundary face-to-cell weights...'
137  END IF ! global%verbLevel
138 
139 ! ******************************************************************************
140 ! Set grid pointer
141 ! ******************************************************************************
142 
143  pgrid => pregion%grid
144 
145 ! ******************************************************************************
146 ! Modify order so that can run with first-order scheme
147 ! ******************************************************************************
148 
149  order = max(orderinput,1)
150 
151 ! ******************************************************************************
152 ! Nullify memory
153 ! ******************************************************************************
154 
155  CALL rflu_nullifywtsbf2c(pregion,ppatch)
156 
157 ! ******************************************************************************
158 ! Allocate memory
159 ! ******************************************************************************
160 
161  SELECT CASE ( order )
162 
163 ! ==============================================================================
164 ! Linear approximation
165 ! ==============================================================================
166 
167  CASE ( 1 )
168  IF ( ppatch%bcType /= bc_virtual ) THEN
169  SELECT CASE ( pregion%mixtInput%dimens )
170  CASE ( 1 ) ! NOTE should never reach here
171  CASE ( 2 )
172  DO ifl = 1,ppatch%nBFaces
173  ALLOCATE(ppatch%bf2cs(ifl)%xyzMoms(xyz_mom_11:xyz_mom_33), &
174  stat=errorflag)
175  global%error = errorflag
176  IF ( global%error /= err_none ) THEN
177  CALL errorstop(global,err_allocate,__line__, &
178  'pPatch%bf2cs%xyzMoms')
179  END IF ! global%error
180  END DO ! ifl
181  CASE ( 3 )
182  DO ifl = 1,ppatch%nBFaces
183  ALLOCATE(ppatch%bf2cs(ifl)%xyzMoms(xyz_mom_11:xyz_mom_44), &
184  stat=errorflag)
185  global%error = errorflag
186  IF ( global%error /= err_none ) THEN
187  CALL errorstop(global,err_allocate,__line__, &
188  'pPatch%bf2cs%xyzMoms')
189  END IF ! global%error
190  END DO ! ifl
191  CASE default
192  CALL errorstop(global,err_reached_default,__line__)
193  END SELECT ! dimens
194  END IF ! pPatch%bcType
195 
196 ! ==============================================================================
197 ! Default
198 ! ==============================================================================
199 
200  CASE default
201  CALL errorstop(global,err_reached_default,__line__)
202  END SELECT ! order
203 
204 ! ******************************************************************************
205 ! End
206 ! ******************************************************************************
207 
208  IF ( global%myProcid == masterproc .AND. &
209  global%verbLevel > verbose_none ) THEN
210  WRITE(stdout,'(A,1X,A)') solver_name, &
211  'Creating boundary face-to-cell weights done.'
212  END IF ! global%verbLevel
213 
214  CALL deregisterfunction(global)
215 
216  END SUBROUTINE rflu_createwtsbf2c
217 
218 
219 
220 
221 
222 
223 ! *******************************************************************************
224 !
225 ! Purpose: Wrapper routine for creating boundary-face-to-cell weights.
226 !
227 ! Description: None.
228 !
229 ! Input:
230 ! pRegion Pointer to region
231 ! pPatch Pointer to patch
232 ! order Desired order
233 !
234 ! Output: None.
235 !
236 ! Notes: None.
237 !
238 ! ******************************************************************************
239 
240  SUBROUTINE rflu_createwtsbf2cwrapper(pRegion,pPatch,order)
241 
242  IMPLICIT NONE
243 
244 ! ******************************************************************************
245 ! Declarations and definitions
246 ! ******************************************************************************
247 
248 ! ==============================================================================
249 ! Arguments
250 ! ==============================================================================
251 
252  INTEGER, INTENT(IN) :: order
253  TYPE(t_patch), POINTER :: ppatch
254  TYPE(t_region), POINTER :: pregion
255 
256 ! ==============================================================================
257 ! Locals
258 ! ==============================================================================
259 
260  TYPE(t_global), POINTER :: global
261  TYPE(t_mixt_input), POINTER :: pmixtinput
262 
263 ! ******************************************************************************
264 ! Start
265 ! ******************************************************************************
266 
267  global => pregion%global
268 
269  CALL registerfunction(global,'RFLU_CreateWtsBF2CWrapper',&
270  'RFLU_ModWeights.F90')
271 
272 ! ******************************************************************************
273 ! Set pointers and variables
274 ! ******************************************************************************
275 
276  pmixtinput => pregion%mixtInput
277 
278 ! ******************************************************************************
279 ! Call routines to compute weights
280 ! ******************************************************************************
281 
282  SELECT CASE ( pmixtinput%stencilDimensBFaces )
283  CASE ( 1 )
284  CASE ( 2,3 )
285  CALL rflu_createwtsbf2c(pregion,ppatch,order)
286  CASE default
287  CALL errorstop(global,err_reached_default,__line__)
288  END SELECT ! pMixtInput%stencilDimensBFaces
289 
290 ! ******************************************************************************
291 ! End
292 ! ******************************************************************************
293 
294  CALL deregisterfunction(global)
295 
296  END SUBROUTINE rflu_createwtsbf2cwrapper
297 
298 
299 
300 
301 
302 
303 
304 ! *******************************************************************************
305 !
306 ! Purpose: Create weights for cell-to-cell stencil.
307 !
308 ! Description: None.
309 !
310 ! Input:
311 ! pRegion Pointer to region
312 ! order Desired order
313 !
314 ! Output: None.
315 !
316 ! Notes: None.
317 !
318 ! ******************************************************************************
319 
320  SUBROUTINE rflu_createwtsc2c(pRegion,order)
321 
322  IMPLICIT NONE
323 
324 ! ******************************************************************************
325 ! Declarations and definitions
326 ! ******************************************************************************
327 
328 ! ==============================================================================
329 ! Arguments
330 ! ==============================================================================
331 
332  INTEGER, INTENT(IN) :: order
333  TYPE(t_region), POINTER :: pregion
334 
335 ! ==============================================================================
336 ! Locals
337 ! ==============================================================================
338 
339  INTEGER :: errorflag,icg
340  TYPE(t_grid), POINTER :: pgrid
341  TYPE(t_global), POINTER :: global
342 
343 ! ******************************************************************************
344 ! Start
345 ! ******************************************************************************
346 
347  global => pregion%global
348 
349  CALL registerfunction(global,'RFLU_CreateWtsC2C',&
350  'RFLU_ModWeights.F90')
351 
352  IF ( global%myProcid == masterproc .AND. &
353  global%verbLevel > verbose_none ) THEN
354  WRITE(stdout,'(A,1X,A)') solver_name, &
355  'Creating cell-to-cell weights...'
356  END IF ! global%verbLevel
357 
358 ! ******************************************************************************
359 ! Set grid pointer
360 ! ******************************************************************************
361 
362  pgrid => pregion%grid
363 
364 ! ******************************************************************************
365 ! Nullify memory
366 ! ******************************************************************************
367 
368  CALL rflu_nullifywtsc2c(pregion)
369 
370 ! ******************************************************************************
371 ! Allocate memory
372 ! ******************************************************************************
373 
374  SELECT CASE ( order )
375 
376 ! ==============================================================================
377 ! Linear approximation
378 ! ==============================================================================
379 
380  CASE ( 1 )
381  SELECT CASE ( pregion%mixtInput%dimens )
382  CASE ( 1 )
383  CASE ( 2 )
384  DO icg = 1,pgrid%nCellsTot
385  ALLOCATE(pgrid%c2cs(icg)%xyzMoms(xyz_mom_11:xyz_mom_33), &
386  stat=errorflag)
387  global%error = errorflag
388  IF ( global%error /= err_none ) THEN
389  CALL errorstop(global,err_allocate,__line__, &
390  'pGrid%c2cs%xyzMoms')
391  END IF ! global%error
392  END DO ! icg
393  CASE ( 3 )
394  DO icg = 1,pgrid%nCellsTot
395  ALLOCATE(pgrid%c2cs(icg)%xyzMoms(xyz_mom_11:xyz_mom_44), &
396  stat=errorflag)
397  global%error = errorflag
398  IF ( global%error /= err_none ) THEN
399  CALL errorstop(global,err_allocate,__line__, &
400  'pGrid%c2cs%xyzMoms')
401  END IF ! global%error
402  END DO ! icg
403  CASE default
404  CALL errorstop(global,err_reached_default,__line__)
405  END SELECT ! pRegion%mixtInput%dimens
406 
407 ! ==============================================================================
408 ! Default
409 ! ==============================================================================
410 
411  CASE default
412  CALL errorstop(global,err_reached_default,__line__)
413  END SELECT ! order
414 
415 ! ******************************************************************************
416 ! End
417 ! ******************************************************************************
418 
419  IF ( global%myProcid == masterproc .AND. &
420  global%verbLevel > verbose_none ) THEN
421  WRITE(stdout,'(A,1X,A)') solver_name, &
422  'Creating cell-to-cell weights done.'
423  END IF ! global%verbLevel
424 
425  CALL deregisterfunction(global)
426 
427  END SUBROUTINE rflu_createwtsc2c
428 
429 
430 
431 
432 
433 
434 
435 
436 ! *******************************************************************************
437 !
438 ! Purpose: Wrapper routine for creating cell-to-cell weights.
439 !
440 ! Description: None.
441 !
442 ! Input:
443 ! pRegion Pointer to region
444 ! order Desired order
445 !
446 ! Output: None.
447 !
448 ! Notes: None.
449 !
450 ! ******************************************************************************
451 
452  SUBROUTINE rflu_createwtsc2cwrapper(pRegion,order)
453 
454  IMPLICIT NONE
455 
456 ! ******************************************************************************
457 ! Declarations and definitions
458 ! ******************************************************************************
459 
460 ! ==============================================================================
461 ! Arguments
462 ! ==============================================================================
463 
464  INTEGER, INTENT(IN) :: order
465  TYPE(t_region), POINTER :: pregion
466 
467 ! ==============================================================================
468 ! Locals
469 ! ==============================================================================
470 
471  TYPE(t_global), POINTER :: global
472  TYPE(t_mixt_input), POINTER :: pmixtinput
473 
474 ! ******************************************************************************
475 ! Start
476 ! ******************************************************************************
477 
478  global => pregion%global
479 
480  CALL registerfunction(global,'RFLU_CreateWtsC2CWrapper',&
481  'RFLU_ModWeights.F90')
482 
483 ! ******************************************************************************
484 ! Set pointers and variables
485 ! ******************************************************************************
486 
487  pmixtinput => pregion%mixtInput
488 
489 ! ******************************************************************************
490 ! Call routines to compute weights
491 ! ******************************************************************************
492 
493  SELECT CASE ( pmixtinput%stencilDimensCells )
494  CASE ( 1 )
495  CASE ( 2,3 )
496  CALL rflu_createwtsc2c(pregion,order)
497  CASE default
498  CALL errorstop(global,err_reached_default,__line__)
499  END SELECT ! pMixtInput%stencilDimensCells
500 
501 ! ******************************************************************************
502 ! End
503 ! ******************************************************************************
504 
505  CALL deregisterfunction(global)
506 
507  END SUBROUTINE rflu_createwtsc2cwrapper
508 
509 
510 
511 
512 
513 
514 
515 
516 ! *******************************************************************************
517 !
518 ! Purpose: Create weights for face-to-cell stencil.
519 !
520 ! Description: None.
521 !
522 ! Input:
523 ! pRegion Pointer to region
524 ! orderInput Desired order
525 !
526 ! Output: None.
527 !
528 ! Notes: None.
529 !
530 ! ******************************************************************************
531 
532  SUBROUTINE rflu_createwtsf2c(pRegion,orderInput)
533 
534  IMPLICIT NONE
535 
536 ! ******************************************************************************
537 ! Declarations and definitions
538 ! ******************************************************************************
539 
540 ! ==============================================================================
541 ! Arguments
542 ! ==============================================================================
543 
544  INTEGER, INTENT(IN) :: orderinput
545  TYPE(t_region), POINTER :: pregion
546 
547 ! ==============================================================================
548 ! Locals
549 ! ==============================================================================
550 
551  INTEGER :: errorflag,ifg,order
552  TYPE(t_global), POINTER :: global
553  TYPE(t_grid), POINTER :: pgrid
554 
555 ! ******************************************************************************
556 ! Start
557 ! ******************************************************************************
558 
559  global => pregion%global
560 
561  CALL registerfunction(global,'RFLU_CreateWtsF2C',&
562  'RFLU_ModWeights.F90')
563 
564  IF ( global%myProcid == masterproc .AND. &
565  global%verbLevel > verbose_none ) THEN
566  WRITE(stdout,'(A,1X,A)') solver_name, &
567  'Creating face-to-cell weights...'
568  END IF ! global%verbLevel
569 
570 ! ******************************************************************************
571 ! Set grid pointer
572 ! ******************************************************************************
573 
574  pgrid => pregion%grid
575 
576 ! ******************************************************************************
577 ! Modify order so that can run with first-order scheme
578 ! ******************************************************************************
579 
580  order = max(orderinput,1)
581 
582 ! ******************************************************************************
583 ! Nullify memory
584 ! ******************************************************************************
585 
586  CALL rflu_nullifywtsf2c(pregion)
587 
588 ! ******************************************************************************
589 ! Allocate memory
590 ! ******************************************************************************
591 
592  SELECT CASE ( order )
593 
594 ! ==============================================================================
595 ! Linear approximation
596 ! ==============================================================================
597 
598  CASE ( 1 )
599  SELECT CASE ( pregion%mixtInput%dimens )
600  CASE ( 1 ) ! NOTE should never reach here
601  CASE ( 2 )
602  DO ifg = 1,pgrid%nFaces
603  ALLOCATE(pgrid%f2cs(ifg)%xyzMoms(xyz_mom_11:xyz_mom_33), &
604  stat=errorflag)
605  global%error = errorflag
606  IF ( global%error /= err_none ) THEN
607  CALL errorstop(global,err_allocate,__line__, &
608  'pGrid%f2cs%xyzMoms')
609  END IF ! global%error
610  END DO ! ifg
611  CASE ( 3 )
612  DO ifg = 1,pgrid%nFaces
613  ALLOCATE(pgrid%f2cs(ifg)%xyzMoms(xyz_mom_11:xyz_mom_44), &
614  stat=errorflag)
615  global%error = errorflag
616  IF ( global%error /= err_none ) THEN
617  CALL errorstop(global,err_allocate,__line__, &
618  'pGrid%f2cs%xyzMoms')
619  END IF ! global%error
620  END DO ! ifg
621  CASE default
622  CALL errorstop(global,err_reached_default,__line__)
623  END SELECT ! dimens
624 
625 ! ==============================================================================
626 ! Default
627 ! ==============================================================================
628 
629  CASE default
630  CALL errorstop(global,err_reached_default,__line__)
631  END SELECT ! order
632 
633 ! ******************************************************************************
634 ! End
635 ! ******************************************************************************
636 
637  IF ( global%myProcid == masterproc .AND. &
638  global%verbLevel > verbose_none ) THEN
639  WRITE(stdout,'(A,1X,A)') solver_name, &
640  'Creating face-to-cell weights done.'
641  END IF ! global%verbLevel
642 
643  CALL deregisterfunction(global)
644 
645  END SUBROUTINE rflu_createwtsf2c
646 
647 
648 
649 
650 
651 
652 
653 ! *******************************************************************************
654 !
655 ! Purpose: Wrapper routine for creating face-to-cell weights.
656 !
657 ! Description: None.
658 !
659 ! Input:
660 ! pRegion Pointer to region
661 ! order Desired order
662 !
663 ! Output: None.
664 !
665 ! Notes: None.
666 !
667 ! ******************************************************************************
668 
669  SUBROUTINE rflu_createwtsf2cwrapper(pRegion,order)
670 
671  IMPLICIT NONE
672 
673 ! ******************************************************************************
674 ! Declarations and definitions
675 ! ******************************************************************************
676 
677 ! ==============================================================================
678 ! Arguments
679 ! ==============================================================================
680 
681  INTEGER, INTENT(IN) :: order
682  TYPE(t_region), POINTER :: pregion
683 
684 ! ==============================================================================
685 ! Locals
686 ! ==============================================================================
687 
688  TYPE(t_global), POINTER :: global
689  TYPE(t_mixt_input), POINTER :: pmixtinput
690 
691 ! ******************************************************************************
692 ! Start
693 ! ******************************************************************************
694 
695  global => pregion%global
696 
697  CALL registerfunction(global,'RFLU_CreateWtsF2CWrapper',&
698  'RFLU_ModWeights.F90')
699 
700 ! ******************************************************************************
701 ! Set pointers and variables
702 ! ******************************************************************************
703 
704  pmixtinput => pregion%mixtInput
705 
706 ! ******************************************************************************
707 ! Call routines to compute weights
708 ! ******************************************************************************
709 
710  SELECT CASE ( pmixtinput%stencilDimensFaces )
711  CASE ( 1 )
712  CASE ( 2,3 )
713  CALL rflu_createwtsf2c(pregion,order)
714  CASE default
715  CALL errorstop(global,err_reached_default,__line__)
716  END SELECT ! pMixtInput%stencilDimensFaces
717 
718 ! ******************************************************************************
719 ! End
720 ! ******************************************************************************
721 
722  CALL deregisterfunction(global)
723 
724  END SUBROUTINE rflu_createwtsf2cwrapper
725 
726 
727 
728 
729 
730 
731 ! *******************************************************************************
732 !
733 ! Purpose: Compute weights for boundary face-to-cell stencil.
734 !
735 ! Description: None.
736 !
737 ! Input:
738 ! pRegion Pointer to region
739 ! pPatch Pointer to patch
740 ! orderInput Desired order
741 !
742 ! Output: None.
743 !
744 ! Notes: None.
745 !
746 ! ******************************************************************************
747 
748  SUBROUTINE rflu_computewtsbf2c(pRegion,pPatch,orderInput)
749 
750  IMPLICIT NONE
751 
752 ! ******************************************************************************
753 ! Declarations and definitions
754 ! ******************************************************************************
755 
756 ! ==============================================================================
757 ! Arguments
758 ! ==============================================================================
759 
760  INTEGER, INTENT(IN) :: orderinput
761  TYPE(t_patch), POINTER :: ppatch
762  TYPE(t_region), POINTER :: pregion
763 
764 ! ==============================================================================
765 ! Locals
766 ! ==============================================================================
767 
768  INTEGER :: errorflag,nmembs,icg,ifl,isl,order
769  REAL(RFREAL), DIMENSION(:,:), ALLOCATABLE :: dr
770  TYPE(t_global), POINTER :: global
771  TYPE(t_grid), POINTER :: pgrid
772 
773 ! ******************************************************************************
774 ! Start
775 ! ******************************************************************************
776 
777  global => pregion%global
778 
779  CALL registerfunction(global,'RFLU_ComputeWtsBF2C',&
780  'RFLU_ModWeights.F90')
781 
782  IF ( global%myProcid == masterproc .AND. &
783  global%verbLevel > verbose_none ) THEN
784  WRITE(stdout,'(A,1X,A)') solver_name, &
785  'Computing boundary face-to-cell weights...'
786  END IF ! global%verbLevel
787 
788 ! ******************************************************************************
789 ! Set grid pointer
790 ! ******************************************************************************
791 
792  pgrid => pregion%grid
793 
794 ! ******************************************************************************
795 ! Modify order so that can run with first-order scheme
796 ! ******************************************************************************
797 
798  order = max(orderinput,1)
799 
800 ! ******************************************************************************
801 ! Compute weights
802 ! ******************************************************************************
803 
804  SELECT CASE ( order )
805 
806 ! ==============================================================================
807 ! Linear approximation
808 ! ==============================================================================
809 
810  CASE ( 1 )
811  IF ( ppatch%bcType /= bc_virtual ) THEN
812  SELECT CASE ( pregion%mixtInput%dimens )
813  CASE ( 1 )
814  CASE ( 2 )
815  DO ifl = 1,ppatch%nBFaces
816  nmembs = ppatch%bf2cs(ifl)%nCellMembs
817 
818  ALLOCATE(dr(xcoord:ycoord,nmembs),stat=errorflag)
819  global%error = errorflag
820  IF ( global%error /= err_none ) THEN
821  CALL errorstop(global,err_allocate,__line__,'dr')
822  END IF ! global%error
823 
824  DO isl = 1,nmembs
825  icg = ppatch%bf2cs(ifl)%cellMembs(isl)
826 
827  dr(xcoord,isl) = pgrid%cofg(xcoord,icg) &
828  - ppatch%fc(xcoord,ifl)
829  dr(ycoord,isl) = pgrid%cofg(ycoord,icg) &
830  - ppatch%fc(ycoord,ifl)
831  END DO ! isl
832 
833  CALL rflu_computestencilmoments2d1(global,nmembs,dr, &
834  ppatch%bf2cs(ifl)%xyzMoms)
835 
836  DEALLOCATE(dr,stat=errorflag)
837  global%error = errorflag
838  IF ( global%error /= err_none ) THEN
839  CALL errorstop(global,err_deallocate,__line__,'dr')
840  END IF ! global%error
841  END DO ! ifl
842  CASE ( 3 )
843  DO ifl = 1,ppatch%nBFaces
844  nmembs = ppatch%bf2cs(ifl)%nCellMembs
845 
846  ALLOCATE(dr(xcoord:zcoord,nmembs),stat=errorflag)
847  global%error = errorflag
848  IF ( global%error /= err_none ) THEN
849  CALL errorstop(global,err_allocate,__line__,'dr')
850  END IF ! global%error
851 
852  DO isl = 1,nmembs
853  icg = ppatch%bf2cs(ifl)%cellMembs(isl)
854 
855  dr(xcoord,isl) = pgrid%cofg(xcoord,icg) &
856  - ppatch%fc(xcoord,ifl)
857  dr(ycoord,isl) = pgrid%cofg(ycoord,icg) &
858  - ppatch%fc(ycoord,ifl)
859  dr(zcoord,isl) = pgrid%cofg(zcoord,icg) &
860  - ppatch%fc(zcoord,ifl)
861  END DO ! isl
862 
863  CALL rflu_computestencilmoments3d1(global,nmembs,dr, &
864  ppatch%bf2cs(ifl)%xyzMoms)
865 
866  DEALLOCATE(dr,stat=errorflag)
867  global%error = errorflag
868  IF ( global%error /= err_none ) THEN
869  CALL errorstop(global,err_deallocate,__line__,'dr')
870  END IF ! global%error
871  END DO ! ifl
872  CASE default
873  CALL errorstop(global,err_reached_default,__line__)
874  END SELECT ! pRegion%mixtInput%dimens
875  END IF ! pPatch%bcType
876 
877 ! ==============================================================================
878 ! Default
879 ! ==============================================================================
880 
881  CASE default
882  CALL errorstop(global,err_reached_default,__line__)
883  END SELECT ! order
884 
885 ! ******************************************************************************
886 ! End
887 ! ******************************************************************************
888 
889  IF ( global%myProcid == masterproc .AND. &
890  global%verbLevel > verbose_none ) THEN
891  WRITE(stdout,'(A,1X,A)') solver_name, &
892  'Computing boundary face-to-cell weights done.'
893  END IF ! global%verbLevel
894 
895  CALL deregisterfunction(global)
896 
897  END SUBROUTINE rflu_computewtsbf2c
898 
899 
900 
901 
902 
903 
904 
905 
906 ! *******************************************************************************
907 !
908 ! Purpose: Wrapper routine for computing boundary-face-to-cell weights.
909 !
910 ! Description: None.
911 !
912 ! Input:
913 ! pRegion Pointer to region
914 ! pPatch Pointer to patch
915 ! order Desired order
916 !
917 ! Output: None.
918 !
919 ! Notes: None.
920 !
921 ! ******************************************************************************
922 
923  SUBROUTINE rflu_computewtsbf2cwrapper(pRegion,pPatch,order)
924 
925  IMPLICIT NONE
926 
927 ! ******************************************************************************
928 ! Declarations and definitions
929 ! ******************************************************************************
930 
931 ! ==============================================================================
932 ! Arguments
933 ! ==============================================================================
934 
935  INTEGER, INTENT(IN) :: order
936  TYPE(t_patch), POINTER :: ppatch
937  TYPE(t_region), POINTER :: pregion
938 
939 ! ==============================================================================
940 ! Locals
941 ! ==============================================================================
942 
943  TYPE(t_global), POINTER :: global
944  TYPE(t_mixt_input), POINTER :: pmixtinput
945 
946 ! ******************************************************************************
947 ! Start
948 ! ******************************************************************************
949 
950  global => pregion%global
951 
952  CALL registerfunction(global,'RFLU_ComputeWtsBF2CWrapper',&
953  'RFLU_ModWeights.F90')
954 
955 ! ******************************************************************************
956 ! Set pointers and variables
957 ! ******************************************************************************
958 
959  pmixtinput => pregion%mixtInput
960 
961 ! ******************************************************************************
962 ! Call routines to compute weights
963 ! ******************************************************************************
964 
965  SELECT CASE ( pmixtinput%stencilDimensBFaces )
966  CASE ( 1 )
967  CASE ( 2,3 )
968  CALL rflu_computewtsbf2c(pregion,ppatch,order)
969  CASE default
970  CALL errorstop(global,err_reached_default,__line__)
971  END SELECT ! pMixtInput%stencilDimensBFaces
972 
973 ! ******************************************************************************
974 ! End
975 ! ******************************************************************************
976 
977  CALL deregisterfunction(global)
978 
979  END SUBROUTINE rflu_computewtsbf2cwrapper
980 
981 
982 
983 
984 
985 
986 
987 ! *******************************************************************************
988 !
989 ! Purpose: Compute weights for cell-to-cell stencil.
990 !
991 ! Description: None.
992 !
993 ! Input:
994 ! pRegion Pointer to region
995 ! order Desired order
996 !
997 ! Output: None.
998 !
999 ! Notes: None.
1000 !
1001 ! ******************************************************************************
1002 
1003  SUBROUTINE rflu_computewtsc2c(pRegion,order)
1004 
1005  IMPLICIT NONE
1006 
1007 ! ******************************************************************************
1008 ! Declarations and definitions
1009 ! ******************************************************************************
1010 
1011 ! ==============================================================================
1012 ! Arguments
1013 ! ==============================================================================
1014 
1015  INTEGER, INTENT(IN) :: order
1016  TYPE(t_region), POINTER :: pregion
1017 
1018 ! ==============================================================================
1019 ! Locals
1020 ! ==============================================================================
1021 
1022  INTEGER :: errorflag,nmembs,icg,icg2,isl
1023  REAL(RFREAL), DIMENSION(:,:), ALLOCATABLE :: dr
1024  TYPE(t_grid), POINTER :: pgrid
1025  TYPE(t_global), POINTER :: global
1026 
1027 ! ******************************************************************************
1028 ! Start
1029 ! ******************************************************************************
1030 
1031  global => pregion%global
1032 
1033  CALL registerfunction(global,'RFLU_ComputeWtsC2C',&
1034  'RFLU_ModWeights.F90')
1035 
1036  IF ( global%myProcid == masterproc .AND. &
1037  global%verbLevel > verbose_none ) THEN
1038  WRITE(stdout,'(A,1X,A)') solver_name, &
1039  'Computing cell-to-cell weights...'
1040  END IF ! global%verbLevel
1041 
1042 ! ******************************************************************************
1043 ! Set grid pointer
1044 ! ******************************************************************************
1045 
1046  pgrid => pregion%grid
1047 
1048 ! ******************************************************************************
1049 ! Compute weights
1050 ! ******************************************************************************
1051 
1052  SELECT CASE ( order )
1053 
1054 ! ==============================================================================
1055 ! Linear approximation
1056 ! ==============================================================================
1057 
1058  CASE ( 1 )
1059  SELECT CASE ( pregion%mixtInput%dimens )
1060  CASE ( 1 ) ! NOTE should never reach here
1061  CASE ( 2 )
1062  DO icg = 1,pgrid%nCellsTot
1063  nmembs = pgrid%c2cs(icg)%nCellMembs
1064 
1065  ALLOCATE(dr(xcoord:ycoord,nmembs),stat=errorflag)
1066  global%error = errorflag
1067  IF ( global%error /= err_none ) THEN
1068  CALL errorstop(global,err_allocate,__line__,'dr')
1069  END IF ! global%error
1070 
1071  DO isl = 1,nmembs
1072  icg2 = pgrid%c2cs(icg)%cellMembs(isl)
1073 
1074  dr(xcoord,isl) = pgrid%cofg(xcoord,icg2)-pgrid%cofg(xcoord,icg)
1075  dr(ycoord,isl) = pgrid%cofg(ycoord,icg2)-pgrid%cofg(ycoord,icg)
1076  END DO ! isl
1077 
1078  CALL rflu_computestencilmoments2d1(global,nmembs,dr, &
1079  pgrid%c2cs(icg)%xyzMoms)
1080 
1081  DEALLOCATE(dr,stat=errorflag)
1082  global%error = errorflag
1083  IF ( global%error /= err_none ) THEN
1084  CALL errorstop(global,err_deallocate,__line__,'dr')
1085  END IF ! global%error
1086  END DO ! icg
1087  CASE ( 3 )
1088  DO icg = 1,pgrid%nCellsTot
1089  nmembs = pgrid%c2cs(icg)%nCellMembs
1090 
1091  ALLOCATE(dr(xcoord:zcoord,nmembs),stat=errorflag)
1092  global%error = errorflag
1093  IF ( global%error /= err_none ) THEN
1094  CALL errorstop(global,err_allocate,__line__,'dr')
1095  END IF ! global%error
1096 
1097  DO isl = 1,nmembs
1098  icg2 = pgrid%c2cs(icg)%cellMembs(isl)
1099 
1100  dr(xcoord,isl) = pgrid%cofg(xcoord,icg2)-pgrid%cofg(xcoord,icg)
1101  dr(ycoord,isl) = pgrid%cofg(ycoord,icg2)-pgrid%cofg(ycoord,icg)
1102  dr(zcoord,isl) = pgrid%cofg(zcoord,icg2)-pgrid%cofg(zcoord,icg)
1103  END DO ! isl
1104 
1105  CALL rflu_computestencilmoments3d1(global,nmembs,dr, &
1106  pgrid%c2cs(icg)%xyzMoms)
1107 
1108  DEALLOCATE(dr,stat=errorflag)
1109  global%error = errorflag
1110  IF ( global%error /= err_none ) THEN
1111  CALL errorstop(global,err_deallocate,__line__,'dr')
1112  END IF ! global%error
1113  END DO ! icg
1114  CASE default
1115  CALL errorstop(global,err_reached_default,__line__)
1116  END SELECT ! pRegion%mixtInput%dimens
1117 
1118 ! ==============================================================================
1119 ! Default
1120 ! ==============================================================================
1121 
1122  CASE default
1123  CALL errorstop(global,err_reached_default,__line__)
1124  END SELECT ! order
1125 
1126 ! ******************************************************************************
1127 ! End
1128 ! ******************************************************************************
1129 
1130  IF ( global%myProcid == masterproc .AND. &
1131  global%verbLevel > verbose_none ) THEN
1132  WRITE(stdout,'(A,1X,A)') solver_name, &
1133  'Computing cell-to-cell weights done.'
1134  END IF ! global%verbLevel
1135 
1136  CALL deregisterfunction(global)
1137 
1138  END SUBROUTINE rflu_computewtsc2c
1139 
1140 
1141 
1142 
1143 
1144 
1145 
1146 
1147 ! *******************************************************************************
1148 !
1149 ! Purpose: Wrapper routine for computing cell-to-cell weights.
1150 !
1151 ! Description: None.
1152 !
1153 ! Input:
1154 ! pRegion Pointer to region
1155 ! order Desired order
1156 !
1157 ! Output: None.
1158 !
1159 ! Notes: None.
1160 !
1161 ! ******************************************************************************
1162 
1163  SUBROUTINE rflu_computewtsc2cwrapper(pRegion,order)
1164 
1165  IMPLICIT NONE
1166 
1167 ! ******************************************************************************
1168 ! Declarations and definitions
1169 ! ******************************************************************************
1170 
1171 ! ==============================================================================
1172 ! Arguments
1173 ! ==============================================================================
1174 
1175  INTEGER, INTENT(IN) :: order
1176  TYPE(t_region), POINTER :: pregion
1177 
1178 ! ==============================================================================
1179 ! Locals
1180 ! ==============================================================================
1181 
1182  TYPE(t_global), POINTER :: global
1183  TYPE(t_mixt_input), POINTER :: pmixtinput
1184 
1185 ! ******************************************************************************
1186 ! Start
1187 ! ******************************************************************************
1188 
1189  global => pregion%global
1190 
1191  CALL registerfunction(global,'RFLU_ComputeWtsC2CWrapper',&
1192  'RFLU_ModWeights.F90')
1193 
1194 ! ******************************************************************************
1195 ! Set pointers and variables
1196 ! ******************************************************************************
1197 
1198  pmixtinput => pregion%mixtInput
1199 
1200 ! ******************************************************************************
1201 ! Call routines to compute weights
1202 ! ******************************************************************************
1203 
1204  SELECT CASE ( pmixtinput%stencilDimensCells )
1205  CASE ( 1 )
1206  CASE ( 2,3 )
1207  CALL rflu_computewtsc2c(pregion,order)
1208  CASE default
1209  CALL errorstop(global,err_reached_default,__line__)
1210  END SELECT ! pMixtInput%stencilDimensCells
1211 
1212 ! ******************************************************************************
1213 ! End
1214 ! ******************************************************************************
1215 
1216  CALL deregisterfunction(global)
1217 
1218  END SUBROUTINE rflu_computewtsc2cwrapper
1219 
1220 
1221 
1222 
1223 
1224 
1225 
1226 ! *******************************************************************************
1227 !
1228 ! Purpose: Compute weights for face-to-cell stencil.
1229 !
1230 ! Description: None.
1231 !
1232 ! Input:
1233 ! pRegion Pointer to region
1234 ! orderInput Desired order
1235 !
1236 ! Output: None.
1237 !
1238 ! Notes: None.
1239 !
1240 ! ******************************************************************************
1241 
1242  SUBROUTINE rflu_computewtsf2c(pRegion,orderInput)
1243 
1244  IMPLICIT NONE
1245 
1246 ! ******************************************************************************
1247 ! Declarations and definitions
1248 ! ******************************************************************************
1249 
1250 ! ==============================================================================
1251 ! Arguments
1252 ! ==============================================================================
1253 
1254  INTEGER, INTENT(IN) :: orderinput
1255  TYPE(t_region), POINTER :: pregion
1256 
1257 ! ==============================================================================
1258 ! Locals
1259 ! ==============================================================================
1260 
1261  INTEGER :: errorflag,nmembs,icg,ifg,isl,order
1262  REAL(RFREAL), DIMENSION(:,:), ALLOCATABLE :: dr
1263  TYPE(t_global), POINTER :: global
1264  TYPE(t_grid), POINTER :: pgrid
1265 
1266 ! ******************************************************************************
1267 ! Start
1268 ! ******************************************************************************
1269 
1270  global => pregion%global
1271 
1272  CALL registerfunction(global,'RFLU_ComputeWtsF2C',&
1273  'RFLU_ModWeights.F90')
1274 
1275  IF ( global%myProcid == masterproc .AND. &
1276  global%verbLevel > verbose_none ) THEN
1277  WRITE(stdout,'(A,1X,A)') solver_name, &
1278  'Computing face-to-cell weights...'
1279  END IF ! global%verbLevel
1280 
1281 ! ******************************************************************************
1282 ! Set grid pointer
1283 ! ******************************************************************************
1284 
1285  pgrid => pregion%grid
1286 
1287 ! ******************************************************************************
1288 ! Modify order so that can run with first-order scheme
1289 ! ******************************************************************************
1290 
1291  order = max(orderinput,1)
1292 
1293 ! ******************************************************************************
1294 ! Compute weights
1295 ! ******************************************************************************
1296 
1297  SELECT CASE ( order )
1298 
1299 ! ==============================================================================
1300 ! Linear approximation
1301 ! ==============================================================================
1302 
1303  CASE ( 1 )
1304 
1305 ! ------------------------------------------------------------------------------
1306 ! Interior faces
1307 ! ------------------------------------------------------------------------------
1308 
1309  SELECT CASE ( pregion%mixtInput%dimens )
1310  CASE ( 1 ) ! NOTE should never reach here
1311  CASE ( 2 )
1312  DO ifg = 1,pgrid%nFaces
1313  nmembs = pgrid%f2cs(ifg)%nCellMembs
1314 
1315  ALLOCATE(dr(xcoord:ycoord,nmembs),stat=errorflag)
1316  global%error = errorflag
1317  IF ( global%error /= err_none ) THEN
1318  CALL errorstop(global,err_allocate,__line__,'dr')
1319  END IF ! global%error
1320 
1321  DO isl = 1,nmembs
1322  icg = pgrid%f2cs(ifg)%cellMembs(isl)
1323 
1324  dr(xcoord,isl) = pgrid%cofg(xcoord,icg) - pgrid%fc(xcoord,ifg)
1325  dr(ycoord,isl) = pgrid%cofg(ycoord,icg) - pgrid%fc(ycoord,ifg)
1326  END DO ! isl
1327 
1328  CALL rflu_computestencilmoments2d1(global,nmembs,dr, &
1329  pgrid%f2cs(ifg)%xyzMoms)
1330 
1331  DEALLOCATE(dr,stat=errorflag)
1332  global%error = errorflag
1333  IF ( global%error /= err_none ) THEN
1334  CALL errorstop(global,err_deallocate,__line__,'dr')
1335  END IF ! global%error
1336  END DO ! ifg
1337  CASE ( 3 )
1338  DO ifg = 1,pgrid%nFaces
1339  nmembs = pgrid%f2cs(ifg)%nCellMembs
1340 
1341  ALLOCATE(dr(xcoord:zcoord,nmembs),stat=errorflag)
1342  global%error = errorflag
1343  IF ( global%error /= err_none ) THEN
1344  CALL errorstop(global,err_allocate,__line__,'dr')
1345  END IF ! global%error
1346 
1347  DO isl = 1,nmembs
1348  icg = pgrid%f2cs(ifg)%cellMembs(isl)
1349 
1350  dr(xcoord,isl) = pgrid%cofg(xcoord,icg)-pgrid%fc(xcoord,ifg)
1351  dr(ycoord,isl) = pgrid%cofg(ycoord,icg)-pgrid%fc(ycoord,ifg)
1352  dr(zcoord,isl) = pgrid%cofg(zcoord,icg)-pgrid%fc(zcoord,ifg)
1353  END DO ! isl
1354 
1355  CALL rflu_computestencilmoments3d1(global,nmembs, &
1356  dr,pgrid%f2cs(ifg)%xyzMoms)
1357 
1358  DEALLOCATE(dr,stat=errorflag)
1359  global%error = errorflag
1360  IF ( global%error /= err_none ) THEN
1361  CALL errorstop(global,err_deallocate,__line__,'dr')
1362  END IF ! global%error
1363  END DO ! ifg
1364  CASE default
1365  CALL errorstop(global,err_reached_default,__line__)
1366  END SELECT ! pRegion%mixtInput%dimens
1367 
1368 ! ==============================================================================
1369 ! Default
1370 ! ==============================================================================
1371 
1372  CASE default
1373  CALL errorstop(global,err_reached_default,__line__)
1374  END SELECT ! order
1375 
1376 ! ******************************************************************************
1377 ! End
1378 ! ******************************************************************************
1379 
1380  IF ( global%myProcid == masterproc .AND. &
1381  global%verbLevel > verbose_none ) THEN
1382  WRITE(stdout,'(A,1X,A)') solver_name, &
1383  'Computing face-to-cell weights done.'
1384  END IF ! global%verbLevel
1385 
1386  CALL deregisterfunction(global)
1387 
1388  END SUBROUTINE rflu_computewtsf2c
1389 
1390 
1391 
1392 
1393 
1394 
1395 
1396 ! *******************************************************************************
1397 !
1398 ! Purpose: Wrapper routine for computing face-to-cell weights.
1399 !
1400 ! Description: None.
1401 !
1402 ! Input:
1403 ! pRegion Pointer to region
1404 ! order Desired order
1405 !
1406 ! Output: None.
1407 !
1408 ! Notes: None.
1409 !
1410 ! ******************************************************************************
1411 
1412  SUBROUTINE rflu_computewtsf2cwrapper(pRegion,order)
1413 
1414  IMPLICIT NONE
1415 
1416 ! ******************************************************************************
1417 ! Declarations and definitions
1418 ! ******************************************************************************
1419 
1420 ! ==============================================================================
1421 ! Arguments
1422 ! ==============================================================================
1423 
1424  INTEGER, INTENT(IN) :: order
1425  TYPE(t_region), POINTER :: pregion
1426 
1427 ! ==============================================================================
1428 ! Locals
1429 ! ==============================================================================
1430 
1431  TYPE(t_global), POINTER :: global
1432  TYPE(t_mixt_input), POINTER :: pmixtinput
1433 
1434 ! ******************************************************************************
1435 ! Start
1436 ! ******************************************************************************
1437 
1438  global => pregion%global
1439 
1440  CALL registerfunction(global,'RFLU_ComputeWtsF2CWrapper',&
1441  'RFLU_ModWeights.F90')
1442 
1443 ! ******************************************************************************
1444 ! Set pointers and variables
1445 ! ******************************************************************************
1446 
1447  pmixtinput => pregion%mixtInput
1448 
1449 ! ******************************************************************************
1450 ! Call routines to compute weights
1451 ! ******************************************************************************
1452 
1453  SELECT CASE ( pmixtinput%stencilDimensFaces )
1454  CASE ( 1 )
1455  CASE ( 2,3 )
1456  CALL rflu_computewtsf2c(pregion,order)
1457  CASE default
1458  CALL errorstop(global,err_reached_default,__line__)
1459  END SELECT ! pMixtInput%stencilDimensFaces
1460 
1461 ! ******************************************************************************
1462 ! End
1463 ! ******************************************************************************
1464 
1465  CALL deregisterfunction(global)
1466 
1467  END SUBROUTINE rflu_computewtsf2cwrapper
1468 
1469 
1470 
1471 
1472 
1473 
1474 
1475 ! *******************************************************************************
1476 !
1477 ! Purpose: Compute weights for 1D x-to-cell stencil.
1478 !
1479 ! Description: Compute Lagrangian polynomial stencil weights from Fornberg
1480 ! algorithm.
1481 !
1482 ! Input:
1483 ! global Pointer to global data
1484 ! m Order of derivative for which weights are sought
1485 ! nMembs Number of stencil members
1486 ! x Locations of stencil members
1487 ! z Location at which weights are sough
1488 !
1489 ! Output:
1490 ! w Stencil weights (corresponding to c array in Fornberg)
1491 !
1492 ! Notes:
1493 ! 1. See Fornberg, SIAM Rev., Vol.40, No.3, pp.685-691, Sep. 1998.
1494 !
1495 ! ******************************************************************************
1496 
1497  SUBROUTINE rflu_computewtsx2c_1d(global,m,nMembs,x,z,w)
1498 
1499  IMPLICIT NONE
1500 
1501 ! ******************************************************************************
1502 ! Declarations and definitions
1503 ! ******************************************************************************
1504 
1505 ! ==============================================================================
1506 ! Arguments
1507 ! ==============================================================================
1508 
1509  INTEGER, INTENT(IN) :: m,nmembs
1510  REAL(RFREAL), INTENT(IN) :: z
1511  REAL(RFREAL), INTENT(IN) :: x(0:nmembs-1)
1512  REAL(RFREAL), INTENT(OUT) :: w(0:nmembs-1)
1513  TYPE(t_global), POINTER :: global
1514 
1515 ! ==============================================================================
1516 ! Locals
1517 ! ==============================================================================
1518 
1519  INTEGER :: errorflag,i,j,k,mn,n
1520  REAL(RFREAL) :: c1,c2,c3,c4,c5 ! Same notation as Fornberg
1521  REAL(RFREAL) :: c(0:nmembs-1,0:m)
1522 
1523 ! ******************************************************************************
1524 ! Start
1525 ! ******************************************************************************
1526 
1527  CALL registerfunction(global,'RFLU_ComputeWtsX2C_1D',&
1528  'RFLU_ModWeights.F90')
1529 
1530 ! ******************************************************************************
1531 ! Set pointers and variables
1532 ! ******************************************************************************
1533 
1534  n = nmembs-1
1535 
1536 ! TO DO
1537 ! Add check for order (given nMembs)
1538 ! END TO DO
1539 
1540 ! ******************************************************************************
1541 ! Initialize
1542 ! ******************************************************************************
1543 
1544  c1 = 1.0_rfreal
1545  c4 = x(0) - z
1546 
1547  DO k = 0,m
1548  DO j = 0,n
1549  c(j,k) = 0.0_rfreal
1550  END DO ! j
1551  END DO ! k
1552 
1553  c(0,0) = 1.0_rfreal
1554 
1555 ! ******************************************************************************
1556 ! Compute weights
1557 ! ******************************************************************************
1558 
1559  DO i = 1,n
1560  mn = min(i,m)
1561  c2 = 1.0_rfreal
1562  c5 = c4
1563  c4 = x(i) - z
1564 
1565  DO j = 0,i-1
1566  c3 = x(i) - x(j)
1567  c2 = c2*c3
1568 
1569  IF ( j == (i-1) ) THEN
1570  DO k = mn,1,-1
1571  c(i,k) = c1*(k*c(i-1,k-1) - c5*c(i-1,k))/c2
1572  END DO ! k
1573 
1574  c(i,0) = -c1*c5*c(i-1,0)/c2
1575  END IF ! j
1576 
1577  DO k = mn,1,-1
1578  c(j,k) = (c4*c(j,k) - k*c(j,k-1))/c3
1579  END DO ! k
1580 
1581  c(j,0) = c4*c(j,0)/c3
1582  END DO ! j
1583 
1584  c1 = c2
1585  END DO ! i
1586 
1587  DO j = 0,nmembs-1
1588  w(j) = c(j,m)
1589  END DO ! j
1590 
1591 ! ******************************************************************************
1592 ! End
1593 ! ******************************************************************************
1594 
1595  CALL deregisterfunction(global)
1596 
1597  END SUBROUTINE rflu_computewtsx2c_1d
1598 
1599 
1600 
1601 
1602 
1603 
1604 ! *******************************************************************************
1605 !
1606 ! Purpose: Compute weights from coordinate differences.
1607 !
1608 ! Description: None.
1609 !
1610 ! Input:
1611 ! global Pointer to global data
1612 ! nMembs Number of members in stencil
1613 ! dr Coordinate differences
1614 !
1615 ! Output:
1616 ! xyzMoms Coordinate moments
1617 !
1618 ! Notes:
1619 ! 1. Use inverse-distance weighting.
1620 !
1621 ! ******************************************************************************
1622 
1623  SUBROUTINE rflu_computestencilmoments2d1(global,nMembs,dr,xyzMoms)
1624 
1625  IMPLICIT NONE
1626 
1627 ! ******************************************************************************
1628 ! Declarations and definitions
1629 ! ******************************************************************************
1630 
1631 ! ==============================================================================
1632 ! Arguments
1633 ! ==============================================================================
1634 
1635  INTEGER, INTENT(IN) :: nmembs
1636  REAL(RFREAL), INTENT(INOUT) :: dr(xcoord:ycoord,nmembs)
1637  REAL(RFREAL), INTENT(INOUT) :: xyzmoms(xyz_mom_11:xyz_mom_33)
1638  TYPE(t_global), POINTER :: global
1639 
1640 ! ==============================================================================
1641 ! Locals
1642 ! ==============================================================================
1643 
1644  INTEGER :: isl
1645  REAL(RFREAL) :: dx,dy,ir11,ir22,ir33,r11,r12,r13,r22,r23, &
1646  r33,wt
1647 
1648 ! ******************************************************************************
1649 ! Start
1650 ! ******************************************************************************
1651 
1652  CALL registerfunction(global,'RFLU_ComputeStencilMoments2D1',&
1653  'RFLU_ModWeights.F90')
1654 
1655 ! ******************************************************************************
1656 ! Compute moments
1657 ! ******************************************************************************
1658 
1659 ! ==============================================================================
1660 ! Initialize weights
1661 ! ==============================================================================
1662 
1663  xyzmoms(xyz_mom_11) = 0.0_rfreal
1664 
1665  xyzmoms(xyz_mom_12) = 0.0_rfreal
1666  xyzmoms(xyz_mom_22) = 0.0_rfreal
1667 
1668  xyzmoms(xyz_mom_13) = 0.0_rfreal
1669  xyzmoms(xyz_mom_23) = 0.0_rfreal
1670  xyzmoms(xyz_mom_33) = 0.0_rfreal
1671 
1672 ! ==============================================================================
1673 ! Compute weights
1674 ! ==============================================================================
1675 
1676  DO isl = 1,nmembs
1677  dx = dr(xcoord,isl)
1678  dy = dr(ycoord,isl)
1679 
1680  wt = 1.0_rfreal/sqrt(dx*dx + dy*dy)
1681 
1682  dx = wt*dx
1683  dy = wt*dy
1684 
1685  xyzmoms(xyz_mom_11) = xyzmoms(xyz_mom_11) + dx*dx
1686 
1687  xyzmoms(xyz_mom_12) = xyzmoms(xyz_mom_12) + dx*dy
1688  xyzmoms(xyz_mom_22) = xyzmoms(xyz_mom_22) + dy*dy
1689 
1690  xyzmoms(xyz_mom_13) = xyzmoms(xyz_mom_13) + wt*dx
1691  xyzmoms(xyz_mom_23) = xyzmoms(xyz_mom_23) + wt*dy
1692  xyzmoms(xyz_mom_33) = xyzmoms(xyz_mom_33) + wt*wt
1693  END DO ! isl
1694 
1695  r11 = sqrt(xyzmoms(xyz_mom_11))
1696  ir11 = 1.0_rfreal/r11
1697 
1698  r12 = ir11*xyzmoms(xyz_mom_12)
1699  r22 = sqrt(xyzmoms(xyz_mom_22) - r12*r12)
1700  ir22 = 1.0_rfreal/r22
1701 
1702  r13 = ir11*xyzmoms(xyz_mom_13)
1703  r23 = ir22*(xyzmoms(xyz_mom_23) - r12*r13 )
1704  r33 = sqrt(xyzmoms(xyz_mom_33) - (r13*r13 + r23*r23))
1705  ir33 = 1.0_rfreal/r33
1706 
1707 ! ==============================================================================
1708 ! Store weights
1709 ! ==============================================================================
1710 
1711  xyzmoms(xyz_mom_11) = r11
1712 
1713  xyzmoms(xyz_mom_12) = r12
1714  xyzmoms(xyz_mom_22) = r22
1715 
1716  xyzmoms(xyz_mom_13) = r13
1717  xyzmoms(xyz_mom_23) = r23
1718  xyzmoms(xyz_mom_33) = r33
1719 
1720 ! ******************************************************************************
1721 ! End
1722 ! ******************************************************************************
1723 
1724  CALL deregisterfunction(global)
1725 
1726  END SUBROUTINE rflu_computestencilmoments2d1
1727 
1728 
1729 
1730 
1731 
1732 
1733 
1734 
1735 ! *******************************************************************************
1736 !
1737 ! Purpose: Compute weights from coordinate differences.
1738 !
1739 ! Description: None.
1740 !
1741 ! Input:
1742 ! global Pointer to global data
1743 ! nMembs Number of members in stencil
1744 ! dr Coordinate differences
1745 !
1746 ! Output:
1747 ! xyzMoms Coordinate moments
1748 !
1749 ! Notes:
1750 ! 1. Use inverse-distance weighting.
1751 !
1752 ! ******************************************************************************
1753 
1754  SUBROUTINE rflu_computestencilmoments3d1(global,nMembs,dr,xyzMoms)
1755 
1756  IMPLICIT NONE
1757 
1758 ! ******************************************************************************
1759 ! Declarations and definitions
1760 ! ******************************************************************************
1761 
1762 ! ==============================================================================
1763 ! Arguments
1764 ! ==============================================================================
1765 
1766  INTEGER, INTENT(IN) :: nmembs
1767  REAL(RFREAL), INTENT(INOUT) :: dr(xcoord:zcoord,nmembs)
1768  REAL(RFREAL), INTENT(INOUT) :: xyzmoms(xyz_mom_11:xyz_mom_44)
1769  TYPE(t_global), POINTER :: global
1770 
1771 ! ==============================================================================
1772 ! Locals
1773 ! ==============================================================================
1774 
1775  INTEGER :: isl
1776  REAL(RFREAL) :: dx,dy,dz,ir11,ir22,ir33,r11,r12,r13,r14,r22,r23,r24, &
1777  r33,r34,r44,wt
1778 
1779 ! ******************************************************************************
1780 ! Start
1781 ! ******************************************************************************
1782 
1783  CALL registerfunction(global,'RFLU_ComputeStencilMoments3D1',&
1784  'RFLU_ModWeights.F90')
1785 
1786 ! ******************************************************************************
1787 ! Compute moments
1788 ! ******************************************************************************
1789 
1790 ! ==============================================================================
1791 ! Initialize weights
1792 ! ==============================================================================
1793 
1794  xyzmoms(xyz_mom_11) = 0.0_rfreal
1795 
1796  xyzmoms(xyz_mom_12) = 0.0_rfreal
1797  xyzmoms(xyz_mom_22) = 0.0_rfreal
1798 
1799  xyzmoms(xyz_mom_13) = 0.0_rfreal
1800  xyzmoms(xyz_mom_23) = 0.0_rfreal
1801  xyzmoms(xyz_mom_33) = 0.0_rfreal
1802 
1803  xyzmoms(xyz_mom_14) = 0.0_rfreal
1804  xyzmoms(xyz_mom_24) = 0.0_rfreal
1805  xyzmoms(xyz_mom_34) = 0.0_rfreal
1806  xyzmoms(xyz_mom_44) = 0.0_rfreal
1807 
1808 ! ==============================================================================
1809 ! Compute weights
1810 ! ==============================================================================
1811 
1812  DO isl = 1,nmembs
1813  dx = dr(xcoord,isl)
1814  dy = dr(ycoord,isl)
1815  dz = dr(zcoord,isl)
1816 
1817  wt = 1.0_rfreal/sqrt(dx*dx + dy*dy + dz*dz)
1818 
1819  dx = wt*dx
1820  dy = wt*dy
1821  dz = wt*dz
1822 
1823  xyzmoms(xyz_mom_11) = xyzmoms(xyz_mom_11) + dx*dx
1824 
1825  xyzmoms(xyz_mom_12) = xyzmoms(xyz_mom_12) + dx*dy
1826  xyzmoms(xyz_mom_22) = xyzmoms(xyz_mom_22) + dy*dy
1827 
1828  xyzmoms(xyz_mom_13) = xyzmoms(xyz_mom_13) + dx*dz
1829  xyzmoms(xyz_mom_23) = xyzmoms(xyz_mom_23) + dy*dz
1830  xyzmoms(xyz_mom_33) = xyzmoms(xyz_mom_33) + dz*dz
1831 
1832  xyzmoms(xyz_mom_14) = xyzmoms(xyz_mom_14) + wt*dx
1833  xyzmoms(xyz_mom_24) = xyzmoms(xyz_mom_24) + wt*dy
1834  xyzmoms(xyz_mom_34) = xyzmoms(xyz_mom_34) + wt*dz
1835  xyzmoms(xyz_mom_44) = xyzmoms(xyz_mom_44) + wt*wt
1836  END DO ! isl
1837 
1838  r11 = sqrt(xyzmoms(xyz_mom_11))
1839  ir11 = 1.0_rfreal/r11
1840 
1841  r12 = ir11*xyzmoms(xyz_mom_12)
1842  r22 = sqrt(xyzmoms(xyz_mom_22) - r12*r12)
1843  ir22 = 1.0_rfreal/r22
1844 
1845  r13 = ir11*xyzmoms(xyz_mom_13)
1846  r23 = ir22*(xyzmoms(xyz_mom_23) - r12*r13 )
1847  r33 = sqrt(xyzmoms(xyz_mom_33) - (r13*r13 + r23*r23))
1848  ir33 = 1.0_rfreal/r33
1849 
1850  r14 = ir11*xyzmoms(xyz_mom_14)
1851  r24 = ir22*(xyzmoms(xyz_mom_24) - r12*r14 )
1852  r34 = ir33*(xyzmoms(xyz_mom_34) - (r13*r14 + r23*r24 ))
1853  r44 = sqrt(xyzmoms(xyz_mom_44) - (r14*r14 + r24*r24 + r34*r34))
1854 
1855 ! ==============================================================================
1856 ! Store weights
1857 ! ==============================================================================
1858 
1859  xyzmoms(xyz_mom_11) = r11
1860 
1861  xyzmoms(xyz_mom_12) = r12
1862  xyzmoms(xyz_mom_22) = r22
1863 
1864  xyzmoms(xyz_mom_13) = r13
1865  xyzmoms(xyz_mom_23) = r23
1866  xyzmoms(xyz_mom_33) = r33
1867 
1868  xyzmoms(xyz_mom_14) = r14
1869  xyzmoms(xyz_mom_24) = r24
1870  xyzmoms(xyz_mom_34) = r34
1871  xyzmoms(xyz_mom_44) = r44
1872 
1873 ! ******************************************************************************
1874 ! End
1875 ! ******************************************************************************
1876 
1877  CALL deregisterfunction(global)
1878 
1879  END SUBROUTINE rflu_computestencilmoments3d1
1880 
1881 
1882 
1883 
1884 
1885 ! *******************************************************************************
1886 !
1887 ! Purpose: Destroy weights for boundary face-to-cell stencil.
1888 !
1889 ! Description: None.
1890 !
1891 ! Input:
1892 ! pRegion Pointer to region
1893 ! pPatch Pointer to patch
1894 !
1895 ! Output: None.
1896 !
1897 ! Notes: None.
1898 !
1899 ! ******************************************************************************
1900 
1901  SUBROUTINE rflu_destroywtsbf2c(pRegion,pPatch)
1902 
1903  IMPLICIT NONE
1904 
1905 ! ******************************************************************************
1906 ! Declarations and definitions
1907 ! ******************************************************************************
1908 
1909 ! ==============================================================================
1910 ! Arguments
1911 ! ==============================================================================
1912 
1913  TYPE(t_region), POINTER :: pregion
1914  TYPE(t_patch), POINTER :: ppatch
1915 
1916 ! ==============================================================================
1917 ! Locals
1918 ! ==============================================================================
1919 
1920  INTEGER :: errorflag,ifl
1921  TYPE(t_global), POINTER :: global
1922  TYPE(t_grid), POINTER :: pgrid
1923 
1924 ! ******************************************************************************
1925 ! Start
1926 ! ******************************************************************************
1927 
1928  global => pregion%global
1929 
1930  CALL registerfunction(global,'RFLU_DestroyBWtsF2C',&
1931  'RFLU_ModWeights.F90')
1932 
1933  IF ( global%myProcid == masterproc .AND. &
1934  global%verbLevel > verbose_none ) THEN
1935  WRITE(stdout,'(A,1X,A)') solver_name, &
1936  'Destroying boundary face-to-cell weights...'
1937  END IF ! global%verbLevel
1938 
1939 ! ******************************************************************************
1940 ! Set grid pointer
1941 ! ******************************************************************************
1942 
1943  pgrid => pregion%grid
1944 
1945 ! ******************************************************************************
1946 ! Deallocate memory
1947 ! ******************************************************************************
1948 
1949  IF ( ppatch%bcType /= bc_virtual ) THEN
1950  DO ifl = 1,ppatch%nBFaces
1951  DEALLOCATE(ppatch%bf2cs(ifl)%xyzMoms,stat=errorflag)
1952  global%error = errorflag
1953  IF ( global%error /= err_none ) THEN
1954  CALL errorstop(global,err_deallocate,__line__,'pPatch%bf2cs%xyzMoms')
1955  END IF ! global%error
1956  END DO ! ifl
1957  END IF ! pPatch%bcType
1958 
1959 ! ******************************************************************************
1960 ! Nullify memory
1961 ! ******************************************************************************
1962 
1963  CALL rflu_nullifywtsbf2c(pregion,ppatch)
1964 
1965 ! ******************************************************************************
1966 ! End
1967 ! ******************************************************************************
1968 
1969  IF ( global%myProcid == masterproc .AND. &
1970  global%verbLevel > verbose_none ) THEN
1971  WRITE(stdout,'(A,1X,A)') solver_name, &
1972  'Destroying boundary face-to-cell weights done.'
1973  END IF ! global%verbLevel
1974 
1975  CALL deregisterfunction(global)
1976 
1977  END SUBROUTINE rflu_destroywtsbf2c
1978 
1979 
1980 
1981 
1982 
1983 
1984 ! *******************************************************************************
1985 !
1986 ! Purpose: Wrapper routine for destroying boundary-face-to-cell weights.
1987 !
1988 ! Description: None.
1989 !
1990 ! Input:
1991 ! pRegion Pointer to region
1992 ! pPatch Pointer to patch
1993 !
1994 ! Output: None.
1995 !
1996 ! Notes: None.
1997 !
1998 ! ******************************************************************************
1999 
2000  SUBROUTINE rflu_destroywtsbf2cwrapper(pRegion,pPatch)
2001 
2002  IMPLICIT NONE
2003 
2004 ! ******************************************************************************
2005 ! Declarations and definitions
2006 ! ******************************************************************************
2007 
2008 ! ==============================================================================
2009 ! Arguments
2010 ! ==============================================================================
2011 
2012  TYPE(t_patch), POINTER :: ppatch
2013  TYPE(t_region), POINTER :: pregion
2014 
2015 ! ==============================================================================
2016 ! Locals
2017 ! ==============================================================================
2018 
2019  TYPE(t_global), POINTER :: global
2020  TYPE(t_mixt_input), POINTER :: pmixtinput
2021 
2022 ! ******************************************************************************
2023 ! Start
2024 ! ******************************************************************************
2025 
2026  global => pregion%global
2027 
2028  CALL registerfunction(global,'RFLU_DestroyWtsBF2CWrapper',&
2029  'RFLU_ModWeights.F90')
2030 
2031 ! ******************************************************************************
2032 ! Set pointers and variables
2033 ! ******************************************************************************
2034 
2035  pmixtinput => pregion%mixtInput
2036 
2037 ! ******************************************************************************
2038 ! Call routines to compute weights
2039 ! ******************************************************************************
2040 
2041  SELECT CASE ( pmixtinput%stencilDimensBFaces )
2042  CASE ( 1 )
2043  CASE ( 2,3 )
2044  CALL rflu_destroywtsbf2c(pregion,ppatch)
2045  CASE default
2046  CALL errorstop(global,err_reached_default,__line__)
2047  END SELECT ! pMixtInput%stencilDimensBFaces
2048 
2049 ! ******************************************************************************
2050 ! End
2051 ! ******************************************************************************
2052 
2053  CALL deregisterfunction(global)
2054 
2055  END SUBROUTINE rflu_destroywtsbf2cwrapper
2056 
2057 
2058 
2059 
2060 
2061 
2062 ! *******************************************************************************
2063 !
2064 ! Purpose: Destroy weights for cell-to-cell stencil.
2065 !
2066 ! Description: None.
2067 !
2068 ! Input:
2069 ! pRegion Pointer to region
2070 !
2071 ! Output: None.
2072 !
2073 ! Notes: None.
2074 !
2075 ! ******************************************************************************
2076 
2077  SUBROUTINE rflu_destroywtsc2c(pRegion)
2078 
2079  IMPLICIT NONE
2080 
2081 ! ******************************************************************************
2082 ! Declarations and definitions
2083 ! ******************************************************************************
2084 
2085 ! ==============================================================================
2086 ! Arguments
2087 ! ==============================================================================
2088 
2089  TYPE(t_region), POINTER :: pregion
2090 
2091 ! ==============================================================================
2092 ! Locals
2093 ! ==============================================================================
2094 
2095  INTEGER :: errorflag,icg
2096  TYPE(t_global), POINTER :: global
2097  TYPE(t_grid), POINTER :: pgrid
2098 
2099 ! ******************************************************************************
2100 ! Start
2101 ! ******************************************************************************
2102 
2103  global => pregion%global
2104 
2105  CALL registerfunction(global,'RFLU_DestroyWtsC2C',&
2106  'RFLU_ModWeights.F90')
2107 
2108  IF ( global%myProcid == masterproc .AND. &
2109  global%verbLevel > verbose_none ) THEN
2110  WRITE(stdout,'(A,1X,A)') solver_name, &
2111  'Destroying cell-to-cell weights...'
2112  END IF ! global%verbLevel
2113 
2114 ! ******************************************************************************
2115 ! Set grid pointer
2116 ! ******************************************************************************
2117 
2118  pgrid => pregion%grid
2119 
2120 ! ******************************************************************************
2121 ! Allocate memory
2122 ! ******************************************************************************
2123 
2124  DO icg = 1,pgrid%nCellsTot
2125  DEALLOCATE(pgrid%c2cs(icg)%xyzMoms,stat=errorflag)
2126  global%error = errorflag
2127  IF ( global%error /= err_none ) THEN
2128  CALL errorstop(global,err_deallocate,__line__,'pGrid%c2cs%xyzMoms')
2129  END IF ! global%error
2130  END DO ! icg
2131 
2132 ! ******************************************************************************
2133 ! Nullify memory
2134 ! ******************************************************************************
2135 
2136  CALL rflu_nullifywtsc2c(pregion)
2137 
2138 ! ******************************************************************************
2139 ! End
2140 ! ******************************************************************************
2141 
2142  IF ( global%myProcid == masterproc .AND. &
2143  global%verbLevel > verbose_none ) THEN
2144  WRITE(stdout,'(A,1X,A)') solver_name, &
2145  'Destroying cell-to-cell weights done.'
2146  END IF ! global%verbLevel
2147 
2148  CALL deregisterfunction(global)
2149 
2150  END SUBROUTINE rflu_destroywtsc2c
2151 
2152 
2153 
2154 
2155 
2156 
2157 
2158 
2159 
2160 ! *******************************************************************************
2161 !
2162 ! Purpose: Wrapper routine for destroying cell-to-cell weights.
2163 !
2164 ! Description: None.
2165 !
2166 ! Input:
2167 ! pRegion Pointer to region
2168 !
2169 ! Output: None.
2170 !
2171 ! Notes: None.
2172 !
2173 ! ******************************************************************************
2174 
2175  SUBROUTINE rflu_destroywtsc2cwrapper(pRegion)
2176 
2177  IMPLICIT NONE
2178 
2179 ! ******************************************************************************
2180 ! Declarations and definitions
2181 ! ******************************************************************************
2182 
2183 ! ==============================================================================
2184 ! Arguments
2185 ! ==============================================================================
2186 
2187  TYPE(t_region), POINTER :: pregion
2188 
2189 ! ==============================================================================
2190 ! Locals
2191 ! ==============================================================================
2192 
2193  TYPE(t_global), POINTER :: global
2194  TYPE(t_mixt_input), POINTER :: pmixtinput
2195 
2196 ! ******************************************************************************
2197 ! Start
2198 ! ******************************************************************************
2199 
2200  global => pregion%global
2201 
2202  CALL registerfunction(global,'RFLU_DestroyWtsC2CWrapper',&
2203  'RFLU_ModWeights.F90')
2204 
2205 ! ******************************************************************************
2206 ! Set pointers and variables
2207 ! ******************************************************************************
2208 
2209  pmixtinput => pregion%mixtInput
2210 
2211 ! ******************************************************************************
2212 ! Call routines to compute weights
2213 ! ******************************************************************************
2214 
2215  SELECT CASE ( pmixtinput%stencilDimensCells )
2216  CASE ( 1 )
2217  CASE ( 2,3 )
2218  CALL rflu_destroywtsc2c(pregion)
2219  CASE default
2220  CALL errorstop(global,err_reached_default,__line__)
2221  END SELECT ! pMixtInput%stencilDimensCells
2222 
2223 ! ******************************************************************************
2224 ! End
2225 ! ******************************************************************************
2226 
2227  CALL deregisterfunction(global)
2228 
2229  END SUBROUTINE rflu_destroywtsc2cwrapper
2230 
2231 
2232 
2233 
2234 
2235 
2236 
2237 
2238 ! *******************************************************************************
2239 !
2240 ! Purpose: Destroy weights for face-to-cell stencil.
2241 !
2242 ! Description: None.
2243 !
2244 ! Input:
2245 ! pRegion Pointer to region
2246 !
2247 ! Output: None.
2248 !
2249 ! Notes: None.
2250 !
2251 ! ******************************************************************************
2252 
2253  SUBROUTINE rflu_destroywtsf2c(pRegion)
2254 
2255  IMPLICIT NONE
2256 
2257 ! ******************************************************************************
2258 ! Declarations and definitions
2259 ! ******************************************************************************
2260 
2261 ! ==============================================================================
2262 ! Arguments
2263 ! ==============================================================================
2264 
2265  TYPE(t_region), POINTER :: pregion
2266 
2267 ! ==============================================================================
2268 ! Locals
2269 ! ==============================================================================
2270 
2271  INTEGER :: errorflag,ifg
2272  TYPE(t_global), POINTER :: global
2273  TYPE(t_grid), POINTER :: pgrid
2274 
2275 ! ******************************************************************************
2276 ! Start
2277 ! ******************************************************************************
2278 
2279  global => pregion%global
2280 
2281  CALL registerfunction(global,'RFLU_DestroyWtsF2C',&
2282  'RFLU_ModWeights.F90')
2283 
2284  IF ( global%myProcid == masterproc .AND. &
2285  global%verbLevel > verbose_none ) THEN
2286  WRITE(stdout,'(A,1X,A)') solver_name, &
2287  'Destroying face-to-cell weights...'
2288  END IF ! global%verbLevel
2289 
2290 ! ******************************************************************************
2291 ! Set grid pointer
2292 ! ******************************************************************************
2293 
2294  pgrid => pregion%grid
2295 
2296 ! ******************************************************************************
2297 ! Deallocate memory
2298 ! ******************************************************************************
2299 
2300  DO ifg = 1,pgrid%nFaces
2301  DEALLOCATE(pgrid%f2cs(ifg)%xyzMoms,stat=errorflag)
2302  global%error = errorflag
2303  IF ( global%error /= err_none ) THEN
2304  CALL errorstop(global,err_deallocate,__line__,'pGrid%f2cs%xyzMoms')
2305  END IF ! global%error
2306  END DO ! ifg
2307 
2308 ! ******************************************************************************
2309 ! Nullify memory
2310 ! ******************************************************************************
2311 
2312  CALL rflu_nullifywtsf2c(pregion)
2313 
2314 ! ******************************************************************************
2315 ! End
2316 ! ******************************************************************************
2317 
2318  IF ( global%myProcid == masterproc .AND. &
2319  global%verbLevel > verbose_none ) THEN
2320  WRITE(stdout,'(A,1X,A)') solver_name, &
2321  'Destroying face-to-cell weights done.'
2322  END IF ! global%verbLevel
2323 
2324  CALL deregisterfunction(global)
2325 
2326  END SUBROUTINE rflu_destroywtsf2c
2327 
2328 
2329 
2330 
2331 
2332 
2333 ! *******************************************************************************
2334 !
2335 ! Purpose: Wrapper routine for destroying face-to-cell weights.
2336 !
2337 ! Description: None.
2338 !
2339 ! Input:
2340 ! pRegion Pointer to region
2341 !
2342 ! Output: None.
2343 !
2344 ! Notes: None.
2345 !
2346 ! ******************************************************************************
2347 
2348  SUBROUTINE rflu_destroywtsf2cwrapper(pRegion)
2349 
2350  IMPLICIT NONE
2351 
2352 ! ******************************************************************************
2353 ! Declarations and definitions
2354 ! ******************************************************************************
2355 
2356 ! ==============================================================================
2357 ! Arguments
2358 ! ==============================================================================
2359 
2360  TYPE(t_region), POINTER :: pregion
2361 
2362 ! ==============================================================================
2363 ! Locals
2364 ! ==============================================================================
2365 
2366  TYPE(t_global), POINTER :: global
2367  TYPE(t_mixt_input), POINTER :: pmixtinput
2368 
2369 ! ******************************************************************************
2370 ! Start
2371 ! ******************************************************************************
2372 
2373  global => pregion%global
2374 
2375  CALL registerfunction(global,'RFLU_DestroyWtsF2CWrapper',&
2376  'RFLU_ModWeights.F90')
2377 
2378 ! ******************************************************************************
2379 ! Set pointers and variables
2380 ! ******************************************************************************
2381 
2382  pmixtinput => pregion%mixtInput
2383 
2384 ! ******************************************************************************
2385 ! Call routines to compute weights
2386 ! ******************************************************************************
2387 
2388  SELECT CASE ( pmixtinput%stencilDimensFaces )
2389  CASE ( 1 )
2390  CASE ( 2,3 )
2391  CALL rflu_destroywtsf2c(pregion)
2392  CASE default
2393  CALL errorstop(global,err_reached_default,__line__)
2394  END SELECT ! pMixtInput%stencilDimensFaces
2395 
2396 ! ******************************************************************************
2397 ! End
2398 ! ******************************************************************************
2399 
2400  CALL deregisterfunction(global)
2401 
2402  END SUBROUTINE rflu_destroywtsf2cwrapper
2403 
2404 
2405 
2406 
2407 
2408 
2409 ! *******************************************************************************
2410 !
2411 ! Purpose: Nullify weights for boundary face-to-cell stencil.
2412 !
2413 ! Description: None.
2414 !
2415 ! Input:
2416 ! pRegion Pointer to region
2417 ! pPatch Pointer to patch
2418 !
2419 ! Output: None.
2420 !
2421 ! Notes: None.
2422 !
2423 ! ******************************************************************************
2424 
2425  SUBROUTINE rflu_nullifywtsbf2c(pRegion,pPatch)
2426 
2427  IMPLICIT NONE
2428 
2429 ! ******************************************************************************
2430 ! Declarations and definitions
2431 ! ******************************************************************************
2432 
2433 ! ==============================================================================
2434 ! Arguments
2435 ! ==============================================================================
2436 
2437  TYPE(t_patch), POINTER :: ppatch
2438  TYPE(t_region), POINTER :: pregion
2439 
2440 ! ==============================================================================
2441 ! Locals
2442 ! ==============================================================================
2443 
2444  INTEGER :: ifl
2445  TYPE(t_global), POINTER :: global
2446  TYPE(t_grid), POINTER :: pgrid
2447 
2448 ! ******************************************************************************
2449 ! Start
2450 ! ******************************************************************************
2451 
2452  global => pregion%global
2453 
2454  CALL registerfunction(global,'RFLU_NullifyWtsBF2C',&
2455  'RFLU_ModWeights.F90')
2456 
2457 ! ******************************************************************************
2458 ! Set grid pointer
2459 ! ******************************************************************************
2460 
2461  pgrid => pregion%grid
2462 
2463 ! ******************************************************************************
2464 ! Nullify memory
2465 ! ******************************************************************************
2466 
2467  IF ( ppatch%bcType /= bc_virtual ) THEN
2468  DO ifl = 1,ppatch%nBFaces
2469  nullify(ppatch%bf2cs(ifl)%xyzMoms)
2470  END DO ! ifl
2471  END IF ! pPatch%bcType
2472 
2473 ! ******************************************************************************
2474 ! End
2475 ! ******************************************************************************
2476 
2477  CALL deregisterfunction(global)
2478 
2479  END SUBROUTINE rflu_nullifywtsbf2c
2480 
2481 
2482 
2483 
2484 
2485 
2486 ! *******************************************************************************
2487 !
2488 ! Purpose: Nullify weights for cell-to-cell stencil.
2489 !
2490 ! Description: None.
2491 !
2492 ! Input:
2493 ! pRegion Pointer to region
2494 !
2495 ! Output: None.
2496 !
2497 ! Notes: None.
2498 !
2499 ! ******************************************************************************
2500 
2501  SUBROUTINE rflu_nullifywtsc2c(pRegion)
2502 
2503  IMPLICIT NONE
2504 
2505 ! ******************************************************************************
2506 ! Declarations and definitions
2507 ! ******************************************************************************
2508 
2509 ! ==============================================================================
2510 ! Arguments
2511 ! ==============================================================================
2512 
2513  TYPE(t_region), POINTER :: pregion
2514 
2515 ! ==============================================================================
2516 ! Locals
2517 ! ==============================================================================
2518 
2519  INTEGER :: icg
2520  TYPE(t_grid), POINTER :: pgrid
2521  TYPE(t_global), POINTER :: global
2522 
2523 ! ******************************************************************************
2524 ! Start
2525 ! ******************************************************************************
2526 
2527  global => pregion%global
2528 
2529  CALL registerfunction(global,'RFLU_NullifyWtsC2C',&
2530  'RFLU_ModWeights.F90')
2531 
2532 ! ******************************************************************************
2533 ! Set grid pointer
2534 ! ******************************************************************************
2535 
2536  pgrid => pregion%grid
2537 
2538 ! ******************************************************************************
2539 ! Nullify memory
2540 ! ******************************************************************************
2541 
2542  DO icg = 1,pgrid%nCellsTot
2543  nullify(pgrid%c2cs(icg)%xyzMoms)
2544  END DO ! icg
2545 
2546 ! ******************************************************************************
2547 ! End
2548 ! ******************************************************************************
2549 
2550  CALL deregisterfunction(global)
2551 
2552  END SUBROUTINE rflu_nullifywtsc2c
2553 
2554 
2555 
2556 
2557 
2558 ! *******************************************************************************
2559 !
2560 ! Purpose: Nullify weights for face-to-cell stencil.
2561 !
2562 ! Description: None.
2563 !
2564 ! Input:
2565 ! pRegion Pointer to region
2566 !
2567 ! Output: None.
2568 !
2569 ! Notes: None.
2570 !
2571 ! ******************************************************************************
2572 
2573  SUBROUTINE rflu_nullifywtsf2c(pRegion)
2574 
2575  IMPLICIT NONE
2576 
2577 ! ******************************************************************************
2578 ! Declarations and definitions
2579 ! ******************************************************************************
2580 
2581 ! ==============================================================================
2582 ! Arguments
2583 ! ==============================================================================
2584 
2585  TYPE(t_region), POINTER :: pregion
2586 
2587 ! ==============================================================================
2588 ! Locals
2589 ! ==============================================================================
2590 
2591  INTEGER :: ifg
2592  TYPE(t_global), POINTER :: global
2593  TYPE(t_grid), POINTER :: pgrid
2594 
2595 ! ******************************************************************************
2596 ! Start
2597 ! ******************************************************************************
2598 
2599  global => pregion%global
2600 
2601  CALL registerfunction(global,'RFLU_NullifyWtsF2C',&
2602  'RFLU_ModWeights.F90')
2603 
2604 ! ******************************************************************************
2605 ! Set grid pointer
2606 ! ******************************************************************************
2607 
2608  pgrid => pregion%grid
2609 
2610 ! ******************************************************************************
2611 ! Nullify memory
2612 ! ******************************************************************************
2613 
2614  DO ifg = 1,pgrid%nFaces
2615  nullify(pgrid%f2cs(ifg)%xyzMoms)
2616  END DO ! ifg
2617 
2618 ! ******************************************************************************
2619 ! End
2620 ! ******************************************************************************
2621 
2622  CALL deregisterfunction(global)
2623 
2624  END SUBROUTINE rflu_nullifywtsf2c
2625 
2626 
2627 
2628 
2629 
2630 
2631 
2632 ! ******************************************************************************
2633 ! End
2634 ! ******************************************************************************
2635 
2636 END MODULE rflu_modweights
2637 
2638 
2639 ! ******************************************************************************
2640 !
2641 ! RCS Revision history:
2642 !
2643 ! $Log: RFLU_ModWeights.F90,v $
2644 ! Revision 1.16 2008/12/06 08:44:25 mtcampbe
2645 ! Updated license.
2646 !
2647 ! Revision 1.15 2008/11/19 22:17:36 mtcampbe
2648 ! Added Illinois Open Source License/Copyright
2649 !
2650 ! Revision 1.14 2007/02/27 13:08:27 haselbac
2651 ! Enabled 1d computations
2652 !
2653 ! Revision 1.13 2006/04/07 16:03:33 haselbac
2654 ! Changed computation of bf2c wts to be done patch-wise
2655 !
2656 ! Revision 1.12 2006/04/07 15:19:21 haselbac
2657 ! Removed tabs
2658 !
2659 ! Revision 1.11 2006/04/07 14:52:40 haselbac
2660 ! Adapted to changes in stencilDimens params, bug fixes in 1D routine
2661 !
2662 ! Revision 1.10 2006/03/09 20:50:56 haselbac
2663 ! Bug fix: Removed icg from INTEGER, INTENT(IN)
2664 !
2665 ! Revision 1.9 2006/03/09 14:09:22 haselbac
2666 ! Wrapperified module bcos of 1D routines
2667 !
2668 ! Revision 1.8 2006/01/06 22:14:45 haselbac
2669 ! Renamed routines bcos added 1D routines
2670 !
2671 ! Revision 1.7 2005/10/05 14:16:51 haselbac
2672 ! Added routines for bfaces, clean-up
2673 !
2674 ! Revision 1.6 2005/03/09 15:06:03 haselbac
2675 ! Added 2d option
2676 !
2677 ! Revision 1.5 2004/07/06 15:14:48 haselbac
2678 ! Cosmetics only
2679 !
2680 ! Revision 1.4 2004/03/18 03:32:39 haselbac
2681 ! Bug fix for i4 terms, joined init and computation
2682 !
2683 ! Revision 1.3 2004/01/22 16:03:59 haselbac
2684 ! Made contents of modules PRIVATE, only procs PUBLIC, to avoid errors on ALC and titan
2685 !
2686 ! Revision 1.2 2004/01/13 16:22:32 haselbac
2687 ! Changed to inverse-distance weighting
2688 !
2689 ! Revision 1.1 2003/12/04 03:28:43 haselbac
2690 ! Initial revision
2691 !
2692 ! ******************************************************************************
2693 
2694 
2695 
2696 
2697 
2698 
2699 
2700 
2701 
2702 
2703 
2704 
2705 
2706 
2707 
2708 
2709 
2710 
2711 
2712 
2713 
2714 
2715 
2716 
2717 
2718 
2719 
2720 
2721 
2722 
subroutine, public rflu_computewtsx2c_1d(global, m, nMembs, x, z, w)
subroutine, public rflu_createwtsf2cwrapper(pRegion, order)
subroutine rflu_createwtsc2c(pRegion, order)
FT m(int i, int j) const
subroutine rflu_computewtsc2c(pRegion, order)
subroutine, public rflu_createwtsc2cwrapper(pRegion, order)
subroutine rflu_nullifywtsbf2c(pRegion, pPatch)
j indices k indices k
Definition: Indexing.h:6
NT dx
subroutine rflu_computestencilmoments2d1(global, nMembs, dr, xyzMoms)
Vector_n max(const Array_n_const &v1, const Array_n_const &v2)
Definition: Vector_n.h:354
Size order() const
Degree of the element. 1 for linear and 2 for quadratic.
subroutine, public rflu_destroywtsbf2cwrapper(pRegion, pPatch)
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine rflu_destroywtsbf2c(pRegion, pPatch)
double sqrt(double d)
Definition: double.h:73
subroutine, public rflu_createwtsbf2cwrapper(pRegion, pPatch, order)
subroutine rflu_createwtsf2c(pRegion, orderInput)
RT c() const
Definition: Line_2.h:150
subroutine rflu_createwtsbf2c(pRegion, pPatch, orderInput)
subroutine, public rflu_computewtsbf2cwrapper(pRegion, pPatch, order)
subroutine rflu_nullifywtsc2c(pRegion)
void int int int REAL REAL REAL * z
Definition: write.cpp:76
subroutine rflu_destroywtsf2c(pRegion)
subroutine rflu_computewtsf2c(pRegion, orderInput)
blockLoc i
Definition: read.cpp:79
void int int REAL * x
Definition: read.cpp:74
subroutine rflu_computestencilmoments3d1(global, nMembs, dr, xyzMoms)
const NT & n
subroutine, public rflu_destroywtsf2cwrapper(pRegion)
subroutine, public rflu_computewtsc2cwrapper(pRegion, order)
RT dz() const
Definition: Direction_3.h:133
Vector_n min(const Array_n_const &v1, const Array_n_const &v2)
Definition: Vector_n.h:346
j indices j
Definition: Indexing.h:6
NT dy
subroutine rflu_nullifywtsf2c(pRegion)
subroutine, public rflu_destroywtsc2cwrapper(pRegion)
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine, public rflu_computewtsf2cwrapper(pRegion, order)
subroutine rflu_destroywtsc2c(pRegion)
subroutine deregisterfunction(global)
Definition: ModError.F90:469
subroutine rflu_computewtsbf2c(pRegion, pPatch, orderInput)