Only use kx>=0 in computation of alpha, energy and enstrophy

This commit is contained in:
Ian Jauslin 2023-04-25 18:13:20 -04:00
parent d838060265
commit f7a7a5866c

View File

@ -553,8 +553,8 @@ double compute_alpha(
num=0.;
denom=0.;
for(kx=-K1;kx<=K1;kx++){
for(ky=-K2;ky<=K2;ky++){
for(kx=0;kx<=K1;kx++){
for(ky=(kx>0 ? -K2 : 1);ky<=K2;ky++){
num+=L*L/4/M_PI/M_PI*(kx*kx+ky*ky)*getval_sym(g, kx,ky,K2)*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));
}
@ -572,12 +572,12 @@ double compute_energy(
){
int kx,ky;
double out=0.;
for(kx=-K1;kx<=K1;kx++){
for (ky=-K2;ky<=K2;ky++){
for(kx=0;kx<=K1;kx++){
for(ky=(kx>0 ? -K2 : 1);ky<=K2;ky++){
out+=__real__ (getval_sym(u, kx,ky,K2)*conj(getval_sym(u, kx,ky,K2)));
}
}
return out;
return 2*out;
}
// compute enstrophy
@ -589,12 +589,12 @@ double compute_enstrophy(
){
int kx,ky;
double out=0.;
for(kx=-K1;kx<=K1;kx++){
for (ky=-K2;ky<=K2;ky++){
for(kx=0;kx<=K1;kx++){
for(ky=(kx>0 ? -K2 : 1);ky<=K2;ky++){
out+=__real__ (4*M_PI*M_PI/L/L*(kx*kx+ky*ky)*getval_sym(u, kx,ky,K2)*conj(getval_sym(u, kx,ky,K2)));
}
}
return out;
return 2*out;
}