cfdgrid

15
Engineering Building Room 2303 Mail Code Phone: 818-677-6448 E-mail: [email protected] 8348 Fax: 818-677-7062 College of Engineering and Computer Science Mechanical Engineering Department ME 692 – Computational Fluid Dynamics Spring 2002 Ticket: 57541 Instructor: Larry Caretto Grid Transformations for CFD Calculations Introduction We want to carry out our CFD analyses in alternative coordinate systems. Most students have dealt with polar and spherical coordinate systems. In these notes, we want to extend this notion of different coordinate systems to consider arbitrary coordinate systems. This prepares the way for the consideration of body-fitted coordinates in CFD problems. Body fitted coordinated start by fitting a coordinate line to the physical body under consideration. This body may be any arbitrary shape. One consequence of the use of body-fitted coordinates is that the resulting coordinate system may not be orthogonal. In an orthogonal coordinate system the unit vectors in any coordinate direction will be perpendicular to the unit vectors in the other directions. In a general orthogonal coordinate system we can express the unit vectors in the three coordinate directions, e (1) , e (2) , and e (3) , as the following column vectors. 1 0 0 0 1 0 0 0 1 ) 3 ( ) 2 ( ) 1 ( e e e [1] We usually use the notation e i to represent one component of a vector. Here we use the notation, e (i) instead of e i for the unit vectors to emphasize that these are in fact vectors with three components; we are not referring to the individual components (the 1’s and 0’s of these vectors here. With this definition of the unit vectors for the orthogonal coordinate system, the vector dot product of any two unit vectors may be represented as follows. j i if j i if ij j T i j i 0 1 ) ( ) ( ) ( ) ( e e e e [2] In equation [2], the first notation is the conventional dot-product notation for vectors; the second notation is the matrix multiplication notation for column vectors. Both operations produce the Kronecker delta, defined as the last item in equation [2]. For our Cartesian coordinates, the unit vectors are usually denoted as i, j, and k. We will call these unit vectors e (x) , e (y) and e (z) , in these notes. Coordinate transformations require two different items. The first is a transformation of coordinates. When we have a derivative of some function with respect to x in a Cartesian system, how do we express that derivative in a new coordinate system? The second questions relates to components of vectors. If the velocity vector has certain components along the axes in a Cartesian system, what are the components of the velocity vector in the transformed system? In addition to vectors, we have to consider the shear stress, σ ij . This two dimensional quantity is known as a tensor and its nine components must have appropriate transformations to get into the new coordinate system. When we depart from an orthogonal system, we have an additional complication. There are two concepts that are the same in orthogonal systems. The first is the tangent to a coordinate line.

Upload: vignesh

Post on 11-Sep-2015

216 views

Category:

Documents


0 download

DESCRIPTION

railway reguirmend

TRANSCRIPT

  • Engineering Building Room 2303 Mail Code Phone: 818-677-6448 E-mail: [email protected] 8348 Fax: 818-677-7062

    College of Engineering and Computer ScienceMechanical Engineering Department

    ME 692 Computational Fluid DynamicsSpring 2002 Ticket: 57541 Instructor: Larry Caretto

    Grid Transformations for CFD Calculations

    Introduction

    We want to carry out our CFD analyses in alternative coordinate systems. Most students have dealt with polar and spherical coordinate systems. In these notes, we want to extend this notion of different coordinate systems to consider arbitrary coordinate systems. This prepares the way for the consideration of body-fitted coordinates in CFD problems. Body fitted coordinated start by fitting a coordinate line to the physical body under consideration. This body may be any arbitrary shape. One consequence of the use of body-fitted coordinates is that the resulting coordinate system may not be orthogonal. In an orthogonal coordinate system the unit vectors in any coordinate direction will be perpendicular to the unit vectors in the other directions. In a general orthogonal coordinate system we can express the unit vectors in the three coordinate directions, e(1), e(2), and e(3), as the following column vectors.

    100

    010

    001

    )3()2()1( eee [1]

    We usually use the notation ei to represent one component of a vector. Here we use the notation, e(i) instead of ei for the unit vectors to emphasize that these are in fact vectors with three components; we are not referring to the individual components (the 1s and 0s of these vectors here. With this definition of the unit vectors for the orthogonal coordinate system, the vector dot product of any two unit vectors may be represented as follows.

    jiifjiif

    ijjTiji 0

    1)()()()( eeee [2]

    In equation [2], the first notation is the conventional dot-product notation for vectors; the second notation is the matrix multiplication notation for column vectors. Both operations produce the Kronecker delta, defined as the last item in equation [2]. For our Cartesian coordinates, the unit vectors are usually denoted as i, j, and k. We will call these unit vectors e(x), e(y) and e(z), in these notes.

    Coordinate transformations require two different items. The first is a transformation of coordinates. When we have a derivative of some function with respect to x in a Cartesian system, how do we express that derivative in a new coordinate system? The second questions relates to components of vectors. If the velocity vector has certain components along the axes in a Cartesian system, what are the components of the velocity vector in the transformed system? In addition to vectors, we have to consider the shear stress, ij. This two dimensional quantity is known as a tensor and its nine components must have appropriate transformations to get into the new coordinate system.

    When we depart from an orthogonal system, we have an additional complication. There are two concepts that are the same in orthogonal systems. The first is the tangent to a coordinate line.

  • Coordinate transformations ME 692, L. S. Caretto, Spring 2002 Page 2

    The second is the normal to a surface where a coordinate is constant. This is not always the case in nonorthogonal systems. For example, a coordinate line in the direction of angular displacement, , in a cylindrical coordinate system, describes a circle. A tangent line to a line along which only the coordinate varies is a tangent to a circle. In this coordinate system, a surface, on which is a constant, is a plane. A vector normal to this plane of constant will point in the same direction as the tangent to the coordinate line. In nonorthogonal coordinate systems, this is not the case.

    Definition of Generalized Coordinate Systems

    We are concerned about transformations between two different coordinate systems. Ultimately the analysis of two general coordinate systems will allow us to obtain relations with the more familiar Cartesian coordinate system. We use the notation x1, x2, and x3 to define one coordinate system and the notation x1, x2, and x3, to define the second coordinate system. For example we could have the Cartesian coordinate system, x1 =x, x2 =y, and x3 =z, as one system.* The other system might be the cylindrical coordinate system: x1 = r, x2 = and x3 =z. In general, any one of the new coordinates can depend on all three of the old coordinates. Thus, we can write the following general relationship.

    3,2,1),,( 321 ixxxxx ii [3] We can write all three relationships as shown below.

    ),,(),,(),,(

    32133

    32122

    32111

    xxxxxxxxxxxxxxx

    [4]

    For example, we can write the usual equations for the conversion from a Cartesian coordinate system to a cylindrical coordinate system in terms of the usual r, , z variables and the notation introduced here in equation [5].

    33

    1

    2112

    22

    21

    221

    tantan

    xzxxx

    xyx

    xxyxrx

    [5]

    We want to invert the general functional relationship in [3] and [4] so that we go back and forth between the two coordinate systems. That is we want to have relationships like the following.

    3,2,1),,( 321 ixxxxx ii [6] As before, the functional relationships shown in equation [3] are equivalent to the following three relationships.

    * Later in these notes we will use the notation yi to discriminate between a Cartesian system and any other coordinate system. That is, we will write y1 =x, y2 =y, and y3 =z, for a Cartesian coordinate system.

  • Coordinate transformations ME 692, L. S. Caretto, Spring 2002 Page 3

    ),,(),,(),,(

    32133

    32122

    32111

    xxxxxxxxxxxxxxx

    [7]

    The equations shown in [5] for transforming a Cartesian system into a cylindrical coordinate system have the inverse relationships shown in equation [8]. As in equation [5], we write these equations in terms of the usual r, , z variables and the general coordinate system introduced here.

    33

    212

    211

    sinsincoscos

    xzxxxryxxxrxx

    [8]

    The inversion of this functional relationship for the coordinate transformation requires the Jacobian determinant for the transformation be nonzero. This determinant is expressed by the following symbolic notation.

    ),,(),,(

    321

    321

    xxxxxxJ

    [9]

    The actual definition of this determinant is shown below.

    3

    3

    2

    3

    1

    3

    3

    2

    2

    2

    1

    2

    3

    1

    2

    1

    1

    1

    321

    321

    ),,(),,(

    xx

    xx

    xx

    xx

    xx

    xx

    xx

    xx

    xx

    xxxxxxJ

    [10]

    The functional relationships in equation [3] allow us to express a differential change in the new Cartesian coordinates in terms of the differential changes in the new coordinate system by the usual relationship for total differentials in terms of partial derivatives.

    3,2,133

    22

    11

    idx

    xxdx

    xxdx

    xxxd iiii [11]

    We can write the inverse relationship for the total differential by a similar relationship.

    3,2,133

    22

    11

    ixd

    xxxd

    xxxd

    xxdx iiii [12]

    Using the summation convention that repeated indices in a single term are summed over all three coordinate values, we could write equations [11] and [12] as follows.

  • Coordinate transformations ME 692, L. S. Caretto, Spring 2002 Page 4

    jj

    iij

    j

    ii xd

    xxdxdx

    xxxd

    [13]

    In both cases, the repeated index, j, is summed over its three possible values 1, 2, and 3.

    To start our general coordinate system, we consider a position vector, r, that is defined in a Cartesian coordinate space as follows with unit vectors e(x), e(y) and e(z). The position vector is defined as follows in a Cartesian system. We use either (x, y, z) or (y1, y2, y3) as our Cartesian coordinates..

    )3(3)2(2)1(1)()()( eeeeeer yyyzyx zyx [14] The derivative of the position vector, with respect to a particular new coordinate, xi, is given by equation [15], which is also used to define the base vector, g(i), in the new coordinate system.

    3,2,1)()()3(3)2(2)1(1

    i

    xy

    xy

    xy

    xy

    x ijij

    iiii

    geeeer [15]

    In the last expression, we use the summation convention over the repeated index j. The three base vectors defined in equation [15] are the equivalent of the usual unit vector that we have in our Cartesian coordinate system. We can use these base vectors to compute the differential vector length, dr, along any path in our new coordinate system.

    3)3(2)2(1)1()(33

    22

    11

    dxdxdxdxdxx

    dxx

    dxx

    dxx

    d iiii

    ggggrrrrr

    [16]

    In the two middle terms of equation [16] we have used the summation convention the summation over repeated indices. We can write an elementary length in Cartesian space, ds, as the magnitude of the dr vector. This is the square of the magnitude of the vector, which is the absolute value of the dot product of the vector with itself.

    jiijjijijjii dxdxgdxdxdxdxddds )()()()(2)( ggggrr [17] Note that all the terms involving indices i and j have both indices repeated. Thus we sum over both indices and we have nine terms in the sum for (ds)2. The dot product of two base vectors, g(i) and g(j) is defined gij, one of the nine components of a quantity known as the metric tensor.

    From the definition of g(i) in equation [15], we can obtain a scalar equation for gij as follows. In the following, we use equation [2] that defines the orthogonality condition for the Cartesian unit vectors, e(i).

    jijijikm

    j

    m

    i

    k

    mkj

    m

    i

    km

    j

    mk

    i

    kjiij

    xy

    xy

    xy

    xy

    xy

    xy

    xy

    xy

    xy

    xy

    xy

    xyg

    332211

    )()()()()()(

    eeeegg [18]

    For example, in a cylindrical coordinate system, y1 = x1cos(x2), y2 = x1sin(x2) and y3 = x3. We have the following partial derivatives.

  • Coordinate transformations ME 692, L. S. Caretto, Spring 2002 Page 5

    100

    0)cos()sin(

    0)sin()cos(

    2

    3

    2

    3

    1

    3

    3

    221

    2

    22

    1

    2

    3

    121

    2

    12

    1

    1

    xy

    xy

    xy

    xyxx

    xyx

    xy

    xyxx

    xyx

    xy

    [19]

    Using equation [18], we can compute some of the gij components for the cylindrical coordinate system.

    1100

    0)sin()sin(

    00)cos()sin()cos()sin(

    10)(sin)(cos

    3

    3

    3

    3

    3

    2

    3

    2

    3

    1

    3

    133

    21

    221

    221

    2

    3

    2

    3

    2

    2

    2

    2

    2

    1

    2

    122

    2212212

    3

    1

    3

    2

    2

    1

    2

    2

    1

    1

    112

    22

    22

    1

    3

    1

    3

    1

    2

    1

    2

    1

    1

    1

    111

    xy

    xy

    xy

    xy

    xy

    xyg

    xxxxxxy

    xy

    xy

    xy

    xy

    xyg

    xxxxxxxy

    xy

    xy

    xy

    xy

    xyg

    xxxy

    xy

    xy

    xy

    xy

    xyg

    [20]

    The remaining, unique, off-diagonal terms, g13 and g23 can both be shown to be zero. The remaining off diagonal terms, g21, g31, and g32 are seen to be symmetric by the basic form of equation [19]. These terms will also be zero.

    When the metric tensor has zero for all its off-diagonal terms, the resulting coordinate system is orthogonal. In an orthogonal system, each base vector is perpendicular to the other two base vectors at all points in the coordinate system. The differential path length given by equation [17], which we use to define a new term, for orthogonal systems only hi = gii.

    2332

    222

    1122 )()()()()( dxhdxhdxhdxhdxdxgds iiiiii [21]

    In the equation [20] example of cylindrical coordinates, we had g11 = h1 = g33 = h3 = 1, and g22 = h2 = x1 = r. Thus the three terms in equation [21] are (dx)2, (rd)2 and (dz)2. We see that

    h2 = r multiplies the differential coordinate, d, and results in a length. This is a general result for any hi coefficient; this coefficient is a factor that takes a differential in a coordinate direction and converts it into a physical length. This factor also appears in operations on vector components for orthogonal systems. These factors are usually written in terms of Cartesian coordinates (x, y, and z) by the following equations, which are a combination of equations [21] and [18].

    2

    3

    2

    3

    2

    3

    23

    2

    2

    2

    2

    2

    2

    22

    2

    1

    2

    1

    2

    1

    21

    xz

    xy

    xxh

    xz

    xy

    xxh

    xz

    xy

    xxh

    [22]

  • Coordinate transformations ME 692, L. S. Caretto, Spring 2002 Page 6

    Now that we have an expression for the differential length in our new coordinate system, we can derive equations for differential areas and volumes. From equation [17] we see that the length of a path along which only one coordinate, say xk, changes, is given by the equation gkkdxk (no summation intended); the vector representation of this path is g(k)dxk. To get an differential area from two differential path lengths, we take the vector cross product of these two differential lengths. The vector cross product gives the product of two perpendicular components of the differential path lengths to calculate an differential area, (dS)i.

    3,2,1,,)()( )()()()(

    icyclickjisummationnodxdxdxdxd kjkjkkjj

    i ggggS [23]

    The vector that results from the cross product is in the plus or minus xi coordinate direction depending on which direction the surface is facing. The notion that i, j, and k are cyclic means that we use only the following three combinations (i = 1, j = 2, k = 3), (i = 2, j = 3, k = 1), or (i = 3, j = 1, k = 2). In order to compute the magnitude of the surface area, we need to compute the magnitude of the vector cross product |g(j) x g(k)|= |g(j) x g(k)||g(j) x g(k)|. To obtain a useful result from this definition, we need to use the following vector identity.

    ))(())(()()( CBDADBCADCBA [24] Using A = C = g(j) and B = D = g(k), gives the following result for the cross product of base vectors.

    2)()()()()()()()()()()()( ))(())(()()( jkkkjjjkkjkkjjkjkj ggg gggggggggggg [25] With this expression, we can write the magnitude of the differential surface area in direction i as follows.

    3,2,1,,)(

    )( 2

    icyclickjisummationnodxdxgggdS kjjkkkjj

    i [26]

    Next, we obtain an equation for the differential volume element in our generalized coordinate space. This is done by taking the vector dot product of differential area element in equation [23] and the differential length element normal to the area. This gives the differential volume element by the following equation.

    3,2,1,,)(

    )( )()()(

    icyclickjisummationno

    dxdxdxdV kjikji ggg [27]

    Just as we did for the differential area element, we also seek the magnitude of the vector term in the volume element equation. This requires that we find the term |g(i)(g(j) x g(k))| =

    |g(i)(g(j) x g(k))||g(i)(g(j) x g(k))|. To start this, we need the following vector identity.

    22 )()()()()( CBACBCBAACBA [28] We can use the identity in equation [24] to substitute for the term (B x C) (B x C). We can also use the following identity to substitute for the A x (B x C) term.

    )()()( BACCABCBA [28]

  • Coordinate transformations ME 692, L. S. Caretto, Spring 2002 Page 7

    Since we have only three basis vectors, we will use the following base vectors from equation [27] in equation [28]: A = g(1) , B = g(2), and C = g(3). Making these substitutions and recognizing that the dot product g(i)g(j) = gij, the metric coefficient, gives the following result.

    331221221331233211231231231231332211

    331212221313232311231213231213332211

    2312133321222

    213

    223332211

    2)3()2()1( 2)(

    ggggggggggggggggggggggggggggggggggggggggggggggg

    ggg [29]

    In rearranging equation [29], we have made use of the symmetry relationship for the metric tensor components, gji = gij, in obtaining the third line. We see that this final line is just the equation for the determinant of a 3x3 array. If we write this determinant as g, we have the following result for the volume element.

    321321 )( dxdxdxgDetdxdxdxgdV ij [30]

    The value of g is the same as the value of the Jacobian determinant in equation [10]. You can show this by writing the Jacobian determinant as a matrix and square that matrix. The components in the resulting product matrix will be the components of the metric tensor, gij. Because the determinant of a matrix product is the same as the product of the determinants of the two matrices, we have the result that J = g.

    If we return to our previous example of cylindrical coordinate systems for which g11 = g33 = 1, g22 = x12 = r2, and g12 = g21 = g13 = g31 = g23 = g33 = 0, the value of g is simply the product of the diagonal terms which is equal to x12 or r2 in the conventional notation. For this system, equation [30] for dV gives the usual result for the differential volume in a cylindrical coordinate system, dV = rdrddz. Exercise: For the spherical polar system the three coordinates are x1, the distance from the origin to a point on a sphere, x2, the counterclockwise angle on the x-y plane from the x axis to the projection of the r coordinate on the x-y plane, and x3 = the angle from the vertical axis to the line from the origin to the point. (These coordinates are more conventionally called r, , and .) The transformation equations from Cartesian coordinates (y1, y2, and y3) to spherical polar coordinates are given by the following equations: x1 = y12 + y22 + y32, x2 = tan-1(y2/y1), and x3 = tan-1[ y12 + y22/y3]. The inverse transformation to obtain Cartesian coordinates from spherical polar coordinates is: y1 = x1 cos(x2)sin(x3), y2 = x1 sin(x2)sin(x3), and y3 = x1cos(x3). Find all components of the metric tensor for this transformation. Verify that this is an orthogonal coordinate system. What are the three possible differential areas for this system? What is the volume element for this system?

    Vector components in generalized coordinate systems

    The simplest vector to consider in a generalized coordinate system is the velocity vector, v, whose components are the derivatives of the coordinates with respect to time. We can define the velocity component in a particular direction, xi, by the symbol vi. The definition of vi in the arbitrary coordinate system, and its relationship to the Cartesian coordinate system is shown below, where we have used equation [11] or [12] for the coordinate transformation, substituting the notation of yi for the Cartesian coordinates.

    dtdy

    yx

    dtdy

    yx

    dtdy

    yx

    dtdy

    yx

    dtdxv k

    k

    iiiiii

    3

    3

    2

    2

    1

    1

    [31]

  • Coordinate transformations ME 692, L. S. Caretto, Spring 2002 Page 8

    We see that the terms dyi/dt on the right-hand side of equation [31] are just the velocity components in the Cartesian coordinate system. In addition, there is no particular reason to assume that the original system is Cartesian, we could equally well use the notation xi for the alternative coordinate system and the notation vi for the velocity components in that system. This gives the following equation for the transformation of velocity components from one coordinate system to another.

    kk

    iiiiiiiii vx

    xvxxv

    xxv

    xx

    dtxd

    xx

    dtxd

    xx

    dtxd

    xx

    dtdxv

    33

    22

    11

    3

    3

    2

    2

    1

    1 [32]

    This transformation equation for components of the velocity vector can be contrasted with the transformation equation for the components of the gradient vector. Equation [33] is the equation for the gradient of a scalar, A; written as A , in Cartesian coordinates.

    )()()( zyx zA

    yA

    xAA eee

    [33]

    If we denote one component of this vector as ai, we can write this component and its coordinate transformation into a new system

    kk

    i

    kk

    iiii

    ii

    ii a

    xx

    xA

    xx

    xA

    xx

    xA

    xx

    xA

    xx

    xAa

    xAa

    332211

    [34]

    If we compare equation [34] for the transformation of the components of a gradient vector with equation [32] for the transformation of the components of a velocity vector, we see that there is a subtle difference in the equations. For transforming the gradient vector from the old ai components to the new ai components, the partial derivatives of the coordinates have xi in the numerator. For the transformation of the velocity components from the old coordinate system, vi, into the vi components of the new system, the old coordinates, xi, appear in the denominator. It thus appears that we have two different equations for the transformation of a vector.

    What we have, in fact, is two different kinds of vectors defined by their transformation equations. A vector that is transformed from one coordinate to system to another using equation [32] is called a contravariant vector. One that transforms according to equation [34] is called a covariant vector. (You can remember these names by if you remember that covariant vectors have transformation relations for vector components in which the old coordinates are collocated with the old vector components in the numerator of the transformation. The transformation relations for contravariant vectors have the old coordinates and the old vector components located in the opposite locations old vector components in the numerator and old coordinates in the denominator.) In accordance with these names we call the velocity a contravariant vector and the gradient a covariant vector.

    Although there are naturally two types of vectors, according to their transformation relationships, these differences disappear for an orthogonal coordinate system. In addition, one can express a covariant vector by its contravariant components and vice versa. The covariant vector components represent the components along the coordinate lines. The contravariant components represent the components along normal to a plane in which the coordinate value is constant. A vector, such as velocity, always has the same magnitude and direction at a given location in a flow. The only thing that varies in different coordinate systems is the say in which we choose to represent the vector. In an orthogonal system, only our choice of coordinate system changes the representation of the vector. In a nonorthogonal system we choose not only the

  • Coordinate transformations ME 692, L. S. Caretto, Spring 2002 Page 9

    coordinate system, but also whether we want to represent the vector by its covariant or contravariant components.

    Although much of the original work on boundary fitted coordinate systems used different representations of velocity components, most current day approaches used a mixed formulation. The coordinate system is nonorthogonal, but we use Cartesian vector components. This is like using a r--z coordinate system, but leaving the velocity components as vx, vy, and vz. This is not a wise choice, but it is possible. When we are dealing with complex boundary-fitted coordinate systems, the use of Cartesian vector components does produce simpler results for the CFD calculations.

    Transforming the basic equations

    The analysis of boundary-fitted coordinates usually starts with the equations in a Cartesian basis (x, y, z) and speaks of a transformation of a dimensionless coordinate system (, , ). This is sometimes represented as a transformation from a Cartesian system (x1, x2, x3) to the dimensionless system (1, 2, 3). The latter form of the transformation allows the use of the summation convention. The task of determining the new coordinate system is the task of finding the appropriate transformations = (x, y, z), = (x, y, z), and = (x, y, z). (These transformations can be compactly written as the vector transformation, = (x).) The transformations convert our known geometry (in x, y, z space) into a computational space whose coordinates are , , . The task of finding a grid transformation, which is discussed below, is one of finding Cartesian coordinate values for each grid point defined in -- space, such that the x-y-z boundary coordinates of geometry being modeled becomes coordinate boundaries for the computational grid. The resulting grid requires us to transform the general equations into the transformed coordinates , , (or 1, 2, 3 to invoke the convenience in derivations allowed by the summation convention.) In order to complete the transformation of our balance equation, we must first obtain some relations among the derivatives of coordinate systems.

    The relations among the derivatives are found by rewriting the general equations [11] and [12] in terms of the particular coordinate scheme described here. Those equations express the fact that a differential change in any of the xi coordinates in the original coordinate system can cause a differential change in one of the i coordinates. The general equation for di is given below.

    3,2,133

    22

    11

    idxx

    dordxx

    dxx

    dxx

    d jj

    ii

    iiii

    [35]

    In the second form of equation [35], there is an implied summation over the repeated j index. Equation [35] applies for i = 1, 2, and 3.

    If we looked at the inverse problem of determining the differential changes in our original coordinate system (x1, x2, x3), from differential changes in the (1, 2, 3) coordinate system, we would have the following analog of equation [35].

    jj

    ii

    iiii d

    xdxordxdxdxdx

    33

    22

    11

    [36]

  • Coordinate transformations ME 692, L. S. Caretto, Spring 2002 Page 10

    We can write both equations [35] and [36] as matrix equations to show that the partial derivatives,

    j

    ix

    andi

    j

    x

    are related to each other as components of an inverse matrix. In matrix form,

    equation [35] becomes.

    3

    2

    1

    3

    3

    2

    3

    1

    3

    3

    2

    2

    2

    1

    2

    3

    1

    2

    1

    1

    1

    3

    2

    1

    dxdxdx

    xxx

    xxx

    xxx

    ddd

    [37]

    Converting equation [36] to matrix form gives the following result.

    3

    2

    1

    3

    3

    2

    3

    1

    3

    3

    2

    2

    2

    1

    2

    3

    1

    2

    1

    1

    1

    3

    2

    1

    ddd

    xxx

    xxx

    xxx

    dxdxdx

    [38]

    Equations [37] and [38] can only be correct if the two three-by-three matrices that appear in these equations are inverses of each other. That is, the partial derivatives are related by the following matrix inversion.

    1

    3

    3

    2

    3

    1

    3

    3

    2

    2

    2

    1

    2

    3

    1

    2

    1

    1

    1

    3

    3

    2

    3

    1

    3

    3

    2

    2

    2

    1

    2

    3

    1

    2

    1

    1

    1

    xxx

    xxx

    xxx

    xxx

    xxx

    xxx

    [39]

    If a matrix, B, is the inverse of a matrix, A, the components of b are given by equation [40]. In that equation, Mij, denotes the minor determinant which is defined as follows. If A is an n-by-n matrix, it has n2 minor determinants, Mij, which are the determinants of the (n-1) by (n-1) matrices formed if row i and column j are deleted from the original matrix. The minor determinant is used to define the cofactor, Aij = (-1)i+jMij. The components of the inverse matrix are defined in terms of this cofactor and the determinant of the original matrix, A.

    )(

    )1()(

    ,1ADetM

    ADetA

    bABFor jiji

    jiij

    [40]

    The matrix on the right hand side of equation [39] has the same form as the Jacobian determinant defined in equation [10]. Thus the determinant of this matrix is the Jacobian, J. With this expression for the cofactor, we can write the following nine equations for the inverse components

  • Coordinate transformations ME 692, L. S. Caretto, Spring 2002 Page 11

    from equation [39]. These derivatives are called the metric coefficients for the transformation. In the equations below we write these coefficients in both the general form with numerical subscripts and using the (x, y, z) and (, , ) notation. The final term in each equation is an alternative notation for partial derivatives.

    J

    yzzyyzzyJx

    orxxxx

    Jx

    113

    2

    2

    3

    3

    3

    2

    2

    1

    1 [41a]

    J

    zxzxzxzxJy

    orxxxx

    Jx

    113

    3

    2

    1

    2

    3

    3

    1

    2

    1 [41b]

    J

    yxyxyxyxJz

    orxxxxJx

    112

    2

    3

    1

    3

    2

    2

    1

    3

    1 [41c]

    J

    zyzyzyzyJx

    orxxxx

    Jx

    113

    3

    1

    2

    1

    3

    3

    2

    1

    2 [41d]

    J

    zxzxzxzxJy

    orxxxx

    Jx

    111

    3

    3

    1

    3

    3

    1

    1

    2

    2 [41e]

    J

    yxyxyxyxJz

    orxxxxJx

    111

    2

    3

    1

    3

    2

    1

    1

    3

    2 [41f]

    J

    zyzyzyzyJz

    orxxxxJx

    111

    3

    2

    2

    2

    3

    1

    2

    1

    3 [41g]

    J

    zxzxzxzxJy

    orxxxxJx

    112

    3

    1

    1

    1

    3

    2

    1

    2

    3 [41h]

    J

    yxyxyxyxJz

    orxxxxJx

    111

    2

    2

    1

    2

    2

    1

    1

    3

    3 [41i]]

    The relationships for two-dimensional flows can be found from these equations by recognizing that in such flows, there is no variation in the third dimension. This means that there is no variation of x or y with . Thus all derivative of x and y with respect to are zero. We set the derivative z = 1 for applying equation [41] to two-dimensional flows. This is equivalent to assuming a coordinate transformation of z = for such flow geometries. The results of converting equations [41a], [41b], [41d] and [41e] to two-dimensional forms are shown below

    Jyy

    Jxorx

    Jx

    112

    2

    1

    1 [42a]

  • Coordinate transformations ME 692, L. S. Caretto, Spring 2002 Page 12

    Jxx

    Jyorx

    Jx

    112

    1

    2

    1 [42b]

    Jyy

    Jxorx

    Jx

    111

    2

    1

    2 [42c]

    Jxx

    Jyorx

    Jx

    111

    1

    2

    2 [42d]

    (Note that equation [41i] is correct. The left hand side, z, is equal to one. The terms in braces on the left-hand side are just the definition of the Jacobian, J, for the two-dimensional case. Thus both sides of equation [41i] are equal to one in the two-dimensional case.)

    We are now ready to transform the balance equations into our computational space. To carry out this grid transformation we recognize that a change in any of the transformed coordinates can be reflected as a change in any of the original coordinates. Thus we write the following equation to convert first derivatives in our Cartesian coordinate system (with respect to any Cartesian coordinate, xi) to first derivatives in transformed space.

    3,2,1

    ixx

    orxxxx ji

    j

    iiiii

    [43]

    The second form of this equation has an implied summation over the repeated j index. We first apply this to the convection terms, where we write Fi = ui. In transformed space the convection terms, with the summation convention, are written as follows.

    j

    i

    i

    j

    i

    i Fxx

    FxF

    xF

    xF

    3

    3

    2

    2

    1

    1 [44]

    This equation can be converted into an alternative form by first multiplying by the Jacobian of the transformation, J, and writing the resulting AdF term as d(FA) FdA. This gives the following result.

    i

    j

    ji

    i

    ji

    jj

    i

    i

    j

    i

    i

    xJF

    xJF

    Fx

    JxF

    J

    [45]

    The summation over the two repeated indices in the final term gives nine separate terms for the transformed convection equation. We can show that the final term, multiplied by Fi is zero for each value of i by using the metric coefficient relationships in equation [41]. We first get the following result for i = 1, using equations [41a], [41d], and [41g].

    1

    3

    2

    2

    2

    3

    1

    2

    33

    3

    1

    2

    1

    3

    3

    2

    2

    3

    2

    2

    3

    3

    3

    2

    2

    11

    3

    31

    2

    21

    1

    11

    xxxxxxxx

    xxxxx

    Jx

    Jx

    Jx

    J jj [46]

  • Coordinate transformations ME 692, L. S. Caretto, Spring 2002 Page 13

    Carrying out the indicated differentiations gives the combination of mixed, second-order partial derivatives shown below. Each of these derivatives occurs two times, once with a plus sign and once with a minus sign. (The order of differentiation is also different, but mixed second order derivatives are the same regardless of the order of differentiation.) A letter below the term with a plus or minus sign indicates the matching terms that cancel. For example, the term labeled (+A) has a plus sign in the equation that cancels the term labeled (-A).

    )()()()(

    )()()()(

    )()()()(

    13

    32

    2

    2

    23

    32

    1

    2

    1

    3

    23

    22

    2

    3

    13

    22

    32

    32

    1

    2

    12

    32

    3

    2

    3

    3

    12

    22

    1

    3

    32

    22

    31

    22

    2

    3

    31

    32

    2

    2

    3

    2

    21

    32

    3

    3

    21

    22

    1

    CFED

    xxxxxxxxFBAE

    xxxxxxxxDCBA

    xxxxxxxxx

    J jj

    [47]

    This shows that the

    i

    j

    ji x

    JF

    term in equation [45] is zero when i = 1. The proof that this term is zero for i = 2 and i = 3 follows the same approach used above and is left as an exercise for the interested reader. With all these terms zero, equation [45] gives the following result for the transformed convection terms.

    i

    ji

    jj

    i

    i

    j

    i

    i

    xJF

    Fx

    JxF

    J

    [45]

    Recall that Fi = ui; we can define the velocity, UK as follows.

    3

    32

    21

    1 xu

    xu

    xu

    xuU jjj

    i

    jij

    [46]

    This equation has the same form as equation [32] that defined the general transformation for velocity components. At that point, we noted that the velocity was a contravariant vector, which meant that the direction of the component Uj is was perpendicular to a surface where the ith coordinate is constant. This contravariant velocity component appears naturally in the transformed equations. However, we can still replace the general transport variable, , by our choice of velocity components when we write the momentum equations. With this definition of Uj, the convection terms in our momentum equation become.

    j

    j

    i

    i

    i

    i UxuJ

    xFJ

    [47]

    The transformed convection terms, except for the new definition of Uj in placed of the usual Cartesian velocity components, have the same form as those in the original equations.

  • Coordinate transformations ME 692, L. S. Caretto, Spring 2002 Page 14

    The next step is the transformation of the second-derivative diffusive terms. We can use the result obtained above in equation [45], if we change the definition of Fi to apply to the second derivative terms.

    iii

    i

    ii xxx

    Fthatso

    xFDefine

    )()( [48]

    The result in equation [45] did not depend on the definition of Fi; it only depended on the fact that

    there was an implied summation over all three components of Fi in the i

    i

    xF

    term. Thus, we can

    apply equation [45] to the definition of Fi in equation [48] to obtain the following result.

    i

    j

    iji

    ji

    jiii

    i

    xxJ

    xJF

    xxJ

    xF

    J

    )()( [49]

    To complete the transformation of the second derivative terms, we have to replace the remaining first derivative of in by derivatives with respect to the transformed coordinates, i. We use equation [41] for the transform of this first derivative to obtain the following result.

    i

    j

    ki

    k

    ji

    i

    ki

    k

    i xxJ

    xFJthatso

    xx

    )( [50]

    We use the index, k, for the second implied summation index to get the result that there are three repeated indices in the final version of equation [50]. We can simplify the notation of this problem by defining the coefficient Bkj as follows.

    332211 xxxxxxJ

    xxJB jkjkjk

    i

    j

    i

    kkj

    [51]

    With this definition we can rewrite equation [50] as follows.

    kkj

    ji

    i BxF

    J

    )( [52]

    With the transformed convection and diffusion terms (in equations [47] and [52], the general balance equation, in transformed coordinates, becomes,

    )()(

    JSB

    xU

    tJ

    kkj

    ji

    i

    [53]

    The second derivative term in this equation, after application of the summation convention, has nine separate terms. Three of them are pure second derivatives, which we are used to seeing in our general transport equation. The other six are mixed, second-order derivatives. In implicit finite-difference approaches, these mixed terms are usually treated explicitly. The coefficients Bkj, which are related to, but not the same as, the metric tensor coefficients, gij in equation [18], are zero for orthogonal grids if k j. These Bkj coefficients with k j that multiply the mixed second-

  • Coordinate transformations ME 692, L. S. Caretto, Spring 2002 Page 15

    derivative terms, can cause convergence problems is the grid angles are far from orthogonal or if there are large aspect ratios for the grid cells.

    The grid spacing on the computational grid is usually taken as 1; i.e., = = = 1. At each point on the computational grid we will have a known value of x, y, and z. A grid generation program determines the relationship between these actual coordinates and the dimensionless computational grid coordinates. The x, y, and z values at the dimensionless coordinates are used to compute the partial derivatives that appear in the definition of U (defined in equation [46]) and

    Bkj, defined in equation [51]. These equations require the evaluation of i

    j

    x

    . Because the

    computational grid has , , and as the independent variables, we cannot evaluate these derivatives directly. Instead, equation [41] is used to relate

    i

    j

    x

    to derivatives of the formj

    ix

    ,

    which are evaluated using conventional, second-order, finite-difference expressions such as the ones shown below.

    22

    1,,1,,,,1,,1 kjikjikjikji yyyxxx [53]

    Transport equations like equation [53] can be done by finite difference methods using conventional finite-difference forms.

    An alternative approach to nonorthogonal grids uses a finite volume approach with a coordinate system that handles grid transformations locally. This requires an analysis of the specific geometry of a typical grid cell.

    These notes have not considered the problems of grid generation, which is an entirely separate topic.