Same initial u as Gallavotti

This commit is contained in:
Ian Jauslin 2022-05-25 10:23:53 -04:00
parent d58123d7cc
commit 4b7c89fb35

View File

@ -278,31 +278,26 @@ int ns_init_u(
int K2
){
int kx,ky;
/*
double rescale;
srand(17);
// random init (set half, then the other half are the conjugates)
for(ky=0;ky<=K2;ky++){
u[klookup(0,ky,2*K1+1,2*K2+1)]=(-RAND_MAX*0.5+rand())*1.0/RAND_MAX+(-RAND_MAX*0.5+rand())*1.0/RAND_MAX*I;
}
for(kx=1;kx<=K1;kx++){
for(kx=0;kx<=K1;kx++){
for(ky=-K2;ky<=K2;ky++){
u[klookup(kx,ky,2*K1+1,2*K2+1)]=(-RAND_MAX*0.5+rand())*1.0/RAND_MAX+(-RAND_MAX*0.5+rand())*1.0/RAND_MAX*I;
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 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)]=conj(u[klookup(kx,ky,2*K1+1,2*K2+1)]);
}
// conjugates
for(ky=-K2;ky<=-1;ky++){
u[klookup(0,ky,2*K1+1,2*K2+1)]=conj(u[klookup(0,-ky,2*K1+1,2*K2+1)]);
}
for(kx=-K1;kx<=-1;kx++){
for(ky=-K2;ky<=K2;ky++){
u[klookup(kx,ky,2*K1+1,2*K2+1)]=conj(u[klookup(-kx,-ky,2*K1+1,2*K2+1)]);
}
}
// rescale: 1/k decay
// rescale to match with Gallavotti's initialization
double rescale;
rescale=0;
for(kx=-K1;kx<=K1;kx++){
for(ky=-K2;ky<=K2;ky++){
@ -311,10 +306,9 @@ int ns_init_u(
}
for(kx=-K1;kx<=K1;kx++){
for(ky=-K2;ky<=K2;ky++){
u[klookup(kx,ky,2*K1+1,2*K2+1)]=u[klookup(kx,ky,2*K1+1,2*K2+1)]*sqrt(155.1/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);
}
}
*/
/*
@ -326,12 +320,14 @@ int ns_init_u(
}
*/
/*
// exponentially decaying init
for(kx=-K1;kx<=K1;kx++){
for(ky=-K2;ky<=K2;ky++){
u[klookup(kx,ky,2*K1+1,2*K2+1)]=exp(-sqrt(kx*kx+ky*ky));
}
}
*/
return 0;
}