Add command to print the enstrophy of the initial condition
This commit is contained in:
@@ -58,7 +58,14 @@ The available commands are
|
||||
|
||||
* `uk`: to compute the Fourier transform of the solution.
|
||||
|
||||
* `quiet`: does not print anything, useful for debugging.
|
||||
* `quiet`: does not print anything (useful for debugging).
|
||||
|
||||
* `enstrophy_print_init`: to compute the enstrophy and various other
|
||||
observables for the initial condition (useful for debugging). The command
|
||||
prints
|
||||
```
|
||||
alpha energy enstrophy
|
||||
```
|
||||
|
||||
|
||||
# Parameters
|
||||
|
||||
@@ -21,6 +21,7 @@ limitations under the License.
|
||||
#define COMMAND_QUIET 3
|
||||
#define COMMAND_RESUME 4
|
||||
#define COMMAND_LYAPUNOV 5
|
||||
#define COMMAND_ENSTROPHY_PRINT_INIT 6
|
||||
|
||||
#define DRIVING_ZERO 1
|
||||
#define DRIVING_TEST 2
|
||||
|
||||
@@ -325,6 +325,9 @@ int main (
|
||||
signal(SIGTERM, sig_handler);
|
||||
enstrophy(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, parameters.print_alpha, 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_PRINT_INIT){
|
||||
enstrophy_print_init(parameters.K1, parameters.K2, parameters.L, u0, g);
|
||||
}
|
||||
else if(command==COMMAND_QUIET){
|
||||
quiet(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, parameters.starting_time, u0, g, parameters.irreversible, parameters.keep_en_cst, parameters.init_enstrophy, parameters.algorithm, nthreads, savefile);
|
||||
}
|
||||
@@ -561,6 +564,9 @@ int read_args(
|
||||
else if(strcmp(argv[i], "enstrophy")==0){
|
||||
*command=COMMAND_ENSTROPHY;
|
||||
}
|
||||
else if(strcmp(argv[i], "enstrophy_print_init")==0){
|
||||
*command=COMMAND_ENSTROPHY_PRINT_INIT;
|
||||
}
|
||||
else if(strcmp(argv[i], "quiet")==0){
|
||||
*command=COMMAND_QUIET;
|
||||
}
|
||||
|
||||
@@ -297,6 +297,25 @@ int enstrophy(
|
||||
return(0);
|
||||
}
|
||||
|
||||
// compute enstrophy, alpha for the initial condition (useful for debugging)
|
||||
int enstrophy_print_init(
|
||||
int K1,
|
||||
int K2,
|
||||
double L,
|
||||
_Complex double* u0,
|
||||
_Complex double* g
|
||||
){
|
||||
double alpha, enstrophy, energy;
|
||||
|
||||
alpha=compute_alpha(u0, K1, K2, g, L);
|
||||
enstrophy=compute_enstrophy(u0, K1, K2, L);
|
||||
energy=compute_energy(u0, K1, K2);
|
||||
|
||||
// print
|
||||
printf("% .15e % .15e % .15e\n", alpha, energy, enstrophy);
|
||||
return(0);
|
||||
}
|
||||
|
||||
// compute solution as a function of time, but do not print anything (useful for debugging)
|
||||
int quiet(
|
||||
int K1,
|
||||
|
||||
@@ -35,6 +35,8 @@ int uk( int K1, int K2, int N1, int N2, double final_time, double nu, double del
|
||||
|
||||
// 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);
|
||||
// compute enstrophy, alpha for the initial condition (useful for debugging)
|
||||
int enstrophy_print_init( int K1, int K2, double L, _Complex double* u0, _Complex double* g);
|
||||
|
||||
// compute solution as a function of time, but do not print anything (useful for debugging)
|
||||
int quiet( 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, double starting_time, _Complex double* u0, _Complex double* g, bool irreversible, bool keep_en_cst, double target_en, unsigned int algorithm, unsigned int nthreads, FILE* savefile);
|
||||
|
||||
Reference in New Issue
Block a user