.. THIS FILE WAS AUTOGENERATED BY GENERATE_TUTORIALS.PY. ANY CHANGES WILL BE OVERWRITTEN. .. _tdgl_fem: TDGL and FEM analysis ===================== In this set of tutorials, we will cover conversion of ``qnngds.Device`` to ``tdgl.Device`` and ``skfem.mesh.MeshTri1`` for analysis of device properties. First, we will show how to generate a ``tdgl.Device`` .. code-block:: python :linenos: import qnngds as qg from qnngds.analysis.tdgl import make_tdgl_device import matplotlib.pyplot as plt snspd = qg.devices.snspd.basic() device = make_tdgl_device( device=snspd, coherence_length=0.005, london_lambda=0.35, thickness=0.01, gamma=23.8, layer=(1, 0), ) fig, ax = device.draw() plt.show() .. image:: tdgl_femtdgldraw.png We can use this object to do tdgl simulations, check out [the docs](https://py-tdgl.readthedocs.io/en/latest/) for more info. Now, let's analyze the structure with femwell/skfem to visualize the current density. .. code-block:: python :linenos: from qnngds.analysis.fem import ( make_mesh, solve_laplace, visualize_mesh, visualize_current, ) we can create a mesh as so: .. code-block:: python :linenos: mesh = make_mesh(device=snspd, layer=(1, 0), tolerance=0.01) visualize_mesh(mesh) plt.show() .. image:: tdgl_femfemmesh.png Now, let's analyze the current density by solving the laplace equation .. code-block:: python :linenos: result = solve_laplace(mesh) visualize_current(result, ("1", "2")) plt.show() .. image:: tdgl_femfemj.png