no driving option

This commit is contained in:
Ian Jauslin 2022-05-19 17:51:45 +02:00
parent 8bce8632c5
commit 146903265a
4 changed files with 34 additions and 3 deletions

View File

@ -15,3 +15,14 @@ _Complex double g_test(
return 0.; return 0.;
} }
#define UNUSED(x) (void)(x)
_Complex double g_zero(
int kx,
int ky
){
// avoid unused variable warnings
UNUSED(kx);
UNUSED(ky);
return 0.;
}

View File

@ -3,6 +3,7 @@
#include <complex.h> #include <complex.h>
_Complex double g_zero( int kx, int ky);
_Complex double g_test( int kx, int ky); _Complex double g_test( int kx, int ky);
#endif #endif

View File

@ -22,7 +22,8 @@ int set_parameter(char* lhs, char* rhs, int* K1, int* K2, int* N1, int* N2, unsi
#define COMMAND_ENSTROPHY 2 #define COMMAND_ENSTROPHY 2
#define COMMAND_QUIET 3 #define COMMAND_QUIET 3
#define DRIVING_TEST 1 #define DRIVING_ZERO 1
#define DRIVING_TEST 2
int main ( int main (
@ -55,12 +56,15 @@ int main (
} }
// set driving force // set driving force
switch(driving){ switch(driving){
case DRIVING_ZERO:
g=g_zero;
break;
case DRIVING_TEST: case DRIVING_TEST:
g=g_test; g=g_test;
break; break;
default: default:
g=g_test; g=g_zero;
break; break;
} }
@ -137,7 +141,10 @@ int read_args(
} }
// driving force // driving force
else if(flag==CP_FLAG_DRIVING){ else if(flag==CP_FLAG_DRIVING){
if (strcmp(argv[i],"test")==0){ if (strcmp(argv[i],"zero")==0){
*driving_force=DRIVING_ZERO;
}
else if (strcmp(argv[i],"test")==0){
*driving_force=DRIVING_TEST; *driving_force=DRIVING_TEST;
} }
else{ else{

View File

@ -30,6 +30,18 @@ int uk(
ns_init_tmps(&u, &tmp1, &tmp2, &tmp3, &fft1, &fft2, &ifft, K1, K2, N1, N2, nthreads); ns_init_tmps(&u, &tmp1, &tmp2, &tmp3, &fft1, &fft2, &ifft, K1, K2, N1, N2, nthreads);
ns_init_u(u, K1, K2); ns_init_u(u, K1, K2);
// print column headers
printf("# 1:i 2:t ");
t=3;
for(kx=-K1;kx<=K1;kx++){
for (ky=-K2;ky<=K2;ky++){
printf(" %6d:(%4d,%4d)r ",t,kx,ky);
t++;
printf(" %6d:(%4d,%4d)i ",t,kx,ky);
t++;
}
}
// iterate // iterate
for(t=0;t<nsteps;t++){ for(t=0;t<nsteps;t++){
ins_step(u, K1, K2, N1, N2, nu, delta, g, fft1, fft2, ifft, tmp1, tmp2, tmp3); ins_step(u, K1, K2, N1, N2, nu, delta, g, fft1, fft2, ifft, tmp1, tmp2, tmp3);