gaussian init

This commit is contained in:
Ian Jauslin 2022-05-26 14:12:58 -04:00
parent 2a24406ca6
commit 11af4a8ece

View File

@ -280,15 +280,13 @@ int ns_init_u(
){ ){
int kx,ky; int kx,ky;
/*
srand(17); srand(17);
// random init (set half, then the other half are the conjugates) // random init (set half, then the other half are the conjugates)
for(kx=0;kx<=K1;kx++){ for(kx=0;kx<=K1;kx++){
for(ky=-K2;ky<=K2;ky++){ for(ky=-K2;ky<=K2;ky++){
if (kx==0 && ky<=0){ if (kx!=0 || ky>0){
u[klookup(kx,ky,2*K1+1,2*K2+1)]=0.;
}
else{
double x=-0.5+((double) rand())/RAND_MAX; double x=-0.5+((double) rand())/RAND_MAX;
double y=-0.5+((double) rand())/RAND_MAX; double y=-0.5+((double) rand())/RAND_MAX;
u[klookup(kx,ky,2*K1+1,2*K2+1)]=x+y*I; u[klookup(kx,ky,2*K1+1,2*K2+1)]=x+y*I;
@ -310,6 +308,7 @@ int ns_init_u(
u[klookup(kx,ky,2*K1+1,2*K2+1)]=u[klookup(kx,ky,2*K1+1,2*K2+1)]*sqrt(1.54511597324389e+02/rescale); u[klookup(kx,ky,2*K1+1,2*K2+1)]=u[klookup(kx,ky,2*K1+1,2*K2+1)]*sqrt(1.54511597324389e+02/rescale);
} }
} }
*/
/* /*
@ -321,14 +320,12 @@ int ns_init_u(
} }
*/ */
/* // gaussian init
// exponentially decaying init
for(kx=-K1;kx<=K1;kx++){ for(kx=-K1;kx<=K1;kx++){
for(ky=-K2;ky<=K2;ky++){ for(ky=-K2;ky<=K2;ky++){
u[klookup(kx,ky,2*K1+1,2*K2+1)]=exp(-sqrt(kx*kx+ky*ky)); u[klookup(kx,ky,2*K1+1,2*K2+1)]=(kx*kx+ky*ky)*exp(-(kx*kx+ky*ky));
} }
} }
*/
return 0; return 0;
} }