File:VFPt quadrupole coils 1.svg

From KYNNpedia

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

This file is from Wikimedia Commons and may be used by other projects. The description on its file description page there is shown below.

Summary

Description
English: Magnetic field of four coils creating a quadrupole field. This field configuration is used for strong focusing accelerator physics for instance.
Date
Source Own work
Author Geek3
Other versions VFPt quadrupole coils 2.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 1.1
doc = FieldplotDocument('VFPt_quadrupole_coils_1',
    width=600, height=600, unit=100, commons=True)
R = 1.2
rs = 0.5
ls = 0.4
field = Field({'coils':[
    [-R, R, -pi/4, rs, ls, -1.0], [R, R, pi/4, rs, ls, -1.0],
    [R, -R, -pi/4, rs, ls, 1.0], [-R, -R, pi/4, rs, ls, 1.0]]})
r0 = op.brentq(lambda r: field.F([0, r])[0], 0.1 * R, 2.0 * R)
Fs = ig.quad(lambda r: field.F([0, r])[0], 0.0, r0)[0]
n = 4
for i in range(n):
    a = (i + 0.5) / n
    r = op.brentq(lambda r: ig.quad(
        lambda r1: field.F([0, r1])[0], 0.0, r)[0] - a * Fs, 0.0, r0)
    for phi in range(4):
        line = FieldLine(field, rot([r, 0], phi * pi / 2.0), directions='both')
        doc.draw_line(line, arrows_style={'dist':1.3, 'offsets':[0.0, 0.5, 0.5, 1.0]})
for phi in range(4):
    xy = rot([R, R], phi * pi / 2.0)
    for d in (-1, 1):
        xy1 = xy + d * rot([0.427, 0], (phi-0.5) * pi / 2.0)
        line = FieldLine(field, xy1, directions='both')
        doc.draw_line(line, arrows_style={'dist':1.3})

# draw coils
windings = 9
b = ls / (windings - 1.0)
coil_defs = doc.draw_object('defs', {})
grad_back = doc.draw_object('linearGradient', {'id':'grad_back',
    'x1':'0', 'x2':'0', 'y1':str(-rs-b), 'y2':str(rs+b),
    'gradientUnits':'userSpaceOnUse'}, group=coil_defs)
for of, col in ((0.00, '#ac7d6b'), (0.15, '#220e0b'), (0.35, '#8a634f'),
    (0.60, '#ffffff'), (0.80, '#8a634f'), (0.90, '#371f18'), (1.00, '#a37e6b')):
    doc.draw_object('stop', {'offset':str(of), 'stop-color':col}, group=grad_back)
grad_front = doc.draw_object('linearGradient', {'id':'grad_front',
    'x1':str(-b), 'x2':str(b), 'y1':'0', 'y2':'0',
    'gradientUnits':'userSpaceOnUse'}, group=coil_defs)
for of, col, opa in ((0.00, '#ad7d63', 0.90), (0.48, '#ad8169', 0.31), 
    (0.65, '#8f6050', 0.14), (0.83, '#844038', 0.42), (1.00, '#2d1412', 1.00)):
    doc.draw_object('stop', {'offset':str(of), 'stop-color':col, 'stop-opacity':str(opa)}, group=grad_front)
wire = doc.draw_object('g', {'id':'wire'}, group=coil_defs)
wire_string = 'M -{0},{1} L -{0},-{1} A {0},{0} 0 1 1 {0},-{1} L {0},{1} A {0},{0} 0 1 1 -{0},{1} Z'.format(b, rs)
wire_back = doc.draw_object('path', {'d':wire_string, 'stroke':'none',
    'fill':'url(#grad_back)'}, group=wire)
wire_front = doc.draw_object('path', {'d':wire_string, 'stroke':'#000000',
    'stroke-width':'0.01', 'fill':'url(#grad_front)'}, group=wire)
coil = doc.draw_object('g', {'id':'coil'}, group=coil_defs)
for i in range(windings):
    doc.draw_object('use', {'{http://www.w3.org/1999/xlink}href':'#wire',
        'x':str(b * (2 * i + 1 - windings))}, group=coil)
doc.draw_object('use', {'{http://www.w3.org/1999/xlink}href':'#coil',
    'transform':'translate(-{0},{0}) scale(-1,1) rotate(45)'.format(R)})
doc.draw_object('use', {'{http://www.w3.org/1999/xlink}href':'#coil',
    'transform':'translate({0},{0}) rotate(45)'.format(R)})
doc.draw_object('use', {'{http://www.w3.org/1999/xlink}href':'#coil',
    'transform':'translate({0},-{0}) scale(-1,1) rotate(45)'.format(R)})
doc.draw_object('use', {'{http://www.w3.org/1999/xlink}href':'#coil',
    'transform':'translate(-{0},-{0}) rotate(45)'.format(R)})

doc.write()

Licensing

I, the copyright holder of this work, hereby publish it under the following licenses:
GNU head Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled GNU Free Documentation License.
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported 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.
You may select the license of your choice.

Captions

Add a one-line explanation of what this file represents

Items portrayed in this file

depicts

August 2010

image/svg+xml

File history

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

Date/TimeThumbnailDimensionsUserComment
current22:24, 7 August 2010Thumbnail for version as of 22:24, 7 August 2010600 × 600 (47 KB)wikimediacommons>Geek3VFPt_quadrupole_coils_1

The following page uses this file:

Metadata