Incremental update: not operation yet

This commit is contained in:
Harry Moffat 2009-02-15 19:41:33 +00:00
parent b1f8a6b0b9
commit 21e111145e
5 changed files with 503 additions and 213 deletions

View file

@ -31,7 +31,8 @@ namespace Cantera {
//////////////////// class LiquidTransport methods //////////////
LiquidTransport::LiquidTransport() :
LiquidTransport::LiquidTransport(thermo_t* thermo, int ndim) :
Transport(thermo, ndim),
m_nsp(0),
m_tmin(-1.0),
m_tmax(100000.),
@ -45,22 +46,118 @@ namespace Cantera {
m_press(-1.0),
m_lambda(-1.0),
m_viscmix(-1.0),
m_viscmix_ok(false),
m_viscwt_ok(false),
m_spvisc_ok(false),
m_diffmix_ok(false),
m_bindiff_ok(false),
m_spcond_ok(false),
m_condmix_ok(false),
m_visc_mix_ok(false),
m_visc_temp_ok(false),
m_visc_conc_ok(false),
m_diff_mix_ok(false),
m_diff_temp_ok(false),
m_cond_temp_ok(false),
m_cond_mix_ok(false),
m_mode(-1000),
m_debug(false),
m_nDim(1)
m_debug(false)
{
}
LiquidTransport::LiquidTransport(const LiquidTransport &right) :
Transport(),
m_nsp(0),
m_tmin(-1.0),
m_tmax(100000.),
m_iStateMF(-1),
m_temp(-1.0),
m_logt(0.0),
m_sqrt_t(-1.0),
m_t14(-1.0),
m_t32(-1.0),
m_sqrt_kbt(-1.0),
m_press(-1.0),
m_lambda(-1.0),
m_viscmix(-1.0),
m_visc_mix_ok(false),
m_visc_temp_ok(false),
m_visc_conc_ok(false),
m_diff_mix_ok(false),
m_diff_temp_ok(false),
m_cond_temp_ok(false),
m_cond_mix_ok(false),
m_mode(-1000),
m_debug(false)
{
/*
* Use the assignment operator to do the brunt
* of the work for the copy construtor.
*/
*this = right;
}
LiquidTransport& LiquidTransport::operator=(const LiquidTransport& right) {
if (&right != this) {
return *this;
}
Transport::operator=(right);
m_nsp = right.m_nsp;
m_tmin = right.m_tmin;
m_tmax = right.m_tmax;
m_mw = right.m_mw;
m_poly = right.m_poly;
viscCoeffsVector_ = right.viscCoeffsVector_;
m_condcoeffs = right.m_condcoeffs;
m_diffcoeffs = right.m_diffcoeffs;
m_Grad_X = right.m_Grad_X;
m_Grad_T = right.m_Grad_T;
m_Grad_V = right.m_Grad_V;
m_Grad_mu = right.m_Grad_mu;
m_bdiff = right.m_bdiff;
m_visc = right.m_visc;
m_sqvisc = right.m_sqvisc;
m_cond = right.m_cond;
m_polytempvec = right.m_polytempvec;
m_iStateMF = -1;
m_molefracs = right.m_molefracs;
m_concentrations = right.m_concentrations;
m_chargeSpecies = right.m_chargeSpecies;
m_DiffCoeff_StefMax = right.m_DiffCoeff_StefMax;
viscosityModel_ = right.viscosityModel_;
m_phi = right.m_phi;
m_wratjk = right.m_wratjk;
m_wratkj1 = right.m_wratkj1;
m_B = right.m_B;
m_A = right.m_A;
m_eps = right.m_eps;
m_alpha = right.m_alpha;
m_temp = right.m_temp;
m_logt = right.m_logt;
m_sqrt_t = right.m_sqrt_t;
m_t14 = right.m_t14;
m_t32 = right.m_t32;
m_sqrt_kbt = right.m_sqrt_kbt;
m_press = right.m_press;
m_flux = right.m_flux;
m_lambda = right.m_lambda;
m_viscmix = right.m_viscmix;
m_spwork = right.m_spwork;
m_visc_mix_ok = false;
m_visc_temp_ok = false;
m_visc_conc_ok = false;
m_diff_mix_ok = false;
m_diff_temp_ok = false;
m_cond_temp_ok = false;
m_cond_mix_ok = false;
m_mode = right.m_mode;
m_diam = right.m_diam;
m_debug = right.m_debug;
m_nDim = right.m_nDim;
return *this;
}
Transport *LiquidTransport::duplMyselfAsTransport() const {
LiquidTransport* tr = new LiquidTransport(*this);
return (dynamic_cast<Transport *>(tr));
}
// Initialize the object
/*
* This is where we dimension everything.
@ -119,13 +216,14 @@ namespace Cantera {
// set all flags to false
m_viscmix_ok = false;
m_viscwt_ok = false;
m_spvisc_ok = false;
m_spcond_ok = false;
m_condmix_ok = false;
m_spcond_ok = false;
m_diffmix_ok = false;
m_visc_mix_ok = false;
m_visc_temp_ok = false;
m_visc_conc_ok = false;
m_cond_temp_ok = false;
m_cond_mix_ok = false;
m_diff_temp_ok = false;
m_diff_mix_ok = false;
return true;
}
@ -150,23 +248,43 @@ namespace Cantera {
*/
doublereal LiquidTransport::viscosity() {
update_T();
update_C();
update_temp();
update_conc();
if (m_viscmix_ok) return m_viscmix;
if (m_visc_mix_ok) return m_viscmix;
// update m_visc[] and m_phi[] if necessary
if (!m_viscwt_ok) updateViscosity_T();
multiply(m_phi, DATA_PTR(m_molefracs), DATA_PTR(m_spwork));
m_viscmix = 0.0;
for (int k = 0; k < m_nsp; k++) {
m_viscmix += m_molefracs[k] * m_visc[k]/m_spwork[k]; //denom;
if (!m_visc_temp_ok) {
updateViscosity_temp();
}
if (!m_visc_conc_ok) {
updateViscosities_conc();
}
if (viscosityModel_ == LVISC_CONSTANT) {
return m_viscmix;
} else if (viscosityModel_ == LVISC_MIXTUREAVG) {
m_viscmix = dot_product(m_visc, m_molefracs);
} else if (viscosityModel_ == LVISC_WILKES) {
multiply(m_phi, DATA_PTR(m_molefracs), DATA_PTR(m_spwork));
m_viscmix = 0.0;
for (int k = 0; k < m_nsp; k++) {
m_viscmix += m_molefracs[k] * m_visc[k]/m_spwork[k];
}
}
return m_viscmix;
}
void LiquidTransport::getSpeciesViscosities(doublereal* visc) {
update_temp();
if (!m_visc_temp_ok) {
updateViscosity_temp();
}
copy(m_visc.begin(), m_visc.end(), visc);
}
/******************* binary diffusion coefficients **************/
@ -174,11 +292,11 @@ namespace Cantera {
void LiquidTransport::getBinaryDiffCoeffs(int ld, doublereal* d) {
int i,j;
update_T();
update_temp();
// if necessary, evaluate the binary diffusion coefficents
// from the polynomial fits
if (!m_bindiff_ok) updateDiff_T();
if (!m_diff_temp_ok) updateDiff_temp();
doublereal pres = m_thermo->pressure();
doublereal rp = 1.0/pres;
@ -189,7 +307,7 @@ namespace Cantera {
}
void LiquidTransport::getMobilities(doublereal* mobil) {
void LiquidTransport::getMobilities(doublereal* const mobil) {
// this needs to be checked out.
int k;
getMixDiffCoeffs(DATA_PTR(m_spwork));
@ -201,19 +319,19 @@ namespace Cantera {
void LiquidTransport::set_Grad_V(const doublereal* grad_V) {
void LiquidTransport::set_Grad_V(const doublereal* const grad_V) {
for (int a = 0; a < m_nDim; a++) {
m_Grad_V[a] = grad_V[a];
}
}
void LiquidTransport::set_Grad_T(const doublereal* grad_T) {
void LiquidTransport::set_Grad_T(const doublereal* const grad_T) {
for (int a = 0; a < m_nDim; a++) {
m_Grad_T[a] = grad_T[a];
}
}
void LiquidTransport::set_Grad_X(const doublereal* grad_X) {
void LiquidTransport::set_Grad_X(const doublereal* const grad_X) {
int itop = m_nDim * m_nsp;
for (int i = 0; i < itop; i++) {
m_Grad_X[i] = grad_X[i];
@ -231,20 +349,23 @@ namespace Cantera {
* \]
*/
doublereal LiquidTransport::thermalConductivity() {
int k;
update_temp();
update_conc();
update_T();
update_C();
if (!m_spcond_ok) updateCond_T();
if (!m_condmix_ok) {
if (!m_cond_temp_ok) {
updateCond_temp();
}
if (!m_cond_mix_ok) {
doublereal sum1 = 0.0, sum2 = 0.0;
for (k = 0; k < m_nsp; k++) {
for (int k = 0; k < m_nsp; k++) {
sum1 += m_molefracs[k] * m_cond[k];
sum2 += m_molefracs[k] / m_cond[k];
}
m_lambda = 0.5*(sum1 + 1.0/sum2);
m_cond_mix_ok = true;
}
return m_lambda;
}
@ -257,9 +378,8 @@ namespace Cantera {
* MultiTransport instead. This methods fills out array dt with
* zeros.
*/
void LiquidTransport::getThermalDiffCoeffs(doublereal* dt) {
int k;
for (k = 0; k < m_nsp; k++) {
void LiquidTransport::getThermalDiffCoeffs(doublereal* const dt) {
for (int k = 0; k < m_nsp; k++) {
dt[k] = 0.0;
}
}
@ -296,8 +416,8 @@ namespace Cantera {
void LiquidTransport::getSpeciesFluxesExt(int ldf, doublereal* fluxes) {
int n, k;
update_T();
update_C();
update_temp();
update_conc();
getMixDiffCoeffs(DATA_PTR(m_spwork));
@ -330,14 +450,16 @@ namespace Cantera {
* This is need to avoid a Nan result in the formula
* below.
*/
void LiquidTransport::getMixDiffCoeffs(doublereal* d) {
void LiquidTransport::getMixDiffCoeffs(doublereal* const d) {
update_T();
update_C();
update_temp();
update_conc();
// update the binary diffusion coefficients if necessary
if (!m_bindiff_ok) updateDiff_T();
if (!m_diff_temp_ok) {
updateDiff_temp();
}
int k, j;
doublereal mmw = m_thermo->meanMolecularWeight();
doublereal sumxw = 0.0, sum2;
@ -369,21 +491,24 @@ namespace Cantera {
* This is called whenever a transport property is
* requested.
* The first task is to check whether the temperature has changed
* since the last call to update_T().
* since the last call to update_temp().
* If it hasn't then an immediate return is carried out.
*
* @internal
*/
void LiquidTransport::update_T()
void LiquidTransport::update_temp()
{
// First make a decision about whether we need to recalculate
doublereal t = m_thermo->temperature();
if (t == m_temp) return;
// Next do a reality check on temperature value
if (t < 0.0) {
throw CanteraError("LiquidTransport::update_T",
throw CanteraError("LiquidTransport::update_temp()",
"negative temperature "+fp2str(t));
}
// Compute various functions of temperature
// Compute various direct functions of temperature
m_temp = t;
m_logt = log(m_temp);
m_kbt = Boltzmann * m_temp;
@ -393,64 +518,73 @@ namespace Cantera {
m_sqrt_kbt = sqrt(Boltzmann*m_temp);
// compute powers of log(T)
// -> may move this
m_polytempvec[0] = 1.0;
m_polytempvec[1] = m_logt;
m_polytempvec[2] = m_logt*m_logt;
m_polytempvec[3] = m_logt*m_logt*m_logt;
m_polytempvec[4] = m_logt*m_logt*m_logt*m_logt;
// temperature has changed so temp flags are flipped
m_visc_temp_ok = false;
m_diff_temp_ok = false;
// temperature has changed, so polynomial temperature
// interpolations will need to be reevaluated.
// Set all of these flags to false
m_viscmix_ok = false;
m_spvisc_ok = false;
m_viscwt_ok = false;
m_spcond_ok = false;
m_diffmix_ok = false;
m_bindiff_ok = false;
m_condmix_ok = false;
// This means that many concentration
m_visc_conc_ok = false;
m_cond_temp_ok = false;
// Mixture stuff needs to be evaluated
m_visc_mix_ok = false;
m_diff_mix_ok = false;
// m_cond_mix_ok = false; (don't need it because a lower lvl flag is set
// For now, for a concentration redo also
m_iStateMF = -1;
}
/**
* @internal This is called the first time any transport property
* is requested from Mixture after the concentrations
* have changed.
*/
void LiquidTransport::update_C()
{
// Handles the effects of changes in the mixture concentration
/*
* This is called for every interface call to check whether
* the concentrations have changed. Concentrations change
* whenever the pressure or the mole fraction has changed.
* If it has changed, the recalculations should be done.
*
* Note this should be a lightweight function since it's
* part of all of the interfaces.
*
* @internal
*/
void LiquidTransport::update_conc() {
// If the pressure has changed then the concentrations
// have changed.
doublereal pres = m_thermo->pressure();
// Check for changes in the mole fraction vector.
//int iStateNew = m_thermo->getIStateMF();
//if (iStateNew == m_iStateMF) {
// if (pres == m_press) {
// return;
// }
// } else {
// m_iStateMF = iStateNew;
//}
m_press = pres;
bool qReturn = true;
if (pres != m_press) {
qReturn = false;
m_press = pres;
}
int iStateNew = m_thermo->stateMFNumber();
if (iStateNew != m_iStateMF) {
qReturn = false;
m_thermo->getMoleFractions(DATA_PTR(m_molefracs));
for (int k = 0; k < m_nsp; k++) {
m_molefracs[k] = fmaxx(MIN_X, m_molefracs[k]);
}
}
if (qReturn) {
return;
}
// signal that concentration-dependent quantities will need to
// be recomputed before use, and update the local mole
// fractions.
m_viscmix_ok = false;
m_diffmix_ok = false;
m_condmix_ok = false;
m_thermo->getMoleFractions(DATA_PTR(m_molefracs));
// add an offset to avoid a pure species condition or
// negative mole fractions. MIN_X is 1.0E-20, a value
// which is below the additive machine precision of mole fractions.
int k;
for (k = 0; k < m_nsp; k++) {
m_molefracs[k] = fmaxx(MIN_X, m_molefracs[k]);
}
m_visc_conc_ok = false;
// Mixture stuff needs to be evaluated
m_visc_mix_ok = false;
m_diff_mix_ok = false;
m_cond_mix_ok = false;
}
@ -464,21 +598,20 @@ namespace Cantera {
* Update the temperature-dependent parts of the mixture-averaged
* thermal conductivity.
*/
void LiquidTransport::updateCond_T() {
void LiquidTransport::updateCond_temp() {
int k;
if (m_mode == CK_Mode) {
for (k = 0; k < m_nsp; k++) {
m_cond[k] = exp(dot4(m_polytempvec, m_condcoeffs[k]));
}
}
else {
} else {
for (k = 0; k < m_nsp; k++) {
m_cond[k] = m_sqrt_t*dot5(m_polytempvec, m_condcoeffs[k]);
m_cond[k] = m_sqrt_t * dot5(m_polytempvec, m_condcoeffs[k]);
}
}
m_spcond_ok = true;
m_condmix_ok = false;
m_cond_temp_ok = true;
m_cond_mix_ok = false;
}
@ -486,7 +619,7 @@ namespace Cantera {
* Update the binary diffusion coefficients. These are evaluated
* from the polynomial fits at unit pressure (1 Pa).
*/
void LiquidTransport::updateDiff_T() {
void LiquidTransport::updateDiff_temp() {
// evaluate binary diffusion coefficients at unit pressure
int i,j;
@ -511,17 +644,29 @@ namespace Cantera {
}
}
m_bindiff_ok = true;
m_diffmix_ok = false;
m_diff_temp_ok = true;
m_diff_mix_ok = false;
}
/**
* Update the pure-species viscosities.
*/
void LiquidTransport::updateSpeciesViscosities() {
void LiquidTransport::updateViscosities_conc() {
m_visc_conc_ok = true;
}
/**
* Update the temperature-dependent viscosity terms.
* Updates the array of pure species viscosities, and the
* weighting functions in the viscosity mixture rule.
* The flag m_visc_ok is set to true.
*/
void LiquidTransport::updateViscosity_temp() {
int k;
doublereal vratiokj, wratiojk, factor1;
if (m_mode == CK_Mode) {
for (k = 0; k < m_nsp; k++) {
m_visc[k] = exp(dot4(m_polytempvec, viscCoeffsVector_[k]));
@ -535,23 +680,9 @@ namespace Cantera {
m_visc[k] = (m_sqvisc[k]*m_sqvisc[k]);
}
}
m_spvisc_ok = true;
}
/**
* Update the temperature-dependent viscosity terms.
* Updates the array of pure species viscosities, and the
* weighting functions in the viscosity mixture rule.
* The flag m_visc_ok is set to true.
*/
void LiquidTransport::updateViscosity_T() {
doublereal vratiokj, wratiojk, factor1;
if (!m_spvisc_ok) updateSpeciesViscosities();
// see Eq. (9-5.15) of Reid, Prausnitz, and Poling
int j, k;
int j;
for (j = 0; j < m_nsp; j++) {
for (k = j; k < m_nsp; k++) {
vratiokj = m_visc[k]/m_visc[j];
@ -565,26 +696,9 @@ namespace Cantera {
m_phi(j,k) = m_phi(k,j)/(vratiokj * wratiojk);
}
}
m_viscwt_ok = true;
}
/**
* This function returns a Transport data object for a given species.
*
*/
struct GasTransportData LiquidTransport::
getGasTransportData(int kSpecies)
{
struct GasTransportData td;
td.speciesName = m_thermo->speciesName(kSpecies);
td.wellDepth = m_eps[kSpecies] / Boltzmann;
td.diameter = m_diam(kSpecies, kSpecies) * 1.0E10;
td.polarizability = m_alpha[kSpecies] * 1.0E30;
return td;
m_visc_temp_ok = true;
m_visc_mix_ok = false;
}

View file

@ -29,8 +29,9 @@ using namespace std;
namespace Cantera {
const int LVISC_CONSTANT = 0;
const int LVISC_WILKES = 1;
const int LVISC_CONSTANT = 0;
const int LVISC_WILKES = 1;
const int LVISC_MIXTUREAVG = 2;
@ -128,14 +129,46 @@ namespace Cantera {
*
*/
class LiquidTransport : public Transport {
public:
//! default constructor
LiquidTransport(thermo_t* thermo = 0, int ndim = 1);
//!Copy Constructor for the %LiquidThermo object.
/*!
* @param right ThermoPhase to be copied
*/
LiquidTransport(const LiquidTransport &right);
//! Assignment operator
/*!
* This is NOT a virtual function.
*
* @param right Reference to %ThermoPhase object to be copied into the
* current one.
*/
LiquidTransport& operator=(const LiquidTransport& right);
//! Duplication routine for objects which inherit from
//! %Transport
/*!
* This virtual routine can be used to duplicate %Transport objects
* inherited from %Transport even if the application only has
* a pointer to %Transport to work with.
*
* These routines are basically wrappers around the derived copy
* constructor.
*/
virtual Transport *duplMyselfAsTransport() const;
//! virtual destructor
virtual ~LiquidTransport() {}
//! Return the model id for this transport parameterization
virtual int model() { return cLiquidTransport; }
virtual int model() {
return cLiquidTransport;
}
//! overloaded base class methods
@ -161,12 +194,11 @@ namespace Cantera {
//! Returns the pure species viscosities
/*!
*
* Controlling update boolean = m_viscwt_ok
*
*/
virtual void getSpeciesViscosities(doublereal* visc)
{ updateViscosity_T(); copy(m_visc.begin(), m_visc.end(), visc); }
virtual void getSpeciesViscosities(doublereal* const visc);
virtual void getThermalDiffCoeffs(doublereal* dt);
virtual void getThermalDiffCoeffs(doublereal* const dt);
//! Return the thermal conductivity of the solution
/*!
@ -185,43 +217,44 @@ namespace Cantera {
* @param ld
* @param d
*/
virtual void getBinaryDiffCoeffs(int ld, doublereal* d);
virtual void getBinaryDiffCoeffs(int ld, doublereal* const d);
//! Get the Mixture diffusion coefficients
/*!
* @param d vector of mixture diffusion coefficients
* units = m2 s-1. length = number of species
*/
virtual void getMixDiffCoeffs(doublereal* d);
virtual void getMixDiffCoeffs(doublereal* const d);
//! Get the Mobilities
/*!
* @param mobil
*/
virtual void getMobilities(doublereal* mobil);
virtual void getMobilities(doublereal* const mobil);
//! Specify the value of the gradient of the voltage
/*!
*
* @param grad_V Gradient of the voltage (length num dimensions);
*/
virtual void set_Grad_V(const doublereal* grad_V);
virtual void set_Grad_V(const doublereal* const grad_V);
//! Specify the value of the gradient of the temperature
/*!
*
* @param grad_V Gradient of the temperature (length num dimensions);
*/
virtual void set_Grad_T(const doublereal* grad_T);
virtual void set_Grad_T(const doublereal* const grad_T);
//! Specify the value of the gradient of the MoleFractions
/*!
*
* @param grad_X Gradient of the mole fractions(length nsp * num dimensions);
*/
virtual void set_Grad_X(const doublereal* grad_X);
virtual void set_Grad_X(const doublereal* const grad_X);
protected:
//! Handles the effects of changes in the Temperature, internally
//! within the object.
/*!
@ -231,20 +264,29 @@ namespace Cantera {
* since the last call to update_T().
* If it hasn't then an immediate return is carried out.
*
* @internal
*/
virtual void update_T();
//! Handles the effects of changes in the mixture concentration
/*!
* This is called the first time any transport property
* is requested from Mixture after the concentrations
* have changed.
*
* Note this should be a lightweight function since it's
* part of all of the interfaces.
*
* @internal
*/
virtual void update_C();
virtual void update_temp();
//! Handles the effects of changes in the mixture concentration
/*!
* This is called for every interface call to check whether
* the concentrations have changed. Concentrations change
* whenever the pressure or the mole fraction has changed.
* If it has changed, the recalculations should be done.
*
* Note this should be a lightweight function since it's
* part of all of the interfaces.
*
* @internal
*/
virtual void update_conc();
public:
/**
* @param ndim The number of spatial dimensions (1, 2, or 3).
* @param grad_T The temperature gradient (ignored in this model).
@ -281,22 +323,11 @@ namespace Cantera {
friend class TransportFactory;
/**
* Return a structure containing all of the pertinent parameters
* about a species that was used to construct the Transport
* properties in this object.
*
* @param k Species number to obtain the properties about.
*/
struct GasTransportData getGasTransportData(int k);
//! Solve the stefan_maxell equations for the diffusive fluxes.
void stefan_maxwell_solve();
protected:
//! default constructor
LiquidTransport();
private:
@ -325,7 +356,7 @@ namespace Cantera {
* These express the temperature dependendence of the pures
* species viscosities.
*/
std::vector<vector_fp> viscCoeffsVector_;
std::vector<vector_fp> viscCoeffsVector_;
//! Polynomial coefficients of the conductivities
/*!
@ -398,7 +429,7 @@ namespace Cantera {
*
* units m2/sec
*/
DenseMatrix m_bdiff;
DenseMatrix m_bdiff;
//! Species viscosities
/*!
@ -547,58 +578,62 @@ namespace Cantera {
vector_fp m_spwork;
//! Internal Function
protected:
//! Update the temperature-dependent viscosity terms.
//! Updates the array of pure species viscosities, and the
//! weighting functions in the viscosity mixture rule.
/*!
* The flag m_visc_ok is set to true.
*/
void updateViscosity_T();
void updateViscosity_temp();
//! Update the temperature-dependent parts of the mixture-averaged
//! thermal conductivity.
void updateCond_T();
void updateCond_temp();
//! Update the species viscosities
//! Update the concentration parts of the viscosities
/*!
* Internal routine is run whenever the update_boolean
* m_spvisc_ok is false. This routine will calculate
* m_visc_conc_ok is false. This routine will calculate
* internal values for the species viscosities.
*
* @internal
*/
void updateSpeciesViscosities();
void updateViscosities_conc();
//! Update the binary diffusion coefficients wrt T.
/*!
* These are evaluated
* from the polynomial fits at unit pressure (1 Pa).
*/
void updateDiff_T();
//! Boolean indicating that mixture viscosity is current
bool m_viscmix_ok;
void updateDiff_temp();
private:
//! Boolean indicating that the top-level mixture viscosity is current
/*!
* This is turned false for every change in T, P, or C.
*/
bool m_visc_mix_ok;
//! Boolean indicating that weight factors wrt viscosity is current
bool m_viscwt_ok;
bool m_visc_temp_ok;
//! Flag to indicate that the pure species viscosities
//! are current wrt the temperature
bool m_spvisc_ok;
bool m_visc_conc_ok;
//! Boolean indicating that mixture diffusion coeffs are current
bool m_diffmix_ok;
bool m_diff_mix_ok;
//! Boolean indicating that binary diffusion coeffs are current
bool m_bindiff_ok;
bool m_diff_temp_ok;
//! Flag to indicate that the pure species conductivities
//! are current wrt the temperature
bool m_spcond_ok;
bool m_cond_temp_ok;
//! Boolean indicating that mixture conductivity is current
bool m_condmix_ok;
bool m_cond_mix_ok;
//! Mode for fitting the species viscosities
/*!

View file

@ -35,7 +35,7 @@ CXX_FLAGS = @CXXFLAGS@ $(CXX_OPT) $(PIC_FLAG) $(DEBUG_FLAG)
# Base Transport Object Files
TRAN_OBJ = TransportFactory.o MultiTransport.o MixTransport.o MMCollisionInt.o \
SolidTransport.o DustyGasTransport.o
SolidTransport.o DustyGasTransport.o TransportBase.o
TRAN_H = TransportFactory.h MultiTransport.h MixTransport.h \
MMCollisionInt.h SolidTransport.h DustyGasTransport.h \

View file

@ -0,0 +1,113 @@
/**
* @file TransportBase.cpp
* Mixture-averaged transport properties for ideal gas mixtures.
*/
/*
* $Revision$
* $Date$
*/
#include "ThermoPhase.h"
#include "LiquidTransport.h"
#include "utilities.h"
#include "LiquidTransportParams.h"
#include "TransportFactory.h"
#include "ctlapack.h"
#include <iostream>
using namespace std;
/**
* Mole fractions below MIN_X will be set to MIN_X when computing
* transport properties.
*/
#define MIN_X 1.e-20
namespace Cantera {
//////////////////// class LiquidTransport methods //////////////
Transport::Transport(thermo_t* thermo, int ndim) :
m_thermo(thermo),
m_ready(false),
m_nmin(0),
m_index(-1),
m_nDim(ndim)
{
}
Transport::Transport(const Transport &right)
{
m_thermo = right.m_thermo;
m_ready = right.m_ready;
m_nmin = right.m_nmin;
m_index = right.m_index;
m_nDim = right.m_nDim;
}
Transport& Transport::operator=(const Transport& right) {
if (&right != this) {
return *this;
}
m_thermo = right.m_thermo;
m_ready = right.m_ready;
m_nmin = right.m_nmin;
m_index = right.m_index;
m_nDim = right.m_nDim;
return *this;
}
Transport *Transport::duplMyselfAsTransport() const {
Transport* tr = new Transport(*this);
return tr;
}
Transport::~Transport() {
}
bool Transport::ready() {
return m_ready;
}
int Transport::index() const {
return m_index;
}
/*
* Set an integer index number. This is for internal use of
* Cantera, and may be removed in the future.
*/
void Transport::setIndex(int i) {
m_index = i;
}
//! Set the number of dimensions to be expected in flux expressions
/*!
* Internal memory will be set with this value
*/
void Transport::setNDim(const int ndim) {
m_nDim = ndim;
}
/*
* Set transport model parameters. This method may be
* overloaded in subclasses to set model-specific parameters.
*/
void Transport::setParameters(const int type, const int k,
const doublereal* const p)
{
err("setParameters");
}
}

View file

@ -61,6 +61,45 @@ namespace Cantera {
public:
/**
* Constructor. New transport managers should be created using
* TransportFactory, not by calling the constructor directly.
* @see TransportFactory
*/
Transport(thermo_t* thermo=0, int ndim = 1);
///< Destructor.
virtual ~Transport();
//! Copy Constructor for the %Transport object.
/*!
* @param right Transport to be copied
*/
Transport(const Transport &right);
//! Assignment operator
/*!
* This is NOT a virtual function.
*
* @param right Reference to Transport object to be copied into the
* current one.
*/
Transport& operator=(const Transport& right);
//! Duplication routine for objects which inherit from
//! %Transport
/*!
* This virtual routine can be used to duplicate %Transport objects
* inherited from %Transport even if the application only has
* a pointer to %Transport to work with.
*
* These routines are basically wrappers around the derived copy
* constructor.
*/
virtual Transport *duplMyselfAsTransport() const;
/**
* Transport model. The transport model is the set of
* equations used to compute the transport properties. This
@ -82,27 +121,25 @@ namespace Cantera {
/**
* Returns true if the transport manager is ready for use.
*/
bool ready() { return m_ready; }
bool ready();
/**
* Returns an integer index number. This is for internal use
* of Cantera, and may be removed in the future.
*/
int index() { return m_index; }
int index() const ;
/**
* Set an integer index number. This is for internal use of
* Cantera, and may be removed in the future.
*/
void setIndex(int i) { m_index = i; }
void setIndex(int i);
//! Set the number of dimensions to be expected in flux expressions
/*!
* Internal memory will be set with this value
*/
void setNDim(int ndim) { m_nDim = ndim; }
void setNDim(const int ndim);
//! return the number of dimensions
int nDim() const { return m_nDim; }
@ -257,21 +294,12 @@ namespace Cantera {
* Set transport model parameters. This method may be
* overloaded in subclasses to set model-specific parameters.
*/
virtual void setParameters(int type, int k, doublereal* p)
{ err("setParameters"); }
virtual ~Transport(){} ///< Destructor.
virtual void setParameters(const int type, const int k,
const doublereal* const p);
friend class TransportFactory;
/**
* Constructor. New transport managers should be created using
* TransportFactory, not by calling the constructor directly.
* @see TransportFactory
*/
Transport(thermo_t* thermo=0, int ndim = 1)
: m_thermo(thermo), m_ready(false), m_nmin(0), m_index(-1),
m_nDim(ndim) {}
protected: