model of a heat exchanger ( hyperbolic pde)

11
KTH ROYAL INSTITUTE OF TECHNOLOGY School of Engineering Sciences Course: Applied Numerical Methods Course code: SF2520 Authors: 1) Andreas Angelou 2) Vasileios Papadimitriou 3) Dionysios Zelios Lab name: Model of a Heat Exchanger Date of submission: 13/01/2014

Upload: dionysios-zelios

Post on 27-Sep-2015

17 views

Category:

Documents


0 download

DESCRIPTION

In this exercise a hyperbolic partial differential equation modeling a heat exchanger is studied. A fluid of temperature T(x,t) is flowing with constant speed u in a pipe. Outside thepipe there is a cooling medium that keeps a constant low temperature Tcool. The temperature of the fluid in the pipe is initially cool, i.e., T=Tcool but within a short time period hot fluid enters the pipe. The task is to study how the temperature T(x,t) of the fluidin the pipe depends on x and t.

TRANSCRIPT

  • KTH ROYAL INSTITUTE OF TECHNOLOGY

    School of Engineering Sciences

    Course: Applied Numerical Methods

    Course code: SF2520

    Authors: 1) Andreas Angelou

    2) Vasileios Papadimitriou

    3) Dionysios Zelios

    Lab name: Model of a Heat Exchanger

    Date of submission: 13/01/2014

  • CONTENTS

    Part A ..3

    Part B4 Part C5 Part D..6 Part E...8 Appendix..10

    References.11

  • Model of a Heat Exchanger

    In this exercise a hyperbolic partial differential equation modeling a heat exchanger is

    studied. A fluid of temperature T(x,t) is flowing with constant speed u in a pipe. Outside the

    pipe there is a cooling medium that keeps a constant low temperature Tcool. The

    temperature of the fluid in the pipe is initially cool, i.e., T=Tcool but within a short time

    period hot fluid enters the pipe. The task is to study how the temperature T(x,t) of the fluid

    in the pipe depends on x and t.

    The following PDE model is given:

    1( ) 0cool

    T Tk T T

    x u t

    , 0 x L

    with the initial condition ( ,0) coolT x T and the boundary condition

    (0, )

    ( )sin( ) ,0 0.5

    ,0.5 4

    sin( ( 4)) , 4

    hot

    T t hot

    hot

    Tcool T Tcool t t

    t

    T Tcool t t

    The length of the heat exchanger is L=3. The heat exchanger parameter is k=0.1, the velocity

    u=1, the cooling temperature Tcool=5 and the hot temperature is Thot=100.

    Part A

    We want to show that our problem can be scaled to ( ) 0u u

    u

    , 0 1 .

    Starting from our initial differential equation and using the following change of variables

    5T u , 3x L , 3t , we have:

    (5 ) (5 )0.1(5 5) 0

    (3 ) (3 )

    u uu

    1 1

    0.1( 1) 03 3

    u uu

    0.3( 1) 0u u

    u

    , with 0 1

  • The initial condition is then transformed: ( ,0) 1u , 0 and the boundary condition

    becomes: (0, )

    100 51 ( )sin( )

    ,0 0.55

    100 / 5 ,0.5 4

    sin( ( 4)) , 4

    u

    hotT Tcool

    (0, )

    1 19sin( ) ,0 0.5

    20 ,0.5 4

    20 sin( ( 4) , 4

    u

    Part B

    We discretize the scaled version of the problem initially with the method of lines (MoL). We

    introduce grid points i=ih, i=0,1,n, n=1. We approximate u

    at the point i with 1i iu u

    dx

    .

    1 0.3 ( 1)i i iidx

    u u uu

    1

    1(1 0.3 ) ] 0.3i

    i idx

    dx

    uu u

    The initial condition is u(0)=1 and the boundary condition is

    (0, )

    1 19sin(3 ) ,0 0.5

    20 ,0.5 4

    20 sin( ( 4) , 4

    u

    The PDE problem it then approximated by a system of ODEs: ( )du

    Au bd

    ,

    where A is

    (1 0.3 ) 0 0 0 0

    1 (1 0.3 ) 0 0 0 0

    0 1 (1 0.3 ) 0 0 01*

    0 0 1 0 0

    0 0

    0 0 0 1 (1 0.3 )

    dx

    dx

    dxA

    dx

    dx

  • b is

    0.3 ( )

    0.3

    ( ) 0.3

    0.3

    b

    and u is

    1

    1

    (0) 1

    1

    u

    We already know that the theoretical stability result based on eigenvalue analysis as

    presented for ODE systems in chapter 3 of the book is not correct for the hyperbolic PDE

    model problem. The reason for this is that the eigenvalues of A are all equal, which implies

    an initial polynomial growth of the solution of the difference equation.

    We therefore use von Neumann analysis based on Fourier analysis to decide if our ODE is

    stable or not.

    We conclude that the time-stepsize should be approximately 0.2 times the space-stepsize in

    order to have a stable system.

    Part C

    We solve the ODE system in part B with the explicit Euler method, constant time step t.

    We investigate numerically how the largest constant time step tmax, preserving the stability

    of the numerical solution, depends on the stepsize h defined in part B.

    We find tmax for N=10,20 and 40.

    N tmax

    10 0.002

    20 0.0008

    40 0.0004

    Solving the PDE system in part B, we expect to have a hyperbolic graph which shows that the

    temperature is always increasing, since there is no boundary condition at the end of the pipe

    that affects it.

    We also show graphically the unstable numerical solution for the case N=20, when

    tmax< t=0.05.

  • .

    Part D

    We work out a difference formula of Lax-Wendroff type that solves the PDE problem in part

    A.

    Our initial scaled differential equation is 0.3( 1) 0u u

    u

    (1)

    0.3( 1)u u

    u

    (2)

    2 2 2

    2 20.3 0.6 0.09( 1)

    d u u u d u d u duu

    d d dt d d

    (3)

    The Taylor expansion at the point (i,k):

    2 21 3

    2( )

    2

    k kk k i t ii i t t

    u h uu u h O h

    d

  • By developing our PDE (1) in terms of Taylor expansion and using (2) and (3) equations, we

    have:

    2 21 ( 0.3[ 1]) [ 0.6 0.09( 1)]

    2

    k k kk k k ki t i ii i t i i

    u h u uu u h u u

    (4)

    Using the central difference approximations:

    1 1

    2

    k k k

    i i i

    x

    u u u

    h

    (6)

    2

    1 1

    2 2

    2k k k ki i i i

    x

    u u u u

    h

    (5)

    We have: 2 2 2 2 2 2 2

    1

    1 12 2 2

    0.09 0.6 0.6 0.09(1 0.3 ) ( ) ( ) 0.3

    2 2 2 4 2 2 4 2

    k k k kt t t t t t t t ti i t i i t

    x x x x x x x

    h h h h h h h h hu u h u u h

    h h h h h h h

    Hence:

    2 2

    1 2

    2 2

    2 2

    2 2

    3 2

    2

    4

    0.6

    2 2 4

    0.091 0.3

    2

    0.6

    2 2 4

    0.090.3

    2

    t t t

    x x x

    t tt

    x

    t t t

    x x x

    tt

    h h hc

    h h h

    h hc h

    h

    h h hc

    h h h

    hc h

  • Part E

    We program the Lax-Wendroff formula in part D as a Matlab program and we run it for

    h=0.1 and t=0.002 and we present the result in a 3D plot.

  • Appendix % Matlab code, Lab 6 % Andreas Angelou, Vasileios Papadimitriou, Dionysios Zelios

    clear clc close all N = 10; %total spacesteps dx = 1/N; %space stepsize T=10; %total time (seconds) dt = 0.01; %time stepsize A = zeros(T/dt,N); %setting up matrix A A(1,1) = -(1/dx)-0.3; for i = 2:N A(i,i) = -(1/dx)-0.3; A(i,i-1) = (1/dx); end for k=1:N u0(k)=1; end U=zeros(T/dt,N); %setting the solution matrix U(1,:)=u0; b = zeros(T/dt,1); %setting the boundary matrix a =1; b(1) =0.3+a; %initiating the boundary matrix for t = 2:(T/dt) b(t) = 0.3; end for t = 1:(T/dt) %working on the inner points for i = 1:N if t*dt < (0.5/3) && t*dt > 0 a = 1+ 19*sin(3*pi*t); else if t*dt >(4/3) a = 20 + sin(pi*(3*t-4)); else a=20; end end b(1) = 0.3+a; U(t+1,i) = U(t,i)+dt*(A(t,i)*U(t,i)+b(t)); end end mesh(U) xlabel('Space(scaled)') ylabel('Time(scaled)') zlabel('Temperature(scaled)') title('Unstable solution')

    % Lax Wendroff clear clc close all N = 10; %total spacesteps dx = 1/N; %space stepsize T=10; %total time (seconds) dt = 0.002; %time stepsize for k=1:N

  • u0(k)=1; end U=zeros(T/dt,N); %setting the solution matrix U(1,:)=u0; b = zeros(T/dt,1); %setting the boundary matrix a =1; b(1) =a; %initiating the boundary matrix for t = 1:(T/dt) %working on the inner points for i=2:N-1 if t*dt < (0.5/3) && t*dt > 0 a = 1+ 19*sin(3*pi*t); else if t*dt >(4/3) a = 20 + sin(pi*(3*t-4)); else a=20; end end b(1) = a; U(t+1,i) = U(t,i-1)*((dt/(2*dx))-((dt^2)/(2*(dx)^2))-

    (0.6*(dt)^2/(4*dx)))+U(t,i)*(1-

    (0.3*dt)+((dt)^2/(dx)^2)+(0.09*(dt)^2/2))+U(t,i+1)*(-dt/(2*dx)-

    ((dt)^2/(2*(dx)^2))+(0.6*(dt)^2/(4*dx)))+0.3*dt-(0.09*(dt)^2)/2; end % U(t+1,N) = 2*U(t,N-1)*((dt/(2*dx))-((dt^2)/(2*(dx)^2))-

    (0.6*(dt)^2/(4*dx)))+U(t,N-2)*(1-

    (0.3*dt)+((dt)^2/(dx)^2)+(0.09*(dt)^2/2))+0.3*dt-(0.09*(dt)^2)/2; U(t,N) = 2*U(t,N-1)-U(t,N-2); end mesh(U) xlabel('Spacesteps') ylabel('Timesteps') zlabel('Temperature(/5)')

  • References

    Introduction to computation and modeling for differential equations,

    Lennart Edsberg