Sei sulla pagina 1di 10

Elliptic Grid Generation

Ryan Fuld
ME5110-100
Dr. Fouladi
Villanova University

March 28, 2008

I. Problem

In the computational analysis of fluid motion, proper discretization is necessary in order to obtain
valid simulations. In doing so, different methods exist; the most useful and accurate results come
about via partial differential equations. If these partial differential equations are transformed into
finite difference equations, explicit solutions can be found for physical coordinates occurring in
dimensions of interest. Of course, one incarnation of these equations are elliptic equations, which
are useful particularly when physical boundaries of the domain are specified.

Starting with an algebraic grid, generate an elliptic grid about the upper surface of the airfoil
shown in Fig 9-28 in the textbook. Points are clustered in j direction near the lower surface
(using =1.05 in algebraic grid). Make sure the number of points in i and j are flexible.

Using a predetermined algebraic grid, an elliptic grid can be generated in order to fine tune the
results for airfoil flow. Coding an algebraic grid necessitates an accounting for the geometry of the
airfoil, as well as clustering via appropriate equations. Once these issues are addressed, partial
differential equations can be utilized in order to generate an elliptic grid.


II. Introduction, Theory, & Formulations

A key component of grid generation is the conversion from the physical domain to the
computational domain, in order to allow for equidistant grid lines in rectangular form. In
considering a simple two dimensional case, physical coordinates x and y must be converted to
computational coordinates and . These computational coordinates are furthermore known via
the rectangular grid relations. As a result, they must be converted back into physical coordinates in
order to be of use. For the particular case concerning an airfoil placed on the x axis, the following
relationships exist:

1
= x


1 )) 1 /( ) 1 ((
)) 1 /( ) 1 (( ) 1 ( ) 1 (
1
1
+ +
+ +
=



H y

As can be seen, Eq. (1) simply states that the x coordinate is the coordinate, as there exists no
irregularities to alter that axis. The precise relationship in Eq. (2) is due to a required clustering near
the bottom surface. Here, represents the clustering parameter, which is given, and H represents
the total height along the y axis. However, this does not account for the geometry of the airfoil,
wherein its top surface coordinate is a function of the distance along the x axis. The exact equation
is:

) 1015 . 0 2843 . 0 3516 . 0 126 . 0 2969 . 0 (
2 . 0
4 3 2 2 / 1
x x x x x
t
y + =

Here, y represents the max height of the airfoil, which would thus be the correspond to y=0 in Eq.
(2). Height is determined by subtracting this value from maximum height. This allows a total
expression for the grid y coordinative can be obtained. Note that the x used in Eq. (3) assumes 0 at
the nose of the airfoil and 1 at the tail. The previous equations effectively define all that is needed to
generate an algebraic grid. However, this grid will simply be used as a starting point for the
generation of an elliptic grid. Thus, once x and y are obtained algebraically, they will be set as initial
conditions for the x and y values used in order to perform iterations of the developed finite
difference equations.

Two elliptic partial differential equations must be solved in order to fully define the desired grid. In
doing this, boundary conditions are required. For this case, x and y values along the edges of the
defined physical domain will be left in place. These being predefined allows all interior coordinates
to be developed. The following system of elliptic partial differential equations can be used to define
the domain:

0 = +
yy xx


0 = +
yy xx


Here, the subscripts denote second order derivative of that variable. Notice that these equations do
not express x and y as dependent variables. Rather, they are treated as the independent variables,
requiring a transformation. When such a mathematical transformation is preformed, Eqs. (4) and
(5) become, respectively:

0 2 = +

x c x b x a

0 2 = +

y c y b y a

(3)
(1)
(2)
(4)
(5)
(6)
(7)
2
R. Fuld
where

2 2

y x a + =


y y x x b + =

2 2

y x c + =

The previously stated equations must all be expressed in terms of finite differences. Once this is
done, x and y at each grid point can be found through iterations. Expanding Eqs. (8) through (10)
explicitly in central space, yields:

2
1 ,
1
1 ,
2
1 ,
1
1 ,
2 2

=

+
+
+
+

j i
s
j i
s
j i
s
j i
s
y y x x
a

=

+
+
+
+
+
+
+
+
2 2 2 2
1 ,
1
1 , , 1
1
, 1 1 ,
1
1 , , 1
1
, 1 j i
s
j i
s
j i
s
j i
s
j i
s
j i
s
j i
s
j i
s
y y y y x x x x
b

2
, 1
1
, 1
2
, 1
1
, 1
2 2

=

+
+
+
+

j i
s
j i
s
j i
s
j i
s
y y x x
c

Here, the superscript, s, indexes the iteration, where s is the current iteration and s+1 is the
following iteration. These equations are written this way due to the fact that points above and to the
right of the point being evaluated are unknown, and, thus, old values must be used. The same
procedure of finite differencing can be applied to Eqs. (6) and (7). However, results from these will
be of the same form; that is, only the terms x and y will be different. Considering the expansion of
Eq. (6) yields:

( )
( )
0
2
4
2
2
2
1 ,
1
,
1
1 ,
1 , 1
1
1 , 1 1 , 1 1 , 1
2
, 1
1
,
1
, 1
=

+
+

+ +
+

+
+ + + +
+ +
+


j i
s
j i
s
j i
s
j i
s
j i
s
j i
s
j i
s
j i
s
j i
s
j i
s
x x x
c
x x x x
b
x x x
a


This equation can then be explicitly solved for the value j i
s
x ,
1 +
, which is the coordinate of interest.
Doing so yields:

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


+
+ + + + +
=

+
+
+
+ + + +
+
+
+
j i
s
j i
s
j i
s
j i
s
j i
s
j i
s
j i
s
j i
s
j i
s
x x x x x x x x
x

This formula can then be implemented through coding in order to find all values of x. The
formulation is exactly the same for the y value. Through code, multiple iterations will occur until
(8)
(9)
(10)
(11)
(12)
(13)
(14)
(15)
3
R. Fuld
convergence is reached; that is, the desired x values will be found once the difference between
j i
s
x ,
1 +
and j i
s
x , is below tolerance, and the desired y values will be found once the difference
between j i
s
y ,
1 +
and j i
s
y , falls below said tolerance. These values, when plotted, should produce an
elliptic grid that can be utilized to determine flow within the domain containing the airfoil.


III. Script

A MATLAB script was developed in order to generate the elliptic grid using the developed
equations. In the script, the total number of grid points in each direction is a user-defined input,
allowing for flexibility concerning fineness of the grid. Once these numbers are entered, the script
executes, plots the grid, and displays the total number of iterations to the screen. Algebraic results
were used for initial and boundary conditions in the elliptic grid. Comments are included in the
script which outline the processes being preformed.

%El l i pt i c Gr i d Gener at i on
%Wr i t t en by Ryan Ful d, 04. 02. 08

f unct i on pr oj 4b

cl ear ;
cl c;

%Assi gn val ues f or t and bet a
t =0. 15;
bet a=1. 05;

%Pr ompt user f or number of gr i d poi nt s
n=i nput ( ' Ent er t he number of gr i d poi nt s i n t he i di r ect i on: ' ) ;
m=i nput ( ' Ent er t he number of gr i d poi nt s i n t he j di r ect i on: ' ) ;

%Cr eat e zer oes mat r i x f or sur f ace pl ot s
z=zer os( n, m) ;

%Assi gn l engt hs and val ues f or et a and xi
L=3;
et a=l i nspace( 0, 1, m) ;
xi =l i nspace( 0, L, n) ;

%x i s equal t o xi
X=xi ;

%Fi nd hei ght
yt op=2;

f or i =1: n
i f X( i ) < 1
ybot t om( i ) =0;
el sei f X( i ) > 2
ybot t om( i ) =0;
el se
4
R. Fuld
x2( i ) =X( i ) - 1;
ybot t om( i ) =( t / . 2) *( 0. 2969*x2( i ) ^. 5- 0. 126*x2( i ) -
0. 3516*x2( i ) ^2+0. 2843*x2( i ) ^3- 0. 1015*x2( i ) ^4) ;
end
H( i ) =yt op- ybot t om( i ) ;
end

%Loop t o cal cul at e coor di nat es
zet a=bet a+1;
gamma=bet a- 1;
al pha=zet a/ gamma;

f or i =1: n
f or j =1: m
chi =1- et a( j ) ;
y( i , j ) =H( i ) *( zet a- gamma*al pha^chi ) / ( al pha^chi +1) +ybot t om( i ) ;
x( i , j ) =X( i ) ;
end
end

f i gur e( 1) ;
sur f ace( x, y, z) ;

%El l i pt i c i ni t i al condi t i ons
xol d=x;
yol d=y;

%Cal cul at e comput at i onal st ep si zes
del t a_et a=1/ ( m- 1) ;
del t a_xi =L/ ( n- 1) ;

dx=1; %Condi t i ons t o st ar t l oop
dy=1; %Condi t i ons t o st ar t l oop

%Assi gn t ol er ance val ue
t ol =. 0000001;

%Nest ed l oop t o det er mi ne el l i pt i c gr i d
xdi f f =0;
ydi f f =0;
count =0;

whi l e dy > t ol | | dx > t ol
f or i =2: n- 1
f or j =2: m- 1
a1=( xol d( i , j +1) - x( i , j - 1) ) / ( 2*del t a_et a) ;
a2=( yol d( i , j +1) - y( i , j - 1) ) / ( 2*del t a_et a) ;
a=a1^2+a2^2;
c1=( xol d( i +1, j ) - x( i - 1, j ) ) / ( 2*del t a_xi ) ;
c2=( yol d( i +1, j ) - y( i - 1, j ) ) / ( 2*del t a_xi ) ;
c=c1^2+c2^2;
b=a1*c1+a2*c2;
al pha=a/ del t a_xi ^2;
bet a=- 2*b/ ( 4*del t a_xi *del t a_et a) ;
gamma=c/ del t a_et a^2;
5
R. Fuld
t het a=1/ ( 2*al pha+2*gamma) ;
phi _1=bet a*( xol d( i +1, j +1) - xol d( i +1, j - 1) - xol d( i - 1, j +1) +x( i - 1, j -
1) ) ;
x( i , j ) =t het a*( al pha*( xol d( i +1, j ) +x( i -
1, j ) ) +gamma*( xol d( i , j +1) +x( i , j - 1) ) +phi _1) ;
xdi f f =x( i , j ) - xol d( i , j ) +xdi f f ;
phi _2=bet a*( yol d( i +1, j +1) - yol d( i +1, j - 1) - yol d( i - 1, j +1) +y( i - 1, j -
1) ) ;
y( i , j ) =t het a*( al pha*( yol d( i +1, j ) +y( i -
1, j ) ) +gamma*( yol d( i , j +1) +y( i , j - 1) ) +phi _2) ;
ydi f f =y( i , j ) - yol d( i , j ) +ydi f f ;
end
end

dx=xdi f f ;
dy=ydi f f ;
xdi f f =0;
ydi f f =0;
xol d=x;
yol d=y;
count =count +1;
end

f pr i nt f ( ' The sol ut i on t ook %i i t er at i ons t o conver ge. \ n \ n' , count ) ;

f i gur e( 2) ;
sur f ace( x, y, z) ;

save pr oj 4b












IV. Discussion of Results

Plots of the elliptic grid follow.





6
R. Fuld
Fig. 1. Elliptic Grid for n=m=31
7
R
.

F
u
l
d
Fig. 2. Algebraic Grid for n=m=31
8
R
.

F
u
l
d
Fig. 3. Elliptic Grid for n=m=101
R
.

F
u
l
d
9
Results obtained successfully portrayed the type of grid expected, as can be seen in Fig. 1. Here, the
number of grid points in both the i and j direction were set to 1. Comparing Fig. 1 and Fig. 2 allows
additional observations to be made, as Fig. 2 displays the algebraic grid generated for the same
number of grid points in both directions as in Fig. 1. Grid lines have been smoothed out due to the
elliptic equations, eliminating extreme jaggedness resulting from the algebraic grid. This would
ensure a more accurate flow model. Notice, however, that only the lines in the horizontal direction
have been modified. The vertical lines remain completely straight, meaning there was no
modification at all. Reasons for this are very apparent when examining Eq. (6). Since the physical
coordinate x is essentially equal to the computational coordinate , x is not a function of ; thus, the
partial derivative of x with respect to is zero. Furthermore, the partial derivative of x with respect
to can be written as a total derivative, and, of course, it is equal to one. This consequentially
means the respective second order derivative is equal to zero. This essentially causes all terms in Eq.
(6) to go to zero, meaning that no information is provided via this equation. As a result, scripting
would have been more efficient if all lines of code to calculate x were removed from the elliptic
portion of the script.


An additional grid is presented in Fig. 3, wherein a larger number of grid points were used. Here,
101 grid points were used in both the i and j directions. As can be seen, the grid is much more fine,
and the airfoil geometry is more accurate. Perhaps of greater interest when examining this case is
the convergence. For the case when 31 points was used in both directions, the following displayed:

Ent er t he number of gr i d poi nt s i n t he i di r ect i on: 31
Ent er t he number of gr i d poi nt s i n t he j di r ect i on: 31
The sol ut i on t ook 1549 i t er at i ons t o conver ge.

The iterations here are relatively high; this is likely due to the very low tolerance set, which was
0.0000001. Increasing this tenfold or one hundredfold would have likely sufficed, lessening
convergence time. Now, for 101 points in each direction, the following results were obtained:

Ent er t he number of gr i d poi nt s i n t he i di r ect i on: 101
Ent er t he number of gr i d poi nt s i n t he j di r ect i on: 101
The sol ut i on t ook 17202 i t er at i ons t o conver ge.

Convergence here is much higher than in the other case, supporting the fact that such a fine grid
was unnecessary. The geometry of the airfoil for the previous grid, as well as the spacing would
likely have sufficed for flow simulation.

Also notice that generation of the elliptic grid removed clustering from the surface that was created
through the algebraic grid. In order to cluster here, the right hand side of Eqs. (6) and (7) must not
be equal to zero, so that clustering functions could be implemented.


V. Conclusion

Overall, an elliptic grid was shown to provide desired results for discretization. It succeeded in
smoothing out otherwise rough edges created through algebraic grid generation. At the same time,
the algebraic grid provided a suitable starting point for the generation of the elliptic grid.
10
R. Fuld

Potrebbero piacerti anche