File:VFPt flat cylinder magnet potential+contour.svg

Summary

Description
English: Drawing of a homogeneously magnetized flat cylindrical magnet with exactly computed magnetic field lines. The cylinder has the proportions R/L=2. The magnetic north pole is aligned on top and the magnetic south pole on the bottom, with magnetization along the cylinder axis. The magnetic scalar potential 𝜓 is shown in the background from positive (fuchsia) through zero (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 flat cylinder magnet potential.svg
SVG development
InfoField
Source code
InfoField

Python code

# paste this code at the end of VectorFieldPlot 2.4
# https://commons.wikimedia.org/wiki/User:Geek3/VectorFieldPlot
doc = FieldplotDocument('VFPt_flat_cylinder_magnet_potential+contour',
    commons=True, width=800, height=800)

R, L2 = 2., 0.5
Bfield = Field({'coils':[ [0, 0, pi/2, R, L2 ,1]]})
Hfield = Field([ ['charged_disc', {'x0':-R, 'y0':-L2, 'x1':R, 'y1':-L2, 'Q':-1}],
                 ['charged_disc', {'x0':-R, 'y0':L2, 'x1':R, 'y1':L2, 'Q':1}] ])

doc.draw_magnets(Bfield)

U0 = Hfield.V([0., L2 + 0.02])
doc.draw_scalar_field(func=Hfield.V, cmap=doc.cmap_AqYlFs, vmin=-U0, vmax=U0)
U1 = Hfield.V([0., L2])
doc.draw_contours(func=Hfield.V, levels=sc.linspace(-U1, U1, 11)[1:-1])

nlines = 22
startpoints = Startpath(Bfield, lambda t: sc.array([-R + 2. * R * t, 0.])
    ).npoints(nlines)
cond = lambda xy: fabs(xy[1]) < 1e-2 or fabs(xy[1]) > 0.5

for iline, p0 in enumerate(startpoints):
    line = FieldLine(Bfield, p0, directions='both', maxr=12)
    arrows_style = {'dist':2.5}
    if iline >= 5 and iline < nlines - 5:
        arrows_style = {'potential':Hfield.V,
            'at_potentials':[-0.68*U1, -0.17*U1, 0.17*U1, 0.68*U1],
            'condition_func':cond}
    doc.draw_line(line, linewidth=2.4, arrows_style=arrows_style)

doc.write()

Licensing

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.
Category:CC-BY-SA-4.0#VFPt%20flat%20cylinder%20magnet%20potential+contour.svg
Category:Self-published work Category:Photos by User:Geek3 Category:Field lines around magnets (image set) Category:Field lines around magnets Category:Magnetic scalar potential
Category:CC-BY-SA-4.0 Category:Field lines around magnets Category:Field lines around magnets (image set) Category:Magnetic scalar potential Category:Photos by User:Geek3 Category:Self-published work Category:Valid SVG created with VectorFieldPlot code