16 SimpleTransport::SimpleTransport(
thermo_t* thermo,
int ndim) :
19 compositionDepType_(LTI_MODEL_SOLVENT),
20 useHydroRadius_(false),
24 meanMolecularWeight_(-1.0),
31 m_visc_temp_ok(false),
33 m_diff_temp_ok(false),
34 m_cond_temp_ok(false),
42 compositionDepType_(LTI_MODEL_SOLVENT),
43 useHydroRadius_(false),
52 m_visc_temp_ok(false),
54 m_diff_temp_ok(false),
55 m_cond_temp_ok(false),
64 SimpleTransport& SimpleTransport::operator=(
const SimpleTransport& right)
78 for (
size_t k = 0; k <right.m_coeffVisc_Ns.size() ; k++) {
79 if (right.m_coeffVisc_Ns[k]) {
80 m_coeffVisc_Ns[k] = (right.m_coeffVisc_Ns[k])->duplMyselfAsLTPspecies();
85 for (
size_t k = 0; k < right.m_coeffLambda_Ns.size(); k++) {
86 if (right.m_coeffLambda_Ns[k]) {
92 for (
size_t k = 0; k < right.m_coeffDiff_Ns.size(); k++) {
93 if (right.m_coeffDiff_Ns[k]) {
94 m_coeffDiff_Ns[k] = (right.m_coeffDiff_Ns[k])->duplMyselfAsLTPspecies();
99 for (
size_t k = 0; k < right.m_coeffHydroRadius_Ns.size(); k++) {
100 if (right.m_coeffHydroRadius_Ns[k]) {
140 SimpleTransport::~SimpleTransport()
165 if (phaseNode.
hasChild(
"transport")) {
167 string transportModel = transportNode.
attrib(
"model");
168 if (transportModel ==
"Simple") {
172 "transport model isn't the correct type: " + transportModel);
183 for (
size_t k = 0; k <
m_nsp; k++) {
193 for (
size_t k = 0; k <
m_nsp; k++) {
204 for (
size_t k = 0; k <
m_nsp; k++) {
215 "Neither diffusivity nor hydroradius is set for species " + spName);
223 for (
size_t k = 0; k <
m_nsp; k++) {
262 for (
size_t k = 0; k <
m_nsp; k++) {
267 "Unknowns compositionDepType");
292 for (
size_t i = 0; i <
m_nsp; i++) {
293 for (
size_t j = 0; j <
m_nsp; j++) {
303 for (
size_t k = 0; k <
m_nsp; k++) {
312 for (
size_t k = 0; k <
m_nsp; k++) {
320 for (
size_t a = 0; a <
m_nDim; a++) {
322 if (fabs(grad_V[a]) > 1.0E-13) {
330 for (
size_t a = 0; a <
m_nDim; a++) {
338 for (
size_t i = 0; i < itop; i++) {
355 for (
size_t k = 0; k <
m_nsp; k++) {
359 throw CanteraError(
"SimpleTransport::thermalConductivity()",
360 "Unknown compositionDepType");
369 for (
size_t k = 0; k <
m_nsp; k++) {
375 const doublereal* grad_T,
377 const doublereal* grad_X,
386 for (
size_t n = 0; n <
m_nDim; n++) {
387 for (
size_t k = 0; k <
m_nsp; k++) {
388 if (y[k] > 1.0E-200) {
389 Vdiff[n *
m_nsp + k] *= 1.0 / (rho * y[k]);
391 Vdiff[n *
m_nsp + k] = 0.0;
398 int ldx,
const doublereal* grad_X,
399 int ldf,
const doublereal* grad_Phi,
408 for (
size_t n = 0; n <
m_nDim; n++) {
409 for (
size_t k = 0; k <
m_nsp; k++) {
410 if (y[k] > 1.0E-200) {
411 Vdiff[n *
m_nsp + k] *= 1.0 / (rho * y[k]);
413 Vdiff[n *
m_nsp + k] = 0.0;
420 size_t ldx,
const doublereal*
const grad_X,
421 size_t ldf, doublereal*
const fluxes)
430 AssertThrow(ldf >=
m_nsp ,
"SimpleTransport::getSpeciesFluxesExt: Stride must be greater than m_nsp");
443 for (
size_t n = 0; n <
m_nDim; n++) {
445 for (
size_t k = 0; k <
m_nsp; k++) {
446 fluxes[n*ldf + k] = - concTotal * mw[k] *
m_spwork[k] *
448 rhoVc[n] += fluxes[n*ldf + k];
452 for (
size_t n = 0; n <
m_nDim; n++) {
454 for (
size_t k = 0; k <
m_nsp; k++) {
456 rhoVc[n] += fluxes[n*ldf + k];
462 for (
size_t n = 0; n <
m_nDim; n++) {
464 for (
size_t k = 0; k <
m_nsp; k++) {
465 rhoVc[n] += fluxes[n*ldf + k];
468 for (
size_t n = 0; n <
m_nDim; n++) {
469 for (
size_t k = 0; k <
m_nsp; k++) {
470 fluxes[n*ldf + k] -= y[k] *
rhoVc[n];
474 for (
size_t n = 0; n <
m_nDim; n++) {
476 for (
size_t k = 0; k <
m_nsp; k++) {
477 rhoVc[n] += fluxes[n*ldf + k] / mw[k];
480 for (
size_t n = 0; n <
m_nDim; n++) {
481 for (
size_t k = 0; k <
m_nsp; k++) {
486 for (
size_t n = 0; n <
m_nDim; n++) {
488 for (
size_t k = 0; k <
m_nsp; k++) {
489 rhoVc[n] += fluxes[n*ldf + k] / mw[k];
492 for (
size_t n = 0; n <
m_nDim; n++) {
493 for (
size_t k = 0; k <
m_nsp; k++) {
499 throw CanteraError(
"SimpleTransport::getSpeciesFluxesExt()",
500 "unknown velocity basis");
512 for (
size_t k = 0; k <
m_nsp; k++) {
532 for (
size_t k = 0; k <
m_nsp; k++) {
555 for (
size_t k = 0; k <
m_nsp; k++) {
568 for (
size_t k = 0; k <
m_nsp; k++) {
573 for (
size_t k = 0; k <
m_nsp; k++) {
586 for (
size_t k = 0; k <
m_nsp; k++) {
602 "negative temperature {}", 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.
const vector_fp & molecularWeights() const
Return a const reference to the internal vector of molecular weights.
vector_fp m_Grad_P
Internal value of the gradient of the Pressure vector.
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.
virtual void getBinaryDiffCoeffs(const size_t ld, doublereal *const d)
Returns the binary diffusion coefficients.
doublereal temperature() const
Temperature (K).
const doublereal * massFractions() const
Return a const pointer to the mass fraction array.
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.
virtual Transport * duplMyselfAsTransport() const
Duplication routine for objects which inherit from Transport.
bool m_cond_mix_ok
Boolean indicating that mixture conductivity is current.
Base class for transport property managers.
size_t nSpecies() const
Returns the number of species in the phase.
virtual doublereal density() const
Density (kg/m^3).
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.
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 m_lambda
Saved value of the mixture thermal conductivity.
vector_fp m_Grad_X
Internal value of the gradient of the mole fraction vector.
LTPspecies * speciesDiffusivity
Model type for the speciesDiffusivity.
std::vector< LiquidTransportData > LTData
Species transport parameters.
void updateCond_T()
Update the temperature-dependent parts of the mixture-averaged thermal conductivity.
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.
doublereal molarDensity() const
Molar density (kmol/m^3).
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 speciesName(size_t k) const
Name of the species with index k.
virtual void getMixDiffCoeffs(doublereal *const d)
Get the Mixture diffusion coefficients.
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.
int stateMFNumber() const
Return the State Mole Fraction Number.
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.
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.
void getMoleFractions(doublereal *const x) const
Get the species mole fraction vector.
XML_Node & xml() const
Returns a const reference to the XML_Node that describes the phase.
virtual doublereal pressure() const
Return the thermodynamic pressure (Pa).
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.
bool hasChild(const std::string &ch) const
Tests whether the current node has a child node with a particular name.
XML_Node & child(const size_t n) const
Return a changeable reference to the n'th child of the current node.
virtual doublereal viscosity()
Returns the mixture viscosity of the solution.
const VelocityBasis VB_MOLEAVG
Diffusion velocities are based on the mole averaged velocities.
doublereal m_temp
Current Temperature -> locally stored.
std::string attrib(const std::string &attr) const
Function returns the value of an attribute.
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
doublereal meanMolecularWeight() const
The mean molecular weight. Units: (kg/kmol)
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,.
const doublereal GasConstant
Universal Gas Constant. [J/kmol/K].
LTPspecies * hydroRadius
Model type for the hydroradius.
Contains declarations for string manipulation functions within Cantera.
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.
Namespace for the Cantera kernel.
void getConcentrations(doublereal *const c) const
Get the species concentrations (kmol/m^3).
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.
doublereal charge(size_t k) const
Dimensionless electrical charge of a single molecule of species k The charge is normalized by the the...
Class SimpleTransport implements mixture-averaged transport properties for liquid phases...
const doublereal Boltzmann
Boltzmann's constant [J/K].
Transport & operator=(const Transport &right)
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.