• Keine Ergebnisse gefunden

Worksheet 9: Solving Differential Equations 1 June 4, 2014

N/A
N/A
Protected

Academic year: 2021

Aktie "Worksheet 9: Solving Differential Equations 1 June 4, 2014"

Copied!
2
0
0

Wird geladen.... (Jetzt Volltext ansehen)

Volltext

(1)

Physik auf dem Computer SS 2014

Worksheet 9: Solving Differential Equations 1

June 4, 2014

General Remarks

• The deadline for the worksheets is Wednesday, 18 June 2014, 10:00 for the tutorial on Friday and Friday, 20 June 2014, 10:00 for the tutorials on Tuesday and Wednesday.

• On this worksheet, you can achieve a maximum of 10 points.

• To hand in your solutions, send an email to

Johannes ( zeman@icp.uni-stuttgart.de ; Tuesday, 9:45–11:15) Tobias (richter@icp.uni-stuttgart.de; Wednesday, 15:45–17:15) Shervin ( shervin@icp.uni-stuttgart.de ; Friday, 11:30–13:00) Task 9.1: Solving the One-dimensional Poisson Equation (6 points)

In this task, you are to numerically approximate the solution of the one-dimensional Poisson equa- tion

d

2

dx

2

φ(x) = ρ(x). (1)

9.1.1 (1 point) Using finite differences, discretize the one-dimensional Poisson equation as shown for the Bessel equation in the script in section 6.1.3. Write down the equation that corresponds to equation (6.17) in the script, that allows to read off the matrix A from the system of linear equations A~ φ = ~ ρ.

9.1.2 (2 points) Using the discretization from the previous task, implement a Python function solve_poisson1d_exact(rho,h) that approximates the solution of the Poisson equation, where rho is a one-dimensional NumPy-Array that contains N values of the charge distribution ρ and h is the step size between the values of rho . Let φ = 0 on the boundaries.

Hints

To solve the system of linear equations, use the Python function scipy.linalg.solve .

Consequently, the solution of the system of linear equations is exact, while the solution of the differential equation itself is not.

9.1.3 (1 point) Using the Python function solve_poisson1d_exact(rho,h) from the previous task, approximate the solution of the Poisson equation for the charge distribution ρ(x) = sin(

L

x) on the interval [0, L], where L = 10 at N = 10, 50 points on the interval. Plot the numerical solutions for both values of N and the analytical solution.

9.1.4 (2 points) Approximate the same solution as in the previous subtask for N = 10 points using the successive overrelaxation method as implemented in the Python function sor_step(A,b,omega,x) from chapter 8.1.3 of the script. Plot the solution after 5, 10 and 20 steps of the method at ω = 1.

1

(2)

Task 9.2: Two-dimensional Poisson Equation (4 points)

In this task the two-dimensional Poisson equation

2

φ(x, y)

∂x

2

+

2

φ(x, y)

∂y

2

= ρ(x, y)

should be solved numerically for a two-dimensional charge distribution ρ.

The notebook ws9.ipynb and the Python script ws9.py generate and plot a two-dimensional sample charge distribution rho .

9.2.1 (2 points) Discretize the two-dimensional Poisson equation as explained in chapter 8 of the lecture script and write down the defining equations. Implement a Python function solve_poisson2d(rho,h,sor_steps,omega) that uses the SOR method to approximate the so- lution to the equation. The function should return the potential φ, where rho is a charge distribution, h is the discretization step and sor_steps is the number of steps of the successive overrelaxation scheme and omega is the SOR parameter ω.

Hint The Python command rho_new=rho.reshape(N*N) transforms any N × N -matrix into a one-dimensional array with a length of N

2

.

9.2.2 (2 points) Use the function to solve the equation for the sample charge distribution rho . Plot the potential after 1, 10 and 50 SOR steps at ω = 1.8.

2

Referenzen

ÄHNLICHE DOKUMENTE

Dies ist der Spezialfall p = 5 des hier durch Kongruenzschl¨usse bewiesenen Satzes, dass die im Titel genannte Gleichung keine L¨osungen n, y in positiven ganzen Zahlen hat, wenn p

[r]

• 9.1.2 (1 point) Using the discretization from the previous task, implement a Python function solve_poisson1d_exact(rho,h) that approximates the solution of the Poisson equation,

• 12.1.1 (2 points) Convert the equation system to a system of four differential equations of first order which will be suitable for using a Runge-Kutta

A review is like an audition: you have prepared your presentation for weeks or months, yet you only have a few minutes to convince a director (who knows nothing about you) that you

The energy levels ǫ J,n of our molecule are enumerated by the angular momentum and the radial quantum number n.. To understand the structure of the low-lying energy levels we

The goal of this assignment is to familiarize yourself with the Android development process, to think about user interface design, and to learn how to access sensors and actuators on

Abstract: Climate adaptation is an extremely relevant theme for landscape architecture. This article is based on 2 design studies. The first is our manifesto and regional