24 #include "cantera/base/XML_Writer.h"
40 #define COLL_INT_POLY_DEGREE 8
46 const doublereal ThreeSixteenths = 3.0/16.0;
47 const doublereal TwoOverPi = 2.0/
Pi;
48 const doublereal FiveThirds = 5.0/3.0;
51 TransportFactory* TransportFactory::s_factory = 0;
54 mutex_t TransportFactory::transport_mutex;
68 CanteraError(
"getTransportData",
"error reading transport data: " + msg +
"\n") {
74 void TransportFactory::getBinDiffCorrection(doublereal t,
76 size_t k,
size_t j, doublereal xk, doublereal xj,
77 doublereal& fkj, doublereal& fjk)
79 doublereal w1, w2, wsum, sig1, sig2, sig12, sigratio, sigratio2,
80 sigratio3, tstar1, tstar2, tstar12,
81 om22_1, om22_2, om11_12, astar_12, bstar_12, cstar_12,
82 cnst, wmwp, sqw12, p1, p2, p12, q1, q2, q12;
87 wmwp = (w1 - w2)/wsum;
93 sigratio = sig1*sig1/(sig2*sig2);
94 sigratio2 = sig1*sig1/(sig12*sig12);
95 sigratio3 = sig2*sig2/(sig12*sig12);
101 om22_1 = integrals.omega22(tstar1, tr.
delta(k,k));
102 om22_2 = integrals.omega22(tstar2, tr.
delta(j,j));
103 om11_12 = integrals.omega11(tstar12, tr.
delta(k,j));
104 astar_12 = integrals.astar(tstar12, tr.
delta(k,j));
105 bstar_12 = integrals.bstar(tstar12, tr.
delta(k,j));
106 cstar_12 = integrals.cstar(tstar12, tr.
delta(k,j));
108 cnst = sigratio * sqrt(2.0*w2/wsum) * 2.0 *
110 p1 = cnst * om22_1 / om11_12;
112 cnst = (1.0/sigratio) * sqrt(2.0*w1/wsum) * 2.0*w2*w2/(wsum*w1);
113 p2 = cnst * om22_2 / om11_12;
115 p12 = 15.0 * wmwp*wmwp + 8.0*w1*w2*astar_12/(wsum*wsum);
117 cnst = (2.0/(w2*wsum))*sqrt(2.0*w2/wsum)*sigratio2;
118 q1 = cnst*((2.5 - 1.2*bstar_12)*w1*w1 + 3.0*w2*w2
119 + 1.6*w1*w2*astar_12);
121 cnst = (2.0/(w1*wsum))*sqrt(2.0*w1/wsum)*sigratio3;
122 q2 = cnst*((2.5 - 1.2*bstar_12)*w2*w2 + 3.0*w1*w1
123 + 1.6*w1*w2*astar_12);
125 q12 = wmwp*wmwp*15.0*(2.5 - 1.2*bstar_12)
126 + 4.0*w1*w2*astar_12*(11.0 - 2.4*bstar_12)/(wsum*wsum)
127 + 1.6*wsum*om22_1*om22_2/(om11_12*om11_12*sqw12)
128 * sigratio2 * sigratio3;
130 cnst = 6.0*cstar_12 - 5.0;
131 fkj = 1.0 + 0.1*cnst*cnst *
132 (p1*xk*xk + p2*xj*xj + p12*xk*xj)/
133 (q1*xk*xk + q2*xj*xj + q12*xk*xj);
134 fjk = 1.0 + 0.1*cnst*cnst *
135 (p2*xk*xk + p1*xj*xj + p12*xk*xj)/
136 (q2*xk*xk + q1*xj*xj + q12*xk*xj);
139 void TransportFactory::makePolarCorrections(
size_t i,
size_t j,
152 size_t kp = (tr.
polar[i] ? i : j);
153 size_t knp = (i == kp ? j : i);
155 doublereal d3np, d3p, alpha_star, mu_p_star, xi;
156 d3np = pow(tr.
sigma[knp],3);
157 d3p = pow(tr.
sigma[kp],3);
158 alpha_star = tr.
alpha[knp]/d3np;
159 mu_p_star = tr.
dipole(kp,kp)/sqrt(d3p * tr.
eps[kp]);
160 xi = 1.0 + 0.25 * alpha_star * mu_p_star * mu_p_star *
161 sqrt(tr.
eps[kp]/tr.
eps[knp]);
162 f_sigma = pow(xi, -1.0/6.0);
166 TransportFactory::TransportFactory() :
170 m_models[
"Multi"] = cMulticomponent;
171 m_models[
"Solid"] = cSolidTransport;
172 m_models[
"DustyGas"] = cDustyGasTransport;
173 m_models[
"CK_Multi"] = CK_Multicomponent;
174 m_models[
"CK_Mix"] = CK_MixtureAveraged;
175 m_models[
"Liquid"] = cLiquidTransport;
176 m_models[
"Aqueous"] = cAqueousTransport;
177 m_models[
"Simple"] = cSimpleTransport;
179 m_models[
"Pecos"] = cPecosTransport;
182 for (map<string, int>::iterator iter =
m_models.begin();
211 m_LTImodelMap[
"pairwiseInteraction"] = LTI_MODEL_PAIRWISE_INTERACTION;
212 m_LTImodelMap[
"stefanMaxwell_PPN"] = LTI_MODEL_STEFANMAXWELL_PPN;
213 m_LTImodelMap[
"moleFractionsExpT"] = LTI_MODEL_MOLEFRACS_EXPT;
228 map<int, string>::iterator iter = f.
m_modelNames.find(model);
240 std::string model =
lowercase(trNode[
"model"]);
242 case LTP_TD_CONSTANT:
245 case LTP_TD_ARRHENIUS:
255 throw CanteraError(
"newLTP",
"unknown transport model: " + model);
256 ltps =
new LTPspecies(&trNode, name, tp_ind, thermo);
269 std::string model = trNode[
"model"];
271 case LTI_MODEL_SOLVENT:
272 lti =
new LTI_Solvent(tp_ind);
273 lti->
init(trNode, thermo);
275 case LTI_MODEL_MOLEFRACS:
277 lti->
init(trNode, thermo);
279 case LTI_MODEL_MASSFRACS:
281 lti->
init(trNode, thermo);
283 case LTI_MODEL_LOG_MOLEFRACS:
285 lti->
init(trNode, thermo);
287 case LTI_MODEL_PAIRWISE_INTERACTION:
289 lti->
init(trNode, thermo);
290 lti->setParameters(trParam);
292 case LTI_MODEL_STEFANMAXWELL_PPN:
294 lti->
init(trNode, thermo);
295 lti->setParameters(trParam);
297 case LTI_MODEL_STOKES_EINSTEIN:
298 lti =
new LTI_StokesEinstein(tp_ind);
299 lti->
init(trNode, thermo);
300 lti->setParameters(trParam);
302 case LTI_MODEL_MOLEFRACS_EXPT:
304 lti->
init(trNode, thermo);
309 lti->
init(trNode, thermo);
315 thermo_t* phase,
int log_level,
int ndim)
318 if (transportModel ==
"") {
332 case cMulticomponent:
336 case CK_Multicomponent:
340 case cMixtureAveraged:
344 case CK_MixtureAveraged:
349 case cPecosTransport:
353 case cSolidTransport:
359 case cDustyGasTransport:
366 case cSimpleTransport:
371 case cLiquidTransport:
376 case cAqueousTransport:
382 throw CanteraError(
"newTransport",
"unknown transport model: " + transportModel);
394 if (!phaseNode.
hasChild(
"transport")) {
396 "no transport XML node");
399 std::string transportModel = transportNode.
attrib(
"model");
400 if (transportModel ==
"") {
402 "transport XML node doesn't have a model string");
414 size_t nsp = tr.
nsp_;
431 tr.
polar.resize(nsp,
false);
432 tr.
alpha.resize(nsp, 0.0);
434 tr.
sigma.resize(nsp);
440 for (
size_t i = 0; i < nsp; i++) {
441 tr.
poly[i].resize(nsp);
444 doublereal ts1, ts2, tstar_min = 1.e8, tstar_max = 0.0;
445 doublereal f_eps, f_sigma;
450 for (
size_t i = 0; i < nsp; i++) {
451 for (
size_t j = i; j < nsp; j++) {
459 epsilon(i,j) = sqrt(tr.
eps[i]*tr.
eps[j]);
465 if (ts1 < tstar_min) {
468 if (ts2 > tstar_max) {
476 doublereal d = diam(i,j);
478 / (epsilon(i,j) * d * d * d);
481 tr.
diam(i,j) *= f_sigma;
482 epsilon(i,j) *= f_eps;
486 diam(j,i) = diam(i,j);
487 epsilon(j,i) = epsilon(i,j);
496 if (mode == CK_Mode) {
506 tr.
xml->XML_open(flog,
"collision_integrals");
510 integrals.
init(tr.
xml, tstar_min, tstar_max, log_level);
514 tr.
xml->XML_close(flog,
"collision_integrals");
520 tr.
xml->XML_open(flog,
"property fits");
526 tr.
xml->XML_close(flog,
"property fits");
535 const std::vector<const XML_Node*> & species_database = thermo->
speciesData();
541 size_t nsp = trParam.
nsp_;
548 trParam.
mw.resize(nsp);
553 trParam.
LTData.resize(nsp);
570 if (phase_database->
hasChild(
"transport")) {
571 XML_Node& transportNode = phase_database->
child(
"transport");
585 int nsp = trParam.
nsp_;
592 trParam.
mw.resize(nsp);
608 if (phase_database->
hasChild(
"transport")) {
609 XML_Node& transportNode = phase_database->
child(
"transport");
615 thermo_t* thermo,
int mode,
int log_level)
619 const std::vector<const XML_Node*> & transport_database = thermo->
speciesData();
623 if (log_level == 0) {
626 ofstream flog(
"transport_log.xml");
627 trParam.
xml =
new XML_Writer(flog);
629 trParam.
xml->XML_open(flog,
"transport");
633 std::ostream& flog(std::cout);
636 setupMM(flog, transport_database, thermo, mode, log_level, trParam);
641 trParam.
xml->XML_close(flog,
"transport");
655 ofstream flog(
"transport_log.xml");
656 trParam.
xml =
new XML_Writer(flog);
658 trParam.
xml->XML_open(flog,
"transport");
662 std::ostream& flog(std::cout);
669 trParam.
xml->XML_close(flog,
"transport");
685 ofstream flog(
"transport_log.xml");
686 trParam.
xml =
new XML_Writer(flog);
688 trParam.
xml->XML_open(flog,
"transport");
692 std::ostream& flog(std::cout);
703 trParam.
xml->XML_close(flog,
"transport");
715 vector_fp::iterator dptr;
717 size_t nsp = tr.
nsp_;
725 tr.
xml->XML_open(logfile,
"tstar_fits");
726 tr.
xml->XML_comment(logfile,
"fits to A*, B*, and C* vs. log(T*).\n"
727 "These are done only for the required dstar(j,k) values.");
729 tr.
xml->XML_comment(logfile,
"*** polynomial coefficients not printed (log_level < 3) ***");
733 for (i = 0; i < nsp; i++) {
734 for (j = i; j < nsp; j++) {
736 if (mode != CK_Mode) {
737 dstar = tr.
delta(i,j);
749 if (dptr == tr.
fitlist.end()) {
750 vector_fp ca(degree+1), cb(degree+1), cc(degree+1);
752 integrals.fit(logfile, degree, dstar,
754 integrals.fit_omega22(logfile, degree, dstar,
767 tr.
poly[i][j] =
static_cast<int>((dptr - tr.
fitlist.begin()));
774 tr.
xml->XML_close(logfile,
"tstar_fits");
782 std::map<std::string, size_t> speciesIndices;
783 for (
size_t i = 0; i < names.size(); i++) {
784 speciesIndices[names[i]] = i;
787 for (
size_t i = 0; i < xspecies.size(); i++) {
791 std::map<std::string, size_t>::const_iterator iter =
792 speciesIndices.find(sp[
"name"]);
794 if (iter != speciesIndices.end()) {
807 std::string geom = (geomNode) ? geomNode->
value() :
"";
808 if (geom ==
"atom") {
810 }
else if (geom ==
"linear") {
812 }
else if (geom ==
"nonlinear") {
820 if (welldepth >= 0.0) {
829 tr.
sigma[j] = 1.e-10 * diam;
839 tr.
polar[j] = (dipole > 0.0);
847 tr.
alpha[j] = 1.e-30 * polar;
856 tr.
zrot[j] = std::max(1.0, rot);
865 const std::vector<std::string> &names,
872 std::map<std::string, LiquidTransportData> datatable;
873 std::map<std::string, LiquidTransportData>::iterator it;
876 size_t nsp = trParam.
nsp_;
879 size_t nBinInt = nsp*(nsp-1)/2;
884 for (
size_t i = 0; i < nsp; i++) {
904 for (
size_t iChild = 0; iChild < num; iChild++) {
906 std::string nodeName = xmlChild.
name();
912 case TP_IONCONDUCTIVITY:
915 case TP_MOBILITYRATIO: {
916 for (
size_t iSpec = 0; iSpec< nBinInt; iSpec++) {
918 std::string specName = propSpecNode.
name();
919 size_t loc = specName.find(
":");
920 std::string firstSpec = specName.substr(0,loc);
921 std::string secondSpec = specName.substr(loc+1);
927 case TP_SELFDIFFUSION: {
928 for (
size_t iSpec = 0; iSpec< nsp; iSpec++) {
930 std::string specName = propSpecNode.
name();
931 size_t index = temp_thermo->
speciesIndex(specName.c_str());
962 throw CanteraError(
"getLiquidSpeciesTransportData",
"unknown transport property: " + nodeName);
966 datatable.insert(pair<std::string, LiquidTransportData>(name,data));
975 for (
size_t i = 0; i < trParam.
nsp_; i++) {
980 it = datatable.find(names[i]);
981 if (it == datatable.end()) {
982 throw TransportDBError(0,
"No transport data found for species " + names[i]);
990 trParam.
LTData.push_back(trdat);
1005 const std::vector<std::string> &names,
1010 size_t nsp = trParam.
nsp_;
1011 size_t nBinInt = nsp*(nsp-1)/2;
1014 for (
size_t iChild = 0; iChild < num; iChild++) {
1017 std::string nodeName = tranTypeNode.
name();
1024 if (tranTypeNode.
hasChild(
"compositionDependence")) {
1026 XML_Node& compDepNode = tranTypeNode.
child(
"compositionDependence");
1032 case TP_IONCONDUCTIVITY:
1037 case TP_MOBILITYRATIO: {
1038 for (
size_t iSpec = 0; iSpec< nBinInt; iSpec++) {
1040 string specName = propSpecNode.
name();
1041 size_t loc = specName.find(
":");
1042 string firstSpec = specName.substr(0,loc);
1043 string secondSpec = specName.substr(loc+1);
1051 case TP_SELFDIFFUSION: {
1052 for (
size_t iSpec = 0; iSpec< nsp; iSpec++) {
1054 string specName = propSpecNode.
name();
1055 size_t index = temp_thermo->
speciesIndex(specName.c_str());
1062 case TP_THERMALCOND:
1067 case TP_DIFFUSIVITY:
1072 case TP_HYDRORADIUS:
1083 throw CanteraError(
"getLiquidInteractionsTransportData",
"unknown transport property: " + nodeName);
1095 if (tranTypeNode.
hasChild(
"velocityBasis")) {
1096 std::string velocityBasis =
1097 tranTypeNode.
child(
"velocityBasis").
attrib(
"basis");
1098 if (velocityBasis ==
"mass") {
1100 }
else if (velocityBasis ==
"mole") {
1105 int linenum = __LINE__;
1106 throw TransportDBError(linenum,
"Unknown attribute \"" + velocityBasis +
"\" for <velocityBasis> node. ");
1111 std::cout << err.
what() << std::endl;
1118 const std::string phaseName,
1124 for (
int iChild = 0; iChild < num; iChild++) {
1127 std::string nodeName = tranTypeNode.
name();
1134 case TP_IONCONDUCTIVITY:
1139 case TP_THERMALCOND:
1160 throw CanteraError(
"getSolidTransportData",
"unknown transport property: " + nodeName);
1182 const size_t np = 50;
1184 int mode = tr.
mode_;
1185 int degree = (mode == CK_Mode ? 3 : 4);
1188 doublereal dt = (tr.
tmax - tr.
tmin)/(np-1);
1189 vector_fp tlog(np), spvisc(np), spcond(np);
1190 doublereal val, fit;
1195 for (
size_t n = 0; n < np; n++) {
1201 vector_fp c(degree + 1), c2(degree + 1);
1208 tr.
xml->XML_comment(logfile,
1209 "*** polynomial coefficients not printed (log_level < 2) ***");
1212 doublereal sqrt_T, visc, err, relerr,
1213 mxerr = 0.0, mxrelerr = 0.0, mxerr_cond = 0.0, mxrelerr_cond = 0.0;
1217 tr.
xml->XML_open(logfile,
"viscosity");
1218 tr.
xml->XML_comment(logfile,
"Polynomial fits for viscosity");
1219 if (mode == CK_Mode) {
1220 tr.
xml->XML_comment(logfile,
"log(viscosity) fit to cubic "
1221 "polynomial in log(T)");
1223 sprintf(s,
"viscosity/sqrt(T) fit to "
1224 "polynomial of degree %d in log(T)",degree);
1225 tr.
xml->XML_comment(logfile,s);
1230 doublereal cp_R, cond, w_RT, f_int, A_factor, B_factor,
1231 c1, cv_rot, cv_int, f_rot, f_trans, om11;
1232 doublereal diffcoeff;
1234 for (
size_t k = 0; k < tr.
nsp_; k++) {
1235 for (
size_t n = 0; n < np; n++) {
1243 om22 = integrals.omega22(tstar, tr.
delta(k,k));
1244 om11 = integrals.omega11(tstar, tr.
delta(k,k));
1248 diffcoeff = ThreeSixteenths *
1260 f_int = w_RT * diffcoeff/visc;
1261 cv_rot = tr.
crot[k];
1263 A_factor = 2.5 - f_int;
1264 B_factor = tr.
zrot[k] + TwoOverPi
1265 *(FiveThirds * cv_rot + f_int);
1266 c1 = TwoOverPi * A_factor/B_factor;
1267 cv_int = cp_R - 2.5 - cv_rot;
1269 f_rot = f_int * (1.0 + c1);
1270 f_trans = 2.5 * (1.0 - c1 * cv_rot/1.5);
1273 + f_rot * cv_rot + f_int * cv_int);
1275 if (mode == CK_Mode) {
1276 spvisc[n] = log(visc);
1277 spcond[n] = log(cond);
1289 spvisc[n] = sqrt(visc/sqrt_T);
1296 spcond[n] = cond/sqrt_T;
1297 w[n] = 1.0/(spvisc[n]*spvisc[n]);
1298 w2[n] = 1.0/(spcond[n]*spcond[n]);
1307 for (
size_t n = 0; n < np; n++) {
1308 if (mode == CK_Mode) {
1309 val = exp(spvisc[n]);
1312 sqrt_T = exp(0.5*tlog[n]);
1313 val = sqrt_T * pow(spvisc[n],2);
1318 if (fabs(err) > mxerr) {
1321 if (fabs(relerr) > mxrelerr) {
1322 mxrelerr = fabs(relerr);
1327 for (
size_t n = 0; n < np; n++) {
1328 if (mode == CK_Mode) {
1329 val = exp(spcond[n]);
1332 sqrt_T = exp(0.5*tlog[n]);
1333 val = sqrt_T * spcond[n];
1338 if (fabs(err) > mxerr_cond) {
1339 mxerr_cond = fabs(err);
1341 if (fabs(relerr) > mxrelerr_cond) {
1342 mxrelerr_cond = fabs(relerr);
1357 sprintf(s,
"Maximum viscosity absolute error: %12.6g", mxerr);
1358 tr.
xml->XML_comment(logfile,s);
1359 sprintf(s,
"Maximum viscosity relative error: %12.6g", mxrelerr);
1360 tr.
xml->XML_comment(logfile,s);
1361 tr.
xml->XML_close(logfile,
"viscosity");
1364 tr.
xml->XML_open(logfile,
"conductivity");
1365 tr.
xml->XML_comment(logfile,
"Polynomial fits for conductivity");
1366 if (mode == CK_Mode)
1367 tr.
xml->XML_comment(logfile,
"log(conductivity) fit to cubic "
1368 "polynomial in log(T)");
1370 sprintf(s,
"conductivity/sqrt(T) fit to "
1371 "polynomial of degree %d in log(T)",degree);
1372 tr.
xml->XML_comment(logfile,s);
1375 for (
size_t k = 0; k < tr.
nsp_; k++) {
1379 sprintf(s,
"Maximum conductivity absolute error: %12.6g", mxerr_cond);
1380 tr.
xml->XML_comment(logfile,s);
1381 sprintf(s,
"Maximum conductivity relative error: %12.6g", mxrelerr_cond);
1382 tr.
xml->XML_comment(logfile,s);
1383 tr.
xml->XML_close(logfile,
"conductivity");
1387 tr.
xml->XML_open(logfile,
"binary_diffusion_coefficients");
1388 tr.
xml->XML_comment(logfile,
"binary diffusion coefficients");
1389 if (mode == CK_Mode)
1390 tr.
xml->XML_comment(logfile,
"log(D) fit to cubic "
1391 "polynomial in log(T)");
1393 sprintf(s,
"D/T**(3/2) fit to "
1394 "polynomial of degree %d in log(T)",degree);
1395 tr.
xml->XML_comment(logfile,s);
1400 mxerr = 0.0, mxrelerr = 0.0;
1402 doublereal eps, sigma;
1403 for (
size_t k = 0; k < tr.
nsp_; k++) {
1404 for (
size_t j = k; j < tr.
nsp_; j++) {
1405 for (
size_t n = 0; n < np; n++) {
1411 sigma = tr.
diam(j,k);
1412 om11 = integrals.omega11(tstar, tr.
delta(j,k));
1414 diffcoeff = ThreeSixteenths *
1417 (
Pi * sigma * sigma * om11);
1422 doublereal fkj, fjk;
1427 if (mode == CK_Mode) {
1428 diff[n] = log(diffcoeff);
1431 diff[n] = diffcoeff/pow(t, 1.5);
1432 w[n] = 1.0/(diff[n]*diff[n]);
1439 for (
size_t n = 0; n < np; n++) {
1440 if (mode == CK_Mode) {
1446 val = pre * diff[n];
1451 if (fabs(err) > mxerr) {
1454 if (fabs(relerr) > mxrelerr) {
1455 mxrelerr = fabs(relerr);
1469 sprintf(s,
"Maximum binary diffusion coefficient absolute error:"
1471 tr.
xml->XML_comment(logfile,s);
1472 sprintf(s,
"Maximum binary diffusion coefficient relative error:"
1473 "%12.6g", mxrelerr);
1474 tr.
xml->XML_comment(logfile,s);
1475 tr.
xml->XML_close(logfile,
"binary_diffusion_coefficients");
LTPspecies * defectDiffusivity
Model type for the defectDiffusivity – or more like a defect diffusivity in the context of the solid ...
doublereal tmin
Minimum temperatures for parameter fits.
R poly3(D x, R *c)
Templated evaluation of a polynomial of order 3.
Headers for the DustyGasTransport object, which models transport properties in porous media using the...
Class PecosTransport implements mixture-averaged transport properties for ideal gas mixtures...
DenseMatrix diam
hard-sphere diameter for (i,j) collision
TransportPropertyType
Enumeration of the types of transport properties that can be handled by the variables in the various ...
void restoreState(const vector_fp &state)
Restore a state saved on a previous call to saveState.
DenseMatrix radius_Aij
Interaction associated with hydrodynamic radius.
This structure holds transport model parameters relevant to transport in ideal gases with a kinetic t...
void getTransportData(const std::vector< const XML_Node * > &xspecies, XML_Node &log, const std::vector< std::string > &names, GasTransportParams &tr)
Read the transport database.
void init(XML_Writer *xml, doublereal tsmin, doublereal tsmax, int loglevel=0)
Initialize the object for calculation.
CTML ("Cantera Markup Language") is the variant of XML that Cantera uses to store data...
std::vector< LiquidTranInteraction * > mobilityRatio
Vector of pointer to the LiquidTranInteraction object which handles the calculation of each species' ...
vector_fp alpha
Polarizability of each species in the phase.
thermo_t * thermo
Pointer to the ThermoPhase object.
std::vector< vector_fp > omega22_poly
This is vector of vectors containing the astar fit.
std::string attrib(const std::string &attr) const
Function returns the value of an attribute.
virtual Transport * newTransport(const std::string &model, thermo_t *thermo, int log_level=0, int ndim=1)
Build a new transport manager using a transport manager that may not be the same as in the phase desc...
std::vector< vector_fp > astar_poly
This is vector of vectors containing the astar fit.
LTPspecies * thermalCond
Model type for the thermal conductivity.
Simple mass fraction weighting of transport properties.
void showErrors(std::ostream &f)
Prints all of the error messages to an ostream.
Class IdealGasPhase represents low-density gases that obey the ideal gas equation of state...
Factory class for creating new instances of classes derived from Transport.
Interface for class MultiTransport.
LTPspecies * defectActivity
Model type for the defectActivity.
const doublereal FiveSixteenths
5/16
void getSolidTransportData(const XML_Node &transportNode, XML_Node &log, const std::string phaseName, SolidTransportData &tr)
Read transport property data from a file for a solid phase.
size_t nsp_
Local storage of the number of species.
doublereal tmax
Maximum temperatures for parameter fits.
Transport * newTransportMgr(const std::string &transportModel, thermo_t *thermo, int loglevel, TransportFactory *f, int ndim)
Create a new transport manager instance.
Class LiquidTransport implements models for transport properties for liquid phases.
Class DustyGasTransport implements the Dusty Gas model for transport in porous media.
Class XML_Node is a tree-based representation of the contents of an XML file.
Header file defining class SolidTransportData.
Transport properties that act like pairwise interactions as in binary diffusion coefficients.
Base class for transport property managers.
const doublereal SqrtTen
sqrt(10)
doublereal getFloat(const Cantera::XML_Node &parent, const std::string &name, const std::string &type)
Get a floating-point value from a child element.
void fitProperties(GasTransportParams &tr, MMCollisionInt &integrals, std::ostream &logfile)
Generate polynomial fits to the viscosity, conductivity, and the binary diffusion coefficients...
std::map< int, std::string > m_modelNames
Inverse mapping of transport models, from integer constant to string.
LiquidTranInteraction * viscosity
Object that specifies the viscosity interaction for the mixture.
Class LiquidTransportData holds transport parameters for a specific liquid-phase species.
vector_fp sigma
Lennard-Jones diameter of the species in the current phase.
virtual bool initSolid(SolidTransportData &tr)
Called by TransportFactory to set parameters.
Class LTPspecies_Arrhenius holds transport parameters for a specific liquid-phase species (LTPspecies...
std::string lowercase(const std::string &s)
Cast a copy of a string to lower case.
This file contains definitions for utility functions and text for modules, inputfiles, logs, textlogs, HTML_logs (see Input File Handling, Diagnostic Output, Writing messages to the screen and Writing HTML Logfiles).
void getLiquidSpeciesTransportData(const std::vector< const XML_Node * > &db, XML_Node &log, const std::vector< std::string > &names, LiquidTransportParams &tr)
Read transport property data from a file for a list of species that comprise the phase.
Header file defining class PecosTransport.
DenseMatrix reducedMass
This is the reduced mass of the interaction between species i and j.
virtual void initTransport(Transport *tr, thermo_t *thermo, int mode=0, int log_level=0)
Initialize an existing transport manager.
C interface for Fortran DPOLFT subroutine.
vector_fp fitlist
This is vector containing the values of delta(i,j) that are used in the collision integral fits...
std::string name() const
Return the name of the phase.
LTPspecies * electConductivity
Model type for the electrical conductivity.
LTPspecies * speciesDiffusivity
Model type for the speciesDiffusivity.
Header file for defining the class SolidTransport, which handles transport of ions within solid phase...
Monk and Monchick collision integrals.
static TransportFactory * s_factory
Static instance of the factor -> This is the only instance of this object allowed.
std::vector< vector_fp > cstar_poly
This is vector of vectors containing the astar fit.
XML_Node & child(const size_t n) const
Return a changeable reference to the n'th child of the current node.
Header file defining class TransportFactory (see TransportFactory)
Class SolidTransport implements transport properties for solids.
std::vector< vector_fp > diffcoeffs
temperature-fits of the diffusivity
XML_Node * getByTitle(const Cantera::XML_Node &node, const std::string &title)
Search the child nodes of the current node for an XML Node with a Title attribute of a given name...
R poly4(D x, R *c)
Evaluates a polynomial of order 4.
Base class for a phase with thermodynamic properties.
static std::string modelName(int model)
Get the name of the transport model corresponding to the specified constant.
Class LiquidTransportParams holds transport model parameters relevant to transport in mixtures...
void getLiquidInteractionsTransportData(const XML_Node &phaseTran_db, XML_Node &log, const std::vector< std::string > &names, LiquidTransportParams &tr)
Read transport property data from a file for interactions between species.
std::vector< LiquidTranInteraction * > selfDiffusion
Vector of pointer to the LiquidTranInteraction object which handles the calculation of each species' ...
void getBinDiffCorrection(doublereal t, const GasTransportParams &tr, MMCollisionInt &integrals, size_t k, size_t j, doublereal xk, doublereal xj, doublereal &fkj, doublereal &fjk)
Second-order correction to the binary diffusion coefficients.
Header file defining class LiquidTransportParams.
doublereal polyfit(int n, doublereal *x, doublereal *y, doublereal *w, int maxdeg, int &ndeg, doublereal eps, doublereal *r)
Fits a polynomial function to a set of data points.
size_t speciesIndex(const std::string &name) const
Returns the index of a species named 'name' within the Phase object.
vector_fp zrot
Rotational relaxation number for the species in the current phase.
LiquidTranInteraction * ionConductivity
Object that specifes the ionic Conductivity of the mixture.
void resize(size_t n, size_t m, doublereal v=0.0)
Resize the matrix.
vector_fp eps
Lennard-Jones well-depth of the species in the current phase.
VelocityBasis velocityBasis_
A basis for the average velocity can be specified.
std::vector< bool > polar
Vector of booleans indicating whether a species is a polar molecule.
Mixing rule using logarithms of the mole fractions.
ThermoPhase object for the ideal gas equation of state - workhorse for Cantera (see Thermodynamic Pro...
#define COLL_INT_POLY_DEGREE
polynomial degree used for fitting collision integrals except in CK mode, where the degree is 6...
const char * what() const
Get a description of the error.
Header file defining the class LiquidTranInteraction and classes which derive from LiquidTranInteract...
std::map< std::string, TransportPropertyType > m_tranPropMap
Mapping between between the string name for a transport property and the integer name.
void setupSolidTransport(std::ostream &flog, thermo_t *thermo, int log_level, SolidTransportData &trParam)
Prepare to build a new transport manager for solids.
virtual doublereal maxTemp(size_t k=npos) const
Maximum temperature for which the thermodynamic data for the species are valid.
std::map< std::string, LiquidTranMixingModel > m_LTImodelMap
Mapping between between the string name for a liquid mixture transport property model and the integer...
std::string name() const
Returns the name of the XML node.
Header file for the class SimpleTransport which provides simple transport properties for liquids and ...
Classes providing support for XML data files.
virtual LiquidTranInteraction * newLTI(const XML_Node &trNode, TransportPropertyType tp_ind, LiquidTransportParams &trParam)
Factory function for the construction of new LiquidTranInteraction objects, which are transport model...
void initialize(ThermoPhase *phase, Transport *gastr)
Initialization routine called by TransportFactory.
DenseMatrix thermalCond_Aij
Interaction associated with linear weighting of thermal conductivity.
Base class for exceptions thrown by Cantera classes.
std::map< std::string, int > m_models
Mapping between between the string name for a transport model and the integer name.
Header file defining class AqueousTransport.
bool hasChild(const std::string &ch) const
Tests whether the current node has a child node with a particular name.
void setupMM(std::ostream &flog, const std::vector< const XML_Node * > &transport_database, thermo_t *thermo, int mode, int log_level, GasTransportParams &tr)
Prepare to build a new kinetic-theory-based transport manager for low-density gases.
bool m_verbose
Boolean indicating whether to turn on verbose printing.
Class LTPspecies_Const holds transport parameters for a specific liquid-phase species (LTPspecies) wh...
TransportDBError(int linenum, const std::string &msg)
Default constructor.
DenseMatrix delta
Matrix containing the reduced dipole moment of the interaction between two species.
LiquidTranInteraction * speciesDiffusivity
Pointer to the LiquidTranInteraction object which handles the calculation of the species diffusivity ...
vector_fp crot
Dimensionless rotational heat capacity of the species in the current phase.
DenseMatrix epsilon
The effective well depth for (i,j) collisions.
Class LTPspecies holds transport parameters for a specific liquid-phase species.
vector_fp mw
Local storage of the molecular weights of the species.
Simple mole fraction weighting of transport properties.
static TransportFactory * factory()
Return a pointer to a TransportFactory instance.
void makePolarCorrections(size_t i, size_t j, const GasTransportParams &tr, doublereal &f_eps, doublereal &f_sigma)
Corrections for polar-nonpolar binary diffusion coefficients.
std::vector< Cantera::LiquidTransportData > LTData
Species transport parameters.
std::vector< vector_fp > bstar_poly
This is vector of vectors containing the astar fit.
virtual void initLiquidTransport(Transport *tr, thermo_t *thermo, int log_level=0)
Initialize an existing transport manager for liquid phase.
size_t nSpecies() const
Returns the number of species in the phase.
std::vector< std::vector< int > > poly
This is vector of vectors containing the integer lookup value for the (i,j) interaction.
Class MultiTransport implements multicomponent transport properties for ideal gas mixtures...
const std::vector< std::string > & speciesNames() const
Return a const reference to the vector of species names.
std::string value() const
Return the value of an XML node as a string.
const vector_fp & molecularWeights() const
Return a const reference to the internal vector of molecular weights.
const doublereal Avogadro
Avogadro's Number [number/kmol].
std::map< std::string, LTPTemperatureDependenceType > m_LTRmodelMap
Mapping between between the string name for a species-specific transport property model and the integ...
const VelocityBasis VB_MOLEAVG
Diffusion velocities are based on the mole averaged velocities.
LTPspecies * electCond
Model type for the electrical conductivity.
Class LTPspecies_ExpT holds transport parameters for a specific liquid- phase species (LTPspecies) wh...
Header file defining class LiquidTransport.
void setupLiquidTransport(std::ostream &flog, thermo_t *thermo, int log_level, LiquidTransportParams &trParam)
Prepare to build a new transport manager for liquids assuming that viscosity transport data is provid...
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
DenseMatrix dipole
The effective dipole moment for (i,j) collisions.
virtual bool initLiquid(LiquidTransportParams &tr)
Called by TransportFactory to set parameters.
std::vector< vector_fp > visccoeffs
temperature-fit of the viscosity
virtual void setTemperature(const doublereal temp)
Set the internally stored temperature of the phase (K).
std::string speciesName
A LiquidTransportData object is instantiated for each species.
std::vector< LTPspecies * > mobilityRatio
Model type for the mobility ratio.
std::vector< vector_fp > condcoeffs
temperature-fits of the heat conduction
LTPspecies * ionConductivity
Model type for the ionic conductivity.
Exception thrown if an error is encountered while reading the transport database. ...
const doublereal GasConstant
Universal Gas Constant. [J/kmol/K].
LTPspecies * hydroRadius
Model type for the hydroradius.
Stefan Maxwell Diffusion Coefficients can be solved for given ion conductivity, mobility ratios...
DenseMatrix diff_Dij
Interaction associated with linear weighting of thermal conductivity.
const std::vector< const XML_Node * > & speciesData() const
Return a pointer to the vector of XML nodes containing the species data for this phase.
Contains declarations for string manipulation functions within Cantera.
std::vector< LTPspecies * > selfDiffusion
Model type for the self diffusion coefficients.
#define DATA_PTR(vec)
Creates a pointer to the start of the raw data for a vector.
LTPspecies * viscosity
Model type for the viscosity.
Simple mole fraction weighting of transport properties.
void saveState(vector_fp &state) const
Save the current internal state of the phase Write to vector 'state' the current internal state...
LiquidTranInteraction * hydroRadius
Pointer to the LiquidTranInteraction object which handles the calculation of the hydrodynamic radius ...
XML_Node & xml()
Returns a reference to the XML_Node stored for the phase.
const VelocityBasis VB_MASSAVG
Diffusion velocities are based on the mass averaged velocity.
XML_Writer * xml
Pointer to the xml tree describing the implementation of transport for this object.
virtual void setThermo(thermo_t &thermo)
Specifies the ThermoPhase object.
Calculation of Collision integrals.
void fitCollisionIntegrals(std::ostream &logfile, GasTransportParams &tr, MMCollisionInt &integrals)
Generate polynomial fits to collision integrals.
virtual LTPspecies * newLTP(const XML_Node &trNode, const std::string &name, TransportPropertyType tp_ind, thermo_t *thermo)
Make one of several transport models, and return a base class pointer to it.
virtual void init(const XML_Node &compModelNode=XML_Node(), thermo_t *thermo=0)
initialize LiquidTranInteraction objects with thermo and XML node
LTPspecies * thermalConductivity
Model type for the thermal conductivity.
Transport * newDefaultTransportMgr(thermo_t *thermo, int loglevel, TransportFactory *f)
Create a new transport manager instance.
virtual void initSolidTransport(Transport *tr, thermo_t *thermo, int log_level=0)
Initialize an existing transport manager for solid phase.
Class MixTransport implements mixture-averaged transport properties for ideal gas mixtures...
LTPspecies * ionConductivity
Model type for the ionic conductivity.
static mutex_t transport_mutex
Static instance of the mutex used to ensure the proper reading of the transport database.
Class LTPspecies_Poly holds transport parameters for a specific liquid-phase species (LTPspecies) whe...
Header file for class ThermoPhase, the base class for phases with thermodynamic properties, and the text for the Module thermoprops (see Thermodynamic Properties and class ThermoPhase).
virtual void deleteFactory()
Deletes the statically allocated factory instance.
Class SolidTransportData holds transport parameters for a specific solid-phase species.
Headers for the MixTransport object, which models transport properties in ideal gas solutions using a...
Base class to handle transport property evaluation in a mixture.
LiquidTranInteraction * thermalCond
Pointer to the LiquidTranInteraction object which handles the calculation of the mixture thermal cond...
virtual bool initGas(GasTransportParams &tr)
Called by TransportFactory to set parameters.
Class that holds the data that is read in from the xml file, and which is used for processing of the ...
std::string speciesName(size_t k) const
Name of the species with index k.
Class SimpleTransport implements mixture-averaged transport properties for liquid phases...
const doublereal Boltzmann
Boltzmann's constant [J/K].
size_t nChildren(bool discardComments=false) const
Return the number of children.
A class for full (non-sparse) matrices with Fortran-compatible data storage, which adds matrix operat...
virtual doublereal minTemp(size_t k=npos) const
Minimum temperature for which the thermodynamic data for the species or phase are valid...
LiquidTranInteraction * electCond
Pointer to the LiquidTranInteraction object which handles the calculation of the electrical conductiv...
Class AqueousTransport implements mixture-averaged transport properties for brine phases...
void save()
Function to put this error onto Cantera's error stack.