Exam INF5620, 2014

Hans Petter Langtangen

Dec 13, 2014

This is meant to be the final version of the exam topics.

There is also a PDF version of this document.

About the exam. Six problems are given for this exam. For each problem, the candidate must prepare a 20 min oral presentation in Norwegian or English. Try to communicate a good overview and understanding of the topic, but compose the talk so that you can demonstrate knowledge about details too. Some of the problems require graphical illustrations - you can either sketch graphics on the whiteboard or bring your laptop or tablet to show or compute the graphics. You can send movies to hpl@simula.no and get them played on the exam (having them on GitHub is perhaps easiest). Otherwise there are no aids besides a whiteboard. You will have access to a printout of the present document in the exam room. (Experience with this type of exam and various aids tells that learning the content by heart gives by far the best delivery and communication of understanding.)

You will throw a die 10 minutes before your exam starts, and the number of eyes determines the problem to be presented. You can then use all the material you have brought with you to make the final preparations for the talk. After the talk, you will be given some questions, either about parts of your presention or facts from the other problems.

Note: We write a lot during the presentations. The writing is no indication of whether you say good or bad things.

Show up 0845 in the morning!

Usually some candidates decide not to show up on the exam so everybody must meet 0845 in the morning on the day they want to take the exam to get their specific time for the exam that day (0900, 0930, 1000, 1030, and so on). Candidates can choose their times in the sequence they appear in the list of candidates.

Problem 1: 2D wave equation

a) Formulate a 2D linear wave equation with variable wave velocity, a linear damping term, and a source term. State the type of boundary and initial conditions needed for this type of PDE.

b) Discretize the problem on a rectangle with a finite difference method and a uniform mesh. Explain how the various types of boundary conditions you mentioned under a) can be taken care of in the scheme.

c) Formulate a version of the wave equation problem such that the solution is a constant. What is the practical appliction of such a trivial solution?

d) Derive an exact solution of the discrete equations that you can use for verifying the implementation. Assume constant wave velocity, no damping, and no source term. Make your own choice of boundary and initial conditions.

e) Explain what the method of manufactured solution is. Set up a specific manufactured solution and calculate the source term. What are the initial and boundary conditions? How can you take advantage of the manufactured solution to verify a computer implementation?

f) Explain a physical problem where the 2D wave equation model applies. Simulate a case and make a movie of the solution. (The movie can be shown on your computer at the exam, or you can send it to hpl@simula.no and get it played at the exam.)

Problem 2: 1D finite elements for approximation

a) Approximate the function \( f(x)=x(1-x) \) on \( [0,1] \) by 2 P1 elements and 1 P2 element, using a projection or least squares method. Sketch or plot the solutions. Explain in detail how the computations are made. In particular you should comment upon the following concepts: element, node, cell, vertex, degree of freedom, reference element, assembly, linear system.

b) Introduce a boundary function such that the approximation \( u(x) \) equals \( f(x) \) at the end points \( x=0,1 \). Sketch or plot the solutions in this case.

c) Use the interpolation or collocation method with P1 and P2 elements with the collocation points \( x=0,0.5,1 \).

d) Construct a function space with sine functions suitable for this approximation problem. Compute the approximate solution and show how fast the amplitudes of the coefficients in front of the sine functions decay. Compare the error of using one sine function with the errors in a).

Problem 3: 1D finite elements for a wave equation

We address a 1D wave equation problem $$ \begin{align*} u_{tt} &= c^2 u_{xx},\quad x\in (0,L)\\ u(0,t) &= 0\\ u_x(L,t)&= 0\\ u(x,0) &= I(x)\\ u_t(x,0) &= 0 \end{align*} $$

a) Use a finite difference method in time and a Galerkin method in space. Derive the system of equations to be solved at each time level.

b) Use P1 finite elements for the spatial discretization. Set up the element matrices for the various terms in the variational formulation. Set up the assembled linear system and express it in finite difference operator notation. Comment upon the differences from a pure finite difference method for this wave equation problem.

c) Explain what kind of artifacts that can appear in a pure finite difference solution of this wave equation problem (keep boundary conditions out of the discussion).

Hint. A wave entering a medium with a different (constant) wave velocity is an example on a kind of physical problem that may trigger numerical artifacts. Below is a wave that enters a medium with 1/4 of the wave velocity (more precisely, the Courant number jumps from 1 to 0.25). The propagation of waves in the left medium is exact, while the propagation in the other medium is subject to numerical errors. (Note: These computations have \( u_x=0 \) as boundary condition at both end points!)

Little noise.

Significant noise.

d) Find an expression for the non-dimensional numerical wave velocity \( \tilde c/c \), where \( \tilde c \) is the numerical wave velocity and \( c \) is the exact velocity, when we use P1 elements for the spatial discretization. Compare in a plot this expression with the one we have in a pure finite difference method. Comment on accuracy and stability for the finite difference versus the finite element method.

e) Can you change "numerical ingredients" in the finite element method such that it reproduces the discrete equations of the finite difference method in this problem?

Problem 4: Finite differences for a nonlinear PDE

We look at a nonlinear diffusion problem $$ \begin{align*} \varrho(u)u_t &= \frac{\partial}{\partial x}\left(\alpha(u)\frac{\partial u}{\partial x}\right),\quad x\in (0,1)\\ u(0,t) &= 0\\ u(1,t) &= 0\\ u(x,0) &= I(x) \end{align*} $$ Here, \( \varrho(u) \) and \( \alpha(u) \) are possibly nonlinear functions of \( u \).

a) Formulate a Picard iteration method for linearizing the PDE directly (after time discretization).

b) Formulate a Newton method for linearizing the PDE directly (after time discretization).

c) Discretize the original nonlinear problem by a backward difference in time and a centered difference in space.

d) Show that it does not matter whether we use Picard iteration first on the PDE problem and then discretize by finite differences, or if we first discretize by finite differences and then use Picard iteration for the resulting system of nonlinear equations.

e) Is the equivalence result in d) true if we use a Newton method? Explain in detail.

Problem 5: A Galerkin method for spatial discretization of a nonlinear PDE

We address the same nonlinear diffusion problem as in the previous problem.

a) Use a Galerkin method for discretizing in space and a backward finite difference in time. Derive the resulting system of nonlinear equations to be solved at each time level. Use Picard iteration to linearize the system.

b) Use Picard iteration to linearize the PDE problem. Then use a backward finite difference in time and a Galerkin method in space. Show that the resulting linear systems to be solved at each time level is the same as in a).

c) Use the method in a), but apply Newton's method to linearize the equations. Derive expressions for the Jacobian and explain how it and the right-hand side arising in Newton's method can be computed.

d) Use a Newton method to linearize the PDE problem directly, after a backward difference discretization in time, but prior to a Galerkin discretization in space. Compare the linear system (arising from the discrete space-time problem) to be solved in each Newton iteration with the one derived in the previous subexercise.

e) Set up the expression for the Jacobian in Newton's method when \( \varrho(u)=1+u^2 \) and \( \alpha(u) = |u_x|^m \) for a real number \( m \).

Problem 6: A nonlinear ODE

The (scaled) velocity of a body falling in a fluid is governed by the following equation: $$ v'(t) = -\beta |v|v - 1,\quad v(0)=0$$ The velocity \( v(t) \) is positive upwards.

a) Explain how this model arises from physical principles.

b) Formulate a Forward Euler method, a Backward Euler method, and a Crank-Nicolson method. Linearize the Backward Euler method by using the previous time step in the factor \( |v| \). Interpret this approach as a Picard iteration method. Linearize the Crank-Nicolson method by using a geometric mean for the nonlinear term \( |v|v \).

c) Show plots or sketch the solution corresponding to \( \beta = 1 \) and \( \Delta t=0.5, 1.1 \).

d) To analyze the behavior of the schemes, we need a linear difference equation. The "worst case" corresponds to the highest possible velocity. Find this velocity and call it \( v_T \) (for terminal velocity as \( t\rightarrow\infty \)). The worst case version of the ODE for stability analysis can take the factor \( |v| \) as a known \( |v_T| \) constant. Seek symbolic, exact solutions \( v^n=b(A^n-1) \) of the difference schemes in this case, where \( b \) and \( A \) are coefficients to be determined (\( v^0=0 \) as it should), and \( n \) is a time level counter. Use the exact solution of the difference equations to predict when the numerical solution is stable.

Note.

The oscillatory behavior of the Backward Euler and Crank-Nicolson schemes from b) when \( \Delta t > 1 \) (\( \beta=1 \)) cannot be explained by the exact symbolic solution since this feature stems from the effect that \( v(\Delta t) = -\Delta t \) when \( v(0)=0 \). That is, the "worst case" scenario for this effect corresponds to setting \( |v|=0 \) and demanding the qualitative property \( |v(\Delta t)|\leq |v_T| \), which gives the condition \( \Delta t \leq |v_T| \) for non-oscillatory behavior.