Skip to content

Commit

Permalink
Change input tol of Newton solver to 2-norm
Browse files Browse the repository at this point in the history
ticket:3923
  • Loading branch information
ptaeuber authored and OpenModelica-Hudson committed May 24, 2016
1 parent 7b5e81b commit 737e024
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
4 changes: 2 additions & 2 deletions SimulationRuntime/c/simulation/solver/model_help.c
Expand Up @@ -53,8 +53,8 @@
int maxEventIterations = 20;
double linearSparseSolverMaxDensity = 0.2;
int linearSparseSolverMinSize = 4001;
double newtonXTol = 1e-24;
double newtonFTol = 1e-24;
double newtonXTol = 1e-12;
double newtonFTol = 1e-12;
const size_t SIZERINGBUFFER = 3;
int compiledInDAEMode = 0;

Expand Down
Expand Up @@ -150,8 +150,8 @@ int allocateHomotopyData(int size, void** voiddata)
data->initialized = 0;
data->n = size;
data->m = size + 1;
data->xtol = newtonXTol;
data->ftol = newtonFTol;
data->xtol = newtonXTol*newtonXTol;
data->ftol = newtonFTol*newtonFTol;

data->error_f = 0;

Expand Down Expand Up @@ -1279,7 +1279,7 @@ static int newtonAlgorithm(DATA_HOMOTOPY* solverData, double* x)


/* debug information */
debugString(LOG_NLS_V, "error measurements:");
debugString(LOG_NLS_V, "error measurements (squared):");
debugDouble(LOG_NLS_V, "delta_x =", delta_x);
debugDouble(LOG_NLS_V, "delta_x_scaled =", delta_x_scaled);
debugDouble(LOG_NLS_V, "eps_x =", solverData->xtol);
Expand Down
14 changes: 8 additions & 6 deletions SimulationRuntime/c/util/simulation_options.c
Expand Up @@ -148,8 +148,8 @@ const char *FLAG_DESC[FLAG_MAX+1] = {
/* FLAG_MAX_ORDER */ "value specifies maximum integration order, used by dassl solver",
/* FLAG_MAX_STEP_SIZE */ "value specifies maximum absolute step size, used by dassl solver",
/* FLAG_MEASURETIMEPLOTFORMAT */ "value specifies the output format of the measure time functionality",
/* FLAG_NEWTON_FTOL */ "[double (default 1e-24)] tolerance for accepting accuracy in Newton solver",
/* FLAG_NEWTON_XTOL */ "[double (default 1e-24)] tolerance for updating solution vector in Newton solver",
/* FLAG_NEWTON_FTOL */ "[double (default 1e-12)] tolerance respecting residuals for updating solution vector in Newton solver",
/* FLAG_NEWTON_XTOL */ "[double (default 1e-12)] tolerance respecting newton correction (delta_x) for updating solution vector in Newton solver",
/* FLAG_NEWTON_STRATEGY */ "value specifies the damping strategy for the newton solver",
/* FLAG_NLS */ "value specifies the nonlinear solver",
/* FLAG_NLS_INFO */ "outputs detailed information about solving process of non-linear systems into csv files.",
Expand Down Expand Up @@ -290,11 +290,13 @@ const char *FLAG_DETAILED_DESC[FLAG_MAX+1] = {
" * gif\n"
" * ...",
/* FLAG_NEWTON_FTOL */
" Tolerance for accepting accuracy in Newton solver."
" The value is a Double with default value 1e-24.",
" Tolerance respecting residuals for updating solution vector in Newton solver."
" Solution is accepted if the (scaled) 2-norm of the residuals is smaller than the tolerance newtonFTol and the (scaled) newton correction (delta_x) is smaller than the tolerance newtonXTol."
" The value is a Double with default value 1e-12.",
/* FLAG_NEWTON_XTOL */
" Tolerance for updating solution vector in Newton solver."
" The value is a Double with default value 1e-24.",
" Tolerance respecting newton correction (delta_x) for updating solution vector in Newton solver."
" Solution is accepted if the (scaled) 2-norm of the residuals is smaller than the tolerance newtonFTol and the (scaled) newton correction (delta_x) is smaller than the tolerance newtonXTol."
" The value is a Double with default value 1e-12.",
/* FLAG_NEWTON_STRATEGY */
" Value specifies the damping strategy for the newton solver.",
/* FLAG_NLS */
Expand Down

0 comments on commit 737e024

Please sign in to comment.