Remove term that sums up to 0 from alpha

This commit is contained in:
Ian Jauslin 2023-04-22 15:04:02 -04:00
parent 5d0a1bcc6f
commit cbcb39ff19
2 changed files with 3 additions and 34 deletions

View File

@ -129,7 +129,7 @@ int eea(
ns_step(u, K1, K2, N1, N2, nu, delta, L, g, fft1, fft2, ifft, tmp1, tmp2, tmp3, irreversible);
energy=compute_energy(u, K1, K2);
alpha=compute_alpha_fast(u, K1, K2, g, L);
alpha=compute_alpha(u, K1, K2, g, L);
enstrophy=compute_enstrophy(u, K1, K2, L);
// running average
@ -429,7 +429,7 @@ int ns_rhs(
if (irreversible) {
alpha=nu;
} else {
alpha=compute_alpha(u,K1,K2,N1,N2,g,L,ifft.fft);
alpha=compute_alpha(u,K1,K2,g,L);
}
for(i=0; i<(K1+1)*(2*K2+1); i++){
@ -557,35 +557,6 @@ int ns_T_nofft(
// compute alpha
double compute_alpha(
_Complex double* u,
int K1,
int K2,
int N1,
int N2,
_Complex double* g,
double L,
_Complex double* T
){
_Complex double num=0;
double denom=0;
int kx,ky;
num=0.;
denom=0.;
for(kx=-K1;kx<=K1;kx++){
for(ky=-K2;ky<=K2;ky++){
num+=(L*L/4/M_PI/M_PI*(kx*kx+ky*ky)*getval_sym(g, kx,ky,K2)+sqrt(kx*kx+ky*ky)*T[klookup(kx,ky,N1,N2)])*conj(getval_sym(u, kx,ky,K2));
denom+=__real__ (kx*kx+ky*ky)*(kx*kx+ky*ky)*getval_sym(u, kx,ky,K2)*conj(getval_sym(u, kx,ky,K2));
}
}
return __real__ num/denom;
}
// compute alpha
// do not include the term involving T, which, in the limit K->infty, vanishes
double compute_alpha_fast(
_Complex double* u,
int K1,
int K2,

View File

@ -48,9 +48,7 @@ int ns_T( _Complex double* u, int K1, int K2, int N1, int N2, fft_vect fft1, fft
int ns_T_nofft( _Complex double* out, _Complex double* u, int K1, int K2, int N1, int N2);
// compute alpha
double compute_alpha( _Complex double* u, int K1, int K2, int N1, int N2, _Complex double* g, double L, _Complex double* T);
// do not include the term involving T, which, in the limit K->infty, vanishes
double compute_alpha_fast( _Complex double* u, int K1, int K2, _Complex double* g, double L);
double compute_alpha( _Complex double* u, int K1, int K2, _Complex double* g, double L);
// compute energy
double compute_energy( _Complex double* u, int K1, int K2);
// compute enstrophy