Problem 1 8 points possible Numerical solution of Poissons e
     Problem 1 (8 points possible). Numerical solution of Poisson\'s equation In general, Poisson\'s equation refers to a class of partial differential equations like: where  is the physical field (e.g. electric potential) and fis provided as a source term (e.g electric charge distribution). Now we consider an axisymmetric (with respect to z-axis) problem. This means you can express the V2 operator in its cylindrical coordinate form and let all  derivatives be zero. The problem is simplified to two-dimensional with only  and z dependence To numerically solve the problem, the first step is to define the simulation domain : O and 0 s z S H, where R and H are constants to be specified. Then we will specify the source term F(p, z). To start with, you can set it zero everywhere. This is the case of Laplace equation. Next, specify the boundary condition for p. You need first to think about what kind of boundary conditions are appropriate at the boundary of the simulation domain, i.e. when  = 0,  z = 0 and z = H. Then you need to specify the boundary condition for  at the boundary of a region inside the simulation domain, ie. when G(p,z) = 0, The form of G(p, z) is completely open. The purpose of this interior region is to include the cases when there are different materials in the simulation domain. = R, Finally, choose a spatial step-length to discretize the simulation domain and use Finite Difference method to numerically solve the differential equation. Write a report on how you implemented these steps in MATLAB and how you validated the numerical simulation.  
  
  Solution
% Solving the 2-D Poisson equation by the Finite Difference ...Method % Numerical scheme used is a second order central difference in space ...(5-point difference) %% %Specifying parameters nx=80; %Number of steps in space(x) ny=80; %Number of steps in space(y) niter=1000; %Number of iterations dx=2/(nx-1); %Width of space step(x) dy=2/(ny-1); %Width of space step(y) x=0:dx:2; %Range of x(0,2) and specifying the grid points y=0:dy:2; %Range of y(0,2) and specifying the grid points b=zeros(nx,ny); %Preallocating b pn=zeros(nx,ny); %Preallocating pn %% % Initial Conditions p=zeros(nx,ny); %Preallocating p %% %Boundary conditions p(:,1)=0; p(:,ny)=0; p(1,:)=0; p(nx,:)=0; %% %Source term b(round(ny/4),round(nx/4))=3000; b(round(ny*3/4),round(nx*3/4))=-3000; %% i=2:nx-1; j=2:ny-1; %Explicit iterative scheme with C.D in space (5-point difference) for it=1:niter pn=p; p(i,j)=((dy^2*(pn(i+1,j)+pn(i-1,j)))+(dx^2*(pn(i,j+1)+pn(i,j-1)))-(b(i,j)*dx^2*dy*2))/(2*(dx^2+dy^2)); %Boundary conditions p(:,1)=0; p(:,ny)=0; p(1,:)=0; p(nx,:)=0; end %% %Plotting the solution h=surf(x,y,p\',\'EdgeColor\',\'none\'); shading interp axis([-0.5 2.5 -0.5 2.5 -100 100]) title({\'2-D Poisson equation\';[\'{\\itNumber of iterations} = \',num2str(it)]}) xlabel(\'Spatial co-ordinate (x) \ ightarrow\') ylabel(\'{\\leftarrow} Spatial co-ordinate (y)\') zlabel(\'Solution profile (P) \ ightarrow\')
