Question: Write a PYTHON program to numerically calculate the potential of an electric dipole, i.e., two opposite point charges, Q/o = 2, separated by a
Write a PYTHON program to numerically calculate the potential of an electric dipole, i.e., two opposite point charges, Q/o = 2, separated by a distance a=1 around the origin (e.g., at x = 0.5, y=z=0). Solve the 3D Poisson equation in Cartesian coordinates but impose spherical boundary conditions, V(R)=0, at a large distance R=20 or so. (a) Starting from an initial condition of zero potential use the Jacobi relaxation algorithm with appropriate numerical tolerance and grid density to obtain the (converged) solution. Plot the equipotential lines, as well as V(r) for x=y=z. (b) Compute the magnitude of the electric field, E(r)] (r: distance from dipole center) along the x-y-z-axis and extract the exponent n for the large-distance behavior, E(r) x r for large r, through an eyeball fit. Do you find the theoretically expected n-value for the dipole? (c) Investigate how the number of required iteration steps, Niter, increases with reducing the tolerance (error) limit, "tol", and plot Niter (tol). (d) Write a program by modifying the algorithm using the Simultaneous Over Relaxation (SOR) method, and study the convergence behavior for varying grid density (fixed total size) in different relaxation runs, focusing on the 2D problem in the x-y plane (for which the optimal value of a is close to 2). For fixed point-by-point accuracy in the solution (not total tolerance!), investigate (and plot) how the number of iteration steps, Niter, depends on the number n=n, ny, of grid points. Do you find the expected behavior of Niter xn and Niter xn, for the Jacobi and SOR method, respectively?
Step by Step Solution
3.36 Rating (143 Votes )
There are 3 Steps involved in it
import numpy as np import matplotlibpyplot as plt Constants Q 10 Magnitude of each charge a 10 Separation distance R 200 Large distance for boundary condition npoints 200 Number of grid points toleran... View full answer
Get step-by-step solutions from verified subject matter experts
