Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix various CI issues #1399

Merged
merged 3 commits into from
Sep 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ jobs:
shell: bash
- name: Build Cantera
run: scons build -j2 boost_inc_dir=%BOOST_ROOT% debug=n logging=debug
python_package=full env_vars=PYTHONPATH,GITHUB_ACTIONS
python_package=full env_vars=USERPROFILE,GITHUB_ACTIONS
msvc_version=${{ matrix.vs-toolset }} f90_interface=n --debug=time
shell: cmd
- name: Test Cantera
Expand Down
2 changes: 1 addition & 1 deletion SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ config_options = [
"""Environment variables to propagate through to SCons. Either the
string 'all' or a comma separated list of variable names, for example,
'LD_LIBRARY_PATH,HOME'.""",
"PATH,LD_LIBRARY_PATH,DYLD_LIBRARY_PATH,PYTHONPATH"),
"PATH,LD_LIBRARY_PATH,DYLD_LIBRARY_PATH,PYTHONPATH,USERPROFILE"),
BoolOption(
"use_pch",
"Use a precompiled-header to speed up compilation",
Expand Down
2 changes: 0 additions & 2 deletions src/equil/vcs_solve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1326,10 +1326,8 @@ double VCS_SOLVE::vcs_phaseStabilityTest(const size_t iph)
}

// Now possibly dampen the estimate.
double sumADel = 0.0;
for (size_t k = 0; k < nsp; k++) {
delFrac[k] = fracDelta_raw[k] - fracDelta_old[k];
sumADel += fabs(delFrac[k]);
}
normUpdate = vcs_l2norm(delFrac);

Expand Down
2 changes: 0 additions & 2 deletions src/equil/vcs_solve_TP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2962,7 +2962,6 @@ double VCS_SOLVE::vcs_tmoles()

void VCS_SOLVE::check_tmoles() const
{
double sum = 0.0;
for (size_t i = 0; i < m_numPhases; i++) {
double m_tPhaseMoles_old_a = TPhInertMoles[i];

Expand All @@ -2971,7 +2970,6 @@ void VCS_SOLVE::check_tmoles() const
m_tPhaseMoles_old_a += m_molNumSpecies_old[k];
}
}
sum += m_tPhaseMoles_old_a;

double denom = m_tPhaseMoles_old[i]+ m_tPhaseMoles_old_a + 1.0E-19;
if (!vcs_doubleEqual(m_tPhaseMoles_old[i]/denom, m_tPhaseMoles_old_a/denom)) {
Expand Down
4 changes: 2 additions & 2 deletions src/numerics/AdaptivePreconditioner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ AdaptivePreconditioner::AdaptivePreconditioner()

void AdaptivePreconditioner::setValue(size_t row, size_t col, double value)
{
m_jac_trips.emplace_back(row, col, value);
m_jac_trips.emplace_back(static_cast<int>(row), static_cast<int>(col), value);
}

void AdaptivePreconditioner::stateAdjustment(vector_fp& state) {
Expand Down Expand Up @@ -47,7 +47,7 @@ void AdaptivePreconditioner::initialize(size_t networkSize)
setIlutDropTol(1e-10);
}
if (m_drop_tol == 0) {
setIlutFillFactor(m_dim/4);
setIlutFillFactor(static_cast<int>(m_dim) / 4);
}
// update initialized status
m_init = true;
Expand Down
2 changes: 0 additions & 2 deletions src/oneD/IonFlow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,9 @@ void IonFlow::electricFieldMethod(const double* x, size_t j0, size_t j1)
double dz = z(j+1) - z(j);

// mixture-average diffusion
double sum = 0.0;
for (size_t k = 0; k < m_nsp; k++) {
m_flux(k,j) = m_wt[k]*(rho*m_diff[k+m_nsp*j]/wtm);
m_flux(k,j) *= (X(x,k,j) - X(x,k,j+1))/dz;
sum -= m_flux(k,j);
}

// ambipolar diffusion
Expand Down
10 changes: 5 additions & 5 deletions src/thermo/Elements.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ double getElementWeight(const std::string& ename)

double getElementWeight(int atomicNumber)
{
int num = numElementsDefined();
int num = static_cast<int>(numElementsDefined());
if (atomicNumber > num || atomicNumber < 1) {
throw IndexError("getElementWeight", "atomicWeightTable", atomicNumber, num);
}
Expand Down Expand Up @@ -309,7 +309,7 @@ string getElementSymbol(const std::string& ename)

string getElementSymbol(int atomicNumber)
{
int num = numElementsDefined();
int num = static_cast<int>(numElementsDefined());
if (atomicNumber > num || atomicNumber < 1) {
throw IndexError("getElementSymbol", "atomicWeightTable", atomicNumber, num);
}
Expand All @@ -334,7 +334,7 @@ string getElementName(const std::string& ename)

string getElementName(int atomicNumber)
{
int num = numElementsDefined();
int num = static_cast<int>(numElementsDefined());
if (atomicNumber > num || atomicNumber < 1) {
throw IndexError("getElementName", "atomicWeightTable", atomicNumber, num);
}
Expand All @@ -349,9 +349,9 @@ int getAtomicNumber(const std::string& ename)
string name = toLowerCopy(symbol);
for (size_t i = 0; i < numElements; i++) {
if (symbol == atomicWeightTable[i].symbol) {
return i + 1;
return static_cast<int>(i) + 1;
} else if (name == atomicWeightTable[i].fullName) {
return i + 1;
return static_cast<int>(i) + 1;
}
}
for (size_t i = 0; i < numIsotopes; i++) {
Expand Down
14 changes: 7 additions & 7 deletions src/transport/GasTransport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -823,14 +823,14 @@ void GasTransport::getBinDiffCorrection(double t, MMCollisionInt& integrals,

void GasTransport::getViscosityPolynomial(size_t i, double* coeffs) const
{
for (size_t k = 0; k < (m_mode == CK_Mode ? 4 : 5); k++) {
for (int k = 0; k < (m_mode == CK_Mode ? 4 : 5); k++) {
coeffs[k] = m_visccoeffs[i][k];
}
}

void GasTransport::getConductivityPolynomial(size_t i, double* coeffs) const
{
for (size_t k = 0; k < (m_mode == CK_Mode ? 4 : 5); k++) {
for (int k = 0; k < (m_mode == CK_Mode ? 4 : 5); k++) {
coeffs[k] = m_condcoeffs[i][k];
}
}
Expand All @@ -845,7 +845,7 @@ void GasTransport::getBinDiffusivityPolynomial(size_t i, size_t j, double* coeff
}
ic += mj - mi;

for (size_t k = 0; k < (m_mode == CK_Mode ? 4 : 5); k++) {
for (int k = 0; k < (m_mode == CK_Mode ? 4 : 5); k++) {
coeffs[k] = m_diffcoeffs[ic][k];
}
}
Expand All @@ -855,7 +855,7 @@ void GasTransport::getCollisionIntegralPolynomial(size_t i, size_t j,
double* bstar_coeffs,
double* cstar_coeffs) const
{
for (size_t k = 0; k < (m_mode == CK_Mode ? 6 : COLL_INT_POLY_DEGREE) + 1; k++) {
for (int k = 0; k < (m_mode == CK_Mode ? 6 : COLL_INT_POLY_DEGREE) + 1; k++) {
astar_coeffs[k] = m_astar_poly[m_poly[i][j]][k];
bstar_coeffs[k] = m_bstar_poly[m_poly[i][j]][k];
cstar_coeffs[k] = m_cstar_poly[m_poly[i][j]][k];
Expand All @@ -864,7 +864,7 @@ void GasTransport::getCollisionIntegralPolynomial(size_t i, size_t j,

void GasTransport::setViscosityPolynomial(size_t i, double* coeffs)
{
for (size_t k = 0; k < (m_mode == CK_Mode ? 4 : 5); k++) {
for (int k = 0; k < (m_mode == CK_Mode ? 4 : 5); k++) {
m_visccoeffs[i][k] = coeffs[k];
}

Expand All @@ -877,7 +877,7 @@ void GasTransport::setViscosityPolynomial(size_t i, double* coeffs)

void GasTransport::setConductivityPolynomial(size_t i, double* coeffs)
{
for (size_t k = 0; k < (m_mode == CK_Mode ? 4 : 5); k++) {
for (int k = 0; k < (m_mode == CK_Mode ? 4 : 5); k++) {
m_condcoeffs[i][k] = coeffs[k];
}

Expand All @@ -898,7 +898,7 @@ void GasTransport::setBinDiffusivityPolynomial(size_t i, size_t j, double* coeff
}
ic += mj - mi;

for (size_t k = 0; k < (m_mode == CK_Mode ? 4 : 5); k++) {
for (int k = 0; k < (m_mode == CK_Mode ? 4 : 5); k++) {
m_diffcoeffs[ic][k] = coeffs[k];
}

Expand Down
10 changes: 6 additions & 4 deletions src/zeroD/IdealGasConstPressureMoleReactor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ Eigen::SparseMatrix<double> IdealGasConstPressureMoleReactor::jacobian()
// which is small and would completely destroy the sparsity of the Jacobian
for (int k = 0; k < dwdX.outerSize(); k++) {
for (Eigen::SparseMatrix<double>::InnerIterator it(dwdX, k); it; ++it) {
m_jac_trips.emplace_back(it.row() + m_sidx, it.col() + m_sidx,
m_jac_trips.emplace_back(static_cast<int>(it.row() + m_sidx),
static_cast<int>(it.col() + m_sidx),
it.value() * molarVolume);
}
}
Expand All @@ -171,7 +172,8 @@ Eigen::SparseMatrix<double> IdealGasConstPressureMoleReactor::jacobian()
for (size_t j = 0; j < m_nv; j++) {
double ydotPerturbed = rhsPerturbed[j] / lhsPerturbed[j];
double ydotCurrent = rhsCurrent[j] / lhsCurrent[j];
m_jac_trips.emplace_back(j, 0, (ydotPerturbed - ydotCurrent) / deltaTemp);
m_jac_trips.emplace_back(static_cast<int>(j), 0,
(ydotPerturbed - ydotCurrent) / deltaTemp);
}
// d T_dot/dnj
Eigen::VectorXd specificHeat(m_nsp);
Expand All @@ -188,8 +190,8 @@ Eigen::SparseMatrix<double> IdealGasConstPressureMoleReactor::jacobian()
// determine derivatives
// spans columns
Eigen::VectorXd hkdwkdnjSum = enthalpy.transpose() * dwdX;
for (int j = 0; j < m_nsp; j++) {
m_jac_trips.emplace_back(0, j + m_sidx,
for (size_t j = 0; j < m_nsp; j++) {
m_jac_trips.emplace_back(0, static_cast<int>(j + m_sidx),
((specificHeat[j] - cp_mole) * m_vol * qdot
- m_vol * cp_mole * hkdwkdnjSum[j]
+ totalCp * hk_dwdot_dC_sum) / (totalCp * totalCp));
Expand Down
10 changes: 7 additions & 3 deletions src/zeroD/IdealGasMoleReactor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,10 @@ Eigen::SparseMatrix<double> IdealGasMoleReactor::jacobian()
// add to preconditioner
for (int k=0; k<speciesDervs.outerSize(); ++k) {
for (Eigen::SparseMatrix<double>::InnerIterator it(speciesDervs, k); it; ++it) {
m_jac_trips.emplace_back(it.row() + m_sidx, it.col() + m_sidx, it.value());
m_jac_trips.emplace_back(
static_cast<int>(it.row() + m_sidx),
static_cast<int>(it.col() + m_sidx),
it.value());
}
}
// Temperature Derivatives
Expand All @@ -199,7 +202,8 @@ Eigen::SparseMatrix<double> IdealGasMoleReactor::jacobian()
for (size_t j = 0; j < m_nv; j++) {
double ydotPerturbed = rhsPerturbed[j] / lhsPerturbed[j];
double ydotCurrent = rhsCurrent[j] / lhsCurrent[j];
m_jac_trips.emplace_back(j, 0, (ydotPerturbed - ydotCurrent) / deltaTemp);
m_jac_trips.emplace_back(static_cast<int>(j), 0,
(ydotPerturbed - ydotCurrent) / deltaTemp);
}
// find derivatives d T_dot/dNj
vector_fp specificHeat(m_nsp);
Expand Down Expand Up @@ -236,7 +240,7 @@ Eigen::SparseMatrix<double> IdealGasMoleReactor::jacobian()
ukdnkdnjSum += internal_energy[k] * speciesDervs.coeff(k, j);
}
// set appropriate column of preconditioner
m_jac_trips.emplace_back(0, j + m_sidx,
m_jac_trips.emplace_back(0, static_cast<int>(j + m_sidx),
(ukdwdCtotSum - ukdnkdnjSum + specificHeat[j] * uknkSum / totalCv) / totalCv);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/zeroD/MoleReactor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ void MoleReactor::getSurfaceInitialConditions(double* y)
for (auto& S : m_surfaces) {
double area = S->area();
auto currPhase = S->thermo();
double tempLoc = currPhase->nSpecies();
size_t tempLoc = currPhase->nSpecies();
double surfDensity = currPhase->siteDensity();
S->getCoverages(y + loc);
// convert coverages to moles
Expand All @@ -49,7 +49,7 @@ void MoleReactor::updateSurfaceState(double* y)
auto surf = S->thermo();
double invArea = 1/S->area();
double invSurfDensity = 1/surf->siteDensity();
double tempLoc = surf->nSpecies();
size_t tempLoc = surf->nSpecies();
for (size_t i = 0; i < tempLoc; i++) {
coverages[i + loc] = y[i + loc] * invArea * surf->size(i) * invSurfDensity;
}
Expand Down
4 changes: 3 additions & 1 deletion src/zeroD/Reactor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,9 @@ Eigen::SparseMatrix<double> Reactor::finiteDifferenceJacobian()
double ydotPerturbed = rhsPerturbed[i] / lhsPerturbed[i];
double ydotCurrent = rhsCurrent[i] / lhsCurrent[i];
if (ydotCurrent != ydotPerturbed) {
m_jac_trips.emplace_back(i, j, (ydotPerturbed - ydotCurrent) / delta_y);
m_jac_trips.emplace_back(
static_cast<int>(i), static_cast<int>(j),
(ydotPerturbed - ydotCurrent) / delta_y);
}
}
}
Expand Down