11 #ifndef CT_BEULERINT_H
12 #define CT_BEULERINT_H
29 enum BEulerMethodType {
44 explicit BEulerErr(
const std::string& msg);
48 #define BEULER_JAC_ANAL 2
49 #define BEULER_JAC_NUM 1
67 virtual void setTolerances(
double reltol,
size_t n,
double* abstol);
73 virtual void reinitializeRJE(
double t0,
ResidJacEval& func);
74 virtual double integrateRJE(
double tout,
double tinit = 0.0);
78 virtual doublereal
step(
double tout);
95 virtual int nEvals()
const;
96 virtual void setMethodBEMT(BEulerMethodType t);
98 virtual void setMaxStep(
double hmax);
99 virtual void setMaxNumTimeSteps(
int);
100 virtual void setNumInitialConstantDeltaTSteps(
int);
102 void print_solnDelta_norm_contrib(
const double*
const soln0,
103 const char*
const s0,
104 const double*
const soln1,
105 const char*
const s1,
106 const char*
const title,
107 const double*
const y0,
108 const double*
const y1,
124 int printSolnNumberToTout,
125 int printSolnFirstSteps = 0,
126 bool dumpJacobians =
false);
137 bool matrixConditioning =
false,
138 bool colScaling =
false,
139 bool rowScaling =
true);
140 virtual void setPrintFlag(
int print_flag);
150 bool printLargest =
false);
151 virtual void setInitialTimeStep(
double delta_t);
162 double,
double,
double*
const,
double*
const,
int);
316 double*
const ydot_comm,
double CJ,
320 int& num_linear_solves,
364 double boundStep(
const double*
const y,
const double*
const step0,
int loglevel);
374 int dampStep(
double,
const double*,
const double*,
375 const double*,
double*,
double*,
458 int m_time_step_attempts;
virtual void setPrintSolnOptions(int printSolnStepInterval, int printSolnNumberToTout, int printSolnFirstSteps=0, bool dumpJacobians=false)
This routine controls when the solution is printed.
double m_time_final
Final time.
int m_numTotalTruncFails
Total Number of time truncation error failures.
virtual void setProblemType(int probtype)
Set the problem type.
int m_printSolnNumberToTout
Number of evenly spaced printouts of the solution If zero, there is no printout from this option defa...
double getPrintTime(double time_current)
Get the next time to print out.
virtual void setIterator(IterType t)
Set the linear iterator.
int m_printSolnStepInterval
Step Interval at which to print out the solution default = 1; If set to zero, there is no printout...
int m_numTotalNewtIts
Number of total Newton iterations.
int m_neq
Number of equations in the ode integrator.
virtual double soln_error_norm(const double *const, bool printLargest=false)
Calculate the solution error norm.
void doNewtonSolve(double, double *, double *, double *, GeneralMatrix &, int)
Compute the undamped Newton step.
int m_failure_counter
Failure Counter -> keeps track of the number of consecutive failures.
BEulerMethodType m_method
MethodType is used to specify how the time step is to be chosen.
bool m_rowScaling
m_rowScaling is a boolean.
double m_reltol
Relative time truncation error tolerances.
void beuler_jac(GeneralMatrix &J, double *const f, double, double, double *const, double *const, int)
double m_t0
Initial time at the start of the integration.
bool m_matrixConditioning
m_matrixConditioning is a boolean.
int m_min_newt_its
Minimum Number of Newton Iterations per nonlinear step. default = 0.
int m_print_flag
Determines the level of printing for each time step.
virtual double & solution(size_t k)
The current value of the solution of equation k.
vector_fp m_abstol
Vector of absolute time truncation error tolerance when not uniform for all variables.
BEulerErr(const std::string &msg)
Exception thrown when a BEuler error is encountered.
IterType m_iter
IterType is used to specify how the nonlinear equations are to be relaxed at each time step...
Wrappers for the function evaluators for Nonlinear solvers and Time steppers.
double delta_t_max
Maximum permissible time step.
Exception class thrown when a BEuler error is encountered.
int solve_nonlinear_problem(double *const y_comm, double *const ydot_comm, double CJ, double time_curr, GeneralMatrix &jac, int &num_newt_its, int &num_linear_solves, int &num_backtracks, int loglevel)
Solve a nonlinear system.
int m_numTotalLinearSolves
Total number of linear iterations.
GeneralMatrix * tdjac_ptr
Pointer to the Jacobian representing the time dependent problem.
virtual void setSolnWeights()
Set the solution weights.
int m_printSolnFirstSteps
Number of initial steps that the solution is printed out. default = 0.
virtual void setColumnScales()
Set the column scaling vector at the current time.
int m_numInitialConstantDeltaTSteps
Number of initial time steps to take where the time truncation error tolerances are not checked...
double * solution()
The current value of the solution of the system of equations.
int m_order
Current integration order.
int m_nfe
Number of function evaluations.
Dense, Square (not sparse) matrices.
virtual void initializeRJE(double t0, ResidJacEval &func)
Find the initial conditions for y and ydot.
virtual void setTolerances(double reltol, size_t n, double *abstol)
Set or reset the number of equations.
Abstract base class for ODE system integrators.
Base class for exceptions thrown by Cantera classes.
int m_maxord
Maximum integration order.
double m_abstols
Absolute time truncation error tolerances, when uniform for all variables.
double time_step_control(int m_order, double time_error_factor)
int dampStep(double, const double *, const double *, const double *, double *, double *, double *, double &, GeneralMatrix &, int &, bool, int &)
int m_max_time_step_attempts
Max time steps allowed.
int nEquations() const
The number of equations.
double filterNewStep(double, double *, double *)
Filter a new step.
int m_jacFormMethod
m_jacFormMethod determines how a matrix is formed.
int m_numTotalConvFails
Total number of convergence failures.
virtual int nEvals() const
Return the total number of function evaluations.
double boundStep(const double *const y, const double *const step0, int loglevel)
Bound the Newton step while relaxing the solution.
bool m_colScaling
m_colScaling is a boolean.
IterType
Specifies the method used for iteration.
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
void internalMalloc()
Internal routine that sets up the fixed length storage based on the size of the problem to solve...
bool m_dumpJacobians
Dump Jacobians to disk. default false.
virtual doublereal step(double tout)
Integrate the system of equations.
Declarations for the class GeneralMatrix which is a virtual base class for matrices handled by solver...
int m_nJacEval
Number of Jacobian Evaluations and factorization steps (they are the same)
void setNonLinOptions(int min_newt_its=0, bool matrixConditioning=false, bool colScaling=false, bool rowScaling=true)
Set the options for the nonlinear method.
void calc_ydot(int, double *, double *)
double m_hmax
Maximum step size.
int m_itol
If m_itol =1 then each component has an individual value of atol.
vector_fp m_ewt
Error Weights. This is a surprisingly important quantity.
int m_time_step_num
Time step number.
void computeResidWts(GeneralMatrix &jac)
Compute Residual Weights.