Skip to content
This repository was archived by the owner on May 18, 2019. It is now read-only.

Commit 5cf25d1

Browse files
ptaeuberOpenModelica-Hudson
authored andcommitted
Fix for trying without adaptive homotopy
Do not override lambda with 0 (has to be 1). Belonging to [master]: - #2171
1 parent 3418ccf commit 5cf25d1

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

SimulationRuntime/c/simulation/solver/nonlinearSolverHomotopy.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,10 @@ int allocateHomotopyData(int size, void** voiddata)
193193
data->gradFx = (double*) calloc(size,sizeof(double));
194194

195195
/* damped newton */
196-
data->x = (double*) calloc(size,sizeof(double));
197-
data->x0 = (double*) calloc(size,sizeof(double));
196+
data->x = (double*) calloc((size+1),sizeof(double));
197+
data->x0 = (double*) calloc((size+1),sizeof(double));
198198
data->xStart = (double*) calloc(size,sizeof(double));
199-
data->x1 = (double*) calloc(size,sizeof(double));
199+
data->x1 = (double*) calloc((size+1),sizeof(double));
200200
data->finit = (double*) calloc(size,sizeof(double));
201201
data->fx0 = (double*) calloc(size,sizeof(double));
202202
data->fJac = (double*) calloc((size*(size+1)),sizeof(double));
@@ -910,6 +910,8 @@ static int wrapper_fvec(DATA_HOMOTOPY* solverData, double* x, double* f)
910910
void *dataAndThreadData[2] = {solverData->data, solverData->threadData};
911911
int iflag = 0;
912912

913+
if ((solverData->data)->simulationInfo->nonlinearSystemData[solverData->sysNumber].homotopySupport && !solverData->initHomotopy && (solverData->data)->simulationInfo->nonlinearSystemData[solverData->sysNumber].size > solverData->n)
914+
x[solverData->n] = 1.0;
913915
/*TODO: change input to residualFunc from data to systemData */
914916
(solverData->data)->simulationInfo->nonlinearSystemData[solverData->sysNumber].residualFunc(dataAndThreadData, x, f, &iflag);
915917
solverData->numberOfFunctionEvaluations++;

0 commit comments

Comments
 (0)