skip to main content
research-article

General Template Units for the Finite Volume Method in Box-Shaped Domains

Authors Info & Claims
Published:13 August 2016Publication History
Skip Abstract Section

Abstract

In this work, we develop an extension of the Curiously Recurring Template Pattern (CRTP), which allows us to organize three related concepts in a class hierarchy. Generalizations, specializations and special procedures are the concepts that we use to define and implement several tools. We call these tools general template units because they are well-defined building blocks (units) for numerically solving partial differential equations (PDEs), are based on the use of templates of the C++ language, and can be applied in the solution of different kinds of problems. We focus on the solution of PDEs using the Finite Volume Method (FVM) in box-shaped domains. The three concepts just mentioned are intensively used to generate optimized codes for each case study. The convenience of our approach is highlighted in the numerical solutions of the examples of application, including laminar thermal convection, turbulent thermal convection, as well as a two-phase flow model in porous media, all of them in one, two, and three dimensions. The mathematical models of these examples were obtained using the axiomatic formulation, which provides generality, simplicity, and clarity to tackle any continuum mechanics application. The ideas explained in this work are quite simple but powerful in solving fluid dynamics problems, in which the conservativeness of the FVM is an important feature. The techniques developed in this work allow us to swap easily between numerical schemes for computing the coefficients obtained by applying the FVM.

References

  1. A. Al-Huthali and A. Datta-Gupta. 2004. Streamline simulation of counter-current imbibition in naturally fractured reservoirs. Journal of Petroleum Science and Engineering 43, 271--300.Google ScholarGoogle ScholarCross RefCross Ref
  2. M. Allen, I. Herrera, and G. Pinder. 1998. Numerical Modelling in Science and Engineering. John Wiley & Sons, New York, NY.Google ScholarGoogle Scholar
  3. M. H. Austern. 1999. Generic Programming and the STL: Using and Extending the C++ Standard Template Library. Addison-Wesley, New York, NY. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. S. Balay, J. Brown, K. Buschelman, W. D. Gropp, D. Kaushik, M. G. Knepley, L. C. McInnes, B. F. Smith, and H. Zhang. 2011. PETSc Web page. Retrieved July 16, 2016 from http://www.mcs.anl.gov/petsc.Google ScholarGoogle Scholar
  5. W. Bangerth, R. Hartmann, and G. Kanschat. 2007. deal.II-- A general--purpose object--oriented finite element library. ACM Transactions on Mathematical Software 33, 4. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. J. J. Barton and L. R. Nackman. 1994. Scientifc and Engineering C++. Addison--Wesley, New York, NY.Google ScholarGoogle Scholar
  7. R. Bastiaans, C. Rindt, F. Nieuwstadt, and A. van Steenhoven. 2000. Direct and large--eddy simulation of the transitional of two-- and three--dimensional plane plumes in a confined enclosure. International Journal of Heat and Mass Transfer 43, 2375--2393.Google ScholarGoogle ScholarCross RefCross Ref
  8. E. Bertolazzi and G. Manzini. 2002. Algorithm: P2MESH: Generic object-oriented interface between 2-D unstructured meshes and FEM/FVM-based PDE solvers. ACM Transactions on Mathematical Software 28, 1, 101--131. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. D. L. Brown, W. D. Henshaw, and D. J. Quinlan. 1997. Overture: An object oriented framework for solving partial differential equations. In Lecture Notes in Computer Science. Vol. 1343. Springer, Berlin. Retrieved July 16, 2016 from https://computation.llnl.gov/casc/Overture/. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. S. Buckley and M. Leverett. 1942. Mechanism of fluid displacement in sands. Transactions of the AIME 146, 107--116.Google ScholarGoogle ScholarCross RefCross Ref
  11. P. Castillo, R. Rieben, and D. White. 2005. FEMSTER: An object-oriented class library of high-order discrete differential forms. ACM Transactions on Mathematical Software 31, 4, 425--457. http://www.swmath.org/software/275. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Z. Chen, G. Huan, and Y. Ma. 2006. Computational Methods for Multiphase Flows in Porous Media. SIAM, Philadelphia, PA. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. J. O. Coplien. 1995. Curiously recurring template patterns. C++ Report, 24--27. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. A. Corey. 1954. The interrelation between gas and oil relative permeabilities. Producers Monthly 19, 1, 3841.Google ScholarGoogle Scholar
  15. CUSP. Library of generic parallel algorithms for sparse matrix and graph computations. Retrieved July 16, 2016 from http://code.google.com/p/cusp-library/.Google ScholarGoogle Scholar
  16. E. David. 1993. Modélisation des écoulements compressibles et hypersoniques: une approche instantionnaire. Ph.D. dissertation. National Polytechnic Institute, Grenoble, France.Google ScholarGoogle Scholar
  17. L. de la Cruz. TUNAM: Template units for numerical applications and modeling. Retrieved July 16, 2016 from http://code.google.com/p/tunam/.Google ScholarGoogle Scholar
  18. L. M. de la Cruz. 2005. Parallel computing of balance equations in turbulent flow. Ph.D. dissertation. IIMAS, UNAM, Mexico. In Spanish. Retrieved July 16, 2016 from http://bc.unam.mx/index-alterno.html.Google ScholarGoogle Scholar
  19. Eigen. C++ template library for linear algebra: matrices, vectors, numerical solvers, and related algorithms. Retrieved July 16, 2016 from http://eigen.tuxfamily.org/.Google ScholarGoogle Scholar
  20. FLENS. Flexible library for efficient numerical solutions. Retrieved July 16, 2016 from http://flens.sourceforge.net/.Google ScholarGoogle Scholar
  21. M. Hatakeyama, M. Watanabe, and T. Suzuki. 1998. Object-oriented fluid flow simulation system. Computers & Fluids 27, 5--6, 581--597.Google ScholarGoogle ScholarCross RefCross Ref
  22. T. Hayase, J. A. C. Humphrey, and R. Greif. 1992. A consistently formulated QUICK scheme for fast and stable convergence using finite-volume iterative calculation procedures. Journal of Computational Physics 98, 1, 108--118. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. I. Herrera and G. S. Herrera. 2011. Unified formulation of enhanced oil-recovery methods. Geofisica Internacional 50, 1.Google ScholarGoogle Scholar
  24. I. Herrera and G. Pinder. 2012. Mathematical Modeling in Science and Engineering: An Axiomatic Approach. John Wiley & Sons, New York, NY.Google ScholarGoogle Scholar
  25. P. S. Kholsa and S. G. Rubin. 1974. A diagonal dominant second-order accurate implicit scheme. Computers and Fluids 2, 207--209.Google ScholarGoogle ScholarCross RefCross Ref
  26. B. S. Kirk, J. W. Peterson, R. H. Stogner, and G. F. Carey. 2006. libMesh: A C++ Library for Parallel Adaptive Mesh Refinement/Coarsening Simulations. Engineering with Computers 22, 3--4, 237--254. http://dx.doi.org/10.1007/s00366-006-0049-3. Google ScholarGoogle ScholarCross RefCross Ref
  27. D. B. Kirk and W. W. Hwu. 2010. Programming Massively Parallel Processors: A Hands-on Approach. Morgan Kaufmann, Burlington, MA. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. D. Kuzmin, R. Löhner, and S. Turek. 2012. Flux--Corrected Transport: Principles, Algorithms and Applications. 2nd ed. Scientific Computation. Springer, New York, NY.Google ScholarGoogle Scholar
  29. S. Lamine and M. G. Edwards. 2010. Higher order multidimensional upwind convection schemes for flow in porous media on structured and unstructured quadrilateral grids. SIAM Journal on Scientific Computing 32, 3, 1119--1139.Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. H. P. Langtangen and O. Munthe. 2001. Solving systems of partial differential equations using object-oriented programming techniques with coupled heat and fluid flow as example. ACM Transactions on Mathematical Software 27, 1, 1--26. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. B. P. Leonard. 1979. A stable and accurate convective modelling procedure based on quadratic upstream interpolation. Comp. Meth. in App. Mech. and Engineering 19, 59--98. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. M. Lesieur and O. Métais. 1996. New trends in large-eddy simulations of turbulence. Annual Review of Fluid Mechanics 28, 45--82.Google ScholarGoogle ScholarCross RefCross Ref
  33. R. J. Leveque. 2002. Finite Volume Methods for Hyperbolic Problems. Cambridge University Press, New York, NY.Google ScholarGoogle Scholar
  34. A. Lipchin and R. A. Brown. 1999. Comparison of three turbulence models for simulation of melt convection in Czochralski crystal growth of silicon. Journal of Crystal Growth 205, 1--2, 71--91.Google ScholarGoogle ScholarCross RefCross Ref
  35. J.-L. Liu, I.-J. Lin, M.-Z. Shih, R.-C. Chen, and M.-C. Hsieh. 1996. Object-oriented programming of adaptive finite element and finite volume methods. Applied Numerical Mathematics 21, 4, 439--467. Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. A. Logg and G. N. Wells. 2010. DOLFIN: Automated finite element computing. ACM Transactions on Mathematical Software 37, 2. http://fenicsproject.org/. Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. MTL4. Matrix template library 4. Retrieved July 16, 2016 from http://www.simunova.com/de/mtl4.Google ScholarGoogle Scholar
  38. N. Myers. 1995. Traits: A new and useful template technique. C++ Report.Google ScholarGoogle Scholar
  39. J. Nie, D. Hopkins, Y. Chen, and H. Hsieh. 2010. Development of an object-oriented finite element program with adaptive mesh refinement for multi-physics applications. Advances in Engineering Software 41, 4, 569--579. Google ScholarGoogle ScholarDigital LibraryDigital Library
  40. NIST. FiPy: A finite volume PDE solver using Python. Retrieved July 16, 2016 from http://www.ctcms.nist.gov/fipy/.Google ScholarGoogle Scholar
  41. S. Norris. 2000. A parallel Navier--Stokes solver for natural convection and free surface flow. Ph.D. dissertation. Department of Mechanical Engineering, University of Sydney, Sydney, Australia.Google ScholarGoogle Scholar
  42. S. V. Patankar. 1980. Numerical Heat Transfer and Fluid Flow. McGraw--Hill, New York, NY.Google ScholarGoogle Scholar
  43. L. Pesch, A. Bell, H. Sollie, V. R. Ambati, O. Bokhove, and J. J. V. D. Vegt. 2007. hpGEM -- A software framework for discontinuous Galerkin finite element methods. ACM Transactions on Mathematical Software 33, 4. http://www.hpgem.org. Google ScholarGoogle ScholarDigital LibraryDigital Library
  44. Seldon. C++ library for linear algebra. Retrieved July 16, 2016 from http://seldon.sourceforge.net/.Google ScholarGoogle Scholar
  45. Y. Tian and T. Karayiannis. 2000a. Low turbulence natural convection in an air filled square cavity, Part I: The thermal and fluid flow fields. International Journal of Heat and Mass Transfer 43, 849--866.Google ScholarGoogle ScholarCross RefCross Ref
  46. Y. Tian and T. Karayiannis. 2000b. Low turbulence natural convection in an air filled square cavity, Part II: The thermal and fluid flow fields. International Journal of Heat and Mass Transfer 43, 867--884.Google ScholarGoogle ScholarCross RefCross Ref
  47. uBlas. Basic linear algebra library. Retrieved July 16, 2016 from http://www.boost.org/.Google ScholarGoogle Scholar
  48. J. P. Van Doormaal and G. D Raithby. 1984. Enhancements of the simple method for predicting incompressible fluid flows. Numerical Heat Transfer 7, 147--163.Google ScholarGoogle ScholarCross RefCross Ref
  49. D. Vandevoorde and N. M. Josuttis. 2003. C++ Templates. Addison-Wesley, New York, NY. Google ScholarGoogle ScholarDigital LibraryDigital Library
  50. T. Veldhuizen. Blitz++: Object-oriented library for scientific computing. Retrieved July 16, 2016 from http://sourceforge.net/projects/blitz/.Google ScholarGoogle Scholar
  51. T. L. Veldhuizen. 1995a. Expression templates. C++ Report 7, 5, 26--31. Reprinted in C++ Gems, ed. Stanley Lippman.Google ScholarGoogle Scholar
  52. T. L. Veldhuizen. 1995b. Using C++ template metaprograms. C++ Report 7, 4, 36--43. Reprinted in C++ Gems, ed. Stanley Lippman.Google ScholarGoogle Scholar
  53. T. L. Veldhuizen. 1998. Arrays in Blitz++. In Lecture Notes in Computer Science. Vol. 1505. Springer, Berlin. Google ScholarGoogle ScholarDigital LibraryDigital Library
  54. H. K. Versteeg and W. Malalasekera. 1995. An introduction to computation of fluid dynamics. The finite volume method. Longman Scientific and Technical, Harlow, UK.Google ScholarGoogle Scholar
  55. H. Weller, G. Tabor, H. Jasak, and C. Fureby. 1998. A tensorial approach to CFD using object orientated techniques. Computers in Physics 12, 6, 620--631. Google ScholarGoogle ScholarDigital LibraryDigital Library
  56. J. Xaman, G. Alvarez, L. Lira, and C. Estrada. 2005. Numerical study of heat transfer by laminar and turbulent natural convection in tall cavities of facade elements. Energy and Buildings 37, 7, 787--794.Google ScholarGoogle ScholarCross RefCross Ref

Index Terms

  1. General Template Units for the Finite Volume Method in Box-Shaped Domains

      Recommendations

      Comments

      Login options

      Check if you have access through your login credentials or your institution to get full access on this article.

      Sign in

      Full Access

      • Published in

        cover image ACM Transactions on Mathematical Software
        ACM Transactions on Mathematical Software  Volume 43, Issue 1
        March 2017
        202 pages
        ISSN:0098-3500
        EISSN:1557-7295
        DOI:10.1145/2987591
        Issue’s Table of Contents

        Copyright © 2016 ACM

        Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected].

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        • Published: 13 August 2016
        • Accepted: 1 October 2015
        • Revised: 1 November 2014
        • Received: 1 October 2011
        Published in toms Volume 43, Issue 1

        Permissions

        Request permissions about this article.

        Request Permissions

        Check for updates

        Qualifiers

        • research-article
        • Research
        • Refereed

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader