Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Consider the following Poisson's equation with homogeneous Dirichlet boundary condition: { u(x, y) = 22 sin(x) sin(y), (x, y) = (0, 1)
Consider the following Poisson's equation with homogeneous Dirichlet boundary condition:
{ −∆u(x, y) = 2π2 sin(πx) sin(πy), (x, y) ∈ Ω = (0, 1) × (0, 1),
u(x, y) = 0, on ∂Ω (1)
The exact solution of this problem is u(x) = sin(πx) sin(πy), x ∈ Ω.
In this project, we solve the above equation numerically by the five-point finite difference
formula and observe how the CPU time depends on the size of the discretization.
First generate a mesh with equally spaced intervals along both x and y direction to discretize
the region Ω. Denote the number of intervals along each direction by m+1. The finite difference
algorithm will lead to a linear system of m2 equations, represented by
Au = b,
where the vector u contains the approximation of the solution u(x, y) at the interior grid points.
Formulate the m2 by m2 matrix A and the m2 dimensional right-hand side vector b as
discussed in the class, using the five-point finite difference formula. Then solve the system
Au = b, using the MATLAB backslash function, by u = A\b.
Visualize the solution, using the MATLAB function surface to plot the surface represented
by the vector u, which contains the approximate solution values on the given grid points over the
region Ω. Generate the surface plot of the approximate solution for the cases m = 4, 8, 16, 32,
respectively.
To compare the CPU times of the LU factorizations for different problem size n(n = m2),
we can use the Matlab functions 'tic' and 'toc', just around the line u = A\b. It returns the
wall clock time of running u = A\b in Matlab. As analyzed in class, the CPU time of running
this line should be proportional to n2, i.e., when m is doubled, n is quadrupled, and the CPU
times should be increased by 16 times. Test, for example, for m = 16, 32, 64, . . ., to see if such
an increase can be observed.
{ −∆u(x, y) = 2π2 sin(πx) sin(πy), (x, y) ∈ Ω = (0, 1) × (0, 1),
u(x, y) = 0, on ∂Ω (1)
The exact solution of this problem is u(x) = sin(πx) sin(πy), x ∈ Ω.
In this project, we solve the above equation numerically by the five-point finite difference
formula and observe how the CPU time depends on the size of the discretization.
First generate a mesh with equally spaced intervals along both x and y direction to discretize
the region Ω. Denote the number of intervals along each direction by m+1. The finite difference
algorithm will lead to a linear system of m2 equations, represented by
Au = b,
where the vector u contains the approximation of the solution u(x, y) at the interior grid points.
Formulate the m2 by m2 matrix A and the m2 dimensional right-hand side vector b as
discussed in the class, using the five-point finite difference formula. Then solve the system
Au = b, using the MATLAB backslash function, by u = A\b.
Visualize the solution, using the MATLAB function surface to plot the surface represented
by the vector u, which contains the approximate solution values on the given grid points over the
region Ω. Generate the surface plot of the approximate solution for the cases m = 4, 8, 16, 32,
respectively.
To compare the CPU times of the LU factorizations for different problem size n(n = m2),
we can use the Matlab functions 'tic' and 'toc', just around the line u = A\b. It returns the
wall clock time of running u = A\b in Matlab. As analyzed in class, the CPU time of running
this line should be proportional to n2, i.e., when m is doubled, n is quadrupled, and the CPU
times should be increased by 16 times. Test, for example, for m = 16, 32, 64, . . ., to see if such
an increase can be observed.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started