Abstract

An inductance–resistance $(L- R)$ 2-D axisymmetric circuit model of a tokamak is constrained to fit combinations of diagnostic data. This model is widely used not only to reconstruct magnetohydrodynamics (MHD) equilibrium but also to predict time-dependent vacuum field evolution as part of TRANSP. However, the computational model was procedurally programmed with a commercial software platform which limits the reuse and distribution of this computational model and requires extra expense on the commercial software license. In this article, the original procedural program was ported from its commercial platform to an open-source Python platform and refactored into the object-oriented programming (OOP) style so that computational models could run independently on computers without calling any commercial software libraries. The new classes of the tokamak model contain the most frequently used methods and data structures from equilibrium fitting (EFIT) and LRDFIT. Currently, the model and diagnostic data are derived from national spherical torus experiment (NSTX)-U, however, a customized model could be easily developed for another tokamak. With Numba just-in-time (JIT) compiler, the speed of Python code is accelerated. The original deployment would take ~56 s to converge on a commercial software platform. The open-source Python version would take ~19 s with the same hardware to fit the same set of diagnostic data. Enabled by the OOP design pattern, the numerical algorithm could be further optimized without modification of any other part of code.

Full Text
Published version (Free)

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call