Skip to content

Commit

Permalink
Utilize simulation flag -noRootFinding in GBODE (#10391)
Browse files Browse the repository at this point in the history
* Utilize simulation flag -noRootFinding in GBODE
  • Loading branch information
bernhardbachmann committed Mar 13, 2023
1 parent cfdfe6e commit c9a7342
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
10 changes: 7 additions & 3 deletions OMCompiler/SimulationRuntime/c/simulation/solver/gbode_events.c
Expand Up @@ -275,10 +275,14 @@ double checkForEvents(DATA* data, threadData_t* threadData, SOLVER_INFO* solverI
*foundEvent = checkForStateEvent(data, solverInfo->eventLst);

if (*foundEvent) {
eventTime = findRoot_gb(data, threadData, solverInfo, solverInfo->eventLst, timeLeft, leftValues, timeRight, rightValues, isInnerIntegration);
infoStreamPrint(LOG_SOLVER, 0, "gbode detected an event at time: %20.16g", eventTime);
if (omc_flag[FLAG_NO_ROOTFINDING]) {
eventTime = timeRight;
infoStreamPrint(LOG_SOLVER, 0, "gbode detected an event at time: %20.16g (rootfinding is disabled)", eventTime);
} else {
eventTime = findRoot_gb(data, threadData, solverInfo, solverInfo->eventLst, timeLeft, leftValues, timeRight, rightValues, isInnerIntegration);
infoStreamPrint(LOG_SOLVER, 0, "gbode detected an event at time: %20.16g", eventTime);
}
}

// re-store the pre values of the zeroCrossings for comparison
memcpy(data->simulationInfo->zeroCrossings, data->simulationInfo->zeroCrossingsPre, data->modelData->nZeroCrossings * sizeof(modelica_real));

Expand Down
Expand Up @@ -1843,7 +1843,6 @@ int gbode_singlerate(DATA *data, threadData_t *threadData, SOLVER_INFO *solverIn
}
infoStreamPrint(LOG_SOLVER, 0, "Reject step from %10g to %10g, interpolation error %10g, new stepsize %10g",
gbData->time, gbData->time + gbData->lastStepSize, gbData->err_int, gbData->stepSize);

// count failed steps and output information on the solver status
// gbData->errorTestFailures++;
continue;
Expand Down

0 comments on commit c9a7342

Please sign in to comment.