Starting from:

$34.99

MIT16.90 Problem 1: One-sided finite differences Solution

Suppose we want to find a second-order accurate finite difference approximation of ∂u/∂x at x = 0 with a spatial discretization xi = (i − 1)∆x. The forward difference approximation is given by
∂u u2 − u1 ∂xx1 = ∆x + O(∆x).
However, backward/central difference approximations need u0, which is not available. Instead, we seek a one-sided approximation of the form
∂u ≈ αui + βui+1 + γui+2.

∂xxi ∆x
Find values for α, β, and γ that will make this one-sided finite difference approximation second-order accurate.
Problem 2: Relating Finite Volume and Finite Difference Methods Consider the one-dimensional convection problem,
, F = vU
where v is a constant. Assume a mesh with spacing ∆x. The finite volume discretization for this problem is
dUi
∆x + F(Ui+1,Ui) − F(Ui,Ui−1) = 0, dt
where the flux is approximated as
F(UR,UL) = v (UR + UL) − |v|(UR − UL). (1)
Note: in this problem, do not discretize the time derivative and leave it as ddUti. Here, we only focus on the approximation of the spatial derivative.
1
(a) Consider the case where v > 0. Write out the finite volume discretization in terms of Ui−1, Ui, and Ui+1. What is the equivalent finite difference discretization for this finite volume discretization?
(b) Now, instead of the flux given in Equation (1), consider using a flux which simply averages the states, i.e.
F(UR,UL) = v (UR + UL)
Write out the finite volume discretization in terms of Ui−1, Ui, and Ui+1. What is the equivalent finite difference discretization for this finite volume discretization?
Problem 3: Finite Differences for the Steady Convection-Diffusion Equation
Consider the steady convection-diffusion equation on the domain x ∈ [0,1]:
∂u ∂2u
U = ν (2) ∂x ∂x2
with boundary conditions
u(0) = 1, u(1) = 0
where U > 0 is the convection velocity and ν > 0 is the diffusivity.
(a) To solve this equation numerically, we use the central difference approximation:
Uδ2xui − νδx2ui = 0
Determine the local truncation error for this approximation.
(b) Write the finite difference scheme in matrix form, i.e. construct a linear system Au = b that can be solved to give u(x). What does the ith row of this matrix look like? Hint:
For the ith row, you only need to find values for Ai,i−1, Ai,i, and Ai,i+1.
How do you handle the boundary conditions at the left and right ends of the domain?
(c) Implement the finite difference scheme in MATLAB using the values U = 1.0, ν = 0.1 and plot the error versus ∆x in a log-log plot for ∆x ∈ {10−1,10−2,10−3,10−4}. Use the infinity norm of the difference between the numerical and exact solutions to quantify the error. The exact solution can be found by treating the PDE as a second order ODE with constant coefficients, which has the solution
u(x) = c1eUx/ν + c2, with c1 = 1 −1eU/ν , c = 1 − 1 −1e .
2 U/ν
Does your error plot agree with the analysis performed earlier?
2

More products