cantera/src/transport/TransportBase.cpp
Ray Speth 8f4f72369e Use the associated Cabinet to look up an item's index
This allowed removal the m_index member and associated methods
of the ThermoPhase, Kinetics, and Transport classes.
2012-02-27 18:12:13 +00:00

139 lines
3.4 KiB
C++

/**
* @file TransportBase.cpp
* Mixture-averaged transport properties for ideal gas mixtures.
*/
#include "cantera/thermo/ThermoPhase.h"
#include "cantera/transport/LiquidTransport.h"
#include "cantera/base/ctexceptions.h"
#include "cantera/base/utilities.h"
#include "cantera/transport/LiquidTransportParams.h"
#include "cantera/transport/TransportFactory.h"
#include "cantera/base/stringUtils.h"
#include "cantera/numerics/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, size_t ndim) :
m_thermo(thermo),
m_ready(false),
m_nmin(0),
m_nDim(ndim),
m_velocityBasis(VB_MASSAVG)
{
}
Transport::Transport(const Transport& right)
{
m_thermo = right.m_thermo;
m_ready = right.m_ready;
m_nmin = right.m_nmin;
m_nDim = right.m_nDim;
m_velocityBasis = right.m_velocityBasis;
}
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_nDim = right.m_nDim;
m_velocityBasis = right.m_velocityBasis;
return *this;
}
Transport* Transport::duplMyselfAsTransport() const
{
Transport* tr = new Transport(*this);
return tr;
}
Transport::~Transport()
{
}
bool Transport::ready()
{
return m_ready;
}
// 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");
}
void Transport::setThermo(thermo_t& thermo)
{
if (!ready()) {
m_thermo = &thermo;
m_nmin = m_thermo->nSpecies();
} else
throw CanteraError("Transport::setThermo",
"the phase object cannot be changed after "
"the transport manager has been constructed.");
}
doublereal Transport::err(std::string msg) const
{
throw CanteraError("Transport Base Class",
"\n\n\n**** Method "+ msg +" not implemented in model "
+ int2str(model()) + " ****\n"
"(Did you forget to specify a transport model?)\n\n\n");
return 0.0;
}
void Transport::finalize()
{
if (!ready()) {
m_ready = true;
} else
throw CanteraError("Transport::finalize",
"finalize has already been called.");
}
//====================================================================================================================
void Transport::getSpeciesFluxes(size_t ndim, const doublereal* const grad_T,
int ldx, const doublereal* const grad_X,
int ldf, doublereal* const fluxes)
{
err("getSpeciesFluxes");
}
//====================================================================================================================
}