[关闭]
@guoxiaowhu 2016-05-27T13:40:53.000000Z 字数 2731 阅读 1391

Electric Potentials and Fields

未分类
Author:GUO Xiao


Abstract

This article will solve the electric potential and electric field of figure 5.7 and compare 3 different methods to solve this problem.

Background

In regions of space that don't contain any electric charges,the electric potential obeys Laplace's equation

or

This is partial differential equation (PDE).To solve this equation, we will use relaxation method.

Problem

Exercise 5.7
When boundary condition is given as shown in following figure:

We can solve the distribution of electric potential by numerical method.

Numerical Calculation


For two dimensional problem, Laplace's equation can be written as

Solution

program code
potential.py This program used Jacobi method.

Different methods

Jacobi method

Gauss-Seidel method

Simultaneous over-relaxation method (SOR method)




The best choice for is

SOR.py
This is a program to solve this problem, which uses SOR method and prints almost same results with Jacobi method.

Comparison

Next, I use this porgram problem5.7.py to obtain the data which describes the relationship between numbers of iterations and L.

The comparison of 3 different methods at the same accuracy:

We can see that under the same L, the convergent speeds of SOR method is faster than SOR method, which is faster than that of Jacobi method. (The smaller number of iterations is, the faster convergent speed is.)
Concretely,

Jacobi method


Fit equation:


The number of iterations N is about proportional to .

SOR method


Fit equation:


The number of iterations N is approximately proportional to .

Calculation Error

Because most elements of the array of V are very small, the difference between and will approach 0 very much.
This a part of array .

Due to error of calculation, all elements of the array are easily regarded as 0 by computer. This may lead to some bugs.
This problem can be solved by beginning calculation from a random array, not all-zero array.

Conclusions

Acknowledgement

There is a little bug shortly before.Thanks to Chen Yangyao classmate, who helped me to modify my faults.

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注