Use savefiles in uk
This commit is contained in:
parent
8a1f3987f4
commit
08ded444b8
@ -317,7 +317,7 @@ int main (
|
|||||||
|
|
||||||
// run command
|
// run command
|
||||||
if (command==COMMAND_UK){
|
if (command==COMMAND_UK){
|
||||||
uk(parameters.K1, parameters.K2, parameters.N1, parameters.N2, parameters.final_time, parameters.nu, parameters.delta, parameters.L, parameters.adaptive_tolerance, parameters.adaptive_factor, parameters.max_delta, parameters.adaptive_cost, u0, g, parameters.irreversible, parameters.keep_en_cst, parameters.init_enstrophy, parameters.algorithm, parameters.print_freq, parameters.starting_time, nthreads, savefile);
|
uk(parameters.K1, parameters.K2, parameters.N1, parameters.N2, parameters.final_time, parameters.nu, parameters.delta, parameters.L, parameters.adaptive_tolerance, parameters.adaptive_factor, parameters.max_delta, parameters.adaptive_cost, u0, g, parameters.irreversible, parameters.keep_en_cst, parameters.init_enstrophy, parameters.algorithm, parameters.print_freq, parameters.starting_time, nthreads, savefile, utfile, (char*)argv[0], dstring_to_str_noinit(¶m_str), dstring_to_str_noinit(&savefile_str), dstring_to_str_noinit(&utfile_str));
|
||||||
}
|
}
|
||||||
else if(command==COMMAND_ENSTROPHY){
|
else if(command==COMMAND_ENSTROPHY){
|
||||||
// register signal handler to handle aborts
|
// register signal handler to handle aborts
|
||||||
|
@ -48,7 +48,13 @@ int uk(
|
|||||||
double print_freq,
|
double print_freq,
|
||||||
double starting_time,
|
double starting_time,
|
||||||
unsigned int nthreads,
|
unsigned int nthreads,
|
||||||
FILE* savefile
|
FILE* savefile,
|
||||||
|
FILE* utfile,
|
||||||
|
// for interrupt recovery
|
||||||
|
const char* cmd_string,
|
||||||
|
const char* params_string,
|
||||||
|
const char* savefile_string,
|
||||||
|
const char* utfile_string
|
||||||
){
|
){
|
||||||
_Complex double* u;
|
_Complex double* u;
|
||||||
_Complex double* tmp1;
|
_Complex double* tmp1;
|
||||||
@ -95,7 +101,6 @@ int uk(
|
|||||||
ns_step(algorithm, u, K1, K2, N1, N2, nu, &step, &next_step, adaptive_tolerance, adaptive_factor, max_delta, adaptive_cost, L, g, time, starting_time, fft1, fft2, ifft, &tmp1, &tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, irreversible, keep_en_cst, target_en);
|
ns_step(algorithm, u, K1, K2, N1, N2, nu, &step, &next_step, adaptive_tolerance, adaptive_factor, max_delta, adaptive_cost, L, g, time, starting_time, fft1, fft2, ifft, &tmp1, &tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, irreversible, keep_en_cst, target_en);
|
||||||
|
|
||||||
time+=step;
|
time+=step;
|
||||||
step=next_step;
|
|
||||||
|
|
||||||
if(time>(n+1)*print_freq){
|
if(time>(n+1)*print_freq){
|
||||||
n++;
|
n++;
|
||||||
@ -115,11 +120,25 @@ int uk(
|
|||||||
fprintf(stderr,"\n");
|
fprintf(stderr,"\n");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// get ready for next step
|
||||||
|
step=next_step;
|
||||||
|
|
||||||
|
// catch abort signal
|
||||||
|
if (g_abort){
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: update handling of savefile
|
// TODO: update handling of savefile
|
||||||
// save final entry to savefile
|
if(savefile!=NULL){
|
||||||
write_vec_bin(u, K1, K2, savefile);
|
save_state(u, savefile, K1, K2, cmd_string, params_string, savefile_string, utfile_string, utfile, COMMAND_UK, algorithm, step, time, nthreads);
|
||||||
|
}
|
||||||
|
|
||||||
|
// save final u to utfile in txt format
|
||||||
|
if(utfile!=NULL){
|
||||||
|
write_vec(u, K1, K2, utfile);
|
||||||
|
}
|
||||||
|
|
||||||
ns_free_tmps(u, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, fft1, fft2, ifft, algorithm);
|
ns_free_tmps(u, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, fft1, fft2, ifft, algorithm);
|
||||||
return(0);
|
return(0);
|
||||||
|
@ -31,7 +31,7 @@ typedef struct fft_vects {
|
|||||||
} fft_vect;
|
} fft_vect;
|
||||||
|
|
||||||
// compute u_k
|
// compute u_k
|
||||||
int uk( int K1, int K2, int N1, int N2, double final_time, double nu, double delta, double L, double adaptive_tolerance, double adaptive_factor, double max_delta, unsigned int adaptive_cost, _Complex double* u0, _Complex double* g, bool irreversible, bool keep_en_cst, double target_en, unsigned int algorithm, double print_freq, double starting_time, unsigned int nthreadsl, FILE* savefile);
|
int uk( int K1, int K2, int N1, int N2, double final_time, double nu, double delta, double L, double adaptive_tolerance, double adaptive_factor, double max_delta, unsigned int adaptive_cost, _Complex double* u0, _Complex double* g, bool irreversible, bool keep_en_cst, double target_en, unsigned int algorithm, double print_freq, double starting_time, unsigned int nthreadsl, FILE* savefile, FILE* utfile, const char* cmd_string, const char* params_string, const char* savefile_string, const char* utfile_string);
|
||||||
|
|
||||||
// compute enstrophy and alpha
|
// compute enstrophy and alpha
|
||||||
int enstrophy( int K1, int K2, int N1, int N2, double final_time, double nu, double delta, double L, double adaptive_tolerance, double adaptive_factor, double max_delta, unsigned int adaptive_cost, _Complex double* u0, _Complex double* g, bool irreversible, bool keep_en_cst, double target_en, unsigned int algorithm, double print_freq, double starting_time, bool print_alpha, unsigned int nthreads, FILE* savefile, FILE* utfile, const char* cmd_string, const char* params_string, const char* savefile_string, const char* utfile_string);
|
int enstrophy( int K1, int K2, int N1, int N2, double final_time, double nu, double delta, double L, double adaptive_tolerance, double adaptive_factor, double max_delta, unsigned int adaptive_cost, _Complex double* u0, _Complex double* g, bool irreversible, bool keep_en_cst, double target_en, unsigned int algorithm, double print_freq, double starting_time, bool print_alpha, unsigned int nthreads, FILE* savefile, FILE* utfile, const char* cmd_string, const char* params_string, const char* savefile_string, const char* utfile_string);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user