Skip to content

Commit

Permalink
fix in Kinsol, catch exception
Browse files Browse the repository at this point in the history
change evaluate call in cvode calcfunction 

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@21171 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
niklwors committed Jun 18, 2014
1 parent 05cbd14 commit 10cd1f8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
9 changes: 5 additions & 4 deletions SimulationRuntime/cpp/Solver/CVode/CVode.cpp
Expand Up @@ -349,8 +349,9 @@ void Cvode::CVodeCore()
_events[i] = bool(_zeroSign[i]);

//Event Iteration starten

_mixed_system->handleSystemEvents(_events);
_event_system->getZeroFunc(_zeroVal);
_event_system->getZeroFunc(_zeroVal);
}//EVENT Iteration beendet

// Zustand aus dem System holen
Expand Down Expand Up @@ -462,7 +463,7 @@ void Cvode::giveZeroVal(const double &t,const double *y,double *zeroValue)
_continuous_system->setContinuousStates(y);

// System aktualisieren
_continuous_system->evaluateAll(IContinuous::CONTINUOUS);
_continuous_system->evaluateZeroFuncs(IContinuous::CONTINUOUS);

_event_system->getZeroFunc(zeroValue);

Expand Down Expand Up @@ -500,8 +501,8 @@ const int Cvode::reportErrorMessage(ostream& messageStream)
void Cvode::writeSimulationInfo()
{

/*

/*
src::logger lg;
Expand Down Expand Up @@ -538,8 +539,8 @@ void Cvode::writeSimulationInfo()
BOOST_LOG_SEV(slg, cvode_normal) << " Convergence failures " << "ncfn: " << ncfn ;
*/
*/


//// Solver
Expand Down
8 changes: 7 additions & 1 deletion SimulationRuntime/cpp/Solver/Kinsol/Kinsol.cpp
Expand Up @@ -318,7 +318,13 @@ void Kinsol::calcFunction(const double *y, double *residual)
{
_fValid = true;
_algLoop->setReal(y);
_algLoop->evaluate();
try
{
_algLoop->evaluate();
} catch (std::exception& ex)
{
_fValid = false;
}
_algLoop->getRHS(residual);

for(int i=0;i<_dimSys;i++)
Expand Down

0 comments on commit 10cd1f8

Please sign in to comment.