File:VFPt metal balls neutral potential+contour.svg
Original file (SVG file, nominally 800 × 600 pixels, file size: 126 KB)
Captions
Summary
[edit]DescriptionVFPt metal balls neutral potential+contour.svg |
English: Electric field around a positively charged and a neutral conducting sphere. The shape of the field lines is computed exactly, using the method of image charges with an infinite series of charges inside the two spheres. Field lines are always orthogonal to the surface of each sphere. In reality, the field is created by a continuous charge distribution at the surface of each sphere, indicated by small plus and minus signs. The electric potential is shown in the background from positive (fuchsia) to zero (yellow) together with uniformely spaced equipotential lines. Note that the field lines follow the gradient of the potential. |
Date | |
Source | Own work |
Author | Geek3 |
Other versions | VFPt metal balls neutral potential.svg |
SVG development InfoField | This plot was created with VectorFieldPlot. |
Source code InfoField | Python code# paste this code at the end of VectorFieldPlot 3.1
# https://commons.wikimedia.org/wiki/User:Geek3/VectorFieldPlot
u = 100.0
doc = FieldplotDocument('VFPt_metal_balls_neutral_potential+contour',
commons=True, width=800, height=600, center=[400, 300], unit=u)
# define two spheres with position and radius
s1 = {'c':sc.array([-1.5, 0.]), 'r':1.0}
s2 = {'c':sc.array([1.5, 0.]), 'r':1.0}
# compute series of charges https://dx.doi.org/10.2174/1874183500902010032
def make_charge_series(p0, q0, spheres):
charges = []
p, q = p0, q0
i = 0
while fabs(q) > 1e-4 * fabs(q0):
charges.append([p, q])
i += 1
s = spheres[i%2]
q = -q * s['r'] / vabs(p - s['c'])
p = s['c'] + (p - s['c']) * (s['r'] / vabs(p - s['c']))**2
return charges
charges1 = make_charge_series(s1['c'], 1., [s1, s2])
charges2 = make_charge_series(s2['c'], 1., [s2, s1])
# make sphere 2 neutral
charge_ratio = sum([c[1] for c in charges1[1::2]]) / sum([c[1] for c in charges2[::2]])
for c in charges2:
c[1] = c[1] * -charge_ratio
charges = sorted(charges1 + charges2, key=lambda x: -fabs(x[1]))
field = Field([ ['monopole', {'x':c[0][0], 'y':c[0][1], 'Q':c[1]}] for c in charges])
def pot(xy):
for s in s1, s2:
if vabs(xy - s['c']) <= s['r']:
return field.V(s['c'] + array((s['r'], 0)))
return field.V(xy)
U0 = field.V(s1['c'] + array((s1['r'], 0)))
Ucorner = field.V(sc.array([4., 3.]))
doc.draw_scalar_field(func=pot, cmap=doc.cmap_AqYlFs, vmin=2*Ucorner-U0, vmax=U0)
doc.draw_contours(func=pot, linewidth=1, linecolor='#444444',
levels=sc.linspace(0, U0, 11)[:-1])
# draw symbols
#for c in charges:
# doc.draw_charges(Field([ ['monopole', {'x':c[0][0], 'y':c[0][1], 'Q':c[1]}] ]),
# scale=0.6*sqrt(fabs(c[1])))
gradr = doc.draw_object('linearGradient', {'id':'rod_shade', 'x1':0, 'x2':0,
'y1':0, 'y2':1, 'gradientUnits':'objectBoundingBox'}, group=doc.defs)
for col, of in (('#666', 0), ('#ddd', 0.6), ('#fff', 0.7), ('#ddd', 0.8),
('#888', 1)):
doc.draw_object('stop', {'offset':of, 'stop-color':col}, group=gradr)
gradb = doc.draw_object('radialGradient', {'id':'metal_spot', 'cx':'0.53',
'cy':'0.54', 'r':'0.55', 'fx':'0.65', 'fy':'0.7',
'gradientUnits':'objectBoundingBox'}, group=doc.defs)
for col, of in (('#fff', 0), ('#e7e7e7', 0.15), ('#ddd', 0.25),
('#aaa', 0.7), ('#888', 0.9), ('#666', 1)):
doc.draw_object('stop', {'offset':of, 'stop-color':col}, group=gradb)
ball_charges = []
for ib in range(2):
ball = doc.draw_object('g', {'id':'metal_ball{:}'.format(ib+1),
'transform':'translate({:.3f},{:.3f})'.format(*([s1, s2][ib]['c'])),
'style':'fill:none; stroke:#000;stroke-linecap:square', 'opacity':1})
# draw rods
if ib == 0:
x1, x2 = -4.1 - s1['c'][0], -0.9 * s1['r']
doc.draw_object('rect', {'x':x1, 'width':x2-x1,
'y':-0.1/1.2+0.01, 'height':0.2/1.2-0.02,
'style':'fill:url(#rod_shade); stroke-width:0.02'}, group=ball)
# draw metal balls
doc.draw_object('circle', {'cx':0, 'cy':0, 'r':[s1, s2][ib]['r'],
'style':'fill:url(#metal_spot); stroke-width:0.02'}, group=ball)
ball_charges.append(doc.draw_object('g',
{'style':'stroke-width:0.02'}, group=ball))
def startpath1(t):
phi = 2. * pi * t
return s1['c'] + s1['r'] * array([cos(phi), sin(phi)])
def startpath2(t):
phi = 2. * pi * t
return s2['c'] + s2['r'] * array([-cos(phi), sin(phi)])
nlines1 = 24
startpoints = Startpath(field, startpath1).npoints(nlines1)
t0 = optimize.brentq(lambda t: sc.cross(field.F(startpath2(t)),
Startpath(field, startpath2)._dstartpath(t)), 0, 0.5)
nlines2 = 4
startpoints += Startpath(field, startpath2, t0=t0, t1=1-t0).npoints(nlines2)
#for phi in sc.linspace(-0.35, 0.35, 4):
# startpoints.append(s1['c'] + 0.05 * sc.array([cos(phi), sin(phi)]))
#for phi in sc.linspace(-1.4, 1.4, 4):
# startpoints.append(s2['c'] + 0.05 * sc.array([-cos(phi), sin(phi)]))
for ip, p0 in enumerate(startpoints):
line = FieldLine(field, p0, directions='both', maxr=10.,
bounds_func=lambda xy: max([s['r'] - vabs(xy-s['c']) for s in [s1, s2]]))
# draw little charge signs near the surface
path_minus = 'M {0:.5f},0 h {1:.5f}'.format(-2./u, 4./u)
path_plus = 'M {0:.5f},0 h {1:.5f} M 0,{0:.5f} v {1:.5f}'.format(-2./u, 4./u)
for si in range(2):
sphere = [s1, s2][si]
# check if fieldline ends inside the sphere
for ci in range(2):
if (vabs(line.get_position(ci) - sphere['c']) < sphere['r'] and
vabs(line.get_position(1-ci) - sphere['c']) > sphere['r']):
# find the point where the field line cuts the surface
t = optimize.brentq(lambda t: vabs(line.get_position(t)
- sphere['c']) - sphere['r'], 0., 1.)
pr = line.get_position(t) - sphere['c']
cpos = 0.9 * sphere['r'] * pr / vabs(pr)
doc.draw_object('path', {'stroke':'black', 'd':
[path_plus, path_minus][ci],
'transform':'translate({:.5f},{:.5f})'.format(
round(u*cpos[0])/u, round(u*cpos[1])/u)},
group=ball_charges[si])
doc.draw_line(line, arrows_style={'potential':pot,
'at_potentials':[0.25 * U0, 0.55 * U0]})
doc.write()
|
Licensing
[edit]- 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/Time | Thumbnail | Dimensions | User | Comment | |
---|---|---|---|---|---|
current | 21:51, 25 May 2020 | 800 × 600 (126 KB) | Geek3 (talk | contribs) | Uploaded own work with UploadWizard |
You cannot overwrite this file.
File usage on Commons
The following 2 pages use this file:
Metadata
This file contains additional information such as Exif metadata which may have been added by the digital camera, scanner, or software program used to create or digitize it. If the file has been modified from its original state, some details such as the timestamp may not fully reflect those of the original file. The timestamp is only as accurate as the clock in the camera, and it may be completely wrong.
Short title | VFPt_metal_balls_neutral_potential+contour |
---|---|
Image title | VFPt_metal_balls_neutral_potential+contour
created with VectorFieldPlot 3.1 https://commons.wikimedia.org/wiki/User:Geek3/VectorFieldPlot about: https://commons.wikimedia.org/wiki/File:VFPt_metal_balls_neutral_potential+contour.svg rights: Creative Commons Attribution ShareAlike 4.0 |
Width | 800 |
Height | 600 |