corrected bug that caused problems if this SpeciesThermo manager was used in conjunction with another one (e.g. NASA).
This commit is contained in:
parent
b366e7122b
commit
4aa20002f4
1 changed files with 23 additions and 16 deletions
|
|
@ -30,11 +30,14 @@ namespace Cantera {
|
|||
virtual void install(string name, int index, int type,
|
||||
const doublereal* c,
|
||||
doublereal minTemp, doublereal maxTemp, doublereal refPressure) {
|
||||
//writelog("installing const_cp for species "+name+"\n");
|
||||
m_logt0.push_back(log(c[0]));
|
||||
m_t0.push_back(c[0]);
|
||||
m_h0_R.push_back(c[1]/GasConstant);
|
||||
m_s0_R.push_back(c[2]/GasConstant);
|
||||
m_cp0_R.push_back(c[3]/GasConstant);
|
||||
m_index.push_back(index);
|
||||
m_loc[index] = m_nsp;
|
||||
m_nsp++;
|
||||
doublereal tlow = minTemp;
|
||||
doublereal thigh = maxTemp;
|
||||
|
|
@ -48,13 +51,14 @@ namespace Cantera {
|
|||
|
||||
virtual void update(doublereal t, doublereal* cp_R,
|
||||
doublereal* h_RT, doublereal* s_R) const {
|
||||
int k;
|
||||
int k, ki;
|
||||
doublereal logt = log(t);
|
||||
doublereal rt = 1.0/t;
|
||||
for (k = 0; k < m_nsp; k++) {
|
||||
cp_R[k] = m_cp0_R[k];
|
||||
h_RT[k] = rt*(m_h0_R[k] + (t - m_t0[k]) * m_cp0_R[k]);
|
||||
s_R[k] = m_s0_R[k] + m_cp0_R[k] * (logt - m_logt0[k]);
|
||||
ki = m_index[k];
|
||||
cp_R[ki] = m_cp0_R[k];
|
||||
h_RT[ki] = rt*(m_h0_R[k] + (t - m_t0[k]) * m_cp0_R[k]);
|
||||
s_R[ki] = m_s0_R[k] + m_cp0_R[k] * (logt - m_logt0[k]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -62,23 +66,24 @@ namespace Cantera {
|
|||
doublereal* h_RT, doublereal* s_R) const {
|
||||
doublereal logt = log(t);
|
||||
doublereal rt = 1.0/t;
|
||||
cp_R[k] = m_cp0_R[k];
|
||||
h_RT[k] = rt*(m_h0_R[k] + (t - m_t0[k]) * m_cp0_R[k]);
|
||||
s_R[k] = m_s0_R[k] + m_cp0_R[k] * (logt - m_logt0[k]);
|
||||
int loc = m_loc[k];
|
||||
cp_R[k] = m_cp0_R[loc];
|
||||
h_RT[k] = rt*(m_h0_R[loc] + (t - m_t0[loc]) * m_cp0_R[loc]);
|
||||
s_R[k] = m_s0_R[loc] + m_cp0_R[loc] * (logt - m_logt0[loc]);
|
||||
}
|
||||
|
||||
virtual doublereal minTemp(int k=-1) const {
|
||||
if (k < 0)
|
||||
return m_tlow_max;
|
||||
else
|
||||
return m_tlow[k];
|
||||
return m_tlow[m_loc[k]];
|
||||
}
|
||||
|
||||
virtual doublereal maxTemp(int k=-1) const {
|
||||
if (k < 0)
|
||||
return m_thigh_min;
|
||||
else
|
||||
return m_thigh[k];
|
||||
return m_thigh[m_loc[k]];
|
||||
}
|
||||
|
||||
virtual doublereal refPressure(int k=-1) const {return m_p0;}
|
||||
|
|
@ -97,13 +102,14 @@ namespace Cantera {
|
|||
doublereal &maxTemp,
|
||||
doublereal &refPressure) {
|
||||
type = reportType(index);
|
||||
int loc = m_loc[index];
|
||||
if (type == SIMPLE) {
|
||||
c[0] = m_t0[index];
|
||||
c[1] = m_h0_R[index] * GasConstant;
|
||||
c[2] = m_s0_R[index] * GasConstant;
|
||||
c[3] = m_cp0_R[index] * GasConstant;
|
||||
minTemp = m_tlow[index];
|
||||
maxTemp = m_thigh[index];
|
||||
c[0] = m_t0[loc];
|
||||
c[1] = m_h0_R[loc] * GasConstant;
|
||||
c[2] = m_s0_R[loc] * GasConstant;
|
||||
c[3] = m_cp0_R[loc] * GasConstant;
|
||||
minTemp = m_tlow[loc];
|
||||
maxTemp = m_thigh[loc];
|
||||
refPressure = m_p0;
|
||||
}
|
||||
}
|
||||
|
|
@ -111,7 +117,8 @@ namespace Cantera {
|
|||
|
||||
protected:
|
||||
|
||||
map<int, int> m_index;
|
||||
mutable map<int, int> m_loc;
|
||||
vector_int m_index;
|
||||
doublereal m_tlow_max;
|
||||
doublereal m_thigh_min;
|
||||
vector_fp m_tlow;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue