
[Sponsors] 
December 21, 2008, 22:20 
2d irregular grid

#1 
Guest
Posts: n/a

Sorry if this is basic, but I am a beginner. How do you take an irregular grid (say that of a backward step, or flow around a cylinder) and create a uniform grid to do finite differencing?
Thanks, Remy 

December 22, 2008, 05:49 
Re: 2d irregular grid

#2 
Guest
Posts: n/a

Your question is ambiguous and rather general, but I interpret it as asking (a) how to map an irregular grid in the physical domain onto a uniform structured mesh in the computational domain, rather than (b) how to replace an irregular grid with a uniform mesh in the physical domain. Let me first say that it is easier to implement a finite volume scheme, which you can do for arbitrary unstructured mesh of any polygonal elements.
However, if you really must implement a finite difference scheme on the mesh ... If, by "irregular grid", you mean a structured (but not Cartesian) grid of quadrilaterals, then you can skip the next two paragraphs. I assume you know what is meant by elements (cells) and nodes (shared vertices of elements) of the mesh (grid). What do you mean by "irregular grid"? The key distinction is whether the mesh can be considered structured or must be treated as an unstructured mesh. Since you mention "uniform grid", I assume that you refer to structured meshes, for which finite difference schemes can be written in a straightforward way using global computational coordinates. An intermediate case is (multi)block structured, which is very common, and can also be treated by straightforward finite difference methods, but here each block requires its own set of computational coordinates. Unstructured meshes can also be treated by finite difference schemes, and there are a few references in the literature for such differencing, but such schemes are not straightforward. Alternatively, unstructured meshes can be treated by the socalled meshfree methods, which are sort of like finite difference methods. It sounds like you are asking about 2D meshes. The elements of a structured mesh all need to be of the same type. You can verify whether your grid is structured or truly unstructured by use of the following property. In a structured mesh of quadrilaterals (or a structured block of quads), every interior node (one not lying on a boundary of the mesh) will be shared by four elements. Similar rules apply for triangles, and for tetrahedra and hexahedra in 3D. Basically, this allows the use of two integer indices in 2D, to label the nodes so as to identify two families of coordinate lines. Assuming a structured mesh of quads, all in a single block, identify the four "corners" of the mesh. You can see a fishnet sort of structure, with two families of lines running across each other. The lines (which may not be straight or smooth) of a given family never intersect each other, whereas any single line of a given family intersects every single line of the other family. If the interior lines are not smooth (at least C1 continuous), then you may want to pass the mesh through a grid smoother to make it more suitable for finitedifferencing. Each family has two lines which lie on the boundary of the computational domain (though not necessarily of the physical domain). The four boundary lines form the four boundaries of the computational domain and connect its four corners. This sort of identification can be done for a mesh for a singlyconnected domain like a backward facing step and for C or O grids for doublyconnected domains such as a cylinder in crossflow. The case of an H mesh for a cylinder (or airfoil) should rather be treated as two structured blocks, though some older codes treat this as a single block with some tricky IF statements for the line that splits to cover the body surface. Call one family of lines the xi coordinate lines and the other family the eta coordinate lines. Picking a boundary xi coordinate line, count the number "nxi" of elements on one side of the line that have an edge lying on the boundary line. Similarly count the number "neta" of elements bordering a boundary eta coordinate line. Picture a rectangular Cartesian grid of nxi x neta elements in the computational plane. For programming convenience and efficiency, choose the uniform step size in each direction in the computational domain to be dxi = deta = 1. This is the uniform grid on which you will do the finite differencing. Set up indices i and j in the xi and eta directions for doublysubscripted Fortran arrays which will hold the nodal or elemental information. For nodal information, the i and j indices will run from 1 to nxi+1 and from 1 to neta+1, respectively. For elemental information, they will run from 1 to nxi and 1 to neta, respectively. Map (identify) the four corners of this computational domain to the corresponding four corners referred to above in the physical domain. Identify lines and nodes in the physical domain with corresponding lines and nodes in the computational domain. Assign the (x,y) locations of every node in the physical mesh to the corresponding node in the computational mesh. Transform the governing differential equations that you want to solve, from having (t,x,y) as the independent variables to having (t,xi,eta) as the independents (see a good textbook on how to do this, or one that lists the equations in general coords). Calculate the needed metric quantities numerically by finite differencing on the mesh in the computational domain (basically, quantities like dx/dxi and d2x/dxi2). Now you are ready to finitedifference the governing equations on the uniform mesh in the computational domain. As to the question of how the identifications described in the previous para can be automated in a computer program, the answer depends very much on how you are given the grid data. If you are lucky, whoever generated the mesh gave you the data already in structured form, listing the nodal locations systematically, in order along each coordinate line of one family, and traversing the lines in order with respect to the other coordinate. In this case, it is trivial to read the data in to the arrays set up for the computational domain. However, if the grid data are unfortunately in random order (and why on earth would somebody write out a structured mesh without describing and retaining the structure?), and the boundary nodes/edges are flagged, then it is possible, but not trivial, to write a general computer program that reads in the mesh and verifies that the mesh is structured and counts the number of elements in each direction and performs the identifications previously described and stores the grid data on the uniform mesh in the computational domain, ready to be used. The more general the types of mesh you want to handle (meshes with isolated nonquad cells, multiblock structured meshes, with coincident boundaries, etc.), the more complex will be the corresponding transformative program. You can work out the details of such a program yourself, if you know the particulars of the formats in which you will receive the grids. 

Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Mapping results from CFD grid to structural grid of a freeform surface  mbecker  OpenFOAM Running, Solving & CFD  1  October 18, 2013 10:16 
MapFields to New Grid For Extreme Grid Deformations due to Body Motion  albcem  OpenFOAM  0  May 5, 2009 14:17 
GRID TO GRID INTERPOLATION in FLUENT  calogero  FLUENT  3  June 4, 2003 08:32 
Combustion Convergence problems  Art Stretton  Phoenics  5  April 2, 2002 05:59 
Troubles modelling flow through a grid  Hans Klaufus  CFX  1  June 28, 2000 16:43 