![]() |
The Open FUSION Toolkit 26.9
An open-source framework for fusion and plasma science and engineering
|
In this example we demonstrate:
This example utilizes the mesh built in TokaMaker Meshing Example: Building an LDX-like mesh.
To load the TokaMaker python module we need to tell python where to the module is located. This can be done either through the PYTHONPATH environment variable or using within a script using sys.path.append() as below, where we look for the environement variable OFT_ROOTPATH to provide the path to where the OpenFUSIONToolkit is installed (/Applications/OFT on macOS).
We now create a OFT_env instance for execution using two threads and a TokaMaker instance to use for equilibrium calculations. Note at present only a single TokaMaker instance can be used per python kernel, so this command should only be called once in a given Jupyter notebook or python script. In the future this restriction may be relaxed.
#----------------------------------------------
____ ____________
/ __ \/ ____/_ __/
/ / / / /_ / /
/ /_/ / __/ / /
\____/_/ /_/
Base release: v1.0.0-beta7
Development branch: release_26_06
Revision id: 978c4b9f
Parallelization Info:
Not compiled with MPI
# of OpenMP threads = 2
Linear Algebra backend: native
#----------------------------------------------
Now we load the mesh generated in TokaMaker Meshing Example: Building an LDX-like mesh using load_gs_mesh() and setup_mesh. Then we use setup_regions(), passing the conductor and coil dictionaries for the mesh, to define the different region types. Finally, we call setup() to setup the required solver objects. During this call we can specify the desired element order (min=2, max=4).
**** Loading OFT surface mesh
**** Generating surface grid level 1
Generating boundary domain linkage
Mesh statistics:
Area = 1.411E+01
# of points = 8546
# of edges = 25457
# of cells = 16912
# of boundary points = 178
# of boundary edges = 178
# of boundary cells = 178
Resolution statistics:
hmin = 1.253E-02
hrms = 4.646E-02
hmax = 1.801E-01
Surface grounded at vertex 181
**** Creating Lagrange FE space
Order = 2
Minlev = -1
Computing flux BC matrix
WARNING: TokaMaker's dipole functionality is experimental, use with caution and report bugs
Inverting real matrix
Time = 2.3140000000000001E-003
As the name suggests, a levitated dipole is supported by the magnetic interaction of the floating coil (dipole) and an external levitation coil, which is located above the dipole in most machines due to stability considerations. Therefore the current in each coils needs to be consistent with the required force to support the dipole.
To compute this force, we first compute the vacuum field associated with the levitation coil for unit current (1 Amp).
1 1.8648E-04
Now we compute the magnetic field from the levitation coil within the dipole using get_field_eval() and then integrate to compute the force using area_integral(). Note that the current density in "normal" coils in TokaMaker is uniform so the poloidal integrand is simply \(- 2 \pi r \frac{N_{turns}}{A_C} B_r \), \(N_{turns}\) and \(A_C\) are the number of turns and area of the coil.
For this case our floating coil is composed of only a single contiguous region. However, we still use loops over sub-coils to demonstrate how to perform these calculations in a general way where more than one sub-coil may be used.
Force on Fcoil due to Lcoil coil [N/A^2]: 2.9065E-02
As the coil is not rigidly supported it can also be susceptible to a vertical instability where the coil itself moves upward or downward. To compute the growth rate for this instability we need to look at the variation of the force under displacement of the Fcoil in z. This can be done using a similar process as the force, but replacing the magnetic field with its gradient \(\frac{\partial B_r}{\partial z}\).
In this case the value should positive, which indicates an unstable system as expected.
dF/dz due to motion of Fcoil (positive is unstable) = 6.1903E-02
After computing the required values for force balance we can now compute an equilibrium for our device. The first consideration is force balance on the coil, which is dependent on the current in both the Fcoil and the Lcoil. For this equilibrium we set the Fcoil (dipole) to it's maximum nominal current as used in LDX, which is 1.5 MA, and use the corresponding mass of the LDX levitated structure, which was 560 kg.
1 5.7878E+01
Levitated dipoles usually have a pressure profile that maintains a constant \(PV^{\gamma}\) across flux surfaces. A simple approximation to this as used by M. Davis et al., Plasma Phys. Control. Fusion is a three-region piecewise function. Here we construct a simple approximation to this profile using a cubic spline.
Now we solve for the resulting equilibrium, by first initializing a vacuum state (very low current) and then solving with a given target current.
Starting non-linear GS solver
1 0.0000E+00 -2.7637E-02 1.9359E-04 2.2301E-01 -1.2679E-02 0.0000E+00
2 0.0000E+00 -2.8462E-02 1.0047E-04 2.2301E-01 -1.2679E-02 0.0000E+00
3 0.0000E+00 -2.8913E-02 5.3825E-05 2.2301E-01 -1.2679E-02 0.0000E+00
4 0.0000E+00 -2.9177E-02 3.0671E-05 2.2301E-01 -1.2679E-02 0.0000E+00
5 0.0000E+00 -2.9338E-02 1.8216E-05 2.2301E-01 -1.2679E-02 0.0000E+00
6 0.0000E+00 -2.9439E-02 1.1105E-05 2.2301E-01 -1.2679E-02 0.0000E+00
7 0.0000E+00 -2.9502E-02 6.8674E-06 2.2301E-01 -1.2679E-02 0.0000E+00
8 0.0000E+00 -2.9542E-02 4.2969E-06 2.2301E-01 -1.2679E-02 0.0000E+00
9 0.0000E+00 -2.9568E-02 2.7087E-06 2.2301E-01 -1.2679E-02 0.0000E+00
10 0.0000E+00 -2.9584E-02 1.7189E-06 2.2301E-01 -1.2679E-02 0.0000E+00
11 0.0000E+00 -2.9594E-02 1.0984E-06 2.2301E-01 -1.2679E-02 0.0000E+00
12 0.0000E+00 -2.9601E-02 6.9331E-07 2.2301E-01 -1.2679E-02 0.0000E+00
Timing: 0.15508700005011633
Source: 0.10278800001833588
Solve: 3.6939000012353063E-002
Boundary: 3.1019999878481030E-003
Other: 1.2258000031579286E-002
Since most of the current generating the poloidal field is in the dipole, not the plasma itself we use beta_Ip to override the current in calculations of \(\beta\).
We also compare the flux surfaces in vacuum (red) and with plasma pressure/current (black).
Equilibrium Statistics: Topology = Limited Toroidal Current [A] = 2.5262E+05 Current Centroid [m] = 1.245 0.070 Inner limiter [m] = 0.223 -0.013 Elongation = 0.807 (U: 0.966, L: 0.649) Triangularity = -0.064 (U: -0.117, L: -0.011) Plasma Volume [m^3] = 25.717 Peak Pressure [Pa] = 1.0019E+03 Stored Energy [J] = 2.2017E+03 <Beta_pol> [%] = 5.7826 Diamagnetic flux [Wb] = 0.0000E+00 Toroidal flux [Wb] = 0.0000E+00 l_i = 11.2782
We can also plot the toroidal current distribution within the plasma using get_jtor_plasma().
Starting CG solver
0 0.000000E+00 0.000000E+00 5.706456E-04
1 -1.048446E-03 3.837732E+00 6.755816E-05 1.760367E-05
2 -1.114427E-03 4.596879E+00 2.814409E-05 6.122433E-06
3 -1.118184E-03 4.685015E+00 6.292993E-06 1.343217E-06
4 -1.118471E-03 4.692621E+00 2.139720E-06 4.559754E-07
5 -1.118500E-03 4.692803E+00 7.352839E-07 1.566833E-07
6 -1.118504E-03 4.692812E+00 2.935242E-07 6.254763E-08
7 -1.118505E-03 4.692743E+00 1.288298E-07 2.745298E-08
8 -1.118505E-03 4.692744E+00 4.798269E-08 1.022487E-08
9 -1.118505E-03 4.692740E+00 1.813051E-08 3.863522E-09
10 -1.118505E-03 4.692742E+00 6.322240E-09 1.347238E-09
Now we compute the equilibrium again, this time using a more realistic anisotropic pressure formulation following M. Davis et al. \(\) P_{\perp} = (1-2*a) P_{\parallel} = G(\psi) H(B), \(\) where \(G(\psi)\) is the usual isotropic "gas dynamic" pressure, which is a flux surface quantity, and \(H(B) = \frac{B_0(\psi)}{B}\) is captures the anisotropic variation due to mirroring in the dipole field. This model can be used by setting the anisotropy factor \(a\) to a non-zero value using set_dipole_a().
Starting non-linear GS solver
1 0.0000E+00 -2.9605E-02 1.6817E-04 2.2301E-01 -1.2679E-02 0.0000E+00
2 0.0000E+00 -2.9201E-02 1.1135E-04 2.2301E-01 -1.2679E-02 0.0000E+00
3 0.0000E+00 -2.9438E-02 1.0248E-04 2.2301E-01 -1.2679E-02 0.0000E+00
4 0.0000E+00 -2.9276E-02 5.1114E-05 2.2301E-01 -1.2679E-02 0.0000E+00
5 0.0000E+00 -2.9321E-02 1.7813E-05 2.2301E-01 -1.2679E-02 0.0000E+00
6 0.0000E+00 -2.9317E-02 1.5611E-05 2.2301E-01 -1.2679E-02 0.0000E+00
7 0.0000E+00 -2.9315E-02 9.7946E-06 2.2301E-01 -1.2679E-02 0.0000E+00
8 0.0000E+00 -2.9309E-02 8.6513E-06 2.2301E-01 -1.2679E-02 0.0000E+00
9 0.0000E+00 -2.9313E-02 4.4368E-06 2.2301E-01 -1.2679E-02 0.0000E+00
10 0.0000E+00 -2.9313E-02 3.7353E-06 2.2301E-01 -1.2679E-02 0.0000E+00
11 0.0000E+00 -2.9313E-02 2.2876E-06 2.2301E-01 -1.2679E-02 0.0000E+00
12 0.0000E+00 -2.9312E-02 1.9526E-06 2.2301E-01 -1.2679E-02 0.0000E+00
13 0.0000E+00 -2.9311E-02 1.5383E-06 2.2301E-01 -1.2679E-02 0.0000E+00
14 0.0000E+00 -2.9313E-02 1.4895E-06 2.2301E-01 -1.2679E-02 0.0000E+00
15 0.0000E+00 -2.9313E-02 1.0375E-06 2.2301E-01 -1.2679E-02 0.0000E+00
16 0.0000E+00 -2.9311E-02 1.4221E-06 2.2301E-01 -1.2679E-02 0.0000E+00
17 0.0000E+00 -2.9314E-02 1.1793E-06 2.2301E-01 -1.2679E-02 0.0000E+00
18 0.0000E+00 -2.9311E-02 7.3406E-07 2.2301E-01 -1.2679E-02 0.0000E+00
Timing: 6.1731999999610707
Source: 3.9438179999706335
Solve: 5.4368999903090298E-002
Boundary: 4.4900001958012581E-003
Other: 2.1705229998915456
Comparing the flux surfaces in vacuum (red) and with isotropic pressure (blue) with the anisotropic solution (black) we see only a minor shift in the surfaces due to pressure anisotropy for the parameters used here.
Equilibrium Statistics: Topology = Limited Toroidal Current [A] = 2.5262E+05 Current Centroid [m] = 1.249 0.075 Inner limiter [m] = 0.223 -0.013 Elongation = 0.797 (U: 0.959, L: 0.636) Triangularity = -0.048 (U: -0.112, L: 0.017) Plasma Volume [m^3] = 25.711 Peak Pressure [Pa] = 1.0020E+03 Stored Energy [J] = 2.1134E+03 <Beta_pol> [%] = 5.5589 Diamagnetic flux [Wb] = 0.0000E+00 Toroidal flux [Wb] = 0.0000E+00 l_i = 11.3725
In the dipole, pressure anisotropy has the effect of peaking the toroidal current distribution within the plasma as shown below.
Starting CG solver
0 0.000000E+00 0.000000E+00 4.626497E-04
1 -6.281360E-04 2.910124E+00 5.104709E-05 1.754121E-05
2 -6.690509E-04 3.556311E+00 1.009916E-05 2.839786E-06
3 -6.694549E-04 3.567373E+00 2.158579E-06 6.050891E-07
4 -6.694913E-04 3.568736E+00 7.826563E-07 2.193091E-07
5 -6.694953E-04 3.568548E+00 2.545432E-07 7.132964E-08
6 -6.694958E-04 3.568506E+00 8.838998E-08 2.476946E-08
7 -6.694958E-04 3.568498E+00 3.942168E-08 1.104713E-08
8 -6.694958E-04 3.568510E+00 1.480070E-08 4.147586E-09
9 -6.694958E-04 3.568513E+00 5.565884E-09 1.559721E-09
10 -6.694958E-04 3.568514E+00 1.918989E-09 5.377557E-10
Now we compute the growth rate of the vertical instability for the floation coil (dipole).
First, we compute the eddy currents generated by movement of the coil, which will produce a restoring force and decrease the growth rate compared to a case with no VV. To do this we have to compute the flux change in the VV due to movement of the Fcoil, which can be done similar to above for the change in force on the Fcoil by evaluating \(d\psi/dz\) within the VV due for field generated by the Fcoil.
1 5.1467E+01
Now we can compute the growth rate using a fixed-point iteration. We begin with the vacuum growth rate \(\gamma = dF/dz I_{Fcoil}/m_{Fcoil}\), then at each iteration we compute the eddy currents for the current growth rate and the recompute the growth rate as \(\gamma = dF_{Fcoil,Lcoil}/dz I_{Fcoil}/m_{Fcoil} + dF_{Fcoil,VV}/dz*I_{Fcoil}/m_{Fcoil}\). A fairly large under-relaxation factor is used to ensure convergence.
0 2.0893E+01 1 2.0342E+01 2 1.9357E+01 3 1.8485E+01 4 1.7868E+01 5 1.7475E+01 6 1.7239E+01 7 1.7102E+01 8 1.7023E+01 9 1.6978E+01 10 1.6953E+01 11 1.6939E+01 12 1.6931E+01 13 1.6927E+01 14 1.6924E+01 15 1.6923E+01 16 1.6922E+01 17 1.6921E+01 18 1.6921E+01 19 1.6921E+01 Vertical growth rate = 1.69211E+01 [1/s]
Starting CG solver
0 0.000000E+00 0.000000E+00 2.778463E-03
1 -2.090010E-02 2.323090E+01 1.342922E-03 5.780758E-05
2 -2.561853E-02 2.851730E+01 6.223176E-04 2.182246E-05
3 -2.639301E-02 2.992876E+01 2.449039E-04 8.182896E-06
4 -2.650215E-02 3.018588E+01 1.015446E-04 3.363977E-06
5 -2.652040E-02 3.015018E+01 3.966899E-05 1.315713E-06
6 -2.652267E-02 3.011409E+01 1.632989E-05 5.422673E-07
7 -2.652305E-02 3.009945E+01 6.825510E-06 2.267653E-07
8 -2.652311E-02 3.009743E+01 2.946035E-06 9.788330E-08
9 -2.652312E-02 3.009760E+01 1.090535E-06 3.623329E-08
10 -2.652312E-02 3.009778E+01 4.057441E-07 1.348087E-08
20 -2.652312E-02 3.009803E+01 3.306643E-11 1.098624E-12