Only use kx>=0 in computation of alpha, energy and enstrophy
This commit is contained in:
parent
d838060265
commit
f7a7a5866c
@ -553,8 +553,8 @@ double compute_alpha(
|
|||||||
num=0.;
|
num=0.;
|
||||||
denom=0.;
|
denom=0.;
|
||||||
|
|
||||||
for(kx=-K1;kx<=K1;kx++){
|
for(kx=0;kx<=K1;kx++){
|
||||||
for(ky=-K2;ky<=K2;ky++){
|
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));
|
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));
|
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;
|
int kx,ky;
|
||||||
double out=0.;
|
double out=0.;
|
||||||
for(kx=-K1;kx<=K1;kx++){
|
for(kx=0;kx<=K1;kx++){
|
||||||
for (ky=-K2;ky<=K2;ky++){
|
for(ky=(kx>0 ? -K2 : 1);ky<=K2;ky++){
|
||||||
out+=__real__ (getval_sym(u, kx,ky,K2)*conj(getval_sym(u, kx,ky,K2)));
|
out+=__real__ (getval_sym(u, kx,ky,K2)*conj(getval_sym(u, kx,ky,K2)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return out;
|
return 2*out;
|
||||||
}
|
}
|
||||||
|
|
||||||
// compute enstrophy
|
// compute enstrophy
|
||||||
@ -589,12 +589,12 @@ double compute_enstrophy(
|
|||||||
){
|
){
|
||||||
int kx,ky;
|
int kx,ky;
|
||||||
double out=0.;
|
double out=0.;
|
||||||
for(kx=-K1;kx<=K1;kx++){
|
for(kx=0;kx<=K1;kx++){
|
||||||
for (ky=-K2;ky<=K2;ky++){
|
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)));
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user