Sunteți pe pagina 1din 25

UNIVERSIT DEGLI STUDI DI NAPOLI FEDERICO II Facolt di Ingegneria

Corso di Laurea in Ingegneria Aerospaziale

Tesi di Laurea Triennale

Numerical Schemes Based on Spline Interpolation and Their Application to Eigenvalues Problem

Relatore:

Laureando:

prof. Gennaro Coppola

Adrian Dmytriv matr. N35/38

Anno accademico 2010-2011

Contents
1 Cubic splines 1.1 Formulations . . . . . 1.2 Derivation . . . . . . . 1.3 Alternative formulation 1.4 Endpoints conditions . 1.4.1 Natural spline . 1.4.2 Clamped spline 1.4.3 Not-a-knot . . 1 1 2 3 3 3 4 4 6 6 7 8 10 10 10 15 19 19 20 23

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

2 Spline schemes 2.1 Spline in M atlab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.2 Derivative operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3 Example of application . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Graetz problem 3.1 Introduction . . . . . 3.2 Description . . . . . 3.3 Numerical solution . 3.4 Scripts used . . . . . 3.4.1 Calculation of 3.4.2 Calculation of Bibliography . . . . . . . . the the . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . autofunctions temperature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

ii

Chapter 1 Cubic splines


1.1 Formulations

Denition: Given n data points (x1 , y1 ), ..., (xn , yn ) a cubic spline is a piecewisedened function of the form: S1 (x) = y1 + b1 (x x1 ) + c1 (x x1 )2 + d1 (x x1 )3 S2 (x) = y2 + b2 (x x2 ) + c2 (x x2 )2 + d2 (x x2 )3 ................ .................... for x (xn1 , xn ) for x (x1 , x2 ) for x (x2 , x3 )

Sn1 (x) = yn1 +bn1 (xxn1 )+c2 (xxn1 )2 +dn1 (xxn1 )3

The 3n 3 unknowns (bi , ci , di ) are chosen to satisfy the interpolation constraints and also some smoothness constraints: Interpolation Conditions: we already have Si (xi ) = yi for i = 1 to n 1. In addition, we want the overall function to be continuous. At the interior points, i = 1, 2, ..., n 2, Si (xi+1 ) = Si+1 (xi+1 ) = yi+1 and at the far right value of x, Sn1 (xn ) = yn . Altogether, there are n 1 constraints here. Smoothness Condition 1: at the interior points, Si (xi+1 ) = Si+1 (xi+1 ). There are n 2 constraints here. 1

1 Cubic splines

Smoothness Condition 2 : at the interior points, Si (xi+1 ) = Si+1 (xi+1 ). There are n 2 constraints here. So far, we have (n 1) + (n 2) + (n 2) = 3n 5 constraints, but we have 3(n 1) = 3n 3 coecients. We need two more constraints to dene the cubics uniquely. We can have dierent cubic splines depending on how we want to use our two extra constraints. Here are some common ones: The Natural Spline: S1 (x1 ) = 0 = Sn1 (xn ) The Clamped Spline: the user denes S1 (x1 ) and Sn1 (xn ) Not-A-Knot : ( Matlab Default ) Third derivatives match at x2 and xn1 : S1 (x2 ) = S2 (x2 ) Sn2 (xn2 ) = Sn1 (xn2 )

1.2

Derivation
Si (x) = ai + bi (x xi ) + ci (x xi )2 + di (x xi )3 Si (x) = bi + 2ci (x xi ) + 3di (x xi )2 Si (x) = 2ci + 6di (x xi )

Now we need to nd the espressions for the derivatives of Si :

It is very helpful to introduce the hi = (xi+1 xi ). Then the spline conditions on the uniform mesh can be written as follows: Si (xi ) = yi Si (xi+1 ) = yi+1 yi+1 Si (xi+1 ) = Si+1 (xi+1 ) Si (xi+1 ) = Si+1 (xi+1 ) for y = 0, 1, ..., n 1 : for y = 0, 1, ..., n 1 : for y = 0, 1, ..., n2 : for y = 0, 1, ..., n 2 : ai = y i ai + hi bi + h2 ci + h3 di = i i bi +2hi ci +3h2 di bi+1 = 0 i 2ci + 6hi di 2ci+1

Obtained equations above can be written as a linear system for the 4n unknowns. 2

1 Cubic splines

1.3

Alternative formulation

This linear system can be simplied considerably by dening mi = Si (xi ) = 2ci or ci = mi and thinking of the mi as unknowns instead. Then: 2 Si (xi+1 ) = Si+1 (xi+1 ) 1 for 2ci + 6hi di 2ci+1 = 0 mi + 6hi di mi+1 = 0 di = mi+1 mi 6hi i = 0, 1, ..., n 2 :

Si (xi ) = yi and Si (xi+1 ) = yi+1 for yi + hi bi + h2 ci + h3 di = yi+1 i i Substitute ci , di and di from above: m bi = yi+1iyi hi2 i hi (mi+1 mi ) h 6

i = 0, 1, ..., n 1 :

Si (xi+1 ) = Si+1 (xi+1 ) for i = 0, 1, 2, ..., n 2 : bi + 2hi ci + 3h2 di = bi+1 i Substitute bi , ci and di from above and simplify: y hi mi + 2(hi + hi+1 )mi+1 + hi+1 mi+2 = 6( yi+2i+1i+1 yi+1iyi ) h h Notice: these are n 1 linear equations for n + 1 unknowns (mi )

1.4
1.4.1

Endpoints conditions
Natural spline

In this case we have m0 = 0 and mn = 0 for taken together gives an (n+1)(n+1) system: m 0 1 0 0 ... 0 m1 h0 2(h0 + h1 ) h1 0 m 0 2 h1 2(h1 + h2 ) h2 0 m 0 3 = 0 h2 2(h2 + h3 ) h3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 0 hn2 2(hn2 + hn1 ) hn1 . . 0 0 1 m
n

1 Cubic splines

y y2h 1 1 y3 y2 y h2 4 y3 6 h3 yn yn1 hn1

0 . . . 0

y1 y0 h0 y2 y1 h1 y3 y2 h2

yn1 yn2
hn2

as we see we could just drop the equations for m0 and mn and write it as an (n 1)(n 1) system.

1.4.2

Clamped spline

Clamped Spline, sometimes called a complete spline (derivative is specied): S0 (x0 ) = A b0 = A y m A = y1h0 0 h02 0 h0 (m1 m0 ) 6 y 2h0 m0 + h0 m1 = 6( y1h0 0 A) and Sn1 (xn ) = B bn1 = B yn1 hn1 mn1 + 2hn1 mn = 6(B ynhn1 ) So, we put this two equations in the rst and the last rows: 2h0 h0 0 ... 0 h0 2(h0 + h1 ) h1 0 0 h1 2(h1 + h2 ) h2 0 0 0 h2 2(h2 + h3 ) h3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 0 hn2 2(hn2 + hn1 ) hn1 0 hn1 2hn1

1.4.3

Not-a-knot

In this case the third derivate is matching: S0 (x1 ) = S1 (x1 ) and Sn2 (xn1 ) = Sn1 1(xn1 ) Using Si (x) = 6di and di = mi+1 mi , these conditions become m1 m0 = m2 m1 6 and mn1 mn2 = mn mn1 . The matrix in this case is: 4

1 Cubic splines

1 2 1 ... 0 h0 2(h0 + h1 ) h1 0 0 h1 2(h1 + h2 ) h2 0 0 0 h2 2(h2 + h3 ) h3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 0 hn2 2(hn2 + hn1 ) hn1 1 2 1

Chapter 2 Spline schemes


2.1 Spline in M atlab

For the implementation of spline interpolation in M atlab the relevant commands are spline, ppval and mkpp. Suppose, that we need to interpolate n (in this case 10) values (xi , yi ) , so by writing F=spline (, y ), where (, y ) are vectors containing x x interpolating values is obtained sctructure:

form: breaks: coefs: order: dim:

pp [1 2 3 4 5 6 7 8 9 10] [9x4] 4 1 ,

where: pp is abbreviation of piecewise polynomial form; breaks containing nodal values of xi (in our case from 1 to 10); coefs containing 4 coecients for every of the local polynomial, starting from the higher order (4) ; order is 4 because M atlab interprets it like the number of the coeciets that we need to dene uniquely the cubic spline; dim is 1 becouse we use vectors and not arrays for the representation of x, y . Once, the struct was obtained, we can get the values of interpolated function for any x included in the range of break points and even outside by command ppval(F,x). If we have operated with the coecients and we need to put them back to pp form, is suciente to write mkpp(coefs,x), where size correlation must be matched. As we said before, M atlab use not-a-knot endpoints condition for cubic spline. 6

2 Spline schemes

2.2

Derivative operator

As we know, the derivative is a linear operator. On the discrete domain it can be approsimated by a matrix. Considering one dimensional space where we know n values of the generic function , our aim becomes to nd the matrix D containing the weights of the derivatives : f1 f1 f2 f2 d = [D] ... dx ... fn fn The construction of the matrix D is based on the fact that analitical derivation of interpolating polynomial permit to obtain values of numerical derivative of the function. In particular, if we cosider n th order polinomial a0 + a1 (x x0 ) + a2 (x x0 )2 + ... + an (x x0 )n , the discrete derivative of k th order f (k) evaluatd in x0 is given by relation f (k) = k!ak . Then to obtain f (k) we derive k times interpolating polynomial k!ak + (k + 1)!ak+1 (x x0 ) + ... + n! an (x x0 )nk k! (2.3) (2.2) (2.1)

and evaluate it at x0 , in this way remains only k!ak and the other terms disappear. The next step is to apply this operation to the identity matrix nx n. This procedure gives weights , that we are going to multipy by the appropriate values of the function and it will return the values of numerical derivative at the placement point. So we have created the ruotines using this approach, were the local cubic spline was used as interpolating polinomial. Hence, we have fi (x) = ai (x xi )3 + bi (x xi )2 + ci (x xi ) + di fi (x) = 3ai (x xi )2 + 2bi (x xi ) + ci fi (x) = 6ai (x xi ) + 2bi (x xi ). That moltiplications were done on the rows 5 and 6 of the reported script: (2.4) (2.5) (2.6)

2 Spline schemes

function d=drvtspl(x,y) pp C Cder1 Cder2 ppder1 ppder2 spd1 spd2 d = = = = = = = = = spline(x,y) pp.coefs [3*C(:,1) 2*C(:,2) C(:,3)] [6*C(:,1) 2*C(:,2)] mkpp(x,Cder1) mkpp(x,Cder2) ppval(ppder1,x) ppval(ppder2,x) [spd1;spd2] ; ; ; ; ; ; ; ; ; % % % % % % % % % costruzione della spline nella pp-form estraggo i coefficienti derivata prima derivata seconda genera una nuova variabile pp genera una nuova variabile pp valutazione della derivata prima valutazione della derivata seconda inserisco valori delle derivate ,

Using that routine we are going to evaluate the numerical derivatives (rst and second) of each column-vector of the identity matrix : function D=MD_spline(x,oderv) N = length(x) I = eye(N) D = zeros(N,N,2) for i=1:N Dloc = drvtspl(x,I(:,i)) D(:,i,1) = Dloc(1,:) D(:,i,2) = Dloc(2,:) end if nargin ==2 D = D(:,:,oderv) end ; % lunghezza vettore x ; % matrice canonica ; % matrice delle derivate 1 e 2 ; % derivazione vettori componenti ; % inserimento valore derivata 1 ; % inserimento valore derivata 2 % se input contiene 2 valori allora ; % memorizzo solo derivata specificata ; % da oderv

2.3

Example of application

As an example we can analyze the matrix of weights of the second derivative on discrete domain [0; 1] composed of 30 knots with Dirichlet boundary conditions. On the following gure (2.1) we can see the relative error in the evaluation of the rst 10 eigenvalues and its comparison with the results obtained using nite dierence scheme of the second order. As we can see our scheme with the splines has the same accuracy of FDS. The next gure (2.2) shows the error of the same evaluation during increasing of the points number of x.

2 Spline schemes

10

Errore relativo nella valutazione di 10imo autovalore

10

10

10

Spline FDS 1 2 3 4 5 6 7 8 9 10

Figure 2.1: Comparison of the relative error in the evaluation of the rst 10 eigenvalues using the second order dierence schemes and the cubic spline.
10
0

Errore relativo di 10imo autovalore al variare di N Spline FDS

10

Error

10

10

10

10

10 N = num. di punti

10

Figure 2.2: Comparison of the relative error in the evaluation of the 10-th eigenvalue using the second order dierence schemes and the cubic spline and changing the knots number.

Chapter 3 Graetz problem


3.1 Introduction

By the end of the last century, the problem of forced convection heat transfer in a circular tube in laminar ow gained interest because of its fundamental importance in physical problems such as the analysis and design of heat exchangers. The Graetz problem is a simplied case of the problem of forced convection heat transfer in a circular tube with laminar ow. With the assumptions of steady, incompressible and fully established ow, constant uid properties, no "swirl" component of velocity, a fully developed temperature prole, and negligible energy dissipation eects, Graetz (1883) originally solved this problem analytically. The solution by Graetz involved an innite number of eigenvalues, and in his paper only the rst two eigenvalues were evaluated. Since the accuracy of the Graetz solution mainly depends on the number of eigenvalues, it is extremely important to obtain more eigenvalues. Sellars (1956) extended the problem to include a more eective approximation technique for evaluation of the eigenvalues of the problem; they could get any number of eigenvalues as needed. This work solved the Graetz problem completely.

3.2

Description

As we have seen the Graetz problem is the problem of development of the proles of temperature T (x, r) in a duct with sudden temperature change on the wall. So the problem that we are going to resolve concerns duct subjects to a set temperature of the wall, of which we analyze the area dynamically developed in which we have parabolic prole of velocity, but not developed thermally. In this case the eld temperature is a function of the coordinates x and r, where x is the axis of symmetry, and r is the radius (Figure 3.1 on the following page). 10

3 Graetz problem

Figure 3.1 Neglecting dissipation and heat conduction along the axis, the energy equation Cp DT = Dt
2

T +

(3.1)

in cylindrical coordinates becomes u T T = (r ), x r r r (3.2)

where = Cp is the thermal diusivity of the uid. The velocity distribution u(x, r) is assumed known in the equation and could be one of the following three types :

u = u = const or slug ux: suitable for low Prandtl numbers, so for uids such as liquid metals, where the temperature T is evolving much faster than the velocity u;
r u = 2(1 r2 ) or Poiseuille velocity: appropriate for high Prandtl numbers, so u 0 for uids such as oils, where the thermal input is far away and so is downstream the entry of the duct;
2

developing proles of u: it can be used for each Prandtl number, but this method is normally used when the velocity and temperature at the duct entry are in the same position. We are going to use the Graetz solution for second case ( Poiseuille ). With reference to gure (3.1) we impose the appropriate boundary conditions on T (x, r) for the equation ( 3.2) : T (0, r) = T0 T (r0 , x) = Tw 11 f or f or x0 x > 0. (3.3) (3.4)

3 Graetz problem

Since T ranges from T0 (inlet temperature) to Tw (wall temperature) and r varies between 0 and r0 (radius of the duct) becomes convenient to use dimensionless variables, in this way we can eliminate the thermal diusivity coecient . Hence, Tw T (3.5) Tw To r (3.6) r = r0 x x = , (3.7) d0 ReP r d where Re = u 0 is the Reynolds number referred to the diameter d0 and P r is p the Prandtl number which together form the Peclet number P e = P rRe = C d0 . Combining the equation (3.2) with the dimensionless variable we obtain T = T T 2 = (r ), x r (1 r2 ) r r (3.8)

where T (r ,0) = 1 and T (1, x ) = 0. Note that this equation is totally independent of the parameters, due to our choice of variables (T , r , x ). Its clear that the variables are separable, so that we can get a solution in this form: T (r , x ) = f (r )g(x ). That is a particular solution and replacing it in equation (3.8) we obtain: r f + f g = = 2 = cost. 2g r (1 r2 )f
2

(3.9)

(3.10)

The function g has the solution g = Ce2 x while nding the solution of f is more complicated. To obtain the solution T = f g satisfying condition T (r ,0) = 1 for all r we exploit the linearity of the equation and overlay many similar solutions, so nally the suitable formulation becomes:

T (r , x ) =
n=0

Cn fn (r )e2

2 x

(3.11)

Where the functions fn has the characteristics of solutions of the equation (3.10): r fn + fn + 2 r (1 r2 )fn = 0, n (3.12) where we take for simplicity fn (0) = 1, fn (1) = 0 for satisfy the condition of wall temperature T (1, x ) = 0 from equation (3.8). Then the solution will be complete if it rispect the other initial conditions of the same equation :

T (r ,0) = 1 =
n=0

Cn fn (r ).

(3.13)

12

3 Graetz problem

Graetz showed, that in the nite interval between 0 and 1 the eigenfunctions fn are orthogonal to the load function r (1 r2 ). So if we multiply the equation (3.13) by r (1 r2 ) and integrate between 0 and 1, we can calculate the constants as follows: Cn =
1 r (1 0 1 r (1 0

r2 )fn dr
2 r2 )fn dr

(3.14)

Table 3.1: Important costants for Graetz problem n 0 1 2 3 4 5 6 7 8 9 n 2.7043644 6.679032 10.67338 14.67108 18.66987 22.67 26.67 30.67 34.67 38.67 Cn 1.46622 -0.802476 0.587094 -0.474897 0.404402 -0.35535 0.31886 -0.29049 0.26769 -0.24890 Cn fn (1) 1.49758 1.08848 0.92576 0.83036 0.76474 0.71571 0.67798 0.64711 0.62119 0.59900

The rst ten values are tabulated in table ( 3.1). So the equation (3.12) with its two conditions is an eigenvalue problem of the functions fn . The table (3.1) shows the rst 10 eigenvalues and the constants associated with them. These are sucient to calculate the Nusselt numbers for every condition on the wall, even for an arbitrary distribution of Tw . For large n Sellar gave the following approximations: n = 4(n 1) + 8 3 (3.15)

Cn = (1)

2 2 3 n 2( 3 )6

n Cn fn (1) = 4( 4 ) 6 ( 2 ) 3 3
3 n ( 4 ) 3 1 1

2 3

(3.16)

(3.17)

These formulas are used to calculate the last ve digits of the table with an error less than 0,15 percent. 13

3 Graetz problem

The heat ux from the wall to the uid, qw (x) is a function of axial position. It can be calculated directly by using Fourier law : qw (x) = T (r, x). r (3.18)

It is customary to dene a heat transfer coecient h(x) as : qw (x) = h(x)(T w T b), (3.19)

where the bulk or cup-mixing average temperature Tb is introduced. The way to determine experimentally the bulk average temperature is to collect the uid coming out of the system at a given axial location, mix it completely, and measure its temperature. The mathematical denition of the bulk average temperature is: Tb = T dm = dm
r0 2ruT dr 0 , r0 2rudr 0
2

(3.20)

r where constant density was simplify and u = 2(1 r2 ) (Poiseuille). We can see from u 0 the denition of the heat transfer coecient that it is related to the temperature gradient at the tube wall in a simple manner :

T r h= . Tw Tb

(3.21)

So, we can dene a dimensionless heat transfer coecient, which is known as the Nusselt number: T 2hr0 = 2 x , (3.22) N u(x) = Tb where Tb is the dimensionless bulk average temperature. By substituting from the innite series solution for both the numerator and the denominator, the Nusselt number can be written as follows N u(x ) = 2 Cn fn (1)2n x . n Cn 2 fn (1)22 x n
2

(3.23)

We can see that for large x (> 0.05), only the rst term in the innite series in the numerator, and also the rst term in the innite series in the denominator, is important. Therefore, 2 N u 1 = 3.656. (3.24) 2 14

3 Graetz problem

3.3

Numerical solution

As we have seen the Graetz problem is an eigenvalue problem. In the literature there are many problems in physics-mathematics with formulation of this type. A dierential eigenvalues problem, on bounded domain usually admits an innite number of eigenvalues that form the so-called discrete spectrum. The dicretization of
autofunctions 1

0.5

f(r*) 0 0.5 0

0.2

0.4 r*=r/ro

0.6

0.8

Figure 3.2 the eigenvalue problem leads to an algebrical problem with a nite number of eigenvalues. On the discrete domain, to every linear operator can be associated a matrix, therefore, since the derivative operator is a linear operator, it is associated with a matrix that represents the operation of derivation. Our problem is to determine which are the characteristics solutions of the function fn . So the equation r fn + fn + 2 r (1 r2 )fn = 0 n becomes now we call [r D2 + D1 ]]f = 2 r (1 r2 ) A = [r D2 + D1 ]] B = r (1 r2 ) and in this way is obtained the general formulation : Au = Bu. Lets insert boundary condition : 15 (3.29) (3.25) (3.26) (3.27) (3.28)

3 Graetz problem

f (1) = 0, during the multiplication of a generic matrix M with discrete func tion f ,its last component 0 is going to be multiplicated with the last column, which can be eliminated, since only zeros will be obtained. The last row of the matrix M is usless, because we have the solution on the last knot. So eliminating both of them we consider only matrices part C f1 f1 f2 f2 ... = C ... . [M ] . f fn1 . n1 . 0 0 0 0 ... 0 1 Hence we can extract from A and B only useful components by the simple instruction for M atlab: A=A(1:end-1,1:end-1) B=B(1:end-1,1:end-1) f (0) = 0, to set this condition we use matrix D1 containing the rst derivative weights ( M D_spline routine). So the rst row of A becomes the rst row of D1 and the rst row of B becomes zeros: A(1,:)=D1(1,:) B(1,:)=0 Using created routines , we calculate the eigenvalues and eigenvectors. The gure (3.2) shows that the eigenfunctions converge respecting the conditions fn (0) = 1 and the f n(1) = 0 , taken to satisfy the temperature condition on the wall T (1, x ) = 0. Once we have calculated the eigenvalues, we calculate the coecients using the equation (3.14), where the integral is replaced by sum : Cn =
n 0 r (1 n 0 r (1

r2 )fn dr . 2 r2 )fn dr

(3.30)

We see that our values dier a little from that calculated by Graetz, where of course, the more we increase the number of points N , the greater is the accuracy. Looking at the table (3.2) we can compare obtained values, where 150 points where used for dicretization of r . The next step was the calculation of the temperature using equation (3.11). In gure (3.3) we can observe the development of temperature proles in a duct, due to a sudden change of temperature on the wall. The gure (3.5) is nothing but the precedent image magnied in the area immediately near the entrance. So we can observe that heat ow near the entrance 16

3 Graetz problem

Table 3.2: Comparison of eigenvalues and coecients for Graetz problem n 0 1 2 3 4 5 6 7 8 9 nGr 2.7043644 6.679032 10.67338 14.67108 18.66987 22.67 26.67 30.67 34.67 3 38.67 n 2.704359 6.679164 10.67308 14.67399 18.67651 22.68 26.69 30.70 34.71 38.73 CnGr 1.46622 -0.802476 0.587094 -0.474897 0.404402 -0.35535 0.31886 -0.29049 0.26769 -0.24890 Cn 1.47644 -0.806399 0.588643 -0.476253 0.404579 -0.35612 0.31825 -0.29094 0.2664 -0.24901 Cn fn (1)Gr 1.49758 1.08848 0.92576 0.83036 0.76474 0.71571 0.67798 0.64711 0.62119 0.59900 Cn fn (1) 1.50565 1.09198 0.92945 0.83590 0.77014 0.72433 0.68482 0.65768 0.62937 0.61224

is warmer and cools more and more as we move away from it, also note that the temperature prole is almost rectangular and near the entrance and as it develops it becomes increasingly more parabolic. Instead, the gure(3.4), shows the isolines. The rst is the area closest to the entrance and other represent the progressive development along the duct. Of course there is the cut because we have imposed that T (r , 0) = 1 for all r and therefore our grac respects this boundary condition.

Figure 3.3: Temperature proles

17

3 Graetz problem

Temperature profiles 1 0.8 0.6 0.4 0.2 0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 x* 0.8 1 1.2 1.4 r*

Figure 3.4: Temperature isolines

Figure 3.5: Temperature proles near the entrance

18

3 Graetz problem

Finally, we have calculated the local Nusselt numbers using the equation (3.23), where the asymptotes value is 3.656.
5

4.8

4.6 Nusselt number

4.4

4.2

3.8

3.6

0.2

0.4 0.6 dimensioless axial position x*

0.8

Figure 3.6

3.4
3.4.1

Scripts used
Calculation of the autofunctions

function [AF avl rs]=AutoFun(N) % restituisce N-1 autofunzioni e N-1 autovalori dellequazione % rs*f + f = - lambda^2 *rs*(1-rs*rs)*f % -A * f = lambda^2 *B * f % f(1) = 0 ; a parete % f(0) = 0 ; sullasse del condotto format long ; rs = linspace(0,1,N) ; MD = MD_spline(rs) ; % calcolo matrici di derivazione D1 = MD(:,:,1) ; % derivata prima D2 = MD(:,:,2) ; % derivata seconda RS = diag(rs) ; % raggio del condotto adimensionale A = (RS*D2+D1) ; B = RS-RS^3 ; % Condizioni al contorno A(1,:) = D1(1,:); % in zero f(0)=0; B(1,:) = 0; A = A(1:end-1,1:end-1); % in L f(L)=0 ; 19

3 Graetz problem

B = B(1:end-1,1:end-1); % estrazione autovalori e autovettori [avt,avl] = eig(-A,B) ; % valuto autovalori e autofunzioni avl = diag(avl) ; % matrice diagonale. [~,ii] = sort(abs(real(avl))); % Ordinamento. avl = avl(ii); avt = avt(:,ii); avl = [sqrt(avl); 0]; % lambda^2 AF = zeros(N,N); % allocazione matrice autofunzioni for i=1:N-1 u = [real(avt(1:end,i));0]; if (u(1)<0) u = -u; % inversione del valori negativi end AF(:,i)=u; end

3.4.2

Calculation of the temperature

% Programma per la soluzione di problema di Graetz clc; close all; clear all; format long; N = 150; % numero dei nodi utilizzati [F avl R] = AutoFun(N); % valuto autovalori e autofunzioni m = 148; % numero di autofunzioni utilizzate figure; plot(R,F(:,1:9)); % plotaggio autofunzioni title(autofunctions) ylabel(f(r*)) xlabel(r*=r/ro) % Calcola i coefficienti Cnc e Cnf(1): dR=1/(N-1); Cn=zeros(1,m); CnDF=zeros(1,m); for j=1:m num=0; den=0; for i=1:N-1 dR=R(i+1)-R(i); num=num+( R(i)*(1- R(i)^2))*F(i,j)*dR; den=den+( R(i)*(1- R(i)^2))*(F(i,j))^2*dR; end Cn(j)=num/den ; 20

3 Graetz problem

CnDF(j)=Cn(j)*(F(N,j)-F(N-1,j))/ (R(2)-R(1)); end % Calcolo della temperatura T = zeros(N,N); L = N; z = zeros(1,L); lam = avl; x=(1:L)/1000; % devo usare piccoli valori di x* for k=1:N % ciclo in r for j=1:L for i=1:m/10 % ciclo in lambda % in questo ciclo si eseque la sommatoria % al variare di n (c,f,lam) avewendo fissato x T(k,j)=T(k,j)+Cn(i)*F(k,i)*exp(-2*x(j)*lam(i)^2); end end end T1=T(:,1:L); T2=flipud(T1); T3=[T2;T1]; R1=-R;R2=sort(R1);R3=[R2; R]; figure; plot(T3,R3); xlabel(x*);ylabel(r*);title(Temperature profiles) figure; pcolor(x,R3,T3); title(Temperature profiles) xlabel(x*);ylabel(r*) colorbar; shading interp figure; pcolor(x,R3,T3); title(Temperature profiles) xlabel(x*);ylabel(r*) colorbar; axis([x(1) x(10) -1 1]) shading interp % Calcola il Nusset locale L=100; num=zeros(1,L); den=num; %Nux=num; x=num; for j=1:L % ciclo in x 21

3 Graetz problem

x(j)=j/100; for i=1:m % cicloin lambda % in questo caso si eseque a sommatoria al variare % di n(c,f,lam) avendo fissato x num(j)=num(j)+CnDF(i)*exp(-2*x(j)*lam(i)^2); den(j)=den(j)+(lam(i)^(-2))*CnDF(i)*exp(-2*x(j)*lam(i)^2); end end Nux=num./(2*den); figure; plot(x,Nux,r,markersize,8); grid on xlabel(dimensioless axial position x*); ylabel(Nusselt number);

22

Bibliography
[1] Carl De Boor, A Pratical Guide to Splines , Springer (1994). [2] R.Haberman, Applied Partial Dierential Equations, Pearson Prentice Hall (4th ed.)(2004). [3] Frank M. White , Viscous uid ow, Inc McGraw-Hill (1991)

23

S-ar putea să vă placă și