From 15bcb8b4679d1c3ab2aafeab49a7fba57985acb2 Mon Sep 17 00:00:00 2001 From: Ian Jauslin Date: Mon, 19 Feb 2024 19:05:35 -0500 Subject: [PATCH] Lyapunov command in main --- src/constants.cpp | 1 + src/main.c | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/src/constants.cpp b/src/constants.cpp index 8a0f054..0f07dba 100644 --- a/src/constants.cpp +++ b/src/constants.cpp @@ -20,6 +20,7 @@ limitations under the License. #define COMMAND_ENSTROPHY 2 #define COMMAND_QUIET 3 #define COMMAND_RESUME 4 +#define COMMAND_LYAPUNOV 5 #define DRIVING_ZERO 1 #define DRIVING_TEST 2 diff --git a/src/main.c b/src/main.c index 5066c47..5d743e6 100644 --- a/src/main.c +++ b/src/main.c @@ -27,6 +27,7 @@ limitations under the License. #include "dstring.h" #include "init.h" #include "int_tools.h" +#include "lyapunov.h" #include "navier-stokes.h" @@ -55,6 +56,8 @@ typedef struct nstrophy_parameters { bool keep_en_cst; FILE* initfile; FILE* drivingfile; + double lyapunov_reset; + double D_epsilon; } nstrophy_parameters; // usage message @@ -279,6 +282,9 @@ int main ( 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_norm, parameters.starting_time, u0, g, parameters.irreversible, parameters.keep_en_cst, parameters.init_en, parameters.algorithm, nthreads, savefile); } + else if(command==COMMAND_LYAPUNOV){ + lyapunov(parameters.K1, parameters.K2, parameters.N1, parameters.N2, parameters.final_time, parameters.lyapunov_reset, parameters.nu, parameters.D_epsilon, parameters.delta, parameters.L, parameters.adaptive_tolerance, parameters.adaptive_factor, parameters.max_delta, parameters.adaptive_norm, u0, g, parameters.irreversible, parameters.keep_en_cst, parameters.init_en, parameters.algorithm, parameters.starting_time, nthreads); + } else if(command==0){ fprintf(stderr, "error: no command specified\n"); print_usage(); @@ -501,6 +507,9 @@ int read_args( *command=COMMAND_RESUME; flag=CP_FLAG_RESUME; } + else if(strcmp(argv[i], "lyapunov")==0){ + *command=COMMAND_LYAPUNOV; + } else{ fprintf(stderr, "error: unrecognized command: '%s'\n",argv[i]); return(-1);