15 #ifndef CT_NONLINEARSOLVER_H
16 #define CT_NONLINEARSOLVER_H
30 #define NSOLN_TYPE_PSEUDO_TIME_DEPENDENT 2
32 #define NSOLN_TYPE_TIME_DEPENDENT 1
34 #define NSOLN_TYPE_STEADY_STATE 0
44 #define NSOLN_RETN_SUCCESS 1
46 #define NSOLN_RETN_CONTINUE 0
49 #define NSOLN_RETN_FAIL_STEPTOOSMALL -1
51 #define NSOLN_RETN_FAIL_DAMPSTEP -2
53 #define NSOLN_RETN_MATRIXINVERSIONERROR -3
55 #define NSOLN_RETN_JACOBIANFORMATIONERROR -4
57 #define NSOLN_RETN_RESIDUALFORMATIONERROR -5
59 #define NSOLN_RETN_MAXIMUMITERATIONSEXCEEDED -7
66 #define NSOLN_JAC_NUM 1
68 #define NSOLN_JAC_ANAL 2
192 doublereal
solnErrorNorm(
const doublereal*
const delta_y,
const char* title = 0,
int printLargest = 0,
193 const doublereal dampFactor = 1.0)
const;
212 doublereal
residErrorNorm(
const doublereal*
const resid,
const char* title = 0,
const int printLargest = 0,
213 const doublereal*
const y = 0)
const;
231 int doResidualCalc(
const doublereal time_curr,
const int typeCalc,
const doublereal*
const y_curr,
232 const doublereal*
const ydot_curr,
258 int doNewtonSolve(
const doublereal time_curr,
const doublereal*
const y_curr,
259 const doublereal*
const ydot_curr, doublereal*
const delta_y,
345 void fillDogLegStep(
int leg, doublereal alpha, std::vector<doublereal> & deltaX)
const;
392 doublereal
boundStep(
const doublereal*
const y,
const doublereal*
const step0);
401 const doublereal*
const y_high_bounds);
418 void calc_ydot(
const int order,
const doublereal*
const y_curr, doublereal*
const ydot_curr)
const;
440 doublereal time_curr, doublereal CJ, doublereal*
const y,
441 doublereal*
const ydot,
int num_newt_its);
451 doublereal
filterNewStep(
const doublereal timeCurrent,
const doublereal*
const ybase, doublereal*
const step0);
461 doublereal
filterNewSolution(
const doublereal timeCurrent, doublereal*
const y_current,
462 doublereal*
const ydot_current);
480 doublereal
deltaBoundStep(
const doublereal*
const y,
const doublereal*
const step0);
508 int dampStep(
const doublereal time_curr,
const doublereal*
const y_n_curr,
509 const doublereal*
const ydot_n_curr, doublereal*
const step_1,
510 doublereal*
const y_n_1, doublereal*
const ydot_n_1, doublereal* step_2,
512 int& num_backtracks);
541 int solve_nonlinear_problem(
int SolnType, doublereal*
const y_comm, doublereal*
const ydot_comm, doublereal CJ,
543 int& num_linear_solves,
int& num_backtracks,
int loglevelInput);
571 void setColumnScaling(
bool useColScaling,
const double*
const scaleFactors = 0);
591 doublereal time_curr,
int num_newt_its);
609 const doublereal*
const step_2,
const char*
const stepNorm_2,
610 const char*
const title,
const doublereal*
const y_n_curr,
611 const doublereal*
const y_n_1, doublereal damp,
size_t num_entries);
630 void getResidWts(doublereal*
const residWts)
const;
658 void setAtol(
const doublereal*
const atol);
666 void setRtol(
const doublereal rtol);
695 void setResidualTols(
double residRtol,
double* residATol,
int residNormHandling = 2);
743 void descentComparison(doublereal time_curr ,doublereal* ydot0, doublereal* ydot1,
int& numTrials);
761 int lambdaToLeg(
const doublereal lambda, doublereal& alpha)
const;
820 int dampDogLeg(
const doublereal time_curr,
const doublereal* y_n_curr,
821 const doublereal* ydot_n_curr, std::vector<doublereal> & step_1,
822 doublereal*
const y_n_1, doublereal*
const ydot_n_1,
823 doublereal& stepNorm_1, doublereal& stepNorm_2,
GeneralMatrix& jac,
int& num_backtracks);
852 int decideStep(
const doublereal time_curr,
int leg, doublereal alpha,
const doublereal*
const y_n_curr,
853 const doublereal*
const ydot_n_curr,
854 const std::vector<doublereal> & step_1,
855 const doublereal*
const y_n_1,
const doublereal*
const ydot_n_1, doublereal trustDeltaOld);
877 doublereal& alphaBest)
const;