Esempio n. 1
0
size_t IdealGasReactor::componentIndex(const string& nm) const
{
    size_t k = speciesIndex(nm);
    if (k != npos) {
        return k + 3;
    } else if (nm == "m" || nm == "mass") {
        if (nm == "m") {
            warn_deprecated("IdealGasReactor::componentIndex(\"m\")",
                "Using the name 'm' for mass is deprecated, and will be "
                "disabled after Cantera 2.3. Use 'mass' instead.");
        }
        return 0;
    } else if (nm == "V" || nm == "volume") {
        if (nm == "V") {
            warn_deprecated("IdealGasReactor::componentIndex(\"V\")",
                "Using the name 'V' for volume is deprecated, and will be "
                "disabled after Cantera 2.3. Use 'volume' instead.");
        }
        return 1;
    } else if (nm == "T" || nm == "temperature") {
        if (nm == "T") {
            warn_deprecated("IdealGasReactor::componentIndex(\"T\")",
                "Using the name 'T' for temperature is deprecated, and will be "
                "disabled after Cantera 2.3. Use 'temperature' instead.");
        }
        return 2;
    } else {
        return npos;
    }
}
Esempio n. 2
0
size_t Reactor::componentIndex(const string& nm) const
{
    size_t k = speciesIndex(nm);
    if (k != npos) {
        return k + 3;
    } else if (nm == "m" || nm == "mass") {
        if (nm == "m") {
            warn_deprecated("Reactor::componentIndex(\"m\")",
                "Using the name 'm' for mass is deprecated, and will be "
                "disabled after Cantera 2.3. Use 'mass' instead.");
        }
        return 0;
    } else if (nm == "V" || nm == "volume") {
        if (nm == "V") {
            warn_deprecated("Reactor::componentIndex(\"V\")",
                "Using the name 'V' for volume is deprecated, and will be "
                "disabled after Cantera 2.3. Use 'volume' instead.");
        }
        return 1;
    } else if (nm == "U" || nm == "int_energy") {
        if (nm == "U") {
            warn_deprecated("Reactor::componentIndex(\"U\")",
                "Using the name 'U' for internal energy is deprecated, and "
                "will be disabled after Cantera 2.3. Use 'int_energy' instead.");
        }
        return 2;
    } else {
        return npos;
    }
}
Esempio n. 3
0
void ImplicitSurfChem::getInitialConditions(doublereal t0, size_t lenc,
        doublereal* c)
{
    warn_deprecated("ImplicitSurfChem::getInitialConditions",
        "Use getState instead. To be removed after Cantera 2.3.");
    getState(c);
}
Esempio n. 4
0
//=====================================================================================================================
std::string logfileName(const std::string& infile)
{
    warn_deprecated("logfileName", "To be removed after Cantera 2.2.");
    std::string logfile = getBaseName(infile);
    logfile += ".log";
    return logfile;
}
Esempio n. 5
0
void MetalSHEelectrons::getParameters(int& n, doublereal* const c) const
{
    warn_deprecated("MetalSHEelectrons::getParameters");
    doublereal rho = density();
    n = 1;
    c[0] = rho;
}
Esempio n. 6
0
void Phase::addElement(const XML_Node& e)
{
    warn_deprecated("Phase::addElement(XML_Node&)",
                    "To be removed after Cantera 2.2.");
    doublereal weight = 0.0;
    if (e.hasAttrib("atomicWt")) {
        weight = fpValue(stripws(e["atomicWt"]));
    }
    int anum = 0;
    if (e.hasAttrib("atomicNumber")) {
        anum = atoi(stripws(e["atomicNumber"]).c_str());
    }
    string symbol = e["name"];
    doublereal entropy298 = ENTROPY298_UNKNOWN;
    if (e.hasChild("entropy298")) {
        XML_Node& e298Node = e.child("entropy298");
        if (e298Node.hasAttrib("value")) {
            entropy298 = fpValueCheck(stripws(e298Node["value"]));
        }
    }
    if (weight != 0.0) {
        addElement(symbol, weight, anum, entropy298);
    } else {
        addElement(symbol);
    }
}
void ConstPressureReactor::getInitialConditions(double t0, size_t leny,
        double* y)
{
    warn_deprecated("ConstPressureReactor::getInitialConditions",
                    "Use getState instead. To be removed after Cantera 2.3.");
    getState(y);
}
Esempio n. 8
0
void Phase::addElementsFromXML(const XML_Node& phase)
{
    warn_deprecated("Phase::addElementsFromXML",
                    "Use 'addElements' function. "
                    "To be removed after Cantera 2.2.");
    installElements(*this, phase);
}
void PDSS_IonsFromNeutral::constructPDSSFile(VPStandardStateTP* tp, size_t spindex,
        const std::string& inputFile, const std::string& id)
{
    warn_deprecated("PDSS_IonsFromNeutral::constructPDSSFile",
                    "To be removed after Cantera 2.3.");
    if (inputFile.size() == 0) {
        throw CanteraError("PDSS_IonsFromNeutral::constructPDSSFile",
                           "input file is null");
    }
    std::string path = findInputFile(inputFile);
    ifstream fin(path);
    if (!fin) {
        throw CanteraError("PDSS_IonsFromNeutral::constructPDSSFile","could not open "
                           +path+" for reading.");
    }

    // The phase object automatically constructs an XML object. Use this object
    // to store information.
    XML_Node fxml;
    fxml.build(fin);
    XML_Node* fxml_phase = findXMLPhase(&fxml, id);
    if (!fxml_phase) {
        throw CanteraError("PDSS_IonsFromNeutral::constructPDSSFile",
                           "ERROR: Can not find phase named " +
                           id + " in file named " + inputFile);
    }

    XML_Node& speciesList = fxml_phase->child("speciesArray");
    XML_Node* speciesDB = get_XML_NameID("speciesData", speciesList["datasrc"],
                                         &fxml_phase->root());
    const XML_Node* s = speciesDB->findByAttr("name", tp->speciesName(spindex));
    constructPDSSXML(tp, spindex, *s, *fxml_phase, id);
}
Esempio n. 10
0
std::string string16_EOSType(int EOSType)
{
    warn_deprecated("string16_EOSType", "Use vcs_VolPhase::eos_name instead."
        " To be removed after Cantera 2.3.");
    char st[32];
    st[16] = '\0';
    switch (EOSType) {
    case VCS_EOS_CONSTANT:
        sprintf(st,"Constant        ");
        break;
    case VCS_EOS_IDEAL_GAS:
        sprintf(st,"Ideal Gas       ");
        break;
    case VCS_EOS_STOICH_SUB:
        sprintf(st,"Stoich Sub      ");
        break;
    case VCS_EOS_IDEAL_SOLN:
        sprintf(st,"Ideal Soln      ");
        break;
    case VCS_EOS_DEBEYE_HUCKEL:
        sprintf(st,"Debeye Huckel   ");
        break;
    case VCS_EOS_REDLICK_KWONG:
        sprintf(st,"Redlick_Kwong   ");
        break;
    case VCS_EOS_REGULAR_SOLN:
        sprintf(st,"Regular Soln    ");
        break;
    default:
        sprintf(st,"UnkType: %-7d", EOSType);
        break;
    }
    st[16] = '\0';
    return st;
}
Esempio n. 11
0
void StoichSubstanceSSTP::getParameters(int& n, doublereal* const c) const
{
    warn_deprecated("StoichSubstanceSSTP::getParameters");
    doublereal rho = density();
    n = 1;
    c[0] = rho;
}
MultiSpeciesThermo&
MultiSpeciesThermo::operator=(const MultiSpeciesThermo& b)
{
    warn_deprecated("MultiSpeciesThermo assignment operator",
        "To be removed after Cantera 2.3");
    if (&b == this) {
        return *this;
    }

    m_sp.clear();
    // Copy SpeciesThermoInterpType objects from 'b'
    for (const auto& sp : b.m_sp) {
        for (size_t k = 0; k < sp.second.size(); k++) {
            size_t i = sp.second[k].first;
            shared_ptr<SpeciesThermoInterpType> spec(
                sp.second[k].second->duplMyselfAsSpeciesThermoInterpType());
            m_sp[sp.first].emplace_back(i, spec);
        }
    }

    m_tpoly = b.m_tpoly;
    m_speciesLoc = b.m_speciesLoc;
    m_tlow_max = b.m_tlow_max;
    m_thigh_min = b.m_thigh_min;
    m_p0 = b.m_p0;
    return *this;
}
Esempio n. 13
0
GasTransportParams::GasTransportParams() :
    TransportParams(),
    visccoeffs(0),
    condcoeffs(0),
    diffcoeffs(0),
    poly(0),
    omega22_poly(0),
    astar_poly(0),
    bstar_poly(0),
    cstar_poly(0),
    zrot(0),
    crot(0),
    polar(0),
    alpha(0),
    fitlist(0),
    eps(0),
    sigma(0),
    reducedMass(0, 0),
    diam(0, 0),
    epsilon(0, 0),
    dipole(0, 0),
    delta(0, 0)
{
    warn_deprecated("class GasTransportParams",
                    "To be removed after Cantera 2.2.");
}
Esempio n. 14
0
SpeciesThermo* SpeciesThermoFactory::newSpeciesThermoManager(const std::string& stype) const
{
    warn_deprecated("SpeciesThermoFactory::newSpeciesThermo",
        "To be removed after Cantera 2.2. Use class GeneralSpeciesThermo directly.");
    std::string ltype = lowercase(stype);
    if (ltype == "nasa") {
        return new NasaThermo;
    } else if (ltype == "shomate") {
        return new ShomateThermo;
    } else if (ltype ==  "simple" || ltype == "constant_cp") {
        return new SimpleThermo;
    } else if (ltype ==  "nasa_shomate_duo") {
        return new SpeciesThermoDuo<NasaThermo, ShomateThermo>;
    } else if (ltype ==  "nasa_simple_duo") {
        return new SpeciesThermoDuo<NasaThermo, SimpleThermo>;
    } else if (ltype ==  "shomate_simple_duo") {
        return new SpeciesThermoDuo<ShomateThermo, SimpleThermo>;
    } else if (ltype ==   "general") {
        return new GeneralSpeciesThermo();
    } else if (ltype ==  "") {
        return (SpeciesThermo*) 0;
    } else {
        throw UnknownSpeciesThermo("SpeciesThermoFactory::newSpeciesThermoManager",
                                   stype);
    }
    return (SpeciesThermo*) 0;
}
Esempio n. 15
0
void PDSS_IdealGas::constructPDSSFile(VPStandardStateTP* tp, size_t spindex,
                                      const std::string& inputFile,
                                      const std::string& id)
{
    warn_deprecated("PDSS_IdealGas::constructPDSSFile",
                    "To be removed after Cantera 2.3.");
    if (inputFile.size() == 0) {
        throw CanteraError("PDSS_IdealGas::constructPDSSFile",
                           "input file is null");
    }
    std::string path = findInputFile(inputFile);
    ifstream fin(path);
    if (!fin) {
        throw CanteraError("PDSS_IdealGas::constructPDSSFile","could not open "
                           +path+" for reading.");
    }
    /*
     * The phase object automatically constructs an XML object.
     * Use this object to store information.
     */

    XML_Node fxml;
    fxml.build(fin);
    XML_Node* fxml_phase = findXMLPhase(&fxml, id);
    if (!fxml_phase) {
        throw CanteraError("PDSS_IdealGas::constructPDSSFile",
                           "ERROR: Can not find phase named " +
                           id + " in file named " + inputFile);
    }
    constructPDSSXML(tp, spindex, *fxml_phase, id);
}
Esempio n. 16
0
void BandMatrix::copyData(const GeneralMatrix& y)
{
    warn_deprecated("BandMatrix::copyData", "To be removed after Cantera 2.2.");
    m_factored = false;
    size_t n = sizeof(doublereal) * m_n * (2 *m_kl + m_ku + 1);
    GeneralMatrix* yyPtr = const_cast<GeneralMatrix*>(&y);
    (void) memcpy(DATA_PTR(data), yyPtr->ptrColumn(0), n);
}
Esempio n. 17
0
void StoichSubstance::getUnitsStandardConc(double* uA, int k, int sizeUA) const
{
    warn_deprecated("StoichSubstance::getUnitsStandardConc",
                "To be removed after Cantera 2.2.");
    for (int i = 0; i < sizeUA; i++) {
        uA[i] = 0.0;
    }
}
Esempio n. 18
0
void TransportFactory::initTransport(Transport* tr, thermo_t* thermo,
                                     int mode, int log_level)
{
    warn_deprecated("TransportFactory::initTransport",
                    "To be removed after Cantera 2.2. This initialization is "
                    "now handled directly by GasTransport::init");
    tr->init(thermo);
}
Esempio n. 19
0
PDSS_IdealGas::PDSS_IdealGas(VPStandardStateTP* tp, int spindex,
                             const std::string& inputFile, const std::string& id) :
    PDSS(tp, spindex)
{
    warn_deprecated("PDSS_IdealGas constructor from XML input file",
                    "To be removed after Cantera 2.3.");
    m_pdssType = cPDSS_IDEALGAS;
    constructPDSSFile(tp, spindex, inputFile, id);
}
Esempio n. 20
0
SpeciesThermo* newSpeciesThermoMgr(int type, SpeciesThermoFactory* f)
{
    warn_deprecated("newSpeciesThermoMgr", "To be removed after Cantera 2.2. "
        "Use class GeneralSpeciesThermo directly.");
    if (f == 0) {
        f = SpeciesThermoFactory::factory();
    }
    return f->newSpeciesThermo(type);
}
Esempio n. 21
0
void Phase::addUniqueElement(const std::string& symbol, doublereal weight,
                             int atomic_number, doublereal entropy298,
                             int elem_type)
{
    warn_deprecated("Phase::addUniqueElement",
                    "Equivalent to Phase::addElement. "
                    "To be removed after Cantera 2.2.");
    addElement(symbol, weight, atomic_number, entropy298, elem_type);
}
Esempio n. 22
0
void ReactorNet::addReactor(Reactor* r, bool iown)
{
    warn_deprecated("ReactorNet::addReactor(Reactor*)",
        "To be removed after Cantera 2.2. Use 'addReactor(Reactor&) instead'.");
    if (iown) {
        warn_deprecated("ReactorNet::addReactor",
            "Ownership of Reactors by ReactorNet is deprecated.");
    }
    r->setNetwork(this);
    if (r->type() >= ReactorType) {
        m_reactors.push_back(r);
        m_iown.push_back(iown);
        writelog("Adding reactor "+r->name()+"\n", m_verbose);
    } else {
        writelog("Not adding reactor "+r->name()+
                 ", since type = "+int2str(r->type())+"\n", m_verbose);
    }
}
Esempio n. 23
0
double vcs_VolPhase::AC_calc_one(size_t kspec) const
{
    warn_deprecated("vcs_VolPhase::AC_calc_one",
                    "Unused. To be removed after Cantera 2.3.");
    if (! m_UpToDate_AC) {
        _updateActCoeff();
    }
    return ActCoeff[kspec];
}
Esempio n. 24
0
void SurfPhase::setParameters(int n, doublereal* const c)
{
    warn_deprecated("SurfPhase::setParameters");
    if (n != 1) {
        throw CanteraError("SurfPhase::setParameters",
                           "Bad value for number of parameter");
    }
    setSiteDensity(c[0]);
}
Esempio n. 25
0
PDSS_ConstVol::PDSS_ConstVol(VPStandardStateTP* tp, size_t spindex,
                             const std::string& inputFile, const std::string& id) :
    PDSS(tp, spindex)
{
    warn_deprecated("PDSS_ConstVol constructor from XML input file",
                    "To be removed after Cantera 2.3.");
    m_pdssType = cPDSS_CONSTVOL;
    constructPDSSFile(tp, spindex, inputFile, id);
}
Esempio n. 26
0
size_t Phase::addUniqueElementAfterFreeze(const std::string& symbol,
        doublereal weight, int atomicNumber,
        doublereal entropy298, int elem_type)
{
    warn_deprecated("Phase::addUniqueElementAfterFreeze",
                    "Equivalent to Phase::addElement. "
                    "To be removed after Cantera 2.2");
    return addElement(symbol, weight, atomicNumber, entropy298, elem_type);
}
Transport::Transport(const Transport& right)
{
    warn_deprecated("Transport copy constructor", "To be removed after"
        " Cantera 2.3 for all classes derived from Transport.");
    m_thermo = right.m_thermo;
    m_ready = right.m_ready;
    m_nsp = right.m_nsp;
    m_nDim = right.m_nDim;
    m_velocityBasis = right.m_velocityBasis;
}
Esempio n. 28
0
SpeciesThermo* newSpeciesThermoMgr(std::vector<XML_Node*> spData_nodes,
                                   SpeciesThermoFactory* f)
{
    warn_deprecated("newSpeciesThermoMgr", "To be removed after Cantera 2.2. "
        "Use class GeneralSpeciesThermo directly.");
    if (f == 0) {
        f = SpeciesThermoFactory::factory();
    }
    return f->newSpeciesThermo(spData_nodes);
}
Esempio n. 29
0
SpeciesThermoFactory* SpeciesThermoFactory::factory()
{
    warn_deprecated("class SpeciesThermoFactory",
                    "To be removed after Cantera 2.2.");
    ScopedLock lock(species_thermo_mutex);
    if (!s_factory) {
        s_factory = new SpeciesThermoFactory;
    }
    return s_factory;
}
Esempio n. 30
0
void Phase::getMoleFractionsByName(compositionMap& x) const
{
    warn_deprecated("void Phase::getMoleFractionsByName(compositionMap&)",
                    "To be removed after Cantera 2.2. Use"
                    " 'compositionMap getMoleFractionsByName(double threshold)'"
                    " instead");
    x.clear();
    size_t kk = nSpecies();
    for (size_t k = 0; k < kk; k++) {
        x[speciesName(k)] = Phase::moleFraction(k);
    }
}