MAE200B_HW1

download MAE200B_HW1

of 14

Transcript of MAE200B_HW1

  • 7/25/2019 MAE200B_HW1

    1/14

    UNIVERSITY OFCAL IF OR NI A, I RVINE

    MAE200B - Homework No. 1

    Laura Novoa

    January 15, 2016

    Problem1

    The functionu(x,y) is governed by:

    u

    x=2xu

    Subject to the BC:u(0,y)= si n(y). Calculate the Solution.

    Solution

    Assuming our "common clock" to be the new variables, from the boundary condition:

    u(0,y)= si n(y)

    u(s= 0)= si n()

    Thus, we know that y(0)=

    x(0)= 0

    Using the method of characteristics:

    A=1

    2x

    ,B= 0, andF=u

    1

  • 7/25/2019 MAE200B_HW1

    2/14

    dx(s)

    ds=A=

    1

    2x(s)

    2x(s)dx(s)=

    ds x2 = s+C1 s= x

    2

    0C1 1

    BC: x(0)= 0 C1 = 0

    dy(s)

    ds=B= 0

    dy= 0y(s)=C2 y(s)= 2

    BC: y(0)= C2 =

    du(s)

    ds=F=u

    du(s)

    u(s)=

    dsu(s)=C3e

    s u(s)= si n()es 3

    BC: u(0)= si n() C3 = si n()

    Thus, from 1 and 2 into 3

    u(x,y)= si n(y)ex2

    Problem2Use the Method of characteristics to solve the following two equations foru(x,y) :

    u

    t+2t

    u

    x= 1 u(x, 0)=f(x)

    u

    t+x

    u

    x= si n(t) u(x, 0)= g(x)

    In both cases:

    (a) Use the rigorous approach to express the characteristics and the solutions in terms of an

    independent variables.

    (b) Derive and plot the shapes of the characteristics.

    (c) Derive the solutionsu(x, t) for arbitraryf andg.

    (d) Specialize the solutions for f(x)= ex andg(x)= co s(x). Make 3D plots of the respective so-

    lutions.

    2

  • 7/25/2019 MAE200B_HW1

    3/14

    Solution

    (I)u

    t+2t

    u

    x= 1,u(x, 0)=f(x)

    A= 1,B= 2t, andF= 1

    Assumingsthe new variable, from the boundary condition:

    u(x, 0)=f(x)

    s= 0u(s= 0)=f()

    Thus, we know that x(s) x(0)=

    t(s) t(0)= 0

    a)

    dt(s)

    ds=A= 1 t(s)= s+C1 s= t(s)

    0C1 1

    BC: t(0)= 0 C1 = 0

    dx(s)

    ds=B= 2t(s)= 2s x(s)= s2+C2 x(s)= s

    2+ 2

    BC: x(0)= C2 =

    du(s)

    ds=F=1u(s)= s+C3 u(s)= s+f() 3

    BC: u(0)=f() C3 =f()

    b) Eliminating s from the first two equation gives the characteristic equation:

    Substituting 1 into 2 :

    x(s)= t(s)2+

    3

  • 7/25/2019 MAE200B_HW1

    4/14

    Which is a parabola that crosses the x axis at a positive or negative

    c) The solution for an arbitrary f(x) will be:

    u(s)= s+f()

    From 1 s= t(s)

    From 2 = x(s) s2 = (x(s) t(s))2

    Thus: u(x, t)= t+f(x t2)

    d) Specialize the solution for f(x)= ex

    u(x, t)= t+ext2

    The surface plot of the function:

    4

  • 7/25/2019 MAE200B_HW1

    5/14

    (II)u

    t+x

    u

    x= si n(t),u(x, 0)= g(x)

    A= 1,B= x, andF= si n(t)

    Assumingsthe new variable, from the boundary condition:

    u(x, 0)= g(x)

    s= 0u(s= 0)= g()

    Thus, we know that x(s) x(0)=

    t(s) t(0)= 0

    a)

    dt(s)

    ds=A= 1 t(s)= s+C1 s= t(s)

    0C1 1

    BC: t(0)= 0 C1 = 0

    5

  • 7/25/2019 MAE200B_HW1

    6/14

    dx(s)

    ds=B= x(s)

    d x(s)

    x(s)=

    ds x(s)=C2e

    s x(s)= es 2

    BC: x(0)= C2 =

    du(s)

    ds=F= si n(t(s)) from 1 si n(s)

    du(s)=

    si n(s)

    u(s)=cos(s)+C3 u(s)=co s(s)+g()+1 3

    BC: u(0)= g()1+C3 = g() C3 = g()+1

    b) Eliminating s from the first two equation gives the characteristic equation:

    Substituting 1 into 2 :

    x(s)= et(s)

    6

  • 7/25/2019 MAE200B_HW1

    7/14

    c) From 2 = x(s)es. Thus:

    u(x, t)=co s(t)+g(xet)

    d) Specialize the solution forg(x)= cos(x)

    u(x, t)=co s(t)+cos(xet)

    7

  • 7/25/2019 MAE200B_HW1

    8/14

    Problem3

    The potential, incompressible solution for 2D stagnation-point flow is:

    u=Ax, v=Ay

    Where u and v are the horizontal and vertical velocity components, respectively, and A is a con-

    stant. At time t = 0 a blob of contaminants is introduced in this flow. The initial shape of the

    blob is a circle centered at (x = 0, y = b) with radius R < b. You are asked to find the shape of the

    blob at later times using the following steps.

    (a) Neglecting diffusion, and assuming that the contaminant is a passive scalar, write the trans-

    port equation for the contaminant concentration C(x, y, t).

    Considering steady-state flow: Ct = 0 we have:

    0C

    t+u

    C

    x+v

    C

    y= 0

    (b) and (c): Write differential evolution equations for the characteristics and the concentration

    field, using as independent variable the time t measured by an observed moving with a fluidparticle.Integrate the above equations to obtain algebraic relations for the characteristics (x(t),

    y(t)) and the concentration field c(t).

    dx(t)

    dt=Ax(t)

    dx(t)

    x(t)=A

    dt x(t)=C1e

    At 1 ln

    x(t)

    C1

    =At

    d y(s)dt

    =Ay(t) y(t)=C2eAt 2

    8

  • 7/25/2019 MAE200B_HW1

    9/14

    dC(t)

    dt= 0C(t)=C3 = constant

    1 into 2 y(t)=C2exp lnx(t)

    C1=C2expln

    x(t)

    C11

    =C2C1

    x(t) y(t)=

    C3

    x(t)

    (d) Plot the shapes of the characteristics on thexyplane.

    (e) Derive an analytic expression for the shape of the blob for t > 0. Characterize this shape,and

    plot for A = 1, b = 1, R = 0.5, t = 1.

    At t = 0, from the equation of the circumference with a b displacement in the y axis:

    x20+ (y0b)2=R2

    x0R

    2+

    y0b

    R

    2= 1 1

    From part c), we had:

    x(t)=C1eAt

    9

  • 7/25/2019 MAE200B_HW1

    10/14

    y(t)=C2eAt

    Applying initial conditions:

    x(0)= x0 C1 = xo x(t)= x0eAt 2

    y(0)=y0 C2 =yo y(t)=y0eAt 3

    Substituting 2 and 3 into 1 will give us an analytic expression for the shape of the blob for

    t > 0.

    x(t)

    eAtR

    2+

    y(t)eAt

    b

    R

    2= 1

    x(t)

    eAtR

    2+

    y(t)b

    ReAt

    2=1

    Which describes an Ellipsoid.

    Since we know that eAtR is increasing over time, we can expect that the ellipse radius in the xdirection will progressively increase over time.

    Similarly, sinceeAtR is decreasing, the ellipse radius in the y direction will progressively de-

    crease over time

    Also,eAtbis decreasing over time, meaning the blob will flow downward in the y axis.

    Eventually, whent=, the blob will become a flat "line" in the y = 0 position.

    The plot below describes the evolution of the blob with time. The blue circle represents the

    blob at t = 0 , the red circle is the blob at t = 1 and the yellow at t = 2.:

    10

  • 7/25/2019 MAE200B_HW1

    11/14

    11

  • 7/25/2019 MAE200B_HW1

    12/14

    MATLAB SOURCE CODE

    PDE # 1

    figure

    [X,T] = meshgrid(-4:.2:4);

    U = T + exp(X - T.^2);

    surf(X,T,U)

    xlabel('x')

    ylabel('t')

    zlabel('u')

    %Plot characteristics

    C = [-10:1:10];t = [-5:0.1:5];

    figure

    fori=1:length(C)

    x = t.^2 + C(i);

    plot(t,x)

    ylim = ([0 100]);

    hold on

    end

    xlabel('t(s)')

    ylabel('x(s)')

    PDE #2

    [X,T] = meshgrid(-10:.5:25);

    U = -1*cos(T) + cos(X.*exp(-T));

    figure

    surf(X,T,U)

    xlabel('x')

    ylabel('t')

    zlabel('u')

    %Plot characteristics

    C = [-10:1:10];

    t = [-5:0.1:5];

  • 7/25/2019 MAE200B_HW1

    13/14

    figure

    fori=1:length(C)

    x = C(i).*exp(t);

    plot(t,x)

    ylim = ([0 100]);

    hold on

    end

    xlabel('t(s)')

    ylabel('x(s)')

    Problem 3

    clc

    clear all

    close all

    %Plot characteristic lines

    C = [-10:1:10];

    x = [-5:0.1:5];

    fori=1:length(C)

    y = C(i)./x;

    plot(x,y)

    axis([ -inf inf 0 100]);

    hold on

    end

    xlabel('x(t)')

    ylabel('y(t)')

    Plotting blob

    %t = 0

    r = 0.5; %radius

    xc = 0; %0

    yc = 1; % b

    theta = 0 : .1 : 2*pi;

    x = r * cos(theta) + xc;

    y = r * sin(theta) + yc;

    %figure

    plot(x, y)

    t = 1;

    A = 1;

    xt = x.*exp(A.*t);

    yt = y.*exp(-1*A.*t);

    hold on

    plot(xt, yt)

  • 7/25/2019 MAE200B_HW1

    14/14

    t = 2;

    A = 1;

    xt = x.*exp(A.*t);

    yt = y.*exp(-1*A.*t);

    hold on

    plot(xt, yt)

    xlabel('x(t)')

    ylabel('y(t)')

    axis([ -5 5 0 5]);

    Published with MATLAB R2015a

    http://www.mathworks.com/products/matlab/http://www.mathworks.com/products/matlab/http://www.mathworks.com/products/matlab/