Frad = 1e-12 * (1 - rad / L) * np.exp(-rad / L) Fx = -np.sin(phi) * Fphi + np.cos(phi) * Frad Fy = np.cos(phi) * Fphi + np.sin(phi) * Frad return np.array([Fx, Fy]) sim = fokker_planck(temperature=300, drag=drag, extent=[800 * nm, 800 * nm], resolution=10 * nm, boundary=boundary.reflecting, force=F) ### time-evolved solution pdf = gaussian_pdf(center=(-150 * nm, -150 * nm), width=30 * nm) p0 = pdf(*sim.grid) Nsteps = 200 time, Pt = sim.propagate_interval(pdf, 20e-3, Nsteps=Nsteps) ### animation fig = plt.figure(figsize=plt.figaspect(1 / 2)) ax1 = fig.add_subplot(1, 2, 1, projection='3d') surf = ax1.plot_surface(*sim.grid / nm, p0, cmap='viridis') ax1.set_zlim([0, np.max(Pt) / 5]) ax1.autoscale(False) ax1.set(xlabel='x (nm)', ylabel='y (nm)', zlabel='normalized PDF')
L = 20 * nm F = lambda x: 5e-21 * (np.sin(x / L) + 4) / L sim = fokker_planck(temperature=300, drag=drag, extent=600 * nm, resolution=10 * nm, boundary=boundary.periodic, force=F) ### steady-state solution steady = sim.steady_state() ### time-evolved solution pdf = gaussian_pdf(-150 * nm, 30 * nm) p0 = pdf(sim.grid[0]) Nsteps = 200 time, Pt = sim.propagate_interval(pdf, 2e-3, Nsteps=Nsteps) ### animation fig, ax = plt.subplots(constrained_layout=True) ax.plot(sim.grid[0] / nm, p0, color='red', ls='--', alpha=.3, lw=2, label='initial PDF') ax.plot(sim.grid[0] / nm,