11 #ifndef CT_BEULERINT_H
12 #define CT_BEULERINT_H
36 enum BEulerMethodType {
51 explicit BEulerErr(
const std::string& msg);
55 #define BEULER_JAC_ANAL 2
56 #define BEULER_JAC_NUM 1
73 virtual void setTolerances(
double reltol,
size_t n,
double* abstol);
79 virtual void reinitializeRJE(
double t0,
ResidJacEval& func);
80 virtual double integrateRJE(
double tout,
double tinit = 0.0);
84 virtual doublereal
step(
double tout);
101 virtual int nEvals()
const;
102 virtual void setMethodBEMT(BEulerMethodType t);
104 virtual void setMaxStep(
double hmax);
105 virtual void setMaxNumTimeSteps(
int);
106 virtual void setNumInitialConstantDeltaTSteps(
int);
108 void print_solnDelta_norm_contrib(
const double*
const soln0,
109 const char*
const s0,
110 const double*
const soln1,
111 const char*
const s1,
112 const char*
const title,
113 const double*
const y0,
114 const double*
const y1,
130 int printSolnNumberToTout,
131 int printSolnFirstSteps = 0,
132 bool dumpJacobians =
false);
143 bool matrixConditioning =
false,
144 bool colScaling =
false,
145 bool rowScaling =
true);
146 virtual void setPrintFlag(
int print_flag);
156 bool printLargest =
false);
157 virtual void setInitialTimeStep(
double delta_t);
168 double,
double,
double*
const,
double*
const,
int);
322 double*
const ydot_comm,
double CJ,
326 int& num_linear_solves,
370 double boundStep(
const double*
const y,
const double*
const step0,
int loglevel);
380 int dampStep(
double,
const double*,
const double*,
381 const double*,
double*,
double*,
464 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.
Various templated functions that carry out common vector operations (see Templated Utility Functions)...
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.
This file contains definitions of terms that are used in internal routines and are unlikely to need m...
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.
Class that calculates the solution to a nonlinear, dense, set of equations (see Numerical Utilities w...
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.
Definitions for the classes that are thrown when Cantera experiences an error condition (also contain...
void computeResidWts(GeneralMatrix &jac)
Compute Residual Weights.