Fixed numerous compiler warnings from MSVC
This commit is contained in:
parent
708b78f68b
commit
e8b04fb2b4
63 changed files with 493 additions and 517 deletions
|
|
@ -238,7 +238,7 @@ public:
|
||||||
|
|
||||||
//! Set all of the entries to zero
|
//! Set all of the entries to zero
|
||||||
inline void zero() {
|
inline void zero() {
|
||||||
int nn = m_nrows * m_ncols;
|
size_t nn = m_nrows * m_ncols;
|
||||||
if (nn > 0) {
|
if (nn > 0) {
|
||||||
/*
|
/*
|
||||||
* Using memset is the fastest way to zero a contiguous
|
* Using memset is the fastest way to zero a contiguous
|
||||||
|
|
|
||||||
|
|
@ -715,13 +715,13 @@ extern void mdp_init_int_1(int* const v, const int value, const int len);
|
||||||
*
|
*
|
||||||
* @param tmp number to be checked
|
* @param tmp number to be checked
|
||||||
*/
|
*/
|
||||||
extern void checkZeroFinite(const double tmp) throw(std::range_error);
|
extern void checkZeroFinite(const double tmp);
|
||||||
|
|
||||||
//! Utility routine to check to see that a number is finite.
|
//! Utility routine to check to see that a number is finite.
|
||||||
/*!
|
/*!
|
||||||
* @param tmp number to be checked
|
* @param tmp number to be checked
|
||||||
*/
|
*/
|
||||||
extern void checkFinite(const double tmp) throw(std::range_error);
|
extern void checkFinite(const double tmp);
|
||||||
|
|
||||||
//! Utility routine to link checkFinte() to fortran program
|
//! Utility routine to link checkFinte() to fortran program
|
||||||
/*!
|
/*!
|
||||||
|
|
@ -741,8 +741,7 @@ extern "C" void checkfinite_(double* tmp);
|
||||||
* @param tmp Number to be checked
|
* @param tmp Number to be checked
|
||||||
* @param trigger bounds on the number. Defaults to 1.0E20
|
* @param trigger bounds on the number. Defaults to 1.0E20
|
||||||
*/
|
*/
|
||||||
extern void checkMagnitude(const double tmp, const double trigger = 1.0E20)
|
extern void checkMagnitude(const double tmp, const double trigger = 1.0E20);
|
||||||
throw(std::range_error);
|
|
||||||
|
|
||||||
} /* end of mdp namespace */
|
} /* end of mdp namespace */
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,12 @@ std::string int2str(const int n, const std::string& fmt);
|
||||||
*/
|
*/
|
||||||
std::string int2str(const int n);
|
std::string int2str(const int n);
|
||||||
|
|
||||||
|
//! Convert an unsigned integer to a string
|
||||||
|
/*!
|
||||||
|
* @param n int to be converted
|
||||||
|
*/
|
||||||
|
std::string int2str(const size_t n);
|
||||||
|
|
||||||
//! Strip the leading and trailing white space
|
//! Strip the leading and trailing white space
|
||||||
//! from a string
|
//! from a string
|
||||||
/*!
|
/*!
|
||||||
|
|
|
||||||
|
|
@ -707,39 +707,20 @@ R poly3(D x, R* c)
|
||||||
template<class D>
|
template<class D>
|
||||||
void deepStdVectorPointerCopy(const std::vector<D*> &fromVec, std::vector<D*> &toVec)
|
void deepStdVectorPointerCopy(const std::vector<D*> &fromVec, std::vector<D*> &toVec)
|
||||||
{
|
{
|
||||||
int is = toVec.size();
|
size_t is = toVec.size();
|
||||||
for (int i = 0; i < is; is++) {
|
for (size_t i = 0; i < is; is++) {
|
||||||
if (toVec[i]) {
|
if (toVec[i]) {
|
||||||
delete(toVec[i]);
|
delete(toVec[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is = fromVec.size();
|
is = fromVec.size();
|
||||||
toVec.resize(is);
|
toVec.resize(is);
|
||||||
for (int i = 0; i < is; is++) {
|
for (size_t i = 0; i < is; is++) {
|
||||||
toVec[i] = new D(*(fromVec[i]));
|
toVec[i] = new D(*(fromVec[i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//@}
|
//@}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -165,7 +165,7 @@ public:
|
||||||
*
|
*
|
||||||
* @return returns the number of rows and columns in the matrix.
|
* @return returns the number of rows and columns in the matrix.
|
||||||
*/
|
*/
|
||||||
virtual size_t nRowsAndStruct(int* const iStruct = 0) const;
|
virtual size_t nRowsAndStruct(size_t* const iStruct = 0) const;
|
||||||
|
|
||||||
//! Number of columns
|
//! Number of columns
|
||||||
size_t nColumns() const;
|
size_t nColumns() const;
|
||||||
|
|
@ -190,7 +190,7 @@ public:
|
||||||
* @param b Vector to do the rh multiplcation
|
* @param b Vector to do the rh multiplcation
|
||||||
* @param prod OUTPUT vector to receive the result
|
* @param prod OUTPUT vector to receive the result
|
||||||
*/
|
*/
|
||||||
virtual void mult(const doublereal* const b, doublereal* const prod) const;
|
virtual void mult(const doublereal* b, doublereal* prod) const;
|
||||||
|
|
||||||
//! Multiply b*A and write result to prod.
|
//! Multiply b*A and write result to prod.
|
||||||
/*!
|
/*!
|
||||||
|
|
@ -231,7 +231,7 @@ public:
|
||||||
* 0 indicates a success
|
* 0 indicates a success
|
||||||
* ~0 Some error occurred, see the LAPACK documentation
|
* ~0 Some error occurred, see the LAPACK documentation
|
||||||
*/
|
*/
|
||||||
int solve(doublereal* const b);
|
int solve(doublereal* b);
|
||||||
|
|
||||||
|
|
||||||
//! Returns an iterator for the start of the band storage data
|
//! Returns an iterator for the start of the band storage data
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ public:
|
||||||
* @param m New number of columns
|
* @param m New number of columns
|
||||||
* @param v Default fill value. defaults to zero.
|
* @param v Default fill value. defaults to zero.
|
||||||
*/
|
*/
|
||||||
DenseMatrix(int n, int m, doublereal v = 0.0);
|
DenseMatrix(size_t n, size_t m, doublereal v = 0.0);
|
||||||
|
|
||||||
//! Copy constructor
|
//! Copy constructor
|
||||||
/*!
|
/*!
|
||||||
|
|
@ -108,7 +108,7 @@ public:
|
||||||
* @param m New number of columns
|
* @param m New number of columns
|
||||||
* @param v Default fill value. defaults to zero.
|
* @param v Default fill value. defaults to zero.
|
||||||
*/
|
*/
|
||||||
void resize(int n, int m, doublereal v = 0.0);
|
void resize(size_t n, size_t m, doublereal v = 0.0);
|
||||||
|
|
||||||
//! Return a vector of const pointers to the columns
|
//! Return a vector of const pointers to the columns
|
||||||
/*!
|
/*!
|
||||||
|
|
@ -269,7 +269,7 @@ void increment(const DenseMatrix& A, const double* const b, double* const prod);
|
||||||
* @param nn Size of A. This defaults to -1, which means that the number
|
* @param nn Size of A. This defaults to -1, which means that the number
|
||||||
* of rows is used as the default size of n
|
* of rows is used as the default size of n
|
||||||
*/
|
*/
|
||||||
int invert(DenseMatrix& A, int nn=-1);
|
int invert(DenseMatrix& A, size_t nn=npos);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ public:
|
||||||
* @param b Vector to do the rh multiplcation
|
* @param b Vector to do the rh multiplcation
|
||||||
* @param prod OUTPUT vector to receive the result
|
* @param prod OUTPUT vector to receive the result
|
||||||
*/
|
*/
|
||||||
virtual void mult(const doublereal* const b, doublereal* const prod) const = 0;
|
virtual void mult(const doublereal* b, doublereal* prod) const = 0;
|
||||||
|
|
||||||
//! Multiply b*A and write result to prod.
|
//! Multiply b*A and write result to prod.
|
||||||
/*!
|
/*!
|
||||||
|
|
@ -143,7 +143,7 @@ public:
|
||||||
*
|
*
|
||||||
* @return returns the number of rows and columns in the matrix.
|
* @return returns the number of rows and columns in the matrix.
|
||||||
*/
|
*/
|
||||||
virtual size_t nRowsAndStruct(int* const iStruct = 0) const = 0;
|
virtual size_t nRowsAndStruct(size_t* const iStruct = 0) const = 0;
|
||||||
|
|
||||||
//! clear the factored flag
|
//! clear the factored flag
|
||||||
virtual void clearFactorFlag() = 0;
|
virtual void clearFactorFlag() = 0;
|
||||||
|
|
|
||||||
|
|
@ -929,7 +929,7 @@ private:
|
||||||
int solnType_;
|
int solnType_;
|
||||||
|
|
||||||
//! Local copy of the number of equations
|
//! Local copy of the number of equations
|
||||||
int neq_;
|
size_t neq_;
|
||||||
|
|
||||||
//! Soln error weights
|
//! Soln error weights
|
||||||
std::vector<doublereal> m_ewt;
|
std::vector<doublereal> m_ewt;
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@ public:
|
||||||
* @param b Vector to do the rh multiplcation
|
* @param b Vector to do the rh multiplcation
|
||||||
* @param prod OUTPUT vector to receive the result
|
* @param prod OUTPUT vector to receive the result
|
||||||
*/
|
*/
|
||||||
virtual void mult(const doublereal* const b, doublereal* const prod) const;
|
virtual void mult(const doublereal* b, doublereal* prod) const;
|
||||||
|
|
||||||
//! Multiply b*A and write result to prod.
|
//! Multiply b*A and write result to prod.
|
||||||
/*!
|
/*!
|
||||||
|
|
@ -216,7 +216,7 @@ public:
|
||||||
*
|
*
|
||||||
* @return returns the number of rows and columns in the matrix.
|
* @return returns the number of rows and columns in the matrix.
|
||||||
*/
|
*/
|
||||||
size_t nRowsAndStruct(int* const iStruct = 0) const;
|
size_t nRowsAndStruct(size_t* const iStruct = 0) const;
|
||||||
|
|
||||||
//! Duplicate this object
|
//! Duplicate this object
|
||||||
virtual GeneralMatrix* duplMyselfAsGeneralMatrix() const;
|
virtual GeneralMatrix* duplMyselfAsGeneralMatrix() const;
|
||||||
|
|
|
||||||
|
|
@ -395,30 +395,30 @@ inline void ct_dscal(int n, doublereal da, doublereal* dx, int incx)
|
||||||
cblas_dscal(n, da, dx, incx);
|
cblas_dscal(n, da, dx, incx);
|
||||||
}
|
}
|
||||||
//====================================================================================================================
|
//====================================================================================================================
|
||||||
inline void ct_dgeqrf(int m, int n, doublereal* a, int lda, doublereal* tau,
|
inline void ct_dgeqrf(size_t m, size_t n, doublereal* a, size_t lda, doublereal* tau,
|
||||||
doublereal* work, int lwork, int& info)
|
doublereal* work, size_t lwork, int& info)
|
||||||
{
|
{
|
||||||
integer f_m = m;
|
integer f_m = static_cast<integer>(m);
|
||||||
integer f_n = n;
|
integer f_n = static_cast<integer>(n);
|
||||||
integer f_lda = lda;
|
integer f_lda = static_cast<integer>(lda);
|
||||||
integer f_lwork = lwork;
|
integer f_lwork = static_cast<integer>(lwork);
|
||||||
integer f_info = info;
|
integer f_info = info;
|
||||||
_DGEQRF_(&f_m, &f_n, a, &f_lda, tau, work, &f_lwork, &f_info);
|
_DGEQRF_(&f_m, &f_n, a, &f_lda, tau, work, &f_lwork, &f_info);
|
||||||
info = f_info;
|
info = f_info;
|
||||||
}
|
}
|
||||||
//====================================================================================================================
|
//====================================================================================================================
|
||||||
inline void ct_dormqr(ctlapack::side_t rlside, ctlapack::transpose_t trans, int m,
|
inline void ct_dormqr(ctlapack::side_t rlside, ctlapack::transpose_t trans, size_t m,
|
||||||
int n, int k, doublereal* a, int lda, doublereal* tau, doublereal* c, int ldc,
|
size_t n, size_t k, doublereal* a, size_t lda, doublereal* tau, doublereal* c, size_t ldc,
|
||||||
doublereal* work, size_t lwork, int& info)
|
doublereal* work, size_t lwork, int& info)
|
||||||
{
|
{
|
||||||
char side = left_right[rlside];
|
char side = left_right[rlside];
|
||||||
char tr = no_yes[trans];
|
char tr = no_yes[trans];
|
||||||
integer f_m = m;
|
integer f_m = static_cast<integer>(m);
|
||||||
integer f_n = n;
|
integer f_n = static_cast<integer>(n);
|
||||||
integer f_k = k;
|
integer f_k = static_cast<integer>(k);
|
||||||
integer f_lwork = static_cast<integer>(lwork);
|
integer f_lwork = static_cast<integer>(lwork);
|
||||||
integer f_lda = lda;
|
integer f_lda = static_cast<integer>(lda);
|
||||||
integer f_ldc = ldc;
|
integer f_ldc = static_cast<integer>(ldc);
|
||||||
integer f_info = info;
|
integer f_info = info;
|
||||||
#ifdef NO_FTN_STRING_LEN_AT_END
|
#ifdef NO_FTN_STRING_LEN_AT_END
|
||||||
_DORMQR_(&side, &tr, &f_m, &f_n, &f_k, a, &f_lda, tau, c, &f_ldc, work, &f_lwork, &f_info);
|
_DORMQR_(&side, &tr, &f_m, &f_n, &f_k, a, &f_lda, tau, c, &f_ldc, work, &f_lwork, &f_info);
|
||||||
|
|
@ -434,7 +434,7 @@ inline void ct_dormqr(ctlapack::side_t rlside, ctlapack::transpose_t trans, int
|
||||||
}
|
}
|
||||||
//====================================================================================================================
|
//====================================================================================================================
|
||||||
inline void ct_dtrtrs(ctlapack::upperlower_t uplot, ctlapack::transpose_t trans, const char* diag,
|
inline void ct_dtrtrs(ctlapack::upperlower_t uplot, ctlapack::transpose_t trans, const char* diag,
|
||||||
int n, int nrhs, doublereal* a, int lda, doublereal* b, int ldb, int& info)
|
size_t n, size_t nrhs, doublereal* a, size_t lda, doublereal* b, size_t ldb, int& info)
|
||||||
{
|
{
|
||||||
char uplo = upper_lower[uplot];
|
char uplo = upper_lower[uplot];
|
||||||
char tr = no_yes[trans];
|
char tr = no_yes[trans];
|
||||||
|
|
@ -442,10 +442,10 @@ inline void ct_dtrtrs(ctlapack::upperlower_t uplot, ctlapack::transpose_t trans,
|
||||||
if (diag) {
|
if (diag) {
|
||||||
dd = diag[0];
|
dd = diag[0];
|
||||||
}
|
}
|
||||||
integer f_n = n;
|
integer f_n = static_cast<integer>(n);
|
||||||
integer f_nrhs = nrhs;
|
integer f_nrhs = static_cast<integer>(nrhs);
|
||||||
integer f_lda = lda;
|
integer f_lda = static_cast<integer>(lda);
|
||||||
integer f_ldb = ldb;
|
integer f_ldb = static_cast<integer>(ldb);
|
||||||
integer f_info = info;
|
integer f_info = info;
|
||||||
#ifdef NO_FTN_STRING_LEN_AT_END
|
#ifdef NO_FTN_STRING_LEN_AT_END
|
||||||
_DTRTRS_(&uplo, &tr, &dd, &f_n, &f_nrhs, a, &f_lda, b, &f_ldb, &f_info);
|
_DTRTRS_(&uplo, &tr, &dd, &f_n, &f_nrhs, a, &f_lda, b, &f_ldb, &f_info);
|
||||||
|
|
@ -466,7 +466,7 @@ inline void ct_dtrtrs(ctlapack::upperlower_t uplot, ctlapack::transpose_t trans,
|
||||||
* @param iwork Must be dimensioned equal to or greater than N
|
* @param iwork Must be dimensioned equal to or greater than N
|
||||||
*/
|
*/
|
||||||
inline doublereal ct_dtrcon(const char* norm, ctlapack::upperlower_t uplot, const char* diag,
|
inline doublereal ct_dtrcon(const char* norm, ctlapack::upperlower_t uplot, const char* diag,
|
||||||
int n, doublereal* a, int lda, doublereal* work, int* iwork, int& info)
|
size_t n, doublereal* a, size_t lda, doublereal* work, int* iwork, int& info)
|
||||||
{
|
{
|
||||||
char uplo = upper_lower[uplot];
|
char uplo = upper_lower[uplot];
|
||||||
char dd = 'N';
|
char dd = 'N';
|
||||||
|
|
@ -477,8 +477,8 @@ inline doublereal ct_dtrcon(const char* norm, ctlapack::upperlower_t uplot, con
|
||||||
if (norm) {
|
if (norm) {
|
||||||
nn = norm[0];
|
nn = norm[0];
|
||||||
}
|
}
|
||||||
integer f_n = n;
|
integer f_n = static_cast<integer>(n);
|
||||||
integer f_lda = lda;
|
integer f_lda = static_cast<integer>(lda);
|
||||||
integer f_info = info;
|
integer f_info = info;
|
||||||
doublereal rcond;
|
doublereal rcond;
|
||||||
#ifdef NO_FTN_STRING_LEN_AT_END
|
#ifdef NO_FTN_STRING_LEN_AT_END
|
||||||
|
|
@ -500,11 +500,11 @@ inline doublereal ct_dtrcon(const char* norm, ctlapack::upperlower_t uplot, con
|
||||||
* @param work Must be dimensioned equal to greater than 3N
|
* @param work Must be dimensioned equal to greater than 3N
|
||||||
* @param iwork Must be dimensioned equal to or greater than N
|
* @param iwork Must be dimensioned equal to or greater than N
|
||||||
*/
|
*/
|
||||||
inline void ct_dpotrf(ctlapack::upperlower_t uplot, int n, doublereal* a, int lda, int& info)
|
inline void ct_dpotrf(ctlapack::upperlower_t uplot, size_t n, doublereal* a, size_t lda, int& info)
|
||||||
{
|
{
|
||||||
char uplo = upper_lower[uplot];
|
char uplo = upper_lower[uplot];
|
||||||
integer f_n = n;
|
integer f_n = static_cast<integer>(n);
|
||||||
integer f_lda = lda;
|
integer f_lda = static_cast<integer>(lda);
|
||||||
integer f_info = info;
|
integer f_info = info;
|
||||||
|
|
||||||
#ifdef NO_FTN_STRING_LEN_AT_END
|
#ifdef NO_FTN_STRING_LEN_AT_END
|
||||||
|
|
@ -524,14 +524,14 @@ inline void ct_dpotrf(ctlapack::upperlower_t uplot, int n, doublereal* a, int ld
|
||||||
//!
|
//!
|
||||||
/*!
|
/*!
|
||||||
*/
|
*/
|
||||||
inline void ct_dpotrs(ctlapack::upperlower_t uplot, int n, int nrhs, doublereal* a, int lda,
|
inline void ct_dpotrs(ctlapack::upperlower_t uplot, size_t n, size_t nrhs, doublereal* a, size_t lda,
|
||||||
doublereal* b, int ldb, int& info)
|
doublereal* b, size_t ldb, int& info)
|
||||||
{
|
{
|
||||||
char uplo = upper_lower[uplot];
|
char uplo = upper_lower[uplot];
|
||||||
integer f_n = n;
|
integer f_n = static_cast<integer>(n);
|
||||||
integer f_nrhs = nrhs;
|
integer f_nrhs = static_cast<integer>(nrhs);
|
||||||
integer f_lda = lda;
|
integer f_lda = static_cast<integer>(lda);
|
||||||
integer f_ldb = ldb;
|
integer f_ldb = static_cast<integer>(ldb);
|
||||||
integer f_info = info;
|
integer f_info = info;
|
||||||
|
|
||||||
#ifdef NO_FTN_STRING_LEN_AT_END
|
#ifdef NO_FTN_STRING_LEN_AT_END
|
||||||
|
|
@ -552,15 +552,15 @@ inline void ct_dpotrs(ctlapack::upperlower_t uplot, int n, int nrhs, doublereal*
|
||||||
//!
|
//!
|
||||||
/*!
|
/*!
|
||||||
*/
|
*/
|
||||||
inline doublereal ct_dgecon(const char norm, int n, doublereal* a, int lda, doublereal anorm,
|
inline doublereal ct_dgecon(const char norm, size_t n, doublereal* a, size_t lda, doublereal anorm,
|
||||||
doublereal* work, int* iwork, int& info)
|
doublereal* work, int* iwork, int& info)
|
||||||
{
|
{
|
||||||
char cnorm = '1';
|
char cnorm = '1';
|
||||||
if (norm) {
|
if (norm) {
|
||||||
cnorm = norm;
|
cnorm = norm;
|
||||||
}
|
}
|
||||||
integer f_n = n;
|
integer f_n = static_cast<integer>(n);
|
||||||
integer f_lda = lda;
|
integer f_lda = static_cast<integer>(lda);
|
||||||
integer f_info = info;
|
integer f_info = info;
|
||||||
doublereal rcond;
|
doublereal rcond;
|
||||||
|
|
||||||
|
|
@ -582,17 +582,18 @@ inline doublereal ct_dgecon(const char norm, int n, doublereal* a, int lda, doub
|
||||||
//!
|
//!
|
||||||
/*!
|
/*!
|
||||||
*/
|
*/
|
||||||
inline doublereal ct_dgbcon(const char norm, int n, int kl, int ku, doublereal* a, int ldab, int* ipiv, doublereal anorm,
|
inline doublereal ct_dgbcon(const char norm, size_t n, size_t kl, size_t ku,
|
||||||
|
doublereal* a, size_t ldab, int* ipiv, doublereal anorm,
|
||||||
doublereal* work, int* iwork, int& info)
|
doublereal* work, int* iwork, int& info)
|
||||||
{
|
{
|
||||||
char cnorm = '1';
|
char cnorm = '1';
|
||||||
if (norm) {
|
if (norm) {
|
||||||
cnorm = norm;
|
cnorm = norm;
|
||||||
}
|
}
|
||||||
integer f_n = n;
|
integer f_n = static_cast<integer>(n);
|
||||||
integer f_kl = kl;
|
integer f_kl = static_cast<integer>(kl);
|
||||||
integer f_ku = ku;
|
integer f_ku = static_cast<integer>(ku);
|
||||||
integer f_ldab = ldab;
|
integer f_ldab = static_cast<integer>(ldab);
|
||||||
integer f_info = info;
|
integer f_info = info;
|
||||||
doublereal rcond;
|
doublereal rcond;
|
||||||
|
|
||||||
|
|
@ -614,16 +615,16 @@ inline doublereal ct_dgbcon(const char norm, int n, int kl, int ku, doublereal*
|
||||||
//!
|
//!
|
||||||
/*!
|
/*!
|
||||||
*/
|
*/
|
||||||
inline doublereal ct_dlange(const char norm, int m, int n, doublereal* a, int lda,
|
inline doublereal ct_dlange(const char norm, size_t m, size_t n, doublereal* a, size_t lda,
|
||||||
doublereal* work)
|
doublereal* work)
|
||||||
{
|
{
|
||||||
char cnorm = '1';
|
char cnorm = '1';
|
||||||
if (norm) {
|
if (norm) {
|
||||||
cnorm = norm;
|
cnorm = norm;
|
||||||
}
|
}
|
||||||
integer f_m = m;
|
integer f_m = static_cast<integer>(m);
|
||||||
integer f_n = n;
|
integer f_n = static_cast<integer>(n);
|
||||||
integer f_lda = lda;
|
integer f_lda = static_cast<integer>(lda);
|
||||||
doublereal anorm;
|
doublereal anorm;
|
||||||
|
|
||||||
#ifdef NO_FTN_STRING_LEN_AT_END
|
#ifdef NO_FTN_STRING_LEN_AT_END
|
||||||
|
|
|
||||||
|
|
@ -232,25 +232,25 @@ private:
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//! Printing routine that gets called after every iteration
|
//! Printing routine that gets called after every iteration
|
||||||
virtual void printIteration(int ioflag, doublereal damp, int label_d, int label_t,
|
virtual void printIteration(int ioflag, doublereal damp, int label_d, size_t label_t,
|
||||||
doublereal inv_t, doublereal t_real, int iter,
|
doublereal inv_t, doublereal t_real, int iter,
|
||||||
doublereal update_norm, doublereal resid_norm,
|
doublereal update_norm, doublereal resid_norm,
|
||||||
doublereal netProdRate[], doublereal CSolnSP[],
|
doublereal netProdRate[], doublereal CSolnSP[],
|
||||||
doublereal resid[],
|
doublereal resid[],
|
||||||
doublereal wtSpecies[], int dim, bool do_time);
|
doublereal wtSpecies[], size_t dim, bool do_time);
|
||||||
|
|
||||||
|
|
||||||
//! Print a summary of the solution
|
//! Print a summary of the solution
|
||||||
/*!
|
/*!
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
virtual void printFinal(int ioflag, doublereal damp, int label_d, int label_t,
|
virtual void printFinal(int ioflag, doublereal damp, int label_d, size_t label_t,
|
||||||
doublereal inv_t, doublereal t_real, int iter,
|
doublereal inv_t, doublereal t_real, int iter,
|
||||||
doublereal update_norm, doublereal resid_norm,
|
doublereal update_norm, doublereal resid_norm,
|
||||||
doublereal netProdRateKinSpecies[], const doublereal CSolnSP[],
|
doublereal netProdRateKinSpecies[], const doublereal CSolnSP[],
|
||||||
const doublereal resid[],
|
const doublereal resid[],
|
||||||
const doublereal wtSpecies[], const doublereal wtRes[],
|
const doublereal wtSpecies[], const doublereal wtRes[],
|
||||||
int dim, bool do_time);
|
size_t dim, bool do_time);
|
||||||
|
|
||||||
//! Calculate a conservative delta T to use in a pseudo-steady state
|
//! Calculate a conservative delta T to use in a pseudo-steady state
|
||||||
//! algorithm
|
//! algorithm
|
||||||
|
|
@ -284,7 +284,7 @@ private:
|
||||||
* @return Returns the 1. / delta T to be used on the next step
|
* @return Returns the 1. / delta T to be used on the next step
|
||||||
*/
|
*/
|
||||||
virtual doublereal calc_t(doublereal netProdRateSolnSP[], doublereal Csoln[],
|
virtual doublereal calc_t(doublereal netProdRateSolnSP[], doublereal Csoln[],
|
||||||
int* label, int* label_old,
|
size_t* label, size_t* label_old,
|
||||||
doublereal* label_factor, int ioflag);
|
doublereal* label_factor, int ioflag);
|
||||||
|
|
||||||
//! Calculate the solution and residual weights
|
//! Calculate the solution and residual weights
|
||||||
|
|
@ -364,7 +364,7 @@ private:
|
||||||
* @param dim Size of the solution vector
|
* @param dim Size of the solution vector
|
||||||
* @param label return int, stating which solution component caused the most damping.
|
* @param label return int, stating which solution component caused the most damping.
|
||||||
*/
|
*/
|
||||||
virtual doublereal calc_damping(doublereal x[], doublereal dxneg[], int dim, int* label);
|
virtual doublereal calc_damping(doublereal x[], doublereal dxneg[], size_t dim, int* label);
|
||||||
|
|
||||||
//! residual function pointer to be solved.
|
//! residual function pointer to be solved.
|
||||||
ResidEval* m_residFunc;
|
ResidEval* m_residFunc;
|
||||||
|
|
|
||||||
|
|
@ -137,7 +137,7 @@ public:
|
||||||
*/
|
*/
|
||||||
int atomicNumber(size_t m) const;
|
int atomicNumber(size_t m) const;
|
||||||
|
|
||||||
int elementType(int m) const;
|
int elementType(size_t m) const;
|
||||||
|
|
||||||
/// Return a read-only reference to the vector of element names.
|
/// Return a read-only reference to the vector of element names.
|
||||||
const std::vector<std::string>& elementNames() const;
|
const std::vector<std::string>& elementNames() const;
|
||||||
|
|
@ -232,8 +232,8 @@ public:
|
||||||
* @param elem_type Specifies the type of the element constraint equation. This defaults
|
* @param elem_type Specifies the type of the element constraint equation. This defaults
|
||||||
* to CT_ELEM_TYPE_ABSPOS, i.e., an element.
|
* to CT_ELEM_TYPE_ABSPOS, i.e., an element.
|
||||||
*/
|
*/
|
||||||
int addUniqueElementAfterFreeze(const std::string& symbol, doublereal weight, int atomicNumber,
|
size_t addUniqueElementAfterFreeze(const std::string& symbol, doublereal weight, int atomicNumber,
|
||||||
doublereal entropy298 = ENTROPY298_UNKNOWN, int elem_type = CT_ELEM_TYPE_ABSPOS);
|
doublereal entropy298 = ENTROPY298_UNKNOWN, int elem_type = CT_ELEM_TYPE_ABSPOS);
|
||||||
|
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -205,7 +205,7 @@ public:
|
||||||
*
|
*
|
||||||
* @return Returns the element type
|
* @return Returns the element type
|
||||||
*/
|
*/
|
||||||
int elementType(int m) const;
|
int elementType(size_t m) const;
|
||||||
|
|
||||||
//! Change the element type of the mth constraint
|
//! Change the element type of the mth constraint
|
||||||
/*!
|
/*!
|
||||||
|
|
|
||||||
|
|
@ -332,7 +332,7 @@ public:
|
||||||
/*!
|
/*!
|
||||||
* @param lnac Output vector of ln activity coefficients. Length: m_kk.
|
* @param lnac Output vector of ln activity coefficients. Length: m_kk.
|
||||||
*/
|
*/
|
||||||
virtual void getActivityCoefficients(doublereal* const ac) const;
|
virtual void getActivityCoefficients(doublereal* ac) const;
|
||||||
|
|
||||||
|
|
||||||
//! Get the array of temperature derivatives of the log activity coefficients
|
//! Get the array of temperature derivatives of the log activity coefficients
|
||||||
|
|
@ -368,7 +368,7 @@ public:
|
||||||
* @param dlnActCoeffdlnN Output vector of derivatives of the
|
* @param dlnActCoeffdlnN Output vector of derivatives of the
|
||||||
* log Activity Coefficients. length = m_kk * m_kk
|
* log Activity Coefficients. length = m_kk * m_kk
|
||||||
*/
|
*/
|
||||||
virtual void getdlnActCoeffdlnN(const int ld, doublereal* const dlnActCoeffdlnN) {
|
virtual void getdlnActCoeffdlnN(const size_t ld, doublereal* const dlnActCoeffdlnN) {
|
||||||
err(" getdlnActCoeffdlnN: nonzero and nonimplemented");
|
err(" getdlnActCoeffdlnN: nonzero and nonimplemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -391,7 +391,7 @@ public:
|
||||||
* @param dlnActCoeffdlnN Output vector of derivatives of the
|
* @param dlnActCoeffdlnN Output vector of derivatives of the
|
||||||
* log Activity Coefficients. length = m_kk * m_kk
|
* log Activity Coefficients. length = m_kk * m_kk
|
||||||
*/
|
*/
|
||||||
virtual void getdlnActCoeffdlnN(const int ld, doublereal* const dlnActCoeffdlnN) ;
|
virtual void getdlnActCoeffdlnN(const size_t ld, doublereal* const dlnActCoeffdlnN) ;
|
||||||
|
|
||||||
|
|
||||||
//! Get the Salt Dissociation Coefficients
|
//! Get the Salt Dissociation Coefficients
|
||||||
|
|
|
||||||
|
|
@ -165,7 +165,7 @@ public:
|
||||||
* @param k index of the species. Default is -1, which will return the max of the min value
|
* @param k index of the species. Default is -1, which will return the max of the min value
|
||||||
* over all species.
|
* over all species.
|
||||||
*/
|
*/
|
||||||
virtual doublereal minTemp(int k = -1) const;
|
virtual doublereal minTemp(size_t k = npos) const;
|
||||||
|
|
||||||
//! Maximum temperature for which the thermodynamic data for the species
|
//! Maximum temperature for which the thermodynamic data for the species
|
||||||
//! are valid.
|
//! are valid.
|
||||||
|
|
@ -179,7 +179,7 @@ public:
|
||||||
* @param k index of the species. Default is -1, which will return the min of the max value
|
* @param k index of the species. Default is -1, which will return the min of the max value
|
||||||
* over all species.
|
* over all species.
|
||||||
*/
|
*/
|
||||||
virtual doublereal maxTemp(int k = -1) const;
|
virtual doublereal maxTemp(size_t k = npos) const;
|
||||||
|
|
||||||
|
|
||||||
//! Returns the reference pressure in Pa. This function is a wrapper
|
//! Returns the reference pressure in Pa. This function is a wrapper
|
||||||
|
|
@ -715,9 +715,7 @@ protected:
|
||||||
//! Temporary vector
|
//! Temporary vector
|
||||||
mutable vector_fp tmpV_;
|
mutable vector_fp tmpV_;
|
||||||
|
|
||||||
std::vector<doublereal> nspLattice_;
|
std::vector<size_t> lkstart_;
|
||||||
|
|
||||||
std::vector<int> lkstart_;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -801,7 +801,7 @@ public:
|
||||||
* @param dlnActCoeffdlnN Output vector of derivatives of the
|
* @param dlnActCoeffdlnN Output vector of derivatives of the
|
||||||
* log Activity Coefficients. length = m_kk * m_kk
|
* log Activity Coefficients. length = m_kk * m_kk
|
||||||
*/
|
*/
|
||||||
virtual void getdlnActCoeffdlnN(const int ld, doublereal* const dlnActCoeffdlnN) ;
|
virtual void getdlnActCoeffdlnN(const size_t ld, doublereal* const dlnActCoeffdlnN) ;
|
||||||
|
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -806,7 +806,7 @@ public:
|
||||||
* @param dlnActCoeffdlnN Output vector of derivatives of the
|
* @param dlnActCoeffdlnN Output vector of derivatives of the
|
||||||
* log Activity Coefficients. length = m_kk * m_kk
|
* log Activity Coefficients. length = m_kk * m_kk
|
||||||
*/
|
*/
|
||||||
virtual void getdlnActCoeffdlnN(const int ld, doublereal* const dlnActCoeffdlnN) ;
|
virtual void getdlnActCoeffdlnN(const size_t ld, doublereal* const dlnActCoeffdlnN) ;
|
||||||
|
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
|
@ -829,7 +829,7 @@ private:
|
||||||
/*!
|
/*!
|
||||||
* @param num Number of binary Margules interaction terms
|
* @param num Number of binary Margules interaction terms
|
||||||
*/
|
*/
|
||||||
void resizeNumInteractions(const int num);
|
void resizeNumInteractions(const size_t num);
|
||||||
|
|
||||||
|
|
||||||
//! Initialize lengths of local variables after all species have
|
//! Initialize lengths of local variables after all species have
|
||||||
|
|
@ -948,14 +948,14 @@ protected:
|
||||||
* Each Margules excess Gibbs free energy term involves two species, A and B.
|
* Each Margules excess Gibbs free energy term involves two species, A and B.
|
||||||
* This vector identifies species A.
|
* This vector identifies species A.
|
||||||
*/
|
*/
|
||||||
vector_int m_pSpecies_A_ij;
|
std::vector<size_t> m_pSpecies_A_ij;
|
||||||
|
|
||||||
//! vector of species indices representing species B in the interaction
|
//! vector of species indices representing species B in the interaction
|
||||||
/*!
|
/*!
|
||||||
* Each Margules excess Gibbs free energy term involves two species, A and B.
|
* Each Margules excess Gibbs free energy term involves two species, A and B.
|
||||||
* This vector identifies species B.
|
* This vector identifies species B.
|
||||||
*/
|
*/
|
||||||
vector_int m_pSpecies_B_ij;
|
std::vector<size_t> m_pSpecies_B_ij;
|
||||||
|
|
||||||
//! form of the Margules interaction expression
|
//! form of the Margules interaction expression
|
||||||
/*!
|
/*!
|
||||||
|
|
|
||||||
|
|
@ -810,7 +810,7 @@ public:
|
||||||
* @param dlnActCoeffdlnN Output vector of derivatives of the
|
* @param dlnActCoeffdlnN Output vector of derivatives of the
|
||||||
* log Activity Coefficients. length = m_kk * m_kk
|
* log Activity Coefficients. length = m_kk * m_kk
|
||||||
*/
|
*/
|
||||||
virtual void getdlnActCoeffdlnN(const int ld, doublereal* const dlnActCoeffdlnN) {
|
virtual void getdlnActCoeffdlnN(const size_t ld, doublereal* const dlnActCoeffdlnN) {
|
||||||
getdlnActCoeffdlnN_numderiv(ld, dlnActCoeffdlnN);
|
getdlnActCoeffdlnN_numderiv(ld, dlnActCoeffdlnN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -515,15 +515,15 @@ protected:
|
||||||
mutable std::vector<doublereal> PBMoleFractions_;
|
mutable std::vector<doublereal> PBMoleFractions_;
|
||||||
|
|
||||||
//! Vector of cation indecises in the mixture
|
//! Vector of cation indecises in the mixture
|
||||||
std::vector<int> cationList_;
|
std::vector<size_t> cationList_;
|
||||||
|
|
||||||
//! Number of cations in the mixture
|
//! Number of cations in the mixture
|
||||||
size_t numCationSpecies_;
|
size_t numCationSpecies_;
|
||||||
|
|
||||||
std::vector<int> anionList_;
|
std::vector<size_t> anionList_;
|
||||||
size_t numAnionSpecies_;
|
size_t numAnionSpecies_;
|
||||||
|
|
||||||
std::vector<int> passThroughList_;
|
std::vector<size_t> passThroughList_;
|
||||||
size_t numPassThroughSpecies_;
|
size_t numPassThroughSpecies_;
|
||||||
size_t neutralPBindexStart;
|
size_t neutralPBindexStart;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -802,7 +802,7 @@ public:
|
||||||
* @param dlnActCoeffdlnN Output vector of derivatives of the
|
* @param dlnActCoeffdlnN Output vector of derivatives of the
|
||||||
* log Activity Coefficients. length = m_kk * m_kk
|
* log Activity Coefficients. length = m_kk * m_kk
|
||||||
*/
|
*/
|
||||||
virtual void getdlnActCoeffdlnN(const int ld, doublereal* const dlnActCoeffdlnN);
|
virtual void getdlnActCoeffdlnN(const size_t ld, doublereal* const dlnActCoeffdlnN);
|
||||||
|
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
|
@ -825,7 +825,7 @@ private:
|
||||||
/*!
|
/*!
|
||||||
* @param num Number of binary Margules interaction terms
|
* @param num Number of binary Margules interaction terms
|
||||||
*/
|
*/
|
||||||
void resizeNumInteractions(const int num);
|
void resizeNumInteractions(const size_t num);
|
||||||
|
|
||||||
|
|
||||||
//! Initialize lengths of local variables after all species have
|
//! Initialize lengths of local variables after all species have
|
||||||
|
|
|
||||||
|
|
@ -1160,7 +1160,7 @@ public:
|
||||||
/*!
|
/*!
|
||||||
* @param lnac Output vector of ln activity coefficients. Length: m_kk.
|
* @param lnac Output vector of ln activity coefficients. Length: m_kk.
|
||||||
*/
|
*/
|
||||||
virtual void getLnActivityCoefficients(doublereal* const lnac) const;
|
virtual void getLnActivityCoefficients(doublereal* lnac) const;
|
||||||
|
|
||||||
//@}
|
//@}
|
||||||
/// @name Partial Molar Properties of the Solution
|
/// @name Partial Molar Properties of the Solution
|
||||||
|
|
@ -2198,9 +2198,9 @@ public:
|
||||||
* @param dlnActCoeffdlnN Output vector of derivatives of the
|
* @param dlnActCoeffdlnN Output vector of derivatives of the
|
||||||
* log Activity Coefficients. length = m_kk * m_kk
|
* log Activity Coefficients. length = m_kk * m_kk
|
||||||
*/
|
*/
|
||||||
virtual void getdlnActCoeffdlnN(const int ld, doublereal* const dlnActCoeffdlnN);
|
virtual void getdlnActCoeffdlnN(const size_t ld, doublereal* const dlnActCoeffdlnN);
|
||||||
|
|
||||||
virtual void getdlnActCoeffdlnN_numderiv(const int ld, doublereal* const dlnActCoeffdlnN);
|
virtual void getdlnActCoeffdlnN_numderiv(const size_t ld, doublereal* const dlnActCoeffdlnN);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
|
|
|
||||||
|
|
@ -591,7 +591,7 @@ public:
|
||||||
* Flat vector with the m_nsp in the inner loop.
|
* Flat vector with the m_nsp in the inner loop.
|
||||||
* length = ldx * ndim
|
* length = ldx * ndim
|
||||||
*/
|
*/
|
||||||
virtual void getSpeciesFluxes(int ndim, const doublereal* const grad_T,
|
virtual void getSpeciesFluxes(size_t ndim, const doublereal* const grad_T,
|
||||||
int ldx, const doublereal* const grad_X,
|
int ldx, const doublereal* const grad_X,
|
||||||
int ldf, doublereal* const fluxes);
|
int ldf, doublereal* const fluxes);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -144,7 +144,7 @@ public:
|
||||||
/*!
|
/*!
|
||||||
* @param visc Vector of species viscosities
|
* @param visc Vector of species viscosities
|
||||||
*/
|
*/
|
||||||
virtual void getSpeciesViscosities(doublereal* visc) {
|
virtual void getSpeciesViscosities(doublereal* const visc) {
|
||||||
update_T();
|
update_T();
|
||||||
updateViscosity_T();
|
updateViscosity_T();
|
||||||
copy(m_visc.begin(), m_visc.end(), visc);
|
copy(m_visc.begin(), m_visc.end(), visc);
|
||||||
|
|
@ -271,7 +271,7 @@ public:
|
||||||
* Flat vector with the m_nsp in the inner loop.
|
* Flat vector with the m_nsp in the inner loop.
|
||||||
* length = ldx * ndim
|
* length = ldx * ndim
|
||||||
*/
|
*/
|
||||||
virtual void getSpeciesFluxes(size_t ndim, const doublereal* grad_T,
|
virtual void getSpeciesFluxes(size_t ndim, const doublereal* grad_T,
|
||||||
int ldx, const doublereal* grad_X,
|
int ldx, const doublereal* grad_X,
|
||||||
int ldf, doublereal* fluxes);
|
int ldf, doublereal* fluxes);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -185,7 +185,7 @@ public:
|
||||||
*
|
*
|
||||||
* @see TransportFactory
|
* @see TransportFactory
|
||||||
*/
|
*/
|
||||||
Transport(thermo_t* thermo=0, int ndim = 1);
|
Transport(thermo_t* thermo=0, size_t ndim = 1);
|
||||||
|
|
||||||
//! Destructor.
|
//! Destructor.
|
||||||
virtual ~Transport();
|
virtual ~Transport();
|
||||||
|
|
@ -544,7 +544,7 @@ public:
|
||||||
* Flat vector with the m_nsp in the inner loop.
|
* Flat vector with the m_nsp in the inner loop.
|
||||||
* length = ldx * ndim
|
* length = ldx * ndim
|
||||||
*/
|
*/
|
||||||
virtual void getSpeciesFluxes(int ndim, const doublereal* const grad_T,
|
virtual void getSpeciesFluxes(size_t ndim, const doublereal* const grad_T,
|
||||||
int ldx, const doublereal* const grad_X,
|
int ldx, const doublereal* const grad_X,
|
||||||
int ldf, doublereal* const fluxes);
|
int ldf, doublereal* const fluxes);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -210,7 +210,7 @@ void addIntegerArray(Cantera::XML_Node& node, const std::string& title, const si
|
||||||
if (type != "") {
|
if (type != "") {
|
||||||
f.addAttribute("type",type);
|
f.addAttribute("type",type);
|
||||||
}
|
}
|
||||||
f.addAttribute("size",n);
|
f.addAttribute("size", static_cast<double>(n));
|
||||||
#ifndef CTML_VERSION_1_4
|
#ifndef CTML_VERSION_1_4
|
||||||
f.addAttribute("vtype", "intArray");
|
f.addAttribute("vtype", "intArray");
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -1026,7 +1026,7 @@ doublereal getFloatDefaultUnits(const Cantera::XML_Node& parent, std::string nam
|
||||||
* @verbatim
|
* @verbatim
|
||||||
std::string modelName = "";
|
std::string modelName = "";
|
||||||
bool exists = getOptionalModel(transportNode, "compositionDependence",
|
bool exists = getOptionalModel(transportNode, "compositionDependence",
|
||||||
modelName);
|
modelName);
|
||||||
@endverbatim
|
@endverbatim
|
||||||
*
|
*
|
||||||
* Reads the corresponding XML file:
|
* Reads the corresponding XML file:
|
||||||
|
|
@ -1263,7 +1263,7 @@ size_t getFloatArray(const Cantera::XML_Node& node, std::vector<doublereal> & v,
|
||||||
return v.size();
|
return v.size();
|
||||||
}
|
}
|
||||||
//====================================================================================================================
|
//====================================================================================================================
|
||||||
int getNamedFloatArray(const Cantera::XML_Node& parentNode, const std::string& nodeName, 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::size_type icom;
|
||||||
|
|
@ -1326,7 +1326,7 @@ int getNamedFloatArray(const Cantera::XML_Node& parentNode, const std::string&
|
||||||
* would appear to be odd. So, we keep the
|
* would appear to be odd. So, we keep the
|
||||||
* possibilty in for backwards compatibility.
|
* possibilty in for backwards compatibility.
|
||||||
*/
|
*/
|
||||||
int nlen = strlen(val.c_str());
|
size_t nlen = strlen(val.c_str());
|
||||||
if (nlen > 0) {
|
if (nlen > 0) {
|
||||||
dtmp = atofCheck(val.c_str());
|
dtmp = atofCheck(val.c_str());
|
||||||
v.push_back(dtmp);
|
v.push_back(dtmp);
|
||||||
|
|
@ -1343,8 +1343,8 @@ int getNamedFloatArray(const Cantera::XML_Node& parentNode, const std::string&
|
||||||
" is above upper limit of " +fp2str(vmin)+".\n");
|
" is above upper limit of " +fp2str(vmin)+".\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int nv = v.size();
|
size_t nv = v.size();
|
||||||
for (int n = 0; n < nv; n++) {
|
for (size_t n = 0; n < nv; n++) {
|
||||||
v[n] *= funit;
|
v[n] *= funit;
|
||||||
}
|
}
|
||||||
if (nv != expectedSize) {
|
if (nv != expectedSize) {
|
||||||
|
|
|
||||||
|
|
@ -70,8 +70,6 @@ const int MDP_ALLOC_INTERFACE_ERROR = -230346;
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
||||||
static void mdp_alloc_eh(const char* const rname, const int bytes)
|
static void mdp_alloc_eh(const char* const rname, const int bytes)
|
||||||
throw(std::bad_alloc, std::exception)
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
*
|
*
|
||||||
* mdp_alloc_eh:
|
* mdp_alloc_eh:
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
#include "cantera/base/ctml.h"
|
#include "cantera/base/ctml.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <sstream>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
@ -89,6 +89,17 @@ std::string int2str(const int n)
|
||||||
return std::string(" ");
|
return std::string(" ");
|
||||||
}
|
}
|
||||||
//================================================================================================
|
//================================================================================================
|
||||||
|
// Convert an int to a string
|
||||||
|
/*
|
||||||
|
* @param n int to be converted
|
||||||
|
*/
|
||||||
|
std::string int2str(const size_t n)
|
||||||
|
{
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << n;
|
||||||
|
return ss.str();
|
||||||
|
}
|
||||||
|
//================================================================================================
|
||||||
std::string lowercase(const std::string& s)
|
std::string lowercase(const std::string& s)
|
||||||
{
|
{
|
||||||
int n = static_cast<int>(s.size());
|
int n = static_cast<int>(s.size());
|
||||||
|
|
|
||||||
|
|
@ -1538,9 +1538,9 @@ int vcs_MultiPhaseEquil::determine_PhaseStability(int iph, double& funcStab, int
|
||||||
|
|
||||||
|
|
||||||
clockWC tickTock;
|
clockWC tickTock;
|
||||||
int nsp = m_mix->nSpecies();
|
size_t nsp = m_mix->nSpecies();
|
||||||
int nel = m_mix->nElements();
|
size_t nel = m_mix->nElements();
|
||||||
int nph = m_mix->nPhases();
|
size_t nph = m_mix->nPhases();
|
||||||
if (m_vprob == 0) {
|
if (m_vprob == 0) {
|
||||||
m_vprob = new VCS_PROB(nsp, nel, nph);
|
m_vprob = new VCS_PROB(nsp, nel, nph);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1207,14 +1207,15 @@ double vcs_VolPhase::molefraction(size_t k) const
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
|
|
||||||
void vcs_VolPhase::setCreationMoleNumbers(const double* const n_k,
|
void vcs_VolPhase::setCreationMoleNumbers(const double* const n_k,
|
||||||
const std::vector<int> &creationGlobalRxnNumbers)
|
const std::vector<size_t> &creationGlobalRxnNumbers)
|
||||||
{
|
{
|
||||||
vcs_dcopy(VCS_DATA_PTR(creationMoleNumbers_), n_k, m_numSpecies);
|
vcs_dcopy(VCS_DATA_PTR(creationMoleNumbers_), n_k, m_numSpecies);
|
||||||
vcs_icopy(VCS_DATA_PTR(creationGlobalRxnNumbers_), VCS_DATA_PTR(creationGlobalRxnNumbers), m_numSpecies);
|
creationGlobalRxnNumbers_ = creationGlobalRxnNumbers;
|
||||||
|
|
||||||
}
|
}
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
|
|
||||||
const std::vector<double> & vcs_VolPhase::creationMoleNumbers(std::vector<int> &creationGlobalRxnNumbers) const
|
const std::vector<double> & vcs_VolPhase::creationMoleNumbers(std::vector<size_t> &creationGlobalRxnNumbers) const
|
||||||
{
|
{
|
||||||
creationGlobalRxnNumbers = creationGlobalRxnNumbers_;
|
creationGlobalRxnNumbers = creationGlobalRxnNumbers_;
|
||||||
return creationMoleNumbers_;
|
return creationMoleNumbers_;
|
||||||
|
|
|
||||||
|
|
@ -425,13 +425,13 @@ public:
|
||||||
/*!
|
/*!
|
||||||
* @param F_k Pointer to a vector of n_k's
|
* @param F_k Pointer to a vector of n_k's
|
||||||
*/
|
*/
|
||||||
void setCreationMoleNumbers(const double* const n_k, const std::vector<int> &creationGlobalRxnNumbers);
|
void setCreationMoleNumbers(const double* const n_k, const std::vector<size_t> &creationGlobalRxnNumbers);
|
||||||
|
|
||||||
//! Return a const reference to the creationMoleNumbers storred in the object.
|
//! Return a const reference to the creationMoleNumbers storred in the object.
|
||||||
/*!
|
/*!
|
||||||
* @return Returns a const reference to the vector of creationMoleNumbers
|
* @return Returns a const reference to the vector of creationMoleNumbers
|
||||||
*/
|
*/
|
||||||
const std::vector<double> & creationMoleNumbers(std::vector<int> &creationGlobalRxnNumbers) const;
|
const std::vector<double> & creationMoleNumbers(std::vector<size_t> &creationGlobalRxnNumbers) const;
|
||||||
|
|
||||||
//! Returns whether the phase is an ideal solution phase
|
//! Returns whether the phase is an ideal solution phase
|
||||||
bool isIdealSoln() const;
|
bool isIdealSoln() const;
|
||||||
|
|
@ -895,7 +895,7 @@ private:
|
||||||
* that the global reaction number will go out of order when the species positions
|
* that the global reaction number will go out of order when the species positions
|
||||||
* are swapped. So, this number has to be recalculated.
|
* are swapped. So, this number has to be recalculated.
|
||||||
*/
|
*/
|
||||||
std::vector<int> creationGlobalRxnNumbers_;
|
std::vector<size_t> creationGlobalRxnNumbers_;
|
||||||
|
|
||||||
//! If the potential is a solution variable in VCS, it acts as a species.
|
//! If the potential is a solution variable in VCS, it acts as a species.
|
||||||
//! This is the species index in the phase for the potential
|
//! This is the species index in the phase for the potential
|
||||||
|
|
|
||||||
|
|
@ -191,7 +191,7 @@ int vcsUtil_mlequ(double* c, size_t idem, size_t n, double* b, size_t m);
|
||||||
* (each column is a new rhs)
|
* (each column is a new rhs)
|
||||||
* @param m number of rhs's
|
* @param m number of rhs's
|
||||||
*/
|
*/
|
||||||
int vcsUtil_gaussj(double* c, int idem, int n, double* b, int m);
|
int vcsUtil_gaussj(double* c, size_t idem, size_t n, double* b, size_t m);
|
||||||
|
|
||||||
//! Swap values in vector of doubles
|
//! Swap values in vector of doubles
|
||||||
/*!
|
/*!
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,7 @@ bool VCS_SOLVE::vcs_popPhasePossible(const size_t iphasePop) const
|
||||||
// Second we are here if the component is a reactant in the reaction, and the reaction goes backwards.
|
// Second we are here if the component is a reactant in the reaction, and the reaction goes backwards.
|
||||||
else if (m_stoichCoeffRxnMatrix[jrxn][kspec] < 0.0) {
|
else if (m_stoichCoeffRxnMatrix[jrxn][kspec] < 0.0) {
|
||||||
foundJrxn = true;
|
foundJrxn = true;
|
||||||
int jspec = jrxn + m_numComponents;
|
size_t jspec = jrxn + m_numComponents;
|
||||||
if (m_molNumSpecies_old[jspec] <= VCS_DELETE_ELEMENTABS_CUTOFF*0.5) {
|
if (m_molNumSpecies_old[jspec] <= VCS_DELETE_ELEMENTABS_CUTOFF*0.5) {
|
||||||
foundJrxn = false;
|
foundJrxn = false;
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -133,14 +133,14 @@ bool VCS_SOLVE::vcs_popPhasePossible(const size_t iphasePop) const
|
||||||
}
|
}
|
||||||
//====================================================================================================================
|
//====================================================================================================================
|
||||||
|
|
||||||
int inList(const std::vector<int> &list, int val)
|
size_t inList(const std::vector<size_t> &list, size_t val)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < (int) list.size(); i++) {
|
for (size_t i = 0; i < list.size(); i++) {
|
||||||
if (val == list[i]) {
|
if (val == list[i]) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return -1;
|
return npos;
|
||||||
}
|
}
|
||||||
|
|
||||||
//====================================================================================================================
|
//====================================================================================================================
|
||||||
|
|
@ -172,7 +172,7 @@ int VCS_SOLVE::vcs_phasePopDeterminePossibleList()
|
||||||
* It does not count species with positive stoichiometric values if that species
|
* It does not count species with positive stoichiometric values if that species
|
||||||
* already has a positive mole number. The phase is already popped.
|
* already has a positive mole number. The phase is already popped.
|
||||||
*/
|
*/
|
||||||
std::vector< std::vector<int> > zeroedComponentLinkedPhasePops(m_numComponents);
|
std::vector< std::vector<size_t> > zeroedComponentLinkedPhasePops(m_numComponents);
|
||||||
/*
|
/*
|
||||||
* The logic below calculates zeroedComponentLinkedPhasePops
|
* The logic below calculates zeroedComponentLinkedPhasePops
|
||||||
*/
|
*/
|
||||||
|
|
@ -180,11 +180,11 @@ int VCS_SOLVE::vcs_phasePopDeterminePossibleList()
|
||||||
if (m_elType[j] == VCS_ELEM_TYPE_ABSPOS) {
|
if (m_elType[j] == VCS_ELEM_TYPE_ABSPOS) {
|
||||||
molComp = m_molNumSpecies_old[j];
|
molComp = m_molNumSpecies_old[j];
|
||||||
if (molComp <= 0.0) {
|
if (molComp <= 0.0) {
|
||||||
std::vector<int> &jList = zeroedComponentLinkedPhasePops[j];
|
std::vector<size_t> &jList = zeroedComponentLinkedPhasePops[j];
|
||||||
size_t iph = m_phaseID[j];
|
size_t iph = m_phaseID[j];
|
||||||
jList.push_back(iph);
|
jList.push_back(iph);
|
||||||
for (size_t irxn = 0; irxn < m_numRxnTot; irxn++) {
|
for (size_t irxn = 0; irxn < m_numRxnTot; irxn++) {
|
||||||
size_t kspec = irxn + m_numComponents;
|
size_t kspec = irxn + m_numComponents;
|
||||||
iph = m_phaseID[kspec];
|
iph = m_phaseID[kspec];
|
||||||
Vphase = m_VolPhaseList[iph];
|
Vphase = m_VolPhaseList[iph];
|
||||||
int existence = Vphase->exists();
|
int existence = Vphase->exists();
|
||||||
|
|
@ -206,12 +206,12 @@ int VCS_SOLVE::vcs_phasePopDeterminePossibleList()
|
||||||
* which have a species with a negative stoichiometric value wrt one or more species in the phase.
|
* which have a species with a negative stoichiometric value wrt one or more species in the phase.
|
||||||
* Cut out components which have a pos stoichiometric value with another species in the phase.
|
* Cut out components which have a pos stoichiometric value with another species in the phase.
|
||||||
*/
|
*/
|
||||||
std::vector< std::vector<int> > zeroedPhaseLinkedZeroComponents(m_numPhases);
|
std::vector< std::vector<size_t> > zeroedPhaseLinkedZeroComponents(m_numPhases);
|
||||||
/*
|
/*
|
||||||
* The logic below calculates zeroedPhaseLinkedZeroComponents
|
* The logic below calculates zeroedPhaseLinkedZeroComponents
|
||||||
*/
|
*/
|
||||||
for (size_t iph = 0; iph < m_numPhases; iph++) {
|
for (size_t iph = 0; iph < m_numPhases; iph++) {
|
||||||
std::vector<int> &iphList = zeroedPhaseLinkedZeroComponents[iph];
|
std::vector<size_t> &iphList = zeroedPhaseLinkedZeroComponents[iph];
|
||||||
iphList.clear();
|
iphList.clear();
|
||||||
Vphase = m_VolPhaseList[iph];
|
Vphase = m_VolPhaseList[iph];
|
||||||
int existence = Vphase->exists();
|
int existence = Vphase->exists();
|
||||||
|
|
@ -240,7 +240,7 @@ int VCS_SOLVE::vcs_phasePopDeterminePossibleList()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!foundPos) {
|
if (!foundPos) {
|
||||||
if (inList(iphList, j) != -1) {
|
if (inList(iphList, j) != npos) {
|
||||||
iphList.push_back(j);
|
iphList.push_back(j);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -260,15 +260,15 @@ int VCS_SOLVE::vcs_phasePopDeterminePossibleList()
|
||||||
Vphase = m_VolPhaseList[iph];
|
Vphase = m_VolPhaseList[iph];
|
||||||
int existence = Vphase->exists();
|
int existence = Vphase->exists();
|
||||||
if (existence < 0) {
|
if (existence < 0) {
|
||||||
std::vector<int> &iphList = zeroedPhaseLinkedZeroComponents[iph];
|
std::vector<size_t> &iphList = zeroedPhaseLinkedZeroComponents[iph];
|
||||||
std::vector<int> popProblem(0);
|
std::vector<size_t> popProblem(0);
|
||||||
popProblem.push_back(iph);
|
popProblem.push_back(iph);
|
||||||
for (size_t i = 0; i < iphList.size(); i++) {
|
for (size_t i = 0; i < iphList.size(); i++) {
|
||||||
size_t j = iphList[i];
|
size_t j = iphList[i];
|
||||||
std::vector<int> &jList = zeroedComponentLinkedPhasePops[j];
|
std::vector<size_t> &jList = zeroedComponentLinkedPhasePops[j];
|
||||||
for (int jjl = 0; jjl < (int) jList.size(); jjl++) {
|
for (size_t jjl = 0; jjl < jList.size(); jjl++) {
|
||||||
int jph = jList[jjl];
|
size_t jph = jList[jjl];
|
||||||
if (inList(popProblem, jph) != -1) {
|
if (inList(popProblem, jph) != npos) {
|
||||||
popProblem.push_back(jph);
|
popProblem.push_back(jph);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -285,12 +285,12 @@ int VCS_SOLVE::vcs_phasePopDeterminePossibleList()
|
||||||
// Decision as to whether a phase pops back into existence
|
// Decision as to whether a phase pops back into existence
|
||||||
/*
|
/*
|
||||||
* @return returns the phase id of the phases that pops back into
|
* @return returns the phase id of the phases that pops back into
|
||||||
* existence. Returns -1 if there are no phases
|
* existence. Returns npos if there are no phases
|
||||||
*/
|
*/
|
||||||
int VCS_SOLVE::vcs_popPhaseID(std::vector<int> & phasePopPhaseIDs)
|
size_t VCS_SOLVE::vcs_popPhaseID(std::vector<size_t> & phasePopPhaseIDs)
|
||||||
{
|
{
|
||||||
int iphasePop = -1;
|
size_t iphasePop = npos;
|
||||||
int irxn, kspec;
|
size_t irxn, kspec;
|
||||||
doublereal FephaseMax = -1.0E30;
|
doublereal FephaseMax = -1.0E30;
|
||||||
doublereal Fephase = -1.0E30;
|
doublereal Fephase = -1.0E30;
|
||||||
vcs_VolPhase* Vphase = 0;
|
vcs_VolPhase* Vphase = 0;
|
||||||
|
|
@ -401,7 +401,7 @@ int VCS_SOLVE::vcs_popPhaseID(std::vector<int> & phasePopPhaseIDs)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
phasePopPhaseIDs.resize(0);
|
phasePopPhaseIDs.resize(0);
|
||||||
if (iphasePop >= 0) {
|
if (iphasePop != npos) {
|
||||||
phasePopPhaseIDs.push_back(iphasePop);
|
phasePopPhaseIDs.push_back(iphasePop);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -447,7 +447,7 @@ int VCS_SOLVE::vcs_popPhaseRxnStepSizes(const size_t iphasePop)
|
||||||
size_t kspec = Vphase->spGlobalIndexVCS(0);
|
size_t kspec = Vphase->spGlobalIndexVCS(0);
|
||||||
// Identify the formation reaction for that species
|
// Identify the formation reaction for that species
|
||||||
size_t irxn = kspec - m_numComponents;
|
size_t irxn = kspec - m_numComponents;
|
||||||
std::vector<int> creationGlobalRxnNumbers;
|
std::vector<size_t> creationGlobalRxnNumbers;
|
||||||
|
|
||||||
doublereal s;
|
doublereal s;
|
||||||
// Calculate the initial moles of the phase being born.
|
// Calculate the initial moles of the phase being born.
|
||||||
|
|
@ -656,7 +656,7 @@ double VCS_SOLVE::vcs_phaseStabilityTest(const size_t iph)
|
||||||
vector<doublereal> fracDelta_new(Vphase->nSpecies(), 0.0);
|
vector<doublereal> fracDelta_new(Vphase->nSpecies(), 0.0);
|
||||||
vector<doublereal> fracDelta_old(Vphase->nSpecies(), 0.0);
|
vector<doublereal> fracDelta_old(Vphase->nSpecies(), 0.0);
|
||||||
vector<doublereal> fracDelta_raw(Vphase->nSpecies(), 0.0);
|
vector<doublereal> fracDelta_raw(Vphase->nSpecies(), 0.0);
|
||||||
vector<int> creationGlobalRxnNumbers(Vphase->nSpecies(), -1);
|
vector<size_t> creationGlobalRxnNumbers(Vphase->nSpecies(), npos);
|
||||||
vcs_dcopy(VCS_DATA_PTR(m_deltaGRxn_Deficient), VCS_DATA_PTR(m_deltaGRxn_old), m_numRxnRdc);
|
vcs_dcopy(VCS_DATA_PTR(m_deltaGRxn_Deficient), VCS_DATA_PTR(m_deltaGRxn_old), m_numRxnRdc);
|
||||||
|
|
||||||
vector<doublereal> m_feSpecies_Deficient(m_numComponents, 0.0);
|
vector<doublereal> m_feSpecies_Deficient(m_numComponents, 0.0);
|
||||||
|
|
|
||||||
|
|
@ -41,10 +41,10 @@ namespace VCSnonideal
|
||||||
* in this routine. The species is a noncomponent
|
* in this routine. The species is a noncomponent
|
||||||
* - 2 : Same as one but, the zeroed species is a component.
|
* - 2 : Same as one but, the zeroed species is a component.
|
||||||
*/
|
*/
|
||||||
int VCS_SOLVE::vcs_RxnStepSizes(int& forceComponentCalc, size_t& kSpecial)
|
size_t VCS_SOLVE::vcs_RxnStepSizes(int& forceComponentCalc, size_t& kSpecial)
|
||||||
{
|
{
|
||||||
size_t kspec, iph;
|
size_t kspec, iph;
|
||||||
int iphDel = -1;
|
size_t iphDel = npos;
|
||||||
double s, xx, dss;
|
double s, xx, dss;
|
||||||
size_t k = 0;
|
size_t k = 0;
|
||||||
vcs_VolPhase* Vphase = 0;
|
vcs_VolPhase* Vphase = 0;
|
||||||
|
|
|
||||||
|
|
@ -591,7 +591,7 @@ int VCS_SOLVE::vcs_prob_specifyFully(const VCS_PROB* pub)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (m_doEstimateEquil == 0) {
|
if (m_doEstimateEquil == 0) {
|
||||||
double sum;
|
double sum = 0;
|
||||||
for (size_t j = 0; j < nelements; j++) {
|
for (size_t j = 0; j < nelements; j++) {
|
||||||
m_elemAbundancesGoal[j] = 0.0;
|
m_elemAbundancesGoal[j] = 0.0;
|
||||||
for (size_t kspec = 0; kspec < nspecies; kspec++) {
|
for (size_t kspec = 0; kspec < nspecies; kspec++) {
|
||||||
|
|
|
||||||
|
|
@ -544,7 +544,7 @@ public:
|
||||||
* @return returns the phase id of the phase that pops back into
|
* @return returns the phase id of the phase that pops back into
|
||||||
* existence. Returns -1 if there are no phases
|
* existence. Returns -1 if there are no phases
|
||||||
*/
|
*/
|
||||||
int vcs_popPhaseID(std::vector<int> &phasePopPhaseIDs);
|
size_t vcs_popPhaseID(std::vector<size_t> &phasePopPhaseIDs);
|
||||||
|
|
||||||
//! Calculates the deltas of the reactions due to phases popping
|
//! Calculates the deltas of the reactions due to phases popping
|
||||||
//! into existence
|
//! into existence
|
||||||
|
|
@ -579,7 +579,7 @@ public:
|
||||||
*
|
*
|
||||||
* @return Returns an int representing which phase may need to be zeroed
|
* @return Returns an int representing which phase may need to be zeroed
|
||||||
*/
|
*/
|
||||||
int vcs_RxnStepSizes(int& forceComponentCalc, size_t& kSpecial);
|
size_t vcs_RxnStepSizes(int& forceComponentCalc, size_t& kSpecial);
|
||||||
|
|
||||||
//! Calculates the total number of moles of species in all phases.
|
//! Calculates the total number of moles of species in all phases.
|
||||||
/*!
|
/*!
|
||||||
|
|
@ -1987,7 +1987,7 @@ public:
|
||||||
*/
|
*/
|
||||||
std::vector<double> m_chargeSpecies;
|
std::vector<double> m_chargeSpecies;
|
||||||
|
|
||||||
std::vector<std::vector<int> > phasePopProblemLists_;
|
std::vector<std::vector<size_t> > phasePopProblemLists_;
|
||||||
|
|
||||||
//! Vector of pointers to thermostructures which identify the model
|
//! Vector of pointers to thermostructures which identify the model
|
||||||
//! and parameters for evaluating the thermodynamic functions for that
|
//! and parameters for evaluating the thermodynamic functions for that
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,7 @@ int VCS_SOLVE::vcs_solve_TP(int print_lvl, int printDetails, int maxit)
|
||||||
bool uptodate_minors = true;
|
bool uptodate_minors = true;
|
||||||
bool justDeletedMultiPhase = false;
|
bool justDeletedMultiPhase = false;
|
||||||
bool usedZeroedSpecies; /* return flag from basopt indicating that
|
bool usedZeroedSpecies; /* return flag from basopt indicating that
|
||||||
one of the components had a zero concentration */
|
one of the components had a zero concentration */
|
||||||
size_t doPhaseDeleteIph = npos;
|
size_t doPhaseDeleteIph = npos;
|
||||||
vcs_VolPhase* Vphase;
|
vcs_VolPhase* Vphase;
|
||||||
double* sc_irxn = NULL; /* Stoichiometric coefficients for cur rxn */
|
double* sc_irxn = NULL; /* Stoichiometric coefficients for cur rxn */
|
||||||
|
|
@ -119,7 +119,7 @@ int VCS_SOLVE::vcs_solve_TP(int print_lvl, int printDetails, int maxit)
|
||||||
size_t iphasePop;
|
size_t iphasePop;
|
||||||
int forceComponentCalc = 1;
|
int forceComponentCalc = 1;
|
||||||
size_t iphaseDelete; /* integer that determines which phase is being deleted */
|
size_t iphaseDelete; /* integer that determines which phase is being deleted */
|
||||||
std::vector<int> phasePopPhaseIDs(0);
|
std::vector<size_t> phasePopPhaseIDs(0);
|
||||||
#ifdef DEBUG_MODE
|
#ifdef DEBUG_MODE
|
||||||
char ANOTE[128];
|
char ANOTE[128];
|
||||||
/*
|
/*
|
||||||
|
|
@ -4647,7 +4647,7 @@ void VCS_SOLVE::vcs_printSpeciesChemPot(const int stateCalc) const
|
||||||
mfValue = molNum[kspec]/tMoles[iphase];
|
mfValue = molNum[kspec]/tMoles[iphase];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
int klocal = m_speciesLocalPhaseIndex[kspec];
|
size_t klocal = m_speciesLocalPhaseIndex[kspec];
|
||||||
mfValue = Vphase->moleFraction(klocal);
|
mfValue = Vphase->moleFraction(klocal);
|
||||||
}
|
}
|
||||||
double volts = Vphase->electricPotential();
|
double volts = Vphase->electricPotential();
|
||||||
|
|
@ -5304,10 +5304,10 @@ void VCS_SOLVE::vcs_printDeltaG(const int stateCalc)
|
||||||
|
|
||||||
for (size_t kspec = 0; kspec < m_numSpeciesTot; kspec++) {
|
for (size_t kspec = 0; kspec < m_numSpeciesTot; kspec++) {
|
||||||
|
|
||||||
int irxn = kspec - m_numComponents;
|
size_t irxn = kspec - m_numComponents;
|
||||||
|
|
||||||
double mfValue = 1.0;
|
double mfValue = 1.0;
|
||||||
int iphase = m_phaseID[kspec];
|
size_t iphase = m_phaseID[kspec];
|
||||||
const vcs_VolPhase* Vphase = m_VolPhaseList[iphase];
|
const vcs_VolPhase* Vphase = m_VolPhaseList[iphase];
|
||||||
if ((m_speciesStatus[kspec] == VCS_SPECIES_ZEROEDMS) ||
|
if ((m_speciesStatus[kspec] == VCS_SPECIES_ZEROEDMS) ||
|
||||||
(m_speciesStatus[kspec] == VCS_SPECIES_ZEROEDPHASE) ||
|
(m_speciesStatus[kspec] == VCS_SPECIES_ZEROEDPHASE) ||
|
||||||
|
|
@ -5323,7 +5323,7 @@ void VCS_SOLVE::vcs_printDeltaG(const int stateCalc)
|
||||||
mfValue = molNumSpecies[kspec] / tPhMoles_ptr[iphase];
|
mfValue = molNumSpecies[kspec] / tPhMoles_ptr[iphase];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
int klocal = m_speciesLocalPhaseIndex[kspec];
|
size_t klocal = m_speciesLocalPhaseIndex[kspec];
|
||||||
mfValue = Vphase->moleFraction(klocal);
|
mfValue = Vphase->moleFraction(klocal);
|
||||||
}
|
}
|
||||||
if (zeroedPhase) {
|
if (zeroedPhase) {
|
||||||
|
|
@ -5342,7 +5342,7 @@ void VCS_SOLVE::vcs_printDeltaG(const int stateCalc)
|
||||||
printf(" % -12.4e", mfValue);
|
printf(" % -12.4e", mfValue);
|
||||||
printf(" % -12.4e", feSpecies[kspec] * RT);
|
printf(" % -12.4e", feSpecies[kspec] * RT);
|
||||||
printf(" % -12.4e", feFull * RT);
|
printf(" % -12.4e", feFull * RT);
|
||||||
if (irxn >= 0) {
|
if (irxn != npos) {
|
||||||
printf(" % -12.4e", deltaGRxn[irxn] * RT);
|
printf(" % -12.4e", deltaGRxn[irxn] * RT);
|
||||||
printf(" % -12.4e", (deltaGRxn[irxn] + feFull - feSpecies[kspec]) * RT);
|
printf(" % -12.4e", (deltaGRxn[irxn] + feFull - feSpecies[kspec]) * RT);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -47,9 +47,9 @@ int VCS_SOLVE::vcs_PS(VCS_PROB* vprob, int iphase, int printLvl, double& feStabl
|
||||||
* This function is called to create the private data
|
* This function is called to create the private data
|
||||||
* using the public data.
|
* using the public data.
|
||||||
*/
|
*/
|
||||||
int nspecies0 = vprob->nspecies + 10;
|
size_t nspecies0 = vprob->nspecies + 10;
|
||||||
int nelements0 = vprob->ne;
|
size_t nelements0 = vprob->ne;
|
||||||
int nphase0 = vprob->NPhase;
|
size_t nphase0 = vprob->NPhase;
|
||||||
|
|
||||||
vcs_initSizes(nspecies0, nelements0, nphase0);
|
vcs_initSizes(nspecies0, nelements0, nphase0);
|
||||||
|
|
||||||
|
|
@ -161,8 +161,8 @@ int VCS_SOLVE::vcs_PS(VCS_PROB* vprob, int iphase, int printLvl, double& feStabl
|
||||||
vprob->mf[kstart + k] = mfPop[k];
|
vprob->mf[kstart + k] = mfPop[k];
|
||||||
}
|
}
|
||||||
VPphase->setMoleFractionsState(Vphase->totalMoles(),
|
VPphase->setMoleFractionsState(Vphase->totalMoles(),
|
||||||
VCS_DATA_PTR(Vphase->moleFractions()),
|
VCS_DATA_PTR(Vphase->moleFractions()),
|
||||||
VCS_STATECALC_TMP);
|
VCS_STATECALC_TMP);
|
||||||
*/
|
*/
|
||||||
vcs_prob_update(vprob);
|
vcs_prob_update(vprob);
|
||||||
/*
|
/*
|
||||||
|
|
@ -207,7 +207,7 @@ int VCS_SOLVE::vcs_solve_phaseStability(const int iph, const int ifunc,
|
||||||
{
|
{
|
||||||
double test = -1.0E-10;
|
double test = -1.0E-10;
|
||||||
bool usedZeroedSpecies;
|
bool usedZeroedSpecies;
|
||||||
std::vector<int> phasePopPhaseIDs(0);
|
std::vector<size_t> phasePopPhaseIDs(0);
|
||||||
int iStab = 0;
|
int iStab = 0;
|
||||||
|
|
||||||
std::vector<double> sm(m_numElemConstraints*m_numElemConstraints, 0.0);
|
std::vector<double> sm(m_numElemConstraints*m_numElemConstraints, 0.0);
|
||||||
|
|
|
||||||
|
|
@ -342,7 +342,7 @@ static void mlequ_matrixDump(double* c, int idem, int n)
|
||||||
* @param irowa first row to swap
|
* @param irowa first row to swap
|
||||||
* @param irowb second row to swap
|
* @param irowb second row to swap
|
||||||
*/
|
*/
|
||||||
static void vcsUtil_swapRows(double* c, int idem, int n, double* b, int m, int irowa, int irowb)
|
static void vcsUtil_swapRows(double* c, size_t idem, size_t n, double* b, size_t m, size_t irowa, size_t irowb)
|
||||||
{
|
{
|
||||||
double t1;
|
double t1;
|
||||||
int j;
|
int j;
|
||||||
|
|
@ -365,15 +365,15 @@ static void vcsUtil_swapRows(double* c, int idem, int n, double* b, int m, int i
|
||||||
* @param b RHS of the Ax=b problem to solve
|
* @param b RHS of the Ax=b problem to solve
|
||||||
* @param m Number of rhs to solve
|
* @param m Number of rhs to solve
|
||||||
*/
|
*/
|
||||||
static void vcsUtil_mlequ_preprocess(double* c, int idem, int n, double* b, int m)
|
static void vcsUtil_mlequ_preprocess(double* c, size_t idem, size_t n, double* b, size_t m)
|
||||||
{
|
{
|
||||||
int j = 0;
|
size_t j = 0;
|
||||||
std::vector<int> irowUsed(n, 0);
|
std::vector<int> irowUsed(n, 0);
|
||||||
|
|
||||||
for (j = 0; j < n; j++) {
|
for (j = 0; j < n; j++) {
|
||||||
int numNonzero = 0;
|
int numNonzero = 0;
|
||||||
int inonzero = -1;
|
size_t inonzero = npos;
|
||||||
for (int i = 0; i < n; i++) {
|
for (size_t i = 0; i < n; i++) {
|
||||||
if (c[i + j * idem] != 0.0) {
|
if (c[i + j * idem] != 0.0) {
|
||||||
numNonzero++;
|
numNonzero++;
|
||||||
inonzero = i;
|
inonzero = i;
|
||||||
|
|
@ -395,8 +395,8 @@ static void vcsUtil_mlequ_preprocess(double* c, int idem, int n, double* b, int
|
||||||
for (j = 0; j < n; j++) {
|
for (j = 0; j < n; j++) {
|
||||||
if (c[j + j * idem] == 0.0) {
|
if (c[j + j * idem] == 0.0) {
|
||||||
int numNonzero = 0;
|
int numNonzero = 0;
|
||||||
int inonzero = -1;
|
size_t inonzero = npos;
|
||||||
for (int i = 0; i < n; i++) {
|
for (size_t i = 0; i < n; i++) {
|
||||||
if (! irowUsed[i]) {
|
if (! irowUsed[i]) {
|
||||||
if (c[i + j * idem] != 0.0) {
|
if (c[i + j * idem] != 0.0) {
|
||||||
if ((c[i + i * idem] == 0.0) || (c[j + i * idem] != 0.0)) {
|
if ((c[i + i * idem] == 0.0) || (c[j + i * idem] != 0.0)) {
|
||||||
|
|
@ -423,8 +423,8 @@ static void vcsUtil_mlequ_preprocess(double* c, int idem, int n, double* b, int
|
||||||
for (j = 0; j < n; j++) {
|
for (j = 0; j < n; j++) {
|
||||||
if (c[j + j * idem] == 0.0) {
|
if (c[j + j * idem] == 0.0) {
|
||||||
int numNonzero = 0;
|
int numNonzero = 0;
|
||||||
int inonzero = -1;
|
size_t inonzero = npos;
|
||||||
for (int i = 0; i < n; i++) {
|
for (size_t i = 0; i < n; i++) {
|
||||||
if (! irowUsed[i]) {
|
if (! irowUsed[i]) {
|
||||||
if (c[i + j * idem] != 0.0) {
|
if (c[i + j * idem] != 0.0) {
|
||||||
if ((c[i + i * idem] == 0.0) || (c[j + i * idem] != 0.0)) {
|
if ((c[i + i * idem] == 0.0) || (c[j + i * idem] != 0.0)) {
|
||||||
|
|
@ -434,7 +434,7 @@ static void vcsUtil_mlequ_preprocess(double* c, int idem, int n, double* b, int
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (inonzero != -1) {
|
if (inonzero != npos) {
|
||||||
if (inonzero != j) {
|
if (inonzero != j) {
|
||||||
if (irowUsed[inonzero] == 0) {
|
if (irowUsed[inonzero] == 0) {
|
||||||
vcsUtil_swapRows(c, idem, n, b, m, j, inonzero);
|
vcsUtil_swapRows(c, idem, n, b, m, j, inonzero);
|
||||||
|
|
@ -618,12 +618,12 @@ FOUND_PIVOT:
|
||||||
* (each column is a new rhs)
|
* (each column is a new rhs)
|
||||||
* @param m number of rhs's
|
* @param m number of rhs's
|
||||||
*/
|
*/
|
||||||
int vcsUtil_gaussj(double* c, int idem, int n, double* b, int m)
|
int vcsUtil_gaussj(double* c, size_t idem, size_t n, double* b, size_t m)
|
||||||
{
|
{
|
||||||
|
|
||||||
int i, j, k, l, ll;
|
size_t i, j, k, l, ll;
|
||||||
int irow = -1;
|
size_t irow = npos;
|
||||||
int icol = -1;
|
size_t icol = npos;
|
||||||
bool needInverse = false;
|
bool needInverse = false;
|
||||||
double pivinv, dum;
|
double pivinv, dum;
|
||||||
#ifdef DEBUG_HKM
|
#ifdef DEBUG_HKM
|
||||||
|
|
@ -642,8 +642,8 @@ int vcsUtil_gaussj(double* c, int idem, int n, double* b, int m)
|
||||||
// mlequ_matrixDump(c, idem, n);
|
// mlequ_matrixDump(c, idem, n);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::vector<int> indxc(n);
|
std::vector<size_t> indxc(n);
|
||||||
std::vector<int> indxr(n);
|
std::vector<size_t> indxr(n);
|
||||||
std::vector<int> ipiv(n, 0);
|
std::vector<int> ipiv(n, 0);
|
||||||
doublereal big = 0.0;
|
doublereal big = 0.0;
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -877,9 +877,8 @@ void InterfaceKinetics::getDeltaElectrochemPotentials(doublereal* deltaM)
|
||||||
* Get the chemical potentials of the species in the
|
* Get the chemical potentials of the species in the
|
||||||
* ideal gas solution.
|
* ideal gas solution.
|
||||||
*/
|
*/
|
||||||
int np = nPhases();
|
size_t np = nPhases();
|
||||||
int n;
|
for (size_t n = 0; n < np; n++) {
|
||||||
for (n = 0; n < np; n++) {
|
|
||||||
thermo(n).getElectrochemPotentials(DATA_PTR(m_grt) + m_start[n]);
|
thermo(n).getElectrochemPotentials(DATA_PTR(m_grt) + m_start[n]);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -174,7 +174,7 @@ size_t BandMatrix::nRows() const
|
||||||
}
|
}
|
||||||
//====================================================================================================================
|
//====================================================================================================================
|
||||||
// Number of rows
|
// Number of rows
|
||||||
size_t BandMatrix::nRowsAndStruct(int* const iStruct) const
|
size_t BandMatrix::nRowsAndStruct(size_t* const iStruct) const
|
||||||
{
|
{
|
||||||
if (iStruct) {
|
if (iStruct) {
|
||||||
iStruct[0] = m_kl;
|
iStruct[0] = m_kl;
|
||||||
|
|
@ -214,7 +214,7 @@ vector_int& BandMatrix::ipiv()
|
||||||
/*
|
/*
|
||||||
* Multiply A*b and write result to \c prod.
|
* Multiply A*b and write result to \c prod.
|
||||||
*/
|
*/
|
||||||
void BandMatrix::mult(const doublereal* const b, doublereal* const prod) const
|
void BandMatrix::mult(const doublereal* b, doublereal* prod) const
|
||||||
{
|
{
|
||||||
size_t nr = nRows();
|
size_t nr = nRows();
|
||||||
doublereal sum = 0.0;
|
doublereal sum = 0.0;
|
||||||
|
|
@ -385,7 +385,7 @@ doublereal BandMatrix::rcond(doublereal a1norm)
|
||||||
}
|
}
|
||||||
|
|
||||||
// doublereal anorm = oneNorm();
|
// doublereal anorm = oneNorm();
|
||||||
int ldab = (2 *m_kl + m_ku + 1);
|
size_t ldab = (2 *m_kl + m_ku + 1);
|
||||||
int rinfo;
|
int rinfo;
|
||||||
rcond = ct_dgbcon('1', m_n, m_kl, m_ku, DATA_PTR(ludata), ldab, DATA_PTR(m_ipiv), a1norm, DATA_PTR(work_),
|
rcond = ct_dgbcon('1', m_n, m_kl, m_ku, DATA_PTR(ludata), ldab, DATA_PTR(m_ipiv), a1norm, DATA_PTR(work_),
|
||||||
DATA_PTR(iwork_), rinfo);
|
DATA_PTR(iwork_), rinfo);
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ DenseMatrix::DenseMatrix() :
|
||||||
* Constructor. Create an \c n by \c m matrix, and initialize
|
* Constructor. Create an \c n by \c m matrix, and initialize
|
||||||
* all elements to \c v.
|
* all elements to \c v.
|
||||||
*/
|
*/
|
||||||
DenseMatrix::DenseMatrix(int n, int m, doublereal v) :
|
DenseMatrix::DenseMatrix(size_t n, size_t m, doublereal v) :
|
||||||
Array2D(n, m, v),
|
Array2D(n, m, v),
|
||||||
m_ipiv(0),
|
m_ipiv(0),
|
||||||
m_useReturnErrorCode(0),
|
m_useReturnErrorCode(0),
|
||||||
|
|
@ -35,7 +35,7 @@ DenseMatrix::DenseMatrix(int n, int m, doublereal v) :
|
||||||
{
|
{
|
||||||
m_ipiv.resize(max(n, m));
|
m_ipiv.resize(max(n, m));
|
||||||
m_colPts.resize(m);
|
m_colPts.resize(m);
|
||||||
for (int j = 0; j < m; j++) {
|
for (size_t j = 0; j < m; j++) {
|
||||||
m_colPts[j] = &(m_data[m_nrows*j]);
|
m_colPts[j] = &(m_data[m_nrows*j]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -79,7 +79,7 @@ DenseMatrix::~DenseMatrix()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
//====================================================================================================================
|
//====================================================================================================================
|
||||||
void DenseMatrix::resize(int n, int m, doublereal v)
|
void DenseMatrix::resize(size_t n, size_t m, doublereal v)
|
||||||
{
|
{
|
||||||
Array2D::resize(n,m,v);
|
Array2D::resize(n,m,v);
|
||||||
m_ipiv.resize(max(n,m));
|
m_ipiv.resize(max(n,m));
|
||||||
|
|
@ -109,13 +109,12 @@ void DenseMatrix::mult(const double* b, double* prod) const
|
||||||
//====================================================================================================================
|
//====================================================================================================================
|
||||||
void DenseMatrix::leftMult(const double* const b, double* const prod) const
|
void DenseMatrix::leftMult(const double* const b, double* const prod) const
|
||||||
{
|
{
|
||||||
int nc = static_cast<int>(nColumns());
|
size_t nc = nColumns();
|
||||||
int nr = static_cast<int>(nRows());
|
size_t nr = nRows();
|
||||||
int n, i;
|
|
||||||
double sum = 0.0;
|
double sum = 0.0;
|
||||||
for (n = 0; n < nc; n++) {
|
for (size_t n = 0; n < nc; n++) {
|
||||||
sum = 0.0;
|
sum = 0.0;
|
||||||
for (i = 0; i < nr; i++) {
|
for (size_t i = 0; i < nr; i++) {
|
||||||
sum += value(i,n)*b[i];
|
sum += value(i,n)*b[i];
|
||||||
}
|
}
|
||||||
prod[n] = sum;
|
prod[n] = sum;
|
||||||
|
|
@ -139,9 +138,8 @@ int solve(DenseMatrix& A, double* b)
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
ct_dgetrf(static_cast<int>(A.nRows()),
|
ct_dgetrf(A.nRows(), A.nColumns(), A.ptrColumn(0),
|
||||||
static_cast<int>(A.nColumns()), A.ptrColumn(0), //begin(),
|
A.nRows(), &A.ipiv()[0], info);
|
||||||
static_cast<int>(A.nRows()), &A.ipiv()[0], info);
|
|
||||||
if (info != 0) {
|
if (info != 0) {
|
||||||
if (info > 0) {
|
if (info > 0) {
|
||||||
if (A.m_printLevel) {
|
if (A.m_printLevel) {
|
||||||
|
|
@ -166,11 +164,8 @@ int solve(DenseMatrix& A, double* b)
|
||||||
}
|
}
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
ct_dgetrs(ctlapack::NoTranspose,
|
ct_dgetrs(ctlapack::NoTranspose, A.nRows(), 1, A.ptrColumn(0),
|
||||||
static_cast<int>(A.nRows()), 1, A.ptrColumn(0), //begin(),
|
A.nRows(), &A.ipiv()[0], b, A.nColumns(), info);
|
||||||
static_cast<int>(A.nRows()),
|
|
||||||
&A.ipiv()[0], b,
|
|
||||||
static_cast<int>(A.nColumns()), info);
|
|
||||||
if (info != 0) {
|
if (info != 0) {
|
||||||
if (A.m_printLevel) {
|
if (A.m_printLevel) {
|
||||||
writelogf("solve(DenseMatrix& A, double* b): DGETRS returned INFO = %d\n", info);
|
writelogf("solve(DenseMatrix& A, double* b): DGETRS returned INFO = %d\n", info);
|
||||||
|
|
@ -194,9 +189,8 @@ int solve(DenseMatrix& A, DenseMatrix& b)
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
ct_dgetrf(static_cast<int>(A.nRows()),
|
ct_dgetrf(A.nRows(), A.nColumns(), A.ptrColumn(0),
|
||||||
static_cast<int>(A.nColumns()), A.ptrColumn(0),
|
A.nRows(), &A.ipiv()[0], info);
|
||||||
static_cast<int>(A.nRows()), &A.ipiv()[0], info);
|
|
||||||
if (info != 0) {
|
if (info != 0) {
|
||||||
if (info > 0) {
|
if (info > 0) {
|
||||||
if (A.m_printLevel) {
|
if (A.m_printLevel) {
|
||||||
|
|
@ -222,11 +216,8 @@ int solve(DenseMatrix& A, DenseMatrix& b)
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
ct_dgetrs(ctlapack::NoTranspose, static_cast<int>(A.nRows()),
|
ct_dgetrs(ctlapack::NoTranspose, A.nRows(), b.nColumns(), A.ptrColumn(0),
|
||||||
static_cast<int>(b.nColumns()),
|
A.nRows(), &A.ipiv()[0], b.ptrColumn(0), b.nRows(), info);
|
||||||
A.ptrColumn(0), static_cast<int>(A.nRows()),
|
|
||||||
&A.ipiv()[0], b.ptrColumn(0),
|
|
||||||
static_cast<int>(b.nRows()), info);
|
|
||||||
if (info != 0) {
|
if (info != 0) {
|
||||||
if (A.m_printLevel) {
|
if (A.m_printLevel) {
|
||||||
writelogf("solve(DenseMatrix& A, DenseMatrix& b): DGETRS returned INFO = %d\n", info);
|
writelogf("solve(DenseMatrix& A, DenseMatrix& b): DGETRS returned INFO = %d\n", info);
|
||||||
|
|
@ -283,9 +274,9 @@ void increment(const DenseMatrix& A, const double* b, double* prod)
|
||||||
A.ptrColumn(0), static_cast<int>(A.nRows()), b, 1, 1.0, prod, 1);
|
A.ptrColumn(0), static_cast<int>(A.nRows()), b, 1, 1.0, prod, 1);
|
||||||
}
|
}
|
||||||
//====================================================================================================================
|
//====================================================================================================================
|
||||||
int invert(DenseMatrix& A, int nn)
|
int invert(DenseMatrix& A, size_t nn)
|
||||||
{
|
{
|
||||||
integer n = (nn > 0 ? nn : static_cast<int>(A.nRows()));
|
integer n = static_cast<int>(nn != npos ? nn : A.nRows());
|
||||||
int info=0;
|
int info=0;
|
||||||
ct_dgetrf(n, n, A.ptrColumn(0), static_cast<int>(A.nRows()),
|
ct_dgetrf(n, n, A.ptrColumn(0), static_cast<int>(A.nRows()),
|
||||||
&A.ipiv()[0], info);
|
&A.ipiv()[0], info);
|
||||||
|
|
|
||||||
|
|
@ -762,9 +762,9 @@ int NonlinearSolver::doResidualCalc(const doublereal time_curr, const int typeCa
|
||||||
void NonlinearSolver::scaleMatrix(GeneralMatrix& jac, doublereal* const y_comm, doublereal* const ydot_comm,
|
void NonlinearSolver::scaleMatrix(GeneralMatrix& jac, doublereal* const y_comm, doublereal* const ydot_comm,
|
||||||
doublereal time_curr, int num_newt_its)
|
doublereal time_curr, int num_newt_its)
|
||||||
{
|
{
|
||||||
int irow, jcol;
|
size_t irow, jcol;
|
||||||
int ku, kl;
|
size_t ku, kl;
|
||||||
int ivec[2];
|
size_t ivec[2];
|
||||||
jac.nRowsAndStruct(ivec);
|
jac.nRowsAndStruct(ivec);
|
||||||
double* colP_j;
|
double* colP_j;
|
||||||
|
|
||||||
|
|
@ -1185,7 +1185,7 @@ int NonlinearSolver::doAffineNewtonSolve(const doublereal* const y_curr, const
|
||||||
if (doHessian) {
|
if (doHessian) {
|
||||||
// Store the old value for later comparison
|
// Store the old value for later comparison
|
||||||
|
|
||||||
delyNewton = mdp::mdp_alloc_dbl_1(neq_, MDP_DBL_NOINIT);
|
delyNewton = mdp::mdp_alloc_dbl_1((int) neq_, MDP_DBL_NOINIT);
|
||||||
for (irow = 0; irow < neq_; irow++) {
|
for (irow = 0; irow < neq_; irow++) {
|
||||||
delyNewton[irow] = delta_y[irow];
|
delyNewton[irow] = delta_y[irow];
|
||||||
}
|
}
|
||||||
|
|
@ -1285,7 +1285,7 @@ int NonlinearSolver::doAffineNewtonSolve(const doublereal* const y_curr, const
|
||||||
}
|
}
|
||||||
|
|
||||||
// doublereal *JTF = delta_y;
|
// doublereal *JTF = delta_y;
|
||||||
doublereal* delyH = mdp::mdp_alloc_dbl_1(neq_, MDP_DBL_NOINIT);
|
doublereal* delyH = mdp::mdp_alloc_dbl_1((int) neq_, MDP_DBL_NOINIT);
|
||||||
// First recalculate the scaled residual. It got wiped out doing the newton solve
|
// First recalculate the scaled residual. It got wiped out doing the newton solve
|
||||||
if (m_rowScaling) {
|
if (m_rowScaling) {
|
||||||
for (int n = 0; n < neq_; n++) {
|
for (int n = 0; n < neq_; n++) {
|
||||||
|
|
@ -1368,7 +1368,7 @@ int NonlinearSolver::doAffineNewtonSolve(const doublereal* const y_curr, const
|
||||||
* Choose the delta_y to use
|
* Choose the delta_y to use
|
||||||
*/
|
*/
|
||||||
if (newtonGood || s_alwaysAssumeNewtonGood) {
|
if (newtonGood || s_alwaysAssumeNewtonGood) {
|
||||||
mdp::mdp_copy_dbl_1(DATA_PTR(delta_y), CONSTD_DATA_PTR(delyNewton), neq_);
|
mdp::mdp_copy_dbl_1(DATA_PTR(delta_y), CONSTD_DATA_PTR(delyNewton), (int) neq_);
|
||||||
}
|
}
|
||||||
mdp::mdp_safe_free((void**) &delyH);
|
mdp::mdp_safe_free((void**) &delyH);
|
||||||
mdp::mdp_safe_free((void**) &delyNewton);
|
mdp::mdp_safe_free((void**) &delyNewton);
|
||||||
|
|
@ -2794,7 +2794,7 @@ int NonlinearSolver::dampDogLeg(const doublereal time_curr, const doublereal* y_
|
||||||
|
|
||||||
haveASuccess = true;
|
haveASuccess = true;
|
||||||
// Store the good results in stepLastGood
|
// Store the good results in stepLastGood
|
||||||
mdp::mdp_copy_dbl_1(DATA_PTR(stepLastGood), CONSTD_DATA_PTR(step_1), neq_);
|
mdp::mdp_copy_dbl_1(DATA_PTR(stepLastGood), CONSTD_DATA_PTR(step_1), (int) neq_);
|
||||||
// Within the program decideStep(), we have already increased the value of trustDelta_. We store the
|
// Within the program decideStep(), we have already increased the value of trustDelta_. We store the
|
||||||
// value of step0 in step1, recalculate a larger step0 in the next fillDogLegStep(),
|
// value of step0 in step1, recalculate a larger step0 in the next fillDogLegStep(),
|
||||||
// and then attempt to see if the larger step works in the next iteration
|
// and then attempt to see if the larger step works in the next iteration
|
||||||
|
|
@ -2805,7 +2805,7 @@ int NonlinearSolver::dampDogLeg(const doublereal time_curr, const doublereal* y_
|
||||||
// already been decreased in the decideStep() routine. We go back and try another iteration with
|
// already been decreased in the decideStep() routine. We go back and try another iteration with
|
||||||
// a smaller trust region.
|
// a smaller trust region.
|
||||||
if (haveASuccess) {
|
if (haveASuccess) {
|
||||||
mdp::mdp_copy_dbl_1(DATA_PTR(step_1), CONSTD_DATA_PTR(stepLastGood), neq_);
|
mdp::mdp_copy_dbl_1(DATA_PTR(step_1), CONSTD_DATA_PTR(stepLastGood), (int) neq_);
|
||||||
for (j = 0; j < neq_; j++) {
|
for (j = 0; j < neq_; j++) {
|
||||||
y_n_1[j] = y_n_curr[j] + step_1[j];
|
y_n_1[j] = y_n_curr[j] + step_1[j];
|
||||||
}
|
}
|
||||||
|
|
@ -3082,11 +3082,11 @@ int NonlinearSolver::solve_nonlinear_problem(int SolnType, doublereal* const y_c
|
||||||
bool trInit = false;
|
bool trInit = false;
|
||||||
|
|
||||||
|
|
||||||
mdp::mdp_copy_dbl_1(DATA_PTR(m_y_n_curr), DATA_PTR(y_comm), neq_);
|
mdp::mdp_copy_dbl_1(DATA_PTR(m_y_n_curr), DATA_PTR(y_comm), (int) neq_);
|
||||||
|
|
||||||
if (SolnType != NSOLN_TYPE_STEADY_STATE || ydot_comm) {
|
if (SolnType != NSOLN_TYPE_STEADY_STATE || ydot_comm) {
|
||||||
mdp::mdp_copy_dbl_1(DATA_PTR(m_ydot_n_curr), ydot_comm, neq_);
|
mdp::mdp_copy_dbl_1(DATA_PTR(m_ydot_n_curr), ydot_comm, (int) neq_);
|
||||||
mdp::mdp_copy_dbl_1(DATA_PTR(m_ydot_n_1), ydot_comm, neq_);
|
mdp::mdp_copy_dbl_1(DATA_PTR(m_ydot_n_1), ydot_comm, (int) neq_);
|
||||||
}
|
}
|
||||||
// Redo the solution weights every time we enter the function
|
// Redo the solution weights every time we enter the function
|
||||||
createSolnWeights(DATA_PTR(m_y_n_curr));
|
createSolnWeights(DATA_PTR(m_y_n_curr));
|
||||||
|
|
@ -3103,7 +3103,7 @@ int NonlinearSolver::solve_nonlinear_problem(int SolnType, doublereal* const y_c
|
||||||
trInit = true;
|
trInit = true;
|
||||||
initializeTrustRegion();
|
initializeTrustRegion();
|
||||||
} else {
|
} else {
|
||||||
mdp::mdp_init_dbl_1(DATA_PTR(deltaX_trust_), 1.0, neq_);
|
mdp::mdp_init_dbl_1(DATA_PTR(deltaX_trust_), 1.0, (int) neq_);
|
||||||
trustDelta_ = 1.0;
|
trustDelta_ = 1.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3277,7 +3277,7 @@ int NonlinearSolver::solve_nonlinear_problem(int SolnType, doublereal* const y_c
|
||||||
}
|
}
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
mdp::mdp_copy_dbl_1(DATA_PTR(m_step_1), CONSTD_DATA_PTR(deltaX_Newton_), neq_);
|
mdp::mdp_copy_dbl_1(DATA_PTR(m_step_1), CONSTD_DATA_PTR(deltaX_Newton_), (int) neq_);
|
||||||
|
|
||||||
if (m_print_flag >= 6) {
|
if (m_print_flag >= 6) {
|
||||||
m_normDeltaSoln_Newton = solnErrorNorm(DATA_PTR(deltaX_Newton_), "Initial Undamped Newton Step of the iteration", 10);
|
m_normDeltaSoln_Newton = solnErrorNorm(DATA_PTR(deltaX_Newton_), "Initial Undamped Newton Step of the iteration", 10);
|
||||||
|
|
@ -3452,7 +3452,7 @@ int NonlinearSolver::solve_nonlinear_problem(int SolnType, doublereal* const y_c
|
||||||
|
|
||||||
// Exchange new for curr solutions
|
// Exchange new for curr solutions
|
||||||
if (retnDamp >= NSOLN_RETN_CONTINUE) {
|
if (retnDamp >= NSOLN_RETN_CONTINUE) {
|
||||||
mdp::mdp_copy_dbl_1(DATA_PTR(m_y_n_curr), CONSTD_DATA_PTR(m_y_n_1), neq_);
|
mdp::mdp_copy_dbl_1(DATA_PTR(m_y_n_curr), CONSTD_DATA_PTR(m_y_n_1), (int) neq_);
|
||||||
|
|
||||||
if (solnType_ != NSOLN_TYPE_STEADY_STATE) {
|
if (solnType_ != NSOLN_TYPE_STEADY_STATE) {
|
||||||
calc_ydot(m_order, DATA_PTR(m_y_n_curr), DATA_PTR(m_ydot_n_curr));
|
calc_ydot(m_order, DATA_PTR(m_y_n_curr), DATA_PTR(m_ydot_n_curr));
|
||||||
|
|
@ -3566,9 +3566,9 @@ done:
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mdp::mdp_copy_dbl_1(y_comm, CONSTD_DATA_PTR(m_y_n_curr), neq_);
|
mdp::mdp_copy_dbl_1(y_comm, CONSTD_DATA_PTR(m_y_n_curr), (int) neq_);
|
||||||
if (solnType_ != NSOLN_TYPE_STEADY_STATE) {
|
if (solnType_ != NSOLN_TYPE_STEADY_STATE) {
|
||||||
mdp::mdp_copy_dbl_1(ydot_comm, CONSTD_DATA_PTR(m_ydot_n_curr), neq_);
|
mdp::mdp_copy_dbl_1(ydot_comm, CONSTD_DATA_PTR(m_ydot_n_curr), (int) neq_);
|
||||||
}
|
}
|
||||||
|
|
||||||
num_linear_solves += m_numTotalLinearSolves;
|
num_linear_solves += m_numTotalLinearSolves;
|
||||||
|
|
@ -3761,7 +3761,7 @@ int NonlinearSolver::beuler_jac(GeneralMatrix& J, doublereal* const f,
|
||||||
* deltaY's that are appropriate for calculating the numerical
|
* deltaY's that are appropriate for calculating the numerical
|
||||||
* derivative.
|
* derivative.
|
||||||
*/
|
*/
|
||||||
doublereal* dyVector = mdp::mdp_alloc_dbl_1(neq_, MDP_DBL_NOINIT);
|
doublereal* dyVector = mdp::mdp_alloc_dbl_1((int) neq_, MDP_DBL_NOINIT);
|
||||||
retn = m_func->calcDeltaSolnVariables(time_curr, y, ydot, dyVector, DATA_PTR(m_ewt));
|
retn = m_func->calcDeltaSolnVariables(time_curr, y, ydot, dyVector, DATA_PTR(m_ewt));
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -3837,9 +3837,9 @@ int NonlinearSolver::beuler_jac(GeneralMatrix& J, doublereal* const f,
|
||||||
*/
|
*/
|
||||||
mdp::mdp_safe_free((void**) &dyVector);
|
mdp::mdp_safe_free((void**) &dyVector);
|
||||||
} else if (J.matrixType_ == 1) {
|
} else if (J.matrixType_ == 1) {
|
||||||
int ku, kl;
|
size_t ku, kl;
|
||||||
int ivec[2];
|
size_t ivec[2];
|
||||||
int n = J.nRowsAndStruct(ivec);
|
size_t n = J.nRowsAndStruct(ivec);
|
||||||
kl = ivec[0];
|
kl = ivec[0];
|
||||||
ku = ivec[1];
|
ku = ivec[1];
|
||||||
if (n != neq_) {
|
if (n != neq_) {
|
||||||
|
|
@ -3856,7 +3856,7 @@ int NonlinearSolver::beuler_jac(GeneralMatrix& J, doublereal* const f,
|
||||||
m_nJacEval++;
|
m_nJacEval++;
|
||||||
|
|
||||||
|
|
||||||
doublereal* dyVector = mdp::mdp_alloc_dbl_1(neq_, MDP_DBL_NOINIT);
|
doublereal* dyVector = mdp::mdp_alloc_dbl_1((int) neq_, MDP_DBL_NOINIT);
|
||||||
retn = m_func->calcDeltaSolnVariables(time_curr, y, ydot, dyVector, DATA_PTR(m_ewt));
|
retn = m_func->calcDeltaSolnVariables(time_curr, y, ydot, dyVector, DATA_PTR(m_ewt));
|
||||||
if (s_print_NumJac) {
|
if (s_print_NumJac) {
|
||||||
if (m_print_flag >= 7) {
|
if (m_print_flag >= 7) {
|
||||||
|
|
@ -3897,7 +3897,7 @@ int NonlinearSolver::beuler_jac(GeneralMatrix& J, doublereal* const f,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for (int i = j - ku; i <= j + kl; i++) {
|
for (size_t i = j - ku; i <= j + kl; i++) {
|
||||||
if (i >= 0 && i < neq_) {
|
if (i >= 0 && i < neq_) {
|
||||||
diff = subtractRD(m_wksp[i], f[i]);
|
diff = subtractRD(m_wksp[i], f[i]);
|
||||||
col_j[kl + ku + i - j] = diff / dy;
|
col_j[kl + ku + i - j] = diff / dy;
|
||||||
|
|
@ -3912,7 +3912,7 @@ int NonlinearSolver::beuler_jac(GeneralMatrix& J, doublereal* const f,
|
||||||
|
|
||||||
mdp::mdp_safe_free((void**) &dyVector);
|
mdp::mdp_safe_free((void**) &dyVector);
|
||||||
double vSmall;
|
double vSmall;
|
||||||
int ismall = J.checkRows(vSmall);
|
size_t ismall = J.checkRows(vSmall);
|
||||||
if (vSmall < 1.0E-100) {
|
if (vSmall < 1.0E-100) {
|
||||||
printf("WE have a zero row, %d\n", ismall);
|
printf("WE have a zero row, %d\n", ismall);
|
||||||
exit(-1);
|
exit(-1);
|
||||||
|
|
|
||||||
|
|
@ -156,7 +156,7 @@ void SquareMatrix::resize(size_t n, size_t m, doublereal v)
|
||||||
* @param b Vector to do the rh multiplcation
|
* @param b Vector to do the rh multiplcation
|
||||||
* @param prod OUTPUT vector to receive the result
|
* @param prod OUTPUT vector to receive the result
|
||||||
*/
|
*/
|
||||||
void SquareMatrix::mult(const doublereal* const b, doublereal* const prod) const
|
void SquareMatrix::mult(const doublereal* b, doublereal* prod) const
|
||||||
{
|
{
|
||||||
DenseMatrix::mult(b, prod);
|
DenseMatrix::mult(b, prod);
|
||||||
}
|
}
|
||||||
|
|
@ -220,7 +220,7 @@ int SquareMatrix::factorQR()
|
||||||
a1norm_ = ct_dlange('1', m_nrows, m_nrows, &(*(begin())), m_nrows, DATA_PTR(work));
|
a1norm_ = ct_dlange('1', m_nrows, m_nrows, &(*(begin())), m_nrows, DATA_PTR(work));
|
||||||
int info;
|
int info;
|
||||||
m_factored = 2;
|
m_factored = 2;
|
||||||
int lwork = work.size();
|
size_t lwork = work.size();
|
||||||
ct_dgeqrf(m_nrows, m_nrows, &(*(begin())), m_nrows, DATA_PTR(tau), DATA_PTR(work), lwork, info);
|
ct_dgeqrf(m_nrows, m_nrows, &(*(begin())), m_nrows, DATA_PTR(tau), DATA_PTR(work), lwork, info);
|
||||||
if (info != 0) {
|
if (info != 0) {
|
||||||
if (m_printLevel) {
|
if (m_printLevel) {
|
||||||
|
|
@ -230,7 +230,7 @@ int SquareMatrix::factorQR()
|
||||||
throw CELapackError("SquareMatrix::factorQR()", "DGEQRF returned INFO = " + int2str(info));
|
throw CELapackError("SquareMatrix::factorQR()", "DGEQRF returned INFO = " + int2str(info));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int lworkOpt = work[0];
|
size_t lworkOpt = static_cast<size_t>(work[0]);
|
||||||
if (lworkOpt > lwork) {
|
if (lworkOpt > lwork) {
|
||||||
work.resize(lworkOpt);
|
work.resize(lworkOpt);
|
||||||
}
|
}
|
||||||
|
|
@ -371,7 +371,7 @@ int SquareMatrix::factorAlgorithm() const
|
||||||
//=====================================================================================================================
|
//=====================================================================================================================
|
||||||
bool SquareMatrix::factored() const
|
bool SquareMatrix::factored() const
|
||||||
{
|
{
|
||||||
return m_factored;
|
return (m_factored != 0);
|
||||||
}
|
}
|
||||||
//=====================================================================================================================
|
//=====================================================================================================================
|
||||||
// Return a pointer to the top of column j, columns are contiguous in memory
|
// Return a pointer to the top of column j, columns are contiguous in memory
|
||||||
|
|
@ -401,7 +401,7 @@ size_t SquareMatrix::nRows() const
|
||||||
return m_nrows;
|
return m_nrows;
|
||||||
}
|
}
|
||||||
//=====================================================================================================================
|
//=====================================================================================================================
|
||||||
size_t SquareMatrix::nRowsAndStruct(int* const iStruct) const
|
size_t SquareMatrix::nRowsAndStruct(size_t* const iStruct) const
|
||||||
{
|
{
|
||||||
return m_nrows;
|
return m_nrows;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ namespace Cantera
|
||||||
* STATIC ROUTINES DEFINED IN THIS FILE
|
* STATIC ROUTINES DEFINED IN THIS FILE
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
static doublereal calcWeightedNorm(const doublereal [], const doublereal dx[], int);
|
static doublereal calcWeightedNorm(const doublereal [], const doublereal dx[], size_t);
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* LAPACK PROTOTYPES
|
* LAPACK PROTOTYPES
|
||||||
|
|
@ -66,7 +66,7 @@ solveProb::solveProb(ResidEval* resid) :
|
||||||
m_neq = m_residFunc->nEquations();
|
m_neq = m_residFunc->nEquations();
|
||||||
|
|
||||||
// Dimension solution vector
|
// Dimension solution vector
|
||||||
int dim1 = MAX(1, m_neq);
|
size_t dim1 = MAX(1, m_neq);
|
||||||
|
|
||||||
m_atol.resize(dim1, 1.0E-9);
|
m_atol.resize(dim1, 1.0E-9);
|
||||||
m_netProductionRatesSave.resize(dim1, 0.0);
|
m_netProductionRatesSave.resize(dim1, 0.0);
|
||||||
|
|
@ -85,7 +85,7 @@ solveProb::solveProb(ResidEval* resid) :
|
||||||
|
|
||||||
m_Jac.resize(dim1, dim1, 0.0);
|
m_Jac.resize(dim1, dim1, 0.0);
|
||||||
m_JacCol.resize(dim1, 0);
|
m_JacCol.resize(dim1, 0);
|
||||||
for (int k = 0; k < dim1; k++) {
|
for (size_t k = 0; k < dim1; k++) {
|
||||||
m_JacCol[k] = m_Jac.ptrColumn(k);
|
m_JacCol[k] = m_Jac.ptrColumn(k);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -111,9 +111,9 @@ int solveProb::solve(int ifunc, doublereal time_scale,
|
||||||
EXTRA_ACCURACY *= 0.001;
|
EXTRA_ACCURACY *= 0.001;
|
||||||
}
|
}
|
||||||
int info = 0;
|
int info = 0;
|
||||||
int label_t=-1; /* Species IDs for time control */
|
size_t label_t = npos; /* Species IDs for time control */
|
||||||
int label_d; /* Species IDs for damping control */
|
int label_d; /* Species IDs for damping control */
|
||||||
int label_t_old = -1;
|
size_t label_t_old = npos;
|
||||||
doublereal label_factor = 1.0;
|
doublereal label_factor = 1.0;
|
||||||
int iter=0; // iteration number on numlinear solver
|
int iter=0; // iteration number on numlinear solver
|
||||||
int iter_max=1000; // maximum number of nonlinear iterations
|
int iter_max=1000; // maximum number of nonlinear iterations
|
||||||
|
|
@ -504,7 +504,7 @@ void solveProb::resjac_eval(std::vector<doublereal*> &JacCol,
|
||||||
* @param dim Size of the solution vector
|
* @param dim Size of the solution vector
|
||||||
* @param label return int, stating which solution component caused the most damping.
|
* @param label return int, stating which solution component caused the most damping.
|
||||||
*/
|
*/
|
||||||
doublereal solveProb::calc_damping(doublereal x[], doublereal dxneg[], int dim, int* label)
|
doublereal solveProb::calc_damping(doublereal x[], doublereal dxneg[], size_t dim, int* label)
|
||||||
{
|
{
|
||||||
doublereal damp = 1.0, xnew, xtop, xbot;
|
doublereal damp = 1.0, xnew, xtop, xbot;
|
||||||
static doublereal damp_old = 1.0;
|
static doublereal damp_old = 1.0;
|
||||||
|
|
@ -582,7 +582,7 @@ doublereal solveProb::calc_damping(doublereal x[], doublereal dxneg[], int dim,
|
||||||
* This function calculates the norm of an update, dx[],
|
* This function calculates the norm of an update, dx[],
|
||||||
* based on the weighted values of x.
|
* based on the weighted values of x.
|
||||||
*/
|
*/
|
||||||
static doublereal calcWeightedNorm(const doublereal wtX[], const doublereal dx[], int dim)
|
static doublereal calcWeightedNorm(const doublereal wtX[], const doublereal dx[], size_t dim)
|
||||||
{
|
{
|
||||||
doublereal norm = 0.0;
|
doublereal norm = 0.0;
|
||||||
doublereal tmp;
|
doublereal tmp;
|
||||||
|
|
@ -638,7 +638,7 @@ void solveProb::calcWeights(doublereal wtSpecies[], doublereal wtResid[],
|
||||||
*/
|
*/
|
||||||
doublereal solveProb::
|
doublereal solveProb::
|
||||||
calc_t(doublereal netProdRateSolnSP[], doublereal Csoln[],
|
calc_t(doublereal netProdRateSolnSP[], doublereal Csoln[],
|
||||||
int* label, int* label_old, doublereal* label_factor, int ioflag)
|
size_t* label, size_t* label_old, doublereal* label_factor, int ioflag)
|
||||||
{
|
{
|
||||||
doublereal tmp, inv_timeScale=0.0;
|
doublereal tmp, inv_timeScale=0.0;
|
||||||
for (size_t k = 0; k < m_neq; k++) {
|
for (size_t k = 0; k < m_neq; k++) {
|
||||||
|
|
@ -818,14 +818,14 @@ void solveProb::print_header(int ioflag, int ifunc, doublereal time_scale,
|
||||||
}
|
}
|
||||||
//================================================================================================
|
//================================================================================================
|
||||||
void solveProb::printIteration(int ioflag, doublereal damp, int label_d,
|
void solveProb::printIteration(int ioflag, doublereal damp, int label_d,
|
||||||
int label_t,
|
size_t label_t,
|
||||||
doublereal inv_t, doublereal t_real, int iter,
|
doublereal inv_t, doublereal t_real, int iter,
|
||||||
doublereal update_norm, doublereal resid_norm,
|
doublereal update_norm, doublereal resid_norm,
|
||||||
doublereal netProdRate[], doublereal CSolnSP[],
|
doublereal netProdRate[], doublereal CSolnSP[],
|
||||||
doublereal resid[],
|
doublereal resid[],
|
||||||
doublereal wtSpecies[], int dim, bool do_time)
|
doublereal wtSpecies[], size_t dim, bool do_time)
|
||||||
{
|
{
|
||||||
int i, k;
|
size_t i, k;
|
||||||
string nm;
|
string nm;
|
||||||
if (ioflag == 1) {
|
if (ioflag == 1) {
|
||||||
|
|
||||||
|
|
@ -907,15 +907,15 @@ void solveProb::printIteration(int ioflag, doublereal damp, int label_d,
|
||||||
} /* printIteration */
|
} /* printIteration */
|
||||||
|
|
||||||
//================================================================================================
|
//================================================================================================
|
||||||
void solveProb::printFinal(int ioflag, doublereal damp, int label_d, int label_t,
|
void solveProb::printFinal(int ioflag, doublereal damp, int label_d, size_t label_t,
|
||||||
doublereal inv_t, doublereal t_real, int iter,
|
doublereal inv_t, doublereal t_real, int iter,
|
||||||
doublereal update_norm, doublereal resid_norm,
|
doublereal update_norm, doublereal resid_norm,
|
||||||
doublereal netProdRateKinSpecies[], const doublereal CSolnSP[],
|
doublereal netProdRateKinSpecies[], const doublereal CSolnSP[],
|
||||||
const doublereal resid[],
|
const doublereal resid[],
|
||||||
const doublereal wtSpecies[], const doublereal wtRes[],
|
const doublereal wtSpecies[], const doublereal wtRes[],
|
||||||
int dim, bool do_time)
|
size_t dim, bool do_time)
|
||||||
{
|
{
|
||||||
int i, k;
|
size_t i, k;
|
||||||
string nm;
|
string nm;
|
||||||
if (ioflag == 1) {
|
if (ioflag == 1) {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,7 @@ int Constituents::atomicNumber(size_t m) const
|
||||||
return m_Elements->atomicNumber(m);
|
return m_Elements->atomicNumber(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Constituents::elementType(int m) const
|
int Constituents::elementType(size_t m) const
|
||||||
{
|
{
|
||||||
return m_Elements->elementType(m);
|
return m_Elements->elementType(m);
|
||||||
}
|
}
|
||||||
|
|
@ -495,18 +495,18 @@ void Constituents::getAtoms(size_t k, double* atomArray) const
|
||||||
|
|
||||||
|
|
||||||
//====================================================================================================================
|
//====================================================================================================================
|
||||||
int Constituents::addUniqueElementAfterFreeze(const std::string& symbol, doublereal weight, int atomicNumber,
|
size_t Constituents::addUniqueElementAfterFreeze(const std::string& symbol, doublereal weight, int atomicNumber,
|
||||||
doublereal entropy298, int elem_type)
|
doublereal entropy298, int elem_type)
|
||||||
{
|
{
|
||||||
int ii = elementIndex(symbol);
|
size_t ii = elementIndex(symbol);
|
||||||
if (ii != -1) {
|
if (ii != npos) {
|
||||||
return ii;
|
return ii;
|
||||||
}
|
}
|
||||||
// Check to see that the element isn't really in the list
|
// Check to see that the element isn't really in the list
|
||||||
m_Elements->m_elementsFrozen = false;
|
m_Elements->m_elementsFrozen = false;
|
||||||
addUniqueElement(symbol, weight, atomicNumber, entropy298, elem_type);
|
addUniqueElement(symbol, weight, atomicNumber, entropy298, elem_type);
|
||||||
m_Elements->m_elementsFrozen = true;
|
m_Elements->m_elementsFrozen = true;
|
||||||
int m_mm = m_Elements->nElements();
|
size_t m_mm = m_Elements->nElements();
|
||||||
ii = elementIndex(symbol);
|
ii = elementIndex(symbol);
|
||||||
if (ii != m_mm-1) {
|
if (ii != m_mm-1) {
|
||||||
throw CanteraError("Constituents::addElementAfterFreeze()", "confused");
|
throw CanteraError("Constituents::addElementAfterFreeze()", "confused");
|
||||||
|
|
@ -515,8 +515,8 @@ int Constituents::addUniqueElementAfterFreeze(const std::string& symbol, doubler
|
||||||
vector_fp old(m_speciesComp);
|
vector_fp old(m_speciesComp);
|
||||||
m_speciesComp.resize(m_kk*m_mm, 0.0);
|
m_speciesComp.resize(m_kk*m_mm, 0.0);
|
||||||
for (size_t k = 0; k < m_kk; k++) {
|
for (size_t k = 0; k < m_kk; k++) {
|
||||||
int m_old = m_mm - 1;
|
size_t m_old = m_mm - 1;
|
||||||
for (int m = 0; m < m_old; m++) {
|
for (size_t m = 0; m < m_old; m++) {
|
||||||
m_speciesComp[k * m_mm + m] = old[k * (m_old) + m];
|
m_speciesComp[k * m_mm + m] = old[k * (m_old) + m];
|
||||||
}
|
}
|
||||||
m_speciesComp[k * (m_mm) + (m_mm-1)] = 0.0;
|
m_speciesComp[k * (m_mm) + (m_mm-1)] = 0.0;
|
||||||
|
|
|
||||||
|
|
@ -353,7 +353,7 @@ doublereal Elements::entropyElement298(size_t m) const
|
||||||
*
|
*
|
||||||
* The default is CT_ELEM_TYPE_ABSPOS
|
* The default is CT_ELEM_TYPE_ABSPOS
|
||||||
*/
|
*/
|
||||||
int Elements::elementType(int m) const
|
int Elements::elementType(size_t m) const
|
||||||
{
|
{
|
||||||
return m_elem_type[m];
|
return m_elem_type[m];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -112,8 +112,7 @@ FixedChemPotSSTP::FixedChemPotSSTP(std::string Ename, doublereal val) :
|
||||||
setNDim(3);
|
setNDim(3);
|
||||||
addUniqueElement(Ename, -12345.);
|
addUniqueElement(Ename, -12345.);
|
||||||
freezeElements();
|
freezeElements();
|
||||||
int nel = nElements();
|
vector_fp ecomp(nElements(), 0.0);
|
||||||
vector_fp ecomp(nel, 0.0);
|
|
||||||
ecomp[0] = 1.0;
|
ecomp[0] = 1.0;
|
||||||
double chrg = 0.0;
|
double chrg = 0.0;
|
||||||
SpeciesThermo* spth = new SimpleThermo();
|
SpeciesThermo* spth = new SimpleThermo();
|
||||||
|
|
|
||||||
|
|
@ -588,7 +588,7 @@ void IonsFromNeutralVPSSTP::getdlnActCoeffdlnN_diag(doublereal* dlnActCoeffdlnN_
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//====================================================================================================================
|
//====================================================================================================================
|
||||||
void IonsFromNeutralVPSSTP::getdlnActCoeffdlnN(const int ld, doublereal* dlnActCoeffdlnN)
|
void IonsFromNeutralVPSSTP::getdlnActCoeffdlnN(const size_t ld, doublereal* dlnActCoeffdlnN)
|
||||||
{
|
{
|
||||||
s_update_lnActCoeff();
|
s_update_lnActCoeff();
|
||||||
s_update_dlnActCoeff_dlnN();
|
s_update_dlnActCoeff_dlnN();
|
||||||
|
|
@ -1679,7 +1679,7 @@ void IonsFromNeutralVPSSTP::s_update_dlnActCoeff_dlnN() const
|
||||||
if (!geThermo) {
|
if (!geThermo) {
|
||||||
throw CanteraError("IonsFromNeutralVPSSTP::s_update_dlnActCoeff_dlnN()", "dynamic cast failed");
|
throw CanteraError("IonsFromNeutralVPSSTP::s_update_dlnActCoeff_dlnN()", "dynamic cast failed");
|
||||||
}
|
}
|
||||||
int nsp_ge = geThermo->nSpecies();
|
size_t nsp_ge = geThermo->nSpecies();
|
||||||
geThermo->getdlnActCoeffdlnN(nsp_ge, &(dlnActCoeffdlnN_NeutralMolecule_(0,0)));
|
geThermo->getdlnActCoeffdlnN(nsp_ge, &(dlnActCoeffdlnN_NeutralMolecule_(0,0)));
|
||||||
|
|
||||||
switch (ionSolnType_) {
|
switch (ionSolnType_) {
|
||||||
|
|
|
||||||
|
|
@ -122,9 +122,9 @@ ThermoPhase* LatticeSolidPhase::duplMyselfAsThermoPhase() const
|
||||||
* @param k index of the species. Default is -1, which will return the max of the min value
|
* @param k index of the species. Default is -1, which will return the max of the min value
|
||||||
* over all species.
|
* over all species.
|
||||||
*/
|
*/
|
||||||
doublereal LatticeSolidPhase::minTemp(int k) const
|
doublereal LatticeSolidPhase::minTemp(size_t k) const
|
||||||
{
|
{
|
||||||
if (k >= 0) {
|
if (k != npos) {
|
||||||
for (size_t n = 0; n < m_nlattice; n++) {
|
for (size_t n = 0; n < m_nlattice; n++) {
|
||||||
if (lkstart_[n+1] < k) {
|
if (lkstart_[n+1] < k) {
|
||||||
double ml = (m_lattice[n])->minTemp(k-lkstart_[n]);
|
double ml = (m_lattice[n])->minTemp(k-lkstart_[n]);
|
||||||
|
|
@ -152,9 +152,9 @@ doublereal LatticeSolidPhase::minTemp(int k) const
|
||||||
* @param k index of the species. Default is -1, which will return the max of the min value
|
* @param k index of the species. Default is -1, which will return the max of the min value
|
||||||
* over all species.
|
* over all species.
|
||||||
*/
|
*/
|
||||||
doublereal LatticeSolidPhase::maxTemp(int k) const
|
doublereal LatticeSolidPhase::maxTemp(size_t k) const
|
||||||
{
|
{
|
||||||
if (k >= 0) {
|
if (k != npos) {
|
||||||
for (size_t n = 0; n < m_nlattice; n++) {
|
for (size_t n = 0; n < m_nlattice; n++) {
|
||||||
if (lkstart_[n+1] < k) {
|
if (lkstart_[n+1] < k) {
|
||||||
double ml = (m_lattice[n])->maxTemp(k - lkstart_[n]);
|
double ml = (m_lattice[n])->maxTemp(k - lkstart_[n]);
|
||||||
|
|
@ -512,8 +512,8 @@ void LatticeSolidPhase::installSlavePhases(Cantera::XML_Node* phaseNode)
|
||||||
for (size_t m = 0; m < lp->nElements(); m++) {
|
for (size_t m = 0; m < lp->nElements(); m++) {
|
||||||
if (constArr[m] != 0.0) {
|
if (constArr[m] != 0.0) {
|
||||||
std::string oldEname = lp->elementName(m);
|
std::string oldEname = lp->elementName(m);
|
||||||
int newIndex = elementIndex(oldEname);
|
size_t newIndex = elementIndex(oldEname);
|
||||||
if (newIndex < 0) {
|
if (newIndex == npos) {
|
||||||
throw CanteraError("LatticeSolidPhase::installSlavePhases", "confused");
|
throw CanteraError("LatticeSolidPhase::installSlavePhases", "confused");
|
||||||
}
|
}
|
||||||
ecomp[newIndex] = constArr[m];
|
ecomp[newIndex] = constArr[m];
|
||||||
|
|
@ -534,7 +534,7 @@ void LatticeSolidPhase::installSlavePhases(Cantera::XML_Node* phaseNode)
|
||||||
string econ = "LC_";
|
string econ = "LC_";
|
||||||
econ += int2str(n);
|
econ += int2str(n);
|
||||||
econ += "_" + id();
|
econ += "_" + id();
|
||||||
int m = addUniqueElementAfterFreeze(econ, 0.0, 0, 0.0, CT_ELEM_TYPE_LATTICERATIO);
|
size_t m = addUniqueElementAfterFreeze(econ, 0.0, 0, 0.0, CT_ELEM_TYPE_LATTICERATIO);
|
||||||
m_mm = nElements();
|
m_mm = nElements();
|
||||||
LatticePhase* lp0 = m_lattice[0];
|
LatticePhase* lp0 = m_lattice[0];
|
||||||
size_t nsp0 = lp0->nSpecies();
|
size_t nsp0 = lp0->nSpecies();
|
||||||
|
|
@ -574,7 +574,6 @@ void LatticeSolidPhase::initThermo()
|
||||||
for (size_t n = 0; n < m_nlattice; n++) {
|
for (size_t n = 0; n < m_nlattice; n++) {
|
||||||
nsp = m_lattice[n]->nSpecies();
|
nsp = m_lattice[n]->nSpecies();
|
||||||
lkstart_[n] = loc;
|
lkstart_[n] = loc;
|
||||||
nspLattice_[n] = nsp;
|
|
||||||
for (size_t k = 0; k < nsp; k++) {
|
for (size_t k = 0; k < nsp; k++) {
|
||||||
m_x[loc] =m_lattice[n]->moleFraction(k) / (double) m_nlattice;
|
m_x[loc] =m_lattice[n]->moleFraction(k) / (double) m_nlattice;
|
||||||
loc++;
|
loc++;
|
||||||
|
|
@ -592,7 +591,6 @@ void LatticeSolidPhase::initThermo()
|
||||||
void LatticeSolidPhase::initLengths()
|
void LatticeSolidPhase::initLengths()
|
||||||
{
|
{
|
||||||
theta_.resize(m_nlattice,0);
|
theta_.resize(m_nlattice,0);
|
||||||
nspLattice_.resize(m_nlattice);
|
|
||||||
lkstart_.resize(m_nlattice+1);
|
lkstart_.resize(m_nlattice+1);
|
||||||
m_x.resize(m_kk, 0.0);
|
m_x.resize(m_kk, 0.0);
|
||||||
tmpV_.resize(m_kk, 0.0);
|
tmpV_.resize(m_kk, 0.0);
|
||||||
|
|
|
||||||
|
|
@ -403,11 +403,11 @@ void MargulesVPSSTP::getChemPotentials(doublereal* mu) const
|
||||||
/// Molar enthalpy. Units: J/kmol.
|
/// Molar enthalpy. Units: J/kmol.
|
||||||
doublereal MargulesVPSSTP::enthalpy_mole() const
|
doublereal MargulesVPSSTP::enthalpy_mole() const
|
||||||
{
|
{
|
||||||
int kk = nSpecies();
|
size_t kk = nSpecies();
|
||||||
double h = 0;
|
double h = 0;
|
||||||
vector_fp hbar(kk);
|
vector_fp hbar(kk);
|
||||||
getPartialMolarEnthalpies(&hbar[0]);
|
getPartialMolarEnthalpies(&hbar[0]);
|
||||||
for (int i = 0; i < kk; i++) {
|
for (size_t i = 0; i < kk; i++) {
|
||||||
h += moleFractions_[i]*hbar[i];
|
h += moleFractions_[i]*hbar[i];
|
||||||
}
|
}
|
||||||
return h;
|
return h;
|
||||||
|
|
@ -416,11 +416,11 @@ doublereal MargulesVPSSTP::enthalpy_mole() const
|
||||||
/// Molar entropy. Units: J/kmol.
|
/// Molar entropy. Units: J/kmol.
|
||||||
doublereal MargulesVPSSTP::entropy_mole() const
|
doublereal MargulesVPSSTP::entropy_mole() const
|
||||||
{
|
{
|
||||||
int kk = nSpecies();
|
size_t kk = nSpecies();
|
||||||
double s = 0;
|
double s = 0;
|
||||||
vector_fp sbar(kk);
|
vector_fp sbar(kk);
|
||||||
getPartialMolarEntropies(&sbar[0]);
|
getPartialMolarEntropies(&sbar[0]);
|
||||||
for (int i = 0; i < kk; i++) {
|
for (size_t i = 0; i < kk; i++) {
|
||||||
s += moleFractions_[i]*sbar[i];
|
s += moleFractions_[i]*sbar[i];
|
||||||
}
|
}
|
||||||
return s;
|
return s;
|
||||||
|
|
@ -429,11 +429,11 @@ doublereal MargulesVPSSTP::entropy_mole() const
|
||||||
/// Molar heat capacity at constant pressure. Units: J/kmol/K.
|
/// Molar heat capacity at constant pressure. Units: J/kmol/K.
|
||||||
doublereal MargulesVPSSTP::cp_mole() const
|
doublereal MargulesVPSSTP::cp_mole() const
|
||||||
{
|
{
|
||||||
int kk = nSpecies();
|
size_t kk = nSpecies();
|
||||||
double cp = 0;
|
double cp = 0;
|
||||||
vector_fp cpbar(kk);
|
vector_fp cpbar(kk);
|
||||||
getPartialMolarCp(&cpbar[0]);
|
getPartialMolarCp(&cpbar[0]);
|
||||||
for (int i = 0; i < kk; i++) {
|
for (size_t i = 0; i < kk; i++) {
|
||||||
cp += moleFractions_[i]*cpbar[i];
|
cp += moleFractions_[i]*cpbar[i];
|
||||||
}
|
}
|
||||||
return cp;
|
return cp;
|
||||||
|
|
@ -1050,7 +1050,7 @@ void MargulesVPSSTP::getdlnActCoeffdlnX_diag(doublereal* dlnActCoeffdlnX_diag) c
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//====================================================================================================================
|
//====================================================================================================================
|
||||||
void MargulesVPSSTP::getdlnActCoeffdlnN(const int ld, doublereal* dlnActCoeffdlnN)
|
void MargulesVPSSTP::getdlnActCoeffdlnN(const size_t ld, doublereal* dlnActCoeffdlnN)
|
||||||
{
|
{
|
||||||
s_update_dlnActCoeff_dlnN();
|
s_update_dlnActCoeff_dlnN();
|
||||||
double* data = & dlnActCoeffdlnN_(0,0);
|
double* data = & dlnActCoeffdlnN_(0,0);
|
||||||
|
|
|
||||||
|
|
@ -187,16 +187,16 @@ MixedSolventElectrolyte::MixedSolventElectrolyte(int testProb) :
|
||||||
m_SE_d_ij[0] = 0.0;
|
m_SE_d_ij[0] = 0.0;
|
||||||
|
|
||||||
|
|
||||||
int iLiCl = speciesIndex("LiCl(L)");
|
size_t iLiCl = speciesIndex("LiCl(L)");
|
||||||
if (iLiCl < 0) {
|
if (iLiCl == npos) {
|
||||||
throw CanteraError("MixedSolventElectrolyte test1 constructor",
|
throw CanteraError("MixedSolventElectrolyte test1 constructor",
|
||||||
"Unable to find LiCl(L)");
|
"Unable to find LiCl(L)");
|
||||||
}
|
}
|
||||||
m_pSpecies_B_ij[0] = iLiCl;
|
m_pSpecies_B_ij[0] = iLiCl;
|
||||||
|
|
||||||
|
|
||||||
int iKCl = speciesIndex("KCl(L)");
|
size_t iKCl = speciesIndex("KCl(L)");
|
||||||
if (iKCl < 0) {
|
if (iKCl == npos) {
|
||||||
throw CanteraError("MixedSolventElectrolyte test1 constructor",
|
throw CanteraError("MixedSolventElectrolyte test1 constructor",
|
||||||
"Unable to find KCl(L)");
|
"Unable to find KCl(L)");
|
||||||
}
|
}
|
||||||
|
|
@ -707,8 +707,8 @@ void MixedSolventElectrolyte::initThermoXML(XML_Node& phaseNode, std::string id)
|
||||||
throw CanteraError(subname.c_str(),
|
throw CanteraError(subname.c_str(),
|
||||||
"Unknown activity coefficient model: " + mStringa);
|
"Unknown activity coefficient model: " + mStringa);
|
||||||
}
|
}
|
||||||
int n = acNodePtr->nChildren();
|
size_t n = acNodePtr->nChildren();
|
||||||
for (int i = 0; i < n; i++) {
|
for (size_t i = 0; i < n; i++) {
|
||||||
XML_Node& xmlACChild = acNodePtr->child(i);
|
XML_Node& xmlACChild = acNodePtr->child(i);
|
||||||
stemp = xmlACChild.name();
|
stemp = xmlACChild.name();
|
||||||
string nodeName = lowercase(stemp);
|
string nodeName = lowercase(stemp);
|
||||||
|
|
@ -1052,7 +1052,7 @@ void MixedSolventElectrolyte::getdlnActCoeffdlnX_diag(doublereal* dlnActCoeffdln
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//====================================================================================================================
|
//====================================================================================================================
|
||||||
void MixedSolventElectrolyte::getdlnActCoeffdlnN(const int ld, doublereal* dlnActCoeffdlnN)
|
void MixedSolventElectrolyte::getdlnActCoeffdlnN(const size_t ld, doublereal* dlnActCoeffdlnN)
|
||||||
{
|
{
|
||||||
s_update_dlnActCoeff_dlnN();
|
s_update_dlnActCoeff_dlnN();
|
||||||
double* data = & dlnActCoeffdlnN_(0,0);
|
double* data = & dlnActCoeffdlnN_(0,0);
|
||||||
|
|
@ -1063,7 +1063,7 @@ void MixedSolventElectrolyte::getdlnActCoeffdlnN(const int ld, doublereal* dlnAc
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//====================================================================================================================
|
//====================================================================================================================
|
||||||
void MixedSolventElectrolyte::resizeNumInteractions(const int num)
|
void MixedSolventElectrolyte::resizeNumInteractions(const size_t num)
|
||||||
{
|
{
|
||||||
numBinaryInteractions_ = num;
|
numBinaryInteractions_ = num;
|
||||||
m_HE_b_ij.resize(num, 0.0);
|
m_HE_b_ij.resize(num, 0.0);
|
||||||
|
|
@ -1101,7 +1101,7 @@ void MixedSolventElectrolyte::readXMLBinarySpecies(XML_Node& xmLBinarySpecies)
|
||||||
}
|
}
|
||||||
double* charge = DATA_PTR(m_speciesCharge);
|
double* charge = DATA_PTR(m_speciesCharge);
|
||||||
string stemp;
|
string stemp;
|
||||||
int nParamsFound;
|
size_t nParamsFound;
|
||||||
vector_fp vParams;
|
vector_fp vParams;
|
||||||
string iName = xmLBinarySpecies.attrib("speciesA");
|
string iName = xmLBinarySpecies.attrib("speciesA");
|
||||||
if (iName == "") {
|
if (iName == "") {
|
||||||
|
|
@ -1115,16 +1115,16 @@ void MixedSolventElectrolyte::readXMLBinarySpecies(XML_Node& xmLBinarySpecies)
|
||||||
* Find the index of the species in the current phase. It's not
|
* Find the index of the species in the current phase. It's not
|
||||||
* an error to not find the species
|
* an error to not find the species
|
||||||
*/
|
*/
|
||||||
int iSpecies = speciesIndex(iName);
|
size_t iSpecies = speciesIndex(iName);
|
||||||
if (iSpecies < 0) {
|
if (iSpecies == npos) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
string ispName = speciesName(iSpecies);
|
string ispName = speciesName(iSpecies);
|
||||||
if (charge[iSpecies] != 0) {
|
if (charge[iSpecies] != 0) {
|
||||||
throw CanteraError("MixedSolventElectrolyte::readXMLBinarySpecies", "speciesA charge problem");
|
throw CanteraError("MixedSolventElectrolyte::readXMLBinarySpecies", "speciesA charge problem");
|
||||||
}
|
}
|
||||||
int jSpecies = speciesIndex(jName);
|
size_t jSpecies = speciesIndex(jName);
|
||||||
if (jSpecies < 0) {
|
if (jSpecies == npos) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
string jspName = speciesName(jSpecies);
|
string jspName = speciesName(jSpecies);
|
||||||
|
|
@ -1133,12 +1133,12 @@ void MixedSolventElectrolyte::readXMLBinarySpecies(XML_Node& xmLBinarySpecies)
|
||||||
}
|
}
|
||||||
|
|
||||||
resizeNumInteractions(numBinaryInteractions_ + 1);
|
resizeNumInteractions(numBinaryInteractions_ + 1);
|
||||||
int iSpot = numBinaryInteractions_ - 1;
|
size_t iSpot = numBinaryInteractions_ - 1;
|
||||||
m_pSpecies_A_ij[iSpot] = iSpecies;
|
m_pSpecies_A_ij[iSpot] = iSpecies;
|
||||||
m_pSpecies_B_ij[iSpot] = jSpecies;
|
m_pSpecies_B_ij[iSpot] = jSpecies;
|
||||||
|
|
||||||
int num = xmLBinarySpecies.nChildren();
|
size_t num = xmLBinarySpecies.nChildren();
|
||||||
for (int iChild = 0; iChild < num; iChild++) {
|
for (size_t iChild = 0; iChild < num; iChild++) {
|
||||||
XML_Node& xmlChild = xmLBinarySpecies.child(iChild);
|
XML_Node& xmlChild = xmLBinarySpecies.child(iChild);
|
||||||
stemp = xmlChild.name();
|
stemp = xmlChild.name();
|
||||||
string nodeName = lowercase(stemp);
|
string nodeName = lowercase(stemp);
|
||||||
|
|
|
||||||
|
|
@ -635,7 +635,7 @@ void MolarityIonicVPSSTP::initThermo()
|
||||||
* Go find the list of cations and anions
|
* Go find the list of cations and anions
|
||||||
*/
|
*/
|
||||||
double ch;
|
double ch;
|
||||||
numCationSpecies_ = 0.0;
|
numCationSpecies_ = 0;
|
||||||
cationList_.clear();
|
cationList_.clear();
|
||||||
anionList_.clear();
|
anionList_.clear();
|
||||||
passThroughList_.clear();
|
passThroughList_.clear();
|
||||||
|
|
@ -721,8 +721,8 @@ void MolarityIonicVPSSTP::initThermoXML(XML_Node& phaseNode, std::string id)
|
||||||
// throw CanteraError(subname.c_str(),
|
// throw CanteraError(subname.c_str(),
|
||||||
// "Unknown activity coefficient model: " + mStringa);
|
// "Unknown activity coefficient model: " + mStringa);
|
||||||
//}
|
//}
|
||||||
int n = acNodePtr->nChildren();
|
size_t n = acNodePtr->nChildren();
|
||||||
for (int i = 0; i < n; i++) {
|
for (size_t i = 0; i < n; i++) {
|
||||||
XML_Node& xmlACChild = acNodePtr->child(i);
|
XML_Node& xmlACChild = acNodePtr->child(i);
|
||||||
stemp = xmlACChild.name();
|
stemp = xmlACChild.name();
|
||||||
std::string nodeName = lowercase(stemp);
|
std::string nodeName = lowercase(stemp);
|
||||||
|
|
@ -779,7 +779,7 @@ std::string MolarityIonicVPSSTP::report(bool show_thermo) const
|
||||||
sprintf(p, " potential %12.6g V\n", phi);
|
sprintf(p, " potential %12.6g V\n", phi);
|
||||||
s += p;
|
s += p;
|
||||||
|
|
||||||
int kk = nSpecies();
|
size_t kk = nSpecies();
|
||||||
array_fp x(kk);
|
array_fp x(kk);
|
||||||
array_fp molal(kk);
|
array_fp molal(kk);
|
||||||
array_fp mu(kk);
|
array_fp mu(kk);
|
||||||
|
|
|
||||||
|
|
@ -197,16 +197,16 @@ PhaseCombo_Interaction::PhaseCombo_Interaction(int testProb) :
|
||||||
m_SE_d_ij[0] = 0.0;
|
m_SE_d_ij[0] = 0.0;
|
||||||
|
|
||||||
|
|
||||||
int iLiT = speciesIndex("LiTFe1S2(S)");
|
size_t iLiT = speciesIndex("LiTFe1S2(S)");
|
||||||
if (iLiT < 0) {
|
if (iLiT == npos) {
|
||||||
throw CanteraError("PhaseCombo_Interaction test1 constructor",
|
throw CanteraError("PhaseCombo_Interaction test1 constructor",
|
||||||
"Unable to find LiTFe1S2(S)");
|
"Unable to find LiTFe1S2(S)");
|
||||||
}
|
}
|
||||||
m_pSpecies_A_ij[0] = iLiT;
|
m_pSpecies_A_ij[0] = iLiT;
|
||||||
|
|
||||||
|
|
||||||
int iLi2 = speciesIndex("Li2Fe1S2(S)");
|
size_t iLi2 = speciesIndex("Li2Fe1S2(S)");
|
||||||
if (iLi2 < 0) {
|
if (iLi2 == npos) {
|
||||||
throw CanteraError("PhaseCombo_Interaction test1 constructor",
|
throw CanteraError("PhaseCombo_Interaction test1 constructor",
|
||||||
"Unable to find Li2Fe1S2(S)");
|
"Unable to find Li2Fe1S2(S)");
|
||||||
}
|
}
|
||||||
|
|
@ -717,8 +717,8 @@ void PhaseCombo_Interaction::initThermoXML(XML_Node& phaseNode, std::string id)
|
||||||
throw CanteraError(subname.c_str(),
|
throw CanteraError(subname.c_str(),
|
||||||
"Unknown activity coefficient model: " + mStringa);
|
"Unknown activity coefficient model: " + mStringa);
|
||||||
}
|
}
|
||||||
int n = acNodePtr->nChildren();
|
size_t n = acNodePtr->nChildren();
|
||||||
for (int i = 0; i < n; i++) {
|
for (size_t i = 0; i < n; i++) {
|
||||||
XML_Node& xmlACChild = acNodePtr->child(i);
|
XML_Node& xmlACChild = acNodePtr->child(i);
|
||||||
stemp = xmlACChild.name();
|
stemp = xmlACChild.name();
|
||||||
string nodeName = lowercase(stemp);
|
string nodeName = lowercase(stemp);
|
||||||
|
|
@ -1061,20 +1061,15 @@ void PhaseCombo_Interaction::s_update_dlnActCoeff_dlnN() const
|
||||||
//====================================================================================================================
|
//====================================================================================================================
|
||||||
void PhaseCombo_Interaction::s_update_dlnActCoeff_dlnX_diag() const
|
void PhaseCombo_Interaction::s_update_dlnActCoeff_dlnX_diag() const
|
||||||
{
|
{
|
||||||
|
|
||||||
int iA, iB;
|
|
||||||
doublereal XA, XB, g0 , g1;
|
doublereal XA, XB, g0 , g1;
|
||||||
doublereal T = temperature();
|
doublereal T = temperature();
|
||||||
|
|
||||||
dlnActCoeffdlnX_diag_.assign(m_kk, 0.0);
|
dlnActCoeffdlnX_diag_.assign(m_kk, 0.0);
|
||||||
|
|
||||||
doublereal RT = GasConstant * T;
|
doublereal RT = GasConstant * T;
|
||||||
|
|
||||||
|
|
||||||
for (size_t i = 0; i < numBinaryInteractions_; i++) {
|
for (size_t i = 0; i < numBinaryInteractions_; i++) {
|
||||||
|
size_t iA = m_pSpecies_A_ij[i];
|
||||||
iA = m_pSpecies_A_ij[i];
|
size_t iB = m_pSpecies_B_ij[i];
|
||||||
iB = m_pSpecies_B_ij[i];
|
|
||||||
|
|
||||||
XA = moleFractions_[iA];
|
XA = moleFractions_[iA];
|
||||||
XB = moleFractions_[iB];
|
XB = moleFractions_[iB];
|
||||||
|
|
@ -1117,7 +1112,7 @@ void PhaseCombo_Interaction::getdlnActCoeffdlnX_diag(doublereal* dlnActCoeffdlnX
|
||||||
/*
|
/*
|
||||||
* HKM - Checked for Transition
|
* HKM - Checked for Transition
|
||||||
*/
|
*/
|
||||||
void PhaseCombo_Interaction::getdlnActCoeffdlnN(const int ld, doublereal* dlnActCoeffdlnN)
|
void PhaseCombo_Interaction::getdlnActCoeffdlnN(const size_t ld, doublereal* dlnActCoeffdlnN)
|
||||||
{
|
{
|
||||||
s_update_dlnActCoeff_dlnN();
|
s_update_dlnActCoeff_dlnN();
|
||||||
double* data = & dlnActCoeffdlnN_(0,0);
|
double* data = & dlnActCoeffdlnN_(0,0);
|
||||||
|
|
@ -1132,7 +1127,7 @@ void PhaseCombo_Interaction::getdlnActCoeffdlnN(const int ld, doublereal* dlnAct
|
||||||
/*
|
/*
|
||||||
* HKM - Checked for Transition
|
* HKM - Checked for Transition
|
||||||
*/
|
*/
|
||||||
void PhaseCombo_Interaction::resizeNumInteractions(const int num)
|
void PhaseCombo_Interaction::resizeNumInteractions(const size_t num)
|
||||||
{
|
{
|
||||||
numBinaryInteractions_ = num;
|
numBinaryInteractions_ = num;
|
||||||
m_HE_b_ij.resize(num, 0.0);
|
m_HE_b_ij.resize(num, 0.0);
|
||||||
|
|
@ -1169,7 +1164,7 @@ void PhaseCombo_Interaction::readXMLBinarySpecies(XML_Node& xmLBinarySpecies)
|
||||||
}
|
}
|
||||||
double* charge = DATA_PTR(m_speciesCharge);
|
double* charge = DATA_PTR(m_speciesCharge);
|
||||||
string stemp;
|
string stemp;
|
||||||
int nParamsFound;
|
size_t nParamsFound;
|
||||||
vector_fp vParams;
|
vector_fp vParams;
|
||||||
string iName = xmLBinarySpecies.attrib("speciesA");
|
string iName = xmLBinarySpecies.attrib("speciesA");
|
||||||
if (iName == "") {
|
if (iName == "") {
|
||||||
|
|
@ -1183,16 +1178,16 @@ void PhaseCombo_Interaction::readXMLBinarySpecies(XML_Node& xmLBinarySpecies)
|
||||||
* Find the index of the species in the current phase. It's not
|
* Find the index of the species in the current phase. It's not
|
||||||
* an error to not find the species
|
* an error to not find the species
|
||||||
*/
|
*/
|
||||||
int iSpecies = speciesIndex(iName);
|
size_t iSpecies = speciesIndex(iName);
|
||||||
if (iSpecies < 0) {
|
if (iSpecies == npos) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
string ispName = speciesName(iSpecies);
|
string ispName = speciesName(iSpecies);
|
||||||
if (charge[iSpecies] != 0) {
|
if (charge[iSpecies] != 0) {
|
||||||
throw CanteraError("PhaseCombo_Interaction::readXMLBinarySpecies", "speciesA charge problem");
|
throw CanteraError("PhaseCombo_Interaction::readXMLBinarySpecies", "speciesA charge problem");
|
||||||
}
|
}
|
||||||
int jSpecies = speciesIndex(jName);
|
size_t jSpecies = speciesIndex(jName);
|
||||||
if (jSpecies < 0) {
|
if (jSpecies == npos) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
string jspName = speciesName(jSpecies);
|
string jspName = speciesName(jSpecies);
|
||||||
|
|
@ -1201,12 +1196,12 @@ void PhaseCombo_Interaction::readXMLBinarySpecies(XML_Node& xmLBinarySpecies)
|
||||||
}
|
}
|
||||||
|
|
||||||
resizeNumInteractions(numBinaryInteractions_ + 1);
|
resizeNumInteractions(numBinaryInteractions_ + 1);
|
||||||
int iSpot = numBinaryInteractions_ - 1;
|
size_t iSpot = numBinaryInteractions_ - 1;
|
||||||
m_pSpecies_A_ij[iSpot] = iSpecies;
|
m_pSpecies_A_ij[iSpot] = iSpecies;
|
||||||
m_pSpecies_B_ij[iSpot] = jSpecies;
|
m_pSpecies_B_ij[iSpot] = jSpecies;
|
||||||
|
|
||||||
int num = xmLBinarySpecies.nChildren();
|
size_t num = xmLBinarySpecies.nChildren();
|
||||||
for (int iChild = 0; iChild < num; iChild++) {
|
for (size_t iChild = 0; iChild < num; iChild++) {
|
||||||
XML_Node& xmlChild = xmLBinarySpecies.child(iChild);
|
XML_Node& xmlChild = xmLBinarySpecies.child(iChild);
|
||||||
stemp = xmlChild.name();
|
stemp = xmlChild.name();
|
||||||
string nodeName = lowercase(stemp);
|
string nodeName = lowercase(stemp);
|
||||||
|
|
|
||||||
|
|
@ -123,16 +123,16 @@ RedlichKisterVPSSTP::RedlichKisterVPSSTP(int testProb) :
|
||||||
m_pSpecies_A_ij.resize(1);
|
m_pSpecies_A_ij.resize(1);
|
||||||
m_pSpecies_B_ij.resize(1);
|
m_pSpecies_B_ij.resize(1);
|
||||||
|
|
||||||
int iLiLi = speciesIndex("LiLi");
|
size_t iLiLi = speciesIndex("LiLi");
|
||||||
if (iLiLi < 0) {
|
if (iLiLi == npos) {
|
||||||
throw CanteraError("RedlichKisterVPSSTP test1 constructor",
|
throw CanteraError("RedlichKisterVPSSTP test1 constructor",
|
||||||
"Unable to find LiLi");
|
"Unable to find LiLi");
|
||||||
}
|
}
|
||||||
m_pSpecies_A_ij[0] = iLiLi;
|
m_pSpecies_A_ij[0] = iLiLi;
|
||||||
|
|
||||||
|
|
||||||
int iVLi = speciesIndex("VLi");
|
size_t iVLi = speciesIndex("VLi");
|
||||||
if (iVLi < 0) {
|
if (iVLi == npos) {
|
||||||
throw CanteraError("RedlichKisterVPSSTP test1 constructor",
|
throw CanteraError("RedlichKisterVPSSTP test1 constructor",
|
||||||
"Unable to find VLi");
|
"Unable to find VLi");
|
||||||
}
|
}
|
||||||
|
|
@ -409,11 +409,11 @@ void RedlichKisterVPSSTP::getChemPotentials(doublereal* mu) const
|
||||||
//Molar enthalpy. Units: J/kmol.
|
//Molar enthalpy. Units: J/kmol.
|
||||||
doublereal RedlichKisterVPSSTP::enthalpy_mole() const
|
doublereal RedlichKisterVPSSTP::enthalpy_mole() const
|
||||||
{
|
{
|
||||||
int kk = nSpecies();
|
size_t kk = nSpecies();
|
||||||
double h = 0;
|
double h = 0;
|
||||||
vector_fp hbar(kk);
|
vector_fp hbar(kk);
|
||||||
getPartialMolarEnthalpies(&hbar[0]);
|
getPartialMolarEnthalpies(&hbar[0]);
|
||||||
for (int i = 0; i < kk; i++) {
|
for (size_t i = 0; i < kk; i++) {
|
||||||
h += moleFractions_[i]*hbar[i];
|
h += moleFractions_[i]*hbar[i];
|
||||||
}
|
}
|
||||||
return h;
|
return h;
|
||||||
|
|
@ -422,11 +422,11 @@ doublereal RedlichKisterVPSSTP::enthalpy_mole() const
|
||||||
/// Molar entropy. Units: J/kmol.
|
/// Molar entropy. Units: J/kmol.
|
||||||
doublereal RedlichKisterVPSSTP::entropy_mole() const
|
doublereal RedlichKisterVPSSTP::entropy_mole() const
|
||||||
{
|
{
|
||||||
int kk = nSpecies();
|
size_t kk = nSpecies();
|
||||||
double s = 0;
|
double s = 0;
|
||||||
vector_fp sbar(kk);
|
vector_fp sbar(kk);
|
||||||
getPartialMolarEntropies(&sbar[0]);
|
getPartialMolarEntropies(&sbar[0]);
|
||||||
for (int i = 0; i < kk; i++) {
|
for (size_t i = 0; i < kk; i++) {
|
||||||
s += moleFractions_[i]*sbar[i];
|
s += moleFractions_[i]*sbar[i];
|
||||||
}
|
}
|
||||||
return s;
|
return s;
|
||||||
|
|
@ -435,11 +435,11 @@ doublereal RedlichKisterVPSSTP::entropy_mole() const
|
||||||
/// Molar heat capacity at constant pressure. Units: J/kmol/K.
|
/// Molar heat capacity at constant pressure. Units: J/kmol/K.
|
||||||
doublereal RedlichKisterVPSSTP::cp_mole() const
|
doublereal RedlichKisterVPSSTP::cp_mole() const
|
||||||
{
|
{
|
||||||
int kk = nSpecies();
|
size_t kk = nSpecies();
|
||||||
double cp = 0;
|
double cp = 0;
|
||||||
vector_fp cpbar(kk);
|
vector_fp cpbar(kk);
|
||||||
getPartialMolarCp(&cpbar[0]);
|
getPartialMolarCp(&cpbar[0]);
|
||||||
for (int i = 0; i < kk; i++) {
|
for (size_t i = 0; i < kk; i++) {
|
||||||
cp += moleFractions_[i]*cpbar[i];
|
cp += moleFractions_[i]*cpbar[i];
|
||||||
}
|
}
|
||||||
return cp;
|
return cp;
|
||||||
|
|
@ -678,8 +678,8 @@ void RedlichKisterVPSSTP::initThermoXML(XML_Node& phaseNode, std::string id)
|
||||||
throw CanteraError(subname.c_str(),
|
throw CanteraError(subname.c_str(),
|
||||||
"Unknown activity coefficient model: " + mStringa);
|
"Unknown activity coefficient model: " + mStringa);
|
||||||
}
|
}
|
||||||
int n = acNodePtr->nChildren();
|
size_t n = acNodePtr->nChildren();
|
||||||
for (int i = 0; i < n; i++) {
|
for (size_t i = 0; i < n; i++) {
|
||||||
XML_Node& xmlACChild = acNodePtr->child(i);
|
XML_Node& xmlACChild = acNodePtr->child(i);
|
||||||
stemp = xmlACChild.name();
|
stemp = xmlACChild.name();
|
||||||
std::string nodeName = lowercase(stemp);
|
std::string nodeName = lowercase(stemp);
|
||||||
|
|
@ -960,7 +960,7 @@ void RedlichKisterVPSSTP::getdlnActCoeffdlnX_diag(doublereal* dlnActCoeffdlnX_di
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//====================================================================================================================
|
//====================================================================================================================
|
||||||
void RedlichKisterVPSSTP::getdlnActCoeffdlnN(const int ld, doublereal* dlnActCoeffdlnN)
|
void RedlichKisterVPSSTP::getdlnActCoeffdlnN(const size_t ld, doublereal* dlnActCoeffdlnN)
|
||||||
{
|
{
|
||||||
s_update_dlnActCoeff_dX_();
|
s_update_dlnActCoeff_dX_();
|
||||||
double* data = & dlnActCoeffdlnN_(0,0);
|
double* data = & dlnActCoeffdlnN_(0,0);
|
||||||
|
|
@ -971,7 +971,7 @@ void RedlichKisterVPSSTP::getdlnActCoeffdlnN(const int ld, doublereal* dlnActCoe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//====================================================================================================================
|
//====================================================================================================================
|
||||||
void RedlichKisterVPSSTP::resizeNumInteractions(const int num)
|
void RedlichKisterVPSSTP::resizeNumInteractions(const size_t num)
|
||||||
{
|
{
|
||||||
numBinaryInteractions_ = num;
|
numBinaryInteractions_ = num;
|
||||||
m_pSpecies_A_ij.resize(num, -1);
|
m_pSpecies_A_ij.resize(num, -1);
|
||||||
|
|
@ -1013,16 +1013,16 @@ void RedlichKisterVPSSTP::readXMLBinarySpecies(XML_Node& xmLBinarySpecies)
|
||||||
* an error to not find the species. This means that the interaction doesn't occur for the current
|
* an error to not find the species. This means that the interaction doesn't occur for the current
|
||||||
* implementation of the phase.
|
* implementation of the phase.
|
||||||
*/
|
*/
|
||||||
int iSpecies = speciesIndex(iName);
|
size_t iSpecies = speciesIndex(iName);
|
||||||
if (iSpecies < 0) {
|
if (iSpecies == npos) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
string ispName = speciesName(iSpecies);
|
string ispName = speciesName(iSpecies);
|
||||||
if (charge[iSpecies] != 0) {
|
if (charge[iSpecies] != 0) {
|
||||||
throw CanteraError("RedlichKisterVPSSTP::readXMLBinarySpecies", "speciesA charge problem");
|
throw CanteraError("RedlichKisterVPSSTP::readXMLBinarySpecies", "speciesA charge problem");
|
||||||
}
|
}
|
||||||
int jSpecies = speciesIndex(jName);
|
size_t jSpecies = speciesIndex(jName);
|
||||||
if (jSpecies < 0) {
|
if (jSpecies == npos) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
std::string jspName = speciesName(jSpecies);
|
std::string jspName = speciesName(jSpecies);
|
||||||
|
|
@ -1033,14 +1033,14 @@ void RedlichKisterVPSSTP::readXMLBinarySpecies(XML_Node& xmLBinarySpecies)
|
||||||
* Ok we have found a valid interaction
|
* Ok we have found a valid interaction
|
||||||
*/
|
*/
|
||||||
numBinaryInteractions_++;
|
numBinaryInteractions_++;
|
||||||
int iSpot = numBinaryInteractions_ - 1;
|
size_t iSpot = numBinaryInteractions_ - 1;
|
||||||
m_pSpecies_A_ij.resize(numBinaryInteractions_);
|
m_pSpecies_A_ij.resize(numBinaryInteractions_);
|
||||||
m_pSpecies_B_ij.resize(numBinaryInteractions_);
|
m_pSpecies_B_ij.resize(numBinaryInteractions_);
|
||||||
m_pSpecies_A_ij[iSpot] = iSpecies;
|
m_pSpecies_A_ij[iSpot] = iSpecies;
|
||||||
m_pSpecies_B_ij[iSpot] = jSpecies;
|
m_pSpecies_B_ij[iSpot] = jSpecies;
|
||||||
|
|
||||||
int num = xmLBinarySpecies.nChildren();
|
size_t num = xmLBinarySpecies.nChildren();
|
||||||
for (int iChild = 0; iChild < num; iChild++) {
|
for (size_t iChild = 0; iChild < num; iChild++) {
|
||||||
XML_Node& xmlChild = xmLBinarySpecies.child(iChild);
|
XML_Node& xmlChild = xmLBinarySpecies.child(iChild);
|
||||||
stemp = xmlChild.name();
|
stemp = xmlChild.name();
|
||||||
string nodeName = lowercase(stemp);
|
string nodeName = lowercase(stemp);
|
||||||
|
|
|
||||||
|
|
@ -800,7 +800,7 @@ public:
|
||||||
* @param dlnActCoeffdlnN Output vector of derivatives of the
|
* @param dlnActCoeffdlnN Output vector of derivatives of the
|
||||||
* log Activity Coefficients. length = m_kk * m_kk
|
* log Activity Coefficients. length = m_kk * m_kk
|
||||||
*/
|
*/
|
||||||
virtual void getdlnActCoeffdlnN(const int ld, doublereal* const dlnActCoeffdlnN) ;
|
virtual void getdlnActCoeffdlnN(const size_t ld, doublereal* const dlnActCoeffdlnN) ;
|
||||||
|
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
|
@ -823,7 +823,7 @@ private:
|
||||||
/*!
|
/*!
|
||||||
* @param num Number of binary Redlich-Kister interaction terms
|
* @param num Number of binary Redlich-Kister interaction terms
|
||||||
*/
|
*/
|
||||||
void resizeNumInteractions(const int num);
|
void resizeNumInteractions(const size_t num);
|
||||||
|
|
||||||
|
|
||||||
//! Initialize lengths of local variables after all species have
|
//! Initialize lengths of local variables after all species have
|
||||||
|
|
@ -885,14 +885,14 @@ protected:
|
||||||
* Each Redlich-Kister excess Gibbs free energy term involves two species, A and B.
|
* Each Redlich-Kister excess Gibbs free energy term involves two species, A and B.
|
||||||
* This vector identifies species A.
|
* This vector identifies species A.
|
||||||
*/
|
*/
|
||||||
vector_int m_pSpecies_A_ij;
|
std::vector<size_t> m_pSpecies_A_ij;
|
||||||
|
|
||||||
//! vector of species indices representing species B in the interaction
|
//! vector of species indices representing species B in the interaction
|
||||||
/*!
|
/*!
|
||||||
* Each Redlich-Kisterexcess Gibbs free energy term involves two species, A and B.
|
* Each Redlich-Kisterexcess Gibbs free energy term involves two species, A and B.
|
||||||
* This vector identifies species B.
|
* This vector identifies species B.
|
||||||
*/
|
*/
|
||||||
vector_int m_pSpecies_B_ij;
|
std::vector<size_t> m_pSpecies_B_ij;
|
||||||
|
|
||||||
|
|
||||||
//! Vector of the length of the polynomial for the interaction.
|
//! Vector of the length of the polynomial for the interaction.
|
||||||
|
|
|
||||||
|
|
@ -169,7 +169,7 @@ void ThermoPhase::getActivities(doublereal* a) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//=================================================================================================================
|
//=================================================================================================================
|
||||||
void ThermoPhase::getLnActivityCoefficients(doublereal* const lnac) const
|
void ThermoPhase::getLnActivityCoefficients(doublereal* lnac) const
|
||||||
{
|
{
|
||||||
getActivityCoefficients(lnac);
|
getActivityCoefficients(lnac);
|
||||||
for (size_t k = 0; k < m_kk; k++) {
|
for (size_t k = 0; k < m_kk; k++) {
|
||||||
|
|
@ -1159,7 +1159,7 @@ bool ThermoPhase::getElementPotentials(doublereal* lambda) const
|
||||||
* @param dlnActCoeffdN Output vector of derivatives of the
|
* @param dlnActCoeffdN Output vector of derivatives of the
|
||||||
* log Activity Coefficients. length = m_kk * m_kk
|
* log Activity Coefficients. length = m_kk * m_kk
|
||||||
*/
|
*/
|
||||||
void ThermoPhase::getdlnActCoeffdlnN(const int ld, doublereal* const dlnActCoeffdlnN)
|
void ThermoPhase::getdlnActCoeffdlnN(const size_t ld, doublereal* const dlnActCoeffdlnN)
|
||||||
{
|
{
|
||||||
for (size_t m = 0; m < m_kk; m++) {
|
for (size_t m = 0; m < m_kk; m++) {
|
||||||
for (size_t k = 0; k < m_kk; k++) {
|
for (size_t k = 0; k < m_kk; k++) {
|
||||||
|
|
@ -1169,7 +1169,7 @@ void ThermoPhase::getdlnActCoeffdlnN(const int ld, doublereal* const dlnActCoeff
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//====================================================================================================================
|
//====================================================================================================================
|
||||||
void ThermoPhase::getdlnActCoeffdlnN_numderiv(const int ld, doublereal* const dlnActCoeffdlnN)
|
void ThermoPhase::getdlnActCoeffdlnN_numderiv(const size_t ld, doublereal* const dlnActCoeffdlnN)
|
||||||
{
|
{
|
||||||
double deltaMoles_j = 0.0;
|
double deltaMoles_j = 0.0;
|
||||||
double pres = pressure();
|
double pres = pressure();
|
||||||
|
|
@ -1230,7 +1230,7 @@ void ThermoPhase::getdlnActCoeffdlnN_numderiv(const int ld, doublereal* const dl
|
||||||
* Revert to the base case Xmol_, v_totalMoles
|
* Revert to the base case Xmol_, v_totalMoles
|
||||||
*/
|
*/
|
||||||
v_totalMoles = TMoles_base;
|
v_totalMoles = TMoles_base;
|
||||||
mdp::mdp_copy_dbl_1(DATA_PTR(Xmol), DATA_PTR(Xmol_Base), m_kk);
|
mdp::mdp_copy_dbl_1(DATA_PTR(Xmol), DATA_PTR(Xmol_Base), (int) m_kk);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Go get base values for the activity coefficients.
|
* Go get base values for the activity coefficients.
|
||||||
|
|
|
||||||
|
|
@ -59,26 +59,26 @@ LiquidTranInteraction::LiquidTranInteraction(TransportPropertyType tp_ind) :
|
||||||
|
|
||||||
LiquidTranInteraction::~LiquidTranInteraction()
|
LiquidTranInteraction::~LiquidTranInteraction()
|
||||||
{
|
{
|
||||||
int kmax = m_Aij.size();
|
size_t kmax = m_Aij.size();
|
||||||
for (int k = 0; k < kmax; k++) {
|
for (size_t k = 0; k < kmax; k++) {
|
||||||
if (m_Aij[k]) {
|
if (m_Aij[k]) {
|
||||||
delete m_Aij[k];
|
delete m_Aij[k];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
kmax = m_Bij.size();
|
kmax = m_Bij.size();
|
||||||
for (int k = 0; k < kmax; k++) {
|
for (size_t k = 0; k < kmax; k++) {
|
||||||
if (m_Bij[k]) {
|
if (m_Bij[k]) {
|
||||||
delete m_Bij[k];
|
delete m_Bij[k];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
kmax = m_Hij.size();
|
kmax = m_Hij.size();
|
||||||
for (int k = 0; k < kmax; k++) {
|
for (size_t k = 0; k < kmax; k++) {
|
||||||
if (m_Hij[k]) {
|
if (m_Hij[k]) {
|
||||||
delete m_Hij[k];
|
delete m_Hij[k];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
kmax = m_Sij.size();
|
kmax = m_Sij.size();
|
||||||
for (int k = 0; k < kmax; k++) {
|
for (size_t k = 0; k < kmax; k++) {
|
||||||
if (m_Sij[k]) {
|
if (m_Sij[k]) {
|
||||||
delete m_Sij[k];
|
delete m_Sij[k];
|
||||||
}
|
}
|
||||||
|
|
@ -93,7 +93,7 @@ void LiquidTranInteraction::init(const XML_Node& compModelNode,
|
||||||
|
|
||||||
m_thermo = thermo;
|
m_thermo = thermo;
|
||||||
|
|
||||||
int nsp = thermo->nSpecies();
|
size_t nsp = thermo->nSpecies();
|
||||||
m_Dij.resize(nsp, nsp, 0.0);
|
m_Dij.resize(nsp, nsp, 0.0);
|
||||||
m_Eij.resize(nsp, nsp, 0.0);
|
m_Eij.resize(nsp, nsp, 0.0);
|
||||||
/*
|
/*
|
||||||
|
|
@ -112,8 +112,8 @@ void LiquidTranInteraction::init(const XML_Node& compModelNode,
|
||||||
std::string speciesA;
|
std::string speciesA;
|
||||||
std::string speciesB;
|
std::string speciesB;
|
||||||
|
|
||||||
int num = compModelNode.nChildren();
|
size_t num = compModelNode.nChildren();
|
||||||
for (int iChild = 0; iChild < num; iChild++) {
|
for (size_t iChild = 0; iChild < num; iChild++) {
|
||||||
XML_Node& xmlChild = compModelNode.child(iChild);
|
XML_Node& xmlChild = compModelNode.child(iChild);
|
||||||
std::string nodeName = lowercase(xmlChild.name());
|
std::string nodeName = lowercase(xmlChild.name());
|
||||||
if (nodeName != "interaction") {
|
if (nodeName != "interaction") {
|
||||||
|
|
@ -122,12 +122,12 @@ void LiquidTranInteraction::init(const XML_Node& compModelNode,
|
||||||
}
|
}
|
||||||
speciesA = xmlChild.attrib("speciesA");
|
speciesA = xmlChild.attrib("speciesA");
|
||||||
speciesB = xmlChild.attrib("speciesB");
|
speciesB = xmlChild.attrib("speciesB");
|
||||||
int iSpecies = m_thermo->speciesIndex(speciesA);
|
size_t iSpecies = m_thermo->speciesIndex(speciesA);
|
||||||
if (iSpecies < 0) {
|
if (iSpecies < 0) {
|
||||||
throw CanteraError("TransportFactory::getLiquidInteractionsTransportData",
|
throw CanteraError("TransportFactory::getLiquidInteractionsTransportData",
|
||||||
"Unknown species " + speciesA);
|
"Unknown species " + speciesA);
|
||||||
}
|
}
|
||||||
int jSpecies = m_thermo->speciesIndex(speciesB);
|
size_t jSpecies = m_thermo->speciesIndex(speciesB);
|
||||||
if (jSpecies < 0) {
|
if (jSpecies < 0) {
|
||||||
throw CanteraError("TransportFactory::getLiquidInteractionsTransportData",
|
throw CanteraError("TransportFactory::getLiquidInteractionsTransportData",
|
||||||
"Unknown species " + speciesB);
|
"Unknown species " + speciesB);
|
||||||
|
|
@ -168,7 +168,7 @@ void LiquidTranInteraction::init(const XML_Node& compModelNode,
|
||||||
bTemp->resize(nsp, nsp, 0.0);
|
bTemp->resize(nsp, nsp, 0.0);
|
||||||
m_Bij.push_back(bTemp);
|
m_Bij.push_back(bTemp);
|
||||||
}
|
}
|
||||||
for (int i=0; i<(int)poly.size(); i++) {
|
for (size_t i=0; i<poly.size(); i++) {
|
||||||
(*m_Bij[i])(iSpecies,jSpecies) = poly[i];
|
(*m_Bij[i])(iSpecies,jSpecies) = poly[i];
|
||||||
//(*m_Bij[i])(jSpecies,iSpecies) = (*m_Bij[i])(iSpecies,jSpecies) ;
|
//(*m_Bij[i])(jSpecies,iSpecies) = (*m_Bij[i])(iSpecies,jSpecies) ;
|
||||||
}
|
}
|
||||||
|
|
@ -184,7 +184,7 @@ void LiquidTranInteraction::init(const XML_Node& compModelNode,
|
||||||
hTemp->resize(nsp, nsp, 0.0);
|
hTemp->resize(nsp, nsp, 0.0);
|
||||||
m_Hij.push_back(hTemp);
|
m_Hij.push_back(hTemp);
|
||||||
}
|
}
|
||||||
for (int i=0; i<(int)poly.size(); i++) {
|
for (size_t i=0; i<poly.size(); i++) {
|
||||||
(*m_Hij[i])(iSpecies,jSpecies) = poly[i];
|
(*m_Hij[i])(iSpecies,jSpecies) = poly[i];
|
||||||
(*m_Hij[i])(iSpecies,jSpecies) /= GasConstant;
|
(*m_Hij[i])(iSpecies,jSpecies) /= GasConstant;
|
||||||
//(*m_Hij[i])(jSpecies,iSpecies) = (*m_Hij[i])(iSpecies,jSpecies) ;
|
//(*m_Hij[i])(jSpecies,iSpecies) = (*m_Hij[i])(iSpecies,jSpecies) ;
|
||||||
|
|
@ -201,7 +201,7 @@ void LiquidTranInteraction::init(const XML_Node& compModelNode,
|
||||||
sTemp->resize(nsp, nsp, 0.0);
|
sTemp->resize(nsp, nsp, 0.0);
|
||||||
m_Sij.push_back(sTemp);
|
m_Sij.push_back(sTemp);
|
||||||
}
|
}
|
||||||
for (int i=0; i<(int)poly.size(); i++) {
|
for (size_t i=0; i<poly.size(); i++) {
|
||||||
(*m_Sij[i])(iSpecies,jSpecies) = poly[i];
|
(*m_Sij[i])(iSpecies,jSpecies) = poly[i];
|
||||||
(*m_Sij[i])(iSpecies,jSpecies) /= GasConstant;
|
(*m_Sij[i])(iSpecies,jSpecies) /= GasConstant;
|
||||||
//(*m_Sij[i])(jSpecies,iSpecies) = (*m_Sij[i])(iSpecies,jSpecies) ;
|
//(*m_Sij[i])(jSpecies,iSpecies) = (*m_Sij[i])(iSpecies,jSpecies) ;
|
||||||
|
|
@ -257,7 +257,7 @@ LTI_Solvent::LTI_Solvent(TransportPropertyType tp_ind) :
|
||||||
doublereal LTI_Solvent::getMixTransProp(doublereal* speciesValues, doublereal* speciesWeight)
|
doublereal LTI_Solvent::getMixTransProp(doublereal* speciesValues, doublereal* speciesWeight)
|
||||||
{
|
{
|
||||||
|
|
||||||
int nsp = m_thermo->nSpecies();
|
size_t nsp = m_thermo->nSpecies();
|
||||||
doublereal temp = m_thermo->temperature();
|
doublereal temp = m_thermo->temperature();
|
||||||
vector_fp molefracs(nsp);
|
vector_fp molefracs(nsp);
|
||||||
m_thermo->getMoleFractions(&molefracs[0]);
|
m_thermo->getMoleFractions(&molefracs[0]);
|
||||||
|
|
@ -266,7 +266,7 @@ doublereal LTI_Solvent::getMixTransProp(doublereal* speciesValues, doublereal* s
|
||||||
|
|
||||||
//if weightings are specified, use those
|
//if weightings are specified, use those
|
||||||
if (speciesWeight) {
|
if (speciesWeight) {
|
||||||
for (int k = 0; k < nsp; k++) {
|
for (size_t k = 0; k < nsp; k++) {
|
||||||
molefracs[k] = molefracs[k];
|
molefracs[k] = molefracs[k];
|
||||||
// should be: molefracs[k] = molefracs[k]*speciesWeight[k]; for consistency, but weight(solvent)=1?
|
// should be: molefracs[k] = molefracs[k]*speciesWeight[k]; for consistency, but weight(solvent)=1?
|
||||||
}
|
}
|
||||||
|
|
@ -281,7 +281,7 @@ doublereal LTI_Solvent::getMixTransProp(doublereal* speciesValues, doublereal* s
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < nsp; i++) {
|
for (size_t i = 0; i < nsp; i++) {
|
||||||
//presume that the weighting is set to 1.0 for solvent and 0.0 for everything else.
|
//presume that the weighting is set to 1.0 for solvent and 0.0 for everything else.
|
||||||
value += speciesValues[i] * speciesWeight[i];
|
value += speciesValues[i] * speciesWeight[i];
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
|
|
@ -289,12 +289,12 @@ doublereal LTI_Solvent::getMixTransProp(doublereal* speciesValues, doublereal* s
|
||||||
} else {
|
} else {
|
||||||
AssertTrace(speciesWeight[i] == 0.0);
|
AssertTrace(speciesWeight[i] == 0.0);
|
||||||
}
|
}
|
||||||
for (int j = 0; j < nsp; j++) {
|
for (size_t j = 0; j < nsp; j++) {
|
||||||
for (int k = 0; k < (int)m_Aij.size(); k++) {
|
for (size_t k = 0; k < m_Aij.size(); k++) {
|
||||||
value += molefracs[i]*molefracs[j]*(*m_Aij[k])(i,j)*pow(molefracs[i],k);
|
value += molefracs[i]*molefracs[j]*(*m_Aij[k])(i,j)*pow(molefracs[i], (int) k);
|
||||||
}
|
}
|
||||||
for (int k = 0; k < (int)m_Bij.size(); k++) {
|
for (size_t k = 0; k < m_Bij.size(); k++) {
|
||||||
value += molefracs[i]*molefracs[j]*(*m_Bij[k])(i,j)*temp*pow(molefracs[i],k);
|
value += molefracs[i]*molefracs[j]*(*m_Bij[k])(i,j)*temp*pow(molefracs[i], (int) k);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -305,27 +305,27 @@ doublereal LTI_Solvent::getMixTransProp(doublereal* speciesValues, doublereal* s
|
||||||
doublereal LTI_Solvent::getMixTransProp(std::vector<LTPspecies*> LTPptrs)
|
doublereal LTI_Solvent::getMixTransProp(std::vector<LTPspecies*> LTPptrs)
|
||||||
{
|
{
|
||||||
|
|
||||||
int nsp = m_thermo->nSpecies();
|
size_t nsp = m_thermo->nSpecies();
|
||||||
doublereal temp = m_thermo->temperature();
|
doublereal temp = m_thermo->temperature();
|
||||||
vector_fp molefracs(nsp);
|
vector_fp molefracs(nsp);
|
||||||
m_thermo->getMoleFractions(&molefracs[0]);
|
m_thermo->getMoleFractions(&molefracs[0]);
|
||||||
|
|
||||||
doublereal value = 0.0;
|
doublereal value = 0.0;
|
||||||
|
|
||||||
for (int k = 0; k < nsp; k++) {
|
for (size_t k = 0; k < nsp; k++) {
|
||||||
molefracs[k] = molefracs[k];
|
molefracs[k] = molefracs[k];
|
||||||
// should be: molefracs[k] = molefracs[k]*LTPptrs[k]->getMixWeight(); for consistency, but weight(solvent)=1?
|
// should be: molefracs[k] = molefracs[k]*LTPptrs[k]->getMixWeight(); for consistency, but weight(solvent)=1?
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < nsp; i++) {
|
for (size_t i = 0; i < nsp; i++) {
|
||||||
//presume that the weighting is set to 1.0 for solvent and 0.0 for everything else.
|
//presume that the weighting is set to 1.0 for solvent and 0.0 for everything else.
|
||||||
value += LTPptrs[i]->getSpeciesTransProp() * LTPptrs[i]->getMixWeight();
|
value += LTPptrs[i]->getSpeciesTransProp() * LTPptrs[i]->getMixWeight();
|
||||||
for (int j = 0; j < nsp; j++) {
|
for (size_t j = 0; j < nsp; j++) {
|
||||||
for (int k = 0; k < (int)m_Aij.size(); k++) {
|
for (size_t k = 0; k < m_Aij.size(); k++) {
|
||||||
value += molefracs[i]*molefracs[j]*(*m_Aij[k])(i,j)*pow(molefracs[i],k);
|
value += molefracs[i]*molefracs[j]*(*m_Aij[k])(i,j)*pow(molefracs[i], (int) k);
|
||||||
}
|
}
|
||||||
for (int k = 0; k < (int)m_Bij.size(); k++) {
|
for (size_t k = 0; k < m_Bij.size(); k++) {
|
||||||
value += molefracs[i]*molefracs[j]*(*m_Bij[k])(i,j)*temp*pow(molefracs[i],k);
|
value += molefracs[i]*molefracs[j]*(*m_Bij[k])(i,j)*temp*pow(molefracs[i], (int) k);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -343,7 +343,7 @@ void LTI_Solvent::getMatrixTransProp(DenseMatrix& mat, doublereal* speciesValues
|
||||||
doublereal LTI_MoleFracs::getMixTransProp(doublereal* speciesValues, doublereal* speciesWeight)
|
doublereal LTI_MoleFracs::getMixTransProp(doublereal* speciesValues, doublereal* speciesWeight)
|
||||||
{
|
{
|
||||||
|
|
||||||
int nsp = m_thermo->nSpecies();
|
size_t nsp = m_thermo->nSpecies();
|
||||||
doublereal temp = m_thermo->temperature();
|
doublereal temp = m_thermo->temperature();
|
||||||
vector_fp molefracs(nsp);
|
vector_fp molefracs(nsp);
|
||||||
m_thermo->getMoleFractions(&molefracs[0]);
|
m_thermo->getMoleFractions(&molefracs[0]);
|
||||||
|
|
@ -359,14 +359,14 @@ doublereal LTI_MoleFracs::getMixTransProp(doublereal* speciesValues, doublereal*
|
||||||
throw CanteraError("LTI_MoleFracs::getMixTransProp","You should be specifying the speciesWeight");
|
throw CanteraError("LTI_MoleFracs::getMixTransProp","You should be specifying the speciesWeight");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < nsp; i++) {
|
for (size_t i = 0; i < nsp; i++) {
|
||||||
value += speciesValues[i] * molefracs[i];
|
value += speciesValues[i] * molefracs[i];
|
||||||
for (int j = 0; j < nsp; j++) {
|
for (size_t j = 0; j < nsp; j++) {
|
||||||
for (int k = 0; k < (int)m_Aij.size(); k++) {
|
for (size_t k = 0; k < m_Aij.size(); k++) {
|
||||||
value += molefracs[i]*molefracs[j]*(*m_Aij[k])(i,j)*pow(molefracs[i],k);
|
value += molefracs[i]*molefracs[j]*(*m_Aij[k])(i,j)*pow(molefracs[i], (int) k);
|
||||||
}
|
}
|
||||||
for (int k = 0; k < (int)m_Bij.size(); k++) {
|
for (size_t k = 0; k < m_Bij.size(); k++) {
|
||||||
value += molefracs[i]*molefracs[j]*(*m_Bij[k])(i,j)*temp*pow(molefracs[i],k);
|
value += molefracs[i]*molefracs[j]*(*m_Bij[k])(i,j)*temp*pow(molefracs[i], (int) k);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -378,25 +378,25 @@ doublereal LTI_MoleFracs::getMixTransProp(doublereal* speciesValues, doublereal*
|
||||||
doublereal LTI_MoleFracs::getMixTransProp(std::vector<LTPspecies*> LTPptrs)
|
doublereal LTI_MoleFracs::getMixTransProp(std::vector<LTPspecies*> LTPptrs)
|
||||||
{
|
{
|
||||||
|
|
||||||
int nsp = m_thermo->nSpecies();
|
size_t nsp = m_thermo->nSpecies();
|
||||||
doublereal temp = m_thermo->temperature();
|
doublereal temp = m_thermo->temperature();
|
||||||
vector_fp molefracs(nsp);
|
vector_fp molefracs(nsp);
|
||||||
m_thermo->getMoleFractions(&molefracs[0]);
|
m_thermo->getMoleFractions(&molefracs[0]);
|
||||||
|
|
||||||
doublereal value = 0;
|
doublereal value = 0;
|
||||||
|
|
||||||
for (int k = 0; k < nsp; k++) {
|
for (size_t k = 0; k < nsp; k++) {
|
||||||
molefracs[k] = molefracs[k]*LTPptrs[k]->getMixWeight();
|
molefracs[k] = molefracs[k]*LTPptrs[k]->getMixWeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < nsp; i++) {
|
for (size_t i = 0; i < nsp; i++) {
|
||||||
value += LTPptrs[i]->getSpeciesTransProp() * molefracs[i];
|
value += LTPptrs[i]->getSpeciesTransProp() * molefracs[i];
|
||||||
for (int j = 0; j < nsp; j++) {
|
for (size_t j = 0; j < nsp; j++) {
|
||||||
for (int k = 0; k < (int)m_Aij.size(); k++) {
|
for (size_t k = 0; k < m_Aij.size(); k++) {
|
||||||
value += molefracs[i]*molefracs[j]*(*m_Aij[k])(i,j)*pow(molefracs[i],k);
|
value += molefracs[i]*molefracs[j]*(*m_Aij[k])(i,j)*pow(molefracs[i], (int) k);
|
||||||
}
|
}
|
||||||
for (int k = 0; k < (int)m_Bij.size(); k++) {
|
for (size_t k = 0; k < m_Bij.size(); k++) {
|
||||||
value += molefracs[i]*molefracs[j]*(*m_Bij[k])(i,j)*temp*pow(molefracs[i],k);
|
value += molefracs[i]*molefracs[j]*(*m_Bij[k])(i,j)*temp*pow(molefracs[i], (int) k);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -407,7 +407,7 @@ doublereal LTI_MoleFracs::getMixTransProp(std::vector<LTPspecies*> LTPptrs)
|
||||||
doublereal LTI_MassFracs::getMixTransProp(doublereal* speciesValues, doublereal* speciesWeight)
|
doublereal LTI_MassFracs::getMixTransProp(doublereal* speciesValues, doublereal* speciesWeight)
|
||||||
{
|
{
|
||||||
|
|
||||||
int nsp = m_thermo->nSpecies();
|
size_t nsp = m_thermo->nSpecies();
|
||||||
doublereal temp = m_thermo->temperature();
|
doublereal temp = m_thermo->temperature();
|
||||||
vector_fp massfracs(nsp);
|
vector_fp massfracs(nsp);
|
||||||
m_thermo->getMassFractions(&massfracs[0]);
|
m_thermo->getMassFractions(&massfracs[0]);
|
||||||
|
|
@ -416,21 +416,21 @@ doublereal LTI_MassFracs::getMixTransProp(doublereal* speciesValues, doublereal*
|
||||||
|
|
||||||
//if weightings are specified, use those
|
//if weightings are specified, use those
|
||||||
if (speciesWeight) {
|
if (speciesWeight) {
|
||||||
for (int k = 0; k < nsp; k++) {
|
for (size_t k = 0; k < nsp; k++) {
|
||||||
massfracs[k] = massfracs[k]*speciesWeight[k];
|
massfracs[k] = massfracs[k]*speciesWeight[k];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw CanteraError("LTI_MassFracs::getMixTransProp","You should be specifying the speciesWeight");
|
throw CanteraError("LTI_MassFracs::getMixTransProp","You should be specifying the speciesWeight");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < nsp; i++) {
|
for (size_t i = 0; i < nsp; i++) {
|
||||||
value += speciesValues[i] * massfracs[i];
|
value += speciesValues[i] * massfracs[i];
|
||||||
for (int j = 0; j < nsp; j++) {
|
for (size_t j = 0; j < nsp; j++) {
|
||||||
for (int k = 0; k < (int)m_Aij.size(); k++) {
|
for (size_t k = 0; k < m_Aij.size(); k++) {
|
||||||
value += massfracs[i]*massfracs[j]*(*m_Aij[k])(i,j)*pow(massfracs[i],k);
|
value += massfracs[i]*massfracs[j]*(*m_Aij[k])(i,j)*pow(massfracs[i], (int) k);
|
||||||
}
|
}
|
||||||
for (int k = 0; k < (int)m_Bij.size(); k++) {
|
for (size_t k = 0; k < m_Bij.size(); k++) {
|
||||||
value += massfracs[i]*massfracs[j]*(*m_Bij[k])(i,j)*temp*pow(massfracs[i],k);
|
value += massfracs[i]*massfracs[j]*(*m_Bij[k])(i,j)*temp*pow(massfracs[i], (int) k);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -442,25 +442,25 @@ doublereal LTI_MassFracs::getMixTransProp(doublereal* speciesValues, doublereal*
|
||||||
doublereal LTI_MassFracs::getMixTransProp(std::vector<LTPspecies*> LTPptrs)
|
doublereal LTI_MassFracs::getMixTransProp(std::vector<LTPspecies*> LTPptrs)
|
||||||
{
|
{
|
||||||
|
|
||||||
int nsp = m_thermo->nSpecies();
|
size_t nsp = m_thermo->nSpecies();
|
||||||
doublereal temp = m_thermo->temperature();
|
doublereal temp = m_thermo->temperature();
|
||||||
vector_fp massfracs(nsp);
|
vector_fp massfracs(nsp);
|
||||||
m_thermo->getMassFractions(&massfracs[0]);
|
m_thermo->getMassFractions(&massfracs[0]);
|
||||||
|
|
||||||
doublereal value = 0;
|
doublereal value = 0;
|
||||||
|
|
||||||
for (int k = 0; k < nsp; k++) {
|
for (size_t k = 0; k < nsp; k++) {
|
||||||
massfracs[k] = massfracs[k]*LTPptrs[k]->getMixWeight();
|
massfracs[k] = massfracs[k]*LTPptrs[k]->getMixWeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < nsp; i++) {
|
for (size_t i = 0; i < nsp; i++) {
|
||||||
value += LTPptrs[i]->getSpeciesTransProp() * massfracs[i];
|
value += LTPptrs[i]->getSpeciesTransProp() * massfracs[i];
|
||||||
for (int j = 0; j < nsp; j++) {
|
for (size_t j = 0; j < nsp; j++) {
|
||||||
for (int k = 0; k < (int)m_Aij.size(); k++) {
|
for (size_t k = 0; k < m_Aij.size(); k++) {
|
||||||
value += massfracs[i]*massfracs[j]*(*m_Aij[k])(i,j)*pow(massfracs[i],k);
|
value += massfracs[i]*massfracs[j]*(*m_Aij[k])(i,j)*pow(massfracs[i], (int) k);
|
||||||
}
|
}
|
||||||
for (int k = 0; k < (int)m_Bij.size(); k++) {
|
for (size_t k = 0; k < m_Bij.size(); k++) {
|
||||||
value += massfracs[i]*massfracs[j]*(*m_Bij[k])(i,j)*temp*pow(massfracs[i],k);
|
value += massfracs[i]*massfracs[j]*(*m_Bij[k])(i,j)*temp*pow(massfracs[i], (int) k);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -474,7 +474,7 @@ doublereal LTI_MassFracs::getMixTransProp(std::vector<LTPspecies*> LTPptrs)
|
||||||
doublereal LTI_Log_MoleFracs::getMixTransProp(doublereal* speciesValues, doublereal* speciesWeight)
|
doublereal LTI_Log_MoleFracs::getMixTransProp(doublereal* speciesValues, doublereal* speciesWeight)
|
||||||
{
|
{
|
||||||
|
|
||||||
int nsp = m_thermo->nSpecies();
|
size_t nsp = m_thermo->nSpecies();
|
||||||
doublereal temp = m_thermo->temperature();
|
doublereal temp = m_thermo->temperature();
|
||||||
vector_fp molefracs(nsp);
|
vector_fp molefracs(nsp);
|
||||||
m_thermo->getMoleFractions(&molefracs[0]);
|
m_thermo->getMoleFractions(&molefracs[0]);
|
||||||
|
|
@ -485,22 +485,22 @@ doublereal LTI_Log_MoleFracs::getMixTransProp(doublereal* speciesValues, doubler
|
||||||
|
|
||||||
//if weightings are specified, use those
|
//if weightings are specified, use those
|
||||||
if (speciesWeight) {
|
if (speciesWeight) {
|
||||||
for (int k = 0; k < nsp; k++) {
|
for (size_t k = 0; k < nsp; k++) {
|
||||||
molefracs[k] = molefracs[k]*speciesWeight[k];
|
molefracs[k] = molefracs[k]*speciesWeight[k];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw CanteraError("LTI_Log_MoleFracs::getMixTransProp","You probably should have a speciesWeight when you call getMixTransProp to convert ion mole fractions to molecular mole fractions");
|
throw CanteraError("LTI_Log_MoleFracs::getMixTransProp","You probably should have a speciesWeight when you call getMixTransProp to convert ion mole fractions to molecular mole fractions");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < nsp; i++) {
|
for (size_t i = 0; i < nsp; i++) {
|
||||||
value += log(speciesValues[i]) * molefracs[i];
|
value += log(speciesValues[i]) * molefracs[i];
|
||||||
for (int j = 0; j < nsp; j++) {
|
for (size_t j = 0; j < nsp; j++) {
|
||||||
for (int k = 0; k < (int)m_Hij.size(); k++) {
|
for (size_t k = 0; k < m_Hij.size(); k++) {
|
||||||
value += molefracs[i]*molefracs[j]*(*m_Hij[k])(i,j)/temp*pow(molefracs[i],k);
|
value += molefracs[i]*molefracs[j]*(*m_Hij[k])(i,j)/temp*pow(molefracs[i], (int) k);
|
||||||
//cout << "value = " << value << ", m_Sij = " << (*m_Sij[k])(i,j) << ", m_Hij = " << (*m_Hij[k])(i,j) << endl;
|
//cout << "value = " << value << ", m_Sij = " << (*m_Sij[k])(i,j) << ", m_Hij = " << (*m_Hij[k])(i,j) << endl;
|
||||||
}
|
}
|
||||||
for (int k = 0; k < (int)m_Sij.size(); k++) {
|
for (size_t k = 0; k < m_Sij.size(); k++) {
|
||||||
value -= molefracs[i]*molefracs[j]*(*m_Sij[k])(i,j)*pow(molefracs[i],k);
|
value -= molefracs[i]*molefracs[j]*(*m_Sij[k])(i,j)*pow(molefracs[i], (int) k);
|
||||||
//cout << "value = " << value << ", m_Sij = " << (*m_Sij[k])(i,j) << ", m_Hij = " << (*m_Hij[k])(i,j) << endl;
|
//cout << "value = " << value << ", m_Sij = " << (*m_Sij[k])(i,j) << ", m_Hij = " << (*m_Hij[k])(i,j) << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -514,7 +514,7 @@ doublereal LTI_Log_MoleFracs::getMixTransProp(doublereal* speciesValues, doubler
|
||||||
doublereal LTI_Log_MoleFracs::getMixTransProp(std::vector<LTPspecies*> LTPptrs)
|
doublereal LTI_Log_MoleFracs::getMixTransProp(std::vector<LTPspecies*> LTPptrs)
|
||||||
{
|
{
|
||||||
|
|
||||||
int nsp = m_thermo->nSpecies();
|
size_t nsp = m_thermo->nSpecies();
|
||||||
doublereal temp = m_thermo->temperature();
|
doublereal temp = m_thermo->temperature();
|
||||||
vector_fp molefracs(nsp);
|
vector_fp molefracs(nsp);
|
||||||
m_thermo->getMoleFractions(&molefracs[0]);
|
m_thermo->getMoleFractions(&molefracs[0]);
|
||||||
|
|
@ -524,20 +524,20 @@ doublereal LTI_Log_MoleFracs::getMixTransProp(std::vector<LTPspecies*> LTPptrs)
|
||||||
|
|
||||||
//if weightings are specified, use those
|
//if weightings are specified, use those
|
||||||
|
|
||||||
for (int k = 0; k < nsp; k++) {
|
for (size_t k = 0; k < nsp; k++) {
|
||||||
molefracs[k] = molefracs[k]*LTPptrs[k]->getMixWeight();
|
molefracs[k] = molefracs[k]*LTPptrs[k]->getMixWeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < nsp; i++) {
|
for (size_t i = 0; i < nsp; i++) {
|
||||||
value += log(LTPptrs[i]->getSpeciesTransProp()) * molefracs[i];
|
value += log(LTPptrs[i]->getSpeciesTransProp()) * molefracs[i];
|
||||||
for (int j = 0; j < nsp; j++) {
|
for (size_t j = 0; j < nsp; j++) {
|
||||||
for (int k = 0; k < (int)m_Hij.size(); k++) {
|
for (size_t k = 0; k < m_Hij.size(); k++) {
|
||||||
value += molefracs[i]*molefracs[j]*(*m_Hij[k])(i,j)/temp*pow(molefracs[i],k);
|
value += molefracs[i]*molefracs[j]*(*m_Hij[k])(i,j)/temp*pow(molefracs[i], (int) k);
|
||||||
//cout << "1 = " << molefracs[i]+molefracs[j] << endl;
|
//cout << "1 = " << molefracs[i]+molefracs[j] << endl;
|
||||||
//cout << "value = " << value << ", m_Sij = " << (*m_Sij[k])(i,j) << ", m_Hij = " << (*m_Hij[k])(i,j) << endl;
|
//cout << "value = " << value << ", m_Sij = " << (*m_Sij[k])(i,j) << ", m_Hij = " << (*m_Hij[k])(i,j) << endl;
|
||||||
}
|
}
|
||||||
for (int k = 0; k < (int)m_Sij.size(); k++) {
|
for (size_t k = 0; k < m_Sij.size(); k++) {
|
||||||
value -= molefracs[i]*molefracs[j]*(*m_Sij[k])(i,j)*pow(molefracs[i],k);
|
value -= molefracs[i]*molefracs[j]*(*m_Sij[k])(i,j)*pow(molefracs[i], (int) k);
|
||||||
//cout << "1 = " << molefracs[i]+molefracs[j] << endl;
|
//cout << "1 = " << molefracs[i]+molefracs[j] << endl;
|
||||||
//cout << "value = " << value << ", m_Sij = " << (*m_Sij[k])(i,j) << ", m_Hij = " << (*m_Hij[k])(i,j) << endl;
|
//cout << "value = " << value << ", m_Sij = " << (*m_Sij[k])(i,j) << ", m_Hij = " << (*m_Hij[k])(i,j) << endl;
|
||||||
}
|
}
|
||||||
|
|
@ -557,10 +557,10 @@ doublereal LTI_Log_MoleFracs::getMixTransProp(std::vector<LTPspecies*> LTPptrs)
|
||||||
|
|
||||||
void LTI_Pairwise_Interaction::setParameters(LiquidTransportParams& trParam)
|
void LTI_Pairwise_Interaction::setParameters(LiquidTransportParams& trParam)
|
||||||
{
|
{
|
||||||
int nsp = m_thermo->nSpecies();
|
size_t nsp = m_thermo->nSpecies();
|
||||||
m_diagonals.resize(nsp, 0);
|
m_diagonals.resize(nsp, 0);
|
||||||
|
|
||||||
for (int k = 0; k < nsp; k++) {
|
for (size_t k = 0; k < nsp; k++) {
|
||||||
Cantera::LiquidTransportData& ltd = trParam.LTData[k];
|
Cantera::LiquidTransportData& ltd = trParam.LTData[k];
|
||||||
if (ltd.speciesDiffusivity) {
|
if (ltd.speciesDiffusivity) {
|
||||||
m_diagonals[k] = ltd.speciesDiffusivity;
|
m_diagonals[k] = ltd.speciesDiffusivity;
|
||||||
|
|
@ -571,7 +571,7 @@ void LTI_Pairwise_Interaction::setParameters(LiquidTransportParams& trParam)
|
||||||
doublereal LTI_Pairwise_Interaction::getMixTransProp(doublereal* speciesValues, doublereal* speciesWeight)
|
doublereal LTI_Pairwise_Interaction::getMixTransProp(doublereal* speciesValues, doublereal* speciesWeight)
|
||||||
{
|
{
|
||||||
|
|
||||||
int nsp = m_thermo->nSpecies();
|
size_t nsp = m_thermo->nSpecies();
|
||||||
vector_fp molefracs(nsp);
|
vector_fp molefracs(nsp);
|
||||||
m_thermo->getMoleFractions(&molefracs[0]);
|
m_thermo->getMoleFractions(&molefracs[0]);
|
||||||
|
|
||||||
|
|
@ -586,7 +586,7 @@ doublereal LTI_Pairwise_Interaction::getMixTransProp(doublereal* speciesValues,
|
||||||
doublereal LTI_Pairwise_Interaction::getMixTransProp(std::vector<LTPspecies*> LTPptrs)
|
doublereal LTI_Pairwise_Interaction::getMixTransProp(std::vector<LTPspecies*> LTPptrs)
|
||||||
{
|
{
|
||||||
|
|
||||||
int nsp = m_thermo->nSpecies();
|
size_t nsp = m_thermo->nSpecies();
|
||||||
vector_fp molefracs(nsp);
|
vector_fp molefracs(nsp);
|
||||||
m_thermo->getMoleFractions(&molefracs[0]);
|
m_thermo->getMoleFractions(&molefracs[0]);
|
||||||
|
|
||||||
|
|
@ -600,18 +600,18 @@ doublereal LTI_Pairwise_Interaction::getMixTransProp(std::vector<LTPspecies*> LT
|
||||||
void LTI_Pairwise_Interaction::getMatrixTransProp(DenseMatrix& mat, doublereal* speciesValues)
|
void LTI_Pairwise_Interaction::getMatrixTransProp(DenseMatrix& mat, doublereal* speciesValues)
|
||||||
{
|
{
|
||||||
|
|
||||||
int nsp = m_thermo->nSpecies();
|
size_t nsp = m_thermo->nSpecies();
|
||||||
doublereal temp = m_thermo->temperature();
|
doublereal temp = m_thermo->temperature();
|
||||||
vector_fp molefracs(nsp);
|
vector_fp molefracs(nsp);
|
||||||
m_thermo->getMoleFractions(&molefracs[0]);
|
m_thermo->getMoleFractions(&molefracs[0]);
|
||||||
|
|
||||||
mat.resize(nsp, nsp, 0.0);
|
mat.resize(nsp, nsp, 0.0);
|
||||||
for (int i = 0; i < nsp; i++)
|
for (size_t i = 0; i < nsp; i++)
|
||||||
for (int j = 0; j < i; j++) {
|
for (size_t j = 0; j < i; j++) {
|
||||||
mat(i,j) = mat(j,i) = exp(m_Eij(i,j) / temp) / m_Dij(i,j);
|
mat(i,j) = mat(j,i) = exp(m_Eij(i,j) / temp) / m_Dij(i,j);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < nsp; i++)
|
for (size_t i = 0; i < nsp; i++)
|
||||||
if (mat(i,i) == 0.0 && m_diagonals[i]) {
|
if (mat(i,i) == 0.0 && m_diagonals[i]) {
|
||||||
mat(i,i) = 1.0 / m_diagonals[i]->getSpeciesTransProp() ;
|
mat(i,i) = 1.0 / m_diagonals[i]->getSpeciesTransProp() ;
|
||||||
}
|
}
|
||||||
|
|
@ -620,8 +620,8 @@ void LTI_Pairwise_Interaction::getMatrixTransProp(DenseMatrix& mat, doublereal*
|
||||||
|
|
||||||
void LTI_StefanMaxwell_PPN::setParameters(LiquidTransportParams& trParam)
|
void LTI_StefanMaxwell_PPN::setParameters(LiquidTransportParams& trParam)
|
||||||
{
|
{
|
||||||
int nsp = m_thermo->nSpecies();
|
size_t nsp = m_thermo->nSpecies();
|
||||||
int nsp2 = nsp*nsp;
|
size_t nsp2 = nsp*nsp;
|
||||||
//vector<std
|
//vector<std
|
||||||
|
|
||||||
m_ionCondMix = 0;
|
m_ionCondMix = 0;
|
||||||
|
|
@ -635,26 +635,26 @@ void LTI_StefanMaxwell_PPN::setParameters(LiquidTransportParams& trParam)
|
||||||
m_selfDiffMixModel.resize(nsp);
|
m_selfDiffMixModel.resize(nsp);
|
||||||
m_selfDiffSpecies.resize(nsp);
|
m_selfDiffSpecies.resize(nsp);
|
||||||
|
|
||||||
for (int k = 0; k < nsp2; k++) {
|
for (size_t k = 0; k < nsp2; k++) {
|
||||||
m_mobRatMixModel[k] = trParam.mobilityRatio[k];
|
m_mobRatMixModel[k] = trParam.mobilityRatio[k];
|
||||||
//trParam.mobilityRatio[k] = 0;
|
//trParam.mobilityRatio[k] = 0;
|
||||||
m_mobRatSpecies[k].resize(nsp,0);
|
m_mobRatSpecies[k].resize(nsp,0);
|
||||||
}
|
}
|
||||||
for (int k = 0; k < nsp; k++) {
|
for (size_t k = 0; k < nsp; k++) {
|
||||||
m_selfDiffMixModel[k] = trParam.selfDiffusion[k];
|
m_selfDiffMixModel[k] = trParam.selfDiffusion[k];
|
||||||
//trParam.selfDiffusion[k] = 0;
|
//trParam.selfDiffusion[k] = 0;
|
||||||
m_selfDiffSpecies[k].resize(nsp,0);
|
m_selfDiffSpecies[k].resize(nsp,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int k = 0; k < nsp; k++) {
|
for (size_t k = 0; k < nsp; k++) {
|
||||||
Cantera::LiquidTransportData& ltd = trParam.LTData[k];
|
Cantera::LiquidTransportData& ltd = trParam.LTData[k];
|
||||||
m_ionCondSpecies[k] = ltd.ionConductivity;
|
m_ionCondSpecies[k] = ltd.ionConductivity;
|
||||||
//ltd.ionConductivity = 0;
|
//ltd.ionConductivity = 0;
|
||||||
for (int j = 0; j < nsp2; j++) {
|
for (size_t j = 0; j < nsp2; j++) {
|
||||||
m_mobRatSpecies[j][k] = ltd.mobilityRatio[j];
|
m_mobRatSpecies[j][k] = ltd.mobilityRatio[j];
|
||||||
//ltd.mobilityRatio[j] = 0;
|
//ltd.mobilityRatio[j] = 0;
|
||||||
}
|
}
|
||||||
for (int j = 0; j < nsp; j++) {
|
for (size_t j = 0; j < nsp; j++) {
|
||||||
m_selfDiffSpecies[j][k] = ltd.selfDiffusion[j];
|
m_selfDiffSpecies[j][k] = ltd.selfDiffusion[j];
|
||||||
//ltd.selfDiffusion[j] = 0;
|
//ltd.selfDiffusion[j] = 0;
|
||||||
}
|
}
|
||||||
|
|
@ -664,7 +664,7 @@ void LTI_StefanMaxwell_PPN::setParameters(LiquidTransportParams& trParam)
|
||||||
doublereal LTI_StefanMaxwell_PPN::getMixTransProp(doublereal* speciesValues, doublereal* speciesWeight)
|
doublereal LTI_StefanMaxwell_PPN::getMixTransProp(doublereal* speciesValues, doublereal* speciesWeight)
|
||||||
{
|
{
|
||||||
|
|
||||||
int nsp = m_thermo->nSpecies();
|
size_t nsp = m_thermo->nSpecies();
|
||||||
vector_fp molefracs(nsp);
|
vector_fp molefracs(nsp);
|
||||||
m_thermo->getMoleFractions(&molefracs[0]);
|
m_thermo->getMoleFractions(&molefracs[0]);
|
||||||
|
|
||||||
|
|
@ -679,7 +679,7 @@ doublereal LTI_StefanMaxwell_PPN::getMixTransProp(doublereal* speciesValues, dou
|
||||||
doublereal LTI_StefanMaxwell_PPN::getMixTransProp(std::vector<LTPspecies*> LTPptrs)
|
doublereal LTI_StefanMaxwell_PPN::getMixTransProp(std::vector<LTPspecies*> LTPptrs)
|
||||||
{
|
{
|
||||||
|
|
||||||
int nsp = m_thermo->nSpecies();
|
size_t nsp = m_thermo->nSpecies();
|
||||||
vector_fp molefracs(nsp);
|
vector_fp molefracs(nsp);
|
||||||
m_thermo->getMoleFractions(&molefracs[0]);
|
m_thermo->getMoleFractions(&molefracs[0]);
|
||||||
|
|
||||||
|
|
@ -695,8 +695,7 @@ void LTI_StefanMaxwell_PPN::getMatrixTransProp(DenseMatrix& mat, doublereal* spe
|
||||||
//CAL
|
//CAL
|
||||||
|
|
||||||
IonsFromNeutralVPSSTP* ions_thermo = dynamic_cast<IonsFromNeutralVPSSTP*>(m_thermo);
|
IonsFromNeutralVPSSTP* ions_thermo = dynamic_cast<IonsFromNeutralVPSSTP*>(m_thermo);
|
||||||
int i, j, k;
|
size_t nsp = m_thermo->nSpecies();
|
||||||
int nsp = m_thermo->nSpecies();
|
|
||||||
if (nsp != 3) {
|
if (nsp != 3) {
|
||||||
throw CanteraError("LTI_StefanMaxwell_PPN::getMatrixTransProp","Function may only be called with a 3-ion system");
|
throw CanteraError("LTI_StefanMaxwell_PPN::getMatrixTransProp","Function may only be called with a 3-ion system");
|
||||||
}
|
}
|
||||||
|
|
@ -716,10 +715,10 @@ void LTI_StefanMaxwell_PPN::getMatrixTransProp(DenseMatrix& mat, doublereal* spe
|
||||||
std::vector<size_t> neutMolIndex(3);
|
std::vector<size_t> neutMolIndex(3);
|
||||||
ions_thermo->getDissociationCoeffs(viS,charges,neutMolIndex);
|
ions_thermo->getDissociationCoeffs(viS,charges,neutMolIndex);
|
||||||
|
|
||||||
if ((int)anion.size() != 1) {
|
if (anion.size() != 1) {
|
||||||
throw CanteraError("LTI_StefanMaxwell_PPN::getMatrixTransProp","Must have one anion only for StefanMaxwell_PPN");
|
throw CanteraError("LTI_StefanMaxwell_PPN::getMatrixTransProp","Must have one anion only for StefanMaxwell_PPN");
|
||||||
}
|
}
|
||||||
if ((int)cation.size() != 2) {
|
if (cation.size() != 2) {
|
||||||
throw CanteraError("LTI_StefanMaxwell_PPN::getMatrixTransProp","Must have two cations of equal charge for StefanMaxwell_PPN");
|
throw CanteraError("LTI_StefanMaxwell_PPN::getMatrixTransProp","Must have two cations of equal charge for StefanMaxwell_PPN");
|
||||||
}
|
}
|
||||||
if (charges[cation[0]] != charges[cation[1]]) {
|
if (charges[cation[0]] != charges[cation[1]]) {
|
||||||
|
|
@ -731,9 +730,9 @@ void LTI_StefanMaxwell_PPN::getMatrixTransProp(DenseMatrix& mat, doublereal* spe
|
||||||
MargulesVPSSTP* marg_thermo = dynamic_cast<MargulesVPSSTP*>(ions_thermo->neutralMoleculePhase_);
|
MargulesVPSSTP* marg_thermo = dynamic_cast<MargulesVPSSTP*>(ions_thermo->neutralMoleculePhase_);
|
||||||
doublereal vol = m_thermo->molarVolume();
|
doublereal vol = m_thermo->molarVolume();
|
||||||
|
|
||||||
k = 0;
|
size_t k = 0;
|
||||||
for (j = 0; j < nsp; j++) {
|
for (size_t j = 0; j < nsp; j++) {
|
||||||
for (i = 0; i < nsp; i++) {
|
for (size_t i = 0; i < nsp; i++) {
|
||||||
if (m_mobRatMixModel[k]) {
|
if (m_mobRatMixModel[k]) {
|
||||||
m_mobRatMix(i,j) = m_mobRatMixModel[k]->getMixTransProp(m_mobRatSpecies[k]);
|
m_mobRatMix(i,j) = m_mobRatMixModel[k]->getMixTransProp(m_mobRatSpecies[k]);
|
||||||
if (m_mobRatMix(i,j) > 0.0) {
|
if (m_mobRatMix(i,j) > 0.0) {
|
||||||
|
|
@ -749,6 +748,7 @@ void LTI_StefanMaxwell_PPN::getMatrixTransProp(DenseMatrix& mat, doublereal* spe
|
||||||
m_selfDiffMix[k] = m_selfDiffMixModel[k]->getMixTransProp(m_selfDiffSpecies[k]);
|
m_selfDiffMix[k] = m_selfDiffMixModel[k]->getMixTransProp(m_selfDiffSpecies[k]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! @todo Suspicious implicit conversion from double to int.
|
||||||
int vP = max(viS[cation[0]],viS[cation[1]]);
|
int vP = max(viS[cation[0]],viS[cation[1]]);
|
||||||
int vM = viS[anion[0]];
|
int vM = viS[anion[0]];
|
||||||
int zP = charges[cation[0]];
|
int zP = charges[cation[0]];
|
||||||
|
|
@ -775,7 +775,7 @@ void LTI_StefanMaxwell_PPN::getMatrixTransProp(DenseMatrix& mat, doublereal* spe
|
||||||
doublereal LTI_StokesEinstein::getMixTransProp(doublereal* speciesValues, doublereal* speciesWeight)
|
doublereal LTI_StokesEinstein::getMixTransProp(doublereal* speciesValues, doublereal* speciesWeight)
|
||||||
{
|
{
|
||||||
|
|
||||||
int nsp = m_thermo->nSpecies();
|
size_t nsp = m_thermo->nSpecies();
|
||||||
vector_fp molefracs(nsp);
|
vector_fp molefracs(nsp);
|
||||||
m_thermo->getMoleFractions(&molefracs[0]);
|
m_thermo->getMoleFractions(&molefracs[0]);
|
||||||
|
|
||||||
|
|
@ -790,7 +790,7 @@ doublereal LTI_StokesEinstein::getMixTransProp(doublereal* speciesValues, double
|
||||||
doublereal LTI_StokesEinstein::getMixTransProp(std::vector<LTPspecies*> LTPptrs)
|
doublereal LTI_StokesEinstein::getMixTransProp(std::vector<LTPspecies*> LTPptrs)
|
||||||
{
|
{
|
||||||
|
|
||||||
int nsp = m_thermo->nSpecies();
|
size_t nsp = m_thermo->nSpecies();
|
||||||
vector_fp molefracs(nsp);
|
vector_fp molefracs(nsp);
|
||||||
m_thermo->getMoleFractions(&molefracs[0]);
|
m_thermo->getMoleFractions(&molefracs[0]);
|
||||||
|
|
||||||
|
|
@ -805,10 +805,10 @@ doublereal LTI_StokesEinstein::getMixTransProp(std::vector<LTPspecies*> LTPptrs)
|
||||||
|
|
||||||
void LTI_StokesEinstein::setParameters(LiquidTransportParams& trParam)
|
void LTI_StokesEinstein::setParameters(LiquidTransportParams& trParam)
|
||||||
{
|
{
|
||||||
int nsp = m_thermo->nSpecies();
|
size_t nsp = m_thermo->nSpecies();
|
||||||
m_viscosity.resize(nsp, 0);
|
m_viscosity.resize(nsp, 0);
|
||||||
m_hydroRadius.resize(nsp, 0);
|
m_hydroRadius.resize(nsp, 0);
|
||||||
for (int k = 0; k < nsp; k++) {
|
for (size_t k = 0; k < nsp; k++) {
|
||||||
Cantera::LiquidTransportData& ltd = trParam.LTData[k];
|
Cantera::LiquidTransportData& ltd = trParam.LTData[k];
|
||||||
m_viscosity[k] = ltd.viscosity;
|
m_viscosity[k] = ltd.viscosity;
|
||||||
m_hydroRadius[k] = ltd.hydroRadius;
|
m_hydroRadius[k] = ltd.hydroRadius;
|
||||||
|
|
@ -817,21 +817,20 @@ void LTI_StokesEinstein::setParameters(LiquidTransportParams& trParam)
|
||||||
|
|
||||||
void LTI_StokesEinstein::getMatrixTransProp(DenseMatrix& mat, doublereal* speciesValues)
|
void LTI_StokesEinstein::getMatrixTransProp(DenseMatrix& mat, doublereal* speciesValues)
|
||||||
{
|
{
|
||||||
|
size_t nsp = m_thermo->nSpecies();
|
||||||
int nsp = m_thermo->nSpecies();
|
|
||||||
doublereal temp = m_thermo->temperature();
|
doublereal temp = m_thermo->temperature();
|
||||||
|
|
||||||
array_fp viscSpec(nsp);
|
array_fp viscSpec(nsp);
|
||||||
array_fp radiusSpec(nsp);
|
array_fp radiusSpec(nsp);
|
||||||
|
|
||||||
for (int k = 0; k < nsp; k++) {
|
for (size_t k = 0; k < nsp; k++) {
|
||||||
viscSpec[k] = m_viscosity[k]->getSpeciesTransProp() ;
|
viscSpec[k] = m_viscosity[k]->getSpeciesTransProp() ;
|
||||||
radiusSpec[k] = m_hydroRadius[k]->getSpeciesTransProp() ;
|
radiusSpec[k] = m_hydroRadius[k]->getSpeciesTransProp() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
mat.resize(nsp,nsp, 0.0);
|
mat.resize(nsp,nsp, 0.0);
|
||||||
for (int i = 0; i < nsp; i++)
|
for (size_t i = 0; i < nsp; i++)
|
||||||
for (int j = 0; j < nsp; j++) {
|
for (size_t j = 0; j < nsp; j++) {
|
||||||
mat(i,j) = (6.0 * Pi * radiusSpec[i] * viscSpec[j]) / GasConstant / temp;
|
mat(i,j) = (6.0 * Pi * radiusSpec[i] * viscSpec[j]) / GasConstant / temp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -839,7 +838,7 @@ void LTI_StokesEinstein::getMatrixTransProp(DenseMatrix& mat, doublereal* specie
|
||||||
doublereal LTI_MoleFracs_ExpT::getMixTransProp(doublereal* speciesValues, doublereal* speciesWeight)
|
doublereal LTI_MoleFracs_ExpT::getMixTransProp(doublereal* speciesValues, doublereal* speciesWeight)
|
||||||
{
|
{
|
||||||
|
|
||||||
int nsp = m_thermo->nSpecies();
|
size_t nsp = m_thermo->nSpecies();
|
||||||
doublereal temp = m_thermo->temperature();
|
doublereal temp = m_thermo->temperature();
|
||||||
vector_fp molefracs(nsp);
|
vector_fp molefracs(nsp);
|
||||||
m_thermo->getMoleFractions(&molefracs[0]);
|
m_thermo->getMoleFractions(&molefracs[0]);
|
||||||
|
|
@ -848,18 +847,18 @@ doublereal LTI_MoleFracs_ExpT::getMixTransProp(doublereal* speciesValues, double
|
||||||
|
|
||||||
//if weightings are specified, use those
|
//if weightings are specified, use those
|
||||||
if (speciesWeight) {
|
if (speciesWeight) {
|
||||||
for (int k = 0; k < nsp; k++) {
|
for (size_t k = 0; k < nsp; k++) {
|
||||||
molefracs[k] = molefracs[k]*speciesWeight[k];
|
molefracs[k] = molefracs[k]*speciesWeight[k];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw CanteraError("LTI_MoleFracs_ExpT::getMixTransProp","You should be specifying the speciesWeight");
|
throw CanteraError("LTI_MoleFracs_ExpT::getMixTransProp","You should be specifying the speciesWeight");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < nsp; i++) {
|
for (size_t i = 0; i < nsp; i++) {
|
||||||
value += speciesValues[i] * molefracs[i];
|
value += speciesValues[i] * molefracs[i];
|
||||||
for (int j = 0; j < nsp; j++) {
|
for (size_t j = 0; j < nsp; j++) {
|
||||||
for (int k = 0; k < (int)m_Aij.size(); k++) {
|
for (size_t k = 0; k < m_Aij.size(); k++) {
|
||||||
value += molefracs[i]*molefracs[j]*(*m_Aij[k])(i,j)*pow(molefracs[i],k)*exp((*m_Bij[k])(i,j)*temp);
|
value += molefracs[i]*molefracs[j]*(*m_Aij[k])(i,j)*pow(molefracs[i], (int) k)*exp((*m_Bij[k])(i,j)*temp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -871,22 +870,22 @@ doublereal LTI_MoleFracs_ExpT::getMixTransProp(doublereal* speciesValues, double
|
||||||
doublereal LTI_MoleFracs_ExpT::getMixTransProp(std::vector<LTPspecies*> LTPptrs)
|
doublereal LTI_MoleFracs_ExpT::getMixTransProp(std::vector<LTPspecies*> LTPptrs)
|
||||||
{
|
{
|
||||||
|
|
||||||
int nsp = m_thermo->nSpecies();
|
size_t nsp = m_thermo->nSpecies();
|
||||||
doublereal temp = m_thermo->temperature();
|
doublereal temp = m_thermo->temperature();
|
||||||
vector_fp molefracs(nsp);
|
vector_fp molefracs(nsp);
|
||||||
m_thermo->getMoleFractions(&molefracs[0]);
|
m_thermo->getMoleFractions(&molefracs[0]);
|
||||||
|
|
||||||
doublereal value = 0;
|
doublereal value = 0;
|
||||||
|
|
||||||
for (int k = 0; k < nsp; k++) {
|
for (size_t k = 0; k < nsp; k++) {
|
||||||
molefracs[k] = molefracs[k]*LTPptrs[k]->getMixWeight();
|
molefracs[k] = molefracs[k]*LTPptrs[k]->getMixWeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < nsp; i++) {
|
for (size_t i = 0; i < nsp; i++) {
|
||||||
value += LTPptrs[i]->getSpeciesTransProp() * molefracs[i];
|
value += LTPptrs[i]->getSpeciesTransProp() * molefracs[i];
|
||||||
for (int j = 0; j < nsp; j++) {
|
for (size_t j = 0; j < nsp; j++) {
|
||||||
for (int k = 0; k < (int)m_Aij.size(); k++) {
|
for (size_t k = 0; k < m_Aij.size(); k++) {
|
||||||
value += molefracs[i]*molefracs[j]*(*m_Aij[k])(i,j)*pow(molefracs[i],k)*exp((*m_Bij[k])(i,j)*temp);
|
value += molefracs[i]*molefracs[j]*(*m_Aij[k])(i,j)*pow(molefracs[i], (int) k)*exp((*m_Bij[k])(i,j)*temp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -500,7 +500,7 @@ doublereal LiquidTransport::viscosity()
|
||||||
* @param visc array of length "number of species"
|
* @param visc array of length "number of species"
|
||||||
* to hold returned viscosities.
|
* to hold returned viscosities.
|
||||||
*/
|
*/
|
||||||
void LiquidTransport::getSpeciesViscosities(doublereal* visc)
|
void LiquidTransport::getSpeciesViscosities(doublereal* const visc)
|
||||||
{
|
{
|
||||||
update_T();
|
update_T();
|
||||||
if (!m_visc_temp_ok) {
|
if (!m_visc_temp_ok) {
|
||||||
|
|
@ -1097,7 +1097,7 @@ void LiquidTransport::getSpeciesVdiffES(size_t ndim,
|
||||||
* Flat vector with the m_nsp in the inner loop.
|
* Flat vector with the m_nsp in the inner loop.
|
||||||
* length = ldx * ndim
|
* length = ldx * ndim
|
||||||
*/
|
*/
|
||||||
void LiquidTransport::getSpeciesFluxes(int ndim,
|
void LiquidTransport::getSpeciesFluxes(size_t ndim,
|
||||||
const doublereal* grad_T,
|
const doublereal* grad_T,
|
||||||
int ldx, const doublereal* grad_X,
|
int ldx, const doublereal* grad_X,
|
||||||
int ldf, doublereal* fluxes)
|
int ldf, doublereal* fluxes)
|
||||||
|
|
|
||||||
|
|
@ -250,10 +250,10 @@ bool SimpleTransport::initLiquid(LiquidTransportParams& tr)
|
||||||
tempDepType_ = 1;
|
tempDepType_ = 1;
|
||||||
} else if (vm0 == LTR_MODEL_NOTSET) {
|
} else if (vm0 == LTR_MODEL_NOTSET) {
|
||||||
throw CanteraError("SimpleTransport::initLiquid",
|
throw CanteraError("SimpleTransport::initLiquid",
|
||||||
"Viscosity Model is not set for species " + spName0 + " in the input file");
|
"Viscosity Model is not set for species " + spName0 + " in the input file");
|
||||||
} else {
|
} else {
|
||||||
throw CanteraError("SimpleTransport::initLiquid",
|
throw CanteraError("SimpleTransport::initLiquid",
|
||||||
"Viscosity Model for species " + spName0 + " is not handled by this object");
|
"Viscosity Model for species " + spName0 + " is not handled by this object");
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -266,7 +266,7 @@ bool SimpleTransport::initLiquid(LiquidTransportParams& tr)
|
||||||
if (vm != vm0) {
|
if (vm != vm0) {
|
||||||
if (compositionDepType_ != 0) {
|
if (compositionDepType_ != 0) {
|
||||||
throw CanteraError(" SimpleTransport::initLiquid",
|
throw CanteraError(" SimpleTransport::initLiquid",
|
||||||
"different viscosity models for species " + spName + " and " + spName0 );
|
"different viscosity models for species " + spName + " and " + spName0 );
|
||||||
} else {
|
} else {
|
||||||
kentry = m_coeffVisc_Ns[0];
|
kentry = m_coeffVisc_Ns[0];
|
||||||
}
|
}
|
||||||
|
|
@ -297,7 +297,7 @@ bool SimpleTransport::initLiquid(LiquidTransportParams& tr)
|
||||||
if (cm != cm0) {
|
if (cm != cm0) {
|
||||||
if (compositionDepType_ != 0) {
|
if (compositionDepType_ != 0) {
|
||||||
throw CanteraError(" SimpleTransport::initLiquid",
|
throw CanteraError(" SimpleTransport::initLiquid",
|
||||||
"different thermal conductivity models for species " + spName + " and " + spName0);
|
"different thermal conductivity models for species " + spName + " and " + spName0);
|
||||||
} else {
|
} else {
|
||||||
kentry = m_coeffLambda_Ns[0];
|
kentry = m_coeffLambda_Ns[0];
|
||||||
}
|
}
|
||||||
|
|
@ -322,7 +322,7 @@ bool SimpleTransport::initLiquid(LiquidTransportParams& tr)
|
||||||
LiquidTR_Model rm0 = ltd0.model_hydroradius;
|
LiquidTR_Model rm0 = ltd0.model_hydroradius;
|
||||||
if (rm0 != vm0) {
|
if (rm0 != vm0) {
|
||||||
throw CanteraError("SimpleTransport::initLiquid",
|
throw CanteraError("SimpleTransport::initLiquid",
|
||||||
"hydroradius model is not the same as the viscosity model for species " + spName0);
|
"hydroradius model is not the same as the viscosity model for species " + spName0);
|
||||||
} else {
|
} else {
|
||||||
useHydroRadius_ = true;
|
useHydroRadius_ = true;
|
||||||
}
|
}
|
||||||
|
|
@ -339,22 +339,22 @@ bool SimpleTransport::initLiquid(LiquidTransportParams& tr)
|
||||||
LiquidTR_Model rm = ltd.model_hydroradius;
|
LiquidTR_Model rm = ltd.model_hydroradius;
|
||||||
if (rm == LTR_MODEL_NOTSET) {
|
if (rm == LTR_MODEL_NOTSET) {
|
||||||
throw CanteraError("SimpleTransport::initLiquid",
|
throw CanteraError("SimpleTransport::initLiquid",
|
||||||
"Neither diffusivity nor hydroradius is set for species " + spName);
|
"Neither diffusivity nor hydroradius is set for species " + spName);
|
||||||
}
|
}
|
||||||
if (rm != vm0) {
|
if (rm != vm0) {
|
||||||
throw CanteraError("SimpleTransport::initLiquid",
|
throw CanteraError("SimpleTransport::initLiquid",
|
||||||
"hydroradius model is not the same as the viscosity model for species " + spName);
|
"hydroradius model is not the same as the viscosity model for species " + spName);
|
||||||
}
|
}
|
||||||
if (rm != LTR_MODEL_CONSTANT) {
|
if (rm != LTR_MODEL_CONSTANT) {
|
||||||
throw CanteraError("SimpleTransport::initLiquid",
|
throw CanteraError("SimpleTransport::initLiquid",
|
||||||
"hydroradius model is not constant for species " + spName0);
|
"hydroradius model is not constant for species " + spName0);
|
||||||
}
|
}
|
||||||
vector_fp &kentry = m_coeffHydroRadius_Ns[k];
|
vector_fp &kentry = m_coeffHydroRadius_Ns[k];
|
||||||
kentry = ltd.hydroradius;
|
kentry = ltd.hydroradius;
|
||||||
} else {
|
} else {
|
||||||
if (dm != dm0) {
|
if (dm != dm0) {
|
||||||
throw CanteraError(" SimpleTransport::initLiquid",
|
throw CanteraError(" SimpleTransport::initLiquid",
|
||||||
"different diffusivity models for species " + spName + " and " + spName0 );
|
"different diffusivity models for species " + spName + " and " + spName0 );
|
||||||
}
|
}
|
||||||
vector_fp &kentry = m_coeffDiff_Ns[k];
|
vector_fp &kentry = m_coeffDiff_Ns[k];
|
||||||
kentry = ltd.speciesDiffusivity;
|
kentry = ltd.speciesDiffusivity;
|
||||||
|
|
@ -452,7 +452,7 @@ doublereal SimpleTransport::viscosity()
|
||||||
return m_viscmix;
|
return m_viscmix;
|
||||||
}
|
}
|
||||||
//================================================================================================
|
//================================================================================================
|
||||||
void SimpleTransport::getSpeciesViscosities(doublereal* visc)
|
void SimpleTransport::getSpeciesViscosities(doublereal* const visc)
|
||||||
{
|
{
|
||||||
update_T();
|
update_T();
|
||||||
if (!m_visc_temp_ok) {
|
if (!m_visc_temp_ok) {
|
||||||
|
|
|
||||||
|
|
@ -159,9 +159,9 @@ void SolidTransport::getMixDiffCoeffs(doublereal* const d)
|
||||||
doublereal SolidTransport::electricalConductivity()
|
doublereal SolidTransport::electricalConductivity()
|
||||||
{
|
{
|
||||||
getMobilities(&m_work[0]);
|
getMobilities(&m_work[0]);
|
||||||
int nsp = m_thermo->nSpecies();
|
size_t nsp = m_thermo->nSpecies();
|
||||||
doublereal sum = 0.0;
|
doublereal sum = 0.0;
|
||||||
for (int k = 0; k < nsp; k++) {
|
for (size_t k = 0; k < nsp; k++) {
|
||||||
sum += m_thermo->charge(k) * m_thermo->moleFraction(k) * m_work[k];
|
sum += m_thermo->charge(k) * m_thermo->moleFraction(k) * m_work[k];
|
||||||
}
|
}
|
||||||
return sum * m_thermo->molarDensity();
|
return sum * m_thermo->molarDensity();
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ namespace Cantera
|
||||||
//////////////////// class LiquidTransport methods //////////////
|
//////////////////// class LiquidTransport methods //////////////
|
||||||
|
|
||||||
|
|
||||||
Transport::Transport(thermo_t* thermo, int ndim) :
|
Transport::Transport(thermo_t* thermo, size_t ndim) :
|
||||||
m_thermo(thermo),
|
m_thermo(thermo),
|
||||||
m_ready(false),
|
m_ready(false),
|
||||||
m_nmin(0),
|
m_nmin(0),
|
||||||
|
|
@ -148,7 +148,7 @@ void Transport::finalize()
|
||||||
}
|
}
|
||||||
|
|
||||||
//====================================================================================================================
|
//====================================================================================================================
|
||||||
void Transport::getSpeciesFluxes(int ndim, const doublereal* const grad_T,
|
void Transport::getSpeciesFluxes(size_t ndim, const doublereal* const grad_T,
|
||||||
int ldx, const doublereal* const grad_X,
|
int ldx, const doublereal* const grad_X,
|
||||||
int ldf, doublereal* const fluxes)
|
int ldf, doublereal* const fluxes)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1013,8 +1013,8 @@ void TransportFactory::getLiquidSpeciesTransportData(const std::vector<const XML
|
||||||
data.selfDiffusion.resize(nsp,0);
|
data.selfDiffusion.resize(nsp,0);
|
||||||
ThermoPhase* temp_thermo = trParam.thermo;
|
ThermoPhase* temp_thermo = trParam.thermo;
|
||||||
|
|
||||||
int num = trNode.nChildren();
|
size_t num = trNode.nChildren();
|
||||||
for (int iChild = 0; iChild < num; iChild++) {
|
for (size_t iChild = 0; iChild < num; iChild++) {
|
||||||
XML_Node& xmlChild = trNode.child(iChild);
|
XML_Node& xmlChild = trNode.child(iChild);
|
||||||
std::string nodeName = xmlChild.name();
|
std::string nodeName = xmlChild.name();
|
||||||
|
|
||||||
|
|
@ -1041,7 +1041,7 @@ void TransportFactory::getLiquidSpeciesTransportData(const std::vector<const XML
|
||||||
for (size_t iSpec = 0; iSpec< nsp; iSpec++) {
|
for (size_t iSpec = 0; iSpec< nsp; iSpec++) {
|
||||||
XML_Node& propSpecNode = xmlChild.child(iSpec);
|
XML_Node& propSpecNode = xmlChild.child(iSpec);
|
||||||
std::string specName = propSpecNode.name();
|
std::string specName = propSpecNode.name();
|
||||||
int index = temp_thermo->speciesIndex(specName.c_str());
|
size_t index = temp_thermo->speciesIndex(specName.c_str());
|
||||||
data.selfDiffusion[index] = newLTP(propSpecNode, name, m_tranPropMap[nodeName], temp_thermo);
|
data.selfDiffusion[index] = newLTP(propSpecNode, name, m_tranPropMap[nodeName], temp_thermo);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
@ -1119,11 +1119,11 @@ void TransportFactory::getLiquidInteractionsTransportData(const XML_Node& transp
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
|
||||||
int nsp = trParam.nsp_;
|
size_t nsp = trParam.nsp_;
|
||||||
int nBinInt = nsp*(nsp-1)/2;
|
size_t nBinInt = nsp*(nsp-1)/2;
|
||||||
|
|
||||||
int num = transportNode.nChildren();
|
size_t num = transportNode.nChildren();
|
||||||
for (int iChild = 0; iChild < num; iChild++) {
|
for (size_t iChild = 0; iChild < num; iChild++) {
|
||||||
//tranTypeNode is a type of transport property like viscosity
|
//tranTypeNode is a type of transport property like viscosity
|
||||||
XML_Node& tranTypeNode = transportNode.child(iChild);
|
XML_Node& tranTypeNode = transportNode.child(iChild);
|
||||||
std::string nodeName = tranTypeNode.name();
|
std::string nodeName = tranTypeNode.name();
|
||||||
|
|
@ -1146,7 +1146,7 @@ void TransportFactory::getLiquidInteractionsTransportData(const XML_Node& transp
|
||||||
trParam);
|
trParam);
|
||||||
break;
|
break;
|
||||||
case TP_MOBILITYRATIO: {
|
case TP_MOBILITYRATIO: {
|
||||||
for (int iSpec = 0; iSpec< nBinInt; iSpec++) {
|
for (size_t iSpec = 0; iSpec< nBinInt; iSpec++) {
|
||||||
XML_Node& propSpecNode = compDepNode.child(iSpec);
|
XML_Node& propSpecNode = compDepNode.child(iSpec);
|
||||||
string specName = propSpecNode.name();
|
string specName = propSpecNode.name();
|
||||||
size_t loc = specName.find(":");
|
size_t loc = specName.find(":");
|
||||||
|
|
@ -1160,10 +1160,10 @@ void TransportFactory::getLiquidInteractionsTransportData(const XML_Node& transp
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
case TP_SELFDIFFUSION: {
|
case TP_SELFDIFFUSION: {
|
||||||
for (int iSpec = 0; iSpec< nsp; iSpec++) {
|
for (size_t iSpec = 0; iSpec< nsp; iSpec++) {
|
||||||
XML_Node& propSpecNode = compDepNode.child(iSpec);
|
XML_Node& propSpecNode = compDepNode.child(iSpec);
|
||||||
string specName = propSpecNode.name();
|
string specName = propSpecNode.name();
|
||||||
int index = temp_thermo->speciesIndex(specName.c_str());
|
size_t index = temp_thermo->speciesIndex(specName.c_str());
|
||||||
trParam.selfDiffusion[index] = newLTI(propSpecNode,
|
trParam.selfDiffusion[index] = newLTI(propSpecNode,
|
||||||
m_tranPropMap[nodeName],
|
m_tranPropMap[nodeName],
|
||||||
trParam);
|
trParam);
|
||||||
|
|
@ -1211,7 +1211,7 @@ void TransportFactory::getLiquidInteractionsTransportData(const XML_Node& transp
|
||||||
} else if (velocityBasis == "mole") {
|
} else if (velocityBasis == "mole") {
|
||||||
trParam.velocityBasis_ = VB_MOLEAVG;
|
trParam.velocityBasis_ = VB_MOLEAVG;
|
||||||
} else if (trParam.thermo->speciesIndex(velocityBasis) > 0) {
|
} else if (trParam.thermo->speciesIndex(velocityBasis) > 0) {
|
||||||
trParam.velocityBasis_ = trParam.thermo->speciesIndex(velocityBasis) ;
|
trParam.velocityBasis_ = static_cast<int>(trParam.thermo->speciesIndex(velocityBasis));
|
||||||
} else {
|
} else {
|
||||||
int linenum = __LINE__;
|
int linenum = __LINE__;
|
||||||
throw TransportDBError(linenum, "Unknown attribute \"" + velocityBasis + "\" for <velocityBasis> node. ");
|
throw TransportDBError(linenum, "Unknown attribute \"" + velocityBasis + "\" for <velocityBasis> node. ");
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue