Skip to content

Commit be79c29

Browse files
author
Willi Braun
committed
- nonlinear solver: don't start solver if is already solved.
- now LossyGearDemo2 does work. - minor changes (fix some debug outputs and correct test) git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@13615 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
1 parent 5b88390 commit be79c29

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

SimulationRuntime/c/math-support/nonlinearSolverHybrd.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,15 @@ int solveHybrd(DATA *data, int sysNumber) {
191191
}
192192
}
193193

194+
/* check if system is already solved then do nothing */
195+
wrapper_fvec_hybrd(&solverData->n, systemData->nlsx, solverData->fvec, &solverData->info, data);
196+
xerror = enorm_(&solverData->n, solverData->fvec);
197+
/* solution found */
198+
if (xerror <= local_tol) {
199+
success = 1;
200+
}
201+
202+
194203
/* start solving loop */
195204
while (!giveUp && !success) {
196205

SimulationRuntime/c/simulation/solver/dassl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ int function_ZeroCrossingsDASSL(fortran_integer *neqm, double *t, double *y,
513513
for (i=0; i < *ng; i++) {
514514
if (data->simulationInfo.zeroCrossings[i] != gout[i]){
515515
INFO_AL1("| | %s", zeroCrossingDescription[i]);
516-
INFO_AL2("| | changed : %s <> %s", (data->simulationInfo.zeroCrossings[i]>0)?"TRUE ":"FALSE", (gout[i]>0)?"TRUE ":"FALSE");
516+
INFO_AL2("| | changed : %s -> %s", (data->simulationInfo.zeroCrossings[i]>0)?"TRUE ":"FALSE", (gout[i]>0)?"TRUE ":"FALSE");
517517
}
518518
}
519519
}

SimulationRuntime/c/simulation/solver/events.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ modelica_boolean checkForNewEvent(DATA* data, LIST *eventList)
398398
{
399399
if (DEBUG_FLAG(LOG_EVENTS | LOG_ZEROCROSSINGS)){
400400
INFO_AL1("| | %s", zeroCrossingDescription[i]);
401-
INFO_AL2("| | changed: %s -> %s", (data->simulationInfo.zeroCrossings[i]>0)?"TRUE ":"FALSE", (data->simulationInfo.zeroCrossingsPre[i]>0)?"TRUE ":"FALSE");
401+
INFO_AL2("| | changed: %s -> %s", (data->simulationInfo.zeroCrossingsPre[i]>0)?"TRUE ":"FALSE", (data->simulationInfo.zeroCrossings[i]>0)?"TRUE ":"FALSE");
402402
}
403403
listPushFront(eventList, &(data->simulationInfo.zeroCrossingIndex[i]));
404404
}

0 commit comments

Comments
 (0)