*** empty log message ***
This commit is contained in:
parent
79cdac83b9
commit
c1fc4ef78d
7 changed files with 39 additions and 29 deletions
|
|
@ -133,10 +133,11 @@ namespace Cantera {
|
|||
template<class InputIter, class InputIter2>
|
||||
inline doublereal dot(InputIter x_begin, InputIter x_end,
|
||||
InputIter2 y_begin) {
|
||||
doublereal sum = 0.0;
|
||||
for(; x_begin != x_end; ++x_begin, ++y_begin)
|
||||
sum += *x_begin * *y_begin;
|
||||
return sum;
|
||||
return inner_product(x_begin, x_end, y_begin, 0.0);
|
||||
//doublereal sum = 0.0;
|
||||
//for(; x_begin != x_end; ++x_begin, ++y_begin)
|
||||
//sum += *x_begin * *y_begin;
|
||||
//return sum;
|
||||
}
|
||||
|
||||
//! Multiply elements of an array by a scale factor.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
/**
|
||||
* @file BasisOptimize.cpp
|
||||
* Functions which calculation optimized basis of the
|
||||
|
|
@ -82,7 +83,7 @@ int Cantera::BasisOptimize(int *usedZeroedSpecies, bool doFormRxn,
|
|||
vector_int & orderVectorElements,
|
||||
vector_fp & formRxnMatrix) {
|
||||
|
||||
int j, jj, k, kk, l, i, jl, ml;
|
||||
int j, jj, k=0, kk, l, i, jl, ml;
|
||||
bool lindep;
|
||||
std::string ename;
|
||||
std::string sname;
|
||||
|
|
@ -615,7 +616,7 @@ int Cantera::ElemRearrange(int nComponents, const vector_fp & elementAbundances,
|
|||
vector_int & orderVectorSpecies,
|
||||
vector_int & orderVectorElements) {
|
||||
|
||||
int j, k, l, i, jl, ml, jr, ielem, jj, kk;
|
||||
int j, k, l, i, jl, ml, jr, ielem, jj, kk=0;
|
||||
|
||||
bool lindep = false;
|
||||
int nelements = mphase->nElements();
|
||||
|
|
|
|||
|
|
@ -182,8 +182,11 @@ namespace Cantera {
|
|||
// mixture object.
|
||||
MultiPhase::phase_t& MultiPhase::phase(index_t n) {
|
||||
if (!m_init) init();
|
||||
m_phase[n]->setState_TPX(m_temp, m_press,
|
||||
DATA_PTR(m_moleFractions) + m_spstart[n]);
|
||||
m_phase[n]->setTemperature(m_temp);
|
||||
m_phase[n]->setMoleFractions_NoNorm(DATA_PTR(m_moleFractions) + m_spstart[n]);
|
||||
m_phase[n]->setPressure(m_press);
|
||||
//m_phase[n]->setState_TPX(m_temp, m_press,
|
||||
// DATA_PTR(m_moleFractions) + m_spstart[n]);
|
||||
return *m_phase[n];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ namespace Cantera {
|
|||
|
||||
const doublereal TINY = 1.0e-20;
|
||||
|
||||
#if defined(WITH_HTML_LOGS)
|
||||
/// Used to print reaction equations. Given a stoichiometric
|
||||
/// coefficient 'nu' and a chemical symbol 'sym', return a string
|
||||
/// for this species in the reaction.
|
||||
|
|
@ -30,7 +31,7 @@ namespace Cantera {
|
|||
string s = fp2str(fabs(nu));
|
||||
return strt + s + " " + sym;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/// Constructor. Construct a multiphase equilibrium manager for a
|
||||
/// multiphase mixture.
|
||||
|
|
@ -475,7 +476,7 @@ namespace Cantera {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
#if defined(WITH_HTML_LOGS)
|
||||
void MultiPhaseEquil::printInfo() {
|
||||
index_t m, ik, k;
|
||||
beginLogGroup("info");
|
||||
|
|
@ -523,6 +524,7 @@ namespace Cantera {
|
|||
}
|
||||
return sr + " <=> " + sp;
|
||||
}
|
||||
#endif
|
||||
|
||||
void MultiPhaseEquil::step(doublereal omega, vector_fp& deltaN) {
|
||||
index_t k, ik;
|
||||
|
|
@ -726,10 +728,6 @@ namespace Cantera {
|
|||
}
|
||||
}
|
||||
sum -= psum / (fabs(m_mix->phaseMoles(ip)) + TINY);
|
||||
// if (ISNAN(sum)) {
|
||||
// cout << " sum is nan. " << endl;
|
||||
// cout << psum << " " << m_mix->phaseMoles(ip) << endl;
|
||||
// }
|
||||
}
|
||||
}
|
||||
rfctr = term1 + csum + sum;
|
||||
|
|
@ -737,16 +735,8 @@ namespace Cantera {
|
|||
fctr = 1.0;
|
||||
else
|
||||
fctr = 1.0/(term1 + csum + sum);
|
||||
// if (ISNAN(fctr)) {
|
||||
// cout << "fctr is nan." << endl;
|
||||
// cout << term1 << " " << csum << " " << sum << " " << TINY << endl;
|
||||
//}
|
||||
}
|
||||
dxi[j] = -fctr*dg_rt;
|
||||
//if (ISNAN(dxi[j])) {
|
||||
// cout << "nan detected. " << endl;
|
||||
// cout << fctr << " " << dg_rt << endl;
|
||||
//}
|
||||
|
||||
index_t m;
|
||||
for (m = 0; m < m_nel; m++) {
|
||||
|
|
|
|||
|
|
@ -58,10 +58,15 @@ namespace Cantera {
|
|||
|
||||
doublereal equilibrate(int XY, doublereal err = 1.0e-9,
|
||||
int maxsteps = 1000, int loglevel=-99);
|
||||
|
||||
std::string reactionString(index_t j);
|
||||
doublereal error();
|
||||
|
||||
#if defined(WITH_HTML_LOGS)
|
||||
std::string reactionString(index_t j);
|
||||
void printInfo();
|
||||
#else
|
||||
inline std::string reactionString(index_t j) { return std::string(""); }
|
||||
inline void printInfo() {}
|
||||
#endif
|
||||
|
||||
void setInitialMixMoles() {
|
||||
setInitialMoles();
|
||||
|
|
|
|||
|
|
@ -28,6 +28,13 @@
|
|||
|
||||
using namespace std;
|
||||
|
||||
template<class T> struct timesConstant : public unary_function<T, double>
|
||||
{
|
||||
timesConstant(T c) : m_c(c) {}
|
||||
double operator()(T x) {return m_c * x;}
|
||||
T m_c;
|
||||
};
|
||||
|
||||
namespace Cantera {
|
||||
|
||||
State::State() : m_kk(0), m_temp(0.0), m_dens(0.001), m_mmw(0.0) {}
|
||||
|
|
@ -95,10 +102,13 @@ namespace Cantera {
|
|||
int k;
|
||||
m_mmw = dot(x, x + m_kk, m_molwts.begin());
|
||||
doublereal rmmw = 1.0/m_mmw;
|
||||
for (k = 0; k != m_kk; ++k) {
|
||||
m_ym[k] = x[k]*rmmw;
|
||||
m_y[k] = m_ym[k] * m_molwts[k];
|
||||
}
|
||||
//for (k = 0; k != m_kk; ++k) {
|
||||
// m_ym[k] = x[k]*rmmw;
|
||||
//m_y[k] = m_ym[k] * m_molwts[k];
|
||||
//}
|
||||
transform(x, x + m_kk, m_ym.begin(), timesConstant<double>(rmmw));
|
||||
transform(m_y.begin(), m_y.begin() + m_kk, m_molwts.begin(),
|
||||
m_y.begin(), multiplies<double>());
|
||||
}
|
||||
|
||||
doublereal State::massFraction(int k) const {
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
#define CT_STATE2_H
|
||||
|
||||
#include "ct_defs.h"
|
||||
#include "utilities.h"
|
||||
|
||||
namespace Cantera {
|
||||
|
||||
|
|
@ -334,7 +335,6 @@ namespace Cantera {
|
|||
//! True if the number species has been set
|
||||
bool ready() const { return (m_kk > 0); }
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue