Find the electric field between 2 finite discs

In summary, to find the electric field between two finite discs, one must consider the contributions of each disc's surface charge density. The electric field at a point between the discs can be calculated by integrating the contributions from each infinitesimal charge element on the discs, taking into account their distances and orientations. The overall electric field is the vector sum of the fields due to each disc, with attention to the direction and magnitude of the fields, which can be influenced by factors such as disc size, separation distance, and charge density. Numerical methods or approximations may be employed for complex configurations.
  • #1
kirito
77
9
Homework Statement
there are two finite disc distance d from each other in the z axis potential difference between them V_zero find capacitance q and electric field between them
Relevant Equations
relaxation method , Q/C=V
I did make the problem simpler by looking at the the part from d/2 down the upper plate
here are my initial parameters I am making my size step be h since lowering it may make calculating harder
I am especially getting weird results for the field and capacitance

Code:
R = 0.1; % Radius of the plates in meters (10 cm)
d = 0.005; % Separation distance in meters (0.5 cm)
V0 = 1; % Potential difference in volts
h = d / 20; % Step size
rmax = R + 5 * d; % Maximum r
zmax = 10 * d; % Maximum z

% Create the grid
nr = ceil(rmax / h);
nz = ceil(zmax / h);
phi = zeros(nr, nz);

phi(1:R/h, d/(2*h)) = V0/2;% Set the potential on the positive plate
phi(end, :) =  0%; Boundary condition far from the plates
phi(:, 1) = 0 ;

% Relaxation method)
max_iterations = 10000;
tolerance = 1e-6;
for iter = 1:max_iterations

    old_phi = phi;
 
    for i = 2:nr-1
        for j = 2:nz-1

            if j == d/(2*h) && i < R/h
                continue
            end

                phi(i, j) = (1/4) * (phi(i+1, j) * (1 + h / (2 * i)) + ...
                                     phi(i-1, j) * (1 - h / (2 * i)) + ...
                                     phi(i, j+1) + phi(i, j-1));
        end
    end
    phi(:,1) = old_phi(:,2);
    % Check for convergence
    if max(max(abs(phi - old_phi))) < tolerance
        fprintf('Converged after %d iterations\n', iter);
        break;
       
    end
end

% Plot the potential
figure;
imagesc((0:nr-1) * h, (0:nz-1) * h, flipud(phi'));
colorbar;
title('Electric Potential \phi');
xlabel('r (m)');
ylabel('z (m)');

% Compute the electric field
[B]% now here this seems like  I am calculating wrongly [/B]
[Er, Ez] = gradient(-phi, h);

% Compute the surface charge density at the edge of the plate
r_edge = ceil(R / h) + 1;
sigma = -Er(r_edge, :);

[B]% and the capacitance [/B]
% Note: We multiply by 2*pi*r to account for cylindrical coordinates
Q = 0;
for j = 1:nz-1
    r = (j - 1) * h;
    area = 2 * pi * r * h; % Area of the thin ring
    Q = Q + sigma(j) * area;
end

% Compute the capacitance
% Compute the capacitance
C = Q / V0;
fprintf('Computed capacitance: %e F\n', C);

% Analytic capacitance for comparison
epsilon0 = 8.854187817e-12; % Vacuum permittivity
C_analytic = epsilon0 * pi * R^2 / d;
fprintf('Analytic capacitance: %e F\n', C_analytic);

% Plot the potential along z at r = 0
figure;
plot((0:nz-1) * h, phi(1, :);
title('Electric Potential \phi along z at r = 0');
xlabel('z (m)');
ylabel('\phi (V)');

% Plot the electric field
figure;
quiver((0:nr-1) * h, (0:nz-1) * h, Er', Ez');
title('Electric Field');
xlabel('r (m)');
ylabel('z (m)');

% Plot the surface charge density
figure;
plot((0:nz-1) * h, sigma);
title('Surface Charge Density \sigma at the Edge of the Plate');
xlabel('z (m)');
ylabel('\sigma (C/m^2)');
 
Last edited by a moderator:
Physics news on Phys.org
  • #2
kirito said:
phi(i+1, j) * (1 + h / (2 * i))
I am not seeing the logic behind this expression. Please explain it.
E.g., i is a dimensionless number but h has units of metres, so 1 + h / (2 * i) is dimensionally inconsistent.
 
  • #3
haruspex said:
I am not seeing the logic behind this expression. Please explain it.
E.g., i is a dimensionless number but h has units of metres, so 1 + h / (2 * i) is dimensionally inconsistent.
you are correct I have preciously defined r=hi so if I have r_2=2h r_3=3h and so on then I said I will substitute it instead and forgot to delete the h from the upper term making it into 1+ 1/(2)
 
  • #4
I did improve the code by a lot since I had a lot of confusion In application especially the relaxation method it is a bit hard for me visualise how it exactly works In a table I will add an updated version now
 
  • #5
haruspex said:
I am not seeing the logic behind this expression. Please explain it.
E.g., i is a dimensionless number but h has units of metres, so 1 + h / (2 * i) is dimensionally inconsistent.
with the dimension inconsistency dealt with ,really shows how important it is to check units it took me until yesterday morning to notice it
an improved code with comments for a bit of clarity:
% Parameters
R = 0.1; % Radius of the plates in meters (10 cm)
d = 0.005; % Separation distance in meters (0.5 cm)
V0 = 1; % Potential difference in volts
h = d / 20; % Step size
rmax = R + 5 * d; % Maximum r
zmax = 10 * d; % Maximum z
epsilon0 = 8.854187817e-12; % Vacuum permittivity

% Create the grid
nr = ceil(rmax / h);
nz = ceil(zmax / h);
phi = zeros(nr, nz);

phi(1:ceil(R/h), ceil(d/(2*h))) = V0/2; % Set the potential on the positive plate
phi(end, :) =  0; % Boundary condition far from the plates
phi(:, 1) = 0;
phi(:, end) = 0;

% Relaxation method
max_iterations = 1000000;
tolerance = 1e-6;
for iter = 1:max_iterations
    old_phi = phi;
    for i = 2:nr-1
        for j = 2:nz-1
            if j == ceil(d/(2*h)) && i <= ceil(R/h)
                continue
            end
            phi(i, j) = (1/4) * (old_phi(i+1, j) * (1 + 1 / (2 * i)) + ...
                                 old_phi(i-1, j) * (1 - 1 / (2 * i)) + ...
                                 old_phi(i, j+1) + old_phi(i, j-1));
        end
    end
    phi(1,:) = phi(2,:);
    % Check for convergence
    if max(max(abs(phi - old_phi))) < tolerance
        fprintf('Converged after %d iterations\n', iter);
        break;
    end
end

% Compute the electric field using central difference approximation
Er = zeros(nr, nz);
Ez = zeros(nr, nz);
for i = 2:nr-1
    for j = 2:nz-1
        Er(i, j) = -(phi(i+1, j) - phi(i-1, j)) / (2 * h);
        Ez(i, j) = -(phi(i, j+1) - phi(i, j-1)) / (2 * h);
    end
end

% Compute the surface charge density at the edge of the plate
%r_edge = ceil(R / h);
%sigma = epsilon0 * (Er(r_edge+1, :) - Er(r_edge-1, :)) / (2 * h);
% Compute the surface charge density at the edge of the plate
% Compute the surface charge density at the plate (at z = d/2)
z_plate = ceil(d / (2 * h)); % The index of z at the plate
sigma = epsilon0 * (Ez(:, z_plate+1) - Ez(:, z_plate-1)) / (2 * h);
% Compute the total charge on the plate by integrating sigma
% Note: We multiply by 2*pi*r to account for cylindrical coordinates
Q = 0;
for j = 1:nz-1
    r = (j - 1) * h;
    area = 2 * pi * r * h; % Area of the thin ring
    Q = Q + sigma(j) * area;
end
fprintf('The total charge computed by integrating over the surface charged density:%e F\n', Q)
% Compute the capacitance
C = Q / V0;
fprintf('Computed capacitance: %e F\n', C);

% Analytic capacitance for comparison
C_analytic = epsilon0 * pi * R^2 / d;
fprintf('Analytic capacitance: %e F\n', C_analytic);

% Plot the potential
figure;
imagesc((0:nr-1) * h, (0:nz-1) * h, flipud(phi'));
colorbar;
title('Electric Potential \phi');
xlabel('r (m)');
ylabel('z (m)');

% Plot the potential along z at r = 0
figure;
plot((0:nz-1) * h, phi(1, :));
title('Electric Potential \phi along z at r = 0');
xlabel('z (m)');
ylabel('\phi (V)');

% Plot the electric field
figure;
quiver((0:nr-1) * h, (0:nz-1) * h, Er', Ez');
title('Electric Field');
xlabel('r (m)');
ylabel('z (m)');

% Plot the surface charge density
figure;
plot((0:nr-1) * h, sigma);
title('Surface Charge Density \sigma at the Edge of the Plate');
xlabel('r (m)');
ylabel('\sigma (C/m^2)');

% Numerical differentiation example
f = @cos;
x = 1;

d_f =@(x) -sin(x);
exact = d_f(x);
approx_1 = @(f, x, h) (f(x + h) - f(x)) ./ h;
approx_2 = @(f, x, h) (f(x + h) - f(x - h)) ./ (2 * h);
h = logspace(-1, -15, 100);

% Plot numerical differentiation errors
figure;
loglog(h, abs(exact - approx_1(f, x, h)), '*');
hold on;
loglog(h, abs(exact - approx_2(f, x, h)), '*');
hold off;
xlabel("log(h) from x=1");
ylabel("log(of the difference) from -sin(1)");
legend("normal approx", "symmetrical approximation");
 
  • #6
This still looks wrong to me:
kirito said:
old_phi(i+1, j) * (1 + 1 / (2 * i)) + ... old_phi(i-1, j) * (1 - 1 / (2 * i)) + ... old_phi(i, j+1) + old_phi(i, j-1)
Why the 2*?

You seem to have fixed 0 potential at r=0 and r=rmax. Wouldn’t it be better to have it as linearly Vmin to Vmax at r=0, and maybe also at rmax?
Also, you set V0/2 at one plate, so shouldn’t you set -V0/2 at the other?
 
  • #7
haruspex said:
This still looks wrong to me:

Why the 2*?

You seem to have fixed 0 potential at r=0 and r=rmax. Wouldn’t it be better to have those as linearly Vmin to Vmax? Or maybe that at r=0 and uniformly Vavg at rmax?
Also, you set V0/2 at one plate, so shouldn’t you set -V0/2 at the other?
the 2* because i was asked to take r as ih which is the step taken in the r direction
Why did not i set the potential on the other plate to -vo/2 because i only looked at the upper plate taking it only into account
 
  • #8
kirito said:
the 2* because i was asked to take r as ih which is the step taken in the r direction
Why did not i set the potential on the other plate to -vo/2 because i only looked at the upper plate taking it only into account
Though i may i have applied it incorrectly but when i asked a teacher for a hint to simplify the calculations since the run time is long , he told me a hint is to only look at the upper plate and try to find symmetry for the problem in the r theta coordinates, so i looked at the upper plate and only calculated the potential in a quarter of the space assuming that from the symmetry for rotation the potential i would get in each of the 4 quarters is the same
 
  • #9
kirito said:
Though i may i have applied it incorrectly but when i asked a teacher for a hint to simplify the calculations since the run time is long , he told me a hint is to only look at the upper plate and try to find symmetry for the problem in the r theta coordinates, so i looked at the upper plate and only calculated the potential in a quarter of the space assuming that from the symmetry for rotation the potential i would get in each of the 4 quarters is the same
haruspex said:
This still looks wrong to me:

Why the 2*?

You seem to have fixed 0 potential at r=0 and r=rmax. Wouldn’t it be better to have it as linearly Vmin to Vmax at r=0, and maybe also at rmax?
Also, you set V0/2 at one plate, so shouldn’t you set -V0/2 at the other?
I still have trouble understanding what potential to apply and for which condition, but i will reread this and try to understand how to apply what you are suggesting, i think it all comes down to the fact that though i know how to calculate relaxation I don’t understand how to apply Laplace conditions to most problems in question , i will be going to the office hours to see the code the lecturer wrote later on since the assignment time was due a while back , and i will read more about Laplace today
 
  • #10
kirito said:
the 2* because i was asked to take r as ih which is the step taken in the r direction
For a given circle (r value and z value) you have four adjacent circles: (r+h,z), (r-h,z), (r,z-h), (r,z+h).
The contributions of these to the potential at (r,z) at the next time step must be weighted according their "volumes": r+h, r-h, r, r. Normalising, 1+h/r, 1-h/r, 1, 1. But you have 1+h/(2r) etc.
kirito said:
Why did not i set the potential on the other plate to -vo/2 because i only looked at the upper plate taking it only into account
Yes, sorry, I forgot you were modelling only the upper half.
But what about the potentials at r=0 and r=rmax? It is not right for those to be fixed at 0.
 
  • #11
haruspex said:
For a given circle (r value and z value) you have four adjacent circles: (r+h,z), (r-h,z), (r,z-h), (r,z+h).
The contributions of these to the potential at (r,z) at the next time step must be weighted according their "volumes": r+h, r-h, r, r. Normalising, 1+h/r, 1-h/r, 1, 1. But you have 1+h/(2r) etc.

Yes, sorry, I forgot you were modelling only the upper half.
But what about the potentials at r=0 and r=rmax? It is not right for those to be fixed at 0.
IMG_4410.jpeg

The reason for the two because the formula i got when using symmetrical first derivative to approximate Laplace in spherical coordinates was this
 
  • #12
kirito said:
View attachment 348616
The reason for the two because the formula i got when using symmetrical first derivative to approximate Laplace in spherical coordinates was this
For r=0 i thought its the condition so potential at z=0 is zero
For rmax i though i should take it as 0 since at infinite distance we consider potential zero
 
  • #13
kirito said:
For r=0 i thought its the condition so potential at z=0 is zero
Surely at r=0 the potential should increase approximately linearly from 0 to V0/2.
kirito said:
For rmax i though i should take it as 0 since at infinite distance we consider potential zero
It depends whether rmax is sufficiently large in relation to the disc radius. You only have it 25% larger. Maybe experiment with that later when you have it basically working, i.e. see whether increasing rmax makes a significant difference.
 
  • Like
Likes kirito
  • #14
haruspex said:
Surely at r=0 the potential should increase approximately linearly from 0 to V0/2.
Better would be to set each potential at r=0 at t+1 from the potential at r=h, same z, at time t.
 
  • #15
haruspex said:
Better would be to set each potential at r=0 at t+1 from the potential at r=h, same z, at time t.
if you don't mind further explaining what this means , not sure if I get it , to set the potential at t+1 from r=h is bit unclear to me
 
  • #16
kirito said:
if you don't mind further explaining what this means , not sure if I get it , to set the potential at t+1 from r=h is bit unclear to me
At each time step you set the potential at each (r,z) coordinate from its neighbours' potentials at the previous time step, but not for r=0. I'm saying set it at (0,z) from the value at (h,z) at the previous time step.
Or you could do an average involving (0,z+1), (0,z-1) too, but I don't think that changes much.
 
  • Like
Likes kirito
  • #17
haruspex said:
At each time step you set the potential at each (r,z) coordinate from its neighbours' potentials at the previous time step, but not for r=0. I'm saying set it at (0,z) from the value at (h,z) at the previous time step.
Or you could do an average involving (0,z+1), (0,z-1) too, but I don't think that changes much.
your explanation is much appreciated, thank you
 

FAQ: Find the electric field between 2 finite discs

1. What is the formula for calculating the electric field between two finite discs?

The electric field (E) between two finite discs can be calculated using the principle of superposition. The electric field due to a single disc can be derived from its surface charge density (σ) and is given by the formula: E = (σ / 2ε₀) * (1 - (z / √(z² + R²))) for a disc of radius R at a distance z along the axis perpendicular to its surface. For two discs, you would calculate the electric field due to each disc separately and then combine them vectorially.

2. How does the distance between the two discs affect the electric field?

The distance between the two discs significantly affects the electric field strength. As the distance increases, the electric field strength decreases due to the inverse square relationship inherent in electrostatics. Additionally, the field lines become more spread out, resulting in a weaker overall field. Conversely, as the discs are brought closer together, the electric field strength increases due to the superposition of the fields from both discs.

3. Can the electric field between two finite discs be uniform?

No, the electric field between two finite discs is generally not uniform. The distribution of electric field lines is affected by the finite size of the discs and their separation distance. Near the center between the discs, the field may appear more uniform, but as you move away from the center, the field strength can vary significantly due to edge effects and the geometry of the discs.

4. What factors influence the magnitude of the electric field between two finite discs?

The magnitude of the electric field between two finite discs is influenced by several factors, including the surface charge density (σ) of the discs, the radius (R) of the discs, the distance (z) between the discs, and the permittivity of free space (ε₀). Higher charge densities and smaller distances between the discs will result in a stronger electric field, while larger radii can also affect the distribution of the field lines.

5. How can experimental measurements of the electric field between finite discs be conducted?

Experimental measurements of the electric field between finite discs can be conducted using a test charge or a probe, such as an electrometer or a field mill. By placing the probe at various points in the region between the discs and measuring the force experienced by the test charge, one can infer the electric field strength. It is important to ensure that the influence of external fields is minimized and that measurements are taken at various distances to understand the field distribution accurately.

Back
Top