Phys-Vpy Homework 7 Solved

35.00 $

Category:

Description

Rate this product

Computer Homework 7 Non-ideal Capacitor

A parallel-plate capacitor shown in the figure, has an infinite length in z-axis. The distance between the plates is 𝑑 = 1 mm, the width ofbothplatesis 𝐿=4 mm,andthevoltageis100Voltonthetop plate and -100 Volt on the bottom. If we want to consider the edge effect of the non-ideal capacitor, we need to calculate numerically the total charge on each plate per meter length in z-axis in order to obtain the capacitance value per meter length in z-axis.

𝑦

From General Physics course, we already know that anywhere 𝐸)⃑ = −(!” 𝑥. + !” 𝑦. + !” 𝑧̂). Now we choose !# !$ !%

an infinitesimal cube of volume 𝑑𝑥𝑑𝑦𝑑𝑧. In the two faces perpendicular to
the x-axis, we have the net electric flux for the two faces as 𝑑𝑦

𝑥

𝐸!(𝑥 + 𝑑𝑥)𝑑𝑦𝑑𝑧 − 𝐸!(𝑥)𝑑𝑦𝑑𝑧 = +𝜕𝐸! 𝑑𝑥- 𝑑𝑦𝑑𝑧 = 𝜕𝐸! 𝑑𝑉. 𝐸#(𝑥)

𝐸#(𝑥 + 𝑑𝑥) 𝜕𝑥 𝜕𝑥 𝑑𝑧

Similarly,thenetfluxforthetwofacesperpendiculartothey-axisis “#!𝑑𝑉, 𝑑𝑥 “$

and the two faces to z-axis is “#” 𝑑𝑉. Therefore, the total flux around the cube is 𝜙 = (“## + “#! + “% “! “$

“#”)𝑑𝑉. If no charge is inside this cube, by Gauss’ Law, 𝜙 = & = 0, meaning “## + “#! + “#” = 0. With “% ‘$ “! “$ “%

𝐸)⃑=−3!”𝑥.+!”𝑦.+!”𝑧̂4=𝐸𝑥.+𝐸𝑦.+𝐸𝑧̂,itthenbecomes “%++”%++”%+=0,whichiscalleda !# !$ !% 𝑥 𝑦 𝑧 “!% “$% “%%

Laplace’s Equation and is usually written as ∇,𝑉 = 0. The operator ∇, is called a Laplacian operator. Since in this problem, there is no charge variation along the z-axis, by symmetry 𝐸 = 0 and “%+ = 0

everywhere. We can reduce the 3-dimentional Laplace’s Equation to 2-dimensional, “%+ + “%+ = 0. “!% “$%

With the condition that at the position of the top and bottom plates 𝑉 = +100 V and −100 V respectively, we can try to solve this Laplacian problem by the numerical Laplacian solver. The simplest numerical Laplacian solver is illustrated as the following and starts from the Taylor’s expansion:

% “%%

𝑉(𝑥+h,𝑦)≈𝑉(𝑥,𝑦)+h!” +&!”!; !# ‘ !#!

𝑉(𝑥−h,𝑦)≈𝑉(𝑥,𝑦)−h!” +&!”!; !# ‘ !#!

𝑉(𝑥,𝑦+h)≈𝑉(𝑥,𝑦)+h!” +&!”!; !$ ‘ !$!

𝑉(𝑥,𝑦−h)≈𝑉(𝑥,𝑦)−h!” +&!”!.

!$

We add the above four equations and will obtain

𝑉(𝑥,𝑦)=([𝑉(𝑥+h,𝑦)+𝑉(𝑥−h,𝑦)+𝑉(𝑥,𝑦+h)+𝑉(𝑥,𝑦−h)] )

(*1) because !”! +!”! =0. !#! !$!

‘ !$!

Therefore, the potential at each grid-point is simply the mean value of its nearest neighbors. To find the solution one must fix the values of the grid-points on the boundaries or on the positions according to the required conditions and then iterate the potentials until successive results agree each other to within the desired tolerance. This usually can be done with many enough iterations.

In the following program, (1) we use the finite-difference methods for the grid points on the region of interest and set the potential on the top and bottom plates to be ±100V, (2) we solve the 2-D Laplace’s equation at each grid-point, (3) by taking the gradient of the potential, we obtain the electric field on x-y plane, (4) by numerically integrating the Gauss surface we obtain the total charge on the capacitor, and (5) dividing the total charge by the voltage difference we obtain the capacitance. Your job is to complete the template code for (2), (4), and (5) and compare the value of (5) to the value of an ideal parallel-plate capacitor. (Note: You can change this program easily to calculate the capacitance of a rectangular parallel-plate capacitor, i.e. the length in z is not infinite)

from numpy import * from vpython import *

epsilon = 8.854E-12 N = 101
h = 1E-2/(N-1)
L, d= 4E-3,1E-3

V0 = 200

def solve_laplacian(u, u_cond, h, Niter=5000): V = array(u)

for i in range(Niter):
V[u_cond] = u[u_cond]

V[1:-1, 1:-1] = 0

def get_field(V, h):
Ex, Ey = gradient(V)

Ex, Ey = -Ex/h, -Ey/h return Ex, Ey

# replace this 0 by your Laplacian Solver

return V

u = zeros([N, N])
u[int(N/2)-int(L/h/2.0):int(N/2)+int(L/h/2.0), int(N/2) – int(d/h/2.0)] = -V0/2 u[int(N/2)-int(L/h/2.0):int(N/2)+int(L/h/2.0), int(N/2) + int(d/h/2.0)] = V0/2 u_cond = not_equal(u, 0)

V = solve_laplacian(u, u_cond, h)

scene = canvas(title=’non-ideal capacitor’, height=1000, width=1000, center = vec(N*h/2, N*h/2, 0)) scene.lights = []

scene.ambient=color.gray(0.99) box(pos = vec(N*h/2 , N*h/2 – d/2 – h box(pos = vec(N*h/2 , N*h/2 + d/2 – h for i in range(N):

, 0), length = L, height = h/5, width = h) , 0), length = L, height = h/5, width = h)

for j in range(N):
point = box(pos=vec(i*h, j*h, 0), length = h, height= h, width = h/10, color=vec((V[i,j]+100)/200,(100-V[i,j])/200,0.0) )

Ex, Ey = get_field(V, h)

for i in range(0, N):
for j in range(0, N):

ar = arrow(pos = vec( i*h, j*h, h/10), axis =vec (Ex[i,j]/2E9, Ey[i,j]/2E9, 0), shaftwidth = h/6.0, color=color.black)

#find Q, find C_nonideal = Q/(delta V) #Compare C_nonideal to C_ideal

  • hw7-qcpocr.zip