numerics
Loading...
Searching...
No Matches
adi.hpp File Reference

Crank-Nicolson ADI solver for 2D parabolic equations via fiber sweeps. More...

#include "pde/stencil.hpp"
#include "linalg/factorization/tridiag_complex.hpp"
#include "core/vector.hpp"
#include <vector>
#include <complex>

Go to the source code of this file.

Classes

struct  num::CrankNicolsonADI
 

Namespaces

namespace  num
 

Detailed Description

Crank-Nicolson ADI solver for 2D parabolic equations via fiber sweeps.

CrankNicolsonADI encapsulates the prefactored complex tridiagonals for Strang-split time stepping of equations of the form:

i ∂ψ/∂t = -(1/2) ∆ψ + V(x,y) ψ (Schrödinger) ∂u/∂t = κ ∆u (complex-coefficient diffusion)

Each CN sub-step τ along one axis solves a 1D system per fiber:

(I - ia·Lap₁D) ψⁿ⁺¹ = (I + ia·Lap₁D) ψⁿ, ia = i·τ/(4h²)

Two tridiagonals are prefactored once — for τ = dt/2 and τ = dt — covering the full Strang splitting: sweep_x(dt/2) → sweep_y(dt) → sweep_x(dt/2).

Typical usage (TDSE Strang splitting):

num::CrankNicolsonADI adi(N, dt, h);
// one full time step:
adi.sweep(psi, true, dt * 0.5); // x, half-step
adi.sweep(psi, false, dt); // y, full-step
adi.sweep(psi, true, dt * 0.5); // x, half-step

Definition in file adi.hpp.