16 SimpleTransport::SimpleTransport(
thermo_t* thermo,
int ndim) :
18 compositionDepType_(LTI_MODEL_SOLVENT),
19 useHydroRadius_(false),
23 meanMolecularWeight_(-1.0),
30 m_visc_temp_ok(false),
32 m_diff_temp_ok(false),
33 m_cond_temp_ok(false),
37 warn_deprecated(
"Class SimpleTransport",
"To be removed after Cantera 2.4");
40 SimpleTransport::~SimpleTransport()
65 if (phaseNode.
hasChild(
"transport")) {
67 string transportModel = transportNode.
attrib(
"model");
68 if (transportModel ==
"Simple") {
72 "transport model isn't the correct type: " + transportModel);
83 for (
size_t k = 0; k <
m_nsp; k++) {
93 for (
size_t k = 0; k <
m_nsp; k++) {
104 for (
size_t k = 0; k <
m_nsp; k++) {
115 "Neither diffusivity nor hydroradius is set for species " + spName);
123 for (
size_t k = 0; k <
m_nsp; k++) {
162 for (
size_t k = 0; k <
m_nsp; k++) {
167 "Unknowns compositionDepType");
192 for (
size_t i = 0; i <
m_nsp; i++) {
193 for (
size_t j = 0; j <
m_nsp; j++) {
203 for (
size_t k = 0; k <
m_nsp; k++) {
212 for (
size_t k = 0; k <
m_nsp; k++) {
220 for (
size_t a = 0; a <
m_nDim; a++) {
222 if (fabs(grad_V[a]) > 1.0E-13) {
230 for (
size_t a = 0; a <
m_nDim; a++) {
238 for (
size_t i = 0; i < itop; i++) {
255 for (
size_t k = 0; k <
m_nsp; k++) {
259 throw CanteraError(
"SimpleTransport::thermalConductivity()",
260 "Unknown compositionDepType");
269 for (
size_t k = 0; k <
m_nsp; k++) {
275 const doublereal* grad_T,
277 const doublereal* grad_X,
286 for (
size_t n = 0; n <
m_nDim; n++) {
287 for (
size_t k = 0; k <
m_nsp; k++) {
288 if (y[k] > 1.0E-200) {
289 Vdiff[n *
m_nsp + k] *= 1.0 / (rho * y[k]);
291 Vdiff[n *
m_nsp + k] = 0.0;
298 int ldx,
const doublereal* grad_X,
299 int ldf,
const doublereal* grad_Phi,
308 for (
size_t n = 0; n <
m_nDim; n++) {
309 for (
size_t k = 0; k <
m_nsp; k++) {
310 if (y[k] > 1.0E-200) {
311 Vdiff[n *
m_nsp + k] *= 1.0 / (rho * y[k]);
313 Vdiff[n *
m_nsp + k] = 0.0;
320 size_t ldx,
const doublereal*
const grad_X,
321 size_t ldf, doublereal*
const fluxes)
330 AssertThrow(ldf >=
m_nsp ,
"SimpleTransport::getSpeciesFluxesExt: Stride must be greater than m_nsp");
343 for (
size_t n = 0; n <
m_nDim; n++) {
345 for (
size_t k = 0; k <
m_nsp; k++) {
346 fluxes[n*ldf + k] = - concTotal * mw[k] *
m_spwork[k] *
348 rhoVc[n] += fluxes[n*ldf + k];
352 for (
size_t n = 0; n <
m_nDim; n++) {
354 for (
size_t k = 0; k <
m_nsp; k++) {
356 rhoVc[n] += fluxes[n*ldf + k];
362 for (
size_t n = 0; n <
m_nDim; n++) {
364 for (
size_t k = 0; k <
m_nsp; k++) {
365 rhoVc[n] += fluxes[n*ldf + k];
368 for (
size_t n = 0; n <
m_nDim; n++) {
369 for (
size_t k = 0; k <
m_nsp; k++) {
370 fluxes[n*ldf + k] -= y[k] *
rhoVc[n];
374 for (
size_t n = 0; n <
m_nDim; n++) {
376 for (
size_t k = 0; k <
m_nsp; k++) {
377 rhoVc[n] += fluxes[n*ldf + k] / mw[k];
380 for (
size_t n = 0; n <
m_nDim; n++) {
381 for (
size_t k = 0; k <
m_nsp; k++) {
386 for (
size_t n = 0; n <
m_nDim; n++) {
388 for (
size_t k = 0; k <
m_nsp; k++) {
389 rhoVc[n] += fluxes[n*ldf + k] / mw[k];
392 for (
size_t n = 0; n <
m_nDim; n++) {
393 for (
size_t k = 0; k <
m_nsp; k++) {
399 throw CanteraError(
"SimpleTransport::getSpeciesFluxesExt()",
400 "unknown velocity basis");
412 for (
size_t k = 0; k <
m_nsp; k++) {
432 for (
size_t k = 0; k <
m_nsp; k++) {
455 for (
size_t k = 0; k <
m_nsp; k++) {
468 for (
size_t k = 0; k <
m_nsp; k++) {
473 for (
size_t k = 0; k <
m_nsp; k++) {
486 for (
size_t k = 0; k <
m_nsp; k++) {
502 "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.
bool m_cond_mix_ok
Boolean indicating that mixture conductivity is current.
Base class for transport property managers.
void warn_deprecated(const std::string &method, const std::string &extra)
Print a warning indicating that method is deprecated.
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.
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.
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...
const doublereal Boltzmann
Boltzmann's constant [J/K].
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.