File:VFPt capacitor-round-plate uniform-potential+contour.svg

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

Original file (SVG file, nominally 800 × 600 pixels, file size: 148 KB)

Captions

Captions

Add a one-line explanation of what this file represents

Summary

[edit]
Description
English: Electric field of simple parallel plate capacitor. The capacitor consists of two round plates. The field is accurately computed for a uniform potential at each plate. The charge density increases towards the edges. The electric potential at each position is plotted as the background color from positive (fuchsia) through neutral (yellow) to negative (aqua) together with uniformely spaced equipotential lines. Note that the field lines follow the gradient of the scalar potential.
Date
Source Own work
Author Geek3
Other versions VFPt capacitor-round-plate uniform.svg, VFPt capacitor-round-plate potential.svg
SVG development
InfoField
 
The SVG code is valid.
 
This plot was created with VectorFieldPlot.
Source code
InfoField

Python code

# paste this code at the end of VectorFieldPlot 2.3
doc = FieldplotDocument('VFPt_capacitor-round-plate_uniform-potential+contour',
    width=800, height=600, commons=True)
# capacitor dimensions
l = 4.5
d = 1.5

# To model the real, non-uniform charge distribution on the capacitor plate,
# we we cut the plate into several finite rings and equalize their potential.
nrings = 10 # caution, increases computing effort a lot.
q_list = sc.ones(nrings)
# higher segment density towards the edges, where charge density varies more
r_list = l/2. * (1.0 - sc.linspace(1, 0, nrings + 1)[1:]**2)

for i_iter in range(50):
    discs = []
    for iring in range(nrings):
        r = r_list[iring]
        Q = r**2 * pi * (q_list[iring])
        if iring < nrings - 1:
            Q -= r**2 * pi * q_list[iring+1]
        discs.append({'x0':-r, 'y0':d/2., 'x1':r, 'y1':d/2., 'Q':Q})
        discs.append({'x0':-r, 'y0':-d/2., 'x1':r, 'y1':-d/2., 'Q':-Q})
    field = Field([ ['charged_disc', p] for p in discs])
    
    V_list = [field.V([(r_list[0]) / 2., d/2.])]
    for i in range(1, nrings):
        V_list.append(field.V([(r_list[i-1] + r_list[i]) / 2., d/2.]))
    
    # We want the potential to be 1 everywhere on the plate,
    # so iteratively adapt the charges
    q_list = q_list / V_list

print 'ring charge densities', q_list
print 'ring potentials', V_list

Q_list = [q_list[0] * r_list[0]] + [q_list[i] * (r_list[i] - r_list[i-1]) for i in range(1, nrings)]
charge_sums = sc.cumsum([0.] + Q_list[::-1] + Q_list)
relative_charge_position = ip.interp1d(charge_sums / charge_sums[-1],
    list(-r_list[::-1]) + [0.] + list(r_list))

def startpath(t):
    # take an oval with stright lines and half-cirles around one plate
    tt = (t%1) * (2 * l + pi * d)
    if tt <= l*0.5:
        return sc.array([tt, d])
    elif tt <= l*0.5 + pi/2.*d:
        phi = (tt - l*0.5) / (d/2.)
        return sc.array([l*0.5 + d*0.5*sin(phi), d*0.5 + d*0.5*cos(phi)])
    elif tt <= l*1.5 + pi/2.*d:
        return sc.array([l - (tt - pi/2.*d), 0.])
    elif tt <= l*1.5 + pi*d:
        phi = (tt - l*1.5) / (d/2.)
        return sc.array([-l*0.5 + d*0.5*sin(phi), d*0.5 + d*0.5*cos(phi)])
    else:
        return sc.array([tt - (l*2. + pi*d), d])

nlines = 22
startpoints = Startpath(field, startpath).npoints(nlines)

# plot field lines
for p0 in startpoints:
    line = FieldLine(field, p0, directions='both')
    doc.draw_line(line, linewidth=2.4, arrows_style={'dist':2, 'min_arrows':1})

# plot round plates
D = 0.055
lw = 0.01
nsign = nlines
plus = 'M 0,-0.02 v 0.04 M -0.02,0 h 0.04'
minus = 'M -0.02,0 h 0.04'
defs = doc.draw_object('g', {})
grad = doc.draw_object('linearGradient', {'id':'grad',
    'x1':str(l/2.), 'x2':str(-l/2.), 'y1':'0', 'y2':'0',
    'gradientUnits':'userSpaceOnUse'}, defs)
for o, c, a in ((0, '#000', 0.3), (0.3, '#999', 0.2),
                (0.8, '#fff', 0.25), (1, '#fff', 0.65)):
    doc.draw_object('stop', {'id':'grad',
         'offset':str(o), 'stop-color':c, 'stop-opacity':str(a)}, grad)

for iplate in range(2):
    yplate = d / 2. * {0:-1., 1:1.}[iplate]
    M = sc.array([0., yplate])
    R = sc.array([l/2., 0.])
    a = atan2(R[1], R[0])
    if iplate == 1:
        col = '#e22'
        sign = plus
    else:
        col = '#45e'
        sign = minus
    transform = 'translate({:.6g},{:.6g})'.format(M[0], M[1])
    transform += ' rotate({:.6g})'.format(degrees(a))
    doc.draw_object('rect', {'x':-vabs(R)-D/2., 'width':2*vabs(R)+D,
        'y':-D, 'height':2*D, 'transform':transform,
        'style':'fill:{:s}; stroke:none'.format(col)})
    doc.draw_object('rect', {'x':-vabs(R)-D/2., 'width':2*vabs(R)+D,
        'y':-D, 'height':2*D, 'transform':transform,
        'style':'fill:url(#grad); stroke:#000; stroke-width:{:.6g}'.format(lw)})
    for i in range(nsign):
        pos = [relative_charge_position((i + 0.5) / nsign), yplate]
        doc.draw_object('path', {'d':sign,
        'transform':'translate({:.6g},{:.6g})'.format(*pos),
        'style':'fill:none; stroke:#000; stroke-width:{:.6g}; '.format(2*lw) +
        'stroke-linecap:square'})

# draw potential
print 'computing potential field...'
U0 = field.V([0., d/2. + D + lw/2.])
doc.draw_scalar_field(func=field.V, cmap=doc.cmap_AqYlFs, vmin=-U0, vmax=U0)
print 'computing contours...'
doc.draw_contours(func=field.V, levels=sc.linspace(-1., 1., 9)[1:-1])

doc.write()

Licensing

[edit]
I, the copyright holder of this work, hereby publish it under the following license:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current09:19, 3 October 2019Thumbnail for version as of 09:19, 3 October 2019800 × 600 (148 KB)Geek3 (talk | contribs)User created page with UploadWizard

There are no pages that use this file.

Metadata