WHITEPAPER: How to Choose an Effective Grid System for CFD Meshing Abstract Concurrent CFD is a new kind of CFD tool that enables mechanical engineers to simulate the flow of fluid and heat transfer for today’s products using 3D CAD models. One of the most critical steps in this process is meshing and establishing an effective grid system for 3D simulation and analysis. This paper discusses why automated adaptive meshing is advantageous and how new designs can be meshed most effectively to dramatically reduce the time needed for accurate analysis and to increase design productivity. Contents 1 Needs and Choices ....................................................................................... 3 1.1 Why a Grid System in the First Place? ................................................... 3 1.2 What are the Choices of Grid System? .................................................. 4 2 Factors and Considerations Affecting the Choice of Grid System ................. 6 2.1 Cell Shape and Its Effect on “Grid Quality” ............................................. 6 2.2 Representation of Non-Rectangular Geometries .................................... 8 2.2.1 Patankar and co-workers (Ref 2) ..................................................... 9 2.2.2 Spalding and co-workers (Ref 3) ................................................... 10 2.2.3 Work at NASA Ames (Refs 4 and 5).............................................. 11 2.2.4 Work at University of Cambridge (Ref 6) ....................................... 12 2.3 Choice of Grid Arrangement - Structured or Unstructured? .................. 13 2.4 Grid Generation .................................................................................... 16 3 FloEFD’s Rectangular Adaptive Mesh Technology...................................... 19 3.1 Initial Mesh ........................................................................................... 19 3.2 Solution Adaptive Mesh ........................................................................ 21 4 REFERENCES ............................................................................................ 23 Appendix I: Diffusion Flux And Pressure Gradient In A Non-Orthogonal Grid .... 24 2 1 Needs and Choices 1.1 Why a Grid System in the First Place? To begin with it is useful to consider the need for a grid system in any CFD analysis: All CFD analyses start from the differential equations governing fluid-dynamic phenomena - the Navier-Stokes equations, and the associated conservation equations for heat, etc. As is well known, these equations are insoluble - at least by any analytical means (except in cases which involve so many simplifications that they are of virtually no practical interest). Therefore the only way to solve them is by “discretisation”1: Subdividing the region considered into many small volumes or “cells” - by overlaying a conceptual grid system over the entire region of interest. Making certain assumptions about the variation of the considered properties (velocities, pressure, temperature, etc) within and between the volumes. Thereby deriving approximations to the governing differential equations ( the so-called “finite-volume equations”) which are valid within the volumes so long as each volume is small enough - and are therefore valid in combination for the whole region of interest. Then solving the resulting algebraic equations iteratively. It is therefore clear that: The grid is a means to an end - to the obtaining of a reasonably accurate solution of the governing differential equations. The chosen grid spacing or grid fineness will critically influence the accuracy of the solution. The choice of type of grid system - that is, the shape and arrangement of the cells - is, in a sense, arbitrary. So long as it can easily be defined and yields an accurate solution reliably and efficiently, any grid is as good as any other. However, this “so long as …” is an important proviso. Experience shows that, for any practical application, the choice of grid system for a CFD calculation can radically affect: User time in defining the problem, and in making subsequent modifications Ease of achieving good, accurate results. Robustness and reliability of solution. 1 There are many excellent descriptions of this process in the literature, including Ref 1. 3 Computer speed and storage. This is why the choice of grid systems for CFD calculations is such an important one. 1.2 What are the Choices of Grid System? There are two distinct aspects to the choice of grid system for CFD analyses: (i) The shape of the grid cells, the main options being: Cartesian - rectangular cuboid cells with the faces aligned with a Cartesian x,y,z coordinate system. Hexahedra - six-faced volumes which are distorted in some way from Cartesian - these are sometimes referred to as “topologically Cartesian” (i.e. like Cartesian but distorted), or “body-fitted” (i.e. derived - conceptually at least - by distorting a Cartesian mesh around the surface of a body). Tetrahedra - four faced volumes - in effect “triangular pyramids” (ii) The arrangement of the grid cells, the main options being: Structured - in which the grid cells are arranged in continuous lines through the entire solution domain. Unstructured - a completely arbitrary arrangement. Partially unstructured - there are various intermediate, possibilities, usually involving regions of structured grid combined with one another in some way. Not all combinations of cell shape and grid arrangement are of practical interest. The most widely used are: Cartesian - both structured and partially unstructured - widely used for a wide range of CFD applications. Hexahedra - structured and partially unstructured (often referred to as “bodyfitted”) - most commonly used for “aerodynamic” applications (gas turbine blades, aerofoils, streamlined bodies, etc) as a means to fit the grid to a smoothly varying surface. Fully unstructured hexahedra and/or tetrahedra - initially used in finite element (rather than finite volume) CFD analyses, and now widely adopted for the finite volume approach, often with prisms and square based pyramids used to extrude and connect the surface mesh to the volume mesh. These options are illustrated overleaf. 4 a) Cartesian Structured b) Cartesian Partially Unstructured (with Embedded Fine Grid Region) c) Hexahedral Body Fitted d) Fully Unstructured Hexahedra e) Fully Unstructured Tetrahedra Figure 1: Illustration of the Main Types of Grid System for CFD 5 A further comment is needed concerning the reference to Cartesian grids in the above discussion. Strictly, many of the comments to be made about Cartesian grids would apply equally to any “orthogonal” system - that is, one based on grid lines aligned with coordinate directions which are everywhere at right angles to each other. A Cartesian grid is the most common such system in practical use, and is the one of relevance here. Orthogonal grids based on cylindrical coordinates are also common, and others are in use, but are not generally applicable. However, as will become apparent in the later discussion, it is the “orthogonal” nature of the Cartesian system which leads to many of its advantages over alternative (“non-orthogonal”) systems. The remainder of this document considers these alternative approaches, in the context particularly of the needs for CAD embedded CFD. It focuses mainly on the first and the third in the earlier list - Cartesian, and fully unstructured (hexahedra, tetrahedra and prisms). The second (structured hexahedra - body fitted) is an intermediate approach, mainly suited to aerodynamic applications. 2 Factors and Considerations Affecting the Choice of Grid System 2.1 Cell Shape and Its Effect on “Grid Quality” A Cartesian cell shape is, in many respects, the “natural” choice. Why? The governing equations are naturally derived and formulated in Cartesian coordinates2. The velocity components solved for are almost always those aligned in the Cartesian coordinate directions. This is the case whatever cell shape is used - or if it is not the case, then the need to use a more general, and more complex non-orthogonal coordinate system itself leads to difficulties of a similar kind to those described below. The consequence is that a Cartesian grid leads to a “better quality grid” as compared with any non-orthogonal shape - the greater the departure from Cartesian (that is, the greater the degree of non-orthogonality), the greater the degradation in “quality”. The concept of “grid quality” is central to any consideration of alternative grid systems for CFD. The cell shape (and particularly its departure from 2 Or in some other convenient orthogonal coordinate system 6 orthogonality) has severe implications on the assumptions made in the derivation of the finite-volume equations from the differential equations, and on the resulting solution method. The central issue is explained in Appendix I. This considers the derivation of two typical terms in the finite-volume equations - those representing diffusion flux (i.e. heat conduction) across one cell face, and the pressure gradient which acts as a source of velocity in one direction. The derivation of these terms is considered for a highly non-orthogonal grid. The important point to note is that, instead of resulting in a simple, single term (as for a Cartesian system) the non-orthogonality leads to additional “secondary” terms. In the two-dimensional case considered in the Appendix only two terms arise for each of the processes considered (as compared with the single term arising for a Cartesian system). However, in a fully three-dimensional system, the derivation for a non-orthogonal grid leads to many times as many terms as for a Cartesian system. These additional secondary terms have a number of consequences: Additional computer time - computation of the additional terms will clearly have implications for computer time. As there may be several times as many terms needed to represent a fully non-orthogonal system as a Cartesian one, and as this calculation is repeated at every iteration of the solution, these implications can be severe. Additional computer storage - there can be major implications here. It is usual to store (rather than continually re-calculate) the main geometric parameters associated with each non-orthogonal grid cell. This is one reason (the other is the need to store “connectivities” as explained later) why an unstructured hexahedral or tetrahedral grid method can require substantially more computer storage than a Cartesian grid method - and this can, in practice, become a limitation on the use of such methods for large, complex, calculations. Reduced accuracy and reduced robustness of the iterative solution - the evaluation and inclusion of these additional secondary terms introduce additional “cross-linkages” into the system. That is to say, instead of values of temperature at only two locations being used in the evaluation of a heat flux (as in the primary term), values at many more, remote, locations will be involved (in the secondary terms). There are two consequences: Additional inaccuracies are introduced - which means that, all else being equal, a highly non-orthogonal grid will have lower accuracy than an 7 orthogonal one of comparable spacing - or, to put it another way, to achieve the same local numerical accuracy, a non-orthogonal grid will need to be finer than an orthogonal one. The second effect is on the stability of the convergence of the system of finite-volume equations. Because of the less-direct (less implicit) manner in which the secondary terms need to be handled in the iteration, as they become more dominant, the iterative solution becomes progressively less stable - leading to, at best, unreliable convergence or, at worst, divergence. Of course the deficiencies in a non-orthogonal grid become more severe as the grid becomes more distorted (i.e. less Cartesian) - and the consequences will depend very much on the particular application in question. However, the effects are clear and are well understood. This is why: CFD practitioners have sought, as far as possible, always to use Cartesian grid systems, or other orthogonal systems. Users of non-orthogonal systems are forced to go to great lengths to prevent poor-quality grids, to the extent that (as explained later) grid generation usually involving some manual “adjustment” of any automatically-generated grid - becomes the most time consuming part of the entire process of CFD analysis. 2.2 Representation of Non-Rectangular Geometries Why then, if the advantages of Cartesian grids are so clear, have CFD practitioners made any use at all of non-orthogonal systems? Clearly there is only one motivation - the apparent need to use such more complex systems to represent physical shapes - particularly solid boundaries which are non-rectangular. For these, non-orthogonal systems offer the (apparent) advantage that the grid can be matched to (that is, fitted around) the physical shape of (say) an airfoil, so that grid surfaces are forced to coincide with the physical boundaries. There is, however, an alternative approach, of which there has been increasing, successful experience in the last decade. In this a Cartesian grid is used, and the non-rectangular solid shapes are allowed to cut through the grid in an 8 arbitrary way. The presence of the solid in the grid cells cut by the solid is represented using appropriate “cut-cell” techniques. The advantages of the approach are many: Good grid quality is ensured, with the benefits explained earlier The needs for any kind of “automatic” grid generation (with subsequent manual adjustment) is avoided; and For conjugate heat transfer problems, involving conductive heat transfer in solid regions coupled to flow and heat transfer in the fluid (such as occur commonly in electronics thermal applications), the grid system naturally covers the fluid and solid regions, as needed for the complete, coupled solution. There is now much experience of this approach, some for geometric shapes of surprising complexity. Four examples are cited below. 2.2.1 Patankar and co-workers (Ref 2) Figure 2 below shows work by Professor Patankar and co-workers. Figure 2: Flow Over a Cylinder in Crossflow (Re = 26) Computed Using Cartesian Grid and Body-Fitted Grid (Professor Patankar and Co-Workers, Ref 2) 9 The figure demonstrates the quality of results obtained using a Cartesian grid with a cut-cell representation of the fluid/solid cells, for a case which is conceptually simple, but complex from the fluid-dynamics standpoint. Results for flow around a cylinder in cross flow (at Re = 26) are compared with experimental flow visualisation, and with results for a non-orthogonal body-fitted grid with a comparable grid density. Both sets of computational results show excellent correlation with the flow visualisation, both for the predicted position of the separation point, and for the predicted length and shape of the separated region. Other similar “simple” test cases lead to essentially the same conclusion - that the Cartesian cut-cell approach yields results just as good as alternative, more-complex nonorthogonal, body-fitted systems. 2.2.2 Spalding and co-workers (Ref 3) Figure 3 shows work by Professor Spalding and co-workers (Ref 3). Figure 3: Flow Around a Car Body Shape Computed Using a Cartesian Grid With Embedded Sub Grids (Spalding and Co-Workers, Ref 3) 10 The case shown is turbulent flow around an automobile shape located in a wind tunnel. In this case a Cartesian grid with embedded fine-grid regions is used, giving a partially-unstructured grid (as discussed later). The important conclusion is that the Cartesian grid gives results for pressure variation over the surface of the vehicle which are in reasonable agreement with measurements. Though results from alternative systems are not shown here, the conclusion is that the Cartesian-grid results are of comparable quality with results from body-fitted and other more-complex grid systems. 2.2.3 Work at NASA Ames (Refs 4 and 5) Figure 4 refers to work at NASA Ames, primarily on the external aerodynamics of aircraft and other airborne vehicles. Figure 4: Cartesian Octree-Structured Grid for Computing Flow Around a Military Helicopter (Aftosmis et al, Ref 4) The illustration shows the application of a partially-unstructured Cartesian grid (“octree-structured”) to the aerodynamics of a military helicopter (Ref 4). Such 11 grid systems are also being used at NASA Ames for computing flows around airfoils and wing sections, complete aircraft fuselages, and multiple aircraft. Other work at NASA Ames utilises Cartesian grids with embedded fine grid regions (referred to as “overset structured grids”) in computing flows around and behind flying bodies (Ref 5). The authors have adopted these Cartesian-based techniques because of the (relative) simplicity of grid generation and the superior numerical performance as compared with alternative, non-orthogonal grid systems. 2.2.4 Work at University of Cambridge (Ref 6) Professor Dawes paper reviews the development of CFD specifically for turbomachinery simulations with a particular focus on application to problems with complex geometry. Turbomachinery flows represent an extreme challenge to modelling and simulation. Early turbomachinery CFD pioneered the use of structured hexahedral meshes, e.g. for blade-blade flow analysis. This locked the development trajectory of turbomachinery CFD into the “body-fitted” paradigm that now underpins all the main general-purpose CFD software systems. Professor Dawes argues that this is now holding back the use of CFD and is effectively preventing its use in design due to time required to create the mesh. A paradigm shift in mesh generation is needed, in which the geometry is treated implicitly, rather than explicitly, where the volume mesh is fitted to the surface. Having made the case for an implicit geometry treatment, Professor Dawes describes recent advances in computer graphics, where the development of interactive volume sculpting and ‘physics-based animation’ have been driven by the demands of the film industry. Level set techniques are used to accurately represent multiply curved surfaces using a 3D distance field, storing the signed distance to the nearest surface on an octree-structured Cartesian mesh. This mesh is then used directly for the flow solver as shown below for external flow around a turbine blade: 12 Figure 5: Tesselated geometry of a generic film-cooled turbine blade and octree mesh used for flow solution around blade (Dawes, Ref 6) Professor Dawes uses the example of changing one of the holes in the blade to show how easy it is to change the geometry, as only mesh local to the hole needs to be changed. Generally, the conclusions from these and other studies are that: Using appropriate cut-cell techniques, Cartesian grids can yield results for extremely complex non-rectangular geometries which are of comparable quality to the best obtained from more complex non-Cartesian systems; and The use of Cartesian grids for such problems simplifies problem definition, and ensures robust efficient solution - thereby ensuring user productivity and optimum use of computer resources. 2.3 Choice of Grid Arrangement - Structured or Unstructured? The second major choice in selecting a CFD grid system is the arrangement of the grid cells - that is, are they in a tightly structured arrangement (in continuous 13 regular lines) such as that illustrated earlier in Fig 1a), or are they arranged in a less structured or completely unstructured manner, as illustrated in Fig 1d) or 1e)? Essentially the choice is really all about computer efficiency. An unstructured grid (as shown in Fig 6 b)) can enable the user to concentrate fine grid only in regions where it is required - a fully structured grid, with the same level of fineness in the region of interest (as shown in Fig 6 a)), can involve apparently “wasted” grid in the far field. The results from the two approaches would, all else being equal, be identical - the only difference will be in the computer resources required. 1 a) Structured Cartesian b) Unstructured Tetrahedral c) Cartesian with Embedded Subgrid Figure 6: Structured and Unstructured Grids 14 However, the adverse effect of the “wasted” grid is not as obvious as it at first appears: Solution on a fully unstructured grid such as that illustrated in Fig 6 b) requires additional storage (of the “connectivities” which tell the solution which cells are adjacent to which) and additional computation (to use the connectivities to “unravel” the arbitrarily arranged data associated with the unstructured grid). Furthermore, a non-orthogonal cell shape (usually hexahedral or tetrahedral which are almost always used with a fully unstructured grid) also leads to the needs for additional storage, computational time, and grid fineness (as compared with a Cartesian grid) due to the “grid quality” issues explained earlier. It is therefore far from self evident that the unstructured grid shown in Fig 6 b) will lead to a more efficient solution than the fully structured grid in Fig 6 a). Clearly the former has a smaller total number of grid cells - but it will require substantially more computer storage and computer time per grid cell to obtain a solution. The optimum choice will depend on the particular case in question. Two further points are relevant: Firstly, the advantages offered by unstructured grids are clearly the greatest when the problem considered requires a very fine grid in one region (to resolve detail in geometry of flow behaviour), surrounded by a large open region where a much coarser grid can be used. Such cases are typical in external flow or unconfined applications (the classic example being flow around a body in a free stream). Two typical applications of this kind were illustrated in Section 2.2 – the car-body shape in a (large) wind-tunnel (Fig 3), and the helicopter in free space (Fig 4). There are however many classes of problem (often “confined” flows - contained within an enclosure) which do not exhibit a surrounding “large open region”. For these the overheads associated with structured grids are much less. The interior of a typical electronics enclosure is a classic example. The enclosure is densely packed with components - the effects of all of which have to be modelled - so the “wasted” grid from a local fine grid region is not usually wasted at all - it is used to resolve necessary detail elsewhere in the flow domain. Similar comments apply to pumps and valves which have complex internal structures that are difficult to mesh using body-fitted techniques. Secondly, there are extremely powerful intermediate approaches, which offer virtually all of the flexibility of a fully unstructured system, while retaining virtually all of the benefits (of robustness, speed, economy of computer storage) of a Cartesian structured system. Two such approaches were referred to in the examples cited in Section 2.2 above. 15 The most interesting of these3 is the use of embedded structured regions of fine grid (or, in NASA’s terminology, overset structured grids). These enable large numbers of regions of Cartesian grid to be combined with one another in relatively arbitrary ways, with levels of refinement (regions within regions) as required. So long as care is taken in handling the coupling between the regions within the iterative solution, such methods can work extremely efficiently (with a relatively small increase in computer time per cell as compared with a fully structured grid) for as many as several hundred regions. To conclude: The use of structured vs. unstructured grids is entirely a question of computer efficiency. To judge computer efficiency simply by the total number of grid cells used to solve the problem can be extremely misleading - for a structured Cartesian system (for example) the overhead associated with “wasted” grid will often be more than offset by the more efficient solution per grid cell. Properly implemented, the use of embedded structured and octree grids in a Cartesian system offers virtually all the flexibility of a fully unstructured hexahedral or tetrahedral grid without any of the overheads (and, by using the cut-cell techniques referred to earlier, can represent arbitrarily complex geometries perfectly well). 2.4 Grid Generation At some stage in setting up a CFD problem users need to be concerned with “grid generation”. This has two aspects: The mechanical setting of the data which define the grid - that is the x, y, z locations of grid cell centres and/or vertices. This stage will often involve some basic consideration of matching grid to geometric boundaries, both at the edges and within the solution domain. Ensuring that the grid is a “good” one - meaning: That it will give results of the required accuracy - which involves ensuring that the grid is sufficiently fine to resolve adequately the features of the 3 The alternative method referred to earlier is the octree-structured grid, which offers advantages when used (as by NASA) for complex bodies such as aircraft fuselages, and (as by Cambridge University) for turbomachinery applications. For such cases it is used in a “geometry adaptive” manner - in which the grid is automatically refined locally based on the local geometric features of the body. 16 solution of interest, and give results of at least the required “engineering accuracy”. That the iterative scheme will converge reliably. This relates particularly to the question of “grid quality” referred to earlier. For a Cartesian grid the first stage is trivial - the required data is simply the three one-dimensional arrays, to set the x, y, and z locations of grid vertices (usually) in a 100,000 cell grid (roughly 46 x 46 x 46) this is 138 (46 x 3) numbers. These could simply be set directly by the user, but this is usually not the most convenient way. The point is that the fundamental simplicity of the required data makes it possible to provide simple user controls to automate the setting and manipulation of the grid, such as those available in FloEFD described later. These make it relatively easy for even an inexperienced user to make any adjustments needed to provide a “good” grid in the sense described in the second point above. In contrast, the grid setting (i.e. the first stage of the above) for an unstructured non-orthogonal grid is an entirely different matter. Because of the absence of any logical order or arrangement in the grid, it is necessary to set x, y and z separately for every single grid vertex. In a 100,000 grid this would require 300,000 numbers to be set - which clearly cannot be done manually. This means that some mechanical means has to be provided - using some form of algorithm. This involves the creation of a 2D surface mesh whose faces are shared by the 3D volume mesh. The most usual approach is to use Delaunay Triangulation or the Advancing Front Method which in effect “interpolates” between defined surfaces in some geometric manner. This achieves the first stage of the grid specification task. However, as the user has very little control over the resulting grid (other than the specification of the defined surfaces), it is then virtually always necessary to make further adjustments to ensure: That the grid quality is good enough to ensure reasonably reliable convergence. As a very localised region of poor quality grid (sometimes only one grid cell) can disrupt the entire solution, this might involve manual redefinition of individual grid cells. That the grid fineness is adequate in the various flow regions to give the required accuracy. This is necessary because the interpolation method has no way of anticipating the needs for fine grids in particular regions of the flow associated with high gradients in the solved for variables. The grid will therefore need adjustment based on user knowledge or experience. Since the process involves the use of a mechanical, algorithm-based method for providing the grid locations it is conventionally (and misleadingly) referred to as “automatic” grid generation. In fact it is anything but. The process takes no 17 account of the two critical issues without which the grid is useless – it’s quality and fineness for the required solution accuracy. The complexity of the process makes it difficult and time consuming for the user to make the subsequent (usually manual) adjustments. Furthermore, this complexity has implications for any geometric change in the computational model. For example, if an object is re-located, the whole process (often including the subsequent manual adjustments) has to be repeated making the performance of parametric design studies time consuming, error prone and impossible to automate. Professor Dawes (Ref 6) notes that a critical associated problem is the source of the geometry itself as geometry exported from a CAD system is almost always “dirty” (i.e. not water tight) even if exported direct from the solid modeling kernel due to numerical tolerancing issues within the CAD system requiring very substantial effort to clean up and condition this geometry representation so that the body-fitted meshing software can run satisfactorily. He concludes that: “the mesh generation may well fail and need careful nursing to produce an acceptable mesh for a really complex geometry – and generating the associated viscous layers remains a nightmare”. The latter point referring to the need to ensure that the mesh near to surfaces is sufficiently fine to resolve near-wall flow boundary layers. Prof. Dawes also notes a key distinction between analysis and design, being that analysis is aimed at gaining insight into the performance of a design, but design involves changing geometry, so for design the flexibility and generality with which the geometry can be changed is the critical enabling factor in the designer’s properly explore the design space. From the point of view of design, the critical factor is: how fast can the geometry be changed and re-meshed? To conclude: Body-fitted meshes are time consuming to create, and often require manual intervention Body-fitted meshes are analysis centric, not design centric, making them difficult to use for product design 18 3 FloEFD’s Rectangular Adaptive Mesh Technology 3.1 Initial Mesh FloEFD uses an octree mesh. Where refinement is necessary, isotropic splitting is used, resulting in 8 identical smaller cells. A cut-cell treatment is used at solidfluid boundaries. In FloEFD the initial mesh (so-called as it’s created before the solution and any solution-adaptive refinement) is defined first constructing a basic Cartesian mesh which is then refined. Definition of the initial mesh can be fully automated using the dialog below or it can be defined manually if the ‘Automatic settings’ check box below is checked off. Figure 7: FloEFD’s Initial Mesh dialog The initial mesh is constructed from a near-uniform Cartesian basic mesh that is subsequently refined according to a number of criteria. The ‘Level of Initial Mesh’ slider bar shown in the dialog controls the number of cells in the basic mesh. 19 The ‘Show basic mesh’ check box displays the basic mesh on the model as shown in Figure 8 below. The basic mesh can be stretched to better capture features of the model. The dialog settings shown in Figure 7 produce the basic and initial meshes shown in Figure 8. Figure 8: Basic Mesh and resulting default Initial Mesh for Ball Valve Tutorial Case The initial mesh is constructed by refining the basic mesh around the intersection of the solid model, guided by settings for the ‘Minimum gap size’ and ‘Minimum wall thickness’. The ‘Level of initial mesh’ performs a number of functions in addition to refining the basic mesh. It also determines how many times the basic mesh can be split and sets levels and values for various refinement criteria. FloEFD has separate refinement levels for solid, fluid, and cut cells. Small solid features, local curvature, and narrow channels also have refinement levels together with an associated dimension to denote the smallest size to which the cells can be split. The ‘Level of initial mesh’ slider automatically sets values for all these refinement levels to produce the automatic mesh. Once the automatic mesh has been generated, the user can check off the ‘Automatic settings’ box and adjust the settings manually. This gives complete control over the meshing process. 20 Figure 9: Manual refinement of partial cells (left) and fluid cells (right) The initial mesh settings are applied to the entire computational domain. For example, when specifying a mesh refinement in narrow channels, this is applied to all regions having the same characteristics. However, the initial mesh can also be refined locally, with the local region defined by a component (a part or subassembly in assemblies, as well as a body in multibody parts), face, edge or vertex, or a defined fluid region. 3.2 Solution Adaptive Mesh The solution-adaptive meshing is a procedure for adapting the computational mesh to the solution during the calculation. This is useful to capture flow features, the location of which can not be predicted before solution, for example to capture shocks in high Mach number flows. Cells that do not adequately resolve the gradients of velocity, temperature, pressure, etc. on the initial or previously adapted mesh are refined. Cells that are found to be finer than required are correspondingly coarsened. The octree-based mesh makes the procedure is very simple. Cells are refined by splitting into 8 smaller cells and coarsened by merging 8 identical cells into one. One of the validation cases supplied with FloEFD (Ref. 7) is suitable for demonstrating this. The case considers supersonic flow in a 2D convergent-divergent channel. 21 Figure 10: Schematic of Convergent-Divergent Channel showing location of shocks A uniform supersonic stream of air, having a Mach number of 3, a static temperature of 293.2K, and a static pressure of 1atm, is specified at the channel inlet between two parallel walls. In the convergent section the flow decelerates through two oblique shocks. The shape of the convergent section has been adjusted to the inlet Mach number, so the shape of the shocks matches the geometry, as shown in Figure 10. The initial grid is refined near to the walls, but is not well suited to capture the above shocks. Adaptive mesh refinement is used to refine the mesh as the solution proceeds. This reduces the overall cell count whilst concentrating the mesh around the shocks. The initial fine grid and the result of the adaptive meshing are shown in Figure 11. Figure 11: Initial and Final (Solution Adapted) Mesh The solution adapted mesh accurately captures the sharp shocks as shown in the contour plot of Mach number below. Mach number values predicted with FloEFD along the channel centerline (the reference points are marked by square boxes with numbers) are also compared with the theoretical values. 22 Figure 12: Contour Plot of Mach Number and Agreement with Theory 4 REFERENCES 1. S V Patankar “Numerical Heat Transfer and Fluid Flow”, Hemisphere Publishing, 1980. 2. S V Patankar, Unpublished Presentation at 6th International FloTHERM User Conference, October 1997. 3. D B Spalding, “CAD to SFT, with Aeronautical Applications”, Plenary Lecture at 38th Israel Annual Conference on Aerospace Sciences, February 1998. 4. M J Aftomis, M J Berger, and J E Melton, “Robust and Efficient Cartesian Mesh Generation for Component-Based Geometry”, Paper no AIAA 97 - 0196 Presented at 35th AIAA Aerospace Sciences Meeting and Exhibit, January 1997. 5. R L Meakin, “On Adaptive Refinement and Overset Structured Grids, Paper No AIAA - 97 - 1858, 1997. 6. W N Dawes, “Turbomachinery computational fluid dynamics: asymptotes and paradigm shifts”, Phil. Trans. R. Soc. A, Vol. 365, No. 1859, pp. 2553-2585, May 2007. 7. “EFD.Lab 8 Fundamentals”, Flomerics Ltd, 2007. 23 Appendix I: Diffusion Flux And Pressure Gradient In A NonOrthogonal Grid For a non-orthogonal grid, the normal flux through a control volume face is not aligned with the line joining the adjacent grid points. Therefore, calculation of total normal flux through a face requires calculation of primary and secondary fluxes. It is of interest to write the equation for calculation of diffusion flux for a non-orthogonal grid. This is illustrated for a quadrilateral grid in two-dimensions. However, the same arguments apply for triangular non-orthogonal grids (departure from equilateral triangles in two dimensions). X2 Tn P θ E X1 Ts A non-orthogonal quadrilateral grid In reference to the above figure, the total diffusion flux through a control volume face is decomposed into primary and secondary fluxes as follows: Q = − AK ( Q=( AK δ PE . ∂T ) ∂n AK Sinθ 1 )(TP − TE ) + ( . )(T − T ) Cosθ δsn Cosθ s n Primary Coefficient Secondary Coefficient Note that for a conduction equation, the primary and secondary coefficients in the discretization equations for the temperatures on the two sides of the control volume face are directly proportional to the areas multiplying the temperature gradient terms in the above equation. The behavior of these coefficients is plotted in the following figure. 24 As the departure from the orthogonality increases, both the primary and secondary coefficients become progressively large. It is the small difference between the primary and secondary flux terms that creates the net flux. Note that for a Cartesian or orthogonal grid, the primary coefficient (secondary coefficient is zero) is inversely proportional to the distance between the grid points on the two sides of the control volume face and it correctly represents the physical “conductance” between the adjacent grid points. When the grid is strongly non-orthogonal, the coefficients no longer reflect the physical conductance. The momentum equation for the velocity normal to the face (flow rate for continuity equation) is given as follows: ∧ . . M = M+[ A δ PE A Sinθ 1 ( PP − PE ) + ( P − Pn ) ] Cosθ δ sn Cosθ s Again, the normal pressure gradient has to be decomposed into primary and secondary gradients analogous to the temperature gradient calculation. When a 25 pressure-based solution procedure is used the handle the velocity-pressure coupling, the coefficients in the pressure correction equation also behave inappropriately. 26
© Copyright 2024