Doxygen update: no code changes

Added a cLiquidTransport for an electrolyte transport capability
  under construction
This commit is contained in:
Harry Moffat 2007-07-27 00:25:56 +00:00
parent be6c44da59
commit 4b702bae5b
4 changed files with 817 additions and 782 deletions

View file

@ -1,5 +1,4 @@
/**
*
* @file MixTransport.cpp
* Mixture-averaged transport properties for ideal gas mixtures.
*/
@ -37,485 +36,485 @@ using namespace std;
namespace Cantera {
//////////////////// class MixTransport methods //////////////
//////////////////// class MixTransport methods //////////////
MixTransport::MixTransport() :
m_nsp(0),
m_tmin(-1.0),
m_tmax(100000.),
m_temp(-1.0),
m_logt(0.0)
{
MixTransport::MixTransport() :
m_nsp(0),
m_tmin(-1.0),
m_tmax(100000.),
m_temp(-1.0),
m_logt(0.0)
{
}
bool MixTransport::init(TransportParams& tr) {
// constant substance attributes
m_thermo = tr.thermo;
m_nsp = m_thermo->nSpecies();
m_tmin = m_thermo->minTemp();
m_tmax = m_thermo->maxTemp();
// make a local copy of the molecular weights
m_mw.resize(m_nsp);
copy(m_thermo->molecularWeights().begin(),
m_thermo->molecularWeights().end(), m_mw.begin());
// copy polynomials and parameters into local storage
m_poly = tr.poly;
m_visccoeffs = tr.visccoeffs;
m_condcoeffs = tr.condcoeffs;
m_diffcoeffs = tr.diffcoeffs;
m_zrot = tr.zrot;
m_crot = tr.crot;
m_epsilon = tr.epsilon;
m_mode = tr.mode;
m_diam = tr.diam;
m_eps = tr.eps;
m_alpha = tr.alpha;
m_dipoleDiag.resize(m_nsp);
for (int i = 0; i < m_nsp; i++) {
m_dipoleDiag[i] = tr.dipole(i,i);
}
bool MixTransport::init(TransportParams& tr) {
// constant substance attributes
m_thermo = tr.thermo;
m_nsp = m_thermo->nSpecies();
m_tmin = m_thermo->minTemp();
m_tmax = m_thermo->maxTemp();
// make a local copy of the molecular weights
m_mw.resize(m_nsp);
copy(m_thermo->molecularWeights().begin(),
m_thermo->molecularWeights().end(), m_mw.begin());
// copy polynomials and parameters into local storage
m_poly = tr.poly;
m_visccoeffs = tr.visccoeffs;
m_condcoeffs = tr.condcoeffs;
m_diffcoeffs = tr.diffcoeffs;
m_zrot = tr.zrot;
m_crot = tr.crot;
m_epsilon = tr.epsilon;
m_mode = tr.mode;
m_diam = tr.diam;
m_eps = tr.eps;
m_alpha = tr.alpha;
m_dipoleDiag.resize(m_nsp);
for (int i = 0; i < m_nsp; i++) {
m_dipoleDiag[i] = tr.dipole(i,i);
}
m_phi.resize(m_nsp, m_nsp, 0.0);
m_wratjk.resize(m_nsp, m_nsp, 0.0);
m_wratkj1.resize(m_nsp, m_nsp, 0.0);
int j, k;
for (j = 0; j < m_nsp; j++)
for (k = j; k < m_nsp; k++) {
m_wratjk(j,k) = sqrt(m_mw[j]/m_mw[k]);
m_wratjk(k,j) = sqrt(m_wratjk(j,k));
m_wratkj1(j,k) = sqrt(1.0 + m_mw[k]/m_mw[j]);
}
m_phi.resize(m_nsp, m_nsp, 0.0);
m_wratjk.resize(m_nsp, m_nsp, 0.0);
m_wratkj1.resize(m_nsp, m_nsp, 0.0);
int j, k;
for (j = 0; j < m_nsp; j++)
for (k = j; k < m_nsp; k++) {
m_wratjk(j,k) = sqrt(m_mw[j]/m_mw[k]);
m_wratjk(k,j) = sqrt(m_wratjk(j,k));
m_wratkj1(j,k) = sqrt(1.0 + m_mw[k]/m_mw[j]);
}
m_polytempvec.resize(5);
m_visc.resize(m_nsp);
m_sqvisc.resize(m_nsp);
m_cond.resize(m_nsp);
m_bdiff.resize(m_nsp, m_nsp);
m_polytempvec.resize(5);
m_visc.resize(m_nsp);
m_sqvisc.resize(m_nsp);
m_cond.resize(m_nsp);
m_bdiff.resize(m_nsp, m_nsp);
m_molefracs.resize(m_nsp);
m_spwork.resize(m_nsp);
m_molefracs.resize(m_nsp);
m_spwork.resize(m_nsp);
// set flags all 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_abc_ok = false;
// set flags all 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_abc_ok = false;
return true;
}
return true;
}
/*********************************************************
*
* Public methods
*
*********************************************************/
/*********************************************************
*
* Public methods
*
*********************************************************/
/****************** viscosity ******************************/
/****************** viscosity ******************************/
/**
* The viscosity is computed using the Wilke mixture rule.
* \f[
* \mu = \sum_k \frac{\mu_k X_k}{\sum_j \Phi_{k,j} X_j}.
* \f]
* Here \f$ \mu_k \f$ is the viscosity of pure species \e k,
* and
* \f[
* \Phi_{k,j} = \frac{\left[1
* + \sqrt{\left(\frac{\mu_k}{\mu_j}\sqrt{\frac{M_j}{M_k}}\right)}\right]^2}
* {\sqrt{8}\sqrt{1 + M_k/M_j}}
* \f]
* @see updateViscosity_T();
*/
doublereal MixTransport::viscosity() {
/**
* The viscosity is computed using the Wilke mixture rule.
* \f[
* \mu = \sum_k \frac{\mu_k X_k}{\sum_j \Phi_{k,j} X_j}.
* \f]
* Here \f$ \mu_k \f$ is the viscosity of pure species \e k,
* and
* \f[
* \Phi_{k,j} = \frac{\left[1
* + \sqrt{\left(\frac{\mu_k}{\mu_j}\sqrt{\frac{M_j}{M_k}}\right)}\right]^2}
* {\sqrt{8}\sqrt{1 + M_k/M_j}}
* \f]
* @see updateViscosity_T();
*/
doublereal MixTransport::viscosity() {
update_T();
update_C();
update_T();
update_C();
if (m_viscmix_ok) return m_viscmix;
if (m_viscmix_ok) return m_viscmix;
doublereal vismix = 0.0;
int k;
// update m_visc and m_phi if necessary
if (!m_viscwt_ok) updateViscosity_T();
doublereal vismix = 0.0;
int k;
// 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));
multiply(m_phi, DATA_PTR(m_molefracs), DATA_PTR(m_spwork));
for (k = 0; k < m_nsp; k++) {
vismix += m_molefracs[k] * m_visc[k]/m_spwork[k]; //denom;
}
m_viscmix = vismix;
return vismix;
for (k = 0; k < m_nsp; k++) {
vismix += m_molefracs[k] * m_visc[k]/m_spwork[k]; //denom;
}
m_viscmix = vismix;
return vismix;
}
/******************* binary diffusion coefficients **************/
/******************* binary diffusion coefficients **************/
void MixTransport::getBinaryDiffCoeffs(int ld, doublereal* d) {
int i,j;
void MixTransport::getBinaryDiffCoeffs(int ld, doublereal* d) {
int i,j;
update_T();
update_T();
// if necessary, evaluate the binary diffusion coefficents
// from the polynomial fits
if (!m_bindiff_ok) updateDiff_T();
// if necessary, evaluate the binary diffusion coefficents
// from the polynomial fits
if (!m_bindiff_ok) updateDiff_T();
doublereal rp = 1.0/pressure_ig();
for (i = 0; i < m_nsp; i++)
for (j = 0; j < m_nsp; j++) {
d[ld*j + i] = rp * m_bdiff(i,j);
}
doublereal rp = 1.0/pressure_ig();
for (i = 0; i < m_nsp; i++)
for (j = 0; j < m_nsp; j++) {
d[ld*j + i] = rp * m_bdiff(i,j);
}
}
void MixTransport::getMobilities(doublereal* mobil) {
int k;
getMixDiffCoeffs(DATA_PTR(m_spwork));
doublereal c1 = ElectronCharge / (Boltzmann * m_temp);
for (k = 0; k < m_nsp; k++) {
mobil[k] = c1 * m_spwork[k] * m_thermo->charge(k);
}
void MixTransport::getMobilities(doublereal* mobil) {
int k;
getMixDiffCoeffs(DATA_PTR(m_spwork));
doublereal c1 = ElectronCharge / (Boltzmann * m_temp);
for (k = 0; k < m_nsp; k++) {
mobil[k] = c1 * m_spwork[k] * m_thermo->charge(k);
}
}
}
/****************** thermal conductivity **********************/
/****************** thermal conductivity **********************/
/**
* The thermal conductivity is computed from the following mixture rule:
* \[
* \lambda = 0.5 \left( \sum_k X_k \lambda_k
* + \frac{1}{\sum_k X_k/\lambda_k}\right)
* \]
*/
doublereal MixTransport::thermalConductivity() {
int k;
/**
* The thermal conductivity is computed from the following mixture rule:
* \[
* \lambda = 0.5 \left( \sum_k X_k \lambda_k
* + \frac{1}{\sum_k X_k/\lambda_k}\right)
* \]
*/
doublereal MixTransport::thermalConductivity() {
int k;
update_T();
update_C();
update_T();
update_C();
if (!m_spcond_ok) updateCond_T();
if (!m_condmix_ok) {
doublereal sum1 = 0.0, sum2 = 0.0;
for (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);
}
return m_lambda;
if (!m_spcond_ok) updateCond_T();
if (!m_condmix_ok) {
doublereal sum1 = 0.0, sum2 = 0.0;
for (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);
}
return m_lambda;
}
/****************** thermal diffusion coefficients ************/
/****************** thermal diffusion coefficients ************/
/**
* Thermal diffusion is not considered in this mixture-averaged
* model. To include thermal diffusion, use transport manager
* MultiTransport instead. This methods fills out array dt with
* zeros.
*/
void MixTransport::getThermalDiffCoeffs(doublereal* dt) {
int k;
for (k = 0; k < m_nsp; k++) {
dt[k] = 0.0;
}
/**
* Thermal diffusion is not considered in this mixture-averaged
* model. To include thermal diffusion, use transport manager
* MultiTransport instead. This methods fills out array dt with
* zeros.
*/
void MixTransport::getThermalDiffCoeffs(doublereal* dt) {
int k;
for (k = 0; k < m_nsp; k++) {
dt[k] = 0.0;
}
}
/**
* @param ndim The number of spatial dimensions (1, 2, or 3).
* @param grad_T The temperature gradient (ignored in this model).
* @param ldx Leading dimension of the grad_X array.
* The diffusive mass flux of species \e k is computed from
* \f[
* \vec{j}_k = -n M_k D_k \nabla X_k.
* \f]
*/
void MixTransport::getSpeciesFluxes(int ndim,
const doublereal* grad_T, int ldx, const doublereal* grad_X,
int ldf, doublereal* fluxes) {
int n, k;
/**
* @param ndim The number of spatial dimensions (1, 2, or 3).
* @param grad_T The temperature gradient (ignored in this model).
* @param ldx Leading dimension of the grad_X array.
* The diffusive mass flux of species \e k is computed from
* \f[
* \vec{j}_k = -n M_k D_k \nabla X_k.
* \f]
*/
void MixTransport::getSpeciesFluxes(int ndim,
const doublereal* grad_T, int ldx, const doublereal* grad_X,
int ldf, doublereal* fluxes) {
int n, k;
update_T();
update_C();
update_T();
update_C();
getMixDiffCoeffs(DATA_PTR(m_spwork));
getMixDiffCoeffs(DATA_PTR(m_spwork));
const array_fp& mw = m_thermo->molecularWeights();
const doublereal* y = m_thermo->massFractions();
doublereal rhon = m_thermo->molarDensity();
const array_fp& mw = m_thermo->molecularWeights();
const doublereal* y = m_thermo->massFractions();
doublereal rhon = m_thermo->molarDensity();
vector_fp sum(ndim,0.0);
for (n = 0; n < ndim; n++) {
for (k = 0; k < m_nsp; k++) {
fluxes[n*ldf + k] = -rhon * mw[k] * m_spwork[k] * grad_X[n*ldx + k];
sum[n] += fluxes[n*ldf + k];
}
}
// add correction flux to enforce sum to zero
for (n = 0; n < ndim; n++) {
for (k = 0; k < m_nsp; k++) {
fluxes[n*ldf + k] -= y[k]*sum[n];
}
}
vector_fp sum(ndim,0.0);
for (n = 0; n < ndim; n++) {
for (k = 0; k < m_nsp; k++) {
fluxes[n*ldf + k] = -rhon * mw[k] * m_spwork[k] * grad_X[n*ldx + k];
sum[n] += fluxes[n*ldf + k];
}
}
// add correction flux to enforce sum to zero
for (n = 0; n < ndim; n++) {
for (k = 0; k < m_nsp; k++) {
fluxes[n*ldf + k] -= y[k]*sum[n];
}
}
}
/**
* Mixture-averaged diffusion coefficients [m^2/s].
*
* For the single species case or the pure fluid case
* the routine returns the self-diffusion coefficient.
* This is need to avoid a Nan result in the formula
* below.
*/
void MixTransport::getMixDiffCoeffs(doublereal* d) {
/**
* Mixture-averaged diffusion coefficients [m^2/s].
*
* For the single species case or the pure fluid case
* the routine returns the self-diffusion coefficient.
* This is need to avoid a Nan result in the formula
* below.
*/
void MixTransport::getMixDiffCoeffs(doublereal* d) {
update_T();
update_C();
update_T();
update_C();
// update the binary diffusion coefficients if necessary
if (!m_bindiff_ok) updateDiff_T();
// update the binary diffusion coefficients if necessary
if (!m_bindiff_ok) updateDiff_T();
int k, j;
doublereal mmw = m_thermo->meanMolecularWeight();
doublereal sumxw = 0.0, sum2;
doublereal p = pressure_ig();
if (m_nsp == 1) {
d[0] = m_bdiff(0,0) / p;
} else {
for (k = 0; k < m_nsp; k++) sumxw += m_molefracs[k] * m_mw[k];
for (k = 0; k < m_nsp; k++) {
sum2 = 0.0;
for (j = 0; j < m_nsp; j++) {
if (j != k) {
sum2 += m_molefracs[j] / m_bdiff(j,k);
}
}
if (sum2 <= 0.0) {
d[k] = m_bdiff(k,k) / p;
} else {
d[k] = (sumxw - m_molefracs[k] * m_mw[k])/(p * mmw * sum2);
}
int k, j;
doublereal mmw = m_thermo->meanMolecularWeight();
doublereal sumxw = 0.0, sum2;
doublereal p = pressure_ig();
if (m_nsp == 1) {
d[0] = m_bdiff(0,0) / p;
} else {
for (k = 0; k < m_nsp; k++) sumxw += m_molefracs[k] * m_mw[k];
for (k = 0; k < m_nsp; k++) {
sum2 = 0.0;
for (j = 0; j < m_nsp; j++) {
if (j != k) {
sum2 += m_molefracs[j] / m_bdiff(j,k);
}
}
if (sum2 <= 0.0) {
d[k] = m_bdiff(k,k) / p;
} else {
d[k] = (sumxw - m_molefracs[k] * m_mw[k])/(p * mmw * sum2);
}
}
}
}
/**
* @internal This is called whenever a transport property is
* requested from ThermoSubstance if the temperature has changed
* since the last call to update_T.
*/
void MixTransport::update_T()
{
doublereal t = m_thermo->temperature();
if (t == m_temp) return;
if (t < 0.0) {
throw CanteraError("MixTransport::update_T",
"negative temperature "+fp2str(t));
}
m_temp = t;
m_logt = log(m_temp);
m_kbt = Boltzmann * m_temp;
m_sqrt_t = sqrt(m_temp);
m_t14 = sqrt(m_sqrt_t);
m_t32 = m_temp * m_sqrt_t;
m_sqrt_kbt = sqrt(Boltzmann*m_temp);
// compute powers of log(T)
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 polynomial fits will need to be
// redone.
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_abc_ok = false;
m_condmix_ok = false;
}
/**
* @internal This is called the first time any transport property
* is requested from Mixture after the concentrations
* have changed.
*/
void MixTransport::update_C()
{
// 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
int k;
for (k = 0; k < m_nsp; k++) {
m_molefracs[k] = fmaxx(MIN_X, m_molefracs[k]);
}
/**
* @internal This is called whenever a transport property is
* requested from ThermoSubstance if the temperature has changed
* since the last call to update_T.
*/
void MixTransport::update_T()
{
doublereal t = m_thermo->temperature();
if (t == m_temp) return;
if (t < 0.0) {
throw CanteraError("MixTransport::update_T",
"negative temperature "+fp2str(t));
}
m_temp = t;
m_logt = log(m_temp);
m_kbt = Boltzmann * m_temp;
m_sqrt_t = sqrt(m_temp);
m_t14 = sqrt(m_sqrt_t);
m_t32 = m_temp * m_sqrt_t;
m_sqrt_kbt = sqrt(Boltzmann*m_temp);
// compute powers of log(T)
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;
/*************************************************************************
*
* methods to update temperature-dependent properties
*
*************************************************************************/
// temperature has changed, so polynomial fits will need to be
// redone.
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_abc_ok = false;
m_condmix_ok = false;
}
/**
* Update the temperature-dependent parts of the mixture-averaged
* thermal conductivity.
*/
void MixTransport::updateCond_T() {
/**
* @internal This is called the first time any transport property
* is requested from Mixture after the concentrations
* have changed.
*/
void MixTransport::update_C()
{
// signal that concentration-dependent quantities will need to
// be recomputed before use, and update the local mole
// fractions.
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 {
for (k = 0; k < m_nsp; k++) {
m_cond[k] = m_sqrt_t*dot5(m_polytempvec, m_condcoeffs[k]);
}
}
m_spcond_ok = true;
m_condmix_ok = false;
}
m_viscmix_ok = false;
m_diffmix_ok = false;
m_condmix_ok = false;
m_thermo->getMoleFractions(DATA_PTR(m_molefracs));
/**
* Update the binary diffusion coefficients. These are evaluated
* from the polynomial fits at unit pressure (1 Pa).
*/
void MixTransport::updateDiff_T() {
// evaluate binary diffusion coefficients at unit pressure
int i,j;
int ic = 0;
if (m_mode == CK_Mode) {
for (i = 0; i < m_nsp; i++) {
for (j = i; j < m_nsp; j++) {
m_bdiff(i,j) = exp(dot4(m_polytempvec, m_diffcoeffs[ic]));
m_bdiff(j,i) = m_bdiff(i,j);
ic++;
}
}
}
else {
for (i = 0; i < m_nsp; i++) {
for (j = i; j < m_nsp; j++) {
m_bdiff(i,j) = m_temp * m_sqrt_t*dot5(m_polytempvec,
m_diffcoeffs[ic]);
m_bdiff(j,i) = m_bdiff(i,j);
ic++;
}
}
}
m_bindiff_ok = true;
m_diffmix_ok = false;
// add an offset to avoid a pure species condition
int k;
for (k = 0; k < m_nsp; k++) {
m_molefracs[k] = fmaxx(MIN_X, m_molefracs[k]);
}
}
/**
* Update the pure-species viscosities.
*/
void MixTransport::updateSpeciesViscosities() {
/*************************************************************************
*
* methods to update temperature-dependent properties
*
*************************************************************************/
int k;
if (m_mode == CK_Mode) {
for (k = 0; k < m_nsp; k++) {
m_visc[k] = exp(dot4(m_polytempvec, m_visccoeffs[k]));
m_sqvisc[k] = sqrt(m_visc[k]);
}
}
else {
for (k = 0; k < m_nsp; k++) {
// the polynomial fit is done for sqrt(visc/sqrt(T))
m_sqvisc[k] = m_t14*dot5(m_polytempvec, m_visccoeffs[k]);
m_visc[k] = (m_sqvisc[k]*m_sqvisc[k]);
}
}
m_spvisc_ok = true;
}
/**
* Update the temperature-dependent parts of the mixture-averaged
* thermal conductivity.
*/
void MixTransport::updateCond_T() {
/**
* 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 MixTransport::updateViscosity_T() {
doublereal vratiokj, wratiojk, factor1;
if (!m_spvisc_ok) updateSpeciesViscosities();
// see Eq. (9-5.15) of Reid, Prausnitz, and Poling
int j, k;
for (j = 0; j < m_nsp; j++) {
for (k = j; k < m_nsp; k++) {
vratiokj = m_visc[k]/m_visc[j];
wratiojk = m_mw[j]/m_mw[k];
// Note that m_wratjk(k,j) holds the square root of
// m_wratjk(j,k)!
factor1 = 1.0 + (m_sqvisc[k]/m_sqvisc[j]) * m_wratjk(k,j);
m_phi(k,j) = factor1*factor1 /
(SqrtEight * m_wratkj1(j,k));
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 MixTransport::
getGasTransportData(int kSpecies)
{
struct GasTransportData td;
td.speciesName = m_thermo->speciesName(kSpecies);
td.geometry = 2;
if (m_crot[kSpecies] == 0.0) {
td.geometry = 0;
} else if (m_crot[kSpecies] == 1.0) {
td.geometry = 1;
int k;
if (m_mode == CK_Mode) {
for (k = 0; k < m_nsp; k++) {
m_cond[k] = exp(dot4(m_polytempvec, m_condcoeffs[k]));
}
td.wellDepth = m_eps[kSpecies] / Boltzmann;
td.dipoleMoment = m_dipoleDiag[kSpecies] * 1.0E25 / SqrtTen;
td.diameter = m_diam(kSpecies, kSpecies) * 1.0E10;
td.polarizability = m_alpha[kSpecies] * 1.0E30;
td.rotRelaxNumber = m_zrot[kSpecies];
return td;
}
else {
for (k = 0; k < m_nsp; k++) {
m_cond[k] = m_sqrt_t*dot5(m_polytempvec, m_condcoeffs[k]);
}
}
m_spcond_ok = true;
m_condmix_ok = false;
}
/**
* Update the binary diffusion coefficients. These are evaluated
* from the polynomial fits at unit pressure (1 Pa).
*/
void MixTransport::updateDiff_T() {
// evaluate binary diffusion coefficients at unit pressure
int i,j;
int ic = 0;
if (m_mode == CK_Mode) {
for (i = 0; i < m_nsp; i++) {
for (j = i; j < m_nsp; j++) {
m_bdiff(i,j) = exp(dot4(m_polytempvec, m_diffcoeffs[ic]));
m_bdiff(j,i) = m_bdiff(i,j);
ic++;
}
}
}
else {
for (i = 0; i < m_nsp; i++) {
for (j = i; j < m_nsp; j++) {
m_bdiff(i,j) = m_temp * m_sqrt_t*dot5(m_polytempvec,
m_diffcoeffs[ic]);
m_bdiff(j,i) = m_bdiff(i,j);
ic++;
}
}
}
m_bindiff_ok = true;
m_diffmix_ok = false;
}
/**
* Update the pure-species viscosities.
*/
void MixTransport::updateSpeciesViscosities() {
int k;
if (m_mode == CK_Mode) {
for (k = 0; k < m_nsp; k++) {
m_visc[k] = exp(dot4(m_polytempvec, m_visccoeffs[k]));
m_sqvisc[k] = sqrt(m_visc[k]);
}
}
else {
for (k = 0; k < m_nsp; k++) {
// the polynomial fit is done for sqrt(visc/sqrt(T))
m_sqvisc[k] = m_t14*dot5(m_polytempvec, m_visccoeffs[k]);
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 MixTransport::updateViscosity_T() {
doublereal vratiokj, wratiojk, factor1;
if (!m_spvisc_ok) updateSpeciesViscosities();
// see Eq. (9-5.15) of Reid, Prausnitz, and Poling
int j, k;
for (j = 0; j < m_nsp; j++) {
for (k = j; k < m_nsp; k++) {
vratiokj = m_visc[k]/m_visc[j];
wratiojk = m_mw[j]/m_mw[k];
// Note that m_wratjk(k,j) holds the square root of
// m_wratjk(j,k)!
factor1 = 1.0 + (m_sqvisc[k]/m_sqvisc[j]) * m_wratjk(k,j);
m_phi(k,j) = factor1*factor1 /
(SqrtEight * m_wratkj1(j,k));
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 MixTransport::
getGasTransportData(int kSpecies)
{
struct GasTransportData td;
td.speciesName = m_thermo->speciesName(kSpecies);
td.geometry = 2;
if (m_crot[kSpecies] == 0.0) {
td.geometry = 0;
} else if (m_crot[kSpecies] == 1.0) {
td.geometry = 1;
}
td.wellDepth = m_eps[kSpecies] / Boltzmann;
td.dipoleMoment = m_dipoleDiag[kSpecies] * 1.0E25 / SqrtTen;
td.diameter = m_diam(kSpecies, kSpecies) * 1.0E10;
td.polarizability = m_alpha[kSpecies] * 1.0E30;
td.rotRelaxNumber = m_zrot[kSpecies];
return td;
}
}

View file

@ -1,5 +1,4 @@
/**
*
* @file MixTransport.h
* Header file defining class MixTransport
*/
@ -38,148 +37,164 @@ using namespace std;
namespace Cantera {
class TransportParams;
class TransportParams;
/**
* Class MixTransport implements mixture-averaged transport
* properties for ideal gas mixtures. The model is based on that
* described by Kee, Coltrin, and Glarborg, "Theoretical and
* Practical Aspects of Chemically Reacting Flow Modeling."
*/
class MixTransport : public Transport {
public:
virtual ~MixTransport() {}
virtual int model() { return cMixtureAveraged; }
// overloaded base class methods
virtual doublereal viscosity();
virtual void getSpeciesViscosities(doublereal* visc)
{ updateViscosity_T(); copy(m_visc.begin(), m_visc.end(), visc); }
virtual void getThermalDiffCoeffs(doublereal* dt);
virtual doublereal thermalConductivity();
virtual void getBinaryDiffCoeffs(int ld, doublereal* d);
virtual void getMixDiffCoeffs(doublereal* d);
virtual void getMobilities(doublereal* mobil);
virtual void update_T();
virtual void update_C();
//! Get the species diffusive mass fluxes wrt to
//! the mass averaged velocity,
//! given the gradients in mole fraction and temperature
/*!
* Units for the returned fluxes are kg m-2 s-1.
*
* @param ndim Number of dimensions in the flux expressions
* @param grad_T Gradient of the temperature
* (length = ndim)
* @param ldx Leading dimension of the grad_X array
* (usually equal to m_nsp but not always)
* @param grad_X Gradients of the mole fraction
* Flat vector with the m_nsp in the inner loop.
* length = ldx * ndim
* @param ldf Leading dimension of the fluxes array
* (usually equal to m_nsp but not always)
* @param fluxes Output of the diffusive mass fluxes
* Flat vector with the m_nsp in the inner loop.
* length = ldx * ndim
*/
virtual void getSpeciesFluxes(int ndim,
const doublereal* grad_T,
int ldx,
const doublereal* grad_X,
int ldf, doublereal* fluxes);
virtual bool init(TransportParams& tr);
friend class TransportFactory;
/**
* Class MixTransport implements mixture-averaged transport
* properties for ideal gas mixtures. The model is based on that
* described by Kee, Coltrin, and Glarborg, "Theoretical and
* Practical Aspects of Chemically Reacting Flow Modeling."
* 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 from.
*/
class MixTransport : public Transport {
struct GasTransportData getGasTransportData(int);
public:
protected:
virtual ~MixTransport() {}
/// default constructor
MixTransport();
virtual int model() { return cMixtureAveraged; }
// overloaded base class methods
virtual doublereal viscosity();
private:
virtual void getSpeciesViscosities(doublereal* visc)
{ updateViscosity_T(); copy(m_visc.begin(), m_visc.end(), visc); }
doublereal pressure_ig() {
return (m_thermo->molarDensity() * GasConstant *
m_thermo->temperature());
}
virtual void getThermalDiffCoeffs(doublereal* dt);
virtual doublereal thermalConductivity();
// mixture attributes
int m_nsp;
doublereal m_tmin, m_tmax;
vector_fp m_mw;
virtual void getBinaryDiffCoeffs(int ld, doublereal* d);
virtual void getMixDiffCoeffs(doublereal* d);
virtual void getMobilities(doublereal* mobil);
virtual void update_T();
virtual void update_C();
// polynomial fits
vector<vector_fp> m_visccoeffs;
vector<vector_fp> m_condcoeffs;
vector<vector_fp> m_diffcoeffs;
vector_fp m_polytempvec;
virtual void getSpeciesFluxes(int ndim,
const doublereal* grad_T, int ldx, const doublereal* grad_X,
int ldf, doublereal* fluxes);
// property values
DenseMatrix m_bdiff;
vector_fp m_visc;
vector_fp m_sqvisc;
vector_fp m_cond;
virtual bool init(TransportParams& tr);
array_fp m_molefracs;
friend class TransportFactory;
vector<vector<int> > m_poly;
vector<vector_fp > m_astar_poly;
vector<vector_fp > m_bstar_poly;
vector<vector_fp > m_cstar_poly;
vector<vector_fp > m_om22_poly;
DenseMatrix m_astar;
DenseMatrix m_bstar;
DenseMatrix m_cstar;
DenseMatrix m_om22;
/**
* 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 from.
*/
struct GasTransportData getGasTransportData(int);
DenseMatrix m_phi; // viscosity weighting functions
DenseMatrix m_wratjk, m_wratkj1;
protected:
vector_fp m_zrot;
vector_fp m_crot;
vector_fp m_cinternal;
vector_fp m_eps;
vector_fp m_alpha;
vector_fp m_dipoleDiag;
/// default constructor
MixTransport();
doublereal m_temp, m_logt, m_kbt, m_t14, m_t32;
doublereal m_sqrt_kbt, m_sqrt_t;
private:
vector_fp m_sqrt_eps_k;
DenseMatrix m_log_eps_k;
vector_fp m_frot_298;
vector_fp m_rotrelax;
doublereal m_lambda;
doublereal m_viscmix;
doublereal pressure_ig() {
return (m_thermo->molarDensity() * GasConstant *
m_thermo->temperature());
}
// work space
vector_fp m_spwork;
// mixture attributes
int m_nsp;
doublereal m_tmin, m_tmax;
vector_fp m_mw;
void updateThermal_T();
void updateViscosity_T();
void updateCond_T();
void updateSpeciesViscosities();
void updateDiff_T();
void correctBinDiffCoeffs();
bool m_viscmix_ok;
bool m_viscwt_ok;
bool m_spvisc_ok;
bool m_diffmix_ok;
bool m_bindiff_ok;
bool m_abc_ok;
bool m_spcond_ok;
bool m_condmix_ok;
// polynomial fits
vector<vector_fp> m_visccoeffs;
vector<vector_fp> m_condcoeffs;
vector<vector_fp> m_diffcoeffs;
vector_fp m_polytempvec;
int m_mode;
// property values
DenseMatrix m_bdiff;
vector_fp m_visc;
vector_fp m_sqvisc;
vector_fp m_cond;
array_fp m_molefracs;
vector<vector<int> > m_poly;
vector<vector_fp > m_astar_poly;
vector<vector_fp > m_bstar_poly;
vector<vector_fp > m_cstar_poly;
vector<vector_fp > m_om22_poly;
DenseMatrix m_astar;
DenseMatrix m_bstar;
DenseMatrix m_cstar;
DenseMatrix m_om22;
DenseMatrix m_phi; // viscosity weighting functions
DenseMatrix m_wratjk, m_wratkj1;
vector_fp m_zrot;
vector_fp m_crot;
vector_fp m_cinternal;
vector_fp m_eps;
vector_fp m_alpha;
vector_fp m_dipoleDiag;
doublereal m_temp, m_logt, m_kbt, m_t14, m_t32;
doublereal m_sqrt_kbt, m_sqrt_t;
vector_fp m_sqrt_eps_k;
DenseMatrix m_log_eps_k;
vector_fp m_frot_298;
vector_fp m_rotrelax;
doublereal m_lambda;
doublereal m_viscmix;
// work space
vector_fp m_spwork;
void updateThermal_T();
void updateViscosity_T();
void updateCond_T();
void updateSpeciesViscosities();
void updateDiff_T();
void correctBinDiffCoeffs();
bool m_viscmix_ok;
bool m_viscwt_ok;
bool m_spvisc_ok;
bool m_diffmix_ok;
bool m_bindiff_ok;
bool m_abc_ok;
bool m_spcond_ok;
bool m_condmix_ok;
int m_mode;
DenseMatrix m_epsilon;
DenseMatrix m_diam;
DenseMatrix incl;
bool m_debug;
};
DenseMatrix m_epsilon;
DenseMatrix m_diam;
DenseMatrix incl;
bool m_debug;
};
}
#endif

View file

@ -97,15 +97,41 @@ namespace Cantera {
virtual void getBinaryDiffCoeffs(int ld, doublereal* d);
virtual void getMultiDiffCoeffs(int ld, doublereal* d);
/// Although this class implements a multicomponent diffusion
/// model, it is convenient to be able to compute
/// mixture-averaged diffusion coefficients too.
//! Although this class implements a multicomponent diffusion
//! model, it is convenient to be able to compute
//! mixture-averaged diffusion coefficients too.
/*!
* @param d Mixture averaged diffusion coefficients
* Length = m_msp, units = m2/sec
*/
virtual void getMixDiffCoeffs(doublereal* d);
//! Get the species diffusive mass fluxes wrt to
//! the mass averaged velocity,
//! given the gradients in mole fraction and temperature
/*!
* Units for the returned fluxes are kg m-2 s-1.
*
* @param ndim Number of dimensions in the flux expressions
* @param grad_T Gradient of the temperature
* (length = ndim)
* @param ldx Leading dimension of the grad_X array
* (usually equal to m_nsp but not always)
* @param grad_X Gradients of the mole fraction
* Flat vector with the m_nsp in the inner loop.
* length = ldx * ndim
* @param ldf Leading dimension of the fluxes array
* (usually equal to m_nsp but not always)
* @param fluxes Output of the diffusive mass fluxes
* Flat vector with the m_nsp in the inner loop.
* length = ldx * ndim
*/
virtual void getSpeciesFluxes(int ndim,
const doublereal* grad_T, int ldx, const doublereal* grad_X,
int ldf, doublereal* fluxes);
const doublereal* grad_T,
int ldx,
const doublereal* grad_X,
int ldf,
doublereal* fluxes);
virtual void getMolarFluxes(const doublereal* state1,
const doublereal* state2, doublereal delta,

View file

@ -20,304 +20,299 @@
namespace Cantera {
class TransportParams;
class TransportParams;
const int CK_Mode = 10;
const int CK_Mode = 10;
// types of transport models that can be constructed
const int None = 199;
const int cMulticomponent = 200;
const int CK_Multicomponent = 202;
const int cMixtureAveraged = 210;
const int CK_MixtureAveraged = 211;
const int cSolidTransport = 300;
const int cDustyGasTransport = 400;
const int cUserTransport = 500;
const int cFtnTransport = 600;
// types of transport models that can be constructed
const int None = 199;
const int cMulticomponent = 200;
const int CK_Multicomponent = 202;
const int cMixtureAveraged = 210;
const int CK_MixtureAveraged = 211;
const int cSolidTransport = 300;
const int cDustyGasTransport = 400;
const int cUserTransport = 500;
const int cFtnTransport = 600;
const int cLiquidTransport = 700;
// forward reference
class XML_Writer;
// forward reference
class XML_Writer;
/**
* Base class for transport property managers. All classes that
* compute transport properties derive from this class. Class
* Transport is meant to be used as a base class only. It is
* possible to instantiate it, but its methods throw exceptions if
* called.
*/
class Transport {
public:
/**
* Transport model. The transport model is the set of
* equations used to compute the transport properties. This
* virtual method returns an integer flag that identifies the
* transport model implemented. The base class returns 0.
*/
virtual int model() {return 0;}
/**
* Phase object. Every transport manager is designed to
* compute properties for a specific phase of a mixture, which
* might be a liquid solution, a gas mixture, etc. This method
* returns a reference to the object representing the phase
* itself.
*/
thermo_t& thermo() { return *m_thermo; }
/**
* Base class for transport property managers. All classes that
* compute transport properties derive from this class. Class
* Transport is meant to be used as a base class only. It is
* possible to instantiate it, but its methods throw exceptions if
* called.
* Returns true if the transport manager is ready for use.
*/
class Transport {
public:
/**
* Transport model. The transport model is the set of
* equations used to compute the transport properties. This
* virtual method returns an integer flag that identifies the
* transport model implemented. The base class returns 0.
*/
virtual int model() {return 0;}
/**
* Phase object. Every transport manager is designed to
* compute properties for a specific phase of a mixture, which
* might be a liquid solution, a gas mixture, etc. This method
* returns a reference to the object representing the phase
* itself.
*/
thermo_t& thermo() { return *m_thermo; }
bool ready() { return m_ready; }
/**
* Returns true if the transport manager is ready for use.
*/
bool ready() { return m_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; }
/**
* Returns an integer index number. This is for internal use
* of Cantera, and may be removed in the future.
*/
int index() { return m_index; }
/**
* 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; }
/**
* 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; }
/**
* @name Transport Properties
*/
//@{
/**
* @name Transport Properties
*/
//@{
/**
* The viscosity in Pa-s.
*/
virtual doublereal viscosity()
{ return err("viscosity"); }
/**
* The viscosity in Pa-s.
*/
virtual doublereal viscosity()
{ return err("viscosity"); }
/**
* The bulk viscosity in Pa-s. The bulk viscosity is only
* non-zero in rare cases. Most transport managers either
* overload this method to return zero, or do not implement
* it, in which case an exception is thrown if called.
*/
virtual doublereal bulkViscosity()
{ return err("bulkViscosity"); }
/**
* The bulk viscosity in Pa-s. The bulk viscosity is only
* non-zero in rare cases. Most transport managers either
* overload this method to return zero, or do not implement
* it, in which case an exception is thrown if called.
*/
virtual doublereal bulkViscosity()
{ return err("bulkViscosity"); }
/**
* The thermal conductivity in W/m/K.
*/
virtual doublereal thermalConductivity()
{ return err("thermalConductivity"); }
/**
* The thermal conductivity in W/m/K.
*/
virtual doublereal thermalConductivity()
{ return err("thermalConductivity"); }
/**
* The electrical conductivity (Siemens/m).
*/
virtual doublereal electricalConductivity()
{ return err("electricalConductivity"); }
/**
* The electrical conductivity (Siemens/m).
*/
virtual doublereal electricalConductivity()
{ return err("electricalConductivity"); }
/**
* Electrical mobilities (m^2/V/s). Returns the mobilities of
* the species in array \c mobil. The array must be
* dimensioned at least as large as the number of species.
*/
virtual void getMobilities(doublereal* mobil)
{ err("getMobilities"); }
/**
* Electrical mobilities (m^2/V/s). Returns the mobilities of
* the species in array \c mobil. The array must be
* dimensioned at least as large as the number of species.
*/
virtual void getMobilities(doublereal* mobil)
{ err("getMobilities"); }
//@}
//@}
//! Get the species diffusive mass fluxes wrt to
//! the mass averaged velocity,
//! given the gradients in mole fraction and temperature
/*!
* Units for the returned fluxes are kg m-2 s-1.
*
* @param ndim Number of dimensions in the flux expressions
* @param grad_T Gradient of the temperature
* (length = ndim)
* @param ldx Leading dimension of the grad_X array
* (usually equal to m_nsp but not always)
* @param grad_X Gradients of the mole fraction
* Flat vector with the m_nsp in the inner loop.
* length = ldx * ndim
* @param ldf Leading dimension of the fluxes array
* (usually equal to m_nsp but not always)
* @param fluxes Output of the diffusive mass fluxes
* Flat vector with the m_nsp in the inner loop.
* length = ldx * ndim
*/
virtual void getSpeciesFluxes(int ndim,
const doublereal* grad_T,
int ldx,
const doublereal* grad_X,
int ldf,
doublereal* fluxes) {
err("getSpeciesFluxes");
}
//! Get the species diffusive mass fluxes wrt to
//! the mass averaged velocity,
//! given the gradients in mole fraction and temperature
/*!
* Units for the returned fluxes are kg m-2 s-1.
*
* @param ndim Number of dimensions in the flux expressions
* @param grad_T Gradient of the temperature
* (length = ndim)
* @param ldx Leading dimension of the grad_X array
* (usually equal to m_nsp but not always)
* @param grad_X Gradients of the mole fraction
* Flat vector with the m_nsp in the inner loop.
* length = ldx * ndim
* @param ldf Leading dimension of the fluxes array
* (usually equal to m_nsp but not always)
* @param fluxes Output of the diffusive mass fluxes
* Flat vector with the m_nsp in the inner loop.
* length = ldx * ndim
*/
virtual void getSpeciesFluxes(int ndim,
const doublereal* grad_T,
int ldx,
const doublereal* grad_X,
int ldf,
doublereal* fluxes) {
err("getSpeciesFluxes");
}
/**
* Get the molar fluxes [kmol/m^2/s], given the thermodynamic
* state at two nearby points.
* @param state1 Array of temperature, density, and mass
* fractions for state 1.
* @param state2 Array of temperature, density, and mass
* fractions for state 2.
* @param delta Distance from state 1 to state 2 (m).
*/
virtual void getMolarFluxes(const doublereal* state1,
const doublereal* state2, doublereal delta,
doublereal* fluxes) { err("getMolarFluxes"); }
/**
* Get the molar fluxes [kmol/m^2/s], given the thermodynamic
* state at two nearby points.
* @param state1 Array of temperature, density, and mass
* fractions for state 1.
* @param state2 Array of temperature, density, and mass
* fractions for state 2.
* @param delta Distance from state 1 to state 2 (m).
*/
virtual void getMolarFluxes(const doublereal* state1,
const doublereal* state2, doublereal delta,
doublereal* fluxes) { err("getMolarFluxes"); }
/**
* Get the mass fluxes [kg/m^2/s], given the thermodynamic
* state at two nearby points.
* @param state1 Array of temperature, density, and mass
* fractions for state 1.
* @param state2 Array of temperature, density, and mass
* fractions for state 2.
* @param delta Distance from state 1 to state 2 (m).
*/
virtual void getMassFluxes(const doublereal* state1,
const doublereal* state2, doublereal delta,
doublereal* fluxes) { err("getMassFluxes"); }
/**
* Get the mass fluxes [kg/m^2/s], given the thermodynamic
* state at two nearby points.
* @param state1 Array of temperature, density, and mass
* fractions for state 1.
* @param state2 Array of temperature, density, and mass
* fractions for state 2.
* @param delta Distance from state 1 to state 2 (m).
*/
virtual void getMassFluxes(const doublereal* state1,
const doublereal* state2, doublereal delta,
doublereal* fluxes) { err("getMassFluxes"); }
/**
* Thermal diffusion coefficients [kg/m/sec].
* The thermal diffusion coefficient \f$ D^T_k \f$ is defined
* so that the diffusive mass flux of species k induced by the
* local temperature gradient is \f[ M_k J_k = -D^T_k \nabla
* \ln T. \f]. The thermal diffusion coefficient can be either
* positive or negative.
*
* @param dt on return, dt will contain the species thermal
* diffusion coefficients. Dimension dt at least as large as
* the number of species.
*/
virtual void getThermalDiffCoeffs(doublereal* dt)
{ err("getThermalDiffCoeffs"); }
/**
* Thermal diffusion coefficients [kg/m/sec].
* The thermal diffusion coefficient \f$ D^T_k \f$ is defined
* so that the diffusive mass flux of species k induced by the
* local temperature gradient is \f[ M_k J_k = -D^T_k \nabla
* \ln T. \f]. The thermal diffusion coefficient can be either
* positive or negative.
*
* @param dt on return, dt will contain the species thermal
* diffusion coefficients. Dimension dt at least as large as
* the number of species.
*/
virtual void getThermalDiffCoeffs(doublereal* dt)
{ err("getThermalDiffCoeffs"); }
/**
* Binary diffusion coefficients [m^2/s].
*/
virtual void getBinaryDiffCoeffs(int ld, doublereal* d)
{ err("getBinaryDiffCoeffs"); }
/**
* Binary diffusion coefficients [m^2/s].
*/
virtual void getBinaryDiffCoeffs(int ld, doublereal* d)
{ err("getBinaryDiffCoeffs"); }
/**
* Multicomponent diffusion coefficients. Units: [m^2/s]. If
* the transport manager implements a multicomponent diffusion
* model, then this method returns the array of multicomponent
* diffusion coefficients. Otherwise it throws an exception.
*/
virtual void getMultiDiffCoeffs(int ld, doublereal* d)
{ err("getMultiDiffCoeffs"); }
/**
* Multicomponent diffusion coefficients. Units: [m^2/s]. If
* the transport manager implements a multicomponent diffusion
* model, then this method returns the array of multicomponent
* diffusion coefficients. Otherwise it throws an exception.
*/
virtual void getMultiDiffCoeffs(int ld, doublereal* d)
{ err("getMultiDiffCoeffs"); }
/**
* Mixture-averaged diffusion coefficients [m^2/s]. If the
* transport manager implements a mixture-averaged diffusion
* model, then this method returns the array of
* mixture-averaged diffusion coefficients. Otherwise it
* throws an exception.
*/
virtual void getMixDiffCoeffs(doublereal* d)
{ err("getMixDiffCoeffs"); }
/**
* Mixture-averaged diffusion coefficients [m^2/s]. If the
* transport manager implements a mixture-averaged diffusion
* model, then this method returns the array of
* mixture-averaged diffusion coefficients. Otherwise it
* throws an exception.
*/
virtual void getMixDiffCoeffs(doublereal* d)
{ err("getMixDiffCoeffs"); }
/**
* 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"); }
/**
* 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 ~Transport(){} ///< Destructor.
friend class TransportFactory;
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)
: m_thermo(thermo), m_ready(false), m_nmin(0), m_index(-1) {}
/**
* Constructor. New transport managers should be created using
* TransportFactory, not by calling the constructor directly.
* @see TransportFactory
*/
Transport(thermo_t* thermo=0)
: m_thermo(thermo), m_ready(false), m_nmin(0), m_index(-1) {}
protected:
protected:
/**
* @name Transport manager construction
* These methods are used internally during construction.
* @{
*/
/**
* @name Transport manager construction
* These methods are used internally during construction.
* @{
*/
/**
* Called by TransportFactory to set parameters.
*/
virtual bool init(TransportParams& tr)
{ err("init"); return false; }
/**
* Called by TransportFactory to set parameters.
*/
virtual bool init(TransportParams& tr)
{ err("init"); return false; }
/**
* Set the phase object.
*/
void setThermo(thermo_t& thermo);
/**
* Set the phase object.
*/
void setThermo(thermo_t& thermo);
/**
* Enable for use. Once finalize() has been called, the
* transport manager should be ready to compute any supported
* transport property, and no further modifications to the
* model parameters should be made.
*/
void finalize();
/**
* Enable for use. Once finalize() has been called, the
* transport manager should be ready to compute any supported
* transport property, and no further modifications to the
* model parameters should be made.
*/
void finalize();
//@}
//@}
thermo_t* m_thermo; ///< pointer to the object representing the phase
bool m_ready; ///< true if finalize has been called
size_t m_nmin; ///< number of species
int m_index;
thermo_t* m_thermo; ///< pointer to the object representing the phase
bool m_ready; ///< true if finalize has been called
size_t m_nmin; ///< number of species
int m_index;
private:
private:
/**
* Throw an exception if a method of this class is
* invoked. This probably indicates that a transport manager
* is being used that does not implement all virtual methods,
* and one of those methods was called by the application
* program. For example, a transport manager that computes the
* thermal conductivity of a solid may not define the
* viscosity() method, since the viscosity is in this case
* meaningless. If the application invokes the viscosity()
* method, the base class method will be called, resulting in
* an exception being thrown.
*/
doublereal err(std::string msg) const;
/**
* Throw an exception if a method of this class is
* invoked. This probably indicates that a transport manager
* is being used that does not implement all virtual methods,
* and one of those methods was called by the application
* program. For example, a transport manager that computes the
* thermal conductivity of a solid may not define the
* viscosity() method, since the viscosity is in this case
* meaningless. If the application invokes the viscosity()
* method, the base class method will be called, resulting in
* an exception being thrown.
*/
doublereal err(std::string msg) const;
};
};
typedef Transport transport_t;
typedef Transport transport_t;
}
#endif