Ian Jauslin
summaryrefslogtreecommitdiff
blob: 5ac8d7daa0a4070b6119d6e1b35dbd5b7a3bb5fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#ifndef NAVIERSTOKES_H
#define NAVIERSTOKES_H

#include <complex.h>
#include <fftw3.h>


// arrays on which the ffts are performed
typedef struct fft_vects {
  fftw_complex* fft;
  fftw_plan fft_plan;
} fft_vect;

// compute u_k
int uk( int K1, int K2, int N1, int N2, unsigned int nsteps, double nu, double delta, _Complex double (*g)(int,int), unsigned int print_freq);

// compute enstrophy
int enstrophy( int K1, int K2, int N1, int N2, unsigned int nsteps, double nu, double delta, _Complex double (*g)(int,int), unsigned int print_freq);

// initialize vectors for computation
int  ns_init_tmps( _Complex double **u, _Complex double ** tmp1, _Complex double **tmp2, _Complex double **tmp3, fft_vect* fft1, fft_vect *fft2, fft_vect *ifft, int K1, int K2, int N1, int N2);
// release vectors
int ns_free_tmps( _Complex double* u, _Complex double* tmp1, _Complex double *tmp2,_Complex double *tmp3, fft_vect fft1, fft_vect fft2, fft_vect ifft);

// initial value
int ns_init_u( _Complex double* u, int K1, int K2);

// next time step for Irreversible Navier-Stokes equation
int ins_step( _Complex double* u, int K1, int K2, int N1, int N2, double nu, double delta, _Complex double (*g)(int,int), fft_vect fft1, fft_vect fft2,fft_vect ifft, _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, int K1, int K2, int N1, int N2, double nu, _Complex double (*g)(int,int), fft_vect fft1, fft_vect fft2, fft_vect ifft);

// compute alpha
_Complex double compute_alpha( _Complex double* u, int K1, int K2, _Complex double (*g)(int,int));

// get index for kx,ky in array of size S
int klookup( int kx, int ky, int S1, int S2);

#endif