numerics 0.1.0
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*d(psi)/dt = -(1/2)*Lap(psi) + V(x,y)*psi (Schrodinger) d(u)/dt = kappa*Lap(u) (complex-coefficient diffusion)

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

(I - ia*Lap_1D)*psi^{n+1} = (I + ia*Lap_1D)*psi^n, ia = i*tau/(4*h^2)

Two tridiagonals are prefactored once – for tau = dt/2 and tau = 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.