Fixed code formatting
This commit is contained in:
parent
e77990ab24
commit
3ce3da1fa2
53 changed files with 1417 additions and 1414 deletions
|
|
@ -14,7 +14,8 @@
|
|||
|
||||
#endif
|
||||
|
||||
namespace Cantera {
|
||||
namespace Cantera
|
||||
{
|
||||
|
||||
#ifdef THREAD_SAFE_CANTERA
|
||||
|
||||
|
|
@ -42,7 +43,8 @@ typedef boost::mutex::scoped_lock ScopedLock;
|
|||
#else
|
||||
typedef int mutex_t;
|
||||
|
||||
class ScopedLock {
|
||||
class ScopedLock
|
||||
{
|
||||
public:
|
||||
explicit ScopedLock(const int m) : m_(m) {}
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -94,7 +94,9 @@ public:
|
|||
virtual std::string getMessage() const;
|
||||
|
||||
//! Method overridden by derived classes to indicate their type
|
||||
virtual std::string getClass() const { return "CanteraError"; }
|
||||
virtual std::string getClass() const {
|
||||
return "CanteraError";
|
||||
}
|
||||
|
||||
protected:
|
||||
//! Protected default constructor discourages throwing errors containing no information.
|
||||
|
|
@ -137,7 +139,9 @@ public:
|
|||
CanteraError(procedure), sz_(sz), reqd_(reqd) {}
|
||||
|
||||
virtual std::string getMessage() const;
|
||||
virtual std::string getClass() const { return "ArraySizeError"; }
|
||||
virtual std::string getClass() const {
|
||||
return "ArraySizeError";
|
||||
}
|
||||
|
||||
private:
|
||||
size_t sz_, reqd_;
|
||||
|
|
@ -166,7 +170,9 @@ public:
|
|||
|
||||
virtual ~IndexError() throw() {};
|
||||
virtual std::string getMessage() const;
|
||||
virtual std::string getClass() const { return "IndexError"; }
|
||||
virtual std::string getClass() const {
|
||||
return "IndexError";
|
||||
}
|
||||
|
||||
private:
|
||||
std::string arrayName_;
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@ class SpeciesThermoFactory;
|
|||
class XML_Node;
|
||||
|
||||
//! Rules for parsing and installing reactions
|
||||
struct ReactionRules
|
||||
{
|
||||
struct ReactionRules {
|
||||
ReactionRules();
|
||||
bool skipUndeclaredSpecies;
|
||||
bool skipUndeclaredThirdBodies;
|
||||
|
|
|
|||
|
|
@ -20,20 +20,20 @@
|
|||
namespace Cantera
|
||||
{
|
||||
|
||||
//! A species thermodynamic property manager for a phase.
|
||||
/*!
|
||||
* This is a general manager that can handle a wide variety
|
||||
* of species thermodynamic polynomials for individual species.
|
||||
* It is slow, however, because it recomputes the functions of
|
||||
* temperature needed for each species. What it does is to create
|
||||
* a vector of SpeciesThermoInterpType objects.
|
||||
*
|
||||
* @ingroup mgrsrefcalc
|
||||
*/
|
||||
class GeneralSpeciesThermo : public SpeciesThermo
|
||||
{
|
||||
//! A species thermodynamic property manager for a phase.
|
||||
/*!
|
||||
* This is a general manager that can handle a wide variety
|
||||
* of species thermodynamic polynomials for individual species.
|
||||
* It is slow, however, because it recomputes the functions of
|
||||
* temperature needed for each species. What it does is to create
|
||||
* a vector of SpeciesThermoInterpType objects.
|
||||
*
|
||||
* @ingroup mgrsrefcalc
|
||||
*/
|
||||
class GeneralSpeciesThermo : public SpeciesThermo
|
||||
{
|
||||
|
||||
public:
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
GeneralSpeciesThermo();
|
||||
|
|
@ -214,7 +214,7 @@ namespace Cantera
|
|||
|
||||
#endif
|
||||
|
||||
private:
|
||||
private:
|
||||
//! Provide the SpeciesthermoInterpType object
|
||||
/*!
|
||||
* provide access to the SpeciesThermoInterpType object.
|
||||
|
|
@ -226,7 +226,7 @@ namespace Cantera
|
|||
*/
|
||||
SpeciesThermoInterpType* provideSTIT(size_t k);
|
||||
|
||||
protected:
|
||||
protected:
|
||||
|
||||
/**
|
||||
* This is the main unknown in the object. It is
|
||||
|
|
@ -261,7 +261,7 @@ namespace Cantera
|
|||
friend class VPSSMgr;
|
||||
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -424,64 +424,64 @@ public:
|
|||
* property manager.
|
||||
* @see SpeciesThermo
|
||||
*/
|
||||
virtual doublereal cp_mole() const;
|
||||
virtual doublereal cp_mole() const;
|
||||
|
||||
/**
|
||||
* Molar heat capacity at constant volume. Units: J/kmol/K.
|
||||
* For an ideal gas mixture,
|
||||
* \f[ \hat c_v = \hat c_p - \hat R. \f]
|
||||
*/
|
||||
virtual doublereal cv_mole() const;
|
||||
/**
|
||||
* Molar heat capacity at constant volume. Units: J/kmol/K.
|
||||
* For an ideal gas mixture,
|
||||
* \f[ \hat c_v = \hat c_p - \hat R. \f]
|
||||
*/
|
||||
virtual doublereal cv_mole() const;
|
||||
|
||||
/**
|
||||
* @returns species translational/rotational specific heat at
|
||||
* constant volume. Inferred from the species gas
|
||||
* constant and number of translational/rotational
|
||||
* degrees of freedom. The translational/rotational
|
||||
* modes are assumed to be fully populated, and are
|
||||
* given by
|
||||
* \f[
|
||||
* C^{tr}_{v,s} \equiv \frac{\partial e^{tr}_s}{\partial T} = \frac{5}{2} R_s
|
||||
* \f]
|
||||
* for diatomic molecules and
|
||||
* \f[
|
||||
* C^{tr}_{v,s} \equiv \frac{\partial e^{tr}_s}{\partial T} = \frac{3}{2} R_s
|
||||
* \f]
|
||||
* for atoms.
|
||||
*/
|
||||
virtual doublereal cv_tr(doublereal ) const;
|
||||
|
||||
/**
|
||||
* @returns species translational specific heat at constant volume.
|
||||
* Since the translational modes are assumed to be fully populated
|
||||
* this is simply
|
||||
* \f[
|
||||
* C^{trans}_{v,s} \equiv \frac{\partial e^{trans}_s}{\partial T} = \frac{3}{2} R_s
|
||||
* \f]
|
||||
*/
|
||||
virtual doublereal cv_trans() const;
|
||||
/**
|
||||
* @returns species translational/rotational specific heat at
|
||||
* constant volume. Inferred from the species gas
|
||||
* constant and number of translational/rotational
|
||||
* degrees of freedom. The translational/rotational
|
||||
* modes are assumed to be fully populated, and are
|
||||
* given by
|
||||
* \f[
|
||||
* C^{tr}_{v,s} \equiv \frac{\partial e^{tr}_s}{\partial T} = \frac{5}{2} R_s
|
||||
* \f]
|
||||
* for diatomic molecules and
|
||||
* \f[
|
||||
* C^{tr}_{v,s} \equiv \frac{\partial e^{tr}_s}{\partial T} = \frac{3}{2} R_s
|
||||
* \f]
|
||||
* for atoms.
|
||||
*/
|
||||
virtual doublereal cv_tr(doublereal) const;
|
||||
|
||||
/**
|
||||
* @returns species rotational specific heat at constant volume.
|
||||
* By convention, we lump the translational/rotational components
|
||||
* \f[
|
||||
* C^{tr}_{v,s} \equiv C^{trans}_{v,s} + C^{rot}_{v,s}
|
||||
* \f]
|
||||
* so then
|
||||
* \f[
|
||||
* C^{rot}_{v,s} \equiv C^{tr}_{v,s} - C^{trans}_{v,s}
|
||||
* \f]
|
||||
*/
|
||||
virtual doublereal cv_rot(double atomicity) const;
|
||||
/**
|
||||
* @returns species translational specific heat at constant volume.
|
||||
* Since the translational modes are assumed to be fully populated
|
||||
* this is simply
|
||||
* \f[
|
||||
* C^{trans}_{v,s} \equiv \frac{\partial e^{trans}_s}{\partial T} = \frac{3}{2} R_s
|
||||
* \f]
|
||||
*/
|
||||
virtual doublereal cv_trans() const;
|
||||
|
||||
/**
|
||||
* @returns species vibrational specific heat at
|
||||
* constant volume. This is defined as
|
||||
* \f[
|
||||
* C^{vib}_{v,s} \equiv \frac{\partial e^{vib}_s}{\partial T_V} = \frac{R_s \theta_{vs}^2 \exp\left(\theta_{vs}/T_V\right)}{\left[\left(\exp\left(\theta_{vs}/T_V\right)-1\right)T_V\right]^2}
|
||||
* \f]
|
||||
*/
|
||||
virtual doublereal cv_vib(int k, doublereal T) const;
|
||||
/**
|
||||
* @returns species rotational specific heat at constant volume.
|
||||
* By convention, we lump the translational/rotational components
|
||||
* \f[
|
||||
* C^{tr}_{v,s} \equiv C^{trans}_{v,s} + C^{rot}_{v,s}
|
||||
* \f]
|
||||
* so then
|
||||
* \f[
|
||||
* C^{rot}_{v,s} \equiv C^{tr}_{v,s} - C^{trans}_{v,s}
|
||||
* \f]
|
||||
*/
|
||||
virtual doublereal cv_rot(double atomicity) const;
|
||||
|
||||
/**
|
||||
* @returns species vibrational specific heat at
|
||||
* constant volume. This is defined as
|
||||
* \f[
|
||||
* C^{vib}_{v,s} \equiv \frac{\partial e^{vib}_s}{\partial T_V} = \frac{R_s \theta_{vs}^2 \exp\left(\theta_{vs}/T_V\right)}{\left[\left(\exp\left(\theta_{vs}/T_V\right)-1\right)T_V\right]^2}
|
||||
* \f]
|
||||
*/
|
||||
virtual doublereal cv_vib(int k, doublereal T) const;
|
||||
|
||||
//@}
|
||||
|
||||
|
|
|
|||
|
|
@ -254,11 +254,11 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
//! Modify parameters for the standard state
|
||||
/*!
|
||||
* @param coeffs Vector of coefficients used to set the
|
||||
* parameters for the standard state.
|
||||
*/
|
||||
//! Modify parameters for the standard state
|
||||
/*!
|
||||
* @param coeffs Vector of coefficients used to set the
|
||||
* parameters for the standard state.
|
||||
*/
|
||||
virtual void modifyParameters(doublereal* coeffs) {
|
||||
m_coeff[0] = coeffs[5];
|
||||
m_coeff[1] = coeffs[6];
|
||||
|
|
|
|||
|
|
@ -106,8 +106,8 @@ public:
|
|||
//! @param right Reference to the class to be used in the copy
|
||||
Phase(const Phase& right);
|
||||
|
||||
//! Assignment operator
|
||||
//! @param right Reference to the class to be used in the copy
|
||||
//! Assignment operator
|
||||
//! @param right Reference to the class to be used in the copy
|
||||
Phase& operator=(const Phase& right);
|
||||
|
||||
//! Returns a reference to the XML_Node stored for the phase.
|
||||
|
|
|
|||
|
|
@ -74,8 +74,7 @@ public:
|
|||
/*!
|
||||
* @param right Object to be copied
|
||||
*/
|
||||
SpeciesThermoDuo(const SpeciesThermoDuo& right)
|
||||
{
|
||||
SpeciesThermoDuo(const SpeciesThermoDuo& right) {
|
||||
*this = operator=(right);
|
||||
}
|
||||
|
||||
|
|
@ -128,8 +127,7 @@ public:
|
|||
* @param stit_ptr Pointer to the SpeciesThermoInterpType object
|
||||
* This will set up the thermo for one species
|
||||
*/
|
||||
virtual void install_STIT(SpeciesThermoInterpType* stit_ptr)
|
||||
{
|
||||
virtual void install_STIT(SpeciesThermoInterpType* stit_ptr) {
|
||||
throw CanteraError("install_STIT", "not implemented");
|
||||
}
|
||||
|
||||
|
|
@ -161,8 +159,7 @@ public:
|
|||
*
|
||||
* @param k Species index
|
||||
*/
|
||||
virtual doublereal minTemp(size_t k = npos) const
|
||||
{
|
||||
virtual doublereal minTemp(size_t k = npos) const {
|
||||
return std::max(m_thermo1.minTemp(),m_thermo2.minTemp());
|
||||
}
|
||||
|
||||
|
|
@ -176,8 +173,7 @@ public:
|
|||
*
|
||||
* @param k index for parameterization k
|
||||
*/
|
||||
virtual doublereal maxTemp(size_t k = npos) const
|
||||
{
|
||||
virtual doublereal maxTemp(size_t k = npos) const {
|
||||
return std::min(m_thermo1.maxTemp(), m_thermo2.maxTemp());
|
||||
}
|
||||
|
||||
|
|
@ -194,8 +190,7 @@ public:
|
|||
*
|
||||
* @param k index for parameterization k
|
||||
*/
|
||||
virtual doublereal refPressure(size_t k = npos) const
|
||||
{
|
||||
virtual doublereal refPressure(size_t k = npos) const {
|
||||
return m_p0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
/**
|
||||
* @file StatMech.h
|
||||
* Header for a single-species standard state object derived
|
||||
* from
|
||||
* from
|
||||
*/
|
||||
/*
|
||||
* Copywrite (2006) Sandia Corporation. Under the terms of
|
||||
* Copyright(2006) Sandia Corporation. Under the terms of
|
||||
* Contract DE-AC04-94AL85000 with Sandia Corporation, the
|
||||
* U.S. Government retains certain rights in this software.
|
||||
*/
|
||||
|
|
@ -12,28 +12,23 @@
|
|||
#ifndef CT_STATMECH_H
|
||||
#define CT_STATMECH_H
|
||||
|
||||
/*
|
||||
* $Revision: 279 $
|
||||
* $Date: 2009-12-05 13:08:43 -0600 (Sat, 05 Dec 2009) $
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "cantera/base/global.h"
|
||||
#include "SpeciesThermoInterpType.h"
|
||||
#include "SpeciesThermoMgr.h"
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
namespace Cantera {
|
||||
|
||||
//!
|
||||
/*!
|
||||
* @ingroup spthermo
|
||||
*/
|
||||
class StatMech : public SpeciesThermoInterpType {
|
||||
namespace Cantera
|
||||
{
|
||||
|
||||
public:
|
||||
//!
|
||||
/*!
|
||||
* @ingroup spthermo
|
||||
*/
|
||||
class StatMech : public SpeciesThermoInterpType
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
//! Empty constructor
|
||||
StatMech();
|
||||
|
|
@ -49,7 +44,7 @@ namespace Cantera {
|
|||
* parameters for the standard state.
|
||||
*/
|
||||
StatMech(int n, doublereal tlow, doublereal thigh, doublereal pref,
|
||||
const doublereal* coeffs, std::string my_name);
|
||||
const doublereal* coeffs, std::string my_name);
|
||||
|
||||
//! copy constructor
|
||||
/*!
|
||||
|
|
@ -67,7 +62,7 @@ namespace Cantera {
|
|||
virtual ~StatMech();
|
||||
|
||||
//! duplicator
|
||||
virtual SpeciesThermoInterpType *
|
||||
virtual SpeciesThermoInterpType*
|
||||
duplMyselfAsSpeciesThermoInterpType() const;
|
||||
|
||||
//! Returns the minimum temperature that the thermo
|
||||
|
|
@ -89,7 +84,7 @@ namespace Cantera {
|
|||
|
||||
//! Build a series of maps for the properties needed for species
|
||||
int buildmap();
|
||||
|
||||
|
||||
//! Update the properties for this species, given a temperature polynomial
|
||||
/*!
|
||||
* This method is called with a pointer to an array containing the functions of
|
||||
|
|
@ -114,10 +109,10 @@ namespace Cantera {
|
|||
* @param s_R Vector of Dimensionless entropies.
|
||||
* (length m_kk).
|
||||
*/
|
||||
virtual void updateProperties(const doublereal* tt,
|
||||
doublereal* cp_R, doublereal* h_RT, doublereal* s_R) const;
|
||||
virtual void updateProperties(const doublereal* tt,
|
||||
doublereal* cp_R, doublereal* h_RT, doublereal* s_R) const;
|
||||
|
||||
|
||||
|
||||
//! Compute the reference-state property of one species
|
||||
/*!
|
||||
* Given temperature T in K, this method updates the values of
|
||||
|
|
@ -143,12 +138,12 @@ namespace Cantera {
|
|||
* @param s_R Vector of Dimensionless entropies.
|
||||
* (length m_kk).
|
||||
*/
|
||||
virtual void updatePropertiesTemp(const doublereal temp,
|
||||
doublereal* cp_R, doublereal* h_RT,
|
||||
doublereal* s_R) const;
|
||||
virtual void updatePropertiesTemp(const doublereal temp,
|
||||
doublereal* cp_R, doublereal* h_RT,
|
||||
doublereal* s_R) const;
|
||||
|
||||
//!This utility function reports back the type of
|
||||
//! parameterization and all of the parameters for the
|
||||
//!This utility function reports back the type of
|
||||
//! parameterization and all of the parameters for the
|
||||
//! species, index.
|
||||
/*!
|
||||
* All parameters are output variables
|
||||
|
|
@ -167,10 +162,10 @@ namespace Cantera {
|
|||
* coeffs[2] is max temperature
|
||||
* coeffs[3+i] from i =0,9 are the coefficients themselves
|
||||
*/
|
||||
virtual void reportParameters(size_t& n, int &type,
|
||||
doublereal &tlow, doublereal &thigh,
|
||||
doublereal &pref,
|
||||
doublereal* const coeffs) const;
|
||||
virtual void reportParameters(size_t& n, int& type,
|
||||
doublereal& tlow, doublereal& thigh,
|
||||
doublereal& pref,
|
||||
doublereal* const coeffs) const;
|
||||
|
||||
//! Modify parameters for the standard state
|
||||
/*!
|
||||
|
|
@ -179,16 +174,16 @@ namespace Cantera {
|
|||
*/
|
||||
virtual void modifyParameters(doublereal* coeffs);
|
||||
|
||||
protected:
|
||||
protected:
|
||||
//! lowest valid temperature
|
||||
doublereal m_lowT;
|
||||
doublereal m_lowT;
|
||||
//! highest valid temperature
|
||||
doublereal m_highT;
|
||||
doublereal m_highT;
|
||||
//! standard-state pressure
|
||||
doublereal m_Pref;
|
||||
doublereal m_Pref;
|
||||
//! species index
|
||||
int m_index;
|
||||
//! array of polynomial coefficients
|
||||
int m_index;
|
||||
//! array of polynomial coefficients
|
||||
vector_fp m_coeff;
|
||||
|
||||
std::string sp_name;
|
||||
|
|
@ -196,24 +191,23 @@ namespace Cantera {
|
|||
//*generic species struct that contains everything we need here
|
||||
// achtung: add doxygen markup here
|
||||
// achtung: convert doubles to realdoubles
|
||||
struct species
|
||||
{
|
||||
//Nominal T-R Degrees of freedom (cv = cfs*k*T)
|
||||
doublereal cfs;
|
||||
|
||||
// Mol. Wt. Molecular weight (kg/kmol)
|
||||
doublereal mol_weight;
|
||||
|
||||
// number of vibrational temperatures necessary
|
||||
int nvib;
|
||||
|
||||
// Theta_v Characteristic vibrational temperature(s) (K)
|
||||
doublereal theta[5];
|
||||
struct species {
|
||||
//Nominal T-R Degrees of freedom (cv = cfs*k*T)
|
||||
doublereal cfs;
|
||||
|
||||
// Mol. Wt. Molecular weight (kg/kmol)
|
||||
doublereal mol_weight;
|
||||
|
||||
// number of vibrational temperatures necessary
|
||||
int nvib;
|
||||
|
||||
// Theta_v Characteristic vibrational temperature(s) (K)
|
||||
doublereal theta[5];
|
||||
};
|
||||
|
||||
std::map<std::string,species*> name_map;
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -298,16 +298,16 @@ public:
|
|||
return err("cv_mole");
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns species vibrational specific heat at
|
||||
* constant volume.
|
||||
*
|
||||
*/
|
||||
/// Molar heat capacity at constant volume. Units: J/kmol/K.
|
||||
virtual doublereal cv_vib(int, double) const {
|
||||
return err("cv_vib");
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns species vibrational specific heat at
|
||||
* constant volume.
|
||||
*
|
||||
*/
|
||||
/// Molar heat capacity at constant volume. Units: J/kmol/K.
|
||||
virtual doublereal cv_vib(int, double) const {
|
||||
return err("cv_vib");
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Mechanical Properties
|
||||
|
|
|
|||
|
|
@ -7,7 +7,8 @@
|
|||
|
||||
#include "TransportBase.h"
|
||||
|
||||
namespace Cantera {
|
||||
namespace Cantera
|
||||
{
|
||||
|
||||
//! Class GasTransport implements some functions and properties that are
|
||||
//! shared by the MixTransport and MultiTransport classes.
|
||||
|
|
|
|||
|
|
@ -3,24 +3,12 @@
|
|||
* Header file defining class PecosTransport
|
||||
*/
|
||||
|
||||
/* $Author$
|
||||
* $Revision$
|
||||
* $Date$
|
||||
*/
|
||||
|
||||
// Copyright 2001 California Institute of Technology
|
||||
|
||||
|
||||
#ifndef CT_PECOSTRAN_H
|
||||
#define CT_PECOSTRAN_H
|
||||
|
||||
|
||||
// turn off warnings under Windows
|
||||
#ifdef WIN32
|
||||
#pragma warning(disable:4786)
|
||||
#pragma warning(disable:4503)
|
||||
#endif
|
||||
|
||||
// STL includes
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
|
@ -42,24 +30,28 @@ using namespace std;
|
|||
#include "TransportBase.h"
|
||||
#include "cantera/numerics/DenseMatrix.h"
|
||||
|
||||
namespace Cantera {
|
||||
namespace Cantera
|
||||
{
|
||||
|
||||
|
||||
class GasTransportParams;
|
||||
class GasTransportParams;
|
||||
|
||||
/**
|
||||
*
|
||||
* Class PecosTransport implements mixture-averaged transport
|
||||
* properties for ideal gas mixtures.
|
||||
*
|
||||
*/
|
||||
class PecosTransport : public Transport {
|
||||
/**
|
||||
*
|
||||
* Class PecosTransport implements mixture-averaged transport
|
||||
* properties for ideal gas mixtures.
|
||||
*
|
||||
*/
|
||||
class PecosTransport : public Transport
|
||||
{
|
||||
|
||||
public:
|
||||
public:
|
||||
|
||||
virtual ~PecosTransport() {}
|
||||
|
||||
virtual int model() const { return cPecosTransport; }
|
||||
virtual int model() const {
|
||||
return cPecosTransport;
|
||||
}
|
||||
|
||||
//! Viscosity of the mixture
|
||||
/*!
|
||||
|
|
@ -67,8 +59,11 @@ namespace Cantera {
|
|||
*/
|
||||
virtual doublereal viscosity();
|
||||
|
||||
virtual void getSpeciesViscosities(doublereal* visc)
|
||||
{ update_T(); updateViscosity_T(); copy(m_visc.begin(), m_visc.end(), visc); }
|
||||
virtual void getSpeciesViscosities(doublereal* visc) {
|
||||
update_T();
|
||||
updateViscosity_T();
|
||||
copy(m_visc.begin(), m_visc.end(), visc);
|
||||
}
|
||||
|
||||
//! Return the thermal diffusion coefficients
|
||||
/*!
|
||||
|
|
@ -80,9 +75,9 @@ namespace Cantera {
|
|||
*
|
||||
* This is computed using the lumped model,
|
||||
* \f[
|
||||
* k = k^{tr} + k^{ve}
|
||||
* k = k^{tr} + k^{ve}
|
||||
* \f]
|
||||
* where,
|
||||
* where,
|
||||
* \f[
|
||||
* k^{tr}= 5/2 \mu_s C_{v,s}^{trans} + \mu_s C_{v,s}^{rot}
|
||||
* \f]
|
||||
|
|
@ -90,14 +85,14 @@ namespace Cantera {
|
|||
* \f[
|
||||
* k^{ve}= \mu_s C_{v,s}^{vib} + \mu_s C_{v,s}^{elec}
|
||||
* \f]
|
||||
*
|
||||
*
|
||||
*/
|
||||
virtual doublereal thermalConductivity();
|
||||
|
||||
virtual void getBinaryDiffCoeffs(const int ld, doublereal* const d);
|
||||
|
||||
|
||||
//! Mixture-averaged diffusion coefficients [m^2/s].
|
||||
|
||||
//! Mixture-averaged diffusion coefficients [m^2/s].
|
||||
/*!
|
||||
* For the single species case or the pure fluid case
|
||||
* the routine returns the self-diffusion coefficient.
|
||||
|
|
@ -133,31 +128,31 @@ namespace Cantera {
|
|||
virtual void update_T();
|
||||
virtual void update_C();
|
||||
|
||||
//! Get the species diffusive mass fluxes wrt to
|
||||
//! the mass averaged velocity,
|
||||
//! Get the species diffusive mass fluxes wrt to
|
||||
//! the mass averaged velocity,
|
||||
//! given the gradients in mole fraction and temperature
|
||||
/*!
|
||||
* Units for the returned fluxes are kg m-2 s-1.
|
||||
*
|
||||
*
|
||||
* @param ndim Number of dimensions in the flux expressions
|
||||
* @param grad_T Gradient of the temperature
|
||||
* (length = ndim)
|
||||
* @param ldx Leading dimension of the grad_X array
|
||||
* @param ldx Leading dimension of the grad_X array
|
||||
* (usually equal to m_nsp but not always)
|
||||
* @param grad_X Gradients of the mole fraction
|
||||
* Flat vector with the m_nsp in the inner loop.
|
||||
* length = ldx * ndim
|
||||
* @param ldf Leading dimension of the fluxes array
|
||||
* @param ldf Leading dimension of the fluxes array
|
||||
* (usually equal to m_nsp but not always)
|
||||
* @param fluxes Output of the diffusive mass fluxes
|
||||
* Flat vector with the m_nsp in the inner loop.
|
||||
* length = ldx * ndim
|
||||
*/
|
||||
virtual void getSpeciesFluxes(int ndim,
|
||||
const doublereal* grad_T,
|
||||
int ldx,
|
||||
const doublereal* grad_X,
|
||||
int ldf, doublereal* fluxes);
|
||||
virtual void getSpeciesFluxes(int ndim,
|
||||
const doublereal* grad_T,
|
||||
int ldx,
|
||||
const doublereal* grad_X,
|
||||
int ldf, doublereal* fluxes);
|
||||
|
||||
//! Initialize the transport object
|
||||
/*!
|
||||
|
|
@ -167,20 +162,20 @@ namespace Cantera {
|
|||
*
|
||||
* @param tr Transport parameters for all of the species
|
||||
* in the phase.
|
||||
*
|
||||
*
|
||||
*/
|
||||
virtual bool initGas( GasTransportParams& tr );
|
||||
virtual bool initGas(GasTransportParams& tr);
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
*
|
||||
* Reads the transport table specified (currently defaults to internal file)
|
||||
*
|
||||
* Reads the user-specified transport table, appending new species
|
||||
* data and/or replacing default species data.
|
||||
*
|
||||
* Reads the user-specified transport table, appending new species
|
||||
* data and/or replacing default species data.
|
||||
*
|
||||
*/
|
||||
void read_blottner_transport_table ();
|
||||
void read_blottner_transport_table();
|
||||
|
||||
friend class TransportFactory;
|
||||
|
||||
|
|
@ -193,17 +188,17 @@ namespace Cantera {
|
|||
*/
|
||||
struct GasTransportData getGasTransportData(int);
|
||||
|
||||
protected:
|
||||
protected:
|
||||
|
||||
/// default constructor
|
||||
PecosTransport();
|
||||
|
||||
private:
|
||||
private:
|
||||
|
||||
//! Calculate the pressure from the ideal gas law
|
||||
doublereal pressure_ig() const {
|
||||
return (m_thermo->molarDensity() * GasConstant *
|
||||
m_thermo->temperature());
|
||||
return (m_thermo->molarDensity() * GasConstant *
|
||||
m_thermo->temperature());
|
||||
}
|
||||
|
||||
// mixture attributes
|
||||
|
|
@ -290,6 +285,6 @@ namespace Cantera {
|
|||
vector_fp cp_R;
|
||||
vector_fp cv_int;
|
||||
|
||||
};
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -21,7 +21,8 @@ using std::endl;
|
|||
#pragma comment(lib, "advapi32")
|
||||
#endif
|
||||
|
||||
namespace Cantera {
|
||||
namespace Cantera
|
||||
{
|
||||
|
||||
// If running multiple threads in a cpp application, the Application class
|
||||
// is the only internal object that is single instance with static data.
|
||||
|
|
@ -82,7 +83,8 @@ Application::Messages::Messages(const Messages& r) :
|
|||
logwriter = new Logger(*(r.logwriter));
|
||||
}
|
||||
|
||||
Application::Messages& Application::Messages::operator=(const Messages& r) {
|
||||
Application::Messages& Application::Messages::operator=(const Messages& r)
|
||||
{
|
||||
if (this == &r) {
|
||||
return *this;
|
||||
}
|
||||
|
|
@ -99,7 +101,8 @@ Application::Messages& Application::Messages::operator=(const Messages& r) {
|
|||
return *this;
|
||||
}
|
||||
|
||||
Application::Messages::~Messages() {
|
||||
Application::Messages::~Messages()
|
||||
{
|
||||
delete logwriter;
|
||||
#ifdef WITH_HTML_LOGS
|
||||
if (xmllog) {
|
||||
|
|
@ -329,7 +332,8 @@ Application::Application() :
|
|||
stop_on_error(false),
|
||||
options(),
|
||||
xmlfiles(),
|
||||
pMessenger() {
|
||||
pMessenger()
|
||||
{
|
||||
#if !defined( THREAD_SAFE_CANTERA )
|
||||
pMessenger = std::auto_ptr<Messages>(new Messages());
|
||||
#endif
|
||||
|
|
@ -349,7 +353,8 @@ Application::Application() :
|
|||
#endif
|
||||
}
|
||||
|
||||
Application* Application::Instance() {
|
||||
Application* Application::Instance()
|
||||
{
|
||||
ScopedLock appLock(app_mutex);
|
||||
if (Application::s_app == 0) {
|
||||
Application::s_app = new Application();
|
||||
|
|
@ -367,7 +372,8 @@ Application::~Application()
|
|||
}
|
||||
}
|
||||
|
||||
void Application::ApplicationDestroy() {
|
||||
void Application::ApplicationDestroy()
|
||||
{
|
||||
ScopedLock appLock(app_mutex);
|
||||
if (Application::s_app != 0) {
|
||||
delete Application::s_app;
|
||||
|
|
@ -435,11 +441,11 @@ XML_Node* Application::get_XML_File(std::string file, int debug)
|
|||
* the processed xml tree.
|
||||
*/
|
||||
if (xmlfiles.find(ff) != xmlfiles.end()) {
|
||||
if (debug > 0) {
|
||||
writelog("get_XML_File(): File, " + ff +
|
||||
", was previously read." +
|
||||
" Retrieving the stored xml tree.\n");
|
||||
}
|
||||
if (debug > 0) {
|
||||
writelog("get_XML_File(): File, " + ff +
|
||||
", was previously read." +
|
||||
" Retrieving the stored xml tree.\n");
|
||||
}
|
||||
return xmlfiles[ff];
|
||||
}
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -10,7 +10,8 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace Cantera {
|
||||
namespace Cantera
|
||||
{
|
||||
|
||||
class XML_Node;
|
||||
|
||||
|
|
|
|||
|
|
@ -83,13 +83,13 @@ void ct2ctml(const char* file, const int debug)
|
|||
python.start(pypath(), "-i");
|
||||
stringstream output_stream;
|
||||
python.in() <<
|
||||
"if True:\n" << // Use this so that the rest is a single block
|
||||
" import sys\n" <<
|
||||
" sys.stderr = sys.stdout\n" <<
|
||||
" import ctml_writer\n" <<
|
||||
" ctml_writer.convert(r'" << file << "')\n" <<
|
||||
" sys.exit(0)\n\n"
|
||||
"sys.exit(7)\n";
|
||||
"if True:\n" << // Use this so that the rest is a single block
|
||||
" import sys\n" <<
|
||||
" sys.stderr = sys.stdout\n" <<
|
||||
" import ctml_writer\n" <<
|
||||
" ctml_writer.convert(r'" << file << "')\n" <<
|
||||
" sys.exit(0)\n\n"
|
||||
"sys.exit(7)\n";
|
||||
python.close_in();
|
||||
std::string line;
|
||||
while (python.out().good()) {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,8 @@
|
|||
#include <sstream>
|
||||
#include <typeinfo>
|
||||
|
||||
namespace Cantera {
|
||||
namespace Cantera
|
||||
{
|
||||
|
||||
// *** Exceptions ***
|
||||
|
||||
|
|
@ -38,7 +39,8 @@ void CanteraError::save()
|
|||
}
|
||||
}
|
||||
|
||||
const char* CanteraError::what() const throw() {
|
||||
const char* CanteraError::what() const throw()
|
||||
{
|
||||
try {
|
||||
formattedMessage_ = "\n";
|
||||
formattedMessage_ += stars;
|
||||
|
|
@ -51,22 +53,25 @@ const char* CanteraError::what() const throw() {
|
|||
// Something went terribly wrong and we couldn't even format the message.
|
||||
}
|
||||
return formattedMessage_.c_str();
|
||||
}
|
||||
}
|
||||
|
||||
std::string CanteraError::getMessage() const {
|
||||
std::string CanteraError::getMessage() const
|
||||
{
|
||||
return msg_;
|
||||
}
|
||||
|
||||
std::string ArraySizeError::getMessage() const {
|
||||
std::string ArraySizeError::getMessage() const
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << "Array size (" << sz_ << ") too small. Must be at least " << reqd_ << ".";
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
std::string IndexError::getMessage() const {
|
||||
std::string IndexError::getMessage() const
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << "IndexError: " << arrayName_ << "[" << m_ << "]" <<
|
||||
" outside valid range of 0 to " << (mmax_) << ".";
|
||||
" outside valid range of 0 to " << (mmax_) << ".";
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1132,7 +1132,7 @@ size_t getFloatArray(const Cantera::XML_Node& node, std::vector<doublereal> & v,
|
|||
}
|
||||
//====================================================================================================================
|
||||
size_t getNamedFloatArray(const Cantera::XML_Node& parentNode, const std::string& nodeName, std::vector<doublereal> & v,
|
||||
const bool convert, const std::string unitsString)
|
||||
const bool convert, const std::string unitsString)
|
||||
{
|
||||
std::string::size_type icom;
|
||||
std::string numstr;
|
||||
|
|
|
|||
|
|
@ -11,7 +11,8 @@
|
|||
|
||||
using namespace std;
|
||||
|
||||
namespace Cantera {
|
||||
namespace Cantera
|
||||
{
|
||||
|
||||
//! Return a pointer to the application object
|
||||
static Application* app()
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ void outputExcel(std::ostream& s, const std::string& title,
|
|||
s << ",";
|
||||
}
|
||||
}
|
||||
s << endl;
|
||||
s << endl;
|
||||
for (i = 0; i < npts; i++) {
|
||||
for (j = 0; j < nv; j++) {
|
||||
s << data(j,i);
|
||||
|
|
|
|||
|
|
@ -899,7 +899,7 @@ const std::vector<XML_Node*>& XML_Node::children() const
|
|||
size_t XML_Node::nChildren(const bool discardComments) const
|
||||
{
|
||||
if (discardComments) {
|
||||
size_t count = 0;
|
||||
size_t count = 0;
|
||||
for (size_t i = 0; i < m_nchildren; i++) {
|
||||
XML_Node* xc = m_children[i];
|
||||
if (!(xc->isComment())) {
|
||||
|
|
|
|||
|
|
@ -33,7 +33,8 @@
|
|||
# define DERR -999.999
|
||||
#endif
|
||||
|
||||
namespace Cantera {
|
||||
namespace Cantera
|
||||
{
|
||||
|
||||
//! Exception handler used at language interface boundaries.
|
||||
/*!
|
||||
|
|
@ -56,12 +57,12 @@ T handleAllExceptions(T ctErrorCode, T otherErrorCode)
|
|||
return ctErrorCode;
|
||||
} catch (std::exception& err) {
|
||||
std::cerr << "Cantera: caught an instance of "
|
||||
<< err.what() << std::endl;
|
||||
<< err.what() << std::endl;
|
||||
setError("handleAllExceptions", err.what());
|
||||
return otherErrorCode;
|
||||
} catch (...) {
|
||||
std::cerr << "Cantera: caught an instance of "
|
||||
"an unknown exception type" << std::endl;
|
||||
"an unknown exception type" << std::endl;
|
||||
setError("handleAllExceptions", "unknown exception");
|
||||
return otherErrorCode;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -252,7 +252,7 @@ extern "C" {
|
|||
}
|
||||
|
||||
int phase_setMassFractions(int n, size_t leny,
|
||||
double* y, int norm)
|
||||
double* y, int norm)
|
||||
{
|
||||
try {
|
||||
ThermoPhase& p = ThermoCabinet::item(n);
|
||||
|
|
@ -628,7 +628,7 @@ extern "C" {
|
|||
}
|
||||
|
||||
int th_equil(int n, char* XY, int solver,
|
||||
double rtol, int maxsteps, int maxiter, int loglevel)
|
||||
double rtol, int maxsteps, int maxiter, int loglevel)
|
||||
{
|
||||
try {
|
||||
equilibrate(ThermoCabinet::item(n), XY, solver, rtol, maxsteps,
|
||||
|
|
@ -804,8 +804,8 @@ extern "C" {
|
|||
//-------------- Kinetics ------------------//
|
||||
|
||||
size_t newKineticsFromXML(int mxml, int iphase,
|
||||
int neighbor1, int neighbor2, int neighbor3,
|
||||
int neighbor4)
|
||||
int neighbor1, int neighbor2, int neighbor3,
|
||||
int neighbor4)
|
||||
{
|
||||
try {
|
||||
XML_Node& x = XmlCabinet::item(mxml);
|
||||
|
|
@ -835,7 +835,7 @@ extern "C" {
|
|||
}
|
||||
|
||||
int installRxnArrays(int pxml, int ikin,
|
||||
char* default_phase)
|
||||
char* default_phase)
|
||||
{
|
||||
try {
|
||||
XML_Node& p = XmlCabinet::item(pxml);
|
||||
|
|
@ -871,7 +871,7 @@ extern "C" {
|
|||
{
|
||||
try {
|
||||
return KineticsCabinet::item(n).kineticsSpeciesIndex(string(nm),
|
||||
string(ph));
|
||||
string(ph));
|
||||
} catch (...) {
|
||||
return handleAllExceptions(npos, npos);
|
||||
}
|
||||
|
|
@ -1309,7 +1309,7 @@ extern "C" {
|
|||
}
|
||||
|
||||
int trans_getMolarFluxes(int n, const double* state1,
|
||||
const double* state2, double delta, double* fluxes)
|
||||
const double* state2, double delta, double* fluxes)
|
||||
{
|
||||
try {
|
||||
TransportCabinet::item(n).getMolarFluxes(state1, state2, delta, fluxes);
|
||||
|
|
@ -1320,7 +1320,7 @@ extern "C" {
|
|||
}
|
||||
|
||||
int trans_getMassFluxes(int n, const double* state1,
|
||||
const double* state2, double delta, double* fluxes)
|
||||
const double* state2, double delta, double* fluxes)
|
||||
{
|
||||
try {
|
||||
TransportCabinet::item(n).getMassFluxes(state1, state2, delta, fluxes);
|
||||
|
|
@ -1511,7 +1511,7 @@ extern "C" {
|
|||
}
|
||||
|
||||
int buildSolutionFromXML(char* src, int ixml, char* id,
|
||||
int ith, int ikin)
|
||||
int ith, int ikin)
|
||||
{
|
||||
try {
|
||||
XML_Node* root = 0;
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ extern "C" {
|
|||
CANTERA_CAPI int th_set_SV(int n, double* vals);
|
||||
CANTERA_CAPI int th_set_SP(int n, double* vals);
|
||||
CANTERA_CAPI int th_equil(int n, char* XY, int solver,
|
||||
double rtol, int maxsteps, int maxiter, int loglevel);
|
||||
double rtol, int maxsteps, int maxiter, int loglevel);
|
||||
|
||||
CANTERA_CAPI double th_critTemperature(int n);
|
||||
CANTERA_CAPI double th_critPressure(int n);
|
||||
|
|
@ -88,10 +88,10 @@ extern "C" {
|
|||
CANTERA_CAPI int th_setState_Tsat(int n, double t, double x);
|
||||
|
||||
CANTERA_CAPI size_t newKineticsFromXML(int mxml, int iphase,
|
||||
int neighbor1=-1, int neighbor2=-1, int neighbor3=-1,
|
||||
int neighbor4=-1);
|
||||
int neighbor1=-1, int neighbor2=-1, int neighbor3=-1,
|
||||
int neighbor4=-1);
|
||||
CANTERA_CAPI int installRxnArrays(int pxml, int ikin,
|
||||
char* default_phase);
|
||||
char* default_phase);
|
||||
CANTERA_CAPI size_t kin_nSpecies(int n);
|
||||
CANTERA_CAPI size_t kin_nReactions(int n);
|
||||
CANTERA_CAPI size_t kin_nPhases(int n);
|
||||
|
|
@ -125,7 +125,7 @@ extern "C" {
|
|||
CANTERA_CAPI size_t kin_phase(int n, size_t i);
|
||||
|
||||
CANTERA_CAPI size_t newTransport(char* model,
|
||||
int th, int loglevel);
|
||||
int th, int loglevel);
|
||||
CANTERA_CAPI double trans_viscosity(int n);
|
||||
CANTERA_CAPI double trans_thermalConductivity(int n);
|
||||
CANTERA_CAPI int trans_getThermalDiffCoeffs(int n, int ldt, double* dt);
|
||||
|
|
@ -134,13 +134,13 @@ extern "C" {
|
|||
CANTERA_CAPI int trans_getMultiDiffCoeffs(int n, int ld, double* d);
|
||||
CANTERA_CAPI int trans_setParameters(int n, int type, int k, double* d);
|
||||
CANTERA_CAPI int trans_getMolarFluxes(int n, const double* state1,
|
||||
const double* state2, double delta, double* fluxes);
|
||||
const double* state2, double delta, double* fluxes);
|
||||
CANTERA_CAPI int trans_getMassFluxes(int n, const double* state1,
|
||||
const double* state2, double delta, double* fluxes);
|
||||
const double* state2, double delta, double* fluxes);
|
||||
|
||||
CANTERA_CAPI int import_phase(int nth, int nxml, char* id);
|
||||
CANTERA_CAPI int import_kinetics(int nxml, char* id,
|
||||
int nphases, int* ith, int nkin);
|
||||
int nphases, int* ith, int nkin);
|
||||
CANTERA_CAPI int getCanteraError(int buflen, char* buf);
|
||||
CANTERA_CAPI int showCanteraErrors();
|
||||
CANTERA_CAPI int write_HTML_log(const char* file);
|
||||
|
|
@ -152,10 +152,10 @@ extern "C" {
|
|||
CANTERA_CAPI int delTransport(int n);
|
||||
CANTERA_CAPI int readlog(int n, char* buf);
|
||||
CANTERA_CAPI int buildSolutionFromXML(char* src, int ixml, char* id,
|
||||
int ith, int ikin);
|
||||
int ith, int ikin);
|
||||
|
||||
CANTERA_CAPI int ck_to_cti(char* in_file, char* db_file,
|
||||
char* tr_file, char* id_tag, int debug, int validate);
|
||||
char* tr_file, char* id_tag, int debug, int validate);
|
||||
CANTERA_CAPI int writelogfile(char* logfile);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -41,8 +41,8 @@ extern "C" {
|
|||
int maxiter, int loglevel);
|
||||
CANTERA_CAPI int mix_getChemPotentials(int i, size_t lenmu, double* mu);
|
||||
CANTERA_CAPI int mix_getValidChemPotentials(int i, double bad_mu,
|
||||
int standard, size_t lenmu,
|
||||
double* mu);
|
||||
int standard, size_t lenmu,
|
||||
double* mu);
|
||||
CANTERA_CAPI double mix_enthalpy(int i);
|
||||
CANTERA_CAPI double mix_entropy(int i);
|
||||
CANTERA_CAPI double mix_gibbs(int i);
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ extern "C" {
|
|||
}
|
||||
|
||||
int domain_setTolerances(int i, int n, double rtol,
|
||||
double atol, int itime)
|
||||
double atol, int itime)
|
||||
{
|
||||
try {
|
||||
Domain1D& dom = DomainCabinet::item(i);
|
||||
|
|
@ -457,7 +457,7 @@ extern "C" {
|
|||
}
|
||||
|
||||
int stflow_setFixedTempProfile(int i, size_t n, double* pos,
|
||||
size_t m, double* temp)
|
||||
size_t m, double* temp)
|
||||
{
|
||||
try {
|
||||
vector_fp vpos(n), vtemp(n);
|
||||
|
|
|
|||
|
|
@ -17,11 +17,11 @@ extern "C" {
|
|||
CANTERA_CAPI int domain_componentName(int i, int n, int sz, char* nameout);
|
||||
CANTERA_CAPI size_t domain_componentIndex(int i, char* name);
|
||||
CANTERA_CAPI int domain_setBounds(int i, int n, double lower,
|
||||
double upper);
|
||||
double upper);
|
||||
CANTERA_CAPI double domain_lowerBound(int i, int n);
|
||||
CANTERA_CAPI double domain_upperBound(int i, int n);
|
||||
CANTERA_CAPI int domain_setTolerances(int i, int n, double rtol,
|
||||
double atol, int itime);
|
||||
double atol, int itime);
|
||||
CANTERA_CAPI double domain_rtol(int i, int n);
|
||||
CANTERA_CAPI double domain_atol(int i, int n);
|
||||
CANTERA_CAPI int domain_setupGrid(int i, size_t npts, double* grid);
|
||||
|
|
@ -62,7 +62,7 @@ extern "C" {
|
|||
CANTERA_CAPI int sim1D_del(int i);
|
||||
CANTERA_CAPI int sim1D_setValue(int i, int dom, int comp, int localPoint, double value);
|
||||
CANTERA_CAPI int sim1D_setProfile(int i, int dom, int comp,
|
||||
size_t np, double* pos, size_t nv, double* v);
|
||||
size_t np, double* pos, size_t nv, double* v);
|
||||
CANTERA_CAPI int sim1D_setFlatProfile(int i, int dom, int comp, double v);
|
||||
CANTERA_CAPI int sim1D_showSolution(int i, char* fname);
|
||||
CANTERA_CAPI int sim1D_setTimeStep(int i, double stepsize, size_t ns, integer* nsteps);
|
||||
|
|
@ -72,13 +72,13 @@ extern "C" {
|
|||
CANTERA_CAPI int sim1D_setRefineCriteria(int i, int dom, double ratio,
|
||||
double slope, double curve, double prune);
|
||||
CANTERA_CAPI int sim1D_save(int i, char* fname, char* id,
|
||||
char* desc);
|
||||
char* desc);
|
||||
CANTERA_CAPI int sim1D_restore(int i, char* fname, char* id);
|
||||
CANTERA_CAPI int sim1D_writeStats(int i, int printTime = 1);
|
||||
CANTERA_CAPI int sim1D_domainIndex(int i, char* name);
|
||||
CANTERA_CAPI double sim1D_value(int i, int idom, int icomp, int localPoint);
|
||||
CANTERA_CAPI double sim1D_workValue(int i, int idom,
|
||||
int icomp, int localPoint);
|
||||
int icomp, int localPoint);
|
||||
CANTERA_CAPI int sim1D_eval(int i, double rdt, int count);
|
||||
CANTERA_CAPI int sim1D_setMaxJacAge(int i, int ss_age, int ts_age);
|
||||
CANTERA_CAPI int sim1D_timeStepFactor(int i, double tfactor);
|
||||
|
|
|
|||
|
|
@ -467,7 +467,7 @@ extern "C" {
|
|||
{
|
||||
try {
|
||||
bool ok = FlowDeviceCabinet::item(i).install(ReactorCabinet::item(n),
|
||||
ReactorCabinet::item(m));
|
||||
ReactorCabinet::item(m));
|
||||
if (!ok) {
|
||||
throw CanteraError("install","Could not install flow device.");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -225,7 +225,7 @@ extern "C" {
|
|||
}
|
||||
|
||||
int rdiag_findMajor(int i, double threshold,
|
||||
size_t lda, double* a)
|
||||
size_t lda, double* a)
|
||||
{
|
||||
try {
|
||||
DiagramCabinet::item(i).findMajorPaths(threshold, lda, a);
|
||||
|
|
@ -293,7 +293,7 @@ extern "C" {
|
|||
}
|
||||
|
||||
int rbuild_build(int i, int k, char* el, char* dotfile,
|
||||
int idiag, int iquiet)
|
||||
int idiag, int iquiet)
|
||||
{
|
||||
try {
|
||||
ofstream fdot(dotfile);
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ extern "C" {
|
|||
CANTERA_CAPI int rbuild_del(int i);
|
||||
CANTERA_CAPI int rbuild_init(int i, char* logfile, int k);
|
||||
CANTERA_CAPI int rbuild_build(int i, int k, char* el, char* dotfile,
|
||||
int idiag, int iquiet);
|
||||
int idiag, int iquiet);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -61,17 +61,17 @@ extern "C" {
|
|||
_surfphase(i).setCoveragesByName(string(c));
|
||||
return 0;
|
||||
} catch (...) {
|
||||
return handleAllExceptions(-1, ERR);
|
||||
return handleAllExceptions(-1, ERR);
|
||||
}
|
||||
}
|
||||
|
||||
int surf_getcoverages(int i, double* c)
|
||||
{
|
||||
try {
|
||||
_surfphase(i).getCoverages(c);
|
||||
return 0;
|
||||
_surfphase(i).getCoverages(c);
|
||||
return 0;
|
||||
} catch (...) {
|
||||
return handleAllExceptions(-1, ERR);
|
||||
return handleAllExceptions(-1, ERR);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -81,7 +81,7 @@ extern "C" {
|
|||
_surfphase(i).setConcentrations(c);
|
||||
return 0;
|
||||
} catch (...) {
|
||||
return handleAllExceptions(-1, ERR);
|
||||
return handleAllExceptions(-1, ERR);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -91,7 +91,7 @@ extern "C" {
|
|||
_surfphase(i).getConcentrations(c);
|
||||
return 0;
|
||||
} catch (...) {
|
||||
return handleAllExceptions(-1, ERR);
|
||||
return handleAllExceptions(-1, ERR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,8 +31,8 @@ extern "C" {
|
|||
}
|
||||
return XmlCabinet::add(x);
|
||||
} catch (...) {
|
||||
return handleAllExceptions(-1, ERR);
|
||||
}
|
||||
return handleAllExceptions(-1, ERR);
|
||||
}
|
||||
}
|
||||
|
||||
int xml_get_XML_File(const char* file, int debug)
|
||||
|
|
@ -62,8 +62,8 @@ extern "C" {
|
|||
XmlCabinet::del(i);
|
||||
return 0;
|
||||
} catch (...) {
|
||||
return handleAllExceptions(-1, ERR);
|
||||
}
|
||||
return handleAllExceptions(-1, ERR);
|
||||
}
|
||||
}
|
||||
|
||||
int xml_removeChild(int i, int j)
|
||||
|
|
@ -72,8 +72,8 @@ extern "C" {
|
|||
XmlCabinet::item(i).removeChild(&XmlCabinet::item(j));
|
||||
return 0;
|
||||
} catch (...) {
|
||||
return handleAllExceptions(-1, ERR);
|
||||
}
|
||||
return handleAllExceptions(-1, ERR);
|
||||
}
|
||||
}
|
||||
|
||||
int xml_copy(int i)
|
||||
|
|
@ -81,8 +81,8 @@ extern "C" {
|
|||
try {
|
||||
return XmlCabinet::newCopy(i);
|
||||
} catch (...) {
|
||||
return handleAllExceptions(-1, ERR);
|
||||
}
|
||||
return handleAllExceptions(-1, ERR);
|
||||
}
|
||||
}
|
||||
|
||||
int xml_assign(int i, int j)
|
||||
|
|
@ -90,8 +90,8 @@ extern "C" {
|
|||
try {
|
||||
return XmlCabinet::assign(i,j);
|
||||
} catch (...) {
|
||||
return handleAllExceptions(-1, ERR);
|
||||
}
|
||||
return handleAllExceptions(-1, ERR);
|
||||
}
|
||||
}
|
||||
|
||||
int xml_build(int i, const char* file)
|
||||
|
|
@ -250,8 +250,8 @@ extern "C" {
|
|||
XML_Node& node = XmlCabinet::item(i);
|
||||
return (int) node.nChildren();
|
||||
} catch (...) {
|
||||
return handleAllExceptions(-1, ERR);
|
||||
}
|
||||
return handleAllExceptions(-1, ERR);
|
||||
}
|
||||
}
|
||||
|
||||
int xml_addChild(int i, const char* name, const char* value)
|
||||
|
|
|
|||
|
|
@ -887,7 +887,7 @@ double VCS_SOLVE::vcs_phaseStabilityTest(const size_t iph)
|
|||
for (k = 0; k < Vphase->nSpecies(); k++) {
|
||||
if (fabs(damp * delFrac[k]) > 0.3*fabs(fracDelta_old[k])) {
|
||||
damp = std::max(0.3*fabs(fracDelta_old[k]) / fabs(delFrac[k]),
|
||||
1.0E-8/fabs(delFrac[k]));
|
||||
1.0E-8/fabs(delFrac[k]));
|
||||
}
|
||||
if (delFrac[k] < 0.0) {
|
||||
if (2.0 * damp * (-delFrac[k]) > fracDelta_old[k]) {
|
||||
|
|
|
|||
|
|
@ -126,9 +126,9 @@ int VCS_SOLVE::vcs_prep_oneTime(int printLvl)
|
|||
* equal to nspecies - nelements. This may be changed below
|
||||
*/
|
||||
if (m_numElemConstraints > m_numSpeciesTot) {
|
||||
m_numRxnTot = 0;
|
||||
m_numRxnTot = 0;
|
||||
} else {
|
||||
m_numRxnTot = m_numSpeciesTot - m_numElemConstraints;
|
||||
m_numRxnTot = m_numSpeciesTot - m_numElemConstraints;
|
||||
}
|
||||
m_numRxnRdc = m_numRxnTot;
|
||||
m_numSpeciesRdc = m_numSpeciesTot;
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ extern "C" {
|
|||
//--------------- Phase ---------------------//
|
||||
|
||||
status_t phase_getname_(const integer* n, char* nm,
|
||||
ftnlen lennm)
|
||||
ftnlen lennm)
|
||||
{
|
||||
try {
|
||||
std::string pnm = _fph(n)->name();
|
||||
|
|
@ -108,7 +108,7 @@ extern "C" {
|
|||
try {
|
||||
return _fph(n)->nElements();
|
||||
} catch (...) {
|
||||
return handleAllExceptions(-1, ERR);
|
||||
return handleAllExceptions(-1, ERR);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -225,7 +225,7 @@ extern "C" {
|
|||
} catch (...) {
|
||||
return handleAllExceptions(-1, ERR);
|
||||
}
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
doublereal phase_massfraction_(const integer* n, integer* k)
|
||||
|
|
@ -649,8 +649,8 @@ extern "C" {
|
|||
//-------------- Kinetics ------------------//
|
||||
|
||||
integer newkineticsfromxml_(integer* mxml, integer* iphase,
|
||||
const integer* neighbor1, const integer* neighbor2, const integer* neighbor3,
|
||||
const integer* neighbor4)
|
||||
const integer* neighbor1, const integer* neighbor2, const integer* neighbor3,
|
||||
const integer* neighbor4)
|
||||
{
|
||||
try {
|
||||
XML_Node* x = _xml(mxml);
|
||||
|
|
@ -700,7 +700,7 @@ extern "C" {
|
|||
}
|
||||
|
||||
integer kin_speciesindex_(const integer* n, const char* nm, const char* ph,
|
||||
ftnlen lennm, ftnlen lenph)
|
||||
ftnlen lennm, ftnlen lenph)
|
||||
{
|
||||
try {
|
||||
return _fkin(n)->kineticsSpeciesIndex(f2string(nm, lennm),
|
||||
|
|
@ -1018,7 +1018,7 @@ extern "C" {
|
|||
//-------------------- Functions ---------------------------
|
||||
|
||||
status_t ctphase_report_(const integer* nth,
|
||||
char* buf, integer* show_thermo, ftnlen buflen)
|
||||
char* buf, integer* show_thermo, ftnlen buflen)
|
||||
{
|
||||
try {
|
||||
bool stherm = (*show_thermo != 0);
|
||||
|
|
@ -1065,7 +1065,7 @@ extern "C" {
|
|||
|
||||
|
||||
status_t ctbuildsolutionfromxml(char* src, integer* ixml, char* id,
|
||||
integer* ith, integer* ikin, ftnlen lensrc, ftnlen lenid)
|
||||
integer* ith, integer* ikin, ftnlen lensrc, ftnlen lenid)
|
||||
{
|
||||
try {
|
||||
XML_Node* root = 0;
|
||||
|
|
|
|||
|
|
@ -1115,10 +1115,10 @@ void InterfaceKinetics::addElementaryReaction(ReactionData& r)
|
|||
*/
|
||||
int reactionRateCoeffType_orig = r.rateCoeffType;
|
||||
if (r.rateCoeffType == EXCHANGE_CURRENT_REACTION_RATECOEFF_TYPE) {
|
||||
r.rateCoeffType = SURF_ARRHENIUS_REACTION_RATECOEFF_TYPE;
|
||||
r.rateCoeffType = SURF_ARRHENIUS_REACTION_RATECOEFF_TYPE;
|
||||
}
|
||||
if (r.rateCoeffType == ARRHENIUS_REACTION_RATECOEFF_TYPE) {
|
||||
r.rateCoeffType = SURF_ARRHENIUS_REACTION_RATECOEFF_TYPE;
|
||||
r.rateCoeffType = SURF_ARRHENIUS_REACTION_RATECOEFF_TYPE;
|
||||
}
|
||||
/*
|
||||
* Install the reaction rate into the vector of reactions handled by this class
|
||||
|
|
|
|||
|
|
@ -489,8 +489,8 @@ static void getEfficiencies(const XML_Node& eff, Kinetics& kin,
|
|||
rdata.thirdBodyEfficiencies[k] = fpValue(val[n]); // bb->second;
|
||||
} else if (!rules.skipUndeclaredThirdBodies) {
|
||||
throw CanteraError("getEfficiencies", "Encountered third-body "
|
||||
"efficiency for undefined species \"" + nm + "\"\n"
|
||||
"while adding reaction " + int2str(rdata.number+1) + ".");
|
||||
"efficiency for undefined species \"" + nm + "\"\n"
|
||||
"while adding reaction " + int2str(rdata.number+1) + ".");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -512,7 +512,7 @@ void getRateCoefficient(const XML_Node& kf, Kinetics& kin,
|
|||
const XML_Node& node = kf.child(m);
|
||||
double p = getFloat(node, "P", "toSI");
|
||||
vector_fp& rate = rdata.plogParameters.insert(
|
||||
std::make_pair(p, vector_fp()))->second;
|
||||
std::make_pair(p, vector_fp()))->second;
|
||||
rate.resize(3);
|
||||
rate[0] = getFloat(node, "A", "toSI");
|
||||
rate[1] = getFloat(node, "b");
|
||||
|
|
@ -853,8 +853,8 @@ bool rxninfo::installReaction(int iRxn, const XML_Node& r, Kinetics& kin,
|
|||
rdata.number = iRxn;
|
||||
rdata.rxn_number = iRxn;
|
||||
|
||||
// Read the rate coefficient data from the XML file. Trigger an
|
||||
// exception for negative A unless specifically authorized.
|
||||
// Read the rate coefficient data from the XML file. Trigger an
|
||||
// exception for negative A unless specifically authorized.
|
||||
getRateCoefficient(r.child("rateCoeff"), kin, rdata, rules);
|
||||
|
||||
// Check to see that the elements balance in the reaction.
|
||||
|
|
|
|||
|
|
@ -86,8 +86,9 @@ void phasemethods(int nlhs, mxArray* plhs[],
|
|||
buflen = (mwSize)(mxGetM(prhs[3]) * mxGetN(prhs[3])) + 1;
|
||||
input_buf = (char*)mxCalloc(buflen, sizeof(char));
|
||||
status = mxGetString(prhs[3], input_buf, buflen);
|
||||
if (status != 0)
|
||||
if (status != 0) {
|
||||
mexWarnMsgTxt("Not enough space. " "String is truncated.");
|
||||
}
|
||||
|
||||
switch (mjob) {
|
||||
case 30:
|
||||
|
|
|
|||
|
|
@ -18,22 +18,23 @@
|
|||
#define DAE_DEVEL
|
||||
#ifdef DAE_DEVEL
|
||||
|
||||
namespace Cantera {
|
||||
DAE_Solver* newDAE_Solver(std::string itype, ResidJacEval& f) {
|
||||
if (itype == "IDA") {
|
||||
namespace Cantera
|
||||
{
|
||||
DAE_Solver* newDAE_Solver(std::string itype, ResidJacEval& f)
|
||||
{
|
||||
if (itype == "IDA") {
|
||||
#ifdef HAS_SUNDIALS
|
||||
return new IDA_Solver(f);
|
||||
return new IDA_Solver(f);
|
||||
#else
|
||||
throw CanteraError("newDAE_Solver","IDA solver requires sundials"
|
||||
" package, but Cantera was not built with sundials.");
|
||||
throw CanteraError("newDAE_Solver","IDA solver requires sundials"
|
||||
" package, but Cantera was not built with sundials.");
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
throw CanteraError("newDAE_Solver",
|
||||
"unknown DAE solver: "+itype);
|
||||
}
|
||||
} else {
|
||||
throw CanteraError("newDAE_Solver",
|
||||
"unknown DAE solver: "+itype);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -3738,8 +3738,8 @@ int NonlinearSolver::beuler_jac(GeneralMatrix& J, doublereal* const f,
|
|||
if (s_print_NumJac) {
|
||||
if (m_print_flag >= 7) {
|
||||
if (retn != 1) {
|
||||
printf("\t\tbeuler_jac ERROR: calcDeltaSolnVariables() returned an error condition.\n");
|
||||
printf("\t\t We will bail after calculating the Jacobian\n");
|
||||
printf("\t\tbeuler_jac ERROR: calcDeltaSolnVariables() returned an error condition.\n");
|
||||
printf("\t\t We will bail after calculating the Jacobian\n");
|
||||
}
|
||||
if (neq_ < 20) {
|
||||
printf("\t\tUnk m_ewt y dyVector ResN\n");
|
||||
|
|
@ -3835,8 +3835,8 @@ int NonlinearSolver::beuler_jac(GeneralMatrix& J, doublereal* const f,
|
|||
if (s_print_NumJac) {
|
||||
if (m_print_flag >= 7) {
|
||||
if (retn != 1) {
|
||||
printf("\t\tbeuler_jac ERROR: calcDeltaSolnVariables() returned an error condition.\n");
|
||||
printf("\t\t We will bail after calculating the Jacobian\n");
|
||||
printf("\t\tbeuler_jac ERROR: calcDeltaSolnVariables() returned an error condition.\n");
|
||||
printf("\t\t We will bail after calculating the Jacobian\n");
|
||||
}
|
||||
if (neq_ < 20) {
|
||||
printf("\t\tUnk m_ewt y dyVector ResN\n");
|
||||
|
|
@ -3865,8 +3865,8 @@ int NonlinearSolver::beuler_jac(GeneralMatrix& J, doublereal* const f,
|
|||
}
|
||||
|
||||
info = m_func->evalResidNJ(time_curr, delta_t_n, y, ydot,
|
||||
DATA_PTR(m_wksp), JacDelta_ResidEval,
|
||||
static_cast<int>(j), dy);
|
||||
DATA_PTR(m_wksp), JacDelta_ResidEval,
|
||||
static_cast<int>(j), dy);
|
||||
m_nfe++;
|
||||
if (info != 1) {
|
||||
mdp::mdp_safe_free((void**) &dyVector);
|
||||
|
|
@ -3875,7 +3875,7 @@ int NonlinearSolver::beuler_jac(GeneralMatrix& J, doublereal* const f,
|
|||
|
||||
doublereal diff;
|
||||
|
||||
int ileft = (int) j - (int) ku;
|
||||
int ileft = (int) j - (int) ku;
|
||||
int iright = static_cast<int>(j + kl);
|
||||
for (int i = ileft; i <= iright; i++) {
|
||||
if (i >= 0 && i < (int) neq_) {
|
||||
|
|
@ -3885,14 +3885,14 @@ int NonlinearSolver::beuler_jac(GeneralMatrix& J, doublereal* const f,
|
|||
col_j[index] = diff / dy;
|
||||
}
|
||||
}
|
||||
/*
|
||||
for (size_t i = j - ku; i <= j + kl; i++) {
|
||||
if (i < neq_) {
|
||||
diff = subtractRD(m_wksp[i], f[i]);
|
||||
col_j[kl + ku + i - j] = diff / dy;
|
||||
}
|
||||
}
|
||||
*/
|
||||
/*
|
||||
for (size_t i = j - ku; i <= j + kl; i++) {
|
||||
if (i < neq_) {
|
||||
diff = subtractRD(m_wksp[i], f[i]);
|
||||
col_j[kl + ku + i - j] = diff / dy;
|
||||
}
|
||||
}
|
||||
*/
|
||||
y[j] = ysave;
|
||||
if (solnType_ != NSOLN_TYPE_STEADY_STATE) {
|
||||
ydot[j] = ydotsave;
|
||||
|
|
|
|||
|
|
@ -176,8 +176,8 @@ doublereal MultiNewton::boundStep(const doublereal* x0,
|
|||
doublereal fbound = 1.0;
|
||||
for (size_t i = 0; i < r.nDomains(); i++) {
|
||||
fbound = std::min(fbound,
|
||||
bound_step(x0 + r.start(i), step0 + r.start(i),
|
||||
r.domain(i), loglevel));
|
||||
bound_step(x0 + r.start(i), step0 + r.start(i),
|
||||
r.domain(i), loglevel));
|
||||
}
|
||||
return fbound;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -260,7 +260,7 @@ int Sim1D::newtonSolve(int loglevel)
|
|||
return -1;
|
||||
} else {
|
||||
throw CanteraError("Sim1D::newtonSolve",
|
||||
"ERROR: OneDim::solve returned m = " + int2str(m) + "\n");
|
||||
"ERROR: OneDim::solve returned m = " + int2str(m) + "\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,110 +22,109 @@ namespace Cantera
|
|||
{
|
||||
|
||||
|
||||
/*
|
||||
* Constructors
|
||||
*/
|
||||
GeneralSpeciesThermo::GeneralSpeciesThermo() :
|
||||
/*
|
||||
* Constructors
|
||||
*/
|
||||
GeneralSpeciesThermo::GeneralSpeciesThermo() :
|
||||
SpeciesThermo(),
|
||||
m_tlow_max(0.0),
|
||||
m_thigh_min(1.0E30),
|
||||
m_p0(OneAtm),
|
||||
m_kk(0)
|
||||
{
|
||||
{
|
||||
m_tlow_max = 0.0;
|
||||
m_thigh_min = 1.0E30;
|
||||
}
|
||||
}
|
||||
|
||||
GeneralSpeciesThermo::
|
||||
GeneralSpeciesThermo(const GeneralSpeciesThermo& b) :
|
||||
GeneralSpeciesThermo::
|
||||
GeneralSpeciesThermo(const GeneralSpeciesThermo& b) :
|
||||
m_tlow_max(b.m_tlow_max),
|
||||
m_thigh_min(b.m_thigh_min),
|
||||
m_kk(b.m_kk)
|
||||
{
|
||||
{
|
||||
m_sp.resize(m_kk, 0);
|
||||
for (size_t k = 0; k < m_kk; k++) {
|
||||
SpeciesThermoInterpType* bk = b.m_sp[k];
|
||||
if (bk) {
|
||||
m_sp[k] = bk->duplMyselfAsSpeciesThermoInterpType();
|
||||
}
|
||||
SpeciesThermoInterpType* bk = b.m_sp[k];
|
||||
if (bk) {
|
||||
m_sp[k] = bk->duplMyselfAsSpeciesThermoInterpType();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GeneralSpeciesThermo&
|
||||
GeneralSpeciesThermo::operator=(const GeneralSpeciesThermo& b)
|
||||
{
|
||||
GeneralSpeciesThermo&
|
||||
GeneralSpeciesThermo::operator=(const GeneralSpeciesThermo& b)
|
||||
{
|
||||
if (&b != this) {
|
||||
m_tlow_max = b.m_tlow_max;
|
||||
m_thigh_min = b.m_thigh_min;
|
||||
m_tlow_max = b.m_tlow_max;
|
||||
m_thigh_min = b.m_thigh_min;
|
||||
|
||||
for (size_t k = 0; k < m_kk; k++) {
|
||||
SpeciesThermoInterpType* sp = m_sp[k];
|
||||
if (sp) {
|
||||
delete sp;
|
||||
m_sp[k] = 0;
|
||||
}
|
||||
}
|
||||
m_kk = b.m_kk;
|
||||
m_sp.resize(m_kk, 0);
|
||||
for (size_t k = 0; k < m_kk; k++) {
|
||||
SpeciesThermoInterpType* bk = b.m_sp[k];
|
||||
if (bk) {
|
||||
m_sp[k] = bk->duplMyselfAsSpeciesThermoInterpType();
|
||||
}
|
||||
}
|
||||
for (size_t k = 0; k < m_kk; k++) {
|
||||
SpeciesThermoInterpType* sp = m_sp[k];
|
||||
if (sp) {
|
||||
delete sp;
|
||||
m_sp[k] = 0;
|
||||
}
|
||||
}
|
||||
m_kk = b.m_kk;
|
||||
m_sp.resize(m_kk, 0);
|
||||
for (size_t k = 0; k < m_kk; k++) {
|
||||
SpeciesThermoInterpType* bk = b.m_sp[k];
|
||||
if (bk) {
|
||||
m_sp[k] = bk->duplMyselfAsSpeciesThermoInterpType();
|
||||
}
|
||||
}
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
}
|
||||
|
||||
GeneralSpeciesThermo::~GeneralSpeciesThermo()
|
||||
{
|
||||
GeneralSpeciesThermo::~GeneralSpeciesThermo()
|
||||
{
|
||||
for (size_t k = 0; k < m_kk; k++) {
|
||||
SpeciesThermoInterpType* sp = m_sp[k];
|
||||
if (sp) {
|
||||
delete sp;
|
||||
m_sp[k] = 0;
|
||||
}
|
||||
SpeciesThermoInterpType* sp = m_sp[k];
|
||||
if (sp) {
|
||||
delete sp;
|
||||
m_sp[k] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SpeciesThermo*
|
||||
GeneralSpeciesThermo::duplMyselfAsSpeciesThermo() const
|
||||
{
|
||||
SpeciesThermo*
|
||||
GeneralSpeciesThermo::duplMyselfAsSpeciesThermo() const
|
||||
{
|
||||
GeneralSpeciesThermo* gsth = new GeneralSpeciesThermo(*this);
|
||||
return (SpeciesThermo*) gsth;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Install parameterization for a species.
|
||||
* @param index Species index
|
||||
* @param type parameterization type
|
||||
* @param c coefficients. The meaning of these depends on
|
||||
* the parameterization.
|
||||
*/
|
||||
void GeneralSpeciesThermo::install(std::string name,
|
||||
size_t index,
|
||||
int type,
|
||||
const doublereal* c,
|
||||
doublereal minTemp,
|
||||
doublereal maxTemp,
|
||||
doublereal refPressure)
|
||||
{
|
||||
/*
|
||||
* Install parameterization for a species.
|
||||
* @param index Species index
|
||||
* @param type parameterization type
|
||||
* @param c coefficients. The meaning of these depends on
|
||||
* the parameterization.
|
||||
*/
|
||||
void GeneralSpeciesThermo::install(std::string name,
|
||||
size_t index,
|
||||
int type,
|
||||
const doublereal* c,
|
||||
doublereal minTemp,
|
||||
doublereal maxTemp,
|
||||
doublereal refPressure)
|
||||
{
|
||||
/*
|
||||
* Resize the arrays if necessary, filling the empty
|
||||
* slots with the zero pointer.
|
||||
*/
|
||||
|
||||
if(minTemp <= 0.0)
|
||||
{
|
||||
throw CanteraError("Error in GeneralSpeciesThermo.cpp",
|
||||
" Cannot take 0 tmin as input. \n\n");
|
||||
}
|
||||
|
||||
|
||||
if (minTemp <= 0.0) {
|
||||
throw CanteraError("Error in GeneralSpeciesThermo.cpp",
|
||||
" Cannot take 0 tmin as input. \n\n");
|
||||
}
|
||||
|
||||
if (index >= m_kk) {
|
||||
m_sp.resize(index+1, 0);
|
||||
m_kk = index+1;
|
||||
m_sp.resize(index+1, 0);
|
||||
m_kk = index+1;
|
||||
}
|
||||
|
||||
//int nfreq = 3;
|
||||
|
|
@ -135,74 +134,74 @@ namespace Cantera
|
|||
|
||||
switch (type) {
|
||||
case NASA1:
|
||||
m_sp[index] = new NasaPoly1(index, minTemp, maxTemp,
|
||||
refPressure, c);
|
||||
break;
|
||||
m_sp[index] = new NasaPoly1(index, minTemp, maxTemp,
|
||||
refPressure, c);
|
||||
break;
|
||||
case SHOMATE1:
|
||||
m_sp[index] = new ShomatePoly(index, minTemp, maxTemp,
|
||||
refPressure, c);
|
||||
break;
|
||||
m_sp[index] = new ShomatePoly(index, minTemp, maxTemp,
|
||||
refPressure, c);
|
||||
break;
|
||||
case CONSTANT_CP:
|
||||
case SIMPLE:
|
||||
m_sp[index] = new ConstCpPoly(index, minTemp, maxTemp,
|
||||
refPressure, c);
|
||||
break;
|
||||
m_sp[index] = new ConstCpPoly(index, minTemp, maxTemp,
|
||||
refPressure, c);
|
||||
break;
|
||||
case MU0_INTERP:
|
||||
m_sp[index] = new Mu0Poly(index, minTemp, maxTemp,
|
||||
refPressure, c);
|
||||
break;
|
||||
m_sp[index] = new Mu0Poly(index, minTemp, maxTemp,
|
||||
refPressure, c);
|
||||
break;
|
||||
case SHOMATE2:
|
||||
m_sp[index] = new ShomatePoly2(index, minTemp, maxTemp,
|
||||
refPressure, c);
|
||||
break;
|
||||
m_sp[index] = new ShomatePoly2(index, minTemp, maxTemp,
|
||||
refPressure, c);
|
||||
break;
|
||||
case NASA2:
|
||||
m_sp[index] = new NasaPoly2(index, minTemp, maxTemp,
|
||||
refPressure, c);
|
||||
break;
|
||||
m_sp[index] = new NasaPoly2(index, minTemp, maxTemp,
|
||||
refPressure, c);
|
||||
break;
|
||||
|
||||
case STAT:
|
||||
m_sp[index] = new StatMech(index, minTemp, maxTemp,
|
||||
refPressure, c, name);
|
||||
break;
|
||||
m_sp[index] = new StatMech(index, minTemp, maxTemp,
|
||||
refPressure, c, name);
|
||||
break;
|
||||
|
||||
case ADSORBATE:
|
||||
m_sp[index] = new Adsorbate(index, minTemp, maxTemp,
|
||||
refPressure, c);
|
||||
break;
|
||||
m_sp[index] = new Adsorbate(index, minTemp, maxTemp,
|
||||
refPressure, c);
|
||||
break;
|
||||
default:
|
||||
throw UnknownSpeciesThermoModel(
|
||||
"GeneralSpeciesThermo::install",
|
||||
"unknown species type", int2str(type));
|
||||
break;
|
||||
throw UnknownSpeciesThermoModel(
|
||||
"GeneralSpeciesThermo::install",
|
||||
"unknown species type", int2str(type));
|
||||
break;
|
||||
}
|
||||
if (!m_sp[index]) {
|
||||
cout << "Null m_sp... index = " << index << endl;
|
||||
cout << "type = " << type << endl;
|
||||
cout << "Null m_sp... index = " << index << endl;
|
||||
cout << "type = " << type << endl;
|
||||
}
|
||||
m_tlow_max = max(minTemp, m_tlow_max);
|
||||
m_thigh_min = min(maxTemp, m_thigh_min);
|
||||
}
|
||||
}
|
||||
|
||||
// Install a new species thermodynamic property
|
||||
// parameterization for one species.
|
||||
/*
|
||||
* @param stit_ptr Pointer to the SpeciesThermoInterpType object
|
||||
* This will set up the thermo for one species
|
||||
*/
|
||||
void GeneralSpeciesThermo::install_STIT(SpeciesThermoInterpType* stit_ptr)
|
||||
{
|
||||
// Install a new species thermodynamic property
|
||||
// parameterization for one species.
|
||||
/*
|
||||
* @param stit_ptr Pointer to the SpeciesThermoInterpType object
|
||||
* This will set up the thermo for one species
|
||||
*/
|
||||
void GeneralSpeciesThermo::install_STIT(SpeciesThermoInterpType* stit_ptr)
|
||||
{
|
||||
/*
|
||||
* Resize the arrays if necessary, filling the empty
|
||||
* slots with the zero pointer.
|
||||
*/
|
||||
if (!stit_ptr) {
|
||||
throw CanteraError("GeneralSpeciesThermo::install_STIT",
|
||||
"zero pointer");
|
||||
throw CanteraError("GeneralSpeciesThermo::install_STIT",
|
||||
"zero pointer");
|
||||
}
|
||||
size_t index = stit_ptr->speciesIndex();
|
||||
if (index >= m_kk) {
|
||||
m_sp.resize(index+1, 0);
|
||||
m_kk = index+1;
|
||||
m_sp.resize(index+1, 0);
|
||||
m_kk = index+1;
|
||||
}
|
||||
AssertThrow(m_sp[index] == 0,
|
||||
"Index position isn't null, duplication of assignment: " + int2str(index));
|
||||
|
|
@ -219,177 +218,177 @@ namespace Cantera
|
|||
|
||||
m_tlow_max = max(minTemp, m_tlow_max);
|
||||
m_thigh_min = min(maxTemp, m_thigh_min);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void GeneralSpeciesThermo::installPDSShandler(size_t k, PDSS* PDSS_ptr,
|
||||
VPSSMgr* vpssmgr_ptr)
|
||||
{
|
||||
void GeneralSpeciesThermo::installPDSShandler(size_t k, PDSS* PDSS_ptr,
|
||||
VPSSMgr* vpssmgr_ptr)
|
||||
{
|
||||
STITbyPDSS* stit_ptr = new STITbyPDSS(k, vpssmgr_ptr, PDSS_ptr);
|
||||
install_STIT(stit_ptr);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the properties for one species.
|
||||
*/
|
||||
void GeneralSpeciesThermo::
|
||||
update_one(size_t k, doublereal t, doublereal* cp_R,
|
||||
doublereal* h_RT, doublereal* s_R) const
|
||||
{
|
||||
/**
|
||||
* Update the properties for one species.
|
||||
*/
|
||||
void GeneralSpeciesThermo::
|
||||
update_one(size_t k, doublereal t, doublereal* cp_R,
|
||||
doublereal* h_RT, doublereal* s_R) const
|
||||
{
|
||||
SpeciesThermoInterpType* sp_ptr = m_sp[k];
|
||||
if (sp_ptr) {
|
||||
sp_ptr->updatePropertiesTemp(t, cp_R, h_RT, s_R);
|
||||
sp_ptr->updatePropertiesTemp(t, cp_R, h_RT, s_R);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update the properties for all species.
|
||||
*/
|
||||
void GeneralSpeciesThermo::
|
||||
update(doublereal t, doublereal* cp_R,
|
||||
doublereal* h_RT, doublereal* s_R) const
|
||||
{
|
||||
/**
|
||||
* Update the properties for all species.
|
||||
*/
|
||||
void GeneralSpeciesThermo::
|
||||
update(doublereal t, doublereal* cp_R,
|
||||
doublereal* h_RT, doublereal* s_R) const
|
||||
{
|
||||
vector<SpeciesThermoInterpType*>::const_iterator _begin, _end;
|
||||
_begin = m_sp.begin();
|
||||
_end = m_sp.end();
|
||||
SpeciesThermoInterpType* sp_ptr = 0;
|
||||
for (; _begin != _end; ++_begin) {
|
||||
sp_ptr = *(_begin);
|
||||
if (sp_ptr) {
|
||||
sp_ptr->updatePropertiesTemp(t, cp_R, h_RT, s_R);
|
||||
}
|
||||
// else {
|
||||
// writelog("General::update: sp_ptr is NULL!\n");
|
||||
//}
|
||||
sp_ptr = *(_begin);
|
||||
if (sp_ptr) {
|
||||
sp_ptr->updatePropertiesTemp(t, cp_R, h_RT, s_R);
|
||||
}
|
||||
// else {
|
||||
// writelog("General::update: sp_ptr is NULL!\n");
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This utility function reports the type of parameterization
|
||||
* used for the species, index.
|
||||
*/
|
||||
int GeneralSpeciesThermo::reportType(size_t index) const
|
||||
{
|
||||
/**
|
||||
* This utility function reports the type of parameterization
|
||||
* used for the species, index.
|
||||
*/
|
||||
int GeneralSpeciesThermo::reportType(size_t index) const
|
||||
{
|
||||
SpeciesThermoInterpType* sp = m_sp[index];
|
||||
if (sp) {
|
||||
return sp->reportType();
|
||||
return sp->reportType();
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This utility function reports back the type of
|
||||
* parameterization and all of the parameters for the
|
||||
* species, index.
|
||||
* For the NASA object, there are 15 coefficients.
|
||||
*/
|
||||
void GeneralSpeciesThermo::
|
||||
reportParams(size_t index, int& type, doublereal* const c,
|
||||
doublereal& minTemp, doublereal& maxTemp, doublereal& refPressure) const
|
||||
{
|
||||
/**
|
||||
* This utility function reports back the type of
|
||||
* parameterization and all of the parameters for the
|
||||
* species, index.
|
||||
* For the NASA object, there are 15 coefficients.
|
||||
*/
|
||||
void GeneralSpeciesThermo::
|
||||
reportParams(size_t index, int& type, doublereal* const c,
|
||||
doublereal& minTemp, doublereal& maxTemp, doublereal& refPressure) const
|
||||
{
|
||||
SpeciesThermoInterpType* sp = m_sp[index];
|
||||
size_t n;
|
||||
if (sp) {
|
||||
sp->reportParameters(n, type, minTemp, maxTemp,
|
||||
refPressure, c);
|
||||
if (n != index) {
|
||||
throw CanteraError("GeneralSpeciesThermo::reportParams",
|
||||
"Internal error encountered");
|
||||
}
|
||||
sp->reportParameters(n, type, minTemp, maxTemp,
|
||||
refPressure, c);
|
||||
if (n != index) {
|
||||
throw CanteraError("GeneralSpeciesThermo::reportParams",
|
||||
"Internal error encountered");
|
||||
}
|
||||
} else {
|
||||
type = -1;
|
||||
type = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// //! Modify parameters for the standard state
|
||||
// /*!
|
||||
// * @param index Species index
|
||||
// * @param c Vector of coefficients used to set the
|
||||
// * parameters for the standard state.
|
||||
// */
|
||||
// void GeneralSpeciesThermo::
|
||||
// modifyParams(size_t index, doublereal* c)
|
||||
// {
|
||||
// SpeciesThermoInterpType* sp = m_sp[index];
|
||||
// if (sp) {
|
||||
// sp->modifyParameters(c);
|
||||
// }
|
||||
// }
|
||||
// //! Modify parameters for the standard state
|
||||
// /*!
|
||||
// * @param index Species index
|
||||
// * @param c Vector of coefficients used to set the
|
||||
// * parameters for the standard state.
|
||||
// */
|
||||
// void GeneralSpeciesThermo::
|
||||
// modifyParams(size_t index, doublereal* c)
|
||||
// {
|
||||
// SpeciesThermoInterpType* sp = m_sp[index];
|
||||
// if (sp) {
|
||||
// sp->modifyParameters(c);
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
* Return the lowest temperature at which the thermodynamic
|
||||
* parameterization is valid. If no argument is supplied, the
|
||||
* value is the one for which all species parameterizations
|
||||
* are valid. Otherwise, if an integer argument is given, the
|
||||
* value applies only to the species with that index.
|
||||
*/
|
||||
doublereal GeneralSpeciesThermo::minTemp(size_t k) const
|
||||
{
|
||||
/**
|
||||
* Return the lowest temperature at which the thermodynamic
|
||||
* parameterization is valid. If no argument is supplied, the
|
||||
* value is the one for which all species parameterizations
|
||||
* are valid. Otherwise, if an integer argument is given, the
|
||||
* value applies only to the species with that index.
|
||||
*/
|
||||
doublereal GeneralSpeciesThermo::minTemp(size_t k) const
|
||||
{
|
||||
if (k == npos) {
|
||||
return m_tlow_max;
|
||||
return m_tlow_max;
|
||||
} else {
|
||||
SpeciesThermoInterpType* sp = m_sp[k];
|
||||
if (sp) {
|
||||
return sp->minTemp();
|
||||
}
|
||||
SpeciesThermoInterpType* sp = m_sp[k];
|
||||
if (sp) {
|
||||
return sp->minTemp();
|
||||
}
|
||||
}
|
||||
return m_tlow_max;
|
||||
}
|
||||
}
|
||||
|
||||
doublereal GeneralSpeciesThermo::maxTemp(size_t k) const
|
||||
{
|
||||
doublereal GeneralSpeciesThermo::maxTemp(size_t k) const
|
||||
{
|
||||
if (k == npos) {
|
||||
return m_thigh_min;
|
||||
return m_thigh_min;
|
||||
} else {
|
||||
SpeciesThermoInterpType* sp = m_sp[k];
|
||||
if (sp) {
|
||||
return sp->maxTemp();
|
||||
}
|
||||
SpeciesThermoInterpType* sp = m_sp[k];
|
||||
if (sp) {
|
||||
return sp->maxTemp();
|
||||
}
|
||||
}
|
||||
return m_thigh_min;
|
||||
}
|
||||
}
|
||||
|
||||
doublereal GeneralSpeciesThermo::refPressure(size_t k) const
|
||||
{
|
||||
doublereal GeneralSpeciesThermo::refPressure(size_t k) const
|
||||
{
|
||||
if (k == npos) {
|
||||
return m_p0;
|
||||
return m_p0;
|
||||
} else {
|
||||
SpeciesThermoInterpType* sp = m_sp[k];
|
||||
if (sp) {
|
||||
return sp->refPressure();
|
||||
}
|
||||
SpeciesThermoInterpType* sp = m_sp[k];
|
||||
if (sp) {
|
||||
return sp->refPressure();
|
||||
}
|
||||
}
|
||||
return m_p0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SpeciesThermoInterpType* GeneralSpeciesThermo::provideSTIT(size_t k)
|
||||
{
|
||||
SpeciesThermoInterpType* GeneralSpeciesThermo::provideSTIT(size_t k)
|
||||
{
|
||||
return (m_sp[k]);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef H298MODIFY_CAPABILITY
|
||||
|
||||
doublereal GeneralSpeciesThermo::reportOneHf298(int k) const
|
||||
{
|
||||
doublereal GeneralSpeciesThermo::reportOneHf298(int k) const
|
||||
{
|
||||
SpeciesThermoInterpType* sp_ptr = m_sp[k];
|
||||
doublereal h = -1.0;
|
||||
if (sp_ptr) {
|
||||
h = sp_ptr->reportHf298(0);
|
||||
h = sp_ptr->reportHf298(0);
|
||||
}
|
||||
return h;
|
||||
}
|
||||
}
|
||||
|
||||
void GeneralSpeciesThermo::modifyOneHf298(const int k, const doublereal Hf298New)
|
||||
{
|
||||
void GeneralSpeciesThermo::modifyOneHf298(const int k, const doublereal Hf298New)
|
||||
{
|
||||
SpeciesThermoInterpType* sp_ptr = m_sp[k];
|
||||
if (sp_ptr) {
|
||||
sp_ptr->modifyOneHf298(k, Hf298New);
|
||||
sp_ptr->modifyOneHf298(k, Hf298New);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -155,15 +155,15 @@ doublereal IdealGasPhase::cv_mole() const
|
|||
return cp_mole() - GasConstant;
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns species translational/rotational specific heat at
|
||||
* constant volume.
|
||||
*
|
||||
* Either: $5/2 R_s$ or $3/2 R_s$ for molecules/atoms.
|
||||
*
|
||||
*/
|
||||
doublereal IdealGasPhase::cv_tr (doublereal atomicity) const
|
||||
{
|
||||
/**
|
||||
* @returns species translational/rotational specific heat at
|
||||
* constant volume.
|
||||
*
|
||||
* Either: $5/2 R_s$ or $3/2 R_s$ for molecules/atoms.
|
||||
*
|
||||
*/
|
||||
doublereal IdealGasPhase::cv_tr(doublereal atomicity) const
|
||||
{
|
||||
// k is the species number
|
||||
int dum = 0;
|
||||
int type = 0;
|
||||
|
|
@ -173,54 +173,57 @@ doublereal IdealGasPhase::cv_mole() const
|
|||
doublereal refPressure;
|
||||
|
||||
m_spthermo->reportParams(dum,type,c,minTemp,maxTemp,refPressure);
|
||||
|
||||
if(type != 111)
|
||||
{
|
||||
throw CanteraError("Error in IdealGasPhase.cpp",
|
||||
"cv_tr only supported for StatMech!. \n\n");
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (type != 111) {
|
||||
throw CanteraError("Error in IdealGasPhase.cpp",
|
||||
"cv_tr only supported for StatMech!. \n\n");
|
||||
|
||||
}
|
||||
|
||||
// see reportParameters for specific details
|
||||
return c[3];
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns species translational specific heat at constant volume.
|
||||
*/
|
||||
doublereal IdealGasPhase::cv_trans () const
|
||||
{ return 1.5*GasConstant; }
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns species rotational specific heat at constant volume.
|
||||
*
|
||||
*/
|
||||
doublereal IdealGasPhase::cv_rot (double atom) const
|
||||
{ return std::max(cv_tr(atom) - cv_trans(), 0.); }
|
||||
|
||||
/**
|
||||
* @returns species vibrational specific heat at
|
||||
* constant volume.
|
||||
*
|
||||
* C^{vib}_{v,s} = \frac{\partial e^{vib}_{v,s} }{\partial T}
|
||||
*
|
||||
* The species vibration energy ($e^{vib}_{v,s}$) is:
|
||||
*
|
||||
* 0: atom
|
||||
*
|
||||
* Diatomic:
|
||||
* \f[
|
||||
* \frac{R_s \theta_{v,s}}{e^{\theta_{v,s}/T}-1}
|
||||
* \f]
|
||||
*
|
||||
* General Molecules:
|
||||
* \f[
|
||||
* \sum_i \frac{R_s \theta_{v,s,i}}{e^{\theta_{v,s,i}/T}-1}
|
||||
* \f]
|
||||
*
|
||||
*/
|
||||
doublereal IdealGasPhase::cv_vib (const int k, const doublereal T) const
|
||||
{
|
||||
/**
|
||||
* @returns species translational specific heat at constant volume.
|
||||
*/
|
||||
doublereal IdealGasPhase::cv_trans() const
|
||||
{
|
||||
return 1.5*GasConstant;
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns species rotational specific heat at constant volume.
|
||||
*
|
||||
*/
|
||||
doublereal IdealGasPhase::cv_rot(double atom) const
|
||||
{
|
||||
return std::max(cv_tr(atom) - cv_trans(), 0.);
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns species vibrational specific heat at
|
||||
* constant volume.
|
||||
*
|
||||
* C^{vib}_{v,s} = \frac{\partial e^{vib}_{v,s} }{\partial T}
|
||||
*
|
||||
* The species vibration energy ($e^{vib}_{v,s}$) is:
|
||||
*
|
||||
* 0: atom
|
||||
*
|
||||
* Diatomic:
|
||||
* \f[
|
||||
* \frac{R_s \theta_{v,s}}{e^{\theta_{v,s}/T}-1}
|
||||
* \f]
|
||||
*
|
||||
* General Molecules:
|
||||
* \f[
|
||||
* \sum_i \frac{R_s \theta_{v,s,i}}{e^{\theta_{v,s,i}/T}-1}
|
||||
* \f]
|
||||
*
|
||||
*/
|
||||
doublereal IdealGasPhase::cv_vib(const int k, const doublereal T) const
|
||||
{
|
||||
|
||||
// k is the species number
|
||||
int dum = 0;
|
||||
|
|
@ -234,18 +237,17 @@ doublereal IdealGasPhase::cv_mole() const
|
|||
|
||||
m_spthermo->reportParams(dum,type,c,minTemp,maxTemp,refPressure);
|
||||
|
||||
// basic sanity check
|
||||
if(type != 111)
|
||||
{
|
||||
throw CanteraError("Error in IdealGasPhase.cpp",
|
||||
"cv_vib only supported for StatMech!. \n\n");
|
||||
// basic sanity check
|
||||
if (type != 111) {
|
||||
throw CanteraError("Error in IdealGasPhase.cpp",
|
||||
"cv_vib only supported for StatMech!. \n\n");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// see reportParameters for specific details
|
||||
return c[4];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Mechanical Equation of State ----------------------------
|
||||
// Chemical Potentials and Activities ----------------------
|
||||
|
|
|
|||
|
|
@ -721,7 +721,7 @@ void Phase::addUniqueElement(const std::string& symbol, doublereal weight,
|
|||
} else {
|
||||
if (m_atomicWeights[i] != weight) {
|
||||
throw CanteraError("AddUniqueElement",
|
||||
"Duplicate Elements (" + symbol + ") have different weights");
|
||||
"Duplicate Elements (" + symbol + ") have different weights");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -756,7 +756,7 @@ void Phase::addElementsFromXML(const XML_Node& phase)
|
|||
// get the declared element names
|
||||
if (! phase.hasChild("elementArray")) {
|
||||
throw CanteraError("Elements::addElementsFromXML",
|
||||
"phase xml node doesn't have \"elementArray\" XML Node");
|
||||
"phase xml node doesn't have \"elementArray\" XML Node");
|
||||
}
|
||||
XML_Node& elements = phase.child("elementArray");
|
||||
vector<string> enames;
|
||||
|
|
@ -865,8 +865,8 @@ void Phase::addSpecies(const std::string& name, const doublereal* comp,
|
|||
if (fabs(charge + ecomp) > 0.001) {
|
||||
if (ecomp != 0.0) {
|
||||
throw CanteraError("Phase::addSpecies",
|
||||
"Input charge and element E compositions differ "
|
||||
"for species " + name);
|
||||
"Input charge and element E compositions differ "
|
||||
"for species " + name);
|
||||
} else {
|
||||
// Just fix up the element E composition based on the input
|
||||
// species charge
|
||||
|
|
|
|||
|
|
@ -645,52 +645,52 @@ static void installNasa9ThermoFromXML(std::string speciesName,
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Install a stat mech based property solver
|
||||
* for species k into a SpeciesThermo instance.
|
||||
*/
|
||||
static void installStatMechThermoFromXML(std::string speciesName,
|
||||
SpeciesThermo& sp, int k,
|
||||
const std::vector<XML_Node*>& tp)
|
||||
{
|
||||
const XML_Node * fptr = tp[0];
|
||||
int nRegTmp = tp.size();
|
||||
int nRegions = 0;
|
||||
vector_fp cPoly;
|
||||
StatMech *np_ptr = 0;
|
||||
std::vector<StatMech *> regionPtrs;
|
||||
doublereal tmin, tmax, pref = OneAtm;
|
||||
SpeciesThermo& sp, int k,
|
||||
const std::vector<XML_Node*>& tp)
|
||||
{
|
||||
const XML_Node* fptr = tp[0];
|
||||
int nRegTmp = tp.size();
|
||||
int nRegions = 0;
|
||||
vector_fp cPoly;
|
||||
StatMech* np_ptr = 0;
|
||||
std::vector<StatMech*> regionPtrs;
|
||||
doublereal tmin, tmax, pref = OneAtm;
|
||||
|
||||
// Loop over all of the possible temperature regions
|
||||
for (int i = 0; i < nRegTmp; i++) {
|
||||
fptr = tp[i];
|
||||
if (fptr) {
|
||||
if (fptr->name() == "StatMech") {
|
||||
if (fptr->hasChild("floatArray")) {
|
||||
// Loop over all of the possible temperature regions
|
||||
for (int i = 0; i < nRegTmp; i++) {
|
||||
fptr = tp[i];
|
||||
if (fptr) {
|
||||
if (fptr->name() == "StatMech") {
|
||||
if (fptr->hasChild("floatArray")) {
|
||||
|
||||
tmin = fpValue((*fptr)["Tmin"]);
|
||||
tmax = fpValue((*fptr)["Tmax"]);
|
||||
if ((*fptr).hasAttrib("P0")) {
|
||||
pref = fpValue((*fptr)["P0"]);
|
||||
}
|
||||
if ((*fptr).hasAttrib("Pref")) {
|
||||
pref = fpValue((*fptr)["Pref"]);
|
||||
}
|
||||
tmin = fpValue((*fptr)["Tmin"]);
|
||||
tmax = fpValue((*fptr)["Tmax"]);
|
||||
if ((*fptr).hasAttrib("P0")) {
|
||||
pref = fpValue((*fptr)["P0"]);
|
||||
}
|
||||
if ((*fptr).hasAttrib("Pref")) {
|
||||
pref = fpValue((*fptr)["Pref"]);
|
||||
}
|
||||
|
||||
getFloatArray(fptr->child("floatArray"), cPoly, false);
|
||||
if (cPoly.size() != 0) {
|
||||
throw CanteraError("installStatMechThermoFromXML",
|
||||
"Expected no coeff: this is not a polynomial representation");
|
||||
}
|
||||
}
|
||||
}
|
||||
getFloatArray(fptr->child("floatArray"), cPoly, false);
|
||||
if (cPoly.size() != 0) {
|
||||
throw CanteraError("installStatMechThermoFromXML",
|
||||
"Expected no coeff: this is not a polynomial representation");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// set properties
|
||||
tmin = 0.1;
|
||||
vector_fp coeffs(1);
|
||||
coeffs[0] = 0.0;
|
||||
(&sp)->install(speciesName, k, STAT, &coeffs[0], tmin, tmax, pref);
|
||||
// set properties
|
||||
tmin = 0.1;
|
||||
vector_fp coeffs(1);
|
||||
coeffs[0] = 0.0;
|
||||
(&sp)->install(speciesName, k, STAT, &coeffs[0], tmin, tmax, pref);
|
||||
}
|
||||
|
||||
//! Install a Adsorbate polynomial thermodynamic property parameterization for species k into a SpeciesThermo instance.
|
||||
|
|
@ -794,15 +794,12 @@ void SpeciesThermoFactory::installThermoForSpecies
|
|||
} else if (f->name() == "Mu0") {
|
||||
installMu0ThermoFromXML(speciesNode["name"], spthermo, k, f);
|
||||
} else if (f->name() == "NASA9") {
|
||||
installNasa9ThermoFromXML(speciesNode["name"], spthermo, k, tp);
|
||||
}
|
||||
else if (f->name() == "StatMech") {
|
||||
installStatMechThermoFromXML(speciesNode["name"], spthermo, k, tp);
|
||||
}
|
||||
else if (f->name() == "adsorbate") {
|
||||
installNasa9ThermoFromXML(speciesNode["name"], spthermo, k, tp);
|
||||
} else if (f->name() == "StatMech") {
|
||||
installStatMechThermoFromXML(speciesNode["name"], spthermo, k, tp);
|
||||
} else if (f->name() == "adsorbate") {
|
||||
installAdsorbateThermoFromXML(speciesNode["name"], spthermo, k, *f);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
throw UnknownSpeciesThermoModel("installThermoForSpecies",
|
||||
speciesNode["name"], f->name());
|
||||
}
|
||||
|
|
@ -813,11 +810,9 @@ void SpeciesThermoFactory::installThermoForSpecies
|
|||
installNasaThermoFromXML(speciesNode["name"], spthermo, k, f0, f1);
|
||||
} else if (f0->name() == "Shomate" && f1->name() == "Shomate") {
|
||||
installShomateThermoFromXML(speciesNode["name"], spthermo, k, f0, f1);
|
||||
}
|
||||
else if (f0->name() == "StatMech") {
|
||||
installStatMechThermoFromXML(speciesNode["name"], spthermo, k, tp);
|
||||
}
|
||||
else if (f0->name() == "NASA9" && f1->name() == "NASA9") {
|
||||
} else if (f0->name() == "StatMech") {
|
||||
installStatMechThermoFromXML(speciesNode["name"], spthermo, k, tp);
|
||||
} else if (f0->name() == "NASA9" && f1->name() == "NASA9") {
|
||||
installNasa9ThermoFromXML(speciesNode["name"], spthermo, k, tp);
|
||||
} else {
|
||||
throw UnknownSpeciesThermoModel("installThermoForSpecies", speciesNode["name"],
|
||||
|
|
@ -827,17 +822,15 @@ void SpeciesThermoFactory::installThermoForSpecies
|
|||
const XML_Node* f0 = tp[0];
|
||||
if (f0->name() == "NASA9") {
|
||||
installNasa9ThermoFromXML(speciesNode["name"], spthermo, k, tp);
|
||||
}
|
||||
else if (f0->name() == "StatMech") {
|
||||
installStatMechThermoFromXML(speciesNode["name"], spthermo, k, tp);
|
||||
}
|
||||
else {
|
||||
throw UnknownSpeciesThermoModel("installThermoForSpecies", speciesNode["name"],
|
||||
"multiple");
|
||||
} else if (f0->name() == "StatMech") {
|
||||
installStatMechThermoFromXML(speciesNode["name"], spthermo, k, tp);
|
||||
} else {
|
||||
throw UnknownSpeciesThermoModel("installThermoForSpecies", speciesNode["name"],
|
||||
"multiple");
|
||||
}
|
||||
} else {
|
||||
throw UnknownSpeciesThermoModel("installThermoForSpecies", speciesNode["name"],
|
||||
"multiple");
|
||||
throw UnknownSpeciesThermoModel("installThermoForSpecies", speciesNode["name"],
|
||||
"multiple");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,208 +1,212 @@
|
|||
/**
|
||||
* @file StatMech.cpp
|
||||
* \link Cantera::SpeciesThermoInterpType SpeciesThermoInterpType\endlink
|
||||
* \link Cantera::SpeciesThermoInterpType SpeciesThermoInterpType\endlink
|
||||
*/
|
||||
|
||||
/* $Author: hkmoffa $
|
||||
* $Revision: 279 $
|
||||
* $Date: 2009-12-05 13:08:43 -0600 (Sat, 05 Dec 2009) $
|
||||
*/
|
||||
// Copyright 2007 Sandia National Laboratories
|
||||
|
||||
#include "cantera/thermo/StatMech.h"
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
namespace Cantera
|
||||
namespace Cantera
|
||||
{
|
||||
|
||||
// Statistical mechanics
|
||||
/*
|
||||
* @ingroup spthermo
|
||||
*/
|
||||
|
||||
//! Empty constructor
|
||||
StatMech::StatMech()
|
||||
: m_lowT(0.1), m_highT (1.0),
|
||||
m_Pref(1.0E5), m_index (0) {}
|
||||
// Statistical mechanics
|
||||
/*
|
||||
* @ingroup spthermo
|
||||
*/
|
||||
|
||||
//! Empty constructor
|
||||
StatMech::StatMech()
|
||||
: m_lowT(0.1), m_highT(1.0),
|
||||
m_Pref(1.0E5), m_index(0) {}
|
||||
|
||||
|
||||
// constructor used in templated instantiations
|
||||
/*
|
||||
* @param n Species index
|
||||
* @param tlow Minimum temperature
|
||||
* @param thigh Maximum temperature
|
||||
* @param pref reference pressure (Pa).
|
||||
* @param coeffs Vector of coefficients used to set the
|
||||
* parameters for the standard state.
|
||||
*/
|
||||
StatMech::StatMech(int n, doublereal tlow, doublereal thigh,
|
||||
doublereal pref,
|
||||
const doublereal* coeffs,
|
||||
std::string my_name) :
|
||||
m_lowT (tlow),
|
||||
m_highT (thigh),
|
||||
m_Pref (pref),
|
||||
m_index (n),
|
||||
sp_name (my_name)
|
||||
{
|
||||
// constructor used in templated instantiations
|
||||
/*
|
||||
* @param n Species index
|
||||
* @param tlow Minimum temperature
|
||||
* @param thigh Maximum temperature
|
||||
* @param pref reference pressure (Pa).
|
||||
* @param coeffs Vector of coefficients used to set the
|
||||
* parameters for the standard state.
|
||||
*/
|
||||
StatMech::StatMech(int n, doublereal tlow, doublereal thigh,
|
||||
doublereal pref,
|
||||
const doublereal* coeffs,
|
||||
std::string my_name) :
|
||||
m_lowT(tlow),
|
||||
m_highT(thigh),
|
||||
m_Pref(pref),
|
||||
m_index(n),
|
||||
sp_name(my_name)
|
||||
{
|
||||
// should error on zero -- cannot take ln(0)
|
||||
if(m_lowT <= 0.0){
|
||||
throw CanteraError("Error in StatMech.cpp",
|
||||
" Cannot take 0 tmin as input. \n\n");
|
||||
}
|
||||
if (m_lowT <= 0.0) {
|
||||
throw CanteraError("Error in StatMech.cpp",
|
||||
" Cannot take 0 tmin as input. \n\n");
|
||||
}
|
||||
buildmap();
|
||||
}
|
||||
}
|
||||
|
||||
// copy constructor
|
||||
/*
|
||||
* @param b object to be copied
|
||||
*/
|
||||
StatMech::StatMech(const StatMech& b) :
|
||||
m_lowT (b.m_lowT),
|
||||
m_highT (b.m_highT),
|
||||
m_Pref (b.m_Pref),
|
||||
m_index (b.m_index)
|
||||
{
|
||||
// copy constructor
|
||||
/*
|
||||
* @param b object to be copied
|
||||
*/
|
||||
StatMech::StatMech(const StatMech& b) :
|
||||
m_lowT(b.m_lowT),
|
||||
m_highT(b.m_highT),
|
||||
m_Pref(b.m_Pref),
|
||||
m_index(b.m_index)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// assignment operator
|
||||
/*
|
||||
* @param b object to be copied
|
||||
*/
|
||||
StatMech& StatMech::operator=(const StatMech& b) {
|
||||
// assignment operator
|
||||
/*
|
||||
* @param b object to be copied
|
||||
*/
|
||||
StatMech& StatMech::operator=(const StatMech& b)
|
||||
{
|
||||
if (&b != this) {
|
||||
m_lowT = b.m_lowT;
|
||||
m_highT = b.m_highT;
|
||||
m_Pref = b.m_Pref;
|
||||
m_index = b.m_index;
|
||||
m_lowT = b.m_lowT;
|
||||
m_highT = b.m_highT;
|
||||
m_Pref = b.m_Pref;
|
||||
m_index = b.m_index;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
}
|
||||
|
||||
// Destructor
|
||||
StatMech::~StatMech() {
|
||||
}
|
||||
// Destructor
|
||||
StatMech::~StatMech()
|
||||
{
|
||||
}
|
||||
|
||||
// duplicator
|
||||
SpeciesThermoInterpType *
|
||||
StatMech::duplMyselfAsSpeciesThermoInterpType() const {
|
||||
// duplicator
|
||||
SpeciesThermoInterpType*
|
||||
StatMech::duplMyselfAsSpeciesThermoInterpType() const
|
||||
{
|
||||
StatMech* np = new StatMech(*this);
|
||||
return (SpeciesThermoInterpType *) np;
|
||||
}
|
||||
return (SpeciesThermoInterpType*) np;
|
||||
}
|
||||
|
||||
// Returns the minimum temperature that the thermo
|
||||
// parameterization is valid
|
||||
doublereal StatMech::minTemp() const
|
||||
{
|
||||
return m_lowT;
|
||||
}
|
||||
// Returns the minimum temperature that the thermo
|
||||
// parameterization is valid
|
||||
doublereal StatMech::minTemp() const
|
||||
{
|
||||
return m_lowT;
|
||||
}
|
||||
|
||||
// Returns the maximum temperature that the thermo
|
||||
// parameterization is valid
|
||||
doublereal StatMech::maxTemp() const {
|
||||
// Returns the maximum temperature that the thermo
|
||||
// parameterization is valid
|
||||
doublereal StatMech::maxTemp() const
|
||||
{
|
||||
return m_highT;
|
||||
}
|
||||
}
|
||||
|
||||
// Returns the reference pressure (Pa)
|
||||
doublereal StatMech::refPressure() const { return m_Pref; }
|
||||
// Returns the reference pressure (Pa)
|
||||
doublereal StatMech::refPressure() const
|
||||
{
|
||||
return m_Pref;
|
||||
}
|
||||
|
||||
// Returns an integer representing the type of parameterization
|
||||
int StatMech::reportType() const {
|
||||
// Returns an integer representing the type of parameterization
|
||||
int StatMech::reportType() const
|
||||
{
|
||||
return STAT;
|
||||
}
|
||||
|
||||
// Returns an integer representing the species index
|
||||
size_t StatMech::speciesIndex() const {
|
||||
return m_index;
|
||||
}
|
||||
}
|
||||
|
||||
int StatMech::buildmap()
|
||||
{
|
||||
// Returns an integer representing the species index
|
||||
size_t StatMech::speciesIndex() const
|
||||
{
|
||||
return m_index;
|
||||
}
|
||||
|
||||
int StatMech::buildmap()
|
||||
{
|
||||
|
||||
// build vector of strings
|
||||
std::vector<std::string> SS;
|
||||
|
||||
|
||||
// now just iterate over name map to place each
|
||||
// string in a key
|
||||
|
||||
SS.push_back("Air");
|
||||
SS.push_back("CPAir");
|
||||
SS.push_back("Ar" );
|
||||
SS.push_back("Ar+" );
|
||||
SS.push_back("C" );
|
||||
SS.push_back("C+" );
|
||||
SS.push_back("C2" );
|
||||
SS.push_back("C2H" );
|
||||
SS.push_back("C2H2" );
|
||||
SS.push_back("C3" );
|
||||
SS.push_back("CF" );
|
||||
SS.push_back("CF2" );
|
||||
SS.push_back("CF3" );
|
||||
SS.push_back("CF4" );
|
||||
SS.push_back("CH" );
|
||||
SS.push_back("CH2" );
|
||||
SS.push_back("CH3" );
|
||||
SS.push_back("CH4" );
|
||||
SS.push_back("Cl" );
|
||||
SS.push_back("Cl2" );
|
||||
SS.push_back("CN" );
|
||||
SS.push_back("CN+" );
|
||||
SS.push_back("CO" );
|
||||
SS.push_back("CO+" );
|
||||
SS.push_back("CO2" );
|
||||
SS.push_back("F" );
|
||||
SS.push_back("F2" );
|
||||
SS.push_back("H" );
|
||||
SS.push_back("H+" );
|
||||
SS.push_back("H2" );
|
||||
SS.push_back("H2+" );
|
||||
SS.push_back("H2O" );
|
||||
SS.push_back("HCl" );
|
||||
SS.push_back("HCN" );
|
||||
SS.push_back("He" );
|
||||
SS.push_back("He+" );
|
||||
SS.push_back("N" );
|
||||
SS.push_back("N+" );
|
||||
SS.push_back("N2" );
|
||||
SS.push_back("CPN2" );
|
||||
SS.push_back("N2+" );
|
||||
SS.push_back("Ne" );
|
||||
SS.push_back("NCO" );
|
||||
SS.push_back("NH" );
|
||||
SS.push_back("NH+" );
|
||||
SS.push_back("NH2" );
|
||||
SS.push_back("NH3" );
|
||||
SS.push_back("NO" );
|
||||
SS.push_back("NO+" );
|
||||
SS.push_back("NO2" );
|
||||
SS.push_back("O" );
|
||||
SS.push_back("O+" );
|
||||
SS.push_back("O2" );
|
||||
SS.push_back("O2+" );
|
||||
SS.push_back("OH" );
|
||||
SS.push_back("Si" );
|
||||
SS.push_back("SiO" );
|
||||
SS.push_back("e");
|
||||
SS.push_back("Ar");
|
||||
SS.push_back("Ar+");
|
||||
SS.push_back("C");
|
||||
SS.push_back("C+");
|
||||
SS.push_back("C2");
|
||||
SS.push_back("C2H");
|
||||
SS.push_back("C2H2");
|
||||
SS.push_back("C3");
|
||||
SS.push_back("CF");
|
||||
SS.push_back("CF2");
|
||||
SS.push_back("CF3");
|
||||
SS.push_back("CF4");
|
||||
SS.push_back("CH");
|
||||
SS.push_back("CH2");
|
||||
SS.push_back("CH3");
|
||||
SS.push_back("CH4");
|
||||
SS.push_back("Cl");
|
||||
SS.push_back("Cl2");
|
||||
SS.push_back("CN");
|
||||
SS.push_back("CN+");
|
||||
SS.push_back("CO");
|
||||
SS.push_back("CO+");
|
||||
SS.push_back("CO2");
|
||||
SS.push_back("F");
|
||||
SS.push_back("F2");
|
||||
SS.push_back("H");
|
||||
SS.push_back("H+");
|
||||
SS.push_back("H2");
|
||||
SS.push_back("H2+");
|
||||
SS.push_back("H2O");
|
||||
SS.push_back("HCl");
|
||||
SS.push_back("HCN");
|
||||
SS.push_back("He");
|
||||
SS.push_back("He+");
|
||||
SS.push_back("N");
|
||||
SS.push_back("N+");
|
||||
SS.push_back("N2");
|
||||
SS.push_back("CPN2");
|
||||
SS.push_back("N2+");
|
||||
SS.push_back("Ne");
|
||||
SS.push_back("NCO");
|
||||
SS.push_back("NH");
|
||||
SS.push_back("NH+");
|
||||
SS.push_back("NH2");
|
||||
SS.push_back("NH3");
|
||||
SS.push_back("NO");
|
||||
SS.push_back("NO+");
|
||||
SS.push_back("NO2");
|
||||
SS.push_back("O");
|
||||
SS.push_back("O+");
|
||||
SS.push_back("O2");
|
||||
SS.push_back("O2+");
|
||||
SS.push_back("OH");
|
||||
SS.push_back("Si");
|
||||
SS.push_back("SiO");
|
||||
SS.push_back("e");
|
||||
|
||||
// now place each species in a map
|
||||
int ii;
|
||||
for(ii=0; ii < SS.size(); ii++)
|
||||
{
|
||||
name_map[SS[ii]]=(new species);
|
||||
for (ii=0; ii < SS.size(); ii++) {
|
||||
name_map[SS[ii]]=(new species);
|
||||
|
||||
// init to crazy defaults
|
||||
name_map[SS[ii]]->nvib = -1;
|
||||
name_map[SS[ii]]->cfs = -1;
|
||||
name_map[SS[ii]]->mol_weight = -1;
|
||||
// init to crazy defaults
|
||||
name_map[SS[ii]]->nvib = -1;
|
||||
name_map[SS[ii]]->cfs = -1;
|
||||
name_map[SS[ii]]->mol_weight = -1;
|
||||
|
||||
name_map[SS[ii]]->theta[0] =0.0;
|
||||
name_map[SS[ii]]->theta[1] =0.0;
|
||||
name_map[SS[ii]]->theta[2] =0.0;
|
||||
name_map[SS[ii]]->theta[3] =0.0;
|
||||
name_map[SS[ii]]->theta[4] =0.0;
|
||||
}
|
||||
name_map[SS[ii]]->theta[0] =0.0;
|
||||
name_map[SS[ii]]->theta[1] =0.0;
|
||||
name_map[SS[ii]]->theta[2] =0.0;
|
||||
name_map[SS[ii]]->theta[3] =0.0;
|
||||
name_map[SS[ii]]->theta[4] =0.0;
|
||||
}
|
||||
|
||||
// now set all species information
|
||||
|
||||
|
|
@ -220,12 +224,12 @@ namespace Cantera
|
|||
name_map["Ar"]->cfs = 1.5;
|
||||
name_map["Ar"]->mol_weight=39.944;
|
||||
name_map["Ar"]->nvib=0;
|
||||
|
||||
|
||||
// build Ar+
|
||||
name_map["Ar+"]->cfs = 1.5;
|
||||
name_map["Ar+"]->mol_weight=39.94345;
|
||||
name_map["Ar+"]->nvib=0;
|
||||
|
||||
|
||||
// build C
|
||||
name_map["C"]->cfs = 1.5;
|
||||
name_map["C"]->mol_weight=12.011;
|
||||
|
|
@ -235,7 +239,7 @@ namespace Cantera
|
|||
name_map["C+"]->cfs = 1.5;
|
||||
name_map["C+"]->mol_weight=12.01045;
|
||||
name_map["C+"]->nvib=0;
|
||||
|
||||
|
||||
// C2
|
||||
name_map["C2"]->cfs=2.5;
|
||||
name_map["C2"]->mol_weight=24.022;
|
||||
|
|
@ -322,7 +326,7 @@ namespace Cantera
|
|||
name_map["CH3"]->theta[1]=8.73370e+02;
|
||||
name_map["CH3"]->theta[2]=4.54960e+03;
|
||||
name_map["CH3"]->theta[3]=2.01150e+03;
|
||||
|
||||
|
||||
// CH4
|
||||
name_map["CH4"]->cfs=3;
|
||||
name_map["CH4"]->mol_weight=16.04300;
|
||||
|
|
@ -570,88 +574,79 @@ namespace Cantera
|
|||
name_map["e"]->nvib=0;
|
||||
|
||||
int dum = 0;
|
||||
for(ii=0; ii < SS.size(); ii++)
|
||||
{
|
||||
// check nvib was initalized for all species
|
||||
if(name_map[SS[ii]]->nvib == -1)
|
||||
{
|
||||
std::cout << name_map[SS[ii]]->nvib << std::endl;
|
||||
throw CanteraError("Error in StatMech.cpp",
|
||||
"nvib not initialized!. \n\n");
|
||||
for (ii=0; ii < SS.size(); ii++) {
|
||||
// check nvib was initalized for all species
|
||||
if (name_map[SS[ii]]->nvib == -1) {
|
||||
std::cout << name_map[SS[ii]]->nvib << std::endl;
|
||||
throw CanteraError("Error in StatMech.cpp",
|
||||
"nvib not initialized!. \n\n");
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// check that theta is initalized
|
||||
for(int i=0;i<name_map[SS[ii]]->nvib;i++)
|
||||
{
|
||||
if(name_map[SS[ii]]->theta[i] <= 0.0)
|
||||
{
|
||||
throw CanteraError("Error in StatMech.cpp",
|
||||
"theta not initalized!. \n\n");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// check that theta is initalized
|
||||
for (int i=0; i<name_map[SS[ii]]->nvib; i++) {
|
||||
if (name_map[SS[ii]]->theta[i] <= 0.0) {
|
||||
throw CanteraError("Error in StatMech.cpp",
|
||||
"theta not initalized!. \n\n");
|
||||
}
|
||||
}
|
||||
|
||||
// check that no non-zero theta exist
|
||||
// for any theta larger than nvib!
|
||||
for(int i=name_map[SS[ii]]->nvib;i<5;i++)
|
||||
{
|
||||
if(name_map[SS[ii]]->theta[i] != 0.0)
|
||||
{
|
||||
std::string err = "bad theta value for "+SS[ii]+"\n";
|
||||
throw CanteraError("StatMech.cpp",err);
|
||||
}
|
||||
} // done with for loop
|
||||
}
|
||||
// check that no non-zero theta exist
|
||||
// for any theta larger than nvib!
|
||||
for (int i=name_map[SS[ii]]->nvib; i<5; i++) {
|
||||
if (name_map[SS[ii]]->theta[i] != 0.0) {
|
||||
std::string err = "bad theta value for "+SS[ii]+"\n";
|
||||
throw CanteraError("StatMech.cpp",err);
|
||||
}
|
||||
} // done with for loop
|
||||
}
|
||||
|
||||
// check mol weight was initialized for all species
|
||||
if(name_map[SS[ii]]->mol_weight == -1)
|
||||
{
|
||||
std::cout << name_map[SS[ii]]->mol_weight << std::endl;
|
||||
throw CanteraError("Error in StatMech.cpp",
|
||||
"mol_weight not initialized!. \n\n");
|
||||
// check mol weight was initialized for all species
|
||||
if (name_map[SS[ii]]->mol_weight == -1) {
|
||||
std::cout << name_map[SS[ii]]->mol_weight << std::endl;
|
||||
throw CanteraError("Error in StatMech.cpp",
|
||||
"mol_weight not initialized!. \n\n");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// cfs was initialized for all species
|
||||
if(name_map[SS[ii]]->cfs == -1)
|
||||
{
|
||||
std::cout << name_map[SS[ii]]->cfs << std::endl;
|
||||
throw CanteraError("Error in StatMech.cpp",
|
||||
"cfs not initialized!. \n\n");
|
||||
// cfs was initialized for all species
|
||||
if (name_map[SS[ii]]->cfs == -1) {
|
||||
std::cout << name_map[SS[ii]]->cfs << std::endl;
|
||||
throw CanteraError("Error in StatMech.cpp",
|
||||
"cfs not initialized!. \n\n");
|
||||
|
||||
}
|
||||
|
||||
} // done with sanity checks
|
||||
|
||||
}
|
||||
|
||||
} // done with sanity checks
|
||||
|
||||
// mark it zero, dude
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Update the properties for this species
|
||||
/**
|
||||
*
|
||||
* \f[
|
||||
* \frac{C_p^0(T)}{R} = \frac{C_v^0(T)}{R} + 1
|
||||
* \f]
|
||||
*
|
||||
* Where,
|
||||
* \f[
|
||||
* \frac{C_v^0(T)}{R} = \frac{C_v^{tr}(T)}{R} + \frac{C_v^{vib}(T)}{R}
|
||||
* \f]
|
||||
*
|
||||
*
|
||||
* @param tt vector of temperature polynomials
|
||||
* @param cp_R Vector of Dimensionless heat capacities.
|
||||
* (length m_kk).
|
||||
* @param h_RT Vector of Dimensionless enthalpies.
|
||||
* (length m_kk).
|
||||
* @param s_R Vector of Dimensionless entropies.
|
||||
* (length m_kk).
|
||||
*/
|
||||
void StatMech::updateProperties(const doublereal* tt,
|
||||
doublereal* cp_R, doublereal* h_RT,
|
||||
doublereal* s_R) const {
|
||||
// Update the properties for this species
|
||||
/**
|
||||
*
|
||||
* \f[
|
||||
* \frac{C_p^0(T)}{R} = \frac{C_v^0(T)}{R} + 1
|
||||
* \f]
|
||||
*
|
||||
* Where,
|
||||
* \f[
|
||||
* \frac{C_v^0(T)}{R} = \frac{C_v^{tr}(T)}{R} + \frac{C_v^{vib}(T)}{R}
|
||||
* \f]
|
||||
*
|
||||
*
|
||||
* @param tt vector of temperature polynomials
|
||||
* @param cp_R Vector of Dimensionless heat capacities.
|
||||
* (length m_kk).
|
||||
* @param h_RT Vector of Dimensionless enthalpies.
|
||||
* (length m_kk).
|
||||
* @param s_R Vector of Dimensionless entropies.
|
||||
* (length m_kk).
|
||||
*/
|
||||
void StatMech::updateProperties(const doublereal* tt,
|
||||
doublereal* cp_R, doublereal* h_RT,
|
||||
doublereal* s_R) const
|
||||
{
|
||||
|
||||
std::map<std::string,species*>::iterator it;
|
||||
|
||||
|
|
@ -659,97 +654,94 @@ namespace Cantera
|
|||
species* s;
|
||||
|
||||
// pointer to map location of particular species
|
||||
if(name_map.find(sp_name) != name_map.end())
|
||||
{
|
||||
s = name_map.find(sp_name)->second;
|
||||
}
|
||||
else
|
||||
{
|
||||
//std::cout << sp_name << std::endl;
|
||||
throw CanteraError("StatMech.cpp",
|
||||
"species properties not found!. \n\n");
|
||||
}
|
||||
if (name_map.find(sp_name) != name_map.end()) {
|
||||
s = name_map.find(sp_name)->second;
|
||||
} else {
|
||||
//std::cout << sp_name << std::endl;
|
||||
throw CanteraError("StatMech.cpp",
|
||||
"species properties not found!. \n\n");
|
||||
}
|
||||
|
||||
// translational + rotational specific heat
|
||||
doublereal ctr = 0.0;
|
||||
double theta = 0.0;
|
||||
|
||||
|
||||
// 5/2 * R for molecules, 3/2 * R for atoms
|
||||
ctr += GasConstant * s->cfs;
|
||||
|
||||
// vibrational energy
|
||||
for(int i=0; i< s->nvib; i++)
|
||||
{
|
||||
theta = s->theta[i];
|
||||
ctr += GasConstant * theta * (theta* exp(theta/tt[0])/(tt[0]*tt[0]))/((exp(theta/tt[0])-1) * (exp(theta/tt[0])-1));
|
||||
}
|
||||
for (int i=0; i< s->nvib; i++) {
|
||||
theta = s->theta[i];
|
||||
ctr += GasConstant * theta * (theta* exp(theta/tt[0])/(tt[0]*tt[0]))/((exp(theta/tt[0])-1) * (exp(theta/tt[0])-1));
|
||||
}
|
||||
|
||||
// Cp = Cv + R
|
||||
doublereal cpdivR = ctr/GasConstant + 1;
|
||||
|
||||
// ACTUNG: fix enthalpy and entropy
|
||||
// ACTUNG: fix enthalpy and entropy
|
||||
doublereal hdivRT = 0.0;
|
||||
doublereal sdivR = 0.0;
|
||||
|
||||
// return the computed properties in the location in the output
|
||||
// return the computed properties in the location in the output
|
||||
// arrays for this species
|
||||
cp_R[m_index] = cpdivR;
|
||||
h_RT[m_index] = hdivRT;
|
||||
s_R [m_index] = sdivR;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Compute the reference-state property of one species
|
||||
/*
|
||||
* Given temperature T in K, this method updates the values of
|
||||
* the non-dimensional heat capacity at constant pressure,
|
||||
* enthalpy, and entropy, at the reference pressure, Pref
|
||||
* of one of the species. The species index is used
|
||||
* to reference into the cp_R, h_RT, and s_R arrays.
|
||||
*
|
||||
* Temperature Polynomial:
|
||||
* tt[0] = t;
|
||||
* tt[1] = t*t;
|
||||
* tt[2] = t*t*t;
|
||||
* tt[3] = t*t*t*t;
|
||||
* tt[4] = 1.0/t;
|
||||
* tt[5] = 1.0/(t*t);
|
||||
* tt[6] = std::log(t);
|
||||
*
|
||||
* @param temp Temperature (Kelvin)
|
||||
* @param cp_R Vector of Dimensionless heat capacities.
|
||||
* (length m_kk).
|
||||
* @param h_RT Vector of Dimensionless enthalpies.
|
||||
* (length m_kk).
|
||||
* @param s_R Vector of Dimensionless entropies.
|
||||
* (length m_kk).
|
||||
*/
|
||||
void StatMech::updatePropertiesTemp(const doublereal temp,
|
||||
doublereal* cp_R, doublereal* h_RT,
|
||||
doublereal* s_R) const {
|
||||
|
||||
// Compute the reference-state property of one species
|
||||
/*
|
||||
* Given temperature T in K, this method updates the values of
|
||||
* the non-dimensional heat capacity at constant pressure,
|
||||
* enthalpy, and entropy, at the reference pressure, Pref
|
||||
* of one of the species. The species index is used
|
||||
* to reference into the cp_R, h_RT, and s_R arrays.
|
||||
*
|
||||
* Temperature Polynomial:
|
||||
* tt[0] = t;
|
||||
* tt[1] = t*t;
|
||||
* tt[2] = t*t*t;
|
||||
* tt[3] = t*t*t*t;
|
||||
* tt[4] = 1.0/t;
|
||||
* tt[5] = 1.0/(t*t);
|
||||
* tt[6] = std::log(t);
|
||||
*
|
||||
* @param temp Temperature (Kelvin)
|
||||
* @param cp_R Vector of Dimensionless heat capacities.
|
||||
* (length m_kk).
|
||||
* @param h_RT Vector of Dimensionless enthalpies.
|
||||
* (length m_kk).
|
||||
* @param s_R Vector of Dimensionless entropies.
|
||||
* (length m_kk).
|
||||
*/
|
||||
void StatMech::updatePropertiesTemp(const doublereal temp,
|
||||
doublereal* cp_R, doublereal* h_RT,
|
||||
doublereal* s_R) const
|
||||
{
|
||||
double tPoly[1];
|
||||
tPoly[0] = temp;
|
||||
updateProperties(tPoly, cp_R, h_RT, s_R);
|
||||
}
|
||||
}
|
||||
|
||||
//This utility function reports back the type of
|
||||
// parameterization and all of the parameters for the
|
||||
// species, index.
|
||||
/*
|
||||
* All parameters are output variables
|
||||
*
|
||||
* @param n Species index
|
||||
* @param type Integer type of the standard type
|
||||
* @param tlow output - Minimum temperature
|
||||
* @param thigh output - Maximum temperature
|
||||
* @param pref output - reference pressure (Pa).
|
||||
* @param coeffs Vector of species state data
|
||||
*/
|
||||
void StatMech::reportParameters(size_t &n, int &type,
|
||||
doublereal &tlow, doublereal &thigh,
|
||||
doublereal &pref,
|
||||
doublereal* const coeffs) const
|
||||
{
|
||||
//This utility function reports back the type of
|
||||
// parameterization and all of the parameters for the
|
||||
// species, index.
|
||||
/*
|
||||
* All parameters are output variables
|
||||
*
|
||||
* @param n Species index
|
||||
* @param type Integer type of the standard type
|
||||
* @param tlow output - Minimum temperature
|
||||
* @param thigh output - Maximum temperature
|
||||
* @param pref output - reference pressure (Pa).
|
||||
* @param coeffs Vector of species state data
|
||||
*/
|
||||
void StatMech::reportParameters(size_t& n, int& type,
|
||||
doublereal& tlow, doublereal& thigh,
|
||||
doublereal& pref,
|
||||
doublereal* const coeffs) const
|
||||
{
|
||||
species* s;
|
||||
|
||||
n = m_index;
|
||||
|
|
@ -757,55 +749,50 @@ namespace Cantera
|
|||
tlow = m_lowT;
|
||||
thigh = m_highT;
|
||||
pref = m_Pref;
|
||||
for (int i = 0; i < 9; i++)
|
||||
{
|
||||
coeffs[i] = 0.0;
|
||||
}
|
||||
for (int i = 0; i < 9; i++) {
|
||||
coeffs[i] = 0.0;
|
||||
}
|
||||
doublereal temp = coeffs[0];
|
||||
coeffs[1] = m_lowT;
|
||||
coeffs[2] = m_highT;
|
||||
|
||||
// get species name, to gather species properties
|
||||
// pointer to map location of particular species
|
||||
if(name_map.find(sp_name) != name_map.end())
|
||||
{
|
||||
s = name_map.find(sp_name)->second;
|
||||
}
|
||||
else
|
||||
{
|
||||
//std::cout << sp_name << std::endl;
|
||||
throw CanteraError("StatMech.cpp",
|
||||
"species properties not found!. \n\n");
|
||||
}
|
||||
if (name_map.find(sp_name) != name_map.end()) {
|
||||
s = name_map.find(sp_name)->second;
|
||||
} else {
|
||||
//std::cout << sp_name << std::endl;
|
||||
throw CanteraError("StatMech.cpp",
|
||||
"species properties not found!. \n\n");
|
||||
}
|
||||
|
||||
double theta = 0.0;
|
||||
doublereal cvib = 0;
|
||||
|
||||
|
||||
// vibrational energy
|
||||
for(int i=0; i< s->nvib; i++)
|
||||
{
|
||||
theta = s->theta[i];
|
||||
cvib += GasConstant * theta * (theta* exp(theta/temp)/(temp*temp))/((exp(theta/temp)-1) * (exp(theta/temp)-1));
|
||||
}
|
||||
for (int i=0; i< s->nvib; i++) {
|
||||
theta = s->theta[i];
|
||||
cvib += GasConstant * theta * (theta* exp(theta/temp)/(temp*temp))/((exp(theta/temp)-1) * (exp(theta/temp)-1));
|
||||
}
|
||||
|
||||
// load vibrational energy
|
||||
coeffs[3] = GasConstant * s->cfs;
|
||||
coeffs[4] = cvib;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Modify parameters for the standard state
|
||||
/*
|
||||
* @param coeffs Vector of coefficients used to set the
|
||||
* parameters for the standard state.
|
||||
*/
|
||||
void StatMech::modifyParameters(doublereal* coeffs)
|
||||
{
|
||||
// Modify parameters for the standard state
|
||||
/*
|
||||
* @param coeffs Vector of coefficients used to set the
|
||||
* parameters for the standard state.
|
||||
*/
|
||||
void StatMech::modifyParameters(doublereal* coeffs)
|
||||
{
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -249,16 +249,13 @@ ThermoPhase* newPhase(XML_Node& xmlphase)
|
|||
ThermoPhase* t = newThermoPhase(model);
|
||||
if (model == "singing cows") {
|
||||
throw CanteraError(" newPhase", "Cows don't sing");
|
||||
}
|
||||
else if (model == "HMW") {
|
||||
} else if (model == "HMW") {
|
||||
HMWSoln* p = dynamic_cast<HMWSoln*>(t);
|
||||
p->constructPhaseXML(xmlphase,"");
|
||||
}
|
||||
else if (model == "IonsFromNeutralMolecule") {
|
||||
} else if (model == "IonsFromNeutralMolecule") {
|
||||
IonsFromNeutralVPSSTP* p = dynamic_cast<IonsFromNeutralVPSSTP*>(t);
|
||||
p->constructPhaseXML(xmlphase,"");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
importPhase(xmlphase, t);
|
||||
}
|
||||
return t;
|
||||
|
|
|
|||
|
|
@ -294,7 +294,7 @@ doublereal WaterProps::ADebye(doublereal T, doublereal P_input, int ifunc)
|
|||
doublereal dw = density_IAPWS(T, P);
|
||||
doublereal tmp = sqrt(2.0 * Avogadro * dw / 1000.);
|
||||
doublereal tmp2 = ElectronCharge * ElectronCharge * Avogadro /
|
||||
(epsilon * GasConstant * T);
|
||||
(epsilon * GasConstant * T);
|
||||
doublereal tmp3 = tmp2 * sqrt(tmp2);
|
||||
doublereal A_Debye = tmp * tmp3 / (8.0 * Pi);
|
||||
|
||||
|
|
|
|||
|
|
@ -687,7 +687,7 @@ void Substance::set_TPp(double Temp, double Pressure)
|
|||
|
||||
// loop
|
||||
while (P_here = Pp(),
|
||||
fabs(Pressure - P_here) >= ErrP*Pressure || LoopCount == 0) {
|
||||
fabs(Pressure - P_here) >= ErrP* Pressure || LoopCount == 0) {
|
||||
if (P_here < 0.0) {
|
||||
BracketSlope(Pressure);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
#include "cantera/transport/GasTransport.h"
|
||||
#include "cantera/transport/TransportParams.h"
|
||||
|
||||
namespace Cantera {
|
||||
namespace Cantera
|
||||
{
|
||||
|
||||
GasTransport::GasTransport(ThermoPhase* thermo) :
|
||||
Transport(thermo),
|
||||
|
|
@ -135,7 +136,8 @@ bool GasTransport::initGas(GasTransportParams& tr)
|
|||
return true;
|
||||
}
|
||||
|
||||
void GasTransport::update_T(void) {
|
||||
void GasTransport::update_T(void)
|
||||
{
|
||||
double T = m_thermo->temperature();
|
||||
if (T == m_temp) {
|
||||
return;
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -373,7 +373,7 @@ Transport* TransportFactory::newTransport(std::string transportModel,
|
|||
tr = new MixTransport;
|
||||
initTransport(tr, phase, CK_Mode, log_level);
|
||||
break;
|
||||
// adding pecos transport model 2/13/12
|
||||
// adding pecos transport model 2/13/12
|
||||
case cPecosTransport:
|
||||
tr = new PecosTransport;
|
||||
initTransport(tr, phase, 0, log_level);
|
||||
|
|
@ -712,8 +712,8 @@ void TransportFactory::initLiquidTransport(Transport* tran,
|
|||
}
|
||||
|
||||
void TransportFactory::fitCollisionIntegrals(ostream& logfile,
|
||||
GasTransportParams& tr,
|
||||
MMCollisionInt& integrals)
|
||||
GasTransportParams& tr,
|
||||
MMCollisionInt& integrals)
|
||||
{
|
||||
vector_fp::iterator dptr;
|
||||
doublereal dstar;
|
||||
|
|
@ -1145,7 +1145,7 @@ void TransportFactory::getLiquidInteractionsTransportData(const XML_Node& transp
|
|||
*********************************************************/
|
||||
|
||||
void TransportFactory::fitProperties(GasTransportParams& tr,
|
||||
MMCollisionInt& integrals, std::ostream& logfile)
|
||||
MMCollisionInt& integrals, std::ostream& logfile)
|
||||
{
|
||||
doublereal tstar;
|
||||
int ndeg = 0;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# $Id: runtest,v 1.8 2006/08/14 19:32:55 hkmoffa Exp $
|
||||
#
|
||||
temp_success="1"
|
||||
/bin/rm -f eq1.csv tr1.csv tr2.csv kin1.csv kin2.csv \
|
||||
kin1_blessed_tmp.csv kin2_blessed_tmp.csv
|
||||
|
|
@ -115,7 +113,7 @@ fi
|
|||
#
|
||||
cp kin1_blessed.csv kin1_blessed_tmp.csv
|
||||
if test x"$machType" = "xcygwin" ; then
|
||||
/bin/cp kin1_blessed_win.csv kin1_blessed_tmp.csv
|
||||
/bin/cp kin1_blessed_win.csv kin1_blessed_tmp.csv
|
||||
fi
|
||||
|
||||
$CANTERA_BIN/csvdiff -r 3.0E-3 kin1.csv kin1_blessed_tmp.csv > kin1_test.out
|
||||
|
|
@ -150,7 +148,7 @@ fi
|
|||
#
|
||||
cp kin2_blessed.csv kin2_blessed_tmp.csv
|
||||
if test x"$machType" = "xcygwin" ; then
|
||||
/bin/cp kin2_blessed_win.csv kin2_blessed_tmp.csv
|
||||
/bin/cp kin2_blessed_win.csv kin2_blessed_tmp.csv
|
||||
fi
|
||||
|
||||
$CANTERA_BIN/csvdiff kin2.csv kin2_blessed_tmp.csv > kin2_test.out
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue