Skip to content

Commit

Permalink
fix for Chuacircuit in Cvode an kinsol
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@21283 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
niklwors committed Jun 25, 2014
1 parent 01c76a6 commit acfdc86
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
17 changes: 9 additions & 8 deletions SimulationRuntime/cpp/Solver/CVode/CVode.cpp
Expand Up @@ -155,7 +155,7 @@ void Cvode::initialize()
if(_idid < 0)
throw std::invalid_argument("CVode::initialize()");

_idid = CVodeSetMaxStep(_cvodeMem, global_settings->getEndTime()/100); // MAXIMUM STEPSIZE
_idid = CVodeSetMaxStep(_cvodeMem, global_settings->getEndTime()/10.0); // MAXIMUM STEPSIZE
if(_idid < 0)
throw std::invalid_argument("CVode::initialize()");

Expand Down Expand Up @@ -209,10 +209,11 @@ void Cvode::solve(const SOLVERCALL action)
initialize();
writeToFile(0, _tCurrent, _h);
_tLastWrite = 0;


return;
}

if(action & RECORDCALL)
if(action & RECORDCALL && !(action & FIRST_CALL))
{
writeToFile(_accStps, _tCurrent, _h);
return;
Expand All @@ -222,9 +223,10 @@ void Cvode::solve(const SOLVERCALL action)
if(action & RECALL)
{
_firstStep = true;
writeCVodeOutput(_tCurrent,_h,_locStps);
if (_cvodesettings->getEventOutput())
writeToFile(0, _tCurrent, _h);
if (_cvodesettings->getEventOutput())
writeToFile(0, _tCurrent, _h);
//else
writeCVodeOutput(_tCurrent,_h,_locStps);
}

// Solver soll fortfahren
Expand Down Expand Up @@ -276,7 +278,7 @@ void Cvode::CVodeCore()
{
_idid = CVodeReInit(_cvodeMem, _tCurrent, _CV_y);
_idid = CVodeSetStopTime(_cvodeMem, _tEnd);
_idid = CVodeSetInitStep(_cvodeMem, 1e-12);
_idid = CVodeSetInitStep(_cvodeMem, 1e-6);
if(_idid <0)
throw std::runtime_error("CVode::ReInit");

Expand Down Expand Up @@ -383,7 +385,6 @@ void Cvode::CVodeCore()
_continuous_system->evaluateODE(IContinuous::CONTINUOUS);
writeToFile(0, _tEnd, _h);
_solverStatus = DONE;
writeToFile(0, _tEnd, _h);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions SimulationRuntime/cpp/Solver/Kinsol/Kinsol.cpp
Expand Up @@ -394,8 +394,8 @@ void Kinsol::solveNLS()
double
maxStepsStart = 1e3*max(euclidNorm(_dimSys,_yScale),euclidNorm(_dimSys,_yScale)),
maxSteps = maxStepsStart,
maxStepsHigh = 1e16,
maxStepsLow = 1e-3,
maxStepsHigh = 1e8,
maxStepsLow = 1,
limit = maxStepsHigh;

while(_iterationStatus == CONTINUE)
Expand Down

0 comments on commit acfdc86

Please sign in to comment.