From 3d4940d8a71c2f09cb41690029e87def292f48b3 Mon Sep 17 00:00:00 2001 From: Ian Bell Date: Sat, 24 Feb 2024 10:58:35 -0500 Subject: [PATCH] Squelch more pedantic warnings --- include/teqp/algorithms/ancillary_builder.hpp | 4 ++-- include/teqp/ideal_eosterms.hpp | 2 +- include/teqp/json_tools.hpp | 4 ++-- include/teqp/math/finite_derivs.hpp | 2 +- include/teqp/models/CPA.hpp | 4 ++-- include/teqp/models/GERG/GERG.hpp | 4 ++-- include/teqp/models/cubics.hpp | 22 +++++++++---------- .../teqp/models/model_potentials/LJChain.hpp | 2 +- include/teqp/models/multifluid.hpp | 4 ++-- include/teqp/types.hpp | 2 +- interface/C/teqpc.cpp | 1 + src/tests/GERG2008.cpp | 2 +- src/tests/catch_test_GERG.cxx | 8 +++---- src/tests/catch_test_Grayiteration.cxx | 1 - src/tests/catch_test_SAFTpolar.cxx | 3 ++- src/tests/catch_test_alphaig.cxx | 2 +- src/tests/catch_test_cubics.cxx | 2 +- src/tests/catch_test_mutant.cxx | 1 - 18 files changed, 35 insertions(+), 35 deletions(-) diff --git a/include/teqp/algorithms/ancillary_builder.hpp b/include/teqp/algorithms/ancillary_builder.hpp index c36281f3..465b78b8 100644 --- a/include/teqp/algorithms/ancillary_builder.hpp +++ b/include/teqp/algorithms/ancillary_builder.hpp @@ -132,12 +132,12 @@ auto build_ancillaries(const AbstractModel& model, double Tcritguess, double rho if (verify){ // Verify - for (auto i = 0; i < Thetas_.size(); ++i){ + for (auto i = 0U; i < Thetas_.size(); ++i){ double T = (1-Thetas_[i])*Tcrittrue; double rhoLanc = anc.rhoL(T); double rhoVanc = anc.rhoV(T); - double panc = anc.pL(T); +// double panc = anc.pL(T); if (std::abs(rhoLanc/rhoLs_[i]-1) > 1e-2){ std::cout << T << " " << rhoLs_[i] << " " << rhoLanc << std::endl; } diff --git a/include/teqp/ideal_eosterms.hpp b/include/teqp/ideal_eosterms.hpp index 3dad5310..123b77ca 100644 --- a/include/teqp/ideal_eosterms.hpp +++ b/include/teqp/ideal_eosterms.hpp @@ -416,7 +416,7 @@ namespace teqp { // std::cout << term.dump() << std::endl; std::valarray t = term.at("t"), c = term.at("c"); double T_0 = term.at("T0"); - for (auto i = 0; i < t.size(); ++i){ + for (auto i = 0U; i < t.size(); ++i){ if (t[i] == 0){ newterms.push_back({{"type", "Cp0Constant"}, {"c", c[i]}, {"T_0", T_0}, {"R", R}}); } diff --git a/include/teqp/json_tools.hpp b/include/teqp/json_tools.hpp index 3580e5b8..9fd0a1d9 100644 --- a/include/teqp/json_tools.hpp +++ b/include/teqp/json_tools.hpp @@ -51,10 +51,10 @@ namespace teqp{ // Then copy elements over for (auto i = 0U; i < m.size(); ++i){ auto row = m[i]; - if (row.size() != mat.rows()){ + if (row.size() != static_cast(mat.rows())){ throw std::invalid_argument("provided matrix is not square"); } - for (auto k = 0; k < row.size(); ++k){ + for (auto k = 0U; k < row.size(); ++k){ mat(i, k) = row[k]; } } diff --git a/include/teqp/math/finite_derivs.hpp b/include/teqp/math/finite_derivs.hpp index 9f08dc33..2a0f2c88 100644 --- a/include/teqp/math/finite_derivs.hpp +++ b/include/teqp/math/finite_derivs.hpp @@ -57,7 +57,7 @@ auto centered_diff(const Function &f, const Scalar x, const Scalar h) { throw std::invalid_argument("Finite differentiation coefficient arrays not the same size"); } Scalar num = 0.0; - for (auto i = 0; i < k.size(); ++i) { + for (auto i = 0U; i < k.size(); ++i) { num = num + c[i]*f(x + h*k[i]); } auto val = num / pow(h, Nderiv); diff --git a/include/teqp/models/CPA.hpp b/include/teqp/models/CPA.hpp index 05b0d751..1ad88242 100644 --- a/include/teqp/models/CPA.hpp +++ b/include/teqp/models/CPA.hpp @@ -166,10 +166,10 @@ class CPACubic { auto get_ab(const TType T, const VecType& molefrac) const { using return_type = std::common_type_t; return_type asummer = 0.0, bsummer = 0.0; - for (auto i = 0; i < molefrac.size(); ++i) { + for (auto i = 0U; i < molefrac.size(); ++i) { bsummer += molefrac[i] * bi[i]; auto ai = get_ai(T, i); - for (auto j = 0; j < molefrac.size(); ++j) { + for (auto j = 0U; j < molefrac.size(); ++j) { auto aj = get_ai(T, j); auto a_ij = (1.0 - k_ij[i][j]) * sqrt(ai * aj); asummer += molefrac[i] * molefrac[j] * a_ij; diff --git a/include/teqp/models/GERG/GERG.hpp b/include/teqp/models/GERG/GERG.hpp index fc18f03a..5379b0f8 100644 --- a/include/teqp/models/GERG/GERG.hpp +++ b/include/teqp/models/GERG/GERG.hpp @@ -190,7 +190,7 @@ class GERG200XCorrespondingStatesTerm{ if (N != size()){ throw std::invalid_argument("wrong size"); } - for (auto i = 0; i < N; ++i) { + for (auto i = 0U; i < N; ++i) { alphar += molefracs[i] * EOSs[i].alphar(tau, delta); } return forceeval(alphar); @@ -286,7 +286,7 @@ class GERG200XDepartureTerm { throw std::invalid_argument("wrong size"); } - for (auto i = 0; i < N; ++i){ + for (auto i = 0U; i < N; ++i){ for (auto j = i+1; j < N; ++j){ auto Fij = Fmat(i,j); if (Fij != 0){ diff --git a/include/teqp/models/cubics.hpp b/include/teqp/models/cubics.hpp index 973d41b8..af6d8b6c 100644 --- a/include/teqp/models/cubics.hpp +++ b/include/teqp/models/cubics.hpp @@ -218,10 +218,10 @@ class GenericCubic { template auto get_a(TType T, const CompType& molefracs) const { std::common_type_t a_ = 0.0; - for (auto i = 0; i < molefracs.size(); ++i) { + for (auto i = 0U; i < molefracs.size(); ++i) { auto alphai = forceeval(std::visit([&](auto& t) { return t(T); }, alphas[i])); auto ai_ = forceeval(this->ai[i] * alphai); - for (auto j = 0; j < molefracs.size(); ++j) { + for (auto j = 0U; j < molefracs.size(); ++j) { auto alphaj = forceeval(std::visit([&](auto& t) { return t(T); }, alphas[j])); auto aj_ = this->ai[j] * alphaj; auto aij = forceeval((1 - kmat(i,j)) * sqrt(ai_ * aj_)); @@ -234,7 +234,7 @@ class GenericCubic { template auto get_b(TType /*T*/, const CompType& molefracs) const { std::common_type_t b_ = 0.0; - for (auto i = 0; i < molefracs.size(); ++i) { + for (auto i = 0U; i < molefracs.size(); ++i) { b_ = b_ + molefracs[i] * bi[i]; } return forceeval(b_); @@ -501,13 +501,13 @@ class WilsonResidualHelmholtzOverRT { using TYPE = std::common_type_t; // The denominator in Phi TYPE Vtot = 0.0; - for (auto i = 0; i < molefracs.size(); ++i){ + for (auto i = 0U; i < molefracs.size(); ++i){ auto v_i = b[i]; Vtot += molefracs[i]*v_i; } TYPE summer = 0.0; - for (auto i = 0; i < molefracs.size(); ++i){ + for (auto i = 0U; i < molefracs.size(); ++i){ auto v_i = b[i]; // The ratio phi_i/z_i is expressed like this to better handle // the case of z_i = 0, which would otherwise be a divide by zero @@ -528,10 +528,10 @@ class WilsonResidualHelmholtzOverRT { using TYPE = std::common_type_t; TYPE summer = 0.0; - for (auto i = 0; i < molefracs.size(); ++i){ + for (auto i = 0U; i < molefracs.size(); ++i){ auto v_i = b[i]; TYPE summerj = 0.0; - for (auto j = 0; j < molefracs.size(); ++j){ + for (auto j = 0U; j < molefracs.size(); ++j){ auto v_j = b[j]; auto Aij = get_Aij(i,j,T); auto Omega_ji = v_j/v_i*exp(-Aij/T); @@ -675,7 +675,7 @@ class AdvancedPRaEres { auto get_am_over_bm(TType T, const CompType& molefracs) const { auto aEresRT = std::visit([&](auto& aresRTfunc) { return aresRTfunc(T, molefracs); }, ares); // aEres/RT, so a non-dimensional quantity std::common_type_t summer = aEresRT*Ru*T/CEoS; - for (auto i = 0; i < molefracs.size(); ++i) { + for (auto i = 0U; i < molefracs.size(); ++i) { summer += molefracs[i]*get_ai(T,i)/get_bi(T,i); } return forceeval(summer); @@ -687,9 +687,9 @@ class AdvancedPRaEres { switch (brule){ case AdvancedPRaEMixingRules::kQuadratic: - for (auto i = 0; i < molefracs.size(); ++i) { + for (auto i = 0U; i < molefracs.size(); ++i) { auto bi_ = get_bi(T, i); - for (auto j = 0; j < molefracs.size(); ++j) { + for (auto j = 0U; j < molefracs.size(); ++j) { auto bj_ = get_bi(T, j); auto bij = (1 - lmat(i,j)) * pow((pow(bi_, 1.0/s) + pow(bj_, 1.0/s))/2.0, s); @@ -698,7 +698,7 @@ class AdvancedPRaEres { } break; case AdvancedPRaEMixingRules::kLinear: - for (auto i = 0; i < molefracs.size(); ++i) { + for (auto i = 0U; i < molefracs.size(); ++i) { b_ += molefracs[i] * get_bi(T, i); } break; diff --git a/include/teqp/models/model_potentials/LJChain.hpp b/include/teqp/models/model_potentials/LJChain.hpp index 902a7387..6829d607 100644 --- a/include/teqp/models/model_potentials/LJChain.hpp +++ b/include/teqp/models/model_potentials/LJChain.hpp @@ -55,7 +55,7 @@ namespace teqp { } template - auto R(const VecType& molefrac) const { + auto R(const VecType& /*molefrac*/) const { return 1.0; } }; diff --git a/include/teqp/models/multifluid.hpp b/include/teqp/models/multifluid.hpp index f8143c8c..059c2be9 100644 --- a/include/teqp/models/multifluid.hpp +++ b/include/teqp/models/multifluid.hpp @@ -61,7 +61,7 @@ class CorrespondingStatesContribution { using resulttype = std::common_type_t; // Type promotion, without the const-ness resulttype alphar = 0.0; auto N = molefracs.size(); - for (auto i = 0; i < N; ++i) { + for (auto i = 0U; i < N; ++i) { alphar = alphar + molefracs[i] * EOSs[i].alphar(tau, delta); } return forceeval(alphar); @@ -164,7 +164,7 @@ class MultiFluid { const RhoType &rho, const MoleFracType& molefrac) const { - if (molefrac.size() != corr.size()){ + if (static_cast(molefrac.size()) != corr.size()){ throw teqp::InvalidArgument("Wrong size of mole fractions; "+std::to_string(corr.size()) + " are loaded but "+std::to_string(molefrac.size()) + " were provided"); } auto Tred = forceeval(redfunc.get_Tr(molefrac)); diff --git a/include/teqp/types.hpp b/include/teqp/types.hpp index 85b2ba28..19a937ef 100644 --- a/include/teqp/types.hpp +++ b/include/teqp/types.hpp @@ -60,7 +60,7 @@ namespace teqp { /// A constexpr function for ensuring that an argument to a function is NOT an expr, /// which can have surprising behavior template - void error_if_expr(T&& expr) + void error_if_expr(T&& /*expr*/) { using namespace autodiff::detail; if constexpr (isExpr) { diff --git a/interface/C/teqpc.cpp b/interface/C/teqpc.cpp index 20a49474..df6d95b9 100644 --- a/interface/C/teqpc.cpp +++ b/interface/C/teqpc.cpp @@ -149,6 +149,7 @@ TEST_CASE("Use of C interface","[teqpc]") { }; std::string js = j.dump(2); int e1 = build_model(js.c_str(), &uuidMF, errmsg, errmsg_length); + REQUIRE(e1 == 0); } { nlohmann::json jmodel = nlohmann::json::object(); diff --git a/src/tests/GERG2008.cpp b/src/tests/GERG2008.cpp index adca4d78..5b50a4bd 100644 --- a/src/tests/GERG2008.cpp +++ b/src/tests/GERG2008.cpp @@ -64,7 +64,7 @@ // Kunz, O., Klimeck, R., Wagner, W., and Jaeschke, M. // The GERG-2004 Wide-Range Equation of State for Natural Gases and Other Mixtures // GERG Technical Monograph 15 -// Fortschr.-Ber. VDI, Reihe 6, Nr. 557, VDI Verlag, Düsseldorf, 2007. +// Fortschr.-Ber. VDI, Reihe 6, Nr. 557, VDI Verlag, Dusseldorf, 2007. // http://www.gerg.eu/public/uploads/files/publications/technical_monographs/tm15_04.pdf // Subroutines contained here for property calculations: diff --git a/src/tests/catch_test_GERG.cxx b/src/tests/catch_test_GERG.cxx index eca5f984..a2b4f9a4 100644 --- a/src/tests/catch_test_GERG.cxx +++ b/src/tests/catch_test_GERG.cxx @@ -23,7 +23,7 @@ TEST_CASE("Load all GERG2004 models", "[GERG2004]"){ } CHECK_THROWS(GERG2004::get_pure_info("NOT A FLUID")); - for (auto i = 0; i < names.size(); ++i){ + for (auto i = 0U; i < names.size(); ++i){ for (auto j = i+1; j < names.size(); ++j){ CHECK_NOTHROW(GERG2004::get_betasgammas(names[i], names[j])); CHECK_NOTHROW(GERG2004::get_betasgammas(names[j], names[i])); @@ -61,7 +61,7 @@ TEST_CASE("Load all GERG2008 models", "[GERG2008]"){ } CHECK_THROWS(GERG2008::get_pure_info("NOT A FLUID")); - for (auto i = 0; i < names.size(); ++i){ + for (auto i = 0U; i < names.size(); ++i){ for (auto j = i+1; j < names.size(); ++j){ CHECK_NOTHROW(GERG2008::get_betasgammas(names[i], names[j])); CHECK_NOTHROW(GERG2008::get_betasgammas(names[j], names[i])); @@ -498,7 +498,7 @@ TEST_CASE("Validate all GERG2008 binaries", "[GERG20082]"){ double R = 8.314472; - for (auto i = 0; i < components.size(); ++i){ + for (auto i = 0U; i < components.size(); ++i){ for(auto j = i+1; j < components.size(); ++j){ double T_K = 300; @@ -546,7 +546,7 @@ TEST_CASE("Validate all GERG2008 models", "[GERG2008]"){ auto model = GERG2008::GERG2008ResidualModel(components); SetupGERG(); - for (auto i = 0; i < validation_data.size(); ++i){ + for (auto i = 0U; i < validation_data.size(); ++i){ double p_given_MPa = validation_data[i].P_MPa; double rho = validation_data[i].D_molL*1e3; diff --git a/src/tests/catch_test_Grayiteration.cxx b/src/tests/catch_test_Grayiteration.cxx index ddcbdca7..3dd0c6fd 100644 --- a/src/tests/catch_test_Grayiteration.cxx +++ b/src/tests/catch_test_Grayiteration.cxx @@ -246,7 +246,6 @@ TEST_CASE("Test critical points against Kiyohara results", "[polarizability]"){ double Tstar = Tc/epsilon_over_kB; double rhostar = rhoc*N_A*pow(sigma_m,3); std::cout << mustar << "," << alphastar << "," << Tstar << "," << rhostar << std::endl; - int tt =0; } } } diff --git a/src/tests/catch_test_SAFTpolar.cxx b/src/tests/catch_test_SAFTpolar.cxx index 544bc3a2..0b245e12 100644 --- a/src/tests/catch_test_SAFTpolar.cxx +++ b/src/tests/catch_test_SAFTpolar.cxx @@ -26,6 +26,7 @@ TEST_CASE("Evaluation of J^{(n)}", "[LuckasJn]") { LuckasJIntegral J12{12}; auto Jval = J12.get_J(3.0, 1.0); + CHECK(Jval != 0); } TEST_CASE("Evaluation of K(xxx, yyy)", "[LuckasKnn]") @@ -218,7 +219,7 @@ TEST_CASE("Check Stockmayer critical points with polarity terms", "[SAFTVRMiepol if (print) std::cout << "0, " << Tstar_guess << ", " << rhostar_guess << std::endl; double mustar2factor = 1.0/(4*static_cast(EIGEN_PI)*8.8541878128e-12*1.380649e-23); - double Qstar2factor = 1.0/(4*static_cast(EIGEN_PI)*8.8541878128e-12*1.380649e-23); +// double Qstar2factor = 1.0/(4*static_cast(EIGEN_PI)*8.8541878128e-12*1.380649e-23); j["model"]["polar_model"] = polar_model; for (double mustar2 = 0.1; mustar2 < 5; mustar2 += 0.1){ diff --git a/src/tests/catch_test_alphaig.cxx b/src/tests/catch_test_alphaig.cxx index b765f7cd..9c4598d1 100644 --- a/src/tests/catch_test_alphaig.cxx +++ b/src/tests/catch_test_alphaig.cxx @@ -8,7 +8,7 @@ using Catch::Approx; using namespace teqp; -nlohmann::json demo_pure_term(double a_1, double a_2){ +nlohmann::json demo_pure_term(double /*a_1*/, double /*a_2*/){ nlohmann::json j0 = nlohmann::json::array(); j0.push_back({ {"type", "Lead"}, { "a_1", 1 }, { "a_2", 2 } }); return {{"R", 8.31446261815324}, {"terms", j0}}; diff --git a/src/tests/catch_test_cubics.cxx b/src/tests/catch_test_cubics.cxx index 4011b0eb..ef1e3c70 100644 --- a/src/tests/catch_test_cubics.cxx +++ b/src/tests/catch_test_cubics.cxx @@ -414,7 +414,7 @@ TEST_CASE("Check manual integration of subcritical VLE isobar for binary mixture double pfinal = get_p(X0, T); double diffs = 0; - for (auto i = 0; i < X0.size(); ++i) { + for (auto i = 0U; i < X0.size(); ++i) { diffs += std::abs(pinit-pfinal); } CHECK(diffs < 0.1); diff --git a/src/tests/catch_test_mutant.cxx b/src/tests/catch_test_mutant.cxx index 26d0d522..36b4bc01 100644 --- a/src/tests/catch_test_mutant.cxx +++ b/src/tests/catch_test_mutant.cxx @@ -168,7 +168,6 @@ TEST_CASE("Test infinite dilution critical locus derivatives for multifluid muta auto infdil = ct::get_drhovec_dT_crit(mutant, T0, rhovec0); auto der = ct::get_derivs(mutant, T0, rhovec0); auto epinfdil = ct::eigen_problem(mutant, T0, rhovec0); - using tdx = TDXDerivatives; auto z = (rhovec0 / rhovec0.sum()).eval(); auto alphar = mutant.alphar(T0, rhoc0, z); return std::make_tuple(T0, rhoc0, alphar, infdil, der);