File:VFPt superconductor ball E-field potential+contour.svg

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

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

Captions

Captions

Add a one-line explanation of what this file represents

Summary

[edit]
Description
English: Deformation of a previously homogeneous electric field around a perfect conducting ball (e.g. iron or a superconductor). Inside the sphere the field vanishes. The field lines are accurately computed. The electric potential is drawn as a background color field and uniformely spaced equipotential lines are shown.
Date
Source Own work
Author Geek3
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_superconductor_ball_E-field_potential+contour',
    width=600, height=600, commons=True)
unit = 100.
field_direction = [0.0, -1.0]
sphere = {'p':sc.array([0., 0.]), 'r':1.2}
field = Field([['homogeneous', {'Fx':field_direction[0], 'Fy':field_direction[1]}],
    ['dipole', {'x':sphere['p'][0], 'y':sphere['p'][1],
     'px':4*pi*sphere['r']**3*field_direction[0],
     'py':4*pi*sphere['r']**3*field_direction[1]}]])

def pot(xy):
    if vabs(xy) <= sphere['r']:
        return 1e-8 * xy[1] # zero potential inside metal sphere
    return field.V(xy)

doc.draw_contours(func=pot, levels=sc.linspace(-3, 3, 11))

U0 = pot([3, 3])
doc.draw_scalar_field(func=pot, cmap=doc.cmap_AqYlFs, vmin=-U0, vmax=U0)

# draw the superconducting ball
ball = doc.draw_object('g', {'id':'metal_ball'})
grad = 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=ball)
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=grad)
doc.draw_object('circle', {'cx':sphere['p'][0], 'cy':sphere['p'][1], 'r':str(sphere['r']),
    'style':'fill:url(#metal_spot); stroke:#000; stroke-width:0.02'}, group=ball)
ball_charges = doc.draw_object('g', {'style':'stroke-width:0.02; stroke-linecap:square'}, group=ball)

n_lines = 22
for i in range(n_lines):
    a = -3.3 + 6.6 * (0.5 + i) / n_lines
    line = FieldLine(field, [a, 6], maxr=12, pass_dipoles=1,
        bounds_func=lambda xy: sphere['r'] - vabs(xy - sphere['p']))
    doc.draw_line(line, linewidth=2.4, arrows_style=
        {'at_potentials':[-2.1, 2.1]})
    
    # draw little charge signs near the surface
    path_minus = 'M {0:.5f},0 h {1:.5f}'.format(-2./unit, 4./unit)
    path_plus = 'M {0:.5f},0 h {1:.5f} M 0,{0:.5f} v {1:.5f}'.format(-2./unit, 4./unit)
    
    # check if fieldline crosses sphere surface
    tlist = sc.linspace(0., 1., 101)
    for i in range(1, len(tlist)):
        in0 = vabs(line.get_position(tlist[i-1]) - sphere['p']) <= sphere['r']
        in1 = vabs(line.get_position(tlist[i]) - sphere['p']) <= sphere['r']
        if in0 != in1:
            # find the point where the field line cuts the surface
            t = op.brentq(lambda t: vabs(line.get_position(t)
                - sphere['p']) - sphere['r'], tlist[i-1], tlist[i])
            pr = line.get_position(t) - sphere['p']
            cpos = 0.92 * sphere['r'] * pr / vabs(pr)
            if in1:
                path_d = path_minus
            else:
                path_d = path_plus
            doc.draw_object('path', {'stroke':'black', 'd':path_d,
                'transform':'translate({:.5f},{:.5f})'.format(
                    round(unit*cpos[0])/unit, round(unit*cpos[1])/unit)},
                    group=ball_charges)

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
current22:03, 27 September 2019Thumbnail for version as of 22:03, 27 September 2019600 × 600 (97 KB)Geek3 (talk | contribs)User created page with UploadWizard

Metadata