18 SimpleTransport::SimpleTransport(
thermo_t* thermo,
int ndim) :
21 compositionDepType_(0),
22 useHydroRadius_(false),
30 m_visc_temp_ok(false),
32 m_diff_temp_ok(false),
33 m_cond_temp_ok(false),
42 compositionDepType_(0),
43 useHydroRadius_(false),
51 m_visc_temp_ok(false),
53 m_diff_temp_ok(false),
54 m_cond_temp_ok(false),
65 SimpleTransport& SimpleTransport::operator=(
const SimpleTransport& right)
70 Transport::operator=(right);
79 for (
size_t k = 0; k <right.m_coeffVisc_Ns.size() ; k++) {
80 if (right.m_coeffVisc_Ns[k]) {
81 m_coeffVisc_Ns[k] = (right.m_coeffVisc_Ns[k])->duplMyselfAsLTPspecies();
86 for (
size_t k = 0; k < right.m_coeffLambda_Ns.size(); k++) {
87 if (right.m_coeffLambda_Ns[k]) {
93 for (
size_t k = 0; k < right.m_coeffDiff_Ns.size(); k++) {
94 if (right.m_coeffDiff_Ns[k]) {
95 m_coeffDiff_Ns[k] = (right.m_coeffDiff_Ns[k])->duplMyselfAsLTPspecies();
100 for (
size_t k = 0; k < right.m_coeffHydroRadius_Ns.size(); k++) {
101 if (right.m_coeffHydroRadius_Ns[k]) {
143 SimpleTransport::~SimpleTransport()
170 if (phaseNode.
hasChild(
"transport")) {
172 string transportModel = transportNode.
attrib(
"model");
173 if (transportModel ==
"Simple") {
179 std::string modelName =
"";
183 if (modelName ==
"solvent_only") {
185 }
else if (modelName ==
"mixture_averaged") {
188 throw CanteraError(
"SimpleTransport::initLiquid",
"Unknown compositionDependence Model: " + modelName);
224 for (
size_t k = 0; k <
m_nsp; k++) {
255 for (
size_t k = 0; k <
m_nsp; k++) {
297 for (
size_t k = 0; k <
m_nsp; k++) {
337 "Neither diffusivity nor hydroradius is set for species " + spName);
346 for (
size_t k = 0; k <
m_nsp; k++) {
388 for (
size_t k = 0; k <
m_nsp; k++) {
416 for (
size_t i = 0; i <
m_nsp; i++) {
417 for (
size_t j = 0; j <
m_nsp; j++) {
419 d[i*m_nsp+j] = bdiff;
428 for (
size_t k = 0; k <
m_nsp; k++) {
437 for (
size_t k = 0; k <
m_nsp; k++) {
445 for (
size_t a = 0; a <
m_nDim; a++) {
447 if (fabs(grad_V[a]) > 1.0E-13) {
455 for (
size_t a = 0; a <
m_nDim; a++) {
463 for (
size_t i = 0; i < itop; i++) {
480 for (
size_t k = 0; k <
m_nsp; k++) {
491 for (
size_t k = 0; k <
m_nsp; k++) {
497 const doublereal* grad_T,
499 const doublereal* grad_X,
510 for (
size_t n = 0; n <
m_nDim; n++) {
511 for (
size_t k = 0; k <
m_nsp; k++) {
512 if (y[k] > 1.0E-200) {
513 Vdiff[n * m_nsp + k] *= 1.0 / (rho * y[k]);
515 Vdiff[n * m_nsp + k] = 0.0;
522 int ldx,
const doublereal* grad_X,
523 int ldf,
const doublereal* grad_Phi,
534 for (
size_t n = 0; n <
m_nDim; n++) {
535 for (
size_t k = 0; k <
m_nsp; k++) {
536 if (y[k] > 1.0E-200) {
537 Vdiff[n * m_nsp + k] *= 1.0 / (rho * y[k]);
539 Vdiff[n * m_nsp + k] = 0.0;
546 size_t ldx,
const doublereal*
const grad_X,
547 size_t ldf, doublereal*
const fluxes)
556 AssertThrow(ldf >=
m_nsp ,
"SimpleTransport::getSpeciesFluxesExt: Stride must be greater than m_nsp");
572 for (
size_t n = 0; n <
m_nDim; n++) {
574 for (
size_t k = 0; k <
m_nsp; k++) {
575 fluxes[n*ldf + k] = - concTotal * mw[k] *
m_spwork[k] *
577 rhoVc[n] += fluxes[n*ldf + k];
581 for (
size_t n = 0; n <
m_nDim; n++) {
583 for (
size_t k = 0; k <
m_nsp; k++) {
584 fluxes[n*ldf + k] = - concTotal * mw[k] *
m_spwork[k] *
m_Grad_X[n*m_nsp + k];
585 rhoVc[n] += fluxes[n*ldf + k];
591 for (
size_t n = 0; n <
m_nDim; n++) {
593 for (
size_t k = 0; k <
m_nsp; k++) {
594 rhoVc[n] += fluxes[n*ldf + k];
597 for (
size_t n = 0; n <
m_nDim; n++) {
598 for (
size_t k = 0; k <
m_nsp; k++) {
599 fluxes[n*ldf + k] -= y[k] *
rhoVc[n];
603 for (
size_t n = 0; n <
m_nDim; n++) {
605 for (
size_t k = 0; k <
m_nsp; k++) {
606 rhoVc[n] += fluxes[n*ldf + k] / mw[k];
609 for (
size_t n = 0; n <
m_nDim; n++) {
610 for (
size_t k = 0; k <
m_nsp; k++) {
615 for (
size_t n = 0; n <
m_nDim; n++) {
617 for (
size_t k = 0; k <
m_nsp; k++) {
618 rhoVc[n] += fluxes[n*ldf + k] / mw[k];
621 for (
size_t n = 0; n <
m_nDim; n++) {
622 for (
size_t k = 0; k <
m_nsp; k++) {
629 throw CanteraError(
"SimpleTransport::getSpeciesFluxesExt()",
630 "unknown velocity basis");
642 for (
size_t k = 0; k <
m_nsp; k++) {
663 for (
size_t k = 0; k <
m_nsp; k++) {
688 for (
size_t k = 0; k <
m_nsp; k++) {
701 for (
size_t k = 0; k <
m_nsp; k++) {
706 for (
size_t k = 0; k <
m_nsp; k++) {
723 for (
size_t k = 0; k <
m_nsp; k++) {
739 "negative temperature "+
fp2str(t));
763 "\n\n\n**** Method "+ msg +
" not implemented in model "
765 "(Did you forget to specify a transport model?)\n\n\n");
bool m_visc_temp_ok
Boolean indicating that weight factors wrt viscosity is current.
vector_fp m_Grad_T
Internal value of the gradient of the Temperature vector.
vector_fp m_Grad_V
Internal value of the gradient of the Electric Voltage.
vector_fp m_Grad_P
Internal value of the gradient of the Pressure vector.
virtual doublereal density() const
Density (kg/m^3).
std::string int2str(const int n, const std::string &fmt)
Convert an int to a string using a format converter.
virtual int model() const
Transport model.
virtual bool initLiquid(LiquidTransportParams &tr)
Initialize the transport object.
vector_fp m_spwork
work space
bool m_visc_mix_ok
Boolean indicating that the top-level mixture viscosity is current.
thermo_t * thermo
Pointer to the ThermoPhase object.
std::string attrib(const std::string &attr) const
Function returns the value of an attribute.
virtual void getBinaryDiffCoeffs(const size_t ld, doublereal *const d)
Returns the binary diffusion coefficients.
Various templated functions that carry out common vector operations (see Templated Utility Functions)...
LTPspecies * thermalCond
Model type for the thermal conductivity.
virtual void getSpeciesFluxes(size_t ndim, const doublereal *const grad_T, size_t ldx, const doublereal *const grad_X, size_t ldf, doublereal *const fluxes)
Get the species diffusive mass fluxes wrt to the specified solution averaged velocity, given the gradients in mole fraction and temperature.
doublereal m_viscmix
Saved value of the mixture viscosity.
bool getOptionalModel(const Cantera::XML_Node &parent, const std::string &nodeName, std::string &modelName)
Get an optional model name from a named child node.
double rhoVc[3]
Temporary variable that stores the rho Vc value.
thermo_t * m_thermo
pointer to the object representing the phase
virtual bool update_T()
Handles the effects of changes in the Temperature, internally within the object.
Class XML_Node is a tree-based representation of the contents of an XML file.
void updateViscosities_C()
Update the concentration parts of the viscosities.
bool m_cond_mix_ok
Boolean indicating that mixture conductivity is current.
Base class for transport property managers.
void updateDiff_T()
Update the binary diffusion coefficients wrt T.
Class LiquidTransportData holds transport parameters for a specific liquid-phase species.
int stateMFNumber() const
Return the State Mole Fraction Number.
virtual void getMobilities(doublereal *const mobil_e)
Get the Electrical mobilities (m^2/V/s).
virtual bool update_C()
Handles the effects of changes in the mixture concentration.
doublereal molarDensity() const
Molar density (kmol/m^3).
std::string lowercase(const std::string &s)
Cast a copy of a string to lower case.
void getMoleFractions(doublereal *const x) const
Get the species mole fraction vector.
doublereal m_lambda
Saved value of the mixture thermal conductivity.
vector_fp m_Grad_X
Internal value of the gradient of the mole fraction vector.
void getConcentrations(doublereal *const c) const
Get the species concentrations (kmol/m^3).
LTPspecies * speciesDiffusivity
Model type for the speciesDiffusivity.
void updateCond_T()
Update the temperature-dependent parts of the mixture-averaged thermal conductivity.
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)
int m_iStateMF
State of the mole fraction vector.
Base class for a phase with thermodynamic properties.
Class LiquidTransportParams holds transport model parameters relevant to transport in mixtures...
Header file defining class LiquidTransportParams.
doublereal meanMolecularWeight_
Mean molecular weight.
bool m_diff_temp_ok
Boolean indicating that binary diffusion coeffs are current.
virtual void getFluidMobilities(doublereal *const mobil_f)
Get the fluid mobilities (s kmol/kg).
std::vector< LTPspecies * > m_coeffVisc_Ns
Pure species viscosities in Arrhenius temperature-dependent form.
std::string fp2str(const double x, const std::string &fmt)
Convert a double into a c++ string.
virtual void getMixDiffCoeffs(doublereal *const d)
Get the Mixture diffusion coefficients.
const doublereal * massFractions() const
Return a const pointer to the mass fraction array.
virtual void getSpeciesVdiffES(size_t ndim, const doublereal *grad_T, int ldx, const doublereal *grad_X, int ldf, const doublereal *grad_Phi, doublereal *Vdiff)
Get the species diffusive velocities wrt to the averaged velocity, given the gradients in mole fracti...
Header file for the class SimpleTransport which provides simple transport properties for liquids and ...
vector_fp m_diffSpecies
Vector of Species Diffusivities.
vector_fp m_viscSpecies
Species viscosities.
int tempDepType_
Temperature dependence type.
std::vector< LTPspecies * > m_coeffLambda_Ns
Pure species thermal conductivities in Arrhenius temperature-dependent form.
#define AssertThrow(expr, procedure)
Assertion must be true or an error is thrown.
Base class for exceptions thrown by Cantera classes.
SimpleTransport(thermo_t *thermo=0, int ndim=1)
Default constructor.
doublereal m_press
Current value of the pressure.
std::vector< LTPspecies * > m_coeffHydroRadius_Ns
Hydrodynamic radius in LTPspecies form.
bool hasChild(const std::string &ch) const
Tests whether the current node has a child node with a particular name.
virtual void set_Grad_X(const doublereal *const grad_X)
Specify the value of the gradient of the MoleFractions.
virtual void getSpeciesVdiff(size_t ndim, const doublereal *grad_T, int ldx, const doublereal *grad_X, int ldf, doublereal *Vdiff)
Get the species diffusive velocities wrt to the averaged velocity, given the gradients in mole fracti...
virtual doublereal thermalConductivity()
Returns the mixture thermal conductivity of the solution.
virtual void set_Grad_V(const doublereal *const grad_V)
Specify the value of the gradient of the voltage.
doublereal concTot_
Local copy of the total concentration.
doublereal err(const std::string &msg) const
Throw an exception if this method is invoked.
vector_fp m_concentrations
Local copy of the concentrations of the species in the phase.
void updateViscosity_T()
Update the temperature-dependent viscosity terms.
virtual void getThermalDiffCoeffs(doublereal *const dt)
Return the thermal diffusion coefficients.
std::vector< Cantera::LiquidTransportData > LTData
Species transport parameters.
size_t nSpecies() const
Returns the number of species in the phase.
virtual doublereal viscosity()
Returns the mixture viscosity of the solution.
virtual doublereal pressure() const
Return the thermodynamic pressure (Pa).
const vector_fp & molecularWeights() const
Return a const reference to the internal vector of molecular weights.
const VelocityBasis VB_MOLEAVG
Diffusion velocities are based on the mole averaged velocities.
doublereal temperature() const
Temperature (K).
doublereal m_temp
Current Temperature -> locally stored.
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
vector_fp m_condSpecies
Internal value of the species individual thermal conductivities.
bool doMigration_
Boolean indicating whether electro-migration term should be added.
bool useHydroRadius_
Boolean indicating whether to use the hydrodynamic radius formulation.
virtual void getSpeciesFluxesExt(size_t ldf, doublereal *fluxes)
Return the species diffusive mass fluxes wrt to the mass averaged velocity,.
doublereal meanMolecularWeight() const
The mean molecular weight. Units: (kg/kmol)
const doublereal GasConstant
Universal Gas Constant. [J/kmol/K].
LTPspecies * hydroRadius
Model type for the hydroradius.
Contains declarations for string manipulation functions within Cantera.
virtual Transport * duplMyselfAsTransport() const
Duplication routine for objects which inherit from Transport.
int compositionDepType_
Composition dependence of the transport properties.
#define DATA_PTR(vec)
Creates a pointer to the start of the raw data for a vector.
LTPspecies * viscosity
Model type for the viscosity.
size_t m_nsp
Number of species.
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.
size_t m_nDim
Number of dimensions.
vector_fp m_chargeSpecies
Local copy of the charge of each species.
bool m_cond_temp_ok
Flag to indicate that the pure species conductivities are current wrt the temperature.
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).
vector_fp m_molefracs
Local copy of the mole fractions of the species in the phase.
virtual void getSpeciesViscosities(doublereal *const visc)
Returns the pure species viscosities.
int m_velocityBasis
Velocity basis from which diffusion velocities are computed.
virtual void set_Grad_T(const doublereal *const grad_T)
Specify the value of the gradient of the temperature.
std::vector< LTPspecies * > m_coeffDiff_Ns
Pure species viscosities in Arrhenius temperature-dependent form.
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].
doublereal charge(size_t k) const
Dimensionless electrical charge of a single molecule of species k The charge is normalized by the the...
bool m_diff_mix_ok
Boolean indicating that mixture diffusion coeffs are current.
vector_fp m_mw
Local Copy of the molecular weights of the species.