Commit a2277acf authored by Nicolas Van der Noot's avatar Nicolas Van der Noot
Browse files

verbose adapt time step

parent e6bb640c
......@@ -59,12 +59,13 @@ MbsDirdyn* mbs_new_dirdyn_aux(MbsData* mbs_data, MbsAux* mbs_aux){
// adaptive time step integrator
opts->adapt_time_step = 0;
opts->adapt_verbose = 1;
opts->adapt_rtoler = 1.0e-4;
opts->adapt_atoler = 1.0e-3;
opts->adapt_dt_max = 1.0e-3;
opts->adapt_dt_save = 1.0e-3;
opts->adapt_dt_rt = 1.0e-3;
opts->adapt_max_steps = 1.0e9;
opts->adapt_dt_rt = 1.0e-3;
opts->adapt_nmax = 1.0e9;
dirdyn->options = opts;
......@@ -252,7 +253,8 @@ void mbs_dirdyn_init(MbsDirdyn* dd, MbsData* mbs_data){
void mbs_dirdyn_loop(MbsDirdyn* dd, MbsData* mbs_data){
FILE* animFile;
FILE *animFile;
FILE *fileout_dopri5;
int i;
#ifdef REAL_TIME
......@@ -270,8 +272,17 @@ void mbs_dirdyn_loop(MbsDirdyn* dd, MbsData* mbs_data){
if (dd->options->adapt_time_step)
{
if (dd->options->adapt_verbose)
{
fileout_dopri5 = stdout;
}
else
{
fileout_dopri5 = NULL;
}
dopri5(dd->nState, f_prim_dopri5, dd->options->t0, dd->y, dd->options->tf, &(dd->options->adapt_rtoler), &(dd->options->adapt_atoler),
0, NULL, 0, stdout, 0.0, 0.0, 0.0, 0.0, 0.0, dd->options->adapt_dt_max, dd->options->dt0, dd->options->adapt_max_steps, 1, 0, 0, NULL, 0, mbs_data, dd);
0, NULL, 0, fileout_dopri5, 0.0, 0.0, 0.0, 0.0, 0.0, dd->options->adapt_dt_max, dd->options->dt0, dd->options->adapt_nmax, 1, 0, 0, NULL, 0, mbs_data, dd);
}
else
{
......
......@@ -64,8 +64,9 @@ typedef struct MbsDirdynOptions
int realtime; ///< 1 to activate to real-time features, 0 to deactivate them
// adaptive time step
int adapt_time_step; ///< 1 to use dopri5 (adaptive time step), 0 to use runge kutta 4 (fixed time step)
int adapt_max_steps; ///< maximal number of stpes [-]
int adapt_time_step; ///< 1 to use dopri5 (adaptive time step), 0 to use runge kutta 4 (fixed time step)
int adapt_nmax; ///< maximal number of stpes [-]
int adapt_verbose; ///< 1 to get print indications related to time adaptive integrator, 0 otherwise
double adapt_rtoler; ///< relative error tolerances [-]
double adapt_atoler; ///< absolute error tolerances [-]
double adapt_dt_max; ///< maximal time step [s]
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment