From 01f47ace6756c28deb9ea0daaee3904ffa5ce9e0 Mon Sep 17 00:00:00 2001 From: Ian Jauslin Date: Thu, 11 Jan 2018 22:48:14 +0000 Subject: Initial commit --- src/navier-stokes.h | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 src/navier-stokes.h (limited to 'src/navier-stokes.h') diff --git a/src/navier-stokes.h b/src/navier-stokes.h new file mode 100644 index 0000000..cd093d7 --- /dev/null +++ b/src/navier-stokes.h @@ -0,0 +1,48 @@ +#ifndef NAVIERSTOKES_H +#define NAVIERSTOKES_H + +#include +#include + +// to extract elements from array of size S representing a function of momentum, use +// array[KEXTRACT(kx,ky,size)] +#define KLOOKUP(X,Y,S) (X>=0?X:S+X)*S+(Y>=0?Y:S+Y) + + +// parameters for the NS equation +typedef struct ns_params { + // number of modes + int K; + // 2*K+1 + int S; + // 4*K+1 + int N; + // forcing term + _Complex double* g; + // time step + double h; + // friction + double nu; +} ns_params; + +// arrays on which the ffts are performed +typedef struct fft_vects { + fftw_complex* fft1; + fftw_complex* fft2; + fftw_complex* invfft; + fftw_plan fft1_plan; + fftw_plan fft2_plan; + fftw_plan invfft_plan; +} fft_vects; + +// next time step for Irreversible Navier-Stokes equation +int ins_step(_Complex double* u, ns_params params, fft_vects vects, _Complex double* tmp1, _Complex double* tmp2, _Complex double* tmp3); + +// right side of Irreversible Navier-Stokes equation +int ins_rhs(_Complex double* out, _Complex double* u, ns_params params, fft_vects vects); + +// compute alpha +_Complex double compute_alpha(_Complex double* u, ns_params params); + +#endif + -- cgit v1.2.3-54-g00ecf