Laplace & Poisson Problems

Anonymous
timer Asked: Jan 22nd, 2021

Question Description

I'm working on a numerical analysis question and need support to help me learn.

Laplace & Poisson Problems 1. Find the electric potential for all points inside the charge-free square shown on the left of Figure 5.2. The bottom and sides of the square are grounded, while the wire at the top is kept at 100 V. Listing 5.2 is our code LaplaceLine.py that solves Laplace’s equation within the square of Figure 5.2.

a. Create a surface plot of the potential V (x, y).

b. Run 10-1000 iterations, and note when convergence occurs.

c. Modify the code so that it quits iterating once the sum of the diagonal elements P|Vi,i| converges to some measure of precision such as 10−4 .

d. Investigate the effect of varying the step size ∆. Draw conclusions regarding the stability and accuracy of the solution for various ∆’s.

e. Investigate the effect of using Gauss-Seidel versus Jacobi relaxation. Which converges faster? Do the answers agree?

LaplaceLine.py :

# LaplaceLine.py: Solve Laplace's eqtn, 3D matplot, close shell to quit

import matplotlib.pylab as p;

from mpl_toolkits.mplot3d import Axes3D

from numpy import *;

import numpy;

print("Initializing")

Nmax = 100; Niter = 70; V = zeros((Nmax, Nmax), float)

print ("Working hard, wait for the figure while I count to 60")

for k in range(0, Nmax-1): V[k,0] = 100.0 # Line at 100V

for iter in range(Niter):

if iter%10 == 0: print(iter)

for i in range(1, Nmax-2):

for j in range(1,Nmax-2):

V[i,j] = 0.25*(V[i+1,j]+V[i-1,j]+V[i,j+1]+V[i,j-1])

x = range(0, Nmax-1, 2); y = range(0, 50, 2)

X, Y = p.meshgrid(x,y)

def functz(V): # V(x, y)

z = V[X,Y]

return z

Z = functz(V)

fig = p.figure() # Create figure

ax = Axes3D(fig) # Plot axes

ax.plot_wireframe(X, Y, Z, color = 'r') # Red wireframe

ax.set_xlabel('X')

ax.set_ylabel('Y')

ax.set_zlabel('Potential')

p.show() # Show fig

Student has agreed that all tutoring, explanations, and answers provided by the tutor will be used to help in the learning process and in accordance with Studypool's honor code & terms of service.

This question has not been answered.

Create a free account to get help with this and any other question!

Similar Questions
Related Tags

Brown University





1271 Tutors

California Institute of Technology




2131 Tutors

Carnegie Mellon University




982 Tutors

Columbia University





1256 Tutors

Dartmouth University





2113 Tutors

Emory University





2279 Tutors

Harvard University





599 Tutors

Massachusetts Institute of Technology



2319 Tutors

New York University





1645 Tutors

Notre Dam University





1911 Tutors

Oklahoma University





2122 Tutors

Pennsylvania State University





932 Tutors

Princeton University





1211 Tutors

Stanford University





983 Tutors

University of California





1282 Tutors

Oxford University





123 Tutors

Yale University





2325 Tutors