Skip to content

Commit

Permalink
- fix bug in newton solver with fvec
Browse files Browse the repository at this point in the history
  • Loading branch information
ptaeuber authored and OpenModelica-Hudson committed Aug 5, 2015
1 parent 3236596 commit 799bcc3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Compiler/SimCode/SimCodeUtil.mo
Expand Up @@ -339,9 +339,9 @@ algorithm
SymbolicJacsNLS := listAppend(SymbolicJacsTemp, SymbolicJacsNLS);

if Flags.isSet(Flags.DYNAMIC_TEARING_INFO) then
print("\n\n*********************\n* SimCode Equations *\n*********************\n\ninitialEquations:\n:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=\n" + dumpSimEqSystemLst(initialEquations) + "\n");
print("\n\nparameterEquations:\n:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=\n" + dumpSimEqSystemLst(parameterEquations) + "\n");
print("\n\nallEquations:\n:=:=:=:=:=:=:=:=:=:=:=:=:=\n" + dumpSimEqSystemLst(allEquations) + "\n\n");
print("\n\n*********************\n* SimCode Equations *\n*********************\n\ninitialEquations:\n=================\n" + dumpSimEqSystemLst(initialEquations) + "\n");
print("\n\nparameterEquations:\n===================\n" + dumpSimEqSystemLst(parameterEquations) + "\n");
print("\n\nallEquations:\n=============\n" + dumpSimEqSystemLst(allEquations) + "\n\n");
end if;

// collect symbolic jacobians from state selection
Expand Down
2 changes: 2 additions & 0 deletions SimulationRuntime/c/simulation/solver/newtonIteration.c
Expand Up @@ -208,6 +208,8 @@ int _omc_newton(int(*f)(int*, double*, double*, void*, int), DATA_NEWTON* solver

error_f = current_fvec_enorm = enorm_(n, fvec);

memcpy(solverData->fvecScaled, solverData->fvec, *n*sizeof(double));

while(error_f > *eps && scaledError_f > *eps && delta_x > *eps && delta_f > *eps && delta_x_scaled > *eps)
{
if(ACTIVE_STREAM(LOG_NLS_V))
Expand Down

0 comments on commit 799bcc3

Please sign in to comment.