Skip to content

Commit

Permalink
[Transport] Deprecate logging of property fits
Browse files Browse the repository at this point in the history
Superseded by programmatic availability of polynomial coefficients
and error metrics.
  • Loading branch information
speth committed Dec 4, 2024
1 parent 508aeda commit b785e49
Show file tree
Hide file tree
Showing 13 changed files with 56 additions and 14 deletions.
5 changes: 3 additions & 2 deletions include/cantera/transport/GasTransport.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ class GasTransport : public Transport
double* bstar_coeffs,
double* cstar_coeffs, bool actualT) override;

void init(ThermoPhase* thermo, int mode=0, int log_level=0) override;
void init(ThermoPhase* thermo, int mode=0, int log_level=-7) override;

bool CKMode() const override {
return m_mode == CK_Mode;
Expand Down Expand Up @@ -541,7 +541,8 @@ class GasTransport : public Transport
//! Quadrupole polarizability
vector<double> m_quad_polar;

//! Level of verbose printing during initialization
//! Level of verbose printing during initialization.
//! @deprecated To be removed after %Cantera 3.1.
int m_log_level = 0;
};

Expand Down
2 changes: 1 addition & 1 deletion include/cantera/transport/IonGasTransport.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class IonGasTransport : public MixTransport
return "ionized-gas";
}

void init(ThermoPhase* thermo, int mode, int log_level) override;
void init(ThermoPhase* thermo, int mode, int log_level=-7) override;

//! Viscosity of the mixture (kg/m/s).
//! Only Neutral species contribute to Viscosity.
Expand Down
2 changes: 1 addition & 1 deletion include/cantera/transport/MixTransport.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class MixTransport : public GasTransport
size_t ldx, const double* const grad_X,
size_t ldf, double* const fluxes) override;

void init(ThermoPhase* thermo, int mode=0, int log_level=0) override;
void init(ThermoPhase* thermo, int mode=0, int log_level=-7) override;

protected:
//! Update the temperature dependent parts of the species thermal
Expand Down
2 changes: 1 addition & 1 deletion include/cantera/transport/MultiTransport.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class MultiTransport : public GasTransport
void getMassFluxes(const double* state1, const double* state2, double delta,
double* fluxes) override;

void init(ThermoPhase* thermo, int mode=0, int log_level=0) override;
void init(ThermoPhase* thermo, int mode=0, int log_level=-7) override;

protected:
//! Update basic temperature-dependent quantities if the temperature has
Expand Down
4 changes: 3 additions & 1 deletion include/cantera/transport/Transport.h
Original file line number Diff line number Diff line change
Expand Up @@ -413,8 +413,10 @@ class Transport
* @param mode Chemkin compatible mode or not. This alters the
* specification of the collision integrals. defaults to no.
* @param log_level Defaults to zero, no logging
* @deprecated The `log_level` parameter is deprecated and will be removed after
* %Cantera 3.1.
*/
virtual void init(ThermoPhase* thermo, int mode=0, int log_level=0) {}
virtual void init(ThermoPhase* thermo, int mode=0, int log_level=-7) {}

//! Boolean indicating the form of the transport properties polynomial fits.
//! Returns true if the Chemkin form is used.
Expand Down
10 changes: 8 additions & 2 deletions include/cantera/transport/TransportFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,22 @@ class TransportFactory : public Factory<Transport>
* @param model String name for the transport manager
* @param thermo ThermoPhase object
* @param log_level log level
*
* @deprecated The `log_level` parameter is deprecated and will be removed after
* %Cantera 3.1.
*/
Transport* newTransport(const string& model, ThermoPhase* thermo, int log_level=0);
Transport* newTransport(const string& model, ThermoPhase* thermo, int log_level=-7);

//! Build a new transport manager using the default transport manager
//! in the phase description and return a base class pointer to it
/*!
* @param thermo ThermoPhase object
* @param log_level log level
*
* @deprecated The `log_level` parameter is deprecated and will be removed after
* %Cantera 3.1.
*/
Transport* newTransport(ThermoPhase* thermo, int log_level=0);
Transport* newTransport(ThermoPhase* thermo, int log_level=-7);

private:
//! Static instance of the factor -> This is the only instance of this
Expand Down
2 changes: 1 addition & 1 deletion include/cantera/transport/WaterTransport.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class WaterTransport : public Transport
*/
double thermalConductivity() override;

void init(ThermoPhase* thermo, int mode=0, int log_level=0) override;
void init(ThermoPhase* thermo, int mode=0, int log_level=-7) override;
};
}
#endif
10 changes: 8 additions & 2 deletions src/transport/GasTransport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ void GasTransport::update_T()
{
if (m_thermo->nSpecies() != m_nsp) {
// Rebuild data structures if number of species has changed
init(m_thermo, m_mode, m_log_level);
init(m_thermo, m_mode, m_log_level != 0 ? m_log_level : -7);
}

double T = m_thermo->temperature();
Expand Down Expand Up @@ -263,6 +263,12 @@ void GasTransport::init(ThermoPhase* thermo, int mode, int log_level)
m_thermo = thermo;
m_nsp = m_thermo->nSpecies();
m_mode = mode;
if (log_level == -7) {
log_level = 0;
} else {
warn_deprecated("Transport::init", "The log_level parameter "
"is deprecated and will be removed after Cantera 3.1.");
}
m_log_level = log_level;

// set up Monchick and Mason collision integrals
Expand Down Expand Up @@ -372,7 +378,7 @@ void GasTransport::setupCollisionIntegral()
// initialize the collision integral calculator for the desired T* range
debuglog("*** collision_integrals ***\n", m_log_level);
MMCollisionInt integrals;
integrals.init(tstar_min, tstar_max, m_log_level);
integrals.init(tstar_min, tstar_max, m_log_level != 0 ? m_log_level : -7);
fitCollisionIntegrals(integrals);
debuglog("*** end of collision_integrals ***\n", m_log_level);
// make polynomial fits
Expand Down
6 changes: 6 additions & 0 deletions src/transport/IonGasTransport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ void IonGasTransport::init(ThermoPhase* thermo, int mode, int log_level)
throw CanteraError("IonGasTransport::init",
"mode = CK_Mode, which is an outdated lower-order fit.");
}
if (log_level == -7) {
log_level = 0;
} else {
warn_deprecated("Transport::init", "The log_level parameter "
"is deprecated and will be removed after Cantera 3.1.");
}
m_log_level = log_level;
// make a local copy of species charge
for (size_t k = 0; k < m_nsp; k++) {
Expand Down
6 changes: 6 additions & 0 deletions src/transport/MMCollisionInt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,12 @@ double MMCollisionInt::cstar_table[39*8] = {

void MMCollisionInt::init(double tsmin, double tsmax, int log_level)
{
if (log_level == -7) {
log_level = 0;
} else {
warn_deprecated("MMCollisionInt::init", "The log_level parameter "
"is deprecated and will be removed after Cantera 3.1.");
}
m_loglevel = log_level;
debuglog("Collision Integral Polynomial Fits\n", m_loglevel > 0);
m_nmin = -1;
Expand Down
4 changes: 3 additions & 1 deletion src/transport/MMCollisionInt.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ class MMCollisionInt
* @param tsmax Maximum value of Tstar to carry out the fitting
* @param loglevel Set the loglevel for the object. The default
* loglevel is zero, indicating no output.
* @deprecated The `log_level` parameter is deprecated and will be removed after
* %Cantera 3.1.
*/
void init(double tsmin, double tsmax, int loglevel = 0);
void init(double tsmin, double tsmax, int loglevel = -7);

double omega22(double ts, double deltastar);
double astar(double ts, double deltastar);
Expand Down
12 changes: 10 additions & 2 deletions src/transport/TransportFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ void TransportFactory::deleteFactory()
Transport* TransportFactory::newTransport(const string& transportModel,
ThermoPhase* phase, int log_level)
{
if (log_level != -7) {
warn_deprecated("TransportFactory::newTransport", "The log_level parameter "
"is deprecated and will be removed after Cantera 3.1.");
}
if (transportModel != "DustyGas" && canonicalize(transportModel) == "none") {
return create(transportModel);
}
Expand Down Expand Up @@ -98,6 +102,10 @@ Transport* TransportFactory::newTransport(const string& transportModel,

Transport* TransportFactory::newTransport(ThermoPhase* phase, int log_level)
{
if (log_level != -7) {
warn_deprecated("TransportFactory::newTransport", "The log_level parameter "
"is deprecated and will be removed after Cantera 3.1.");
}
string transportModel = "none";
AnyMap& input = phase->input();
if (input.hasKey("transport")) {
Expand All @@ -110,9 +118,9 @@ shared_ptr<Transport> newTransport(shared_ptr<ThermoPhase> thermo, const string&
{
Transport* tr;
if (model == "default") {
tr = TransportFactory::factory()->newTransport(thermo.get(), 0);
tr = TransportFactory::factory()->newTransport(thermo.get());
} else {
tr = TransportFactory::factory()->newTransport(model, thermo.get(), 0);
tr = TransportFactory::factory()->newTransport(model, thermo.get());
}
return shared_ptr<Transport>(tr);
}
Expand Down
5 changes: 5 additions & 0 deletions src/transport/WaterTransport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "cantera/thermo/VPStandardStateTP.h"
#include "cantera/thermo/PDSS_Water.h"
#include "cantera/thermo/WaterSSTP.h"
#include "cantera/base/global.h"

namespace {

Expand All @@ -32,6 +33,10 @@ namespace Cantera

void WaterTransport::init(ThermoPhase* thermo, int mode, int log_level)
{
if (log_level != -7) {
warn_deprecated("Transport::init", "The log_level parameter "
"is deprecated and will be removed after Cantera 3.1.");
}
m_thermo = thermo;
}

Expand Down

0 comments on commit b785e49

Please sign in to comment.