Skip to content

Commit

Permalink
Fixing some typos and formatting based on comments for PR #575
Browse files Browse the repository at this point in the history
  • Loading branch information
gkogekar authored and ischoegl committed Jun 14, 2023
1 parent 81f1d06 commit 34e0996
Show file tree
Hide file tree
Showing 13 changed files with 117 additions and 129 deletions.
2 changes: 1 addition & 1 deletion include/cantera/numerics/FuncEval.h
Expand Up @@ -76,7 +76,7 @@ class FuncEval
* @returns 0 for a successful evaluation; 1 after a potentially-
* recoverable error; -1 after an unrecoverable error.
*/
int eval_nothrow(double t, double* y, double* ydot, double* residaul);
int eval_nothrow(double t, double* y, double* ydot, double* residual);

/*! Evaluate the setup processes for the Jacobian preconditioner.
* @param[in] t time.
Expand Down
6 changes: 3 additions & 3 deletions include/cantera/numerics/IDAIntegrator.h
Expand Up @@ -4,7 +4,7 @@
*/

// This file is part of Cantera. See License.txt in the top-level directory or
// at http://www.cantera.org/license.txt for license and copyright information.
// at https://www.cantera.org/license.txt for license and copyright information.

#ifndef CT_IDAIntegrator_H
#define CT_IDAIntegrator_H
Expand Down Expand Up @@ -67,7 +67,7 @@ class IDAIntegrator : public Integrator
//! responsible for integrator failures or unexpected small timesteps.
virtual std::string getErrorInfo(int N);

//! Error message information provide by CVodes
//! Error message information provide by IDAS
std::string m_error_message;

virtual void setMaxNonlinIterations(int n);
Expand All @@ -78,7 +78,7 @@ class IDAIntegrator : public Integrator

protected:
protected:
//! Applies user-specified options to the underlying CVODES solver. Called
//! Applies user-specified options to the underlying IDAS solver. Called
//! during integrator initialization or reinitialization.
void applyOptions();

Expand Down
28 changes: 14 additions & 14 deletions include/cantera/numerics/Integrator.h
Expand Up @@ -3,7 +3,7 @@
*/

/**
* @defgroup intGroup Zero-dimensional Integrators
* @defgroup intGroup Integrators for initial value problems
*/

// This file is part of Cantera. See License.txt in the top-level directory or
Expand Down Expand Up @@ -68,8 +68,8 @@ class Integrator
* @param n Number of equations
* @param abstol array of N absolute tolerance values
*/
virtual void setTolerances(doublereal reltol, size_t n,
doublereal* abstol) {
virtual void setTolerances(double reltol, size_t n,
double* abstol) {
warn("setTolerances");
}

Expand All @@ -78,7 +78,7 @@ class Integrator
* @param reltol scalar relative tolerance
* @param abstol scalar absolute tolerance
*/
virtual void setTolerances(doublereal reltol, doublereal abstol) {
virtual void setTolerances(double reltol, double abstol) {
warn("setTolerances");
}

Expand All @@ -87,7 +87,7 @@ class Integrator
* @param reltol scalar relative tolerance
* @param abstol scalar absolute tolerance
*/
virtual void setSensitivityTolerances(doublereal reltol, doublereal abstol)
virtual void setSensitivityTolerances(double reltol, double abstol)
{ }

//! Set the problem type.
Expand Down Expand Up @@ -164,11 +164,11 @@ class Integrator
* @param t0 initial time
* @param func RHS evaluator object for system of equations.
*/
virtual void initialize(doublereal t0, FuncEval& func) {
virtual void initialize(double t0, FuncEval& func) {
warn("initialize");
}

virtual void reinitialize(doublereal t0, FuncEval& func) {
virtual void reinitialize(double t0, FuncEval& func) {
warn("reinitialize");
}

Expand All @@ -177,7 +177,7 @@ class Integrator
* @param tout Integrate to this time. Note that this is the
* absolute time value, not a time interval.
*/
virtual void integrate(doublereal tout) {
virtual void integrate(double tout) {
warn("integrate");
}

Expand All @@ -186,19 +186,19 @@ class Integrator
* @param tout integrate to this time. Note that this is the
* absolute time value, not a time interval.
*/
virtual doublereal step(doublereal tout) {
virtual double step(double tout) {
warn("step");
return 0.0;
}

//! The current value of the solution of equation k.
virtual doublereal& solution(size_t k) {
virtual double& solution(size_t k) {
warn("solution");
return m_dummy;
}

//! The current value of the solution of the system of equations.
virtual doublereal* solution() {
virtual double* solution() {
warn("solution");
return 0;
}
Expand Down Expand Up @@ -294,8 +294,8 @@ class Integrator
virtual void setMaxNonlinConvFailures(int n) {
warn("setMaxNonlinConvFailures");
}
virtual void inclAlgebraicInErrorTest(bool yesno) {
warn("inclAlgebraicInErrorTest");
virtual void includeAlgebraicInErrorTest(bool yesno) {
warn("includeAlgebraicInErrorTest");
}

protected:
Expand All @@ -308,7 +308,7 @@ class Integrator
// methods for DAE solvers

private:
doublereal m_dummy;
double m_dummy;
void warn(const std::string& msg) const {
writelog(">>>> Warning: method "+msg+" of base class "
+"Integrator called. Nothing done.\n");
Expand Down
14 changes: 7 additions & 7 deletions include/cantera/zeroD/FlowReactor.h
Expand Up @@ -66,7 +66,7 @@ class FlowReactor : public IdealGasReactor
// mark all variables differential equations unless otherwise specified
std::fill(constraints, constraints + m_nv, 1.0);
// the species coverages are algebraic constraints
std::fill(constraints + m_non_spec_eq + m_nsp, constraints + m_nv, 0.0);
std::fill(constraints + m_offset_Y + m_nsp, constraints + m_nv, 0.0);
}


Expand All @@ -79,7 +79,7 @@ class FlowReactor : public IdealGasReactor
return m_u;
}

//! The area of the reactor [m^2]
//! The cross-sectional area of the reactor [m^2]
double area() const {
return m_area;
}
Expand Down Expand Up @@ -110,25 +110,25 @@ class FlowReactor : public IdealGasReactor

//! Set the steady state tolerances used to determine the initial state for
//! surface coverages
void setSteadyStateAtol(double atol) {
void setInletSurfaceAtol(double atol) {
m_ss_atol = atol;
}

//! Set the steady state tolerances used to determine the initial state for
//! surface coverages
void setSteadyStateRtol(double rtol) {
void setInletSurfaceRtol(double rtol) {
m_ss_rtol = rtol;
}

//! Set the steady state tolerances used to determine the initial state for
//! surface coverages
void setSteadyStateMaxSteps(int max_steps) {
void setInletSurfaceMaxSteps(int max_steps) {
m_max_ss_steps = max_steps;
}

//! Set the steady state tolerances used to determine the initial state for
//! surface coverages
void setSteadyStateMaxErrorFailures(int max_fails) {
void setInletSurfaceMaxErrorFailures(int max_fails) {
m_max_ss_error_fails = max_fails;
}

Expand All @@ -144,7 +144,7 @@ class FlowReactor : public IdealGasReactor
protected:
double m_u, m_T, m_P, m_rho;
//! offset to the species equations
const size_t m_non_spec_eq = 4;
const size_t m_offset_Y = 4;
//! reactor area [m^2]
double m_area;
//! reactor surface area to volume ratio [m^-1]
Expand Down
18 changes: 9 additions & 9 deletions include/cantera/zeroD/Reactor.h
Expand Up @@ -97,20 +97,20 @@ class Reactor : public ReactorBase
/*!
* @param[out] y state vector representing the initial state of the reactor
*/
virtual void getState(doublereal* y);
virtual void getState(double* y);

//! Get the current state and derivative vector of the reactor for a DAE solver
/*!
* @param[out] y state vector representing the initial state of the reactor
* @param[out] ydot state vector representing the initial derivatives of the
* reactor
*/
virtual void getState(doublereal* y, doublereal* ydot)
virtual void getState(double* y, double* ydot)
{
throw CanteraError("Reactor::getState", "Not Implemented");
throw CanteraError("Reactor::getState(y, ydot)", "Not Implemented");
}

virtual void initialize(doublereal t0 = 0.0);
virtual void initialize(double t0 = 0.0);

//! Evaluate the reactor governing equations. Called by ReactorNet::eval.
//! @param[in] t time.
Expand All @@ -126,11 +126,11 @@ class Reactor : public ReactorBase
* @param[in] y solution vector, length neq()
* @param[in] ydot rate of change of solution vector, length neq()
* @param[in] params sensitivity parameter vector, length ReactorNet::nparams()
* @param[out] residual resisduals vector, length neq()
* @param[out] residual residuals vector, length neq()
*/
virtual void evalEqs(doublereal t, doublereal* y,
doublereal* ydot, doublereal* params,
doublereal* residual)
virtual void evalEqs(double t, double* y,
double* ydot, double* params,
double* residual)
{
throw CanteraError("Reactor::evalEqs", "Not Implemented");
}
Expand All @@ -145,7 +145,7 @@ class Reactor : public ReactorBase
virtual void syncState();

//! Set the state of the reactor to correspond to the state vector *y*.
virtual void updateState(doublereal* y);
virtual void updateState(double* y);

//! Number of sensitivity parameters associated with this reactor
//! (including walls)
Expand Down
34 changes: 17 additions & 17 deletions include/cantera/zeroD/ReactorNet.h
Expand Up @@ -69,27 +69,27 @@ class ReactorNet : public FuncEval
void setSensitivityTolerances(double rtol, double atol);

//! Current value of the simulation time.
doublereal time() {
double time() {
return m_time;
}

//! Relative tolerance.
doublereal rtol() {
double rtol() {
return m_rtol;
}

//! Absolute integration tolerance
doublereal atol() {
double atol() {
return m_atols;
}

//! Relative sensitivity tolerance
doublereal rtolSensitivity() const {
double rtolSensitivity() const {
return m_rtolsens;
}

//! Absolute sensitivity tolerance
doublereal atolSensitivity() const {
double atolSensitivity() const {
return m_atolsens;
}

Expand All @@ -105,7 +105,7 @@ class ReactorNet : public FuncEval
* timesteps as necessary to reach *time*.
* @param time Time to advance to (s).
*/
void advance(doublereal time);
void advance(double time);

/**
* Advance the state of all reactors in time. Take as many internal
Expand Down Expand Up @@ -150,7 +150,7 @@ class ReactorNet : public FuncEval

//! Update the state of all the reactors in the network to correspond to
//! the values in the solution vector *y*.
void updateState(doublereal* y);
void updateState(double* y);

//! Return the sensitivity of the *k*-th solution component with respect to
//! the *p*-th sensitivity parameter.
Expand Down Expand Up @@ -187,8 +187,8 @@ class ReactorNet : public FuncEval
* @param[in] p sensitivity parameter vector (unused?)
* @param[out] j Jacobian matrix, size neq() by neq().
*/
void evalJacobian(doublereal t, doublereal* y,
doublereal* ydot, doublereal* p, Array2D* j);
void evalJacobian(double t, double* y,
double* ydot, double* p, Array2D* j);

// overloaded methods of class FuncEval
virtual size_t neq() {
Expand All @@ -199,21 +199,21 @@ class ReactorNet : public FuncEval
return m_reactors.size();
}

virtual void eval(doublereal t, doublereal* y,
doublereal* ydot, doublereal* p);
virtual void eval(double t, double* y,
double* ydot, double* p);

//! eval coupling for IDA / DAEs
virtual void eval(doublereal t, doublereal* y,
doublereal* ydot, doublereal* p,
doublereal* residaul);
virtual void eval(double t, double* y,
double* ydot, double* p,
double* residaul);

virtual void getState(doublereal* y);
virtual void getState(double* y);

//! Return k-th derivative at the current time
virtual void getDerivative(int k, double* dky);
virtual void getState(doublereal* y, doublereal* ydot);
virtual void getState(double* y, double* ydot);

virtual void getConstraints(doublereal* constraints);
virtual void getConstraints(double* constraints);

virtual size_t nparams() {
return m_sens_params.size();
Expand Down
8 changes: 4 additions & 4 deletions interfaces/cython/cantera/reactor.pxd
Expand Up @@ -59,10 +59,10 @@ cdef extern from "cantera/zerodim.h" namespace "Cantera":
double area() except +translate_exception
void setSurfaceAreaToVolumeRatio(double) except +translate_exception
double surfaceAreaToVolumeRatio() except +translate_exception
void setSteadyStateAtol(double) except +translate_exception
void setSteadyStateRtol(double) except +translate_exception
void setSteadyStateMaxSteps(int) except +translate_exception
void setSteadyStateMaxErrorFailures(int) except +translate_exception
void setInletSurfaceAtol(double) except +translate_exception
void setInletSurfaceRtol(double) except +translate_exception
void setInletSurfaceMaxSteps(int) except +translate_exception
void setInletSurfaceMaxErrorFailures(int) except +translate_exception

# walls
cdef cppclass CxxWallBase "Cantera::WallBase":
Expand Down
16 changes: 8 additions & 8 deletions interfaces/cython/cantera/reactor.pyx
Expand Up @@ -478,29 +478,29 @@ cdef class FlowReactor(Reactor):
def __set__(self, area):
(<CxxFlowReactor*>self.reactor).setArea(area)

property steady_state_atol:
property inlet_surface_atol:
""" Set the steady-state tolerances used to determine the initial surface
species coverages"""
def __set__(self, atol):
(<CxxFlowReactor*>self.reactor).setSteadyStateAtol(atol)
(<CxxFlowReactor*>self.reactor).setInletSurfaceAtol(atol)

property steady_state_rtol:
property inlet_surface_rtol:
""" Set the steady-state tolerances used to determine the initial surface
species coverages"""
def __set__(self, rtol):
(<CxxFlowReactor*>self.reactor).setSteadyStateRtol(rtol)
(<CxxFlowReactor*>self.reactor).setInletSurfaceRtol(rtol)

property steady_state_max_steps:
property inlet_surface_max_steps:
""" Set the maximum number of integrator steps used to determine the initial surface
species coverages"""
def __set__(self, nsteps):
(<CxxFlowReactor*>self.reactor).setSteadyStateMaxSteps(nsteps)
(<CxxFlowReactor*>self.reactor).setInletSurfaceMaxSteps(nsteps)

property steady_state_max_error_failures:
property inlet_surface_max_error_failures:
""" Set the maximum number of integrator error failures allowed when determining
the initial surface species coverages"""
def __set__(self, nsteps):
(<CxxFlowReactor*>self.reactor).setSteadyStateMaxErrorFailures(nsteps)
(<CxxFlowReactor*>self.reactor).setInletSurfaceMaxErrorFailures(nsteps)

property surface_area_to_volume_ratio:
""" Get/set the surface area to volume ratio of the reactor [m^-1] """
Expand Down

0 comments on commit 34e0996

Please sign in to comment.