pytdgl logo

pyTDGL solves a generalized time-depdendent Ginzburg-Landau (TDGL) equation for two-dimensional superconducting device with arbitrary geometry. At a high level, the TDGL model can be understood as a set of coupled partial differential equations (PDEs) describing the evolution of a complex field \(\psi(\mathbf{r}, t)\) (the superconducting order parameter) and \(\mu(\mathbf{r}, t)\) (the electric potential) in space and time.

The inputs to the model are:

  1. Properties of the superconducting thin film: thickness \(d\), Ginzburg-Landau coherence length \(\xi\), and London penetration depth \(\lambda\) (see tdgl.Layer).

  2. The geometry of the device residing in the film, which can include holes (see tdgl.Polygon).

  3. A time-independent applied magnetic vector potential \(\mathbf{A}_\mathrm{applied}(\mathbf{r})\).

  4. A set of applied bias currents which are sourced or sunk via a set of current terminals.

The outputs of the model are:

  1. The complex order parameter \(\psi(\mathbf{r}, t)=|\psi|e^{i\theta}\), where \(|\psi|^2=n_s\) is the normalized superfluid density.

  2. The electric scalar potential \(\mu(\mathbf{r}, t)\), which arises from motion of vortices in the film.

  3. The sheet current density in the device, \(\mathbf{K}(\mathbf{r}, t)=\mathbf{K}_s(\mathbf{r}, t)+\mathbf{K}_n(\mathbf{r}, t)\), which is the sum of the sheet supercurrent density \(\mathbf{K}_s\) and the sheet normal current density \(\mathbf{K}_n\).

While the TDGL calculation is performed in dimensionless units, the inputs and outputs are specified in experimentalist-friendly physics units. The translation between the two is handled by the tdgl.Device class.

# Automatically install tdgl from GitHub only if running in Google Colab
if "google.colab" in str(get_ipython()):
    %pip install --quiet git+https://github.com/loganbvh/py-tdgl.git
    !apt install ffmpeg
%config InlineBackend.figure_formats = {"retina", "png"}

import os
import tempfile

os.environ["OPENBLAS_NUM_THREADS"] = "1"

from IPython.display import HTML, display
import h5py
import matplotlib.pyplot as plt
import numpy as np

plt.rcParams["figure.figsize"] = (5, 4)

import tdgl
from tdgl.geometry import box, circle
from tdgl.visualization.animate import create_animation

Optionally, generate and display animations of the simulated dynamics.


We will save the data to a temporary directory that will be removed at the end of the notebook.

tempdir = tempfile.TemporaryDirectory()

Below we can create animations of the time-dependent simulation results. This is a helper function that animates a tdgl.Solution object so that it can be embedded in a notebook.

def make_video_from_solution(
    quantities=("order_parameter", "phase"),
    figsize=(5, 4),
    """Generates an HTML5 video from a tdgl.Solution."""
    with tdgl.non_gui_backend():
        with h5py.File(solution.path, "r") as h5file:
            anim = create_animation(
            video = anim.to_html5_video()
        return HTML(video)