1. Introduction
  2. Boundary-Conforming Coordinate Systems
  3. Transformation Relations
    1. Base Vectors
      1. Covariant
      2. Contravariant
      3. Orthogonality
    2. Differential Elements
      1. Covariant metric tensor
      2. Arc length element
      3. Surface area element
      4. Volume element
    3. Derivative Operators
      1. Divergence
      2. Curl
      3. Gradient
      4. Laplacian
    4. Relations Between Covariant and Contravariant Metrics
      1. Base vectors
      2. Metric Tensors
    5. Restatement of Derivative Operators
      1. Conservative
      2. Non-conservative
    6. Normal and Tangential Derivatives
      1. Tangent to coordinate lines
      2. Normal to coordinate surfaces
      3. Normal to coordinate lines and tangent to coordinate surfaces
    7. Integrals
      1. Surface integral
      2. Volume integral
      3. Line integrals
    8. Two-Dimensional Forms
      1. Metric elements
      2. Transformation relations
    9. Time derivatives
      1. First Derivative
      2. Convective terms
  4. Numerical Implementation
  5. Truncation Error
  6. Elliptic Generation Systems
  7. Parabolic and Hyperbolic Generation Systems
  8. Algebraic Generation Systems
  9. Orthogonal Systems
  10. Conformal Mapping
  11. Adaptive Grids
  12. Appendix A
    Appendix B
    Appendix C

    Downloadable Version (PDF)
Numerical Grid Generation
Foundations and Applications
By: Joe E. Thompson, Z.U.A. Warsi and C. Wayne Mastin


          The transformation relations from cartesian coordinates to a general curvilinear system are developed here using certain concepts from differential geometry and tensor analysis, which are introduced only as needed. Warsi [15] has given an extensive collection of concepts from tensor analysis and differential geometry applicable to the generation of curvilinear coordinate systems. Another discussion is given in Eiseman [16], where these concepts are developed as part of a general survey on the generation and use of curvilinear coordinate systems. Eiseman includes a discussion on differential forms, which is a fundamental part of modern differential geometry, but primarily restricts his development to Euclidean space. In contrast, Warsi has given a classical development that includes curved space, but not differential forms.

          Partial derivatives with respect to cartesian coordinates are related to partial derivatives with respect to curvilinear coordinates by the chain rule which may be written in either of two ways. If A is a scalar-valued function, then


or, equivalently,


Either formulation may be used to relate the cartesian and curvilinear derivatives of the function A. However, there is a difference in the transformation derivatives which must be inserted in these relations. In the first ease one must be able to evaluate (or approximate) the vectors

whereas, the second case requires

Thus all the transformation relations may be based on either of these two sets of vectors. Various properties of, and relationships between, these vectors are developed and applied in this chapter to provide the necessary transformation relations.

1. Base Vectors

          The curvilinear coordinate lines of a three-dimensional system are space curves formed by the intersection of surfaces on which one coordinate is constant. One coordinate varies along a coordinate line, of course, while the other two are constant thereon. The tangents to the coordinate line and the normals to the coordinate surface are the base vectors of the coordinate system.

A. Covariant

          Consider first a coordinate line along which only the coordinate varies:

Clearly a tangent vector to the coordinate line is given by

(Coordinates appearing as subscripts will always indicate partial differentiation.) These tangent vectors to the three coordinate lines are the three covariant base vectors of the curvilinear coordinate system, designated


where the three curvilinear coordinates are represented by i (i=1,2,3), and the subscript i indicates the base vector corresponding to the i coordinate, i.e., the tangent to the coordinate line along which only i varies.

B. Contravariant

          A normal vector to a coordinate surface on which the coordinate is constant is given by :

These normal vectors to the three coordinate surfaces are the three contravariant base vectors of the curvilinear coordinate system, designated


Here the coordinate index i appears as a superscript on the base vector to differentiate these contravariant base vectors from the covariant base vectors. The two types of base vectors are illustrated in the following figure, showing an element of volume with six sides, each of which lies on some coordinate surface.

C. Orthogonality

          Only in an orthogonal coordinate system are the two types of base vectors parallel, since for a non-orthogonal system, the normal to a coordinate surface does not necessarily coincide with the tangent to a coordinate line crossing that surface:

Also for an orthogonal system the three base vectors of each type are obviously mutually perpendicular.

2. Differential Elements

          The differential increments of arc length, surface, and volume, which are needed for the formulation of the respective integrals, can be generated directly from the co-variant base vectors. The general arc length increment leads also to the definition of a fundamental metric tensor.

A. Covariant metric tensor

          The general differential increment (not necessarily along a coordinate line) of a position vector is given by

An increment of arc length along a general space curve then is given by

The general arc length increment thus depends on the nine dot products, (i=1,2,3) and (j= 1,2,3), which form a symmetric tensor. These quantities are the covariant metric tensor components:


Thus the general arc length increment can be written as


B. Arc length element

          An increment of arc length on a coordinate line along which i varies is given by


C. Surface area element

          Also an increment of area on a coordinate surface of constant i is given by


Using the vector identity


we have


so that the increment of surface area can be written as


D. Volume element

          An increment of volume is given by


But, by the identity (9),

Also from (9),

and by the vector identity


we have

so that with the dot products replaced according to the definition (5),

This last expression is simply the determinant of the (symmetric) covariant metric tensor expanded by cofactors. Therefore


so that the volume increment can be written


where (called the Jacobian of the transformation) can be evaluated by either of the following expressions:


3. Derivative Operators

          Expressions for the derivative operators, such as gradient, divergence, curl, Laplacian, etc., are obtained by applying the Divergence Theorem to a differential volume increment bounded by coordinate surfaces. The gradient operator then leads to the expression of contravariant base vectors in terms of the covariant base vectors, and to the contravariant metric tensor as the inverse of the covariant metric tensor.

          By the Divergence Theorem,


for any tensor , where is the outward-directed unit normal to the closed surface S enclosing the volume V. For a differential surface element lying on a coordinate surface we have, by Eq. (8),


with the choice of sign being dependent on the location of the volume relative to the surface. Then considering a differential element of volume, V, bounded by six faces lying on coordinate surfaces, as shown in the figure on p. 98, we have, using Eq. (15) and (18),


where the notation and indicates the element on i two sides of the which is constant and which are located at larger and smaller values, respectively, of . Here, as usual, the indices (i,j,k) are cyclic.

A. Divergence

Proceeding to the limit as the element of volume shrinks to zero we then have an expression for the divergence:


where, as noted, the subscript i on the bracket indicates partial differentiation.

          A basic metric identity is involved here, since

The indices (i,j,k) are cyclic, and therefore the last summation may be written equivalently as

Since this is then the negative of the first summation we have the identity,


This is a fundamental metric identity which will be used several times in the developments that follow. This identity also follows directly from Eq. (20) for uniform . It then follows that the divergence can also be written as


          Although the equations (20) and (22) are equivalent expressions for the divergence, because of the identity (21), the numerical representations of these two forms may not be equivalent. The form given by Eq. (20) is called the conservative form, and that of Eq. (22), where the product derivative has been expanded and Eq. (21) has been used, is called the non-conservative form. Recalling that the quantity represents an increment of surface area (cf.Eq. (8)), so that is a flux through this area, it is clear that the difference between the two forms is that the area used in numerical representation of the flux in the conservative form, Eq. (20), is the area of the individual sides of the volume element, but inthe nonconservative form, a common area evaluated at the center of the volume element is used. The conservative form thus gives the telescopic collapse of the flux terms when the difference equations are summed over the field, so that this summation then involves only the boundary fluxes. This would seem to favor the conservative form as the better numerical representation of the net flux through the volume element.

          It is important to note that since the conservative form of the divergence, and of the gradient, curl, and Laplacian to follow, is obtained directly from the closed surface integral in the Divergence Theorem, the use of the conservative difference forms for these derivative operators is equivalent to using difference forms for that closed surface integral. Therefore the finite volume difference formulation can be implemented by using these conservative forms directly in the differential equations of motion without the necessity of returning to the integral form of the equations of motion.

B. Curl

          Since Eq. (17) is also valid with the dot products replaced by cross products, the conservative and non-conservative expressions for the curl follow immediately from Eq. (20) and (22):




These expressions can also be written, using Eq. (13), as




C. Gradient

Eq. (17) is also valid with replaced by a scalar, and the dot product replaced by simple operation on the left and multiplication on the right. Therefore the conservative and non-conservative expressions for the gradient also follow directly from Eq. (20) and (22) as




D. Laplacian

          The expressions for the Laplacian then follow from Eq. (20) or (22), with replaced by A from Eq. (27) or (28). Thus the conservative form is


and the non-conservative is


With the product derivative expanded, the non-conservative form, Eq. (30), can also be written as


4. Relations Between Covariant and Contravariant Metrics

A. Base vectors

          The expression (28) for the gradient allows the contravariant base vectors to be expressed in terms ofthe co-variant base vectors as follows. With A=m in (28), we have

since the three curvilinear coordinates are independent of each other. Then


This gives a relation between the derivatives of the curvilinear coordinates (i)xl and the derivatives (xr) s of the cartesian coordinates. By Eq. (4) the contravariant base vectors maybe written in terms of the covariant base vectors as


          By Eq. (33),

where here (j,k,l) are cyclic. If j i, either k or l must be i, and in that case the right-hand sidevanishessince the three vectors in the triple product may be in any cyclic order and the cross product of any vector with itself vanishes. When j=i, the right-hand side is simply unity. Therefore, in general


Because of this relation, any vector can be expressed in terms of either set of base vectors as




Here the quantities and , are the contravariant and co-variant components, respectively, of the vector .

B. Metric Tensors

          The components of the contravariant metric tensor are the dot products of the contravariant base vectors:


The relation between the covariant and contravariant metric tensor components is obtained by use of Eq. (33) in (37). Thus, with (i,j,k) cyclic and (l,m,n) cyclic,

by the identity (9). Then from the definition (5),


Since the quantity in parentheses in the above equation is the signed cofactor of the il component of the covariant metric tensor, the right-hand side above is the li component of the inverse of this tensor. Then, since the metric tensor is symmetric we have immediately that the contravariant metric tensor is simply the inverse of the covariant metric tensor. It then follows that

so that, in terms of the contravariant base vectors, the Jacobian is


The identity (21) can be given, using Eq. (33), as


5. Restatement of Derivative Operators

          In view of Eq. (33), the cross products of the co-variant base vectors in the expressions given above for the gradient, divergence, curl, and Laplacian can be replaced directly by the contravariant base vectors (multiplied by the Jacobian). The components of these contravariant base vectors i in the expressions are the derivatives of the curvilinear coordinates with respect to the cartesian coordinates, and this notation, rather than the cross-products, often appears in the literature. Thus, by Eq. (4), the xj-component of ai can be written as


          The expressions for the gradient, divergence, curl, Laplacian, etc., given above in terms of the cross products of the covariant base vectors, i, involve the derivatives of the cartesian coordinates with respect to the curvilinear coordinates, e.g. (xi)j. The expressions given below in terms of the contravariant base vectors, i, involve the derivatives (i)xj when is evaluated from (39). From a coding standpoint, however, the contravariant base vectors i in these expressions would be evaluated from the covariant base vectors using Eq. (33).

A. Conservative

          The conservative forms are as follows:


By expanding the inner derivative, the Laplacian can be expressed as


          For we have


or, with the inner derivative expanded,


          In the expressions for the divergence, may be a tensor, in which case we have


From Eq. (42) we have the conservative expressions for the first derivative:


where is the component in the xj-direction. Also, for the second derivative,


or, with the inner derivative expanded,


          It then follows that all of the above conservative expressions can be written in the form


where the quantity Ai takes the following form for the various operatfons, with i = 1,2,3,


          matrix product of square matrix and column vector i. Here i is a vector)


          It is computationally more efficient to evaluate the product i as an entity from Eq. (33) when the conservative forms are used, in order to avoid the extra multiplication by . Another alternative is to include with .

B. Non-conservative

          The non-conservative relations are as follows:


From Eq. (65) the p operator can be represented by






by Eq. (37) and (69), the Laplacian can also be written as


          Using Eq. (67) and (65) we also have

Thus, by Eq. (70), the non-conservative expression is


A more practical equation than Eq. (70) for the evaluation of 2j in these expressions can be obtained as follows.

          Since 2=0 it follows from Eq. (71) that


But j=j. Then dotting l into this equation and using Eq. 34, we have

so that 2l is given by


          The non-conservative form of the divergence of a tensor is, by expansion in Eq. (49),


          From Eq.(65) the non-conservative expressions for the first and second derivatives are




          This non-conservative form in terms of the contravariant base vectors is referred to by some as the "chain-rule conservation" form (Eq. (76) is equivalent to Eq. (1)). In any case only the conservative form gives the telescopic collapse over the field that characterizes conservative numerical representations, and it is necessary to substitute for the contravariant base vectors from Eq. (33) in implementation, since it is the covariant base vectors that are directly calculated from the grid point locations.

6. Normal and Tangential Derivatives

          Expressions for derivatives normal and tangential to coordinate surfaces are needed in boundary conditions and are obtained from the base vectors as follows.

A. Tangent to coordinate lines

          Since the covariant base vectors are tangent to the coordinate lines, the tangential derivative on a coordinate line along which i varies is given by

using Eq. (65). In view of Eq. (34), this reduces to


B. Normal to coordinate surfaces

          Also, since the contravariant base vectors are normal to the coordinate surfaces, the normal derivative to a coordinate surface on which i is constant is given by


C. Normal to coordinate lines and tangent to coordinate surfaces

          The vector is normal to the coordinate line on which i varies and is also tangent to the coordinate surface on which i is constant:

Using Eq. (33) and the identity (13), this vector is given by

and the magnitude is given by

The bracket is the negative of the second and third terms of the determinant, , expanded by cofactors. Therefore, we have


          The derivative normal to the coordinate line on which i varies and in the coordinate surface on which i is constant then, using Eq. (65) and (80), is given by

By Eq. (34). Thus, using Eq. (81),


7. Integrals

Expressions for surface, volume, and line integrals are easily developed from the base vectors as follow.

A. Surface integral

Returning to the Divergence Theorem, Eq. (17), and its counterparts with the dot product replaced by a cross product or simple operation (the latter with A replaced by a scalar), we have approximate expressions for the surface integrals over the surface of the volume element given, using Eq. (15), by


with the open circle indicating the product operation, and using the appropriate expression for from those given in the developments above. This emphasizes again that difference representations based on integral formulations, e.g. finite volume, can be obtained by using conservative expressions for the derivative operators directly in the partial differential equations.

B. Volume integral

          The approximate expression for the volume integral over the volume element, again using Eq. (15), is simply


C. Line integrals

          Using Eq. (3), the line integral on a coordinate line element on which i varies is simply


where again the open circle indicates any type of operation, and is any tensor. Also since

we have for a closed circuit lying on a coordinate surface on which i is constant,

using Eq. (83), where (l,m,n) are cyclic. But

Then using the identity (13), we have


by using Eq. (34). With (1,j,k) cyclic we have for the circuit integral,


8. Two-Dimensional Forms

          In two dimensions, let the x3 direction be the direction of invariance, and let the 3 curvilinear coordinate be identical with x3. Also, for convenience of notation, let the other coordinates be identified as

A. Metric elements


and the other base vectors are


The covariant metric components then are


From Eq. (16), the Jacobian is given by


The other contravariant base vectors are, from Eq. (33),


and the contravariant metric components are, from Eq. (37) or (38),


From Eq. (4) we have =1 and =2, so that by Eq. (91),


B. Transformation relations

Divergence (conservative), Eq. (43):


(non-conservative), Eq. (67):


Gradient (conservative), Eq., (42):


(non-conservative), Eq. (65):


          By Eq. (93), or directly from Eq. (76), these non-conservative forms may be given as

which are the so-called "chain-rule conservative" forms. This form, however, is not conservative and the relations given by Eq. (93) must be substituted in the implementation in any case, since it is x , etc., rather than x, that is directly calculated from the grid point locations.

Curl (conservative), Eq. (44):


(non-conservative), Eq. (68):


Laplacian (conservative), Eq. (45):


(non-conservative), Eq. (65):


Second derivatives (non-conservative):


Normal derivative (conservative):




Tangential derivative (conservative):




Surface integral:


9. Time derivatives

A. First Derivative

          With moving grids the time derivatives must be transformed also. For the first derivative we have


where here, and in Eq. (117) below, the subscripts indicate the variable being held constant in the partial differentiation. Here the time derivative on the left side is at a fixed position in the transformed space, i.e., at a given grid point. The time derivative on the right is at a fixed position in the physical space, i.e., the time derivative that appears in the physical equations of motion. The quantity is the grid point speed, to be written hereafter. Thus we have, for substitution into the physical equations of motion, the relation


with to come from thetransformation relations given previously. With the time derivatives transformed, only time derivatives at fixed points in the transformed space will appear in the equations and, therefore, all computation can be done on the fixed uniform grid in the transformed field without interpolation, even though the grid points are in motion in the physical space. The last term in Eq. (117) resembles a convective term and accounts for the motion of the grid.

B. Convective terms

Consider the generic convective terms


where is a velocity, which occur in many conservation equations. Using Eq. (117) we have

where now the time derivative is understood to be at a fixed point in the transformed space. Then using Eq. (42) and (43) for the gradient and divergence, this becomes


          By Eq. (16),

by Eq. (33). But

so that


          We then can write


which is a conservative form of the generic convective terms with regard to the quantity, A. By Eq. (33), the quantity


is the contravariant velocity component in the i-direction, relative to the moving grid. Thus Eq. (121) can be written in the conservative form,


          Expanding the derivatives in Eq. (119) and using Eq. (40), we have


so that the non-conservative form


The last summation is the divergence of the velocity, . (Computationally, might be included in the definition of Ui for use in the conservative form in the interest of computational efficiency, since by Eq. (33) the product i can be evaluated directly as the cross product of the co-variant base vectors.)

          From Eq. (117) we have, with A taken as i,


by Eq. (4). Here the time derivative of i is, of course, at a fixed position in physical space. The quantity Ui introduced above in Eq. (122), thus could be written as


Here the are, of course, the contravariant velocity components.

C. Second derivative

          The second time derivative transforms as follows:


where the x,y subscripts on the left indicate the variables being held constant, and


with (l,m,n) cyclic.


1. Obtain the covariant and contravariant base vectors for cylindrical coordinates from Eq. (3) and (4). Show that Eq. (34) holds for this system.

2. Obtain the elements of arc length, surface area, and volume for cylindrical coordinates.

3. Obtain the relations for gradient, divergence, curl, and Laplacian for cylindrical coordinates.

4. Demonstrate that the identity (21) holds for cylindrical coordinates.

5. Demonstrate that Eq. (33), (38) and (39) hold for cylindrical coordinates.

6. Repeat exercises 1 - 5 for spherical coordinates.

7. Show that the covariant base vectors may be written in terms of the contravariant base vectors by

Hint: Cross k into Eq. (33) and use (13), rearranging k subscripts at the end. Recalling that as can be expressed , this gives, a relation for (xl)i in terms of the derivatives (r)xs.

8. Show that the elements of the covariant metric tensor can be expressed in terms of the contravariant elements by

Hint: Follow the development of Eq. (38), but with .

9. Show that Eq. (65) is equivalent to the chain rule expression (1). Also show that the dot product of j with Eq. (65) leads, after interchange of indices, to the chain rule expression (4).

10. Show that

Hint: Since depends on only through the gij, differential g with respect to gjk with respect to i. Recall Eq. (38).

11. Show that 2=0. Hint: Use cartesian coordinates.

12. Obtain the two-dimensional relations in Section 6 from the general expression.

13. Verify Eq. (74) for cylindrical and spherical coordinates.

14. Obtain the normal and tangential derivatives (Section4) for cylindrical and spherical coordinates.