12 SimpleTransport::SimpleTransport(
thermo_t* thermo,
int ndim) :
15 compositionDepType_(LTI_MODEL_SOLVENT),
16 useHydroRadius_(false),
20 meanMolecularWeight_(-1.0),
27 m_visc_temp_ok(false),
29 m_diff_temp_ok(false),
30 m_cond_temp_ok(false),
38 compositionDepType_(LTI_MODEL_SOLVENT),
39 useHydroRadius_(false),
48 m_visc_temp_ok(false),
50 m_diff_temp_ok(false),
51 m_cond_temp_ok(false),
62 SimpleTransport& SimpleTransport::operator=(
const SimpleTransport& right)
67 Transport::operator=(right);
76 for (
size_t k = 0; k <right.m_coeffVisc_Ns.size() ; k++) {
77 if (right.m_coeffVisc_Ns[k]) {
78 m_coeffVisc_Ns[k] = (right.m_coeffVisc_Ns[k])->duplMyselfAsLTPspecies();
83 for (
size_t k = 0; k < right.m_coeffLambda_Ns.size(); k++) {
84 if (right.m_coeffLambda_Ns[k]) {
90 for (
size_t k = 0; k < right.m_coeffDiff_Ns.size(); k++) {
91 if (right.m_coeffDiff_Ns[k]) {
92 m_coeffDiff_Ns[k] = (right.m_coeffDiff_Ns[k])->duplMyselfAsLTPspecies();
97 for (
size_t k = 0; k < right.m_coeffHydroRadius_Ns.size(); k++) {
98 if (right.m_coeffHydroRadius_Ns[k]) {
140 SimpleTransport::~SimpleTransport()
167 if (phaseNode.
hasChild(
"transport")) {
169 string transportModel = transportNode.
attrib(
"model");
170 if (transportModel ==
"Simple") {
176 "transport model isn't the correct type: " + transportModel);
193 for (
size_t k = 0; k <
m_nsp; k++) {
207 for (
size_t k = 0; k <
m_nsp; k++) {
223 for (
size_t k = 0; k <
m_nsp; k++) {
235 "Neither diffusivity nor hydroradius is set for species " + spName);
244 for (
size_t k = 0; k <
m_nsp; k++) {
286 for (
size_t k = 0; k <
m_nsp; k++) {
291 "Unknowns compositionDepType");
317 for (
size_t i = 0; i <
m_nsp; i++) {
318 for (
size_t j = 0; j <
m_nsp; j++) {
320 d[i*m_nsp+j] = bdiff;
329 for (
size_t k = 0; k <
m_nsp; k++) {
338 for (
size_t k = 0; k <
m_nsp; k++) {
346 for (
size_t a = 0; a <
m_nDim; a++) {
348 if (fabs(grad_V[a]) > 1.0E-13) {
356 for (
size_t a = 0; a <
m_nDim; a++) {
364 for (
size_t i = 0; i < itop; i++) {
381 for (
size_t k = 0; k <
m_nsp; k++) {
385 throw CanteraError(
"SimpleTransport::thermalConductivity()",
386 "Unknown compositionDepType");
395 for (
size_t k = 0; k <
m_nsp; k++) {
401 const doublereal* grad_T,
403 const doublereal* grad_X,
414 for (
size_t n = 0; n <
m_nDim; n++) {
415 for (
size_t k = 0; k <
m_nsp; k++) {
416 if (y[k] > 1.0E-200) {
417 Vdiff[n * m_nsp + k] *= 1.0 / (rho * y[k]);
419 Vdiff[n * m_nsp + k] = 0.0;
426 int ldx,
const doublereal* grad_X,
427 int ldf,
const doublereal* grad_Phi,
438 for (
size_t n = 0; n <
m_nDim; n++) {
439 for (
size_t k = 0; k <
m_nsp; k++) {
440 if (y[k] > 1.0E-200) {
441 Vdiff[n * m_nsp + k] *= 1.0 / (rho * y[k]);
443 Vdiff[n * m_nsp + k] = 0.0;
450 size_t ldx,
const doublereal*
const grad_X,
451 size_t ldf, doublereal*
const fluxes)
460 AssertThrow(ldf >=
m_nsp ,
"SimpleTransport::getSpeciesFluxesExt: Stride must be greater than m_nsp");
476 for (
size_t n = 0; n <
m_nDim; n++) {
478 for (
size_t k = 0; k <
m_nsp; k++) {
479 fluxes[n*ldf + k] = - concTotal * mw[k] *
m_spwork[k] *
481 rhoVc[n] += fluxes[n*ldf + k];
485 for (
size_t n = 0; n <
m_nDim; n++) {
487 for (
size_t k = 0; k <
m_nsp; k++) {
488 fluxes[n*ldf + k] = - concTotal * mw[k] *
m_spwork[k] *
m_Grad_X[n*m_nsp + k];
489 rhoVc[n] += fluxes[n*ldf + k];
495 for (
size_t n = 0; n <
m_nDim; n++) {
497 for (
size_t k = 0; k <
m_nsp; k++) {
498 rhoVc[n] += fluxes[n*ldf + k];
501 for (
size_t n = 0; n <
m_nDim; n++) {
502 for (
size_t k = 0; k <
m_nsp; k++) {
503 fluxes[n*ldf + k] -= y[k] *
rhoVc[n];
507 for (
size_t n = 0; n <
m_nDim; n++) {
509 for (
size_t k = 0; k <
m_nsp; k++) {
510 rhoVc[n] += fluxes[n*ldf + k] / mw[k];
513 for (
size_t n = 0; n <
m_nDim; n++) {
514 for (
size_t k = 0; k <
m_nsp; k++) {
519 for (
size_t n = 0; n <
m_nDim; n++) {
521 for (
size_t k = 0; k <
m_nsp; k++) {
522 rhoVc[n] += fluxes[n*ldf + k] / mw[k];
525 for (
size_t n = 0; n <
m_nDim; n++) {
526 for (
size_t k = 0; k <
m_nsp; k++) {
533 throw CanteraError(
"SimpleTransport::getSpeciesFluxesExt()",
534 "unknown velocity basis");
546 for (
size_t k = 0; k <
m_nsp; k++) {
567 for (
size_t k = 0; k <
m_nsp; k++) {
592 for (
size_t k = 0; k <
m_nsp; k++) {
605 for (
size_t k = 0; k <
m_nsp; k++) {
610 for (
size_t k = 0; k <
m_nsp; k++) {
627 for (
size_t k = 0; k <
m_nsp; k++) {
643 "negative temperature "+
fp2str(t));
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).
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: shallow pointer.
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.
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.
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.
enum LiquidTranMixingModel compositionDepType_
Composition dependence of the transport properties.
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).
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.
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...
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.
LiquidTranMixingModel compositionDepTypeDefault_
Default composition dependence of the transport properties.
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.
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.
XML_Node & xml() const
Returns a const reference to the XML_Node that describes the phase.
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.
#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.
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.
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.