Moukalled F., Mangani L., Darwish M. The finite volume method in computational fluid dynamics. An advanced introduction with OpenFOAM and Matlab (811443), страница 25
Текст из файла (страница 25)
5.19 The matrix“lduMatrix” and the vector“source” in which thecoefficients and sources arestored131.........=..The matrix of coefficients "lduMatrix"......Thevector of Vector"source"unknownsrepresent the discretized set of algebraic equations defined over each element of thecomputational domain.The namespaces fvm:: and fvc:: allow for the evaluation of a variety of operatorsimplicitly and explicitly, respectively.The explicit operator fvc, named “finite volume calculus”, returns an equivalentfield based on the actual field values. For example the operator fvc::divð/Þ returnsan equivalent geometricField in which each cell contains the value of the divergence of the variable ð/Þ.The fvm implicit operator, instead, defines the implicit finite volume discretization in terms of matrices of coefficients. For example fvm::laplacian(/) returns anfvMatrix in which all the coefficients are based on the finite volume discretization ofthe laplacian.The role of the fvm:: and fvc:: operators is to construct the LHS and RHS of asystem of equations representing the discretized form of Eq.
(5.43) over eachelement in the mesh. The discretization process yields a system of equations thatcan be represented in the matrix form shown in Fig. 5.19.Each row of the system represents the discretized equation in one element, withthe off-diagonal coefficients representing the mutual influence of the neighboringelements.In OpenFOAM® the matrix of coefficients is stored in a class named lduMatrixand the specialized fvMatrix. The chosen storage format of the coefficients is basedon the ldu sparse format, in which all coefficients are stored in three main arrays:diagonal, upper, and lower. The diagonal coefficients are thus stored in one arrayaccessed by diag() function with its dimension being equal to the number of elements in the computational domain. The upper and lower coefficients are storedeach in an array as shown in Fig.
5.20. The source or the right hand side is storedunder a specific vector called source with its dimension being also equal to thenumber of cells over the computational domain.1325 The Finite Volume Method=lduMatrixdiag() lower()upper()Fig. 5.20 The ldu sparse matrix storage (lduMatrix)It is worth noting that despite defining the fvMatrix class as a “template” the vectorspecialization of the class does not imply a block coupled form of the matrix itself butjust a vector of scalar equations that are solved in a standard segregated approach.This is confirmed by the code defined inside the fvMatrix class shown in Listing 5.2with its member function, which returns the diagonal vector coefficients of thematrix, only returning as object a scalar field independently of the template type.Listing 5.2 Excerpt of the code defined inside the fvMatrix class returning as object a scalar field5.10Computational Pointers133More details on the coefficients’ storage techniques used in uFVM andOpenFOAM® will be presented in Chap.
7.5.11 ClosureIn this chapter a general overview of the FVM was presented. The discretizationprocess was shown to involve two distinct steps, with step 1 resulting in a set ofsemi-discretized equations. The chapter also discussed some guiding principles forthe discretization process, which guarantee that the resulting discretized equationwill possess some desirable attributes. Before embarking onto a detailed descriptionof the numerical techniques that will be used in step 2 of the discretization process,the focus of the next chapter will be on the discretization of the computationaldomain and some related issues.5.12 ExercisesExercise 1A critical tool used with OpenFOAM® is Doxygen [18].
It is an open sourcesoftware that generates automatic documentation from annotated C++ sources.Doxygen uses the UML (http://www.uml-diagrams.org/class-reference.html) graphformalism and is capable of visually displaying the relations between the variousclasses, inheritance diagrams, and collaboration diagrams, which are all generatedautomatically as easily browsed HTML documents. Two options are available toaccess Doxygen. The first is to generate the documents by direct compilation on thelocal machine (the main files are placed in $WM_PROJECT_DIR/doc/Doxygen).The second option is to access Doxygen on the web at the address http://www.openfoam.org/docs/cpp/.
This latest option yields always up to date documentation.To start, either open the browser at the address http://www.openfoam.org/docs/cpp/or open the file $WM_PROJECT_DIR/doc/Doxygen/html/index.html. Onceopened, click on the Classes button that appears in the menu in the upper part of thescreen. Then click on the Class Index button.
Once clicked, a list ordered alphabetically of all classes defined in OpenFOAM® is displayed. The inheritance diagram of any class along its public member functions and derived classes areobtained by simply clicking on the class name appearing in the list. Doxygen isused to quickly browse all source files as well as checking all the properties of theclasses and namespaces. Basically the most common information to look for areclass inheritances and public member functions as well as public class constructors.1345 The Finite Volume Method(a) Using the Doxygen documentation find the class definition of the followingtype of data:Foam::faceFoam::cellFoam::fvMeshFoam::fvMatrix(b)(c)(d)(e)Find the parent classes for each of the classes of (a).Find the public constructors for each of the classes defined in (a).Find all the public member functions defined in each of the classes of (a).Find all the public member functions defined in the parent class of each of theclasses of (a).Exercise 2Run testDiffusion (which is available as a test case with uFVM) for one iteration,then(a) Use ‘cfdGetCoefficients’ to get the global matrix data structure and compare itto that shown in Fig.
5.18.(b) Use cfdGetMesh to get a reference to the Mesh object and find the definitionof a face, a cell and a vertex.References1. Blazek J (2005) Computational fluid dynamics: principles and applications. Elsevier,Amsterdam2. Ferziger JH, Peric M (2002) Computational methods for fluid dynamics, 3rd edn. Springer,Berlin3. Versteeg HK, Malalasekera W (2007) An introduction to computational fluid dynamics: thefinite volume method.
Prentice Hall, New Jersey4. Courant R, Friedrichs KO, Lewy H (1928) Über die partiellen Differenzengleichungen derMathematischen Physik. Math Ann 100:32–74 (English translation, with commentaries byLax, P.B., Widlund, O.B., Parter, S.V., in IBM J. Res. Develop.
11 (1967))5. Crank J, Nicolson P (1947) A practical method for numerical integration of solution of partialdifferential equations of heat-conduction type. Proc Cambridge Philos Soc 43:50–676. Clough RW (1960) The finite element method in plane stress analysis. Proceedings of secondASCE conference on electronic computation, Pittsburg, Pennsylvania, 8:345–3787.
Launder BE, Spalding DB (1972) Mathematical models of turbulence. Academic Press,Massachusetts8. Patankar SV (1967) Heat and mass transfer in turbulent boundary layers, Ph.D. Thesis,Imperial College, London University, UK9. Gosman AD, Pun WM, Runchal AK, Spalding DB, Wolfshtein M (1969) Heat and masstransfer in recirculating flows. Academic Press, London10. Runchal AK (1969) Transport processes in steady two-dimensional separated flows. Ph.D.Thesis, Imperial College of Science and Technology, London, UKReferences13511. Runchal AK, Wolfshtein M (1969) Numerical integration procedure for the steady-stateNavier-Stokes equations. Mech Eng Sci II 5:445–45312. Rhie CM, Chow WL (1983) A numerical study of the turbulent flow past an isolated airfoilwith trailing edge separation.
AIAA J 21:1525–153213. Lilek Z, Peric M (1995) A fourth-order finite volume method with collocated variablearrangement. Comput Fluids 24(3):239–25214. Leonard BP (1988) Universal limiter for transient interpolation modeling of the advectivetransport equations: the ultimate conservative difference scheme. NASA TechnicalMemorandum 100916, ICOMP-88-1115. Baliga BR, Patankar SVA (1983) Control volume finite-element method for two-dimensionalfluid flow and heat transfer. Numer Heat Transf 6:245–26116. Vaughan RV (2009) Basic control volume finite element methods for fluids and solids.
IIScresearch monographs series, IISc Press17. OpenFOAM (2015) Version 2.3.x. http://www.openfoam.org18. OpenFOAM Doxygen (2015) Version 2.3.x. http://www.openfoam.org/docs/cpp/Chapter 6The Finite Volume MeshAbstract A key ingredient in the implementation of the finite volume method issetting up the geometrical support framework for the problem at hand. This processstarts with mesh generation, which replaces the continuous domain by a discreteone formed of a contiguous set of non overlapping elements or cells delimited by aset of faces, and the defining of the physical boundaries through the marking of theboundary faces.