% Capacitance_problem_2D_pg20
clear
EM_constants
close all
format compact

%% 2D capacitance problem
% Consider coax. transmission line of cross-sectional geometry below.
% Inner conducter, outer waveguide.
%
% +-------------------------+
% |                         |
% |                         |
% |       +---------+       |
% |       |         |       |
% |       |         |b      |d
% |       |         |       |
% |       +---------+       |
% |            a            |
% |                         |
% +-------------------------+
%              c


%% Iterative solutions to the discretized Laplace equation.
% 1. Start with arbitrary initial guess for solution f_i,j at all internal
% grid-points. (eg.  f_i,j = 0), except boundaries which are kept fixed.
% 2. Iteratively update values of all grid points until a converged
% solution is reached.

%         *
%         fi,j+1
% 
% 
% *       *       *
% fi-1,j  fi,j    fi+1,j
% 
% 
%         *
%         fi,j-1




%% Jacobi iteration
% At every grid-point, the potential is the average of the potential at the
% four nearest neighbours.
% Slow convergence.

%% Gauss-Seidel iteration
% Modification of the Jacobi iteration: "old" values of f are immediately
% overwritten by new ones.

