Last active
March 4, 2022 15:42
-
-
Save tedyapo/68c07875c2b0d66544ad4c5e00ecb7c2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# | |
# excitation coil model | |
# | |
import loopfield as lf | |
# field object | |
field = lf.Field(length_units = lf.mm, | |
current_units = lf.A, | |
field_units = lf.uT) | |
L = 60 | |
d = 1.1 | |
D = 100 | |
layers = 5 | |
turns_per_layer = int(L/d+0.5) | |
current = 1 | |
for layer_idx in range(0, layers): | |
radius = int(layer_idx - layers/2 + 0.5) * d + D/2 | |
for loop_idx in range(0, turns_per_layer): | |
x = int(loop_idx - turns_per_layer/2 + 0.5) * d | |
loop = lf.Loop(position=[x, 0, 0], | |
normal=[1, 0, 0], | |
radius=radius, | |
current=current) | |
field.addLoop(loop) | |
# evaluate field at center of coil | |
Bc = field.evaluate([0., 0., 0.]) | |
print('Bc = ', Bc, '(uT)') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment