hwadigest.blogg.se

Gauss seidel with relaxation python
Gauss seidel with relaxation python











gauss seidel with relaxation python

(Note that here, we will consider only "metallic" fixed-potential boundary conditions, also know as the Dirichlet condition. What do we choose for this? It turns out that it doesn't matter what we choose: the techniques we will look at will always work no matter what you chose (which is handy!). We then start with an initial guess at the potential everywhere inside the box.

gauss seidel with relaxation python

The way relaxation works is the following: we start with our fixed boundary condition on the outside of our simulation "box". This is our "known" starting point, and we need to then find the solutions in the middle that solve the Laplace (or the Poisson) equation. The problem we are looking at is a boundary-value problem: to be able to solve for the potential on our grid, we need to know the value of the potential on the boundaries of our simulation.

gauss seidel with relaxation python

Jacobi method ¶įortunately, there is a simpler method for solving these 10,000 equations, which is known as "relaxation". How many equations will we have? If we choose a grid of 100x100 points in our $x,y$ plane, we will have 10,000 equations! That's a lot! Coding this into a matrix is quite daunting. This equation is hopefully well known to you from your course in electrostatics: is is the equation that determines the electrostatic potential $\phi(\vec \approxĪll we need to do now is to equate this to zero and find the solutions of the resulting coupled (linear) equations. In Table 19.We will look specifically in this course at the solutions to a specific, linear partial differential equation known as Poisson's equation: Running times obtained via the command time are Memory version of the OpenMP code, then we would distribute entire columns In the MPI version of the method of Jacobi, entire rows of the matrix Observe that although the entire matrix A is shared betweenĪll threads, each threads needs only n/p columns of the matrix. Void run_gauss_seidel_method ( int p, int n, double ** A, double * b, double epsilon, int maxit, int * numit, double * x )













Gauss seidel with relaxation python