WolframAlpha.com
WolframCloud.com
All Sites & Public Resources...
Products & Services
Wolfram|One
Mathematica
Wolfram|Alpha Notebook Edition
Programming Lab
Finance Platform
SystemModeler
Wolfram Player
Wolfram Engine
WolframScript
Enterprise Private Cloud
Enterprise Mathematica
Wolfram|Alpha Appliance
Enterprise Solutions
Corporate Consulting
Technical Consulting
Wolfram|Alpha Business Solutions
Resource System
Data Repository
Neural Net Repository
Function Repository
Wolfram|Alpha
Wolfram|Alpha Pro
Problem Generator
API
Data Drop
Products for Education
Mobile Apps
Wolfram Player
Wolfram Cloud App
Wolfram|Alpha for Mobile
Wolfram|Alpha-Powered Apps
Services
Paid Project Support
Wolfram U
Summer Programs
All Products & Services »
Technologies
Wolfram Language
Revolutionary knowledge-based programming language.
Wolfram Cloud
Central infrastructure for Wolfram's cloud products & services.
Wolfram Science
Technology-enabling science of the computational universe.
Wolfram Notebooks
The preeminent environment for any technical workflows.
Wolfram Engine
Software engine implementing the Wolfram Language.
Wolfram Natural Language Understanding System
Knowledge-based broadly deployed natural language.
Wolfram Data Framework
Semantic framework for real-world data.
Wolfram Universal Deployment System
Instant deployment across cloud, desktop, mobile, and more.
Wolfram Knowledgebase
Curated computable knowledge powering Wolfram|Alpha.
All Technologies »
Solutions
Engineering, R&D
Aerospace & Defense
Chemical Engineering
Control Systems
Electrical Engineering
Image Processing
Industrial Engineering
Mechanical Engineering
Operations Research
More...
Finance, Statistics & Business Analysis
Actuarial Sciences
Bioinformatics
Data Science
Econometrics
Financial Risk Management
Statistics
More...
Education
All Solutions for Education
Trends
Machine Learning
Multiparadigm Data Science
Internet of Things
High-Performance Computing
Hackathons
Software & Web
Software Development
Authoring & Publishing
Interface Development
Web Development
Sciences
Astronomy
Biology
Chemistry
More...
All Solutions »
Learning & Support
Learning
Wolfram Language Documentation
Fast Introduction for Programmers
Wolfram U
Videos & Screencasts
Wolfram Language Introductory Book
Webinars & Training
Summer Programs
Books
Need Help?
Support FAQ
Wolfram Community
Contact Support
Premium Support
Paid Project Support
Technical Consulting
All Learning & Support »
Company
About
Company Background
Wolfram Blog
Events
Contact Us
Work with Us
Careers at Wolfram
Internships
Other Wolfram Language Jobs
Initiatives
Wolfram Foundation
MathWorld
Computer-Based Math
A New Kind of Science
Wolfram Technology for Hackathons
Student Ambassador Program
Wolfram for Startups
Demonstrations Project
Wolfram Innovator Awards
Wolfram + Raspberry Pi
Summer Programs
More...
All Company »
Search
WOLFRAM COMMUNITY
Connect with users of Wolfram technologies to learn, solve problems and share ideas
Join
Sign In
Dashboard
Groups
People
Message Boards
Answer
(
Unmark
)
Mark as an Answer
GROUPS:
Staff Picks
Electrical Engineering
Engineering
Mathematics
Physics
Graphics and Visualization
Wolfram Language
Optimization
Wolfram|Alpha Integration
Know-How
9
Robert Mendelsohn
Designing and building the world's largest (amateur) electromagnet
Robert Mendelsohn, Wolfram Research
Posted
26 days ago
1599 Views
|
1 Reply
|
10 Total Likes
Follow this post
|
Designing and building the world’s largest (amateur) electromagnet
by Robert Mendelsohn
In this post, I’ll walk you through how I built what I believe to be the world’s largest amateur electromagnet with the Wolfram Language. I needed this large, strong electromagnet to continue studying highly magnetized (collisionless) plasmas. After examining the requirements of the plasma process, I determined that a highly homogenous magnetic field region with a strength of 160mT, diameter of about an inch and a length of about 2 feet would be sufficient. As you can imagine, an electromagnet requires a lot of wire, and wire is not cheap.
In fact, the prices of copper have really climbed in the last few months. So the difficulty is not really how to build such a magnet, but how to achieve the needed parameters while being cost-effective. Fortunately, we have the Wolfram Language, and we can use real wire prices and component prices and let the Wolfram Language find the best option, including the power supply.
In this post, we’ll briefly consider the theory behind electromagnets, as well as the practicalities of building one. Then we will let the Wolfram Language consider many thousands of different designs and tell us the best option. Finally, I’ll share some photos of the built system as well as some helpful tips for anyone thinking of building a large electromagnet.
The Theory of Electromagnets
This is a very deep and complex topic, but we will stick to the bare minimum theory required to design an electromagnet. If you aren’t interested, feel free to scroll down for photos of big electromagnets. When an electron moves, it creates a magnetic field that rotates around that electron:
If you have a lot of electrons moving in the same direction, as in a current-carrying wire, you amplify that effect:
If you then loop that wire around, you can direct the magnetic field lines in an axial direction:
And there’s basically your electromagnet. We’re not done yet - how do you create fields that are really uniform? In the next section we will consider several different coil configurations that improve the homogeneity of an electromagnet.
Some resources to dive deeper:
Great place for beginners: http://hyperphysics.phy-astr.gsu.edu/hbase/magnetic/magfie.html#c1
For advanced learning: https://press.princeton.edu/books/hardcover/9780691159027/modern-classical-physics
Multi-Coil Homogenous Electromagnets
If a “multi-coil like above (commonly called a solenoid) is infinitely long, then the field within it is uniform. When a solenoid has a finite length, the field is stronger in the middle then at the end:
One of the earliest solutions was to use two current carrying loops that were spaced a special distance apart. This was called a Helmholz coil (or Helmholz pair) and you can try out various configurations with this Manipulate:
I
n
[
]
:
=
M
a
n
i
p
u
l
a
t
e
[
M
o
d
u
l
e
[
{
c
o
i
l
r
e
s
i
s
t
a
n
c
e
=
(
c
o
i
l
t
u
r
n
s
*
P
i
*
Q
u
a
n
t
i
t
y
[
c
o
i
l
r
a
d
i
u
s
,
"
I
n
c
h
e
s
"
]
*
2
.
0
)
*
W
i
r
e
R
e
s
i
s
t
a
n
c
e
[
w
i
r
e
t
y
p
e
]
}
,
M
o
d
u
l
e
[
{
m
a
x
r
a
t
e
d
c
u
r
r
e
n
t
=
M
i
n
[
{
Q
u
a
n
t
i
t
y
[
m
a
x
i
,
"
A
m
p
e
r
e
s
"
]
,
U
n
i
t
C
o
n
v
e
r
t
[
Q
u
a
n
t
i
t
y
[
m
a
x
v
,
"
V
o
l
t
s
"
]
/
c
o
i
l
r
e
s
i
s
t
a
n
c
e
,
"
A
m
p
e
r
e
s
"
]
}
]
,
c
o
i
l
i
n
d
=
U
n
i
t
C
o
n
v
e
r
t
[
(
m
u
0
*
c
o
i
l
t
u
r
n
s
^
2
*
P
i
*
(
W
i
r
e
T
h
i
c
k
n
e
s
s
[
w
i
r
e
t
y
p
e
]
/
2
)
^
2
)
/
(
W
i
r
e
T
h
i
c
k
n
e
s
s
[
w
i
r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1
0
0
,
1
}
,
{
{
w
i
r
e
t
y
p
e
,
"
0
"
,
"
W
i
r
e
T
y
p
e
(
A
W
G
)
"
}
,
{
"
1
2
"
,
"
1
0
"
,
"
4
"
,
"
0
"
,
"
0
0
"
,
"
0
0
0
"
,
"
0
0
0
0
"
}
}
,
S
a
v
e
D
e
f
i
n
i
t
i
o
n
s
T
r
u
e
]
O
u
t
[
]
=
What if we need higher levels of homogeneity? There is an improved version of the Helmholz coil, called a Maxwell coil, that uses 3 rather than 2 loops, and those loops are placed on the surface of a virtual sphere:
Extending this, if you were to add more and more loops on the surface of a sphere, you would eventually get a perfectly homogenous field. The issue is that field has a very large and isotropic volume, and many applications including mine require a longer field with a small radius.
The standard practice here is to use a solenoid with certain parts spaced out. This is optimized numerically using a program like Mathematica. After playing around with that kind of optimization I realized that it greatly increased the complexity of construction: I’d have to very precisely space wraps of wire, and doing do did not lead to a large improvement in performance. So I decided to use a traditional solenoid, and if I used enough turns and the working volume was sufficiently in the interior, there should be a very homogenous field.
I spent a lot of time looking at optimized geometries for producing a homogenous field before realizing the “juice wasn’t worth the squeeze”. At least it resulted in a lot of nice-looking plots of the magnet homogeneity:
I
n
[
]
:
=
D
e
n
s
i
t
y
P
l
o
t
[
(
s
o
l
e
n
o
i
d
3
/
.
{
y
y
2
,
z
2
z
}
)
/
0
.
2
8
2
,
{
y
2
,
-
0
.
0
4
5
,
0
.
0
4
5
}
,
{
z
,
0
.
-
0
.
1
6
,
0
.
1
6
}
,
P
l
o
t
R
a
n
g
e
{
0
,
2
}
,
P
l
o
t
L
e
g
e
n
d
s
A
u
t
o
m
a
t
i
c
,
A
s
p
e
c
t
R
a
t
i
o
3
.
5
5
,
C
o
l
o
r
F
u
n
c
t
i
o
n
C
o
l
o
r
D
a
t
a
[
"
T
e
m
p
e
r
a
t
u
r
e
M
a
p
"
]
]
O
u
t
[
]
=
I may write a later post about optimizing electromagnet geometries with the Wolfram Language. If anyone is interested in the code (and optimization methods, of which there are plenty) let me know in the comments. Here’s a graphic (code way too long and slow) looking at the homogeneity in the central region of two very optimized coils (full coil on left, then a zoomed in section for the region inside the box, two coils being compared):
O
u
t
[
]
=
Manipulate Code
I
n
[
]
:
=
m
u
0
=
Q
u
a
n
t
i
t
y
[
1
.
2
5
6
*
1
0
^
-
6
,
"
H
e
n
r
i
e
s
"
/
"
M
e
t
e
r
s
"
]
;
I
n
[
]
:
=
W
i
r
e
R
e
s
i
s
t
a
n
c
e
=
M
a
p
[
#
[
[
1
]
]
Q
u
a
n
t
i
t
y
[
#
[
[
2
]
]
,
"
M
i
l
l
i
o
h
m
s
"
/
"
M
e
t
e
r
s
"
]
&
,
{
"
0
0
0
0
"
0
.
1
6
0
8
,
"
0
0
0
"
0
.
2
0
2
8
,
"
0
0
"
0
.
2
5
5
7
,
"
0
"
0
.
3
2
2
4
,
"
4
"
0
.
8
1
5
2
,
"
1
0
"
3
.
2
7
7
,
"
1
2
"
5
.
2
1
1
}
]
/
/
A
s
s
o
c
i
a
t
i
o
n
;
I
n
[
]
:
=
W
i
r
e
T
h
i
c
k
n
e
s
s
=
M
a
p
[
#
[
[
1
]
]
Q
u
a
n
t
i
t
y
[
#
[
[
2
]
]
,
"
I
n
c
h
e
s
"
]
&
,
{
"
0
0
0
0
"
0
.
4
6
,
"
0
0
0
"
0
.
4
0
9
6
,
"
0
0
"
0
.
3
6
4
8
,
"
0
"
0
.
3
2
4
9
,
"
4
"
0
.
2
0
4
3
,
"
1
0
"
0
.
1
0
1
9
,
"
1
2
"
0
.
0
8
0
8
}
]
/
/
A
s
s
o
c
i
a
t
i
o
n
;
I
n
[
]
:
=
W
i
r
e
C
o
s
t
=
M
a
p
[
#
[
[
1
]
]
Q
u
a
n
t
i
t
y
[
#
[
[
2
]
]
,
"
U
S
D
o
l
l
a
r
s
"
/
"
F
e
e
t
"
]
&
,
{
"
0
0
0
0
"
4
.
6
2
,
"
0
0
0
"
2
.
8
7
,
"
0
0
"
2
.
3
0
,
"
0
"
1
.
8
8
,
"
4
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,
2
5
1
2
,
3
9
8
1
,
6
3
1
0
,
9
4
0
3
}
}
,
{
{
s
m
a
l
l
d
,
2
.
2
5
,
"
M
i
m
i
m
u
m
B
o
r
e
R
a
d
i
u
s
:
"
}
,
1
,
2
4
}
,
{
{
w
i
r
e
a
,
5
3
.
5
,
"
W
i
r
e
A
r
e
a
(
m
m
^
2
)
"
}
,
{
1
0
7
"
0
0
0
0
A
W
G
"
,
8
5
"
0
0
0
A
W
G
"
,
6
7
.
4
"
0
0
A
W
G
"
,
5
3
.
5
"
0
A
W
G
"
,
3
3
.
6
"
2
A
W
G
"
,
5
.
2
6
"
1
0
A
W
G
"
,
3
.
3
1
"
1
2
A
W
G
"
,
0
.
0
8
1
0
"
2
8
A
W
G
"
}
}
,
S
a
v
e
D
e
f
i
n
i
t
i
o
n
s
T
r
u
e
]
O
u
t
[
]
=
After playing around with it, you can see one of the big issues is power dissipation. Highly resistive electromagnets will necessarily dissipate a lot of power, whereas using more conductor volume will decrease power dissipation and consumption but greatly increase the cost.
If the major driver of cost is the conductor volume, what about using a different conductor? My first thought was making the electromagnet out of hollow copper pipe and running liquid nitrogen through the coil. When at liquid nitrogen temperatures, copper is about 10x more conductive, and liquid nitrogen is orders of magnitude cheaper than copper...
I happen to have a 50 liter liquid nitrogen dewar, but ultimately I decided against this route; it would be much more convenient to have no consumables. Just flip a switch on, and the electromagnet goes on. The next idea: is copper the most cost-effective conductor of electricity?
M
a
n
i
p
u
l
a
t
e
C
o
d
e
Coil Conductor Optimization
What about using aluminum as the conductor?
I
n
[
]
:
=
(
a
l
u
m
i
n
u
m
e
l
e
c
t
r
i
c
a
l
c
o
n
d
u
c
t
i
v
i
t
y
)
/
(
c
o
p
p
e
r
e
l
e
c
t
r
i
c
a
l
c
o
n
d
u
c
t
i
v
i
t
y
)
a
l
u
m
i
n
u
m
E
L
E
M
E
N
T
e
l
e
c
t
r
i
c
a
l
c
o
n
d
u
c
t
i
v
i
t
y
c
o
p
p
e
r
E
L
E
M
E
N
T
e
l
e
c
t
r
i
c
a
l
c
o
n
d
u
c
t
i
v
i
t
y
O
u
t
[
]
=
0
.
6
Okay, so aluminum has 60% of copper’s electrical conductivity, what about its price? Looking at Home Depot’s website for 0AWG copper vs. aluminum wire, you’ll find that the copper wire is $2.34/ft, and the aluminum wire is $0.75/ft (as of the time of this writing).
I
n
[
]
:
=
2
.
3
4
/
0
.
7
5
O
u
t
[
]
=
3
.
1
2
So aluminum is the clear winner; it’s almost half as conductive but is three times cheaper. A strange quirk of wire manufacture is that some gauges are cheaper. Since the driving factor for cost is conductor volume, what gauge aluminum wire is cheapest per unit conductor volume?
I
n
[
]
:
=
S
o
r
t
B
y
[
{
{
"
4
A
W
G
"
,
U
n
i
t
C
o
n
v
e
r
t
[
Q
u
a
n
t
i
t
y
[
0
.
3
5
,
"
U
S
D
o
l
l
a
r
s
"
/
"
F
e
e
t
"
]
/
Q
u
a
n
t
i
t
y
[
2
1
.
2
,
"
M
i
l
l
i
m
e
t
e
r
s
"
^
2
]
,
"
U
S
D
o
l
l
a
r
s
"
/
(
"
I
n
c
h
e
s
"
^
3
)
]
,
Q
u
a
n
t
i
t
y
[
2
1
.
2
,
"
M
i
l
l
i
m
e
t
e
r
s
"
^
2
]
}
,
{
"
2
A
W
G
"
,
U
n
i
t
C
o
n
v
e
r
t
[
Q
u
a
n
t
i
t
y
[
1
5
5
.
3
8
/
5
0
0
,
"
U
S
D
o
l
l
a
r
s
"
/
"
F
e
e
t
"
]
/
Q
u
a
n
t
i
t
y
[
3
3
.
6
,
"
M
i
l
l
i
m
e
t
e
r
s
"
^
2
]
,
"
U
S
D
o
l
l
a
r
s
"
/
(
"
I
n
c
h
e
s
"
^
3
)
]
,
Q
u
a
n
t
i
t
y
[
3
3
.
6
,
"
M
i
l
l
i
m
e
t
e
r
s
"
^
2
]
}
,
{
"
1
/
0
A
W
G
"
,
U
n
i
t
C
o
n
v
e
r
t
[
Q
u
a
n
t
i
t
y
[
0
.
7
5
,
"
U
S
D
o
l
l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i
t
y
[
1
3
.
3
,
"
M
i
l
l
i
m
e
t
e
r
s
"
^
2
]
}
}
,
#
[
[
2
]
]
&
]
/
/
G
r
i
d
O
u
t
[
]
=
2
A
W
G
$
0
.
4
9
7
2
4
7
p
e
r
3
i
n
c
h
3
3
.
6
2
m
m
4
/
0
A
W
G
$
0
.
6
0
2
9
5
3
p
e
r
3
i
n
c
h
1
0
7
2
m
m
2
/
0
A
W
G
$
0
.
6
1
4
2
1
p
e
r
3
i
n
c
h
6
7
.
4
2
m
m
1
/
0
A
W
G
$
0
.
7
5
3
6
9
2
p
e
r
3
i
n
c
h
5
3
.
5
2
m
m
4
A
W
G
$
0
.
8
8
7
6
0
2
p
e
r
3
i
n
c
h
2
1
.
2
2
m
m
6
A
W
G
$
1
.
1
7
2
2
8
p
e
r
3
i
n
c
h
1
3
.
3
2
m
m
So 2AWG aluminum wire is the cheapest, by a considerable amount (at this time). So that’s what we’ll use for the electromagnet. Here’s the delivered #2AWG aluminum wire:
Modelling Electromagnets in the Wolfram Language
First, let’s define the actual equation for a magnetic field in three dimensions:
I
n
[
]
:
=
M
a
g
n
e
t
i
c
F
i
e
l
d
A
n
a
l
y
t
i
c
=
c
u
r
r
e
n
t
m
u
0
x
2
r
a
d
i
u
s
+
2
x
+
2
y
+
2
z
E
l
l
i
p
t
i
c
E
4
r
a
d
i
u
s
2
x
+
2
y
2
r
a
d
i
u
s
+
2
x
+
2
y
+
2
z
2
r
a
d
i
u
s
+
2
x
+
2
y
+
2
z
1
-
4
r
a
d
i
u
s
2
x
+
2
y
2
r
a
d
i
u
s
+
2
x
+
2
y
+
2
z
-
E
l
l
i
p
t
i
c
K
4
r
a
d
i
u
s
2
x
+
2
y
2
r
a
d
i
u
s
+
2
x
+
2
y
+
2
z
2
r
a
d
i
u
s
+
2
x
+
2
y
+
2
z
2
A
b
s
[
x
]
+
2
A
b
s
[
y
]
,
c
u
r
r
e
n
t
m
u
0
y
2
r
a
d
i
u
s
+
2
x
+
2
y
+
2
z
E
l
l
i
p
t
i
c
E
4
r
a
d
i
u
s
2
x
+
2
y
2
r
a
d
i
u
s
+
2
x
+
2
y
+
2
z
2
r
a
d
i
u
s
+
2
x
+
2
y
+
2
z
1
-
4
r
a
d
i
u
s
2
x
+
2
y
2
r
a
d
i
u
s
+
2
x
+
2
y
+
2
z
-
E
l
l
i
p
t
i
c
K
4
r
a
d
i
u
s
2
x
+
2
y
2
r
a
d
i
u
s
+
2
x
+
2
y
+
2
z
2
r
a
d
i
u
s
+
2
x
+
2
y
+
2
z
2
A
b
s
[
x
]
+
2
A
b
s
[
y
]
,
c
u
r
r
e
n
t
m
u
0
2
r
a
d
i
u
s
-
2
x
-
2
y
-
2
z
E
l
l
i
p
t
i
c
E
4
r
a
d
i
u
s
2
x
+
2
y
2
r
a
d
i
u
s
+
2
x
+
2
y
+
2
z
2
r
a
d
i
u
s
+
2
x
+
2
y
+
2
z
1
-
4
r
a
d
i
u
s
2
x
+
2
y
2
r
a
d
i
u
s
+
2
x
+
2
y
+
2
z
+
E
l
l
i
p
t
i
c
K
4
r
a
d
i
u
s
2
x
+
2
y
2
r
a
d
i
u
s
+
2
x
+
2
y
+
2
z
2
r
a
d
i
u
s
+
2
x
+
2
y
+
2
z
;
I
n
[
]
:
=
V
a
c
u
u
m
P
e
r
m
e
a
b
i
l
i
t
y
U
n
i
t
l
e
s
s
=
V
a
c
u
u
m
P
e
r
m
e
a
b
i
l
i
t
y
/
/
U
n
i
t
l
e
s
s
;
The equations come from “Some Useful Information for the Design of Air-Core Solenoids”, by D. Bruce Montgomery, and here’s an illustration of what the variables refer to:
Here’s a function version:
I
n
[
]
:
=
M
a
g
n
e
t
i
c
F
i
e
l
d
F
r
o
m
C
u
r
r
e
n
t
L
o
o
p
C
a
r
t
e
s
i
a
n
[
c
u
r
r
e
n
t
_
,
r
a
d
i
u
s
_
,
x
_
,
y
_
,
z
_
]
:
=
M
o
d
u
l
e
b
r
h
o
=
U
n
i
t
C
o
n
v
e
r
t
c
u
r
r
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