<jupyter_start><jupyter_text>Introduction to Coil Sets, Devices, and Fields The purpose of this tutorial is to develop familiarity with the fundamental objects we will need to create, manipulate, and analyze magnetic configurations. The four objectives of this tutorial are enumerated below:1. Create coil sets and transform them through translations and rotations.2. Create suitable meshes and use them to create Green's functions for flux and magnetic field components3. Learn how to combine sets of coils into a Device object3. Understand and plot the results of goals 1, 2, and 3 Just like any other python notebook we start with importing standard libraries as well as our project's specific functionality<jupyter_code>import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt

from pleiades import RectangularCoil<jupyter_output><empty_output><jupyter_text>Now we will create an instance of the `RectangularCoil` class as it is by far the most common coil set used for building electromagnets for plasma physics or fusion experiments. We create a `RectangularCoil` by specifying at a minimum the centroid `(r0, z0)` of the regular array of current filaments in cylindrical coordinates and with SI units.<jupyter_code>rc1 = RectangularCoil(1, .5, nr=10, nz=10, dr=.01, dz=.01)
print(rc1)<jupyter_output>CurrentFilamentSet
          Class:  <class 'pleiades.current_sets.RectangularCoil'>
        Current:  1.000000e+00 amps
    N Filaments:  100
  Total Current:  1.000000e+02 amps
        R, Z, W:  [9.550000e-01, 4.550000e-01, 1.000000e+00]
                  [9.550000e-01, 4.650000e-01, 1.000000e+00]
                  [9.550000e-01, 4.750000e-01, 1.000000e+00]
                  [9.550000e-01, 4.850000e-01, 1.000000e+00]
                  [9.550000e-01, 4.950000e-01, 1.000000e+00]
                  [9.550000e-01, 5.050000e-01, 1.000000e+00]
                  [9.550000e-01, 5.150000e-01, 1.000000e+00]
                  [9.550000e-01, 5.250000e-01, 1.000000e+00]
                  [9.550000e-01, 5.350000e-01, 1.000000e+00]
                  [9.550000e-01, 5.450000e-01, 1.000000e+00]
                  [9.650000e-01, 4.550000e-01, 1.000000e+00]
                  [9.650000e-01, 4.650000e-01, 1.000000e+00]
                  [9.650000e-01, 4.750000e-01, 1.000000e+00]
                  [9.650000e[...]<jupyter_text>We can learn the basic properties of a coil set just by printing it, but to see what other attributes it has let's print some of those as well.<jupyter_code>print(f'Centroid: {rc1.centroid}, Units: m')
print(f'Cross-sectional area: {rc1.area}, Units: m$^2$')
print(f'Current per filament: {rc1.current}, Units: A')
print(f'Total current: {rc1.total_current}, Units: A')
print(f'Current density: {rc1.current_density}, Units: A/m$^2$')<jupyter_output>Centroid: [1.  0.5], Units: m
Cross-sectional area: 0.01, Units: m$^2$
Current per filament: 1.0, Units: A
Total current: 100.0, Units: A
Current density: 10000.0, Units: A/m$^2$<jupyter_text>Now we will try our hand at plotting some of this data as well as the visulaizations. to access the fields like psi, B_R, and B_Z we simply call their attributes from the brb object as shown below.<jupyter_code>from pleiades import RectMesh

mesh = RectMesh(rmin=0, rmax=3, zmin=0, zmax=3)
rc1.mesh = mesh
rc1.psi()
fig, ax = plt.subplots()
rc1.plot(ax, color='k')
ax.contour(mesh.R, mesh.Z, rc1.psi().reshape(mesh.R.shape), 51)
ax.set_xlim(0, 3)
ax.set_ylim(0, 3)
ax.set_aspect(1)
ax.set_xlabel('R (m)')
ax.set_ylabel('Z (m)')
plt.show()
fig, ax = plt.subplots()
rc1.plot(ax, color='k')
ax.contour(mesh.R, mesh.Z, rc1.psi().reshape(mesh.R.shape), 11)
ax.set_xlim(.9, 1.1)
ax.set_ylim(.4, .6)
ax.set_aspect(1)
ax.set_xlabel('R (m)')
ax.set_ylabel('Z (m)')
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12027491408934708, 'fraction_numerical': 0.11948189267776897, 'mean_word_length': 3.6090133982947625, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '331617', 'license': 'MIT', 'n_tokens_mistral': 1676, 'n_tokens_neox': 1341, 'n_words': 403, 'path': 'examples/jupyter/intro_to_coil_sets.ipynb', 'repo_name': 'jcwright77/pleiades', 'size': '3783'}