Skip to content

Commit

Permalink
Fixed minor problem in nonlinear system solver for adevs backend
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@13976 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
smiz committed Nov 20, 2012
1 parent 789617e commit d4c7c45
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions Compiler/Template/CodegenAdevs.tpl
Expand Up @@ -369,6 +369,7 @@ template makeExtraResiduals(list<SimEqSystem> allEquations, String name)
N_Vector y = N_VNew_Serial(NEQ);
N_Vector scale = N_VNew_Serial(NEQ);
void* kmem = KINCreate();
active_model = this;
assert(kmem != NULL);
flag = KINInit(kmem, residualFunc<%index%>, y);
assert(flag == KIN_SUCCESS);
Expand All @@ -381,11 +382,8 @@ template makeExtraResiduals(list<SimEqSystem> allEquations, String name)
>>
;separator="\n"%>
flag = KINSol(kmem,y,KIN_LINESEARCH,scale,scale);
<%crefs |> name hasindex i0 =>
<<
<%cref(name)%> = NV_Ith_S(y,<%i0%>);
>>
;separator="\n"%>
// Save the outcome and calculate any dependent variables
residualFunc<%index%>(y,scale,NULL);
N_VDestroy_Serial(y);
N_VDestroy_Serial(scale);
KINFree(&kmem);
Expand Down

0 comments on commit d4c7c45

Please sign in to comment.