Ian Jauslin
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIan Jauslin <ian@jauslin.org>2022-05-26 14:12:58 -0400
committerIan Jauslin <ian@jauslin.org>2022-05-26 14:12:58 -0400
commit11af4a8ece4b6c313ddea3d1600d0c2bc871fe64 (patch)
treedad671bc9ab42ed7fa9a88f32293edd59f5106d0 /src
parent2a24406ca6c64901100e982b45f8e7fb913864c3 (diff)
gaussian init
Diffstat (limited to 'src')
-rw-r--r--src/navier-stokes.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/navier-stokes.c b/src/navier-stokes.c
index fe2951f..798c86a 100644
--- a/src/navier-stokes.c
+++ b/src/navier-stokes.c
@@ -280,15 +280,13 @@ int ns_init_u(
){
int kx,ky;
+ /*
srand(17);
// random init (set half, then the other half are the conjugates)
for(kx=0;kx<=K1;kx++){
for(ky=-K2;ky<=K2;ky++){
- if (kx==0 && ky<=0){
- u[klookup(kx,ky,2*K1+1,2*K2+1)]=0.;
- }
- else{
+ if (kx!=0 || ky>0){
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;
@@ -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);
}
}
+ */
/*
@@ -321,14 +320,12 @@ int ns_init_u(
}
*/
- /*
- // exponentially decaying init
+ // gaussian 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));
+ u[klookup(kx,ky,2*K1+1,2*K2+1)]=(kx*kx+ky*ky)*exp(-(kx*kx+ky*ky));
}
}
- */
return 0;
}