Problem Statement

ADJOINT EQUATIONS OF QUASI 1-D EULER
EQUATIONS
Third Year Summer Training
Project
By
Nikita Thakur
Under the guidance of
Prof. K. Sudhakar
Department of Aerospace Engineering,
Indian Institute of Technology, Bombay
June, 2004.
Certificate
Certified that this project report titled “Adjoint Equations of Quasi 1-D
Euler Equations” by “Nikita Thakur” is approved by me for submission.
Certified further that, to the best of my knowledge, the report presents work
carried out by the student.
Date:
29-06-2004
Prof. K. Sudhakar
(Guide)
ii
Acknowledgement
I would like to express my heartfelt gratitude to Prof. K. Sudhakar for his help
and guidance throughout the project work. His cheerful countenance, inspiring
discussions and in-depth knowledge of the subject helped me a lot. I would also like to
thank Prof. A. G. Marathe and Devendra Ghate for their immense support and guidance
during the course of the project.
Date : June 29, 2004
(Nikita Thakur)
iii
Contents
Contents
iv
List of Figures
v
Nomenclature
vi
Abstract
vii
1 Introduction
1
2 Quasi 1-D Euler Solver
2
2.1 Problem Statement……………………………………………………………..2
2.2 Scheme Used…………………………………………………………………...4
2.3 Time Step Calculation………………………………………………………….5
2.4 Initial and Boundary Conditions……………………………………………….5
2.5 Source Term……………………………………………………………………6
2.6 Results………………………………………………………………………….7
3 Duct Optimization
10
3.1 Problem Statement ……………………………………………………………..11
3.2 Adjoint Equations………………………………………………………………12
Appendix
14
References
16
iv
List of Figures
2.1 Geometry Definition
2.2 Variation of velocity with distance
2.3 Mach Number Plot
2.4 Total Temperature Plot
2.5 Total Pressure Plot
3.1
O
Vs plot as obtained from the solver

v
Nomenclature

-
Fluid density
u
-
Fluid velocity
p
-
Fluid static pressure
A
-
Cross-sectional area of duct
x
-
Position along the streamwise direction
Ax
-
Differentiation of cross-sectional area with respect to x
H
-
Enthalpy
U
-
Vector of conserved quantities
F
-
Flux vector
G
-
Source term vector

-
Adjoint vector
vi
Abstract
The objective of the report is to study the Adjoint equation of quasi 1-d Euler equation.
The analysis of quasi 1-d Euler equation has been done followed by duct optimization.
The term ‘optimization’ refers to the fact that one is trying to find the geometry which
minimizes some objective function. This information is used in gradient based
optimization. Since the calculation of gradients is often the most costly step in the
optimization cycle, using efficient methods that accurately calculate sensitivities are
extremely important. Adjoint equation method is one of these methods.
vii
Chapter 1
INTRODUCTION
Sensitivity analysis consists in computing derivatives of one or more quantities (outputs)
with respect to one or several independent variables (inputs). Our main motivation is the
use of this information in gradient-based optimization. When choosing a method for
computing sensitivities, one is mainly concerned with its accuracy, computational
expense and easy implementation. Adjoint equation method. Optimal design methods
involving the solution of an adjoint system of equations are an active area of interest in
computational fluid dynamics. The goal of aerodynamic design optimization is the
minimization of an objective function that is a non-linear function of a set of discrete
flow variables.
Thorough understanding of the problem to be solved through adjoints is aided to large
extent by understanding the analysis cycle before proceeding with the design process.
This is exactly that has been done in the project. The analysis of the quasi 1-d Euler
equation preceeds duct optimization. Once the solution obtained through the analysis of
the flow is validated with standard results, the expressions in adjoints for duct
optimization are derived for the Euler equations.
The gradients to be used in optimization are derived from the solution of the solver first
and then compared with the gradients obtained from adjoint equations. Similar values of
gradients obtained from the two solving processes verify the correctness of the solution
through adjoint equations. While verifying our results, the value of the minimum gradient
obtained from the results of the solver with variation in the selected design parameter, is
taken into account .
viii
Chapter 2
QUASI 1-D EULER SOLVER
2.1 Problem Statement
The problem involves development of a quasi-1D Euler solver for Mach number between
0.4 to 0.6. The Quasi 1-D Euler equations in the steady form are,
dF
G  0
dx
(1)
 u

 u 
A




where, F  ( u 2  p ) , G  x  u 2 
A
 uH

 uH 




(2)
The unsteady form of Quasi 1-D Euler equation is given below,
dU dF

G  0
dt
dx
(3)
 
where, U   u 
 e 
(4)
All the symbols in the Euler equations have their usual meaning.
The steady state Quasi 1-D Euler Equations are also given by the expression :
dF1
 G1  0
dx
(5)
where,
 Au



2
F1 =  A( u  p)
 AuH



and
G1 =
0 
 A p
 x 
0 
(6)
For ease of calculations and to reduce the complexities introduced by the source term, we
have used expression (5) instead of expression (1). It may be noted that the elements of
the matrix G1 are much simpler than the elements of the matrix G.
ix
The equivalence of expressions (1) and (5) can be shown in the following manner :
dF1/dx - G1 = 0
 Au

0 
d 

2
A( u  p) _  Ax p   0


dx
 AuH

0 


 u

 Ax  u 2 
 uH


 u
d  2

p   A  u 
dx

 uH



0 

p   Ax  p   0

0 

Rearranging the terms, we get,
 u
d  2

u 
dx 
 uH



 u 
 Ax  2 
p 
u   0
A 

 uH 



dF
G  0
dx
Hence, our Unsteady state Quasi 1-D Euler equation now becomes,
U F

G  0
t
x
or,
U F

G
t
x
 Au

 


where, U   u  , F   A( u 2  p ) ,
 AuH

 e 


0 
G   Ax p 
0 
(7)
This expression has been solved for a duct of geometry as depicted in fig. 1. Expression
(8) following fig. (1) defines the geometry of the duct used.
x
Fig. 2.1 Geometry Definition
The geometry definition function is as follows:
=2
A(x,  ) =1 + sin(pi*x)*sin(pi*x) +  *x*(x*x – 0.25)*(x*x – 0.25)
=2
-1 > x > -0.5
-0.5 > x > 0.5
0.5 > x > 1
---(8)
2.2 Scheme Used:
The solver has been written using finite difference method. It uses the predictor-corrector
MacCormack Scheme which is defined as follows :
U i  U in 
t
( Fi n1  Fi n )  tGin
x
(9)
U i  U in 
t
( Fi  Fi 1 )  t Gi
x
(10)
For expressions (8) and (9), U, F and G carry their usual meanings for the Euler equations
(7), n represents the time, i represents the cell index, t represents the time step and,
x represents the distance between two cell centers.
Updating gives,
U in 1 
1
(U i + U i )
2
The scheme is forward difference in time and central difference in space.
The time step for the scheme is used using the appropriate CFL number and wave
velocity as discussed in the next section.
xi
2.3 Time Step Calculation:
For a given CFL value, the time step t is given as,
t  CFL * x / velocitymax
where, x  ( xmax  xmin ) / N .
In the given case, xmax = 1,
xmin = -1,
and, N = number of cells.
We have three values (Eigen values) of wave speeds at each cell equal to u+a , u , and ua. For more accurate results, we need the minimum value of time step t . Since we are
selecting the same time step for all cells, we choose the minimum t so that it can be
applicable to all the cells. Taking a large time step results in loss of information and an
unstable solution. In conclusion, we can state that we are using global time stepping for
time-accurate solutions. Therefore, we require maximum value of wave velocity since t
is inversely proportional to the value of wave velocity. The maximum value of wave
velocity at each node is u+a. As a consequence, for each iteration, we refer to the
maximum value of u+a at any node which is labeled as (velocity)max. This is the value of
velocity that is used in calculating the value of minimum time step(global time step). A
suitable value of CFL number is assumed in accordance with the conditions of the
problem.
The initial and boundary conditions have been so selected that the three characteristic
waves can be easily captured.
2.4 Initial and Boundary Conditions :
Initial Conditions:
The initial conditions specified for the duct are such that the velocity increases linearly
from the inlet towards the throat of the duct and then decreases linearly from the throat
towards the outlet. The value of velocity at the outlet is equal in value at the inlet. This
has been done to compensate for the abrupt and steep area variation in the area of the
duct as we move from the inlet to the throat and then towards the outlet. A constant
initialization of the parameters at all the node points results in an unstable solution.
xii
Fig. 2.2 Variation of velocity with distance
Boundary Conditions :
 The values of total pressure (P0) and total temperature (T0) have been specified at
the inlet.
 The value of static pressure has been specified at the outlet (pstatic).
 At the outlet boundary, the values of the other parameters have been extrapolated
from interior such that U N  2U N 1  U N 2 where U is the property at the cell and
N is the cell index.
The value of source term used for the domain is as discussed below.
2.5 Source Term:
The value of the source term as in the original expression is :
0 
G   Ax p  .
0 
However for stability of solution we have replaced the source term by :
0


G   Ax ( Pi 1  2 Pi  Pi 1 ) / 4
0

xiii
i.e. we are taking the average of the pressure values at a particular cell with cell index “i”,
in order to obtain a stable solution.
2.6 Results:
The plot for Mach number variation vs duct length is shown in the figure below. The
green curve represents the analytical solution and the red curve represents the
computational solution. It is observed that the mach number distributions are acceptably
close to each other for the analytical and computational solutions. A slight difference
between the two curves is observed only at the throat of the duct. Hence, the solution is
validated.
M
Duct Length [-1, 1]
Fig. 2.3 Mach Number Plot
The Mach number varies from approximately 0.3 at the inlet to 0.8 at the outlet. Since the
flow is subsonic, the value of Mach number in the results is within the subsonic region. It
is expected that the value of velocity and hence the Mach number will rise at the throat
due to the decrease in area and then fall down to a constant value at the region near the
outlet where the area is constant.
xiv
The static pressure, density, and temperature are expected to fall steeply from a constant
value near the inlet to a minimum value and back to a constant value at the outlet (equal
to that at the outlet).
Fig. 2.4 Total Temperature Plot
Fig. 2.5 Total Pressure Plot
xv
The total temperature and the total pressure should have a constant value throughout the
duct length. The plots in fig. 8 and 9 show that the range of variation in total temperature
(297.965 to 298.035 K) and total pressure (103585 to 103715 N/m2) is within reasonable
limits.
Now that we’ve already performed the analysis of quasi 1-D Euler equations, we shall
proceed with the design part of the equations as described in detail in chapter 3.
We aim at duct optimization. When we optimize the duct, our input comprises of an
arbitrary value of  for which we get a duct geometry such that this duct gives a
pressure distribution closest to the desired pressure distribution along the length of the
duct, as given by expression (8).
The Adjoint equations (discussed in chapter 3) help us in determining important
information that is required as an input for the optimizer in addition to the value of the
design variable. In the upcoming section we derive the Adjoint equation of Quasi 1-D
Euler equations, the advantage of adjoint equations being reduction in computation cost
due to decrease in the number of computational steps to be performed in designing the
duct.
xvi
Chapter 3
DUCT OPTIMIZATION
In this section we aim at designing a duct with a required pressure distribution. Let us
assume that there is a duct (duct 1, with geometry definition function as given in
expression (8) ), which has the desired pressure distribution. If the geometry required for
the problem is similar to duct 1, only a particular pressure distribution curve along the
length of the duct is possible. If the required pressure distribution is different from that
for duct 1, then the geometry function for the new duct would also be entirely different.
Let us assume  as the design variable. Here  is a constant ( refer expression (8) ) on
which the geometry of the duct depends. We have numerous ducts with similar geometry
function, but with different values of  . Out of these various ducts, we require to select
that duct which would give us pressure distribution along its length closest to the desired
pressure distribution.
Let the pressure distribution along the given duct with geometry expression (8) be
represented by ‘ p ’, and the desired pressure distribution along the length of the duct be
represented by ‘ p* ’. Then we need to mathematically express a function whose value
would help us in selecting the best duct in accordance with our required pressure
distribution. This function is called the objective function. Our objective function
represents the square of the difference between p and p* as given below,
1
O   ( p  p * ) 2 dx
(11)
1
We desire to minimize the value of our objective function ‘O’. The minimum value of the
objective function helps us in selecting the best duct. By minimizing the value of ‘O’ we
are actually checking for the duct which would give us the pressure distribution ‘p’
closest to the desired pressure distribution ‘p*’ along the length of the duct.
We have assumed  as the design variable and U as the state variable. This implies that
 is the independent variable (the design variable) and U depends on the independent
variable through the solution of the governing equation.
Any perturbation in the variables in this system of equations must result in no variation of
the residuals, if the governing equations are to be satisfied.
Therefore, we can write,
O 
O
O
U 
  0 , where O is the objective function.
U

xvii
O
 0 so that the perturbation due to dependent variables can be
U
reduced to zero for ease of calculations and hence only the perturbation due to  needs
to be minimized.
We desire that
3.1 Problem Statement :
As already discussed in section 3, the objective function represents the square of the
difference between the obtained pressure variation and the desired pressure variation
along the length of the duct. The lesser the value of this difference, the better the design
of the duct. Our aim is to design a duct which would give us a minimum value of this
O
difference. Hence, we would determine the value of the expression
which would

further help us in optimizing the duct.
We would verify the correctness of the solution of Adjoint Equations, by comparing it
O
with the value of
obtained for a particular change in alpha, from the solution of the

O
quasi 1-D Euler Solver. The values of
as obtained for various values of change in

alpha from the quasi 1-D Euler Solver is plotted as follows,
Fig. 3.1
O
vs plot as obtained from the solver.

xviii
3.2 Adjoint Equations :
Reverting back to our governing equation which is given by the expression:
dF
G  0
dx
(12)
The Lagrangian functional for the above expressions is constructed.
1
1
dF
O   ( p  p * ) 2 dx    T (
 G )dx
dx
1
1
(13)
Expression (13) can further be simplified , using integration by parts as follows :
1
1
1
1
O   ( p  p * ) 2 dx   ( T
dF
  T G )dx
dx
1
1
1
 T 1 dF

d T
dF
  ( p  p ) dx   
dx  
(
dx)dx    T Gdx
dx 1 dx
1
1
1
 1 dx

1
* 2

1
  ( p  p * ) 2 dx   T F
1

1
d T
Fdx    T Gdx
dx
1
1
1
1  
1
 d T

O   ( p  p ) dx    
F   T G dx   T F
dx

1
1
1

1
* 2

1
(14)
1
The first variation of O can be obtained due to the perturbations in flow variables, U ,
and in the geometric design parameter,  ,
1
1
1
 d T F

p T
G
 T F

T G
O   2( p  p )( ) Udx    
U  
U dx  
U     T
dx
U
dx U
U
U


 1 1

1
1
(15)
O
 0 . Hence our governing equation
As already expressed in section 3 we assume that
U
now becomes:
1
*
O
p T d T F
G
 2( p  p * )(
) 
 T
0
U
U
dx U
U
With the local boundary conditions for adjoints at the inlet and outlet as,
xix
(16)
T
F
U
T
F
U
x 1
x 1
 T
F
U
k
x  1
and
0
T
F
U
x  1
 k , where k is some constant.
Finally we would determine the expression,
O
G
  T
dx
 1

1
(17)
Looking at expression (12), our governing equation is of the form,
d T
A  T B  C
dx
where, A 
(18)
F
G
p
,B 
, C  2( p  p * )
.
U
U
U
(For the elements of these
matrices refer to appendix).
d
  T BA 1  CA 1
dx
T
or ,
(19)
We shall apply the MacCormack Scheme in writing the solver for the above expression
which is nothing but the Adjoint Equation of Euler equation.
xx
Appendix
   u 1 
Let U   u   u 2  , then,
 e  u 3 
2

u2 

1) p  (  1) u 3 
2u1 

   1  u 2 2 
 2

 2  u1 
u 
p 
2)
 (1   ) 2 
U 
u1 
(  1)









u 2

 2

2

u2 
u2


 (  1) u 3 
3) F  


u
2u1 

 1



2


 u  (  1) u  u 2  u 2 
 3 2u   u 
 3
1 

 1 




F 

4)
U 

(

0
2
   3  u2

 2
 2  u1
3
u u
u2
 1) 3   2 23
u1
u1
1
(3   )
u2
u1
2
u
u
3
 3  (  1) 2 2
u1 2
u1
xxi


0 

  1

u 
 2
u1 
 A
 X
 A

A
5) G   X
 A

 A
 X
 A

u 2

2
 u 2 

 u1 
 u 3 u 2
 
 u1







3
u 
 (  1) 2 2 
2u1 


AX


0
0


A
2


G
 A u
 A  u 

6)

  X  22
2 X  2 
0
U 
 A  u1
 A  u1 

3
2
 A 
uu 
u
A  u
u 
A
u 
3
 X  (  1) 23   3 22   X   3  (  1) 2 2   X  2 
 A  
u1
u 1   A   u1 2
u1   A  u1 
xxii
References
[1] Laney Culbert B. Computational Gasdynamics. Cambridge University Press, October
1996.
[2] Anderson J.D. Computational Fluid Dynamics. Mc. Graw-Hill, Inc., 1995.
[3] Martins, Joaquim R.R.A. Sensitivity Analysis, AA222-Multidisciplinary Design
Optimization.
[4] Giles Michael B. and Pierce, Niles A. An introduction to the adjoint approach to
design.
xxiii