[Transport] Remove 'name' variable from TransportData
This was used only for validation error messages, but in that case we can just use the Species object which is available during validation.
This commit is contained in:
parent
7d170a9989
commit
aee6cc14ac
4 changed files with 22 additions and 33 deletions
|
|
@ -15,13 +15,9 @@ class TransportData
|
|||
{
|
||||
public:
|
||||
TransportData() {}
|
||||
explicit TransportData(const std::string& name);
|
||||
virtual ~TransportData() {}
|
||||
|
||||
virtual void validate(const Species& species) {}
|
||||
|
||||
//! The name of the species
|
||||
std::string name;
|
||||
};
|
||||
|
||||
//! Transport data for a single gas-phase species which can be used in
|
||||
|
|
@ -31,16 +27,16 @@ class GasTransportData : public TransportData
|
|||
public:
|
||||
GasTransportData();
|
||||
|
||||
GasTransportData(const std::string& name, const std::string& geometry,
|
||||
double diameter, double well_depth, double dipole=0.0,
|
||||
GasTransportData(const std::string& geometry, double diameter,
|
||||
double well_depth, double dipole=0.0,
|
||||
double polarizability=0.0, double rot_relax=0.0,
|
||||
double acentric=0.0);
|
||||
|
||||
//! Set the parameters using "customary" units: diameter in Angstroms, well
|
||||
//! depth in Kelvin, dipole in Debye, and polarizability in Angstroms^3.
|
||||
//! These are the units used in in CK-style input files.
|
||||
void setCustomaryUnits(const std::string& name, const std::string& geometry,
|
||||
double diameter, double well_depth, double dipole=0.0,
|
||||
void setCustomaryUnits(const std::string& geometry, double diameter,
|
||||
double well_depth, double dipole=0.0,
|
||||
double polarizability=0.0, double rot_relax=0.0,
|
||||
double acentric=0.0);
|
||||
|
||||
|
|
|
|||
|
|
@ -646,8 +646,8 @@ bool installSpecies(size_t k, const XML_Node& s, thermo_t& th,
|
|||
getOptionalFloat(tr, "acentric_factor", acentric);
|
||||
|
||||
GasTransportData* gastran = new GasTransportData;
|
||||
gastran->setCustomaryUnits(sp->name, geometry, diam, welldepth,
|
||||
dipole, polar, rot, acentric);
|
||||
gastran->setCustomaryUnits(geometry, diam, welldepth,
|
||||
dipole, polar, rot, acentric);
|
||||
sp->transport.reset(gastran);
|
||||
gastran->validate(*sp);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,11 +8,6 @@
|
|||
namespace Cantera
|
||||
{
|
||||
|
||||
TransportData::TransportData(const std::string& name_)
|
||||
: name(name_)
|
||||
{
|
||||
}
|
||||
|
||||
GasTransportData::GasTransportData()
|
||||
: diameter(0.0)
|
||||
, well_depth(0.0)
|
||||
|
|
@ -24,11 +19,10 @@ GasTransportData::GasTransportData()
|
|||
}
|
||||
|
||||
GasTransportData::GasTransportData(
|
||||
const std::string& name_, const std::string& geometry_,
|
||||
const std::string& geometry_,
|
||||
double diameter_, double well_depth_, double dipole_,
|
||||
double polarizability_, double rot_relax, double acentric)
|
||||
: TransportData(name_)
|
||||
, geometry(geometry_)
|
||||
: geometry(geometry_)
|
||||
, diameter(diameter_)
|
||||
, well_depth(well_depth_)
|
||||
, dipole(dipole_)
|
||||
|
|
@ -39,11 +33,10 @@ GasTransportData::GasTransportData(
|
|||
}
|
||||
|
||||
void GasTransportData::setCustomaryUnits(
|
||||
const std::string& name_, const std::string& geometry_,
|
||||
const std::string& geometry_,
|
||||
double diameter_, double well_depth_, double dipole_,
|
||||
double polarizability_, double rot_relax, double acentric)
|
||||
{
|
||||
name = name_;
|
||||
geometry = geometry_;
|
||||
diameter = 1e-10 * diameter_; // convert from Angstroms to m
|
||||
well_depth = Boltzmann * well_depth_; // convert from K to J
|
||||
|
|
@ -65,51 +58,51 @@ void GasTransportData::validate(const Species& sp)
|
|||
if (geometry == "atom") {
|
||||
if (nAtoms != 1) {
|
||||
throw CanteraError("GasTransportData::validate",
|
||||
"invalid geometry for species '" + name + "'. 'atom' specified,"
|
||||
" but species contains multiple atoms.");
|
||||
"invalid geometry for species '" + sp.name + "'. 'atom' "
|
||||
"specified, but species contains multiple atoms.");
|
||||
}
|
||||
} else if (geometry == "linear") {
|
||||
if (nAtoms == 1) {
|
||||
throw CanteraError("GasTransportData::validate",
|
||||
"invalid geometry for species '" + name + "'. 'linear'"
|
||||
"invalid geometry for species '" + sp.name + "'. 'linear'"
|
||||
" specified, but species only contains one atom.");
|
||||
}
|
||||
} else if (geometry == "nonlinear") {
|
||||
if (nAtoms < 3) {
|
||||
throw CanteraError("GasTransportData::validate",
|
||||
"invalid geometry for species '" + name + "'. 'nonlinear'"
|
||||
"invalid geometry for species '" + sp.name + "'. 'nonlinear'"
|
||||
" specified, but species only contains " + fp2str(nAtoms) +
|
||||
" atoms.");
|
||||
}
|
||||
} else {
|
||||
throw CanteraError("GasTransportData::validate",
|
||||
"invalid geometry for species '" + name + "': '" +
|
||||
"invalid geometry for species '" + sp.name + "': '" +
|
||||
geometry + "'.");
|
||||
}
|
||||
|
||||
if (well_depth < 0.0) {
|
||||
throw CanteraError("GasTransportData::validate",
|
||||
"negative well depth for species '" + name + "'.");
|
||||
"negative well depth for species '" + sp.name + "'.");
|
||||
}
|
||||
|
||||
if (diameter <= 0.0) {
|
||||
throw CanteraError("GasTransportData::validate",
|
||||
"negative or zero diameter for species '" + name + "'.");
|
||||
"negative or zero diameter for species '" + sp.name + "'.");
|
||||
}
|
||||
|
||||
if (dipole < 0.0) {
|
||||
throw CanteraError("GasTransportData::validate",
|
||||
"negative dipole moment for species '" + name + "'.");
|
||||
"negative dipole moment for species '" + sp.name + "'.");
|
||||
}
|
||||
|
||||
if (polarizability < 0.0) {
|
||||
throw CanteraError("GasTransportData::validate",
|
||||
"negative polarizability for species '" + name + "'.");
|
||||
"negative polarizability for species '" + sp.name + "'.");
|
||||
}
|
||||
|
||||
if (rotational_relaxation < 0.0) {
|
||||
throw CanteraError("GasTransportData::validate",
|
||||
"negative rotation relaxation number for species '" + name + "'");
|
||||
"negative rotation relaxation number for species '" + sp.name + "'");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,9 +29,9 @@ public:
|
|||
sO2->thermo.reset(new NasaPoly2(200, 3500, 101325, o2_nasa_coeffs));
|
||||
sH2O->thermo.reset(new NasaPoly2(200, 3500, 101325, h2o_nasa_coeffs));
|
||||
|
||||
tH2->setCustomaryUnits("H2", "linear", 2.92, 38.0, 0.0, 0.79, 280.0);
|
||||
tO2->setCustomaryUnits("O2", "linear", 3.46, 107.40, 0.0, 1.60, 3.80);
|
||||
tH2O->setCustomaryUnits("H2O", "nonlinear", 2.60, 572.4, 1.84, 0.0, 4.00);
|
||||
tH2->setCustomaryUnits("linear", 2.92, 38.0, 0.0, 0.79, 280.0);
|
||||
tO2->setCustomaryUnits("linear", 3.46, 107.40, 0.0, 1.60, 3.80);
|
||||
tH2O->setCustomaryUnits("nonlinear", 2.60, 572.4, 1.84, 0.0, 4.00);
|
||||
|
||||
sH2->transport = tH2;
|
||||
sO2->transport = tO2;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue