Commit 3013809e authored by Sebastien Timmermans's avatar Sebastien Timmermans 🎹

[Fix] update dd->tsim in integrators functions

parent ad8d82a1
......@@ -465,7 +465,7 @@ void mbs_dirdyn_init(MbsDirdyn* dd, MbsData* mbs_data)
// Save first state of the system
mbs_fct_dirdyn(dd->tsim, dd->y, dd->yd, mbs_data, dd);
mbs_dirdyn_save(dd, mbs_data, mbs_data->tsim);
mbs_dirdyn_save(dd, mbs_data, dd->tsim);
// release memory
......
......@@ -131,6 +131,8 @@ void bader(double y[], double dydx[], int nv, double *xx, double htry, double ep
reduct = 1;
} // try again.
dd->tsim = xnew; // Update of tsim
*xx = xnew; // Successful step taken
*hdid = h;
first = 0;
......
......@@ -416,6 +416,8 @@ static int dopcor(unsigned n, FcnEqDiff fcn, double x, double* y, double xend,
xold = x;
x = xph;
dd->tsim = x; // Update of tsim
if (iout)
{
hout = h;
......@@ -456,7 +458,7 @@ static int dopcor(unsigned n, FcnEqDiff fcn, double x, double* y, double xend,
nrejct = nrejct + 1;
last = 0;
}
h = hnew;
last_hnew = hnew; // modif: line added
}
......
......@@ -87,6 +87,7 @@ void loop_rosenbrock(double t0, double tf, MbsData *mbs_data, MbsDirdyn *mbs_dd,
mbs_fct_dirdyn(t, mbs_dd->y, mbs_dd->yd, mbs_data, mbs_dd);
mbs_dd->tsim = t; // Update of tsim
h_cur = (hnext < tf - t) ? hnext : tf - t;
h_max = (mbs_dd->options->dt_max < tf - t) ? mbs_dd->options->dt_max : tf - t;
......
......@@ -69,10 +69,10 @@ void loop_w_methods(double t0, double tf, MbsData *mbs_data, MbsDirdyn *mbs_dd,
// Call the W Method function
w_methods(mbs_dd->y, mbs_dd->yd, mbs_dd->nState, mbs_dd->tsim, h, mbs_dd->yout, mbs_fct_dirdyn, mbs_data, mbs_dd);
mbs_dd->tsim += h;
mbs_fct_dirdyn(mbs_dd->tsim, mbs_dd->y, mbs_dd->yd, mbs_data, mbs_dd); // next f'
mbs_dd->tsim += h;
if (((!mbs_dd->options->flag_solout_wp) || (mbs_dd->options->flag_solout_wp && mbs_dd->tsim == tf))) {
save_realtime_update(mbs_dd, mbs_data);
}
......
Markdown is supported
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