Ch03

  • Upload
    mivano

  • View
    214

  • Download
    0

Embed Size (px)

DESCRIPTION

nb ,b,

Citation preview

  • 2003 by CRC Press LLC

    chapter three

    The adjoint method to compute the numerical solutions of inverse problems

    Yvon Jarny

    Contents

    IntroductionModeling equations

    Direct and inverse problemsThe direct problemsThe inverse parameter problemThe inverse input problem The inverse state problem

    Example 3.1. Semi-infinite body heat conduction with surface convection

    Example 3.2. Semi-infinite body heat conduction with surface heat fluxNumerical results

    Example 3.3. Two-dimensional, steady-state conductionExample 3.4. A lumped heat conduction model

    Numerical resultsLeast squares and gradient algorithms

    The output least squares criterion Gradient algorithms

    The iterative algorithms Steepest descent methodMinimization of the LS-criterion

    Example 3.5. The quadratic caseNumerical resultsConjugate gradient algorithm

    -0861.book Page 103 Monday, August 12, 2002 6:43 PM

  • 104 Inverse Engineering Handbook

    Numerical results for the quadratic caseConclusion

    Non-quadratic caseConclusion

    Lagrange multipliersLagrangian: introductionExample 3.6. Minimization of a perimeter subjected to a

    fixed areaExtension to p variables and nc algebraic equality

    constraints (

    nc

    <

    p

    )Example 3.7. Minimization of a quadratic function: equality

    constraintsThe adjoint method

    Minimization of the LS-criterionGradient of the constrained LS-criterion

    Adjoint method with conjugate gradient algorithm to minimize LS-criterion

    Adjoint method with noisy dataThe regularized LS-criterion

    Example 3.8The iterative regularization principle

    Example 3.9The adjoint method to minimize the LS-criterion with algebraic

    modeling equationsExample 3.10

    Numerical resultsThe adjoint method to minimize the LS-criterion with

    integral modeling equation.Example 3.11

    Numerical resultsConclusion

    Adjoint method to minimize LS-criteria with ordinary differential equations as constraintsGradient of the LS-criterion with ODE as constraintGradient of the LS-criterion with both ODE and AE as

    constraintsExample 3.12. An inverse parameter problem in a solidification

    processNumerical results

    Example 3.13. An inverse input problem in a solidification processNumerical results

    ConclusionAdjoint method to minimize LS-criteria with partial differential

    equations as constraintsThe inverse parameter problem

    Gradient of the LS-criterion

    -0861.book Page 104 Monday, August 12, 2002 6:43 PM

    2003 by CRC Press LLC

  • Chapter three: The adjoint method to compute the numerical solutions 105

    Example 3.14Numerical results

    The inverse state problemGradient of the LS-criterion

    Example 3.15Numerical results

    The inverse input problemGradient of the LS-criterion

    Example 3.16Numerical results

    Gradient of the LS-criterion with elliptic PDE as constraintConclusion

    Conclusion and summary References

    Introduction

    Gradient algorithms

    combined with

    Lagrange multiplier

    techniques

    provide apowerful computational approach to compute the numerical solutions of

    inverse problems

    . This combination, the so-called

    adjoint method

    , can be usedin different situations to estimate constant as well as varying parameters orfunctions. The purpose of this chapter is to introduce some mathematicalbasic concepts useful to develop the adjoint method and to illustrate the rolethat

    modeling equations

    play in the development of the method. Standardexamples in

    heat transfer

    modeling are presented and discussed. For eachexample, numerical results can be reproduced with the included MatLabcodes.

    The chapter is divided into two parts. Part one consists of four sections.Basic modeling concepts of dynamic processes are illustrated by elementarymodels in the first of these sections, and these models are studied in thesecond part of the chapter. Some mathematical results on the minimizationof least squares (LS) criteria using gradient algorithms are briefly recalledand illustrated in the second section. The interest in using Lagrange multi-pliers techniques for finding the solution of minimization problems withequality constraints is presented in the third section. Finally, the adjointmethod to minimize LS-criteria with algebraic equations as constraints isintroduced in the last section of part one of the chapter. The computedsolutions can be very sensitive to data errors, and two very useful regular-ization techniques, which are easy to implement with the adjoint method,are presented and illustrated at the end of this fourth section.

    The second part of the chapter is devoted to the development of theadjoint method for solving inverse problems by minimizing LS-criteria. Fourkinds of modeling equations are considered, and the numerical resolutionof two kinds of inverse problems are illustrated. First, the resolution of aninverse parameter problem for a two-dimensional steady-state conductionmodel with algebraic equations (AE) as constraints is studied. Next, the

    -0861.book Page 105 Monday, August 12, 2002 6:43 PM

    2003 by CRC Press LLC

  • 106 Inverse Engineering Handbook

    solution of an inverse input problem for semi-infinite heat conduction model,with integral equation (IE) as constraint, is described. Following that, theadjoint method for solving both inverse parameter and inverse input prob-lems is developed with ordinary differential equations (ODE) as modelingequations. Two numerical examples, based on a lumped capacitance modelof a solidification process, are chosen to illustrate how to deal with the adjointmethod when nonlinear modeling equations have to be considered. Finally,the resolution of inverse problems by minimizing LS-criteria with parabolic(PDE) partial differential equations as constraints is studied. The numericalsolutions of an inverse parameter problem, an inverse state problem, and aninverse input problem are computed and discussed.

    Modeling equations

    Direct and inverse problems

    Mathematical models of dynamic processes usually involve ordinary differ-ential equations (ODE) or partial differential equations (PDE) or integralequations (IE). Sometimes these equations are reduced to a relatively simpleset of algebraic equations (AE). In any case, there are independent (time,space) and dependent variables. The dependent variables can be organizedin four distinct groups.

    The parameter The input The state The output

    The direct problems

    Mathematical models of dynamic processes are useful to analyze the behav-ior of the processes. When the input and the parameter are assumed to beknown, the resolution of the modeling equations is used to predict the modeloutput. Most frequently, analytical solutions are not available, and numericalapproximation of the solutions are determined using standard computa-tional techniques. The numerical resolution of such direct problems is not

    Modellingequations

    Input

    Initial state

    Parameter

    Measuredoutput

    Additiveerror

    Modeloutput

    FIGURE 3.1 Dynamic system block diagram.

    -0861.book Page 106 Monday, August 12, 2002 6:43 PM

    2003 by CRC Press LLC

  • Chapter three: The adjoint method to compute the numerical solutions 107

    the subject of this chapter. However, these computational aspects cannot beneglected in the development of the adjoint method, and this is why exam-ples of different kinds of modeling equations are introduced. The questionof the adequacy of the mathematical model is not discussed. So, for eachexample studied, the structure of the modeling equations is assumed to beknown and exact.

    The inverse parameter problem

    In experiments, the input and the output are measured directly, but theparameters are not. Approximate values of the parameters are inferred fromthese measurements through the modeling equations. Since only approxi-mate parameter values are found, the parameters are said to be

    estimated

    .Frequently, the variations of the unknown parameters are assumed to benegligible in the range of the experiment, then parameter values to be esti-mated are constant (they do not vary with respect to the independent vari-ables), and the set of unknown parameters in the mathematical model isdescribed by a

    p

    -component vector. In more general cases, parameters arefunctions of the independent variables (

    x

    and/or

    t

    ), or they are varying withthe state variable. The adjoint method is available for both cases.

    The inverse input problem

    Another kind of inverse problem consists in the determination of the inputvariable. Approximate values are inferred from the output measurementsthrough the modeling equations. When some parameters are unknown, theinverse problem is mixed. Most frequently, the input is a function of theindependent variables (time and/or space), and the numerical resolution isseverely ill conditioned. Some regularization techniques have to be intro-duced in the adjoint method to avoid unstable solutions due to the amplifi-cation of the output errors.

    The inverse state problem

    A third kind of inverse problem consists in the determination of the statevariable. Approximate values are inferred from the input and the outputmeasurements through the modeling equations. The state variable in themathematical models of lumped parameters processes is described by a

    n

    -component vector. For distributed parameters processes, it is a function. Theadjoint method is available for both cases.

    Four basic modeling equations of heat transfer processes are now intro-duced. They will be used further to illustrate the development of the adjointmethod for the different situations introduced above.

    Example 3.1. Semi-infinite body heat conduction with surface convection

    Consider a semi-infinite, heat-conducting body initially at the temperature

    T

    0

    and whose surface is exposed to a fluid characterized by the temperature

    -0861.book Page 107 Monday, August 12, 2002 6:43 PM

    2003 by CRC Press LLC

  • 108 Inverse Engineering Handbook

    and the convection coefficient

    h

    . The temperature is measured at thelocation

    x

    1

    , where

    x

    is measured from the heated surface. A mathematicalmodel of the heat transfer process is the PDE model,

    The

    input

    variable is the fluid temperature

    T

    f

    ; the

    output

    variables are thetemperatures at the sensor location; the

    state

    variable is the temper-ature distribution inside the body

    T

    (

    x,t

    )

    x > 0,

    at each time

    t

    it is spatiallyvarying; and the

    parameter

    variables are the thermal diffusivity

    , the thermalconductivity

    k

    , the convection coefficient

    h,

    and the sensor location

    x

    1

    , whichare constant.

    However, if the input temperature step is great enough, variation of

    and

    k

    with

    T

    should be considered.Let us introduce the following new variables:

    The model output is given by the algebraic equation:

    or

    The MatLab code to evaluate this solution is shown in Table 3.1, and theresults are plotted graphically in Figure 3.2.

    This example shows that a partial differential equation (PDE) model ofa dynamic process can be simplified to an algebraic equation (AE) model.The simplification is due to the assumptions that the input and the initialstate variables are constant, the solution of the PDE in that case being wellknown. Moreover, it must be emphasized that both PDE and AE modelsgive a relationship between the output

    and the parameter

    to be estimated,but the first one is implicit through the PDE, and the second one is explicit.When the explicit equation

    (

    ) is available, the derivatives are, too.

    T f T0>

    2Tx2---------

    Tt-------;=

    kTx------- x 0=h T f T 0 t,( )[ ],=

    x 0 t, 0> >

    t 0>

    x 0>T x 0,( ) T0,=

    T x1 t,( )

    T T0T f T0------------------ ,

    x12

    4------- Bi,hx1k

    -------- , Bi

    = = = =

    t ;( ) erfc x2 t-------------

    hxk

    ------

    h2tk2

    -----------+ erfc x2 t-------------

    h tk

    -------------+exp=

    t ;( ) erfc t-- Bi Bi

    2t2

    42------------+ erfc

    t--

    Bi2-----

    t--+exp=

    bT

    -0861.book Page 108 Monday, August 12, 2002 6:43 PM

    2003 by CRC Press LLC

  • Chapter three: The adjoint method to compute the numerical solutions 109

    Example 3.2. Semi-infinite body heat conduction with surface heat flux

    Consider now the same semi-infinite heat-conducting body initially at thetemperature T0, but the surface is subjected to a boundary heat flux densityu(t). The mathematical model of the heat transfer process is changed to thenew PDE model.

    Table 3.1 MatLab Code for Example 3.1% semi-infinite heat conduction% with surface convectionclearx=0.04;a=1.5e-6;h=12;k=0.5;bi=h*x/k;tau=x*x/(4*a)n=0;for u=0.025:0.025:2

    n=n+1;t(n)=1/u;tn=t(n);y(n)=erfc(u)-exp(bi+(bi*bi/(4*u*u)))*erfc(u+bi/(2*u));

    endplot(t,y)

    FIGURE 3.2 Results for Example 3.1: semi-infinite plate with convection.

    2Tx2---------

    Tt-------;=

    kTx------- x 0,( ) u t( ),=

    x 0 t, 0> >

    t 0>

    x 0>T x 0,( ) T0,=

    -0861.book Page 109 Monday, August 12, 2002 6:43 PM

    2003 by CRC Press LLC

  • 110 Inverse Engineering Handbook

    The input variable is u(t), which can be arbitrarily chosen. Consider the inputequal to a pulse, ; E0 is the energy density of the pulse. Theexact solution at the sensor location is

    The function fi(t) is a Greens function for the pulse at x = 0. Let us introduce the new variables ( is a given reference temperature

    difference).

    The output model is then given by the algebraic equations

    The MatLab code to evaluate the function is shown in Table 3.2, and theresults are presented graphically in Figure 3.3.

    In this example, the PDE model has also been simplified to an AE model,because an explicit relationship (a closed-form solution to the PDE) betweenthe output and the parameters is available.

    If, instead, there is a time-varying boundary input u(t), the output tem-perature response is given by the convolution integral equation (IE),

    Table 3.2 MatLab Code for Example 3.2: Semi-infinite Body with Surface Heat Flux

    % semi-infinite heat conduction% response to a pulseclear

    dt=0.1for n=1:200

    t(n)=n*dt;tn=1/t(n);y(n)=sqrt(tn)*exp(-tn);

    end

    plot(t,y)

    u t( ) E0 t( )=xj

    T xj t,( ) T0E0k

    -----

    t-----

    0.5 xj2

    4t--------- exp f i t( )= =

    T

    xj

    2

    4------- A,2E0

    kxjT -----------------------= = , A

    , T T0T---------------= =

    t ;( ) A t--

    t-- exp , t 0>=

    t( ) f i t ( )u ( ) d0

    t=

    -0861.book Page 110 Monday, August 12, 2002 6:43 PM

    2003 by CRC Press LLC

  • Chapter three: The adjoint method to compute the numerical solutions 111

    Then, the inverse input problem, which consists in the determination of theheat flux density u(t) from output measurements, can be formulated in eitherPDE or IE models.

    Numerical resultsThe MatLab code listed in Table 3.3 will evaluate the temperature responseof the semi-infinite domain using the Greens function kernel and the con-volution integral. The results shown in Figure 3.4 are for the two-triangleheat flux shown in Figure 3.4, which is coded into the listing of Table 3.3.

    Example 3.2 will be continued in subsequent sections to illustrate boththe numerical resolution of an input inverse problem according to the adjoint

    FIGURE 3.3 Example 3.2: semi-infinite body with a pulse surface heat flux.

    FIGURE 3.4 Example 3.2: temperature response to a time varying heat flux, IE model.

    -0861.book Page 111 Monday, August 12, 2002 6:43 PM

    2003 by CRC Press LLC

  • 112 Inverse Engineering Handbook

    Table 3.3 MatLab Code to Evaluate Convolution Integral% Semi-infinite body% temperature response to a varying heat flux q(t)% Integral Equation modelcleartau=1.; y0=0.4;dt=tau/10;nf=200;for n=1:nf

    axet(n)=tau*dt*n;if n

  • Chapter three: The adjoint method to compute the numerical solutions 113

    method in the case of integral equation (IE) and partial differential equation(PDE) modeling.

    Example 3.3. Two-dimensional, steady-state conduction

    A large industrial furnace is supported on a long column of fireclay brick,which is 1 1 m on a side. During steady-state operation, installation is suchthat three surfaces (=s) of the column are maintained at the temperature while the remaining surface is exposed to an air stream for which thetemperature is Tair and the heat transfer coefficient is h. The modeling equa-tions are the two-dimensional steady-state conduction equation togetherwith the boundary condition equations,

    The input variables are the temperature Tair of the air stream and the tem-perature Ts fixed at the surface s ; the output variables are the temperature

    at the sensor locations in the column; the state variable is the tem-perature field inside the column; and the parameter variables are thethermal conductivity k, the heat transfer coefficient hair, and the sensor loca-tions .

    Figure 3.5 shows a grid for an approximate solution for the PDE by thefinite difference method. Using a grid of , the two-dimen-sional temperature distribution in the column is determined by solving a seta finite-difference equations. The prescribed grid consists of 12 nodal pointsat which the temperature is unknown. However, the number of unknowns

    Tsair

    kT x y,( ) 0=

    T s Ts=

    kTn------- airshair T Tair[ ]=

    T xi yi,( )T x y,( )

    xi yi,( ) i, 1 .. NS,=

    Air airT

    1 2 1

    3 4 3

    5 6 5

    7 8 7

    Ts

    FIGURE 3.5 Example 3.3: finite difference grid.

    x y 0.25m= =

    -0861.book Page 113 Monday, August 12, 2002 6:43 PM

    2003 by CRC Press LLC

  • 114 Inverse Engineering Handbook

    is reduced to eight through symmetry, so there is a set of eight algebraicmodeling equations to solve.

    The eight finite-difference equations are

    Node 1:

    Node 2:

    Node 3:

    Node 4:

    Node 5:

    Node 6:

    Node 7:

    Node 8:

    In matrix notation, these equations are of the form [A] [T] = [b] with

    ;

    where the Biot number is defined by .

    The numerical solution is computed with the following parameter val-ues:

    Tair = 300K, hair = 10W/m2K, k = 1W/mK, Ts = 500K

    The MatLab code to perform the finite difference computations is listed inTable 3.4. The results from the computation are listed in Table 3.5, and acontour map of these results is seen in Figure 3.6.

    T2 T3 4T1+ 2Ts=

    2T1 T4 4T2+ Ts=

    T1 T4 T5 4T3+ + Ts=

    T2 2T3 T6 4T4+ + 0=

    T3 T6 T7 4T5+ + Ts=

    T4 2T5 T8 4T6+ + 0=

    2T5 T8 4 2Bi+( )T7+ Ts 2Bi T=

    2T6 2T7 4 2Bi+( )T8+ 2Bi T=

    A[ ]

    4 1 1 0 0 0 0 02 4 0 1 0 0 0 01 0 4 1 1 0 0 00 1 2 4 0 1 0 00 0 1 0 4 1 1 00 0 0 1 2 4 0 10 0 0 0 2 0 4 2Bi 10 0 0 0 0 2 2 4 2Bi

    = b[ ] Ts

    21101010

    2Bi

    000000

    T

    T

    =

    Bihairx

    k---------------=

    -0861.book Page 114 Monday, August 12, 2002 6:43 PM

    2003 by CRC Press LLC

  • Chapter three: The adjoint method to compute the numerical solutions 115

    Table 3.4 MatLab Code for Example 3.3: Two-Dimensional Conduction% 2-D steady-state conductionTair=300; h=10; dx=0.25;k=1;Bi=h*dx/k;Ts=500;

    A=[-4 1 1 0 0 0 0 0;2 -4 0 1 0 0 0 0;1 0 -4 1 1 0 0 0;0 1 2 -4 0 1 0 0;0 0 1 0 -4 1 1 0;0 0 0 1 2 -4 0 1;0 0 0 0 2 0 -4-2*Bi 1;0 0 0 0 0 2 2 -4-2*Bi]

    bs=[-2; -1; -1; 0; -1; 0; -1; 0]bair=[0; 0; 0; 0; 0; 0; Tair; Tair]b=Ts*bs-2*Bi*bair

    T=inv(A)*bfor i=1:5

    xx(i)=(i-1)*dx;for j=1:5

    yy(j)=(j-1)*dx;Z(i,j)=Ts;

    endend

    Z(1,2)=T(7);Z(1,3)=T(8);Z(1,4)=T(7);Z(2,2)=T(5);Z(2,3)=T(6);Z(2,4)=T(5);Z(3,2)=T(3);Z(3,3)=T(4);Z(3,4)=T(3);Z(4,2)=T(1);Z(4,3)=T(2);Z(4,4)=T(1);contourf(xx,yy,Z,10)

    Table 3.5 Nodal Temperature Results for Example 3.3Node Temperature

    1 489.3047

    2 485.1538

    3 472.0651

    4 462.0058

    5 436.9498

    6 418.7393

    7 356.9946

    8 339.0520

    -0861.book Page 115 Monday, August 12, 2002 6:43 PM

    2003 by CRC Press LLC

  • 116 Inverse Engineering Handbook

    Example 3.3 will be continued later to illustrate the numerical resolutionof an inverse parameter problem by using the adjoint method in the case ofalgebraic modeling equations.

    Example 3.4. A lumped heat conduction modelLet us determine the input, the output, the state, and the parameter variablesin the following cooling process. We will distinguish between the ODE andthe AE models.

    Let be the temperature of two lumped heat capacities, and , at any time t. At the initial time, both temperatures are equal to

    . The cooling process consists in extracting some heat flux u(t) from theheat capacity so as to achieve the solidification of the heat capacity

    , which is embedded within . To describe heat transfer duringcooling, the heat flux q(t) between the heat capacities is assumed to beproportional to the temperature difference , and the phase-change process of the heat capacity is modeled by a temperaturevarying function. The nonlinear ODE model is

    The new variables are introduced,

    FIGURE 3.6 Example 3.3: computed temperature field.

    T1 t( ) T2 t( ), m1C1m2C2

    T0m1C1

    m2C2 m1C1

    q h T1 T2( )=m2C2

    m1C1dT1dt

    --------- u q=

    m2C2 T2( )dT2dt

    --------- q=

    m1C1

    h------------- t*; t

    -- a;

    m2C2m1C1-------------= = =

    -0861.book Page 116 Monday, August 12, 2002 6:43 PM

    2003 by CRC Press LLC

  • Chapter three: The adjoint method to compute the numerical solutions 117

    where T is a fixed reference and is chosen equal to the maximal temperaturevariation of the heat capacities during the cooling,

    The nonlinear ODE model becomes (using the dimensionless variablesintroduced above but omitting the * notation for convenience),

    The input variable is the extracted heat flux u, the output variable is thetemperature (there is no sensor in the capacitive body 1), the statevariables are contained in the two-component vector , and theparameter variable is the temperature varying function a.

    Due to the nonlinearity of the modeling equations, the numerical solu-tion is achieved using standard finite difference schemes. Let t be the timestep; the ODE can be approximated by the following recursive (AE) algebraicequations:

    where

    Numerical resultsConsider the solidification process starting from the initial temperature T =1 to reach the final temperature T = 0, over the time interval [0, 2]. Considera constant heat flux during the solidification,

    where u0 and tc are to be determined

    u* uhT----------- Ti

    *;Ti Tmin

    T--------------------, i 1 2,= = =

    T T0 Tmin, Tmin Ti T0 =

    T1 T1 T2+ u=

    a T2( )T2 T2 T1+ 0=

    Ti 0( ) 1, i 1 2,= =

    T2=T T1 T2,[ ]T=

    1 t+ ttak------ 1 t

    ak------+

    T1k 1+

    T2k 1+

    T1k t uk 1++

    T2k

    =

    tk kt, Tik Ti tk( ), ak a T2k( ), uk u tk( )= = = =

    u t( ) u0, t tc

    r L 2--- 0.5=

    L( ) 4L=

    L r h , ,( ) P r h,( ) A r h,( ) L2[ ] 2--- 2r h+( ) 2h 4--- 2r h+( )h+= =

    Lr------

    2---h 0= =

    Lh------

    2--- 2

    4--- 2r 2h+( )+ 0= =

    L------- A r h,( ) L

    2 0= =

    h 2=

    2--- 2+

    h--- r h+( )= r h 2

    --- 0.5 =

    -0861.book Page 138 Monday, August 12, 2002 6:43 PM

    2003 by CRC Press LLC

  • Chapter three: The adjoint method to compute the numerical solutions 139

    Substituting in the third equation gives

    In this example, the elimination method is simpler; however, the secondmethod can be extended to optimize a function F() with more than twoparameters and more than one equality constraint.

    Extension to p variables and nc algebraic equality constraints (nc < p)The extension of the method is straightforward. The same notations are used,but now F() is a scalar function of a p-component vector, and we considera set of nc algebraic equality constraints. So, R is a vector function,

    The Lagrangian multiplier is then a vector, whose size is taken equalto the number of constraints: dim() = dim(R) = nc. The Lagrangian is definedas

    When the Lagrange multiplier is fixed, independent of , the stationarycondition is written as

    Hence, the stationary points of the Lagrangian are solution of the set of (nc+ p) algebraic equations,

    Example 3.7. Minimization of a quadratic function: equality constraints

    Minimize , subject to the set of two algebraic equations,

    4--- 2r h+( )h

    4---

    4--- 1 1+ h2 L2 h L= = =

    R ( ) 0=

    dim R( ) nc p

  • 140 Inverse Engineering Handbook

    The stationary condition is

    The optimum is the solution of the (5 5) linear algebraic system, which canbe written simultaneously using matrix notation as

    The MatLab code in Table 3.10 can be used to evaluate the parametersand the Lagrange multipliers. The result from this short code is

    x =

    0.50001.00001.50001.00000.0000

    Therefore, the numerical solution is

    ; for which

    Table 3.10 MatLab Code for Example 3.7 (Lagrange Multipliers)% lagrange multiplier % exampleA= [2 0 0 -1 -2;

    0 2 0 -2 -2;0 0 2 -3 -1;1 2 3 0 0;2 2 1 0 0];

    b=[0; 0; 0; 7; 4.5];x=inv(A)*b

    F ( ) RT ( )[ ] 2123

    1 2

    2 23 1

    12

    000

    = =

    2 0 0 1 20 2 0 2 20 0 2 3 11 2 3 0 02 2 1 0 0

    12313

    0

    007

    4.5

    =

    0.51.01.5

    = 1.00.0

    = F ( ) 3.5=

    -0861.book Page 140 Monday, August 12, 2002 6:43 PM

    2003 by CRC Press LLC

  • Chapter three: The adjoint method to compute the numerical solutions 141

    The stationary point minimizes F(), since the Hessian of F is definite posi-tive,

    The adjoint method

    Minimization of the LS-criterion

    The Lagrangian technique is used to determine , which minimizes the LS-criterion,

    In this section, for simplicity, the mathematical model defining an implicitrelationship between the parameter vector and the output vector is takenas a set of n algebraic equations. They are denoted by the vector functionR[,] as it was done for the equality constraints in the previous section. Inthe next sections, other kinds of modeling equations will be considered.

    The model output () satisfies

    and no explicit relationship for () is available. Consequently, if is not asolution of the modeling equations, then it is true that R[,] 0.

    Now the Lagrangian multiplier and the Lagrangian L[,,] are intro-duced.

    Notice that the Lagrangian introduced in the previous section is modified:three variables (,,) are considered instead of two (,), and the LS-criterion S to be minimized is written only with the output variable ,without referring to the parameter variable ! This is interpreted to meanthat inside the Lagrangian, the parameters and the output vector areconsidered as independent variables.

    When is solution of the modeling equations, it is denoted (), andan important property holds that the Lagrangian is equal to the LS-criterion for any multiplier. It means that the constraints are satisfied,

    2F 21 0 00 1 00 0 1

    2I= =

    S ( ) Y ( ) 2=

    R ( ) ,[ ] 0=

    L , ,( ) Y 2 R ,( ), =

    L ( ) , ,( ) Y ( ) 2 R ( ) ,( ), S ( )= =

    -0861.book Page 141 Monday, August 12, 2002 6:43 PM

    2003 by CRC Press LLC

  • 142 Inverse Engineering Handbook

    Assuming that is fixed, independent of , then the differential of theLagrangian takes the forms

    The choice of the Lagrange multiplier is free. For convenience, so let uschoose to be the solution of the linear equation,

    or

    Hence, the stationary condition of the Lagrangian, which is dL = 0, is reducedto

    or

    Finally, the stationary points (,,) of the Lagrangian are solution of the setof (2n + p) algebraic equations,

    Gradient of the constrained LS-criterionThe solution of this set of algebraic equations can be computed with gradientalgorithms. Steepest descent, or conjugate gradient, methods are based onthe computation of the gradient S() of the function to be minimized.

    dL S , RT[ ]T, R[ ]T+ =

    S , RT[ ] , RT[ ]T, =

    S RT[ ] , RT[ ] , =

    S RT 0=

    RT[ ] S=

    2 Y ( )=

    RT[ ] , 0, =

    RT 0=

    R ( ) ,[ ] 0=

    RT ( ) ,( )[ ] 0=

    RT ( ) ,( )[ ] 2 Y ( )( )=

    -0861.book Page 142 Monday, August 12, 2002 6:43 PM

    2003 by CRC Press LLC

  • Chapter three: The adjoint method to compute the numerical solutions 143

    Without constraints, we have seen that gradient algorithms allow determi-nation of the minimum of the LS-criterion by searching for stationary pointsthat satisfy

    In the minimization of the LS-criterion with constraint, the judicious choiceof the Lagrange multiplier

    implies that the differential of the Lagrangian becomes

    Recalling the property of the model output (),

    the gradient S() is determined by

    which is also called gradient equation.One of the main interests in introducing the Lagrange multiplier is to

    authorize the use of gradient algorithms to minimize the LS-criterion whenno explicit relationship is available between the output and the parameter.

    It must be noted that the Jacobian is never used in thedevelopment above.

    The Lagrange multiplier is also called the adjoint variable, and it is thesolution of the adjoint equation,

    Finally, the method that consists in introducing the Lagrangian

    and considering the stationary condition dL = 0 to determine both the adjointequation and the gradient equation is called the adjoint method.

    Adjoint method with conjugate gradient algorithm to minimize LS-criterion

    The conjugate gradient algorithm is combined with the Lagrange multipliertechnique to compute the minimum of the LS criterion as follows:

    dS S ( ) , 0, = =

    RT 2 Y ( )=

    dL RT[ ] , =

    L ( ) , ,( ) S ( )=

    S ( ) RT =

    X T[ ]T=

    RT 2 Y ( )=

    L , ,( ) Y 2 R ,( ), =

    -0861.book Page 143 Monday, August 12, 2002 6:43 PM

    2003 by CRC Press LLC

  • 144 Inverse Engineering Handbook

    subject to the constraints

    The algorithm is

    1. Choose an initial guess , k = 0.2. Compute solution of , and compute ( .3. Compute solution of , and the gradient

    .4. Determine the descent direction,

    if k = 0,

    else , and

    5. Perform a line search in direction to compute = ,which minimizes the scalar function = .

    6. Compute the new iterate, .7. k k + 1.8. Return to (2) until a termination condition is reached.

    Adjoint method with noisy dataIn practice, the output vector data Y is perturbed by measurement noise.Even if the modeling equations are exact, the Hessian 2S()of the LS-criterion can be very nearly singular, and theminimum is not well defined; it is very sensitive to small measurementserrors. The problem is said to be ill conditioned.

    To regularize the solution, there are several approaches that will be notdiscussed here. However, we illustrate two of them that are easy to imple-ment with the adjoint method.

    The regularized LS-criterion. The LS criterion is modified as follows:

    where b is a prior information available on , is a positive scalar, and U isa symmetric positive definite matrix, which can be introduced for the pur-pose of scaling.

    S ( ) Y ( ) 2=

    R ( ) ,[ ] 0=

    0( ) k( )( ) R ( ) ,[ ] 0= S k( )( )

    RT 2 Y ( )=S ( ) RT =

    w 0( ) S k( ) w k 1( )+=

    Sk( ) 2

    S k 1( ) 2-------------------------= w k( ) S k( ) w k 1( )+=

    w k( ) Arg min r( ) r( ) S k( ) rw k( )+( )

    k 1+( ) k( ) w k( )+=

    R ( ) ,[ ] 0=S ( ) Y ( ) 2=

    S ( ) Y ( ) 2 b U2+=

    b U2 b U b ( ), =

    -0861.book Page 144 Monday, August 12, 2002 6:43 PM

    2003 by CRC Press LLC

  • Chapter three: The adjoint method to compute the numerical solutions 145

    Hence, the Lagrangian is extended to the form

    The adjoint equation is unchanged

    but the gradient equation

    becomes

    The basic steps of the conjugate gradient algorithm remain unchanged.The computed solution will depend on the scalar . Let us see on the

    following example how an optimal value can be determined knowing thenoise level on the vector data.

    Example 3.8

    Consider the quadratic function

    where

    With the vector data (assumed to be without noise),

    The vector solution that minimizes S() is

    L , ,( ) Y 2 b U2 R ,( ), +=

    RT 2 Y ( )=

    S RT + 0=

    RT 2U b ( )=

    S ( ) Y A 2=

    A

    10 7 8 77 5 6 58 6 10 97 5 9 10

    =

    Y 32 23 33 31 T; Y 60=

    A 1 Y 1 1 1 1 T= = ; 2=

    -0861.book Page 145 Monday, August 12, 2002 6:43 PM

    2003 by CRC Press LLC

  • 146 Inverse Engineering Handbook

    Introduce the additive error data,

    Then, the resulting error on is

    Hence, the amplification factor of the relative errors is

    !

    A spectral analysis confirms that the matrix A is nearly singular. Let Vand D be two matrices, where V is orthogonal (V1 = VT), and D is diagonal,such that

    With MatLab, these are found to be

    The ill conditioning of the inversion operation is evaluated by the conditionnumber of the matrix; it can be defined here by the ratio between the largestand the smallest eigenvalues

    that is the same order of magnitude as the amplification factor.Consider now the regularized LS criterion,

    [V,D]=eig(A)V =

    0.5016 0.3017 0.6149 0.52860.8304 0.0933 0.3963 0.38030.2086 0.7603 0.2716 0.55200.1237 0.5676 0.6254 0.5209

    D =0.0102 0 0 00 0.8431 0 00 0 3.8581 00 0 0 30.2887

    Y 0.1 0.1 0.1 0.1 T; Y 0.2= = =

    A 1 Y 8.2 13.6 3.5 2.1 T; 16.397= = =

    G -----------Y--------

    12460.6= =

    AV VD=

    cond A( ) 30.28870.0102------------------- 2.984E3= =

    S ( ) Y A 2 2+=

    -0861.book Page 146 Monday, August 12, 2002 6:43 PM

    2003 by CRC Press LLC

  • Chapter three: The adjoint method to compute the numerical solutions 147

    where the a priori estimate is equal to zero, b = 0, and U is the identitymatrix.

    The vector solution , that minimizes S() satisfies the equation

    ; with

    The exact solution being known, the error estimate can be computed.For a fixed noise level , this error depends on the scalar :

    The graphic representation of the norm of the error estimate, versusthe scalar in Figure 3.17, shows an optimal value. However, in practice,the exact solution (without noise ) is unknown, and this methodis not available to determine the best value of .

    Introduce the new variables,

    Then, using the properties of the matrix V: and , the LScriterion can be rewritten as

    A I+[ ] 1 Y Y+( )= Y 0.2= =

    A I+[ ] 1 Y Y+( ) A 1 Y=

    FIGURE 3.17 Example 3.8: variation of norm of error estimate with penalizationparameter .

    A 1 Y=

    Z VTY, X VTB= =

    VTV I= V 1=

    S Z DX2 X 2+=

    -0861.book Page 147 Monday, August 12, 2002 6:43 PM

    2003 by CRC Press LLC

  • 148 Inverse Engineering Handbook

    The minimum X* of S is reached for

    The components are

    where i, i = 1,4 are the eigenvalues of the matrix A.One way to determine the regularizing parameter for such quadratic

    case consists in choosing the value for which the LS-residual will be equalto the noise level , which gives as the solution of thealgebraic equation

    Table 3.11 MatLab Code to Determine Optimal Value of Regularizing Parameter

    % optimal value of the regularizing% parameter mu[V,D]=eig(A)

    Z=V'*(Y+dY);muopt=fzero('tikho',1)

    for i=1:4 X(i)=D(i,i)*Z(i)/(D(i,i)*D(i,i)+muopt);end

    % minimum of the regularized LS criterionB=V*X'

    function y=tikho(mu)

    global D Z ndy

    s=0;n=size(Z);for i=1:n

    s=s+((mu*Z(i))/(D(i,i)*D(i,i)+mu))^2;endy=s-ndy*ndy;

    DTD I+( )X* DTZ=

    Xi*iZi

    i2 +---------------=

    Z DX 2 2=

    ( ) Zi i2Zi

    i2 +---------------

    2

    2

    i 0= =

    Zii2 +---------------

    2

    2

    i 0= =

    -0861.book Page 148 Monday, August 12, 2002 6:43 PM

    2003 by CRC Press LLC

  • Chapter three: The adjoint method to compute the numerical solutions 149

    Zero found in the interval: [0.54745, 1.4525].

    The conjugate gradient algorithm now can be used to minimize theregularized LS-criterion. MatLab code to perform the CG iterations is listedin Table 3.12 using the optimal value = 1.4065; it produces the resultsshown in Figure 3.18.The CG algorithm converges toward a regularized solution close to the abovepredicted values.

    BW =0 0.9584 1.0018 1.0054 1.0382 1.0485 1.04960 0.6894 0.7206 0.7231 0.7449 0.7515 0.75230 0.9991 1.0429 1.0448 1.0348 1.0265 1.02680 0.9422 0.9827 0.9836 0.9531 0.9361 0.9358

    The iterative regularization principleThe second regularization technique to be used will be the iterative regular-ization principle. [Editors note: this is the same as the discrepancy principlediscussed in Chapter 2.] The iterative regularization principle is very easyto implement with the conjugate gradient algorithm. This principle requires

    muopt =1.4065

    B =

    1.10960.80131.08490.9391

    FIGURE 3.18 Example 3.8: quadratic regularized LS-criterion, opt = 1.4.

    -0861.book Page 149 Monday, August 12, 2002 6:43 PM

    2003 by CRC Press LLC

  • 150 Inverse Engineering Handbook

    Table 3.12 MatLab Code for Example 3.8: Conjugate Gradient Method Using Regularized LS-Criterion (Noisy Data)

    % quadratic case% with noisy data

    clearA=[10 7 8 7;

    7 5 6 5;8 6 10 9;7 5 9 10];

    Y=[32; 23;33;31]; dY=[0.1;-0.1; 0.1; -.1];ndy=norm(dY);

    % conjugate gradient algorithm % with regularized LS-criterion

    muopt=1.4;I= diag([1;1;1;1]);Amu=A+muopt*I;

    B=[0;0;0;0];BW(:,1)=B;Y=Y+dY;ls =1000;k=1;

    while ls>ndy*ndyls=0.5*(Y-Amu*B)'*(Y-Amu*B);

    S(k)=ls;g=-A'*(Y- Amu*B);ng=g'*g;if k==1

    w=-g;

    elsew=-g+ng/ng1*w1;

    endro=-(g'*w)/(w'*Amu'*Amu*w);B=B+ro*w;

    BW(:,k+1)=B;g1=g;w1=w;ng1=ng;k=k+1;

    end

    plot(S)figureplot(BW')

    -0861.book Page 150 Monday, August 12, 2002 6:43 PM

    2003 by CRC Press LLC

  • Chapter three: The adjoint method to compute the numerical solutions 151

    that the iterative process should be stopped when the LS-criterion to beminimized satisfies the terminal condition

    where characterizes the noise level on the vector data.

    Example 3.9Consider the same quadratic case as above.

    (a) Without noise on the data, = 0. The conjugate gradient algorithmis run, starting from ; it produces the following results:

    The exact values of the parameter are obtained after five iterations.

    (b) The algorithm is run now with additive noise on the data with = 0.2. Starting from the same initial guess, , new re-sults are obtained, which are shown in Figure 3.21. Notice than thecomponent values of the minimum of the LS-criterion with noisy data,after four iterations, are quite different from the exact values obtainedwithout noise, but they are equal to those predicted previously inExample 3.8.

    Iteration i 0 1 2 3 4 5 6

    (i)0 1.0486 1.1179 1.1224 1.0755 1.0000 1.00000 0.7543 0.7987 0.7974 0.8749 1.0000 1.00000 1.0933 1.0622 1.0509 1.0314 1.0000 1.00000 1.0312 0.9613 0.9698 0.9814 1.0000 1.0000

    S k( )( ) Y A k( ) 2 Y 2 2= = =

    0( ) 0 0 0 0;;;[ ]T

    FIGURE 3.19 Example 3.9a results, no noise.

    0( ) 0 0 0 0;;;[ ]T

    -0861.book Page 151 Monday, August 12, 2002 6:43 PM

    2003 by CRC Press LLC

  • 152 Inverse Engineering Handbook

    Figure 3.22 and Table 3.13 show the LS-criterion at each iteration numberfor this example. In this case, the additive noise is .Observe that, for the iteration numbers i > 3, the LS-criterion computed bythe conjugate gradient algorithm becomes less than the noise level,

    So, according to the iterative regularizing principle, the terminal conditionof the algorithm occurs for i = 3, and the final values of the parameter

    FIGURE 3.20 Example 3.9a convergence history, no noise.

    FIGURE 3.21 Example 3.9b results, noise with = 0.2.

    Y 2 2 0.04= =

    S k( )( ) Y A k( ) 2; i 3>

  • Chapter three: The adjoint method to compute the numerical solutions 153

    components determined by the conjugate gradient algorithm remain closeto the exact values,

    MatLab code to perform the CG iterations and stop using the iterativeregularization principle is listed in Table 3.14. The code can be used togenerate the results shown in Figure 3.23.

    In the next sections, inverse problems are solved by using the adjointmethod and gradient algorithms. All of them are formulated as the minimi-zation of a constrained LS-criterion. The adjoint method presented in thissection with algebraic modeling equations as constraints will be adapted totake into account the structure of other kinds of modeling equations.

    Table 3.13 Example 3.9b: Results from CG iterations, Noise with = 0.2Iteration number LS-criterion

    0

    1

    2

    3

    4

    5

    1.802620000000000e+003

    1.365119982194982e001

    1.634291561475714e002

    1.343557552068213e002

    6.255409340800662e008

    2.637102500866829e017

    FIGURE 3.22 Example 3.9b convergence history, noise with = 0.2.

    3( )1.09970.81171.13190.8977

    =

    -0861.book Page 153 Monday, August 12, 2002 6:43 PM

    2003 by CRC Press LLC

  • 154 Inverse Engineering Handbook

    Table 3.14 MatLab Code for Example 3.9% quadratic LS-criterion% with noisy data

    clearA=[10 7 8 7;

    7 5 6 5;8 6 10 9;7 5 9 10];

    Y=[32; 23;33;31]; ny=norm(Y)B=inv(A)*Y;nb=norm(B)dY=[0.1;-0.1; 0.1; -.1];ndy=norm(dY);dB=inv(A)*dY;ndb=norm(dB);

    % amplification factor

    gain=(ndb/nb)/(ndy/ny)

    % conjugate gradient algorithm % and regularizing principleB=[0;0;0;0];BW(:,1)=B;Y=Y+dY;ls =1000;k=1;

    while ls>ndy*ndyls=0.5*(Y-A*B)'*(Y-A*B);S(k)=ls;g=-A'*(Y-A*B);ng=g'*g;if k==1

    w=-g;else

    w=-g+ng/ng1*w1;endro=-(g'*w)/(w'*A'*A*w);B=B+ro*w;

    BW(:,k+1)=B;g1=g;w1=w;ng1=ng;

    k=k+1;end

    plot(S)figureplot(BW')

    -0861.book Page 154 Monday, August 12, 2002 6:43 PM

    2003 by CRC Press LLC

  • Chapter three: The adjoint method to compute the numerical solutions 155

    The adjoint method to minimize the LS-criterion with algebraic modeling equations

    Example 3.10

    The example of a two-dimensional steady-state conduction model of Exam-ple 3.3 is continued. Assuming that the air temperature Tair is fixed, thetemperature field T in the column depends on two parameters: the surfacetemperature Ts and the Biot number ; hence the parameternotation is adopted,

    Consider the inverse parameter problem, which consists in estimating from temperature measurements Y taken inside the column. Two (or more)sensors are located at some distinct nodes of the grid. Hence, the outputmeasurement equation can be written in the following matrix form.

    For example, if the sensors are located at the nodes 1 and 5, then the matrixC is

    FIGURE 3.23 Example 3.9 Results: Noise with = 0.2, iterative regularization prin-ciple.

    Bi hx( ) k=

    TsBi

    =

    CT=

    C[ ] 1 0 0 0 0 0 0 00 0 0 0 1 0 0 0

    =

    -0861.book Page 155 Monday, August 12, 2002 6:43 PM

    2003 by CRC Press LLC

  • 156 Inverse Engineering Handbook

    The LS-criterion is written as

    Y is the temperature vector data given by the sensors, and T() satisfies theconstraint equations, i.e., is the solution of the set of finite-difference equa-tions.

    where both [A],[b] depend on the parameter vector .Now, the Lagrangian multiplier and the Lagrangian L(T,,) are intro-

    duced.

    Then, the adjoint equation to determine , which is ,takes the form

    and the gradient equation, which is , gives the twocomponents of the gradient vector of the LS-criterion,

    These two components are computed knowing that

    For i = 1, , then and

    S ( ) 12--- Y CT ( )2

    =

    R T ,( ) A[ ] T[ ] b[ ] 0= =

    L T , ,( ) 12--- Y CT2 A ( )T b ( ), =

    TS TRT 0=

    CT Y CT( ) AT 0=

    S ( ) RT =

    Si-------

    i------- A ( )T b ( )( )

    T

    , i 1 2,= =

    1 Ts= i-------A ( )T 0=

    1-------- b[ ]

    21101010

    =

    -0861.book Page 156 Monday, August 12, 2002 6:43 PM

    2003 by CRC Press LLC

  • Chapter three: The adjoint method to compute the numerical solutions 157

    For i =2, , then ; =

    Numerical resultsThe output data vector Y is first computed as in Example 3.3, with theparameter

    The temperature is rescaled according to the following rule:

    Three sensors are located at the nodes 1, 5, and 8; then, Y = [0.9258; 0.6847;0.1953]T.

    MatLab code to perform the CG iterations for this example is listed inTable 3.15. Starting the conjugate gradient algorithm with the initial guess

    produces the results in Figure 3.24 (convergence history) and Figure 3.25.Since the LS-criterion is not a quadratic function, more than two itera-

    tions are required, but the exact value of the minimum is reached in lessthan ten iterations. As in the simple non-quadratic example presented earlier,it is preferable to compute the optimal step length

    which minimizes the scalar function

    by using a line search algorithm, with the function fminbnd of MatLab.

    2 Bi= i-------A ( )T

    0 0 0 0 0 0 0 00 0 0 0 0 0 0 00 0 0 0 0 0 0 00 0 0 0 0 0 0 00 0 0 0 0 0 0 00 0 0 0 0 0 0 00 0 0 0 0 0 2 00 0 0 0 0 0 0 2

    T= 2-------- b[ ] 2

    000000

    T

    T

    =

    TsBi

    12.5

    = =

    T*T TairTs Tair--------------------=

    0( ) 21

    =

    Arg min r( )=

    r( ) S k( )( ) rw k( )+=

    -0861.book Page 157 Monday, August 12, 2002 6:43 PM

    2003 by CRC Press LLC

  • 158 Inverse Engineering Handbook

    Table 3.15 MatLab Code for Example 3.10 % 2-D steady-state / inverse conduction% Adjoint Methodclearglobal A B Y C bs bair w T

    Tair=0;w=[0; 0];bs=[-2; -1; -1; 0; -1; 0; -1; 0];bair=[0; 0; 0; 0; 0; 0; Tair; Tair];Y=[0.9258; 0.6847; 0.1953];C=[0 1 0 0 0 0 0 0;

    0 0 0 0 1 0 0 0;0 0 0 0 0 0 0 1];

    for i=1:41xx(i)=0.+(i-1)*0.05;for j=1:41

    yy(j)=1+(j-1)*0.1;B=[xx(i);yy(j)];Z(j,i)=phi(0);

    endend

    contour(xx,yy,Z,10);hold on

    clear xx,clear yy;

    B=[2; 1];xx(1)=B(1);yy(1)=B(2);

    for k=2:20% compute the LS criterion

    s(k-1)=phi(0);

    % compute the gradientpsi=inv(A')*C'*(Y-C*T);g=-[bs'*psi;2*(psi(7)*(T(7)-Tair)+psi(8)*(T(8)-Tair))];ng=g'*g;

    % determine the descent directionif mod(k,2)==0

    w=-g;else

    w=-g+ng/ng1*w1;end

    % determine the optimal descent length (line search)

    -0861.book Page 158 Monday, August 12, 2002 6:43 PM

    2003 by CRC Press LLC

  • Chapter three: The adjoint method to compute the numerical solutions 159

    ro=fminbnd('phi',0,1e5);

    % new iterateB=B+ro*w;g1=g;w1=w;ng1=ng;xx(k)=B(1);yy(k)=B(2);

    end

    plot(xx,yy,'lineWidth',3)figureplot(s)

    function y=phi(r)global A B Y C bs bair w TBW=B+r*w;b=BW(1)*bs-2*BW(2)*bair;A=

    [-4 1 1 0 0 0 0 0;2 -4 0 1 0 0 0 0;1 0 -4 1 1 0 0 0;0 1 2 -4 0 1 0 0;0 0 1 0 -4 1 1 0;0 0 0 1 2 -4 0 1;0 0 0 0 2 0 -4 -2*BW(2) 1;0 0 0 0 0 2 2 -4-2*BW(2)];

    T=A\b; e=Y-C*T;y=0.5*(e'*e);

    Table 3.15 MatLab Code for Example 3.10 (continued)

    FIGURE 3.24 Example 3.10 results: convergence history.

    -0861.book Page 159 Monday, August 12, 2002 6:43 PM

    2003 by CRC Press LLC

  • 160 Inverse Engineering Handbook

    The adjoint method to minimize the LS-criterion with integral modeling equation

    Example 3.11Example 3.2 is now continued. The surface of a semi-infinite heat conductingbody is submitted to a time varying heat flux u(t) with the resulting tem-perature response (t;) inside the body modeled in the integral equation

    where the function f is the Greens function for the pulse at x = 0,

    The output Y is computed using MatLab code in Table 3.3, with thefunction u(t) = q(t) shown on the plot in Figure 3.4.

    The inverse input problem aims to determine the function u over the timeinterval , from the output data Y and the knowledge of the Greensfunction f.

    The LS-criterion is introduced,

    FIGURE 3.25 Example 3.10 results: iteration history in parameter plane.

    t u;( ) f t ( )u ( ) d0

    t=

    f t( ) 1t

    ------

    1t

    ------ exp=

    0 t f = 5,

    S ( ) 12--- Y t( ) t u;( )[ ]2 td

    0

    t f 12--- Y u( ) 2= =

    -0861.book Page 160 Monday, August 12, 2002 6:43 PM

    2003 by CRC Press LLC

  • Chapter three: The adjoint method to compute the numerical solutions 161

    The solution u* that minimizes the LS-criterion is computed accordingto the adjoint method and the conjugate gradient algorithm. Notice that themodeling integral equation is linear; hence, the LS-criterion is a quadraticfunctional.

    To implement the CG algorithm, the gradient Su is computed by intro-ducing the Lagrangian,

    where f*q is the convolution product of the functions f and u, and

    is the scalar product of the function with any function u.When the Lagrange multiplier is fixed, the differential of the

    Lagrangian is

    By choosing as the solution of the (simple!) adjoint equation,

    The stationary condition of the Lagrangian is reduced to

    hence, the gradient equation is

    To develop this gradient equation, start from the definitions of the scalarand convolution products; we have

    Using the property of the Greens function f,

    L u , ,( ) 12--- Y 2 f *u, =

    u, t( )u t( ) td0

    t f=

    dL Y , , f *u, +=

    Y , f *u, +=

    Y =

    dL f *u, 0, u= =

    S u, f *u, 0, u= =

    S u, S x( ) u x( ) xd0

    t f= f *u, t( ) f t x( )u x( ) xd td

    0

    t0t f=

    -0861.book Page 161 Monday, August 12, 2002 6:43 PM

    2003 by CRC Press LLC

  • 162 Inverse Engineering Handbook

    the last double integral becomes

    Then, the first integral implies

    or, by using x as the mute variable instead of t,

    Finally, from the solution of the adjoint equation, the new integral equa-tion for the gradient S(t;u) of the LS-criterion emerges.

    Then, the gradient can be computed, and the conjugate gradient algorithmcan be performed. To compute (t;u) and S(t;u), the time variable is dis-cretized,

    where nf is the number of time steps, and the integrals equation are put inthe standard algebraic forms,

    with

    x t> t x 0

  • Chapter three: The adjoint method to compute the numerical solutions 163

    Numerical resultsThe MatLab code to solve this example using CG iteration is shown in Table3.16. Two cases are considered below one with low noise and one withhigher noise.

    (a) The solution is computed over the time interval , with t= 0.1 and nf = 50. The initial guess is taken equal to zero: = .A normally distributed noise is added to the output vector data Y, and thenoise level is , corresponding to Gaussian noise with astandard deviation of = 0.2. The iterative regularizing principle is adoptedto stop the conjugate gradient algorithm. Results are shown in Figure 3.26(convergence history) and in Figure 3.27. Note that the algorithm producesresults close to the exact solution after five iterations, stopping using theiterative regularization criterion. Figure 3.28 shows a graphical comparisonbetween the data for the problem and the corresponding computed valueof temperature using the computed input.

    (b) The noise level is amplified to by increasing thestandard deviation of the Gaussian noise to = 1.0. The algorithm stops afterfour iterations using the iterative regularization criterion, producing theresults seen in Figure 3.29 (convergence history) and Figure 3.30. The resultsare less regular due to the higher noise, but still reproduce the exact inputquite well.

    Conclusion

    This example shows how to use the adjoint method to compute the solutionof an inverse input problem with integral equation model. Due to the lin-earity of the modeling equations, the LS criterion is quadratic, and the

    0 t f = 5,ui

    0( ) 0 i, 1nf=

    2 Y 2 1.269= =

    FIGURE 3.26 Example 3.11: convergence history, low noise (case a).

    2 Y 2 54.4= =

    -0861.book Page 163 Monday, August 12, 2002 6:43 PM

    2003 by CRC Press LLC

  • 164 Inverse Engineering Handbook

    Table 3.16 MatLab Code for Example 3.11 % Semi-infinite body% Inverse input problem% Integral Equation model% Conjugate gradient algorithmcleardt=0.1;nf=50;% the discretized heat fluxfor n=1:nf

    axet(n)=dt*n;if n

  • Chapter three: The adjoint method to compute the numerical solutions 165

    lsw(iter)=ls;

    % compute the gradientfor n=1:nf

    s=0;for i=n+1:nf

    s=s+impulse(i-n)*psi(i);endg(n)=s;

    endng=norm(g)^2;if iter==1

    w=-g;else

    w=-g+ng/ng1*w1;end%compute the descent length% quadratic casefor n=1:nf

    s=0;for i=1:n-1

    s=s+impulse(n-i)*w(i);enddT(n)=s;

    end

    ro=(g*w')/(norm(dT)^2);q=q+ro*w;g1=g;w1=w;ng1=ng;iter=iter+1

    endplot(lsw)figureplot(axet,qexact,'g',axet,q,'r')figureplot(axet,Y,'g',axet,T,'r')

    function y=impulse(n)% temperature response % to the heat flux impulse % the semi-infinite heat conductiondt=0.1;if n

  • 166 Inverse Engineering Handbook

    conjugate gradient algorithm is very well adapted. The iterative regularizingprinciple is an efficient way to avoid the amplification of the data errors,and it is easy to implement.

    The output model equation

    FIGURE 3.27 Example 3.11: computed heat flux, low noise (case "a").

    FIGURE 3.28 Example 3.11: comparison between measured and computed temper-atures, low noise (case a).

    t( ) f t ( )u ( ) d0

    t=

    -0861.book Page 166 Monday, August 12, 2002 6:43 PM

    2003 by CRC Press LLC

  • Chapter three: The adjoint method to compute the numerical solutions 167

    admits the equivalent form

    The numerical resolution of the inverse parameter problem, which consistsin the determination of the parameter function f from the input and outputmeasurements, could be performed with the same algorithm.

    FIGURE 3.29 Example 3.11: computed heat flux, high noise (case "b").

    FIGURE 3.30 Example 3.11: comparison between measured and computed temper-atures, high noise (case b).

    t( ) u t ( ) f ( ) d0

    t=

    -0861.book Page 167 Monday, August 12, 2002 6:43 PM

    2003 by CRC Press LLC

  • 168 Inverse Engineering Handbook

    Adjoint method to minimize LS-criteria with ordinary differential equations as constraints

    Gradient of the LS-criterion with ODE as constraint

    In this section, we consider the case where the mathematical model involves(nonlinear) ordinary differential equations. To use the Lagrangian techniquesome refinements are required. The output (t;) is a function of someindependent variable, say t, over some interval . Since the time vari-able is often present, it is used, but, without any restriction, the independentvariable could be the space variable x. The set of n ODEs could be noted asbefore by R[(t),], but a more convenient form is preferred.

    The model output (t,) is the time varying solution of the modelingODE,

    where R is a vector function of and , and the initial condition vector 0is given.

    Consequently, if (t) is an arbitrary function that is not the solution ofthe modeling ODE, then it is true that

    The LS-criterion to be minimized is

    The Lagrangian multiplier (t) is a vector function of the independentvariable, and the Lagrangian L(,,) takes the form

    When is solution of the modeling ODE, it is denoted (), and theLagrangian is equal to the LS-criterion for any multiplier,

    0 t f,

    d t ;( )dt

    ------------------- R t ;( ) ,[ ] = 0, 0 < t t f

  • Chapter three: The adjoint method to compute the numerical solutions 169

    Assuming that the function (t) is fixed, independent of , then the differ-ential of the Lagrangian takes the forms

    Integrating by parts the second term gives

    and the differential dL becomes

    The choice of the Lagrange multiplier is free, so let us choose (t) to besolution of the set of linear ODE, also called adjoint equations,

    Hence, the differential dL reduces to:

    Since the initial condition of the output is fixed, = 0, and the secondterm is equal to zero,

    and the differential dL is reduced to

    Finally, using the property L((),,) = S(), the gradient S() of the LS-criterion is

    dL 2 Y , , RT[ ]T RT[ ]T { } td0

    t f=2 Y [ ] RT[ ] ,+ td , td

    0

    t f RT[ ]T, td0t f+0

    t f=

    t( ) t( ), td0

    t f [ ]t t f= [ ]t 0= t( ) t( ), td0t f=

    dL 2 Y [ ] RT[ ] ,+ + td RT[ ]T, td [ ]t t f= [ ]t 0=+0t f+0

    t f=

    t( ) RT t( ) 2 Y t( ) t( )[ ]; 0 t t f<

  • 170 Inverse Engineering Handbook

    which is called the gradient equation.

    Gradient of the LS-criterion with both ODE and AE as constraints

    As presented above, it is useful for dynamical process modeling to distin-guish between the state T and the output . Usually, these dependent vari-ables are vectors, but the dimension ns of the output vector is less than thedimension n of the state vector. In the previous section, for simplicity, wehave not considered this difference. Let us examine a more general situationin which the modeling equations involve both algebraic and ordinary dif-ferential equations.

    Now, the solution T of the ODE is the state variable, the ODE is alsocalled the state equation. The output is related to the state by an algebraicequation, which is also called observation equation, or output model equation.The unknown parameters could be in both equations. For simplicity here,the rectangular matrix C is supposed to be known independent of .

    The adjoint method described previously is extended to this new situa-tion by introducing the Lagrangian under the new form

    where the adjoint variable has the same dimension as the state variable T.For this reason, it is also called the adjoint state. Note that, in the Lagrangian,the output variable has been replaced by the state variable.

    The differential dL of the Lagrangian takes the forms

    The stationary condition, dL = 0, leads to choosing the Lagrange multiplier to be the solution of the following adjoint equations:

    S ( ) RT t( )[ ] t( ) td0

    t f=

    dT t ;( )dt

    ------------------- R T t ;( ) ,[ ] = 0; 0 t t f<

  • Chapter three: The adjoint method to compute the numerical solutions 171

    The gradient equation remains unchanged,

    These weak modifications introduced in the adjoint equations are veryproductive; the class of problems that can be solved is much larger. If someparameters are unknown in the output equation, there will be no moremodification in the adjoint equation, but the gradient equation will bechanged. This situation was first illustrated by the Example 3.10.

    Example 3.12. An inverse parameter problem in a solidification process

    This is a continuation of Example 3.4, considered previously.According to the notations introduced in Example 3.4, the nonlinear

    model equations that describe the state vector and the output vector of thelumped system take the form

    where

    The output data Y are computed over the time interval [0, 2] with thefunction a and the input u fixed as in Example 3.4.

    t( ) = TRT[ ] t( ) 2CT Y t( ) CT t( )[ ]; 0 t t f< ,=

    T 0( ) 0=

    CT=

    R T ,( ) 1 11 a T2( ) 1 a T2( )

    T u 10

    + A a( )[ ]T u 1

    0

    += =

    C 0 1=

    a x( ) 0.25 x 0.3115------

    ----------------

    2

    exp+=

    -0861.book Page 171 Monday, August 12, 2002 6:43 PM

    2003 by CRC Press LLC

  • 172 Inverse Engineering Handbook

    Taking tc = 0.5 and produces the results previ-ously computed and displayed in Figure 3.8. The upper curve is the resultingtemperature T2(t), which is taken as the output data Y in the inverse param-eter problem.

    The LS-criterion to be minimized is

    The solution that minimizes the LS-criterion is computed according tothe adjoint method and the conjugate gradient algorithm. Notice that theLS-criterion is not a quadratic function.

    To implement the CG algorithm, the gradient S is computed followingthe method developed in the previous section.

    where the Lagrange multiplier (t) is taken as the solution of the adjointequation,

    From the modeling equations, we find

    Using finite-difference approximation, the discretized adjoint equations are

    which are solved backward in time (integrated from end time to the initialtime).

    u t( ) u0, t tc,=

    T 0( ) 1=

    CT=

    R T u,( ) 1 11 a T2( ) 1 a T2( )

    T u 10

    + A a( )[ ]T u 1

    0

    += =

    C 0 1=

    -0861.book Page 180 Monday, August 12, 2002 6:43 PM

    2003 by CRC Press LLC

  • Chapter three: The adjoint method to compute the numerical solutions 181

    the differential of the Lagrangian dL is reduced to

    Developing, we obtain

    Using the property of the Lagrangian, L((),,) = S(), and the defi-nition of the scalar product of two functions, the gradient equation becomes

    The numerical resolution of the inverse problem being ill conditioned,the LS-criterion to be minimized is regularized using the penalty parameter as presented earlier,

    Only the gradient equation is changed; it becomes

    The solution that minimizes S(u) depends on the positive scalar .The rule introduced previously to optimize leads to solution of the alge-braic equation

    where is given and characterizes the data error. When the dataY in the LS-criterion are measurement results, 2 is determined from themeasurement noise level. Here, the data Y is a prescribed output, so is aprior fixed value. At the end of the minimization process, 2 will characterizethe bias between the desired and the computed outputs,

    t( ) = TRT[ ] t( ) 2CT Y t( ) CT t( )[ ]; 0 t t f<

  • 182 Inverse Engineering Handbook

    By increasing , the resulting bias will increase, but the solution will bemore regular. Some compromise must be made between accuracy and reg-ularity.

    Numerical resultsMatLab code to perform the CG iterations for this example is listed in Table3.19. The prescribed output history Y is chosen to have solidification at aconstant rate on the time interval between the initial temperatureT(0) = 1 and the final temperature equal to zero. In other words, we wantto find the heat removal rate required to obtain a linear decrease in temper-ature from T(0) = 1 to T(tc) = 0. The initial guess is taken equal to zero overthe time interval u(0)(t) = 0, 0 < t < 2.

    With = 0.001, the conjugate gradient algorithm produces the results inFigure 3.37 (convergence history) and Figure 3.38. The final value of the LS-criterion is

    The computed input is compared to the constant heat flux taken in theprevious section in Figure 3.38. The prescribed and the computed outputsare compared to that computed with the constant heat flux in Figure 3.39.Note that the results computed using the optimal value of heat flux inputcomputed in this example reproduce the desired change in temperature,whereas the constant heat flux results in a temperature history different fromthe desired one, owing to the mechanics of the solidification process.

    A smoother solution for u(t) is found by increasing the value of . Withthe parameter = 0.01, the solution is more regular, as seen in the results ofFigure 3.41, but the bias between the prescribed and the computed outputis increased, as seen in Figure 3.42. For this case, the bias can be quantified as

    ConclusionThe two examples presented in this section illustrate how to develop theadjoint method to solve numerically based inverse problems by minimizingLS-criteria when the modeling equations are a set of ordinary differentialequations. For both cases, the unknown to be determined was a function,which is a general situation with ODE modeling. For the inverse parameterproblem, a piecewise linear approximation of the unknown function a, which

    Y t( ) t;u( ) 2 td0

    t f 2=u

    0 t f = 2,

    Y t( ) t;u( ) 2 td0

    t f 2 0.01= =u

    Y t( ) t;u( ) 2 td0

    t f 2 0.0338= =

    -0861.book Page 182 Monday, August 12, 2002 6:43 PM

    2003 by CRC Press LLC

  • Chapter three: The adjoint method to compute the numerical solutions 183

    Table 3.19 MatLab Code for Example 3.13 % inverse input problem% ODE modeling% conjugate gradient

    clear globalglobal nn dt u Y YM e w

    nn=101;dt=0.02;t=0:dt:2;tc=1;u0=-(1+0.25+(sqrt(2*pi))/15)/tc;for n=1:nn

    if t(n)

  • 184 Inverse Engineering Handbook

    pw(2)=pw(2)-2*dt*e(n-1)/aw;pnew=A\pw;psi(n-1)=pnew(1); pw=pnew;

    end g=-psi+mu*u;ng=norm(g)^2;% determine the descent directionif iter==1

    w=-g;else

    w=-g+ng/ng1*w1;end

    %line search

    ro=fminbnd('phiu',0,100)

    %new iterateu=u-ro*w;

    g1=g;w1=w;ng1=ng;end

    plot(t,Yco,'g',t,Y,t,YM,'r')figureplot(t,uco,t,u,'r')figureplot(ls)

    function y=phiu(r)

    global nn dt u Y YM e w

    uw=u-r*w;

    zw=[1; 1];YM(1)=1;e(1)=0;for n=2:nnx=(zw(2)-0.3)*15;aw=0.25+exp(-x^2);

    A=[1+dt -dt;-dt/aw 1+dt/aw];zw(1)=zw(1)+dt*uw(n);znew=A\zw;YM(n)=znew(2);e(n)=Y(n)-YM(n);zw=znew;

    end

    res=norm(e);y=res^2;

    Table 3.19 MatLab Code for Example 3.13 (continued)

    -0861.book Page 184 Monday, August 12, 2002 6:43 PM

    2003 by CRC Press LLC

  • Chapter three: The adjoint method to compute the numerical solutions 185

    depends on the output variable, was considered to develop the gradientequation. For the inverse input problem, the unknown function u varies onlywith the independent time variable, so no such approximation is needed;however, the LS-criterion has to be regularized to avoid unstable solutions.For both cases, the output was nonlinear with respect to the unknownfunction; then, the LS-criteria were not quadratic, but the conjugate gradientalgorithm remains well adapted. A line search is recommended for thedetermination of the optimal step length at each iteration instead of usingthe equation valid for quadratic cases.

    FIGURE 3.37 Example 3.13: convergence history, = 0.001.

    FIGURE 3.38 Example 3.13: computed heat flux compared to a constant heat flux, = 0.001.

    -0861.book Page 185 Monday, August 12, 2002 6:43 PM

    2003 by CRC Press LLC

  • 186 Inverse Engineering Handbook

    0 0.5 1 1.5 2-0.2

    0.0

    0.2

    0.4

    0.6

    0.8

    1.0

    1.2

    time

    ou

    tput

    with uoptimat(t)

    with u(t) = uo/t

    c

    FIGURE 3.39 Example 3.13: estimated temperature, = 0.001.

    FIGURE 3.40 Example 3.13: convergence history, = 0.01.

    -0861.book Page 186 Monday, August 12, 2002 6:43 PM

    2003 by CRC Press LLC

  • Chapter three: The adjoint method to compute the numerical solutions 187

    Adjoint method to minimize LS-criteria with partial differential equations as constraintsIn this section, we study the adjoint method in the case where the mathe-matical model of the dynamical process involves partial differential equa-tions. For simplicity, we consider only two scalar independent variables, thetime t and the space x. As presented previously, we will distinguish betweenthe following dependent variables.

    FIGURE 3.41 Example 3.13: computed heat flux compared to a constant heat flux, = 0.01.

    0 0.5 1 1.5 2-0.2

    0

    0.2

    0.4

    0.6

    0.8

    1

    1.2

    time

    outp

    ut

    with u(t) = uo / t

    c

    with u(t) = uoptimal(t)

    FIGURE 3.42 Example 3.13: estimated temperature, = 0.01.

    -0861.book Page 187 Monday, August 12, 2002 6:43 PM

    2003 by CRC Press LLC

  • 188 Inverse Engineering Handbook

    The parameter, denoted , which can be a p-component vector or afunction

    The state variable T(t,x), which is at each time t, a function of thespace x

    The input u(t), which is a time varying scalar The output (t), which is a time varying vector

    The adjoint method is developed for three standard inverse problemswhich consist to determine the unknown parameter, or the unknown initialstate, or the unknown input, by minimizing LS-criteria. The resolution ofeach problem is illustrated by numerical results.

    The inverse parameter problem

    Gradient of the LS-criterion

    Example 3.14Let us start with the Example 3.1 but, instead of a semi-infinite heat con-ducting body, heat transfer is modeled in a finite space domain, 0 < x < L,and an adiabatic condition is added at x = L. The set of modeling equationsis the PDE model,

    The output model is the integral equation,

    where i is the characteristic function of the sensor i. The output model can be rewritten (as was done previously) by intro-

    ducing the observation operator C, which maps the state T to the output .

    For punctual discrete measurements, we will use the Dirac function i(x) =(x xi), then

    2Tx2---------

    Tt-------; 0 < x L t, 0>=

    kTx------- x L=0, t 0>=

    T x 0,( ) T0, 0 x L<

  • Chapter three: The adjoint method to compute the numerical solutions 189

    where are the locations of the ns sensors.In this example, the input u(t) = Tf and the initial state T0 are supposed

    to be known, and the parameters ,k,h are assumed to be constant.The new variables are introduced for scaling purposes.

    where is a given (arbitrary) time unit.Then, omitting the *, the modeling equations become

    Consider the inverse parameter problem, which consists in the determinationof the unknown two-component parameter vector , by minimizing the LS-criterion

    where the output vector data [Yi(t),i = 1,ns] is given over some time interval and (t) is determined by the solution of the PDE model and the

    observation equation. Then,

    The gradient S of the LS-criterion is determined according to theadjoint method. The Lagrangian is introduced in the form similar to that usedearlier for the adjoint method applied with both ODE and AE constraints.

    where the adjoint variable at each time t is a function of x, as is the stateT. Note that only the first modeling equation is considered as a constraint;

    i t( ) T xi t,( ) T x t,( ) x xi( ) x; id0

    L 1 ns,= = =xi ]0,L[, i 1 ns,=

    t* t--, x* x

    L---, T*

    T T0T f T0------------------, 1 L

    2

    ------, 2 hLk------,

    12

    = = = = = =

    1Tt Txx,=

    Tx 2T+ 2,=

    Tx 0,=

    T 0,=

    0 x 1 t, 0>< =

    x 1, t 0>=

    0 x 1 t,< < 0=

    CT=

    S ( ) Yi t( ) i t;( )[ ]2 td0t f

    i 1 ns,==

    0 t f,

    S ( ) Yi t( ) T x t,( ) x xi( ) xd[ ]2 td0L0t fi 1 ns,= Y CT 20t f dt= =

    L T , ,( ) Y CT 2 1Tt, Txx V{ } td0

    t f=

    -0861.book Page 189 Monday, August 12, 2002 6:43 PM

    2003 by CRC Press LLC

  • 190 Inverse Engineering Handbook

    functions T are supposed to satisfy the boundary and the initial conditionsof the modeling equations.

    By definition in this example, the scalar product notation is usedfor any (square integrable) functions v defined on the space domain [0,1], sothe scalar is time varying when the functions ,v dependon time t.

    Integration by parts give

    The Lagrangian becomes

    or, using the boundary and the initial conditions on T,

    When the adjoint variable is fixed, the differential of the Lagrangianresulting of any variations T and d is

    The notation is used here for the standard scalar productof two vectors.

    By definition of the operator C* (= the adjoint operator of C), this scalarproduct admits the equivalent forms,

    v, V v, V v xd

    0

    1=

    Tt, V td0

    t f T, V[ ]t t f= T, V[ ]t 0= t T, V td0t f=

    Txx, V Tx xT[ ]x L= Tx xT[ ]x 0= xx T, V+=

    L T , ,( ) Y CT 2 T 1t, xx+ V+{ } t 1 T, V t t f= 1 T, V t 0=+d0t f=

    Tx xT[ ]x L= Tx xT[ ]x 0={ } td0

    t f+

    L T , ,( ) Y CT 2 T 1t, xx+ V+{ } t 1 T, V t t f=+d0t f=

    xT[ ]x L= 2 T 1( ) xT[ ]x 0={ } td0

    t f+

    dL 2 Y CT( ) CT, T 1t, xx+ V+{ } t 1 T, V t t f+d0t f=

    xT[ ]x L= 2 x( )T[ ]x 0={ } td Li-------i 1 2,=+ id0t f+

    Y CT( ) CT,

    Y CT( ) CT, C* Y CT( ) T, V=

    -0861.book Page 190 Monday, August 12, 2002 6:43 PM

    2003 by CRC Press LLC

  • Chapter three: The adjoint method to compute the numerical solutions 191

    Using the definition of the observation operator C, the scalar is evaluated tobe

    with ei(t) = Yi(t) T(xi,t),i = 1,ns.Then the equation

    implies

    The choice of the adjoint variable is free; it is chosen to be the solution ofthe set of the following PDEs:

    These adjoint equations are solved backward in time by integrating from thefinal time down to zero. The source terms are discrete and located at eachsensor location xi, where they are proportional to the deviation ei betweenthe output data and the model output.

    Consequently, the differential dL is reduced to

    When T is the solution of the heat equation, the Lagrangian is equal tothe LS-criterion, L(T(),,) = S(), and the components of the gradient ofthe LS-criterion can be computed from the gradient equations under thesimple forms,

    Y CT( ) CT, ei t( ) x xi( )T x t,( )i 1 ns,= xd

    0

    1=Y CT( ) CT, ei t( ) T x t,( ) x xi( ) xd

    0

    1i 1 ns,==

    C* Y CT( ) T, V ei t( ) x xi( )T x t,( )i 1 ns,= xd

    0

    1=

    C* Y CT( ) ei t( ) x xi( )i 1 ns,==

    1t xx+ 2C* Y CT( ),=

    x 2+ 0,=

    x 0, x 1,= =

    0, 0 x 1,<

    t t f=

    dL Li-------dii 1 2,==

    -0861.book Page 191 Monday, August 12, 2002 6:43 PM

    2003 by CRC Press LLC

  • 192 Inverse Engineering Handbook

    Numerical resultsStandard finite-difference approximations of the PDE leads to computationof the state vectors Tk as the numerical solution of recursive algebraic equa-tions in the form

    where nt is the number of time steps, Tk and b are nx-component vectors,with ; nx is the number of nodes of the spatial grid;the source term b is a constant vector and only the first component is differentfrom zero; [A] is an (nx,nx) tridiagonal matrix. The matrix [A] and the vectorb depend on the parameter .

    The ns-component output vectors k are computed from the observationequation,

    where ns is the number of sensors, and C is an (ns, nx) matrix.The adjoint vectors k are computed from the discretized adjoint equa-

    tions, which have the same form as for the direct ones, but they are solvedbackward in time.

    where the source term k is proportional to .The discretized form of the gradient equation is then

    A MatLab code to solve this example is shown in Table 3.20. The outputdata vectors (Yk,k = 1,nt) are first computed with the parameter vector

    L1--------

    S1-------- Tt, V td0

    t f Tt xd td010

    t f= = =L2--------

    S2-------- 0 t,( ) 1 T 0 t,( )( ) td0

    t f= =

    A[ ]Tk 1+ Tk b, k+ 0 nt 1,= =

    Tik T xi tk,( ), i 1 nx,= =

    k CTk, k 0 nt,= =

    A[ ]k 1 k k, k+ nt 2 (step 1),= =

    CT Yk k

    S1--------

    k[ ]T Tk 1+ Tk[ ]xk

    =

    S2-------- 1

    k 1 T1k

    ( )tk

    =

    1020

    =

    -0861.book Page 192 Monday, August 12, 2002 6:43 PM

    2003 by CRC Press LLC

  • Chapter three: The adjoint method to compute the numerical solutions 193

    Table 3.20 MatLab Code for Example 3.14 % inverse parameter problem% PDE modelclear globalclearglobal b w nx nt dx dt A Y YM TM C e

    dx=0.05;nx=21;tf=2;nt=51;dt=tf/(nt-1);t=0:dt:tf;

    % two sensor locationsC=zeros(2,nx);C(1,5)=1;C(2,10)=1;

    % the output dataY=zeros(2,nt);b=[10;20];bmin=[5; 5];w=[0; 0];phipde(0); Y=YM;plot(t,Y(1,:),t,Y(2,:),'r')

    % conjugate gradient algorithm

    b=[20; 5];bb(:,1)=b;itm=25;iter=1:1:itm+1;for it=1:itm

    % the output model% and the LS-criterion

    lsi=phipde(0);ls(it)=lsi;

    % the adjoint variable% and the gradientPw=zeros(nx,1);g=[0; 0];for k=nt:-1:2

    Pw=Pw+2*dt*C'*e(:,k-1);Pnew=A\Pw; Pw=Pnew;dT=TM(:,k)-TM(:,k-1);g(1)=g(1)+dx*Pw'*dT;g(2)=g(2)-dt*Pw(1)*(1-TM(1,k));

    endng=norm(g)^2;

    % the descent directionif it==1

    w=-g;else

    -0861.book Page 193 Monday, August 12, 2002 6:43 PM

    2003 by CRC Press LLC

  • 194 Inverse Engineering Handbook

    w=-g+ng/ng1*w1;end

    % the line search% and the new iterate

    rom=1e5;for j=1:2

    if w(j)

  • Chapter three: The adjoint method to compute the numerical solutions 195

    over the time interval . By taking nx = 21, nt = 50, ns = 2, andthe sensor locations at {x1 = 0.2, x2 = 0.5}, the output is obtained is as shownin Figure 3.43.

    Starting the conjugate gradient algorithm with different initial guessesproduces the following results:

    With (0) = [5 35]T, the value S = 1e 6 of the LS-criterion is obtainedin less than iter = 10 iterations, and the computed values are close tothe exact values.

    With (0) = [20 5]T, the same values are reached in iter = 20 iterations.

    The influence of output additive noise on the minimization process wasdiscussed in the last section, it is not repeated here. But, for a given noiselevel 2 and using the iterative regularizing principle, the final computedvalues can be predicted from the following plots.

    Results with (0) = [5 35]T are shown in Figure 3.44 and Figure 3.45(convergence history).

    A noise level 2 > e 4 (final iter < 4) would produce bad estimation ofthe parameter. Note that the LS-criterion is computed with ns nt = 2 50= 100 terms.

    Results with (0) = [20 5]T are seen in Figure 3.46 and Figure 3.47 (con-vergence history).

    0 t f, 2=

    FIGURE 3.43 Simulated data for Example 3.14.

    iter = 10( ) exactexact------------------------------------------- 0.001=

    -0861.book Page 195 Monday, August 12, 2002 6:43 PM

    2003 by CRC Press LLC

  • 196 Inverse Engineering Handbook

    FIGURE 3.44 Example 3.14: results obtained with (0) = [5 35]T.

    0 5 10 15 20 2510

    -15

    10-10

    10-5

    100

    105

    Iteration number

    LS-cr

    iterio

    n

    FIGURE 3.45 Example 3.14: convergence history with (0) = [5 35]T.

    -0861.book Page 196 Monday, August 12, 2002 6:43 PM

    2003 by CRC Press LLC

  • Chapter three: The adjoint method to compute the numerical solutions 197

    The inverse state problem

    Gradient of the LS-criterion

    Example 3.15

    The previous example is continued, but the initial condition T(x,t = 0) of themodeling equations is supposed to be spatially varying. The PDE modelbecomes

    FIGURE 3.46 Example 3.14: results obtained with (0) = [20 5]T.

    FIGURE 3.47 Example 3.14: convergence History with (0) = [20 5]T.

    -0861.book Page 197 Monday, August 12, 2002 6:43 PM

    2003 by CRC Press LLC

  • 198 Inverse Engineering Handbook

    The input Tf = 1, and the parameter vector are supposed to be known.Consider the inverse state problem, which consists in the determination

    of the unknown function f by minimizing the LS-criterion,

    The Lagrangian is unchanged.

    but T and f are independent, and the functions T are supposed to satisfy(only) the boundary conditions. After integration by parts, the Lagrangiantakes the form

    The adjoint variable (x,t) is fixed to be the solution of the (unchanged)adjoint equations,

    so the differential dL of the Lagrangian is reduced to

    When T is solution of the heat equation, the Lagrangian is equal to theLS-criterion, L(T(f),f,) = S(f), and the gradient of the LS-criterion can becomputed from the gradient equation under the simple form

    1Tt = Txx,Tx 2T+ 2,=

    Tx 0, x 1,= =

    T f , 0 x 1,< < =

    t 0>

    t 0=

    CT=

    S f( ) Yi t( ) i t; f( )[ ]2 td0

    t fi 1 ns,==

    L T f , ,( ) Y CT 2 1Tt, Txx V{ } td0

    t f=

    L T f , ,( ) Y CT 2 T 1t xx+, V+{ } t 1 T, V t t f= 1 T, V t 0=+d0t f=

    Tx xT[ ]x L= Tx xT[ ]x 0={ } td0

    t f+

    1t xx+ 2C* Y CT( ),=x 2+ 0,=

    x 0, x 1,= =

    0, 0 x 1,<

    t t f=

    dL 1 f, V t 0==

    -0861.book Page 198 Monday, August 12, 2002 6:43 PM

    2003 by CRC Press LLC

  • Chapter three: The adjoint method to compute the numerical solutions 199

    Numerical resultsMatLab code to solve this example is listed in Table 3.21. Two different casesare considered.

    (a) The state vectors Tk are first computed with the parameter = [10 20]over the time interval as in Example 3.13 with nx = 21. Thecomputed final state is taken as the initial state f, which is to be determinedfor this experiment.

    Now the output data vectors (Yk,k = 1,nt) are computed with an adiabaticcondition at x = 0, (2 = 0), over the new time interval at thesensor locations {x1 = 0.2, x2 = 0.5}.

    In this example, the output (t;f) is linear with respect to f, so the LS-criterion is quadratic. The numerical resolution of this inverse problem is illconditioned, so regularized solutions are computed, as discussed in Example3.13, by introducing the scalar in the gradient equation, which becomes

    The influence of the parameter on the computed solution has alreadybeen discussed, and it will not be repeated here. By taking the initial guessequal to zero, f(0)(x) = 0, 0 < x < 1, and the parameter = 0.002, the conjugategradient algorithm produces the results in Figures 3.48 (convergence his-tory) and 3.49. The reconstructed state f(iter = 100) is close to the exact solution.The computed temperatures are compared to the original data in Figure3.50.

    (b) Without changing the initial state f, a second experiment is done withthe parameter 2 = 20, and the fluid temperature is equal to 0. In other words,this simulates an experiment in which the surface is cooled with a constantheat transfer coefficient h. The output data vectors (Yk,k = 1,nt) are computedover the new time interval at the new sensor locations{x1 = 0.05, x2 = 0.5} with the new boundary condition

    The MatLab code in Table 3.21 was modified to reflect the change inboundary condition and sensor location. The conjugate gradient algorithmproduces the results in Figures 3.51 (convergence history), 3.52 (the recoveredtemperature distribution), and 3.53.

    Even with a sensor located at x = 0.05 instead of x = 0.2, the reconstructedstate is farther from the exact solution near the boundary x = 0. The adiabaticcondition was more favorable. The final value S = 3e 4 of the LS-criterionis reached faster than in the previous experiment.

    f S x( ) 1 x t, = 0( ) 0 x 1<

  • 200 Inverse Engineering Handbook

    Table 3.21 MatLab Code for Example 3.15 % inverse state problem% PDE model

    clear

    dx=0.05;nx=21;x=0:dx:1;b=[10;20];tf=0.4;nt=11;dt=tf/(nt-1);

    % two sensor locationsC=zeros(2,nx);C(1,5)=1;C(2,10)=1;

    fo=dt/(b(1)*dx*dx);f1=2*fo*b(2)*dx;A=(1+2*fo)*eye(nx);for i=2:nx-1

    A(i,i+1)=-fo;A(i,i-1)=-fo;endA(1,2)=-2*fo;A(nx,nx-1)=-2*fo;A(1,1)=A(1,1)+f1;Tw=zeros(nx,1);

    % the initial state % to be determined

    for k=2:ntTw(1)=Tw(1)+f1;Tnew=A\Tw;YM(:,k)=C*Tnew;Tw=Tnew;

    end

    T0=Tw;Y(:,1)=C*Tw;

    % the output data with % the new initial state% the input is switched to zero

    f1=0; A(1,1)=1+2*fo;tf=2;nt=51;dt=tf/(nt-1);t=0:dt:tf;for k=2:nt

    Tnew=A\Tw;Y(:,k)=C*Tnew;Tw=Tnew;

    end

    % conjugate gradient algorithm

    itm=150; f=zeros(nx,1);mu=0.002;

    for it=1:itm% the output model

    -0861.book Page 200 Monday, August 12, 2002 6:43 PM

    2003 by CRC Press LLC

  • Chapter three: The adjoint method to compute the numerical solutions 201

    % and the LS-criterion

    Tw=f;YM(:,1)=C*f;for k=2:nt

    Tnew=A\Tw;YM(:,k)=C*Tnew;Tw=Tnew;

    ende=Y-YM;lsi=norm(e)^2;ls(it)=lsi;

    % the adjoint variable% and the gradientPw=zeros(nx,1);for k=nt:-1:2

    Pw=Pw+2*dt*C'*e(:,k-1);Pnew=A\Pw; Pw=Pnew;

    endg=b(1)*Pw-mu*f; ng=norm(g)^2;

    % the descent directionif it==1

    w=-g;else

    w=-g+ng/ng1*w1;end

    % the descent step length% quadratic casedTw=w;dY(:,1)=C*dTw;for k=2:nt

    dTnew=A\dTw;dY(:,k)=C*dTnew;dTw=dTnew;

    end

    ro=0.5*g'*w/norm(dY)^2;

    % the new iterate

    f=f+ro*w;g1=g;ng1=ng;w1=w;

    end

    figureplot(ls)figureplot(x,T0,x,f,'r')figureplot(t,Y,t,YM)

    Table 3.21 MatLab Code for Example 3.15 (continued)

    -0861.book Page 201 Monday, August 12, 2002 6:43 PM

    2003 by CRC Press LLC

  • 202 Inverse Engineering Handbook

    The inverse input problem

    Gradient of the LS-criterion

    Example 3.16

    Example 3.2 is continued here. Instead of a semi-infinite heat conductingbody, heat transfer is modeled in a finite space domain, 0 < x < L, andan adiabatic condition is considered at x = L. The set of modeling equa-tions is

    FIGURE 3.48 Example 3.15a: convergence history.

    FIGURE 3.49 Example 3.15a: recovered temperature distribution.

    -0861.book Page 202 Monday, August 12, 2002 6:43 PM

    2003 by CRC Press LLC

  • Chapter three: The adjoint method to compute the numerical solutions 203

    FIGURE 3.50 Example 3.15a: comparison between computed and measured tem-peratures.

    FIGURE 3.51 Example 3.15b: convergence history.

    1Tt Txx,=

    Tx u,=

    Tx 0,=

    T 0,=

    0 x 1 t 0>,< ( )=

    x 1, t 0>( )=

    0 x 1, t< < 0=

    CT=

    -0861.book Page 203 Monday, August 12, 2002 6:43 PM

    2003 by CRC Press LLC

  • 204 Inverse Engineering Handbook

    where the output equation is unchanged,

    In this example, the initial state and the parameters are known.Consider the inverse input problem, which consists in the determination

    of the unknown heat flux u(t), by minimizing the LS-criterion,

    FIGURE 3.52 Example 3.15b: recovered temperature distribution.

    FIGURE 3.53 Example 3.15b: comparison between computed and measured tem-peratures.

    CT i t( ) T xi t,( ) T x t,( ) x xi( ) x; id0

    L 1 ns,= = = =

    -0861.book Page 204 Monday, August 12, 2002 6:43 PM

    2003 by CRC Press LLC

  • Chapter three: The adjoint method to compute the numerical solutions 205

    where the output vector data [Yi(t),i = 1,ns] is given over some time interval, and (t) is determined by the solution of the PDE model and the

    observation equation. To determine the gradient uS of the LS-criterion according to the adjoint

    method, the Lagrangian is introduced as above

    where the functions T satisfy the boundary and the initial conditions. Afterintegration by parts, the Lagrangian takes the form

    When the adjoint variable is fixed, the differential of the Lagrangianresulting of any variations T and u, is

    By choosing the adjoint variable to be the solution of the set of fol-lowing PDEs,

    the differential of the Lagrangian dL is reduced to