This commit is contained in:
Dave Goodwin 2004-08-28 16:12:41 +00:00
parent c951c50f11
commit ab8f620ccb
27 changed files with 60 additions and 352 deletions

View file

@ -1,9 +1,8 @@
/**
* @file Array.h
*
* Header file for class Array2D
*
* $Author$
* @file ArrayViewer.h
*/
/* $Author$
* $Revision$
* $Date$
*

View file

@ -50,9 +50,6 @@ namespace Cantera {
}
}
/**
* Solve Ax = b. Array b is overwritten on exit with x.
*/
int solve(DenseMatrix& A, double* b) {
int info=0;
ct_dgetrf(static_cast<int>(A.nRows()),
@ -72,7 +69,6 @@ namespace Cantera {
return 0;
}
/** Solve Ax = b for multiple right-hand-side vectors. */
int solve(DenseMatrix& A, DenseMatrix& b) {
int info=0;
ct_dgetrf(static_cast<int>(A.nRows()),

View file

@ -98,7 +98,6 @@ namespace Cantera {
m_redo_rates = true;
}
//@}
/**
* @name Reaction Rates Of Progress
*/

View file

@ -1,6 +1,6 @@
/**
*
* @file GasKinetics.h
* @file GRI_30_Kinetics.h
*
*/

View file

@ -1,6 +1,6 @@
/**
*
* @file GasKinetics.h
* @file GasKineticsWriter.h
*
* $Author$
* $Revision$

View file

@ -105,9 +105,6 @@ namespace Cantera {
m_redo_rates = true;
}
//@}
///
/// @name Reaction Rates Of Progress
///

View file

@ -1,5 +1,5 @@
/**
* @file PureFluid.h
* @file PureFluidPhase.h
*
* Declares class PureFluid
*/

View file

@ -39,24 +39,25 @@ namespace Cantera {
* quantities may be called.
*
* The nomenclature used below to document the methods is as follows.
*
* - \f$ N_r \f$
* - Integer reactant stoichiometric coefficient matrix. The (k,i)
* Integer reactant stoichiometric coefficient matrix. The (k,i)
* element of this matrix is the stoichiometric coefficient of
* species \i k as a reactant in reaction \i i.
* - \f$ N_p \f$
* - Integer product stoichiometric coefficient matrix. The (k,i)
* Integer product stoichiometric coefficient matrix. The (k,i)
* element of this matrix is the stoichiometric coefficient of
* species \i k as a product in reaction \i i.
* - \f$ Q_{\rm fwd} \f$
* - Vector of length I of forward rates of progress.
* Vector of length I of forward rates of progress.
* - \f$ Q_{\rm rev} \f$
* - Vector of length I of reverse rates of progress.
* Vector of length I of reverse rates of progress.
* - \f$ C \f$
* - Vector of K species creation rates.
* Vector of K species creation rates.
* - \f$ D \f$
* - Vector of K species destruction rates.
* Vector of K species destruction rates.
* - \f$ W = C - D \f$
* - Vector of K species net production rates.
* Vector of K species net production rates.
*
*/
class ReactionStoichMgr {

View file

@ -1,4 +1,4 @@
/**
/*
* $Id$
*/

View file

@ -20,12 +20,6 @@ using namespace std;
namespace Cantera {
///////////////////////////////////////////////////////////////
//
// Helper Template Functions
//
///////////////////////////////////////////////////////////////
/**
* Invokes the 'updateProperties' method of all objects in the
* list.
@ -180,8 +174,8 @@ namespace Cantera {
map<int, int> speciesToType;
};
#define REMOVE_FOR_V155
#ifndef REMOVE_FOR_V155
//#define REMOVE_FOR_V155
//#ifndef REMOVE_FOR_V155
/**
* This species thermo manager requires that all species have the
@ -246,7 +240,7 @@ namespace Cantera {
vector<T> m_thermo;
doublereal m_pref;
};
#endif
//#endif
}

View file

@ -376,7 +376,7 @@ namespace Cantera {
}
/**
/*
* This class handles operations involving the stoichiometric
* coefficients on one side of a reaction (reactant or product) for
* a set of reactions comprising a reaction mechanism. This class is
@ -393,7 +393,7 @@ namespace Cantera {
* r_i = \sum_m^{M_i} s_{k_{m,i}}
* \f]
* To understand the operations performed by this class, let
* $N_{k,i}$ denote the stoichiometric coefficient of species k on
* \f$ N_{k,i}\f$ denote the stoichiometric coefficient of species k on
* one side (reactant or product) in reaction i. Then \b N is a sparse
* K by I matrix of stoichiometric coefficients.
*

View file

@ -72,7 +72,7 @@ namespace Cantera {
* stoichiometric substance, the molar internal energy is
* independent of pressure. Since the thermodynamic properties
* are specified by giving the standard-state enthalpy, the
* term \f$ P_0 \hat v$ is subtracted from the specified molar
* term \f$ P_0 \hat v\f$ is subtracted from the specified molar
* enthalpy to compute the molar internal energy.
*/
virtual doublereal intEnergy_mole() const {
@ -99,7 +99,7 @@ namespace Cantera {
/**
* Molar heat capacity at constant pressure. Units: J/kmol/K.
* For an incompressible substance, \f$ \hat c_p = \hat c_v$.
* For an incompressible substance, \f$ \hat c_p = \hat c_v\f$.
*/
virtual doublereal cp_mole() const {
_updateThermo();
@ -108,7 +108,7 @@ namespace Cantera {
/**
* Molar heat capacity at constant volume. Units: J/kmol/K.
* For an incompressible substance, \f$ \hat c_p = \hat c_v$.
* For an incompressible substance, \f$ \hat c_p = \hat c_v\f$.
*/
virtual doublereal cv_mole() const {
return cp_mole();

View file

@ -206,8 +206,9 @@ namespace Cantera {
/**
* This method returns an array of generalized concentrations
* \f$ C_k \f$ that are defined such that \f$ a_k = C_k /
* C^0_k, \f$ where \f$ C^0_k \f$ is a standard concentration
* \f$ C_k\f$ that are defined such that
* \f$ a_k = C_k / C^0_k, \f$ where \f$ C^0_k \f$
* is a standard concentration
* defined below. These generalized concentrations are used
* by kinetics manager classes to compute the forward and
* reverse rates of elementary reactions.
@ -245,8 +246,8 @@ namespace Cantera {
return -1.0;
}
/** Get the array of chemical potentials at unit activity \f$
* \mu^0_k \f$.
/** Get the array of chemical potentials at unit activity
* \f$ \mu^0_k \f$.
*/
virtual void getStandardChemPotentials(doublereal* mu) const {
err("getStandardChemPotentials");
@ -274,8 +275,8 @@ namespace Cantera {
int sizeUA = 6);
/**
* Get the array of non-dimensional chemical potentials \f$
* \mu_k / \hat R T \f$.
* Get the array of non-dimensional chemical potentials
* \f$ \mu_k / \hat R T \f$.
*/
virtual void getChemPotentials_RT(doublereal* mu) const {
err("getChemPotentials_RT");
@ -290,7 +291,7 @@ namespace Cantera {
/**
* Get the species electrochemical potentials. Units: J/kmol.
* This method adds a term \f$ Fz_k \phi_k$ to the
* This method adds a term \f$ Fz_k \phi_k \f$ to the
* to each chemical potential.
*/
void getElectrochemPotentials(doublereal* mu) const {
@ -432,7 +433,6 @@ namespace Cantera {
}
//@}
/// @internal
doublereal _RT() const {
return temperature() * GasConstant;
}
@ -491,15 +491,17 @@ namespace Cantera {
//@}
/**
* @internal
* @name Chemical Equilibrium
* Chemical equilibrium.
* @{
*
*/
/**
* This method is used by the ChemEquil equilibrium solver.
* It sets the state such that the chemical potentials satisfy
* \f[ \frac{\mu_k}{\hat R T} = \sum_m A_{k,m}
* \left(\frac{\lambda_m} {\hat R T}\right) \f] where \f$
* \lambda_m \f$ is the element potential of element m. The
* \left(\frac{\lambda_m} {\hat R T}\right) \f] where
* \f$ \lambda_m \f$ is the element potential of element m. The
* temperature is unchanged. Any phase (ideal or not) that
* implements this method can be equilibrated by ChemEquil.
*/

View file

@ -6,7 +6,10 @@
// Copyright 2001 California Institute of Technology
//
// $Log$
// Revision 1.12 2004-08-05 14:56:57 dggoodwin
// Revision 1.13 2004-08-28 16:12:41 dggoodwin
// cleanup
//
// Revision 1.12 2004/08/05 14:56:57 dggoodwin
// *** empty log message ***
//
// Revision 1.11 2004/07/27 14:22:31 dggoodwin
@ -76,9 +79,6 @@ namespace ckr {
static int parseGroupString(string str, vector<string>& esyms,
vector_int& result);
/// @internal
//static string dummy_string;
/**
* Throw an exception if one of the four lines that must have
* 1, 2, 3, or 4 in column 80 do not.

View file

@ -1,5 +1,5 @@
/**
* @file Element.h
* @file converters/Group.h
*
*/

View file

@ -247,11 +247,7 @@ namespace ckr {
Reaction forwardReaction(const Reaction& rxn);
Reaction reverseReaction(const Reaction& rxn);
}
/**
* @file Reaction.h
* Definitions of reaction-related classes.
* @author California Institute of Technology, Caltech
*/

View file

@ -1,5 +1,5 @@
/**
* @file atomicWeightsDB.cpp
* @file atomicWeightDB.cpp
*
* internal database of default atomic weights
*
@ -13,9 +13,7 @@
#pragma warning(disable:4786)
#endif
//#include "../../config.h"
#include <map>
//#include "../Cantera/src/ctmap.h"
#include <string>
#include <iostream>
using namespace std;

View file

@ -13,12 +13,6 @@ namespace ckr {
}
/**
* @file config.h
* Header file generated by configure script. To change options,
* edit config.h.in and re-run configure.
* @author David G. Goodwin, Caltech
*/
#endif

View file

@ -1,5 +1,5 @@
/**
* @file importCK.cpp
* @file filter.cpp
*
*/

View file

@ -11,13 +11,6 @@
#pragma warning(disable:4786)
#endif
/**
* @file thermoFunctions.cpp
* Species thermodynamic properties implementation.
* @author California Institute of Technology, Caltech
* @date @today
*/
#include <math.h>
#include "thermoFunctions.h"
#include <iostream>

View file

@ -1,102 +0,0 @@
/**
* @file newton_utils.cpp
*/
#ifdef WIN32
#pragma warning(disable:4786)
#pragma warning(disable:4503)
#endif
#include "ct_defs.h"
#include "Resid1D.h"
namespace Cantera {
class Indx {
public:
Indx(int nv, int np) : m_nv(nv), m_np(np) {}
int m_nv, m_np;
int operator()(int m, int j) { return j*m_nv + m; }
};
doublereal bound_step(const doublereal* x, const doublereal* step,
Resid1D& r, int loglevel=0) {
char buf[100];
int np = r.nPoints();
int nv = r.nComponents();
Indx index(nv, np);
doublereal above, below, val, newval;
int m, j;
doublereal fbound = 1.0;
bool wroteTitle = false;
for (m = 0; m < nv; m++) {
above = r.upperBound(m);
below = r.lowerBound(m);
for (j = 0; j < np; j++) {
val = x[index(m,j)];
if (loglevel > 0) {
if (val > above + Tiny || val < below - Tiny)
cout << "ERROR: solution out of bounds. "
<< r.componentName(m) << "(" << j << ") = " << val
<< " (" << below << ", " << above << ")" << endl;
}
newval = val + step[index(m,j)];
if (newval > above) {
fbound = fmaxx( 0.0, fminn( fbound,
(above - val)/(newval - val)));
}
else if (newval < below) {
fbound = fminn(fbound, (val - below)/(val - newval));
}
if (loglevel > 1 && (newval > above || newval < below)) {
if (!wroteTitle) {
writelog("\nNewton step takes solution out of bounds.\n\n");
sprintf(buf," %12s %4s %10s %10s %10s %10s\n",
"component","pt","value","step","min","max");
wroteTitle = true;
writelog(buf);
}
sprintf(buf, " %12s %4i %10.3e %10.3e %10.3e %10.3e\n",
r.componentName(m).c_str(), j, val,
step[index(m,j)], below, above);
writelog(buf);
}
}
}
return fbound;
}
doublereal norm_square(const doublereal* x,
const doublereal* step, Resid1D& r) {
doublereal f, ewt, esum, sum = 0.0;
int n, j;
int nv = r.nComponents();
int np = r.nPoints();
//int jmx = 0, nmx = 0;
//doublereal fmx = -1.0;
for (n = 0; n < nv; n++) {
esum = 0.0;
for (j = 0; j < np; j++) esum += fabs(x[nv*j + n]);
ewt = r.rtol(n)*esum/np + r.atol(n);
for (j = 0; j < np; j++) {
f = step[nv*j + n]/ewt;
sum += f*f;
// if (fabs(f) > fmx) {
// fmx = fabs(f);
// jmx = j;
// nmx = n;
// }
}
}
return sum;
}
}

View file

@ -1,88 +0,0 @@
/**
*
* @file Jac1D.h
*
* >>>>> Under construction! <<<<<
*
* $Author$
* $Date$
* $Revision$
*
* Copyright 2002 California Institute of Technology
*
*/
#ifndef CT_JAC1D_H
#define CT_JAC1D_H
#include "Domain1D.h"
#include "BandMatrix.h"
//#include "ArrayViewer.h"
#include "Array.h"
#include "time.h"
namespace Cantera {
/**
* Class Jac1D evaluates the Jacobian of a system of equations
* defined by a residual function of class Domain1D. It is
* assumed that the Jacobian is banded.
*/
class Jac1D : public BandMatrix {
public:
/**
* Constructor. The residual function defining the system of
* equations must be supplied.
*/
Jac1D(Domain1D& r);
/// Destructor. Does nothing.
virtual ~Jac1D(){}
/**
* Evaluate the Jacobian.
*/
void eval(doublereal* x0, doublereal* resid0);
/**
* Returns the matrix element describing the influence of the
* nth component at point j on the mth equation at point
* i. Due to the assumption of a banded Jacobian, this will be
* zero unless |i - j| <= 1.
*/
doublereal& v(int m, int i, int n, int j) {
return value(i*m_nv + m, j*m_nv + n);
}
doublereal elapsedTime() const {
return m_elapsed;
}
int nEvals() const { return m_nevals; }
int age() const { return m_age; }
void incrementAge() { m_age++; }
void setAge(int age) { m_age = age; }
protected:
Domain1D* m_resid;
Array2D m_r1;
// ArrayViewer m_x0, m_r0;
int m_nv, m_points;
doublereal m_atol;
doublereal m_elapsed;
int m_nevals;
int m_age;
private:
size_t index(int m, int j) { return m_nv*j + m; }
};
}
#endif

View file

@ -1,73 +0,0 @@
/**
*
* @file Newton1D.h
*
* Newton solver >>> under construction! <<<<
*
* $Author$
* $Date$
* $Revision$
*
* Copyright 2002 California Institute of Technology
*
*/
#ifndef CT_NEWTON1D_H
#define CT_NEWTON1D_H
#include "Jac1D.h"
namespace Cantera {
class Newton1D {
public:
Newton1D(int nv, int np);
virtual ~Newton1D();
doublereal norm(const doublereal* step);
void step(doublereal* x, doublereal* step,
Domain1D& r, Jac1D& jac, int loglevel, int update=1);
doublereal boundStep(const doublereal* x0, const doublereal* step0,
const Domain1D& r, int loglevel);
int dampStep(const doublereal* x0, const doublereal* step0,
doublereal* x1, doublereal* step1, doublereal& s1,
Domain1D& r, Jac1D& jac, int loglevel, bool writetitle);
void getErrorWeights(const doublereal* x, doublereal* ewt, Domain1D& r);
doublereal norm2(const doublereal* step, doublereal* ewt);
doublereal norm_infty(const doublereal* step, doublereal* ewt);
int solve(doublereal* x0, doublereal* x1, Domain1D& r, Jac1D& jac,
int loglevel);
int timeIntegrate(int n, doublereal dt,
doublereal* x0, doublereal* x1,
Domain1D& r, Jac1D& jac, int loglevel);
doublereal ssnorm(doublereal* x, doublereal* resid, Domain1D& r);
void setOptions(int maxJacAge = 5, doublereal maxNormRatio = 0.001) {
m_maxAge = maxJacAge;
m_maxRatio = maxNormRatio;
}
void resize(int points);
protected:
doublereal* getWorkArray();
void releaseWorkArray(doublereal* work);
vector<doublereal*> m_workarrays;
vector_fp m_ewt;
int m_maxAge;
int m_maxRatio;
int m_nv, m_np, m_n;
private:
size_t index(int n, int j) {
return m_nv * j + n;
}
};
}
#endif

View file

@ -1,5 +1,5 @@
/**
* @file Solid.cpp
* @file Solid1D.cpp
*/
/*

View file

@ -86,8 +86,8 @@ namespace Cantera {
*
* @param x Solution vector for this domain.
* @param step Newton step vector for this domain.
* @param r Object representing the domain. Used to get tolerances, number of components,
* and number of points.
* @param r Object representing the domain. Used to get tolerances,
* number of components, and number of points.
*
* The return value is
* \f[
@ -98,10 +98,10 @@ namespace Cantera {
* w_n = \epsilon_{r,n} \frac{\sum_j |x_{n,j}|}{J} + \epsilon_{a,n}.
* \f]
* Here \f$\epsilon_{r,n} \f$ is the relative error tolerance for
* component \f$ n \f$, and multiplies the average magnitude of
* solution component n in the domain. The second term, \f$
* \epsilon_{a,n}$, is the absolute error tolerance for component
* \f$ n \f$.
* component n, and multiplies the average magnitude of
* solution component n in the domain. The second term,
* \f$\epsilon_{a,n}\f$, is the absolute error tolerance for component
* n.
*
*/
doublereal norm_square(const doublereal* x,

View file

@ -88,7 +88,7 @@ namespace Cantera {
}
/**
/*
* Must be called before calling method 'advance'
*/
void Reactor::initialize(doublereal t0) {
@ -181,7 +181,7 @@ namespace Cantera {
evalEqs(time, y, ydot);
}
/**
/*
* Called by the integrator to evaluate ydot given y at time 'time'.
*/
void Reactor::evalEqs(doublereal time, doublereal* y, doublereal* ydot)
@ -255,10 +255,12 @@ namespace Cantera {
}
/**
/*
* Energy equation.
* \dot U = -P\dot V + A \dot q + \dot m_{in} h_{in}
* \f[
* \dot U = -P\dot V + A \dot q + \dot m_{in} h_{in}
* - \dot m_{out} h.
* \f]
*/
if (m_energy) {
ydot[0] = - m_thermo->pressure() * m_vdot - m_Q;

View file

@ -1,5 +1,5 @@
/**
* @file Reqservoir.h
* @file Reservoir.h
*/
/*