Skip to content

td wslda examples

Gabriel Wlazłowski edited this page Feb 20, 2024 · 3 revisions

[[TOC]]

Example 1: Time-dependent external potential

Target: find a time evolution of the unitary Fermi gas confined in a harmonic trap:

$$V_{\textrm{ext}}(x,y,z,t) = \frac{m\omega_x^2 x^2}{2} + A(t)\frac{m\omega_y^2 y^2}{2}$$

where $A(t)$ is a function that smoothly rises from zero to one within a given time interval.

Step 1: Find the static solution

The initial external potential is $V_{\textrm{ext}}(x,y,z) = \frac{m\omega_x^2 x^2}{2}$, and we can use 1d code.

Code: st-wslda-1d

Settings:

Output:

Step 2: Execute time evolution

Code: td-wslda-2d

Settings:

Output:

td-snapshots

Energy evolution:

import numpy as np
import matplotlib.pyplot as plt

data = np.loadtxt("trap-2d-alpha0.0.wlog", usecols=(1,4,5))

fig, ax = plt.subplots()
ax.plot(data[:,0], data[:,2], color='red', label=r'energy', lw=3.0)
ax.set(xlabel=r'$t\varepsilon_F$', ylabel=r'$E/E_{ffg}$')
ax2 = ax.twinx()  # instantiate a second axes that shares the same x-axis
ax2.plot(data[:,0], data[:,1], color='blue', label=r'particle number', lw=2.0, ls="--") # plot last frame [-1]
ax2.set(ylabel=r'$N$')
fig.legend(loc="upper left", bbox_to_anchor=(0.3,0.3), bbox_transform=ax.transAxes)
fig.savefig("energy-conservation.png")

energy-conservation

Clone this wiki locally