An open-source 3D FE quench simulation tool for no-insulation HTS pancake coils

A new module, Pancake3D, of the open-source finite element quench simulator (FiQuS) has been developed in order to perform transient simulations of no-insulation (NI) high-temperature superconducting pancake coils in three-dimensions. FiQuS/Pancake3D can perform magnetodynamic or coupled magneto-thermal simulations. Thanks to the use of thin shell approximations, an H→−ϕ formulation, and anisotropic homogenization techniques, each turn can be resolved on the mesh level in an efficient and robust manner. FiQuS/Pancake3D relies on pre-formulated finite-element (FE) formulations and numerical approaches that are programmatically adjusted based on a text input file. In this paper, the functionalities and capabilities of FiQuS/Pancake3D are presented. The challenges of FE simulation of NI coils and how FiQuS/Pancake3D addresses them are explained. To highlight the functionalities, the results of a magneto-thermal analysis of a double pancake coil with 40 turns per pancake with local degradation of the critical current density are conducted and discussed. Furthermore, a parameter sweep of the size of this local degradation is presented. All FiQuS input files for reproducing the simulations are provided.


Introduction
Quench detection and protection of high-field, hightemperature superconducting (HTS) magnets are crucial parts of the development of HTS technology.The quench behaviour of HTS magnets differs from lowtemperature superconducting (LTS) magnets.HTS magnets have lower normal zone propagation velocity [1], and the critical current density of an HTS tape strongly depends on the direction of the magnetic field [2].Consequently, quench protection of HTS magnets is regarded as one of the challenging technical issues for HTS technology.
One of the propositions to protect HTS pancake coils is to allow current to divert around the quenched segments of the coil by winding HTS coated conductor (CC) without electrical insulation between the turns, i.e., no-insulation (NI) pancake coils [3].NI pancake coils have attracted considerable research interest, and the design was demonstrated to be stable and effective in a range of high magnetic field applications [4]- [7].However, a few challenges posed by NI pancake coils have also been identified, such as overstrains caused by radial currents during quench [8].Therefore, numerical simulations of the quench behaviour of NI pancake coils are essential.
However, the finite-element (FE) simulation of NI pancake coils is challenging for several reasons: • A quench is intrinsically a local effect, and the detailed study of the magneto-thermal transients requires a three-dimensional (3D) model, where each turn is resolved.• The contact layer between the turns of a pancake coil is much thinner than the total thickness of the HTS CC.Therefore, meshing the contact layer in a classical way leads to either a low-quality mesh or a very fine mesh.• HTS CCs consist of more than one material with highly non-linear properties, and homogenization methods are commonly preferred as the volumetric resolution of all layers is computationally infeasible for 3D simulations.The electrical resistivity of the HTS layer is a function of the current density in the layer.For this reason, homogenization requires an iterative approach to resolve the current sharing between HTS and other layers [9].Furthermore, due to the layered structure of the HTS CC, the homogenization of the electrical resistivity and thermal conductivity should be considered as anisotropic.Finally, accessing material data and integrating it efficiently within the simulation software alongside homogenization techniques can be cumbersome.• Implementing a comprehensive, robust, and efficient FE model of NI pancake coils requires a good understanding of FE formulations and an FE software package.
In this context, we present a new module of the open-source [10] and parametric Finite Element Quench Simulator (FiQuS [11]), which is developed as part of STEAM (Simulation of Transient Effects in Accelerator Magnets [12]) framework at CERN.The new Pancake3D module can generate geometry, generate mesh, solve and postprocess magnetodynamic or coupled magneto-thermal FE simulation of a single or stack of multiple NI pancake coils.
FiQuS is a Python application that utilizes Gmsh [13] for geometry and mesh generation and uses GetDP [14] as the finite-element solver.Our main objective is to provide access to simulations of superconducting magnets to all researchers, regardless of their level of expertise in modelling and simulation.The software design of FiQuS provides a user interface that separates the coil design and the powering details from the numerical computing aspect.This separation allows users to describe and simulate an NI pancake coil setup by simply interacting with a text-based input file without worrying about mathematical formulations.
This paper presents an overview of FiQuS/Pan-cake3D's principles and functionalities, along with examples.
The features and capabilities of the user interface, geometry generator, mesh generator, solver, and postprocessor are reviewed in section 2. The modelling approaches employed, like thin-shell approximations, STEAM material library integration, and homogenization methods, are also presented in section 2.Then, in section 3, results for a magnetothermal analysis of a double pancake coil with a critical current density degradation in a segment of the HTS CC are presented.Also, a parameter sweep of the size of the degradation is performed and presented.Finally, conclusions are drawn in section 4.

Features and Capabilities
This section describes the functionalities and capabilities of FiQuS/Pancake3D, along with implementation details.Section 2.1 presents the user interface and its usage.Section 2.2 then reviews the techniques used to generate geometries efficiently and summarizes implemented features.Section 2.3 demonstrates the capabilities of the mesh generator.Section 2.4 discusses the numerical methods used to conduct simulations and the available solver features.Finally, section 2.5 showcases the postprocessing capabilities.

YAML Input File
The only user interface of FiQuS is a text-based YAML [15] input file.For each simulation, there is one corresponding input file.The text-based input file makes it easy to version-control simulations and aids their reproducibility.The input files for the simulations presented in section 3 are provided [16] so that the same results can be easily reproduced.
The YAML input file is a concise description of the model.It consists of four main parts: geometry, mesh, solve, and postprocess.With this approach, users can concentrate on the coil setup instead of the numerical methods that FiQuS handles in the background.For example, the input to generate a geometry of a double pancake coil with 20 turns per pancake is shown in figure 1.To simplify the usage of the YAML input files, FiQuS provides a standardized schema that specifies and documents the structure of the input format, using JSON Schema [17].Moreover, all the input data is validated initially to minimize the risk of encountering unexpected issues at the later stages.Warnings will be given if wrong or unfeasible inputs are provided, such as a negative inner radius of windings or unrealistic choices for the mesh.

Geometry Generator
FiQuS/Pancake3D is capable of generating fully parametric pancake coil geometries, using Open CASCADE Technology (OCCT) [18] via Gmsh [13].Pancake coils are generated as conformal spiral windings with two terminal blocks that are conformal to the inner and outer surfaces of the windings.An air region conformal to the coil geometry is also generated.Terminal blocks are extended axially to the end of the air region as tubes.A stack of multiple pancake coils can be generated with alternating connections through inner and outer terminal blocks.All the pancake coils in the stack must have the same inner radius, outer radius, and number of turns.Such geometries are generated very efficiently.For example, the geometry of a stack of 10 pancake coils, each with 60 turns, including the air volume that surrounds the coils, can be generated and saved in under 2 minutes using an Intel Core i7-3770 and CPython [19] via Gmsh Python API.The significant performance gain is achieved by avoiding Boolean operations on volumes by creating boundary surfaces and constructing the volumes from closed surface loops.Figure 2 shows a double pancake coil geometry produced from the input in figure 1.
Figure 1 summarizes all available inputs for the geometry generator.The contact layer between the turns can be modelled as either a 2D surface or a 3D volume.Also, an additional and optional air shell volume that surrounds the main air volume can be generated to perform shell transformation to model the infinite space (see section 2.4).

Terminals
Windings Air Gap

Mesh Generator
FiQuS/Pancake3D uses the open-source mesh generator Gmsh to mesh the generated pancake coil geometry.The mesh of each region (windings, terminals, and air) can be controlled separately, thereby providing the flexibility needed to generate the appropriate mesh that is suitable for a given problem.Figure 3 shows an example of a winding mesh generated from the input shown in figure 4. For the windings of the pancake coil, users can select the number of azimuthal elements, axial elements, radial elements per turn, and one of three element types: tetrahedron, hexahedron, or prism.Moreover, the size of mesh elements in the axial direction does not have to be homogeneous and can be controlled with an "axial distribution coefficient" so that finer meshes at the edges can be achieved (see figure 3 for an example).Finally, if the geometry consists of more than one pancake coil, inputs can be independently specified for each winding.For terminal and air regions, both structured and unstructured meshes are supported.When using an unstructured mesh, users can specify maximum and minimum element size to generate finer meshes around the winding and coarser meshes farther away.This capability allows for a more precise analysis near the winding region without the need to uniformly refine the mesh.However, a structured mesh can also be achieved, and the radial element sizes of terminals and air can be specified.Two examples of a complete mesh, one with unstructured air mesh and the other with structured air mesh, are shown in figure 5.

Solver
FiQuS employs GetDP [14] as the finite element solver and uses the STEAM material library [20] for material properties.GetDP is an open-source software environment that allows users to define general FE problems with mathematical expressions.FiQuS/Pancake3D is purpose-built on top of this general framework for quench simulations of NI pancake coils with the following solver features, which will be explained in detail afterwards: • Magnetodynamic or coupled magneto-thermal simulations can be conducted.
• Thin-shell approximations are supported for contact layers.
• A shell transformation can be used to model infinite space with finite elements.
• Temperature-and magnetic field-dependent material properties can be assigned to each region explicitly by specifying the material names or alternatively specifying constant values for electrical resistivity, thermal conductivity, and specific heat capacity.
• The stack of materials of an HTS CC can be specified with a list of material names with their relative thicknesses.Any number of materials can be stacked onto each other.
• Three different cooling conditions can be used.
• Local degradations of critical current (local defects) along the HTS CC can be introduced either by specifying the critical current as a function of the tape length or assigning a custom critical current density value to a specific range of turns.
FiQuS/Pancake3D is capable of conducting both magnetodynamic and coupled magneto-thermal simulations.For magnetodynamics, it uses an ⃗ H − ϕ magnetodynamic formulation with details in [21].This formulation is an efficient and robust choice for systems of HTS without ferromagnetic materials [22].For coupled magneto-thermal simulations, alongside the ⃗ H −ϕ formulation, it solves the heat equation.The ⃗ H −ϕ formulation and the heat equation are coupled by resistive heating acting as a heat source as well as through the temperature-and field-dependent material properties.The mathematical formulation is found in [23].
One of the problems with the FE modelling of NI pancake coils is meshing the thin contact layer.The contact layer's thickness is commonly much smaller compared to the HTS CC's thickness.Therefore, meshing it with 3D elements leads to either an exceedingly high number of degrees of freedom or a low-quality mesh.FiQuS/Pancake3D overcomes this problem by modelling the contact layer with 2D shell elements and enforcing appropriate interface conditions on the two sides of the layer that approximate the 3D layer.This method is called thin-shell approximation, and it has been successfully verified against solutions with 3D contact layers in thermal simulations [24], magnetodynamic simulations [21], and coupled magneto-thermal simulations [23].
An option to approximate an open infinite space using a shell transformation method, provided by GetDP, for the magnetic field [25] is also available.This option allows a smaller air mesh to be used while maintaining sufficient accuracy.
The integration with the STEAM material library makes it possible to assign material properties to each region by specifying material names.Users can also choose to use constant values for material properties.For instance, figure 6 shows an example of a YAML input file's solve section that assigns properties of copper to the terminals and constant properties to the contact layer.Another difficulty of FE simulations of NI pancake coils is that HTS CCs consist of more than one material with nonlinear properties.Their material properties need to be approximated with homogenization since it is not computationally feasible to resolve each layer in a 3D mesh.The homogenization requires an iterative approach to resolve the current sharing between the HTS and other layers due to the E − J power-law modelling of the HTS [9], [23].The homogenization leads to anisotropic properties.Indeed, as explained in [23], the effective electrical resistivity and thermal conductivity are different along the thickness, width and length directions of the CC.The resulting tensorial structure is handled automatically by means of local coordinate transformations.In the input file, the materials of the CC are specified as a list of material names with their relative thicknesses, as shown in figure 7. Additionally, a metallic shunt layer at the narrow side of the CC can be specified in the input, which will be taken into account during the homogenization process as a parallel resistivity in the thickness direction of the CC.Alternatively, constant values can be used for the winding tape's material properties.
Because the materials exhibit nonlinear behaviour, iterative techniques are necessary.FiQuS/Pan-cake3D uses Picard (fixed point) iterations for all material parameters, except for the electrical resistivity of the CC, for which the Newton-Raphson method is used for linearization with respect to the current density,  as proposed in [22] for the ⃗ H − ϕ formulation.Several convergence criteria for the nonlinear solver can be specified in the input file.The convergence criteria can be based on physical quantities or on the vector of degrees of freedom.
For cooling conditions, three options are offered: adiabatic, a cryocooler boundary condition imposed on top and bottom terminal surfaces, and fixed terminal surface temperatures.The adiabatic option prevents any thermal exchange through terminal surfaces so that all generated heat is deposited in the solids of the model.The cryocooler boundary condition uses functions from the STEAM material library specifying the cooling power as a function of temperature based on the load map provided by manufacturers.Finally, the top and bottom terminal surface temperatures can be fixed.
FiQuS/Pancake3D has a feature that allows quench initiation with local defects along the HTS CC.Different material properties can be assigned to different segments of the HTS CC.To introduce local defects, users can specify the critical current as a function of tape length, or they can assign a custom critical current density to a specific segment specified with turn numbers (for example, from turn 10.2 to 11.6).
FiQuS/Pancake3D simulates a transient phenomenon.For time discretization and integration, users can choose either adaptive or fixed time stepping.Adaptive time stepping provides an efficient discretization of time, where small time steps are used only when necessary.The time step size varies according to the criteria given in the input file.Similar to the nonlinear solver's convergence criteria, multiple criteria can be specified based on physical quantities or on the vector of degrees of freedom.Users can also choose a fixed time stepping for the uniform discretization of time.For adaptive time stepping, the backward differentia-tion formula (BDF) of order 1 to 6 can be used for integration.For fixed time stepping, BDF of order 1 (i.e., the implicit Euler method) is used.
The above solver features are abstracted away from the user by using Jinja [26] templating engine to create the input files for GetDP.GetDP does not have an application programming interface (API), and it requires a text-based input file that defines the whole FE problem in a special format (i.e., the .profile).FiQuS/Pancake3D automatically generates GetDP input files with Jinja for every simulation.

Postprocessor
FiQuS/Pancake3D saves all the outputs in text-based files after each simulation and provides a postprocessor that can transform the numerical data into figures.It has two main postprocessing features: time-series plots and a magnetic field on a cutting plane.Additionally, Gmsh's graphical user interface can be used to visualize the vector and scalar fields, along with Gmsh's postprocessing capabilities.
The postprocessor can plot any physical quantity, such as temperature, current density, resistivity, magnetic field, etc., at any model coordinate with respect to time.The probing point's coordinates can be specified either with XYZ coordinates or a turn number (possibly non-integer) with a pancake coil index.For example, figure 8 shows an example input to plot the magnitude of the current density at the location corresponding to turn 10.3 of the first pancake coil with respect to time, and figure 9 shows the result.The postprocessor can also present the magnetic field on a cutting plane as a 2D map with streamlines.Users can select any arbitrary cutting plane that passes through the origin by specifying the normal of the plane in the model's coordinate system, where the z-axis is oriented along the axial direction of the pancake coils.The magnitudes of the magnetic field are interpolated to obtain a smooth 2D map. Figure 10 shows an example 2D magnetic field map obtained from a simulation with structured air mesh.
Finally, because GetDP can save the physical quantities in Gmsh format, Gmsh's graphical user interface and its postprocessing capabilities can be used to visualize the results.A clipped view of the  magnetic field of a quadruple pancake coil is shown in figure 11, which is visualized by Gmsh.

Results
This section presents a coupled magneto-thermal analysis of a double NI pancake coil with local degradation of the critical current density (local defect).Also, a parameter study is performed in section 3.1 where the simulation is repeated with ten different local defect lengths along the HTS CC of the spiral winding to understand the magneto-thermal characteristics of the model further.The results can be reproduced with FiQuS 2023.11.3, CERNGetDP 2023.11.0, and the provided input files [16].
All parameters regarding the geometry, material properties, and simulation setup are given in table 1.All the material properties mentioned in the table and the critical current scaling function of ReBCO (HTS SuperPower ), I c ( ⃗ B, T ), are taken from the STEAM material library [20].The pancake coils are excited in current-driven mode.Firstly, the current is ramped from 0 A to 130 A in 50 s, followed by a plateau for 10 s, as shown in figure 12.Then, a local defect, where the critical current density is set to 0 A/m 2 from turn 10.0 to 10.4 of the first pancake coil, is introduced at 60 s.The local defect is depicted in figure 13. 0.03 s after the local defect, the current is ramped down from 130 A to 0 A in 30 s.The simulation is performed until 100 s.The thin-shell approximation is used for the contact layer.For cooling conditions, the temperatures of the top and bottom surfaces of the terminals are fixed to 4 K.  Figure 12 shows both the axial component of the central magnetic field B z and the source current I versus time.The magnetic field is delayed compared to the source current due to the coils' inductance and radial currents.Moreover, although the source current decays to 0 at 80 s, B z still remains nonzero due to screening current-induced field [27].The current distribution at 80 s is shown in figure 14, where screening currents are visible.
Figure 15 shows the temperature over time at the first pancake coil's turn 10.2, the centre of the local defect.During the coil ramp-up, temperature increases slightly due to resistive heating generated by radial currents [28].As the top and bottom surfaces of the terminals are kept at a fixed temperature with unlimited cooling power, this temperature increase is relatively small.Then, the temperature increases sharply at 60 s due to the sudden transition of turn 10.0 to 10.4 of the first pancake coil into a normal state at 60 s.The transition results in an increase in azimuthal resistivity locally, which causes a current redistribution and resistive heat generation.The generated heat is caused by high local azimuthal resistivity and contact layer resistivity since radial currents emerged.
The temperature distribution at 60.03 s is shown in figure 16, where the local hot spot around the local defect can be seen.Finally, the coil cools down slowly during ramping-down because of the cooling condition, the decreasing source current, and the stabilization of the current distribution.Figure 17 shows the voltage difference between the terminals induced by the ramp-up, local defect, and ramp-down.First, the voltage increases sharply during ramp-up due to the coil's characteristic response.After the coil stabilizes its response to ramping up, the voltage continues to increase linearly due to the terminal resistance.When ramping-up is complete, the voltage becomes constant after the coil's transient response ends.The non-zero voltage difference comes from the copper terminals, as the coil is still fully superconducting.Then, at 60 s, the voltage increases suddenly due to the increased azimuthal resistivity in the local defect and the radial currents caused by it.Finally, a negative voltage is seen while ramping down.A higher voltage difference occurs during ramping down than ramping up because the ramp-down is faster, as shown in figure 12.

Parametric Study of Local Defect Length
Because FiQuS is a part of the STEAM framework, parameter sweeps can be performed with the Analy-sisSTEAM module of STEAM-SDK [29].Also, users can write their own Python script to sweep the parameters since FiQuS is distributed as a Python package [30].With this capability, a parameter sweep study is conducted to further understand the effect of the local defect length along HTS CC on the results.Ten different lengths are considered.All these local defects start at turn 10 of the first pancake coil and end at 10.1, 10.2, ..., and 11.0.The voltage difference between the terminals and the temperature at the middle of the local defects are plotted over time in figure 18 and figure 19, respectively.As expected, higher temperature and voltage increases are observed as the local defect length increases.At 80 s, the voltage differences between the terminals converge to the same value as they are caused by the coil's characteristic response to the rampingdown, and the local defect has a minimal effect on it.Finally, with FiQuS/Pancake3D's parametric capabilities, a parameter sweep study is conducted where the same simulation is repeated with different local defect lengths.
FiQuS is an ongoing collaborative project that is actively developed at CERN.Ongoing work focuses on incorporating enhancements and supporting new types of magnets and conductors.

Figure 1 .
Figure 1.An example geometry section of a YAML input file that generates a geometry of a double pancake coil with 20 turns per pancake as shown in figure 2.

Figure 2 .
Figure 2. Clipped view of a double pancake coil geometry generated from the input shown in figure 1.

Figure 3 .
Figure 3.A pancake coil winding mesh with hexahedral elements and a 2D contact layer between the turns from the input shown in figure 4.

Figure 4 .
Figure 4.An example mesh section of a YAML input file that generates a winding mesh as shown in figure 3.
(a) With unstructured air and terminal mesh.(b) With structured air and terminal mesh.

Figure 5 .
Figure 5. Two examples of a complete pancake coils mesh, including air and terminals.

Figure 6 .
Figure 6.An example solve section of a YAML input file that assigns material properties of the pancake coil's terminals and the contact layer.

Figure 7 .
Figure 7.An example solve section of a YAML input file that assigns material properties of a pancake coil's HTS CC.

Figure 8 .
Figure 8.An example postprocess section of a YAML input file that generates a time-series plot of the magnitude of the current density at turn 10.3 of the first pancake coil.

Figure 9 .
Figure 9.An example time-series plot of the magnitude of the current density at turn 10.3 of the first pancake coil generated by the postprocessor from the input shown in figure 8.

Figure 10 .
Figure 10.Magnetic field presentation on an XZ-plane generated by the postprocessor with the results obtained from a simulation with structured air mesh.

Figure 11 .
Figure 11.A clipped view of the magnetic field generated by a quadruple pancake coil with 60 turns per pancake, visualized in Gmsh's graphical user interface.Only the mesh of the windings is shown for clarity.

Table 1 .Figure 12 .
Figure 12.The current I provided by the power supply, along with the axial magnetic field at the centre Bz generated by the pancake coils.

Figure 13 .
Figure 13.Clipped view of the double pancake coil windings' mesh with the local defect from turn 10.0 to 10.4 of the first pancake coil where the critical current density is set to 0 A/m 2 at 60 s.

• 10 8 Current Density A/m 2 Figure 14 .
Figure 14.Clipped view of the current distribution in the coils at 80 s.

Figure 15 .
Figure 15.Temperature at first pancake coil's turn 10.2 (the centre of the local defect).

Figure 16 .
Figure 16.Clipped view of the temperature distribution in the coils at 60.03 s.

Figure 17 .
Figure 17.Voltage difference between the terminals.

Figure 18 .Figure 19 .
Figure 18.Voltage difference between the terminals obtained for different local defect lengths l in turn numbers.
In this paper, the new Pancake3D module of the open-source and parametric FE quench simulation tool FiQuS has been presented.FiQuS/Pancake3D is a Python tool that conducts 3D FE quench simulations of NI pancake coils.FiQuS uses a text-based YAML input file that fully specifies the model.The structure of the input file is designed to make it easy and intuitive to use, regardless of the users' level of expertise in modelling and simulation.FiQuS/Pancake3D is capable of generating geometry, generating mesh, solving, and postprocessing an FE-based coupled magneto-thermal or magnetodynamic simulation of the transient behaviour of NI pancake coils.FiQuS/Pancake3D addresses common challenges of FE simulation of NI coils.The functionalities and capabilities of FiQuS/Pancake3D's geometry generator, mesh generator, solver, and postprocessor have been explained, along with examples and technical strategies to develop these modules.As a showcase of these capabilities, the results of a transient magneto-thermal simulation of a double pancake coil with 40 turns are presented.