TurbulentTransport from copy of WmeanTransport
This commit is contained in:
parent
f312f0d1d0
commit
5eabd42add
3 changed files with 152 additions and 0 deletions
106
include/cantera/transport/TurbulentTransport.h
Normal file
106
include/cantera/transport/TurbulentTransport.h
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
/**
|
||||
* @file TurbulentTransport.h
|
||||
* Headers for the TurbulentTransport object, which models transport
|
||||
* properties in ideal gas solutions using the unity Lewis number
|
||||
* approximation
|
||||
* (see \ref tranprops and \link Cantera::TurbulentTransport TurbulentTransport \endlink) .
|
||||
*/
|
||||
|
||||
// This file is part of Cantera. See License.txt in the top-level directory or
|
||||
// at https://cantera.org/license.txt for license and copyright information.
|
||||
|
||||
#ifndef CT_TURBULENTTRAN_H
|
||||
#define CT_TURBULENTTRAN_H
|
||||
|
||||
#include "MixTransport.h"
|
||||
|
||||
namespace Cantera
|
||||
{
|
||||
//! Class TurbulentTransport implements the unity Lewis number approximation
|
||||
//! for the mixture-averaged species diffusion coefficients. Mixture-averaged
|
||||
//! transport properties for viscosity and thermal conductivity are inherited
|
||||
//! from the MixTransport class.
|
||||
//! @ingroup tranprops
|
||||
class TurbulentTransport : public MixTransport
|
||||
{
|
||||
public:
|
||||
TurbulentTransport();
|
||||
|
||||
virtual std::string transportType() const {
|
||||
return "Turbulent";
|
||||
}
|
||||
|
||||
virtual void init(thermo_t* thermo, int mode=0, int log_level=0);
|
||||
|
||||
//! Returns the unity Lewis number approximation based diffusion
|
||||
//! coefficients [m^2/s].
|
||||
/*!
|
||||
* Returns the unity Lewis number approximation based diffusion coefficients
|
||||
* for a gas, appropriate for calculating the mass averaged diffusive flux
|
||||
* with respect to the mass averaged velocity using gradients of the mole
|
||||
* fraction.
|
||||
*
|
||||
* \f[
|
||||
* D^\prime_{km} = \frac{\lambda}{\rho c_p}
|
||||
* \f]
|
||||
*
|
||||
* In order to obtain the expected behavior from a unity Lewis number model,
|
||||
* this formulation requires that the correction velocity be computed as
|
||||
*
|
||||
* \f[
|
||||
* V_c = \sum \frac{W_k}{\overline{W}} D^\prime_{km} \nabla X_k
|
||||
* \f]
|
||||
*
|
||||
* @param[out] d Vector of diffusion coefficients for each species (m^2/s).
|
||||
* length m_nsp.
|
||||
*/
|
||||
virtual void getMixDiffCoeffs(double* const d) {
|
||||
GasTransport::getMixDiffCoeffs(d);
|
||||
|
||||
double Dm = 0.0;
|
||||
for (size_t k = 0; k < m_nsp; k++) {
|
||||
Dm += d[k] * m_weight[k];
|
||||
}
|
||||
for (size_t k = 0; k < m_nsp; k++) {
|
||||
d[k] = Dm;
|
||||
}
|
||||
}
|
||||
|
||||
//! Not implemented for unity Lewis number approximation
|
||||
virtual void getMixDiffCoeffsMole(double* const d){
|
||||
throw NotImplementedError("TurbulentTransport::getMixDiffCoeffsMole");
|
||||
}
|
||||
|
||||
//! Returns the unity Lewis number approximation based diffusion
|
||||
//! coefficients [m^2/s].
|
||||
/*!
|
||||
* These are the coefficients for calculating the diffusive mass fluxes
|
||||
* from the species mass fraction gradients, computed as
|
||||
*
|
||||
* \f[
|
||||
* D_{km} = \frac{\lambda}{\rho c_p}
|
||||
* \f]
|
||||
*
|
||||
* @param[out] d Vector of diffusion coefficients for each species (m^2/s).
|
||||
* length m_nsp.
|
||||
*/
|
||||
virtual void getMixDiffCoeffsMass(double* const d){
|
||||
GasTransport::getMixDiffCoeffsMass(d);
|
||||
|
||||
double Dm = 0.0;
|
||||
for (size_t k = 0; k < m_nsp; k++) {
|
||||
Dm += d[k] * m_weight[k];
|
||||
}
|
||||
for (size_t k = 0; k < m_nsp; k++) {
|
||||
d[k] = Dm;
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
//! Internal storage for weights to calculate mean diffusivity
|
||||
vector_fp m_weight;
|
||||
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
|
@ -9,6 +9,7 @@
|
|||
#include "cantera/transport/UnityLewisTransport.h"
|
||||
#include "cantera/transport/ConstantTransport.h"
|
||||
#include "cantera/transport/WmeanTransport.h"
|
||||
#include "cantera/transport/TurbulentTransport.h"
|
||||
#include "cantera/transport/IonGasTransport.h"
|
||||
#include "cantera/transport/WaterTransport.h"
|
||||
#include "cantera/transport/DustyGasTransport.h"
|
||||
|
|
@ -51,6 +52,8 @@ TransportFactory::TransportFactory()
|
|||
m_synonyms["constant"] = "Constant";
|
||||
reg("Wmean", []() { return new WmeanTransport(); });
|
||||
m_synonyms["wmean"] = "Wmean";
|
||||
reg("Turbulent", []() { return new TurbulentTransport(); });
|
||||
m_synonyms["turbulent"] = "Turbulent";
|
||||
reg("UnityLewis", []() { return new UnityLewisTransport(); });
|
||||
m_synonyms["unity-Lewis-number"] = "UnityLewis";
|
||||
reg("Mix", []() { return new MixTransport(); });
|
||||
|
|
|
|||
43
src/transport/TurbulentTransport.cpp
Normal file
43
src/transport/TurbulentTransport.cpp
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
/**
|
||||
* @file TurbulentTransport.cpp
|
||||
* Mixture-averaged transport properties for ideal gas mixtures.
|
||||
*/
|
||||
|
||||
// This file is part of Cantera. See License.txt in the top-level directory or
|
||||
// at https://cantera.org/license.txt for license and copyright information.
|
||||
|
||||
#include "cantera/transport/TurbulentTransport.h"
|
||||
#include "cantera/base/stringUtils.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace Cantera
|
||||
{
|
||||
TurbulentTransport::TurbulentTransport() :
|
||||
MixTransport(),
|
||||
m_weight(m_nsp)
|
||||
{
|
||||
}
|
||||
|
||||
void TurbulentTransport::init(ThermoPhase* thermo, int mode, int log_level)
|
||||
{
|
||||
MixTransport::init(thermo, mode, log_level);
|
||||
|
||||
m_weight.resize(m_nsp);
|
||||
|
||||
m_weight.assign(m_nsp, 0.0);
|
||||
m_weight[0] = 1.0;
|
||||
|
||||
ifstream myfile;
|
||||
myfile.open ("wmean-weights.txt");
|
||||
for (size_t k = 0; k < m_nsp; k++) {
|
||||
myfile >> m_weight[k];
|
||||
|
||||
cout << m_thermo->speciesName(k) << m_weight[k] << endl;
|
||||
}
|
||||
myfile.close();
|
||||
|
||||
// m_reftemp = thermo->temperature();
|
||||
// cout << "check reference temperature" << m_reftemp << endl;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue