From 84acb57b4b896957d52d635191c1edf791e631e2 Mon Sep 17 00:00:00 2001 From: ignis Date: Wed, 27 Nov 2019 16:53:56 +0900 Subject: [PATCH] compiling dummy constant transport class --- include/cantera/transport/ConstantTransport.h | 88 +++++++++++++++++++ src/transport/TransportFactory.cpp | 3 + 2 files changed, 91 insertions(+) create mode 100644 include/cantera/transport/ConstantTransport.h diff --git a/include/cantera/transport/ConstantTransport.h b/include/cantera/transport/ConstantTransport.h new file mode 100644 index 000000000..75e08ab3a --- /dev/null +++ b/include/cantera/transport/ConstantTransport.h @@ -0,0 +1,88 @@ +/** + * @file ConstantTransport.h + * Headers for the ConstantTransport object, which models transport + * properties in ideal gas solutions using the unity Lewis number + * approximation + * (see \ref tranprops and \link Cantera::ConstantTransport ConstantTransport \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_CONSTANTTRAN_H +#define CT_CONSTANTTRAN_H + +#include "MixTransport.h" + +namespace Cantera +{ +//! Class ConstantTransport 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 ConstantTransport : public MixTransport +{ +public: +// ConstantTransport() {} + + virtual std::string transportType() const { + return "Constant"; + } + + //! 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) { + double Dm = thermalConductivity() / (m_thermo->density() * m_thermo->cp_mass()); + 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("ConstantTransport::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){ + double Dm = thermalConductivity() / (m_thermo->density() * m_thermo->cp_mass()); + for (size_t k = 0; k < m_nsp; k++) { + d[k] = Dm; + } + } +}; +} +#endif diff --git a/src/transport/TransportFactory.cpp b/src/transport/TransportFactory.cpp index 03f290b84..146f69f86 100644 --- a/src/transport/TransportFactory.cpp +++ b/src/transport/TransportFactory.cpp @@ -7,6 +7,7 @@ #include "cantera/transport/MultiTransport.h" #include "cantera/transport/MixTransport.h" #include "cantera/transport/UnityLewisTransport.h" +#include "cantera/transport/ConstantTransport.h" #include "cantera/transport/IonGasTransport.h" #include "cantera/transport/WaterTransport.h" #include "cantera/transport/DustyGasTransport.h" @@ -45,6 +46,8 @@ TransportFactory::TransportFactory() { reg("", []() { return new Transport(); }); m_synonyms["None"] = ""; + reg("Constant", []() { return new ConstantTransport(); }); + m_synonyms["constant"] = "Constant"; reg("UnityLewis", []() { return new UnityLewisTransport(); }); m_synonyms["unity-Lewis-number"] = "UnityLewis"; reg("Mix", []() { return new MixTransport(); });