From 0675b8471dd1611d4d50884a6fc02e127e61f3d1 Mon Sep 17 00:00:00 2001 From: Andreas <38031952+AnHeuermann@users.noreply.github.com> Date: Wed, 22 Nov 2023 10:05:24 +0100 Subject: [PATCH] [C Runtime] Check DASSL step size (#11617) - Compared step size to order of magnitude of simulation duration --- OMCompiler/SimulationRuntime/c/simulation/solver/dassl.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/OMCompiler/SimulationRuntime/c/simulation/solver/dassl.c b/OMCompiler/SimulationRuntime/c/simulation/solver/dassl.c index 40edb077a94..103bb0fdf6f 100644 --- a/OMCompiler/SimulationRuntime/c/simulation/solver/dassl.c +++ b/OMCompiler/SimulationRuntime/c/simulation/solver/dassl.c @@ -600,10 +600,12 @@ int dassl_step(DATA* data, threadData_t *threadData, SOLVER_INFO* solverInfo) } /* Check that tout is not less than timeValue - * else will dassl get in trouble. If that is the case we skip the current step. */ - if (solverInfo->currentStepSize < DASSL_STEP_EPS) + * else will dassl get in trouble. If that is the case we skip the current step. + Also check if step size is smaller than DASSL_STEP_EPS or DASSL_STEP_EPS times simulation interval */ + if ((solverInfo->currentStepSize < DASSL_STEP_EPS) || + (solverInfo->currentStepSize < DASSL_STEP_EPS*(data->simulationInfo->stopTime - data->simulationInfo->startTime)) ) { - infoStreamPrint(LOG_DASSL, 0, "Desired step to small try next one"); + infoStreamPrint(LOG_DASSL, 0, "Desired step size %e to small.", solverInfo->currentStepSize); infoStreamPrint(LOG_DASSL, 0, "Interpolate linear"); /*euler step*/