45 NSSolver(idx N_, real dt_, real nu_ = 0.0);
60 real
speed(idx i, idx j)
const;
63 real
interp_u(real px, real py)
const;
65 real
interp_v(real px, real py)
const;
80 inline idx at (idx i, idx j)
const noexcept {
return i *
N + j; }
81 inline idx wp1(idx i)
const noexcept {
return (i + 1) %
N; }
82 inline idx wm1(idx i)
const noexcept {
return (i +
N - 1) %
N; }
86 void apply_diffusion();
88 void solve_pressure();
95 real tol, idx max_iter);
Conjugate gradient solvers (dense and matrix-free)
num::Vector p
velocity faces + cell-centre pressure, N*N each
real vorticity(idx i, idx j) const
Vorticity omega = d_v/d_x - d_u/d_y at grid corner (i*h, j*h).
real interp_u(real px, real py) const
Interpolate x-velocity at physical point (px, py).
real interp_v(real px, real py) const
Interpolate y-velocity at physical point (px, py).
void init_shear_layer(real rho=0.05, real delta=0.05)
real speed(idx i, idx j) const
Velocity magnitude averaged to cell centre (i,j).
void step()
Advance one time step (advect -> pressure -> project).