From c3233c135537cb94ea0456065d16bbe432757cea Mon Sep 17 00:00:00 2001 From: Victor Brunini Date: Mon, 26 Nov 2012 20:19:57 +0000 Subject: [PATCH] Update TransportFactory to allow the specification of the number of dimensions in the problem and default it to 1. At present this is only passed through to the LiquidTransport constructor. Remove LiquidTransport member m_nDim since the base Transport class already stores m_nDim. Don't set m_nDim to 1 in LiquidTransport constructor, it is set by the Transport constructor. --- include/cantera/transport/LiquidTransport.h | 6 ------ include/cantera/transport/TransportFactory.h | 6 ++++-- src/transport/LiquidTransport.cpp | 6 ++---- src/transport/TransportFactory.cpp | 8 ++++---- 4 files changed, 10 insertions(+), 16 deletions(-) diff --git a/include/cantera/transport/LiquidTransport.h b/include/cantera/transport/LiquidTransport.h index 6c00ed41f..236869958 100644 --- a/include/cantera/transport/LiquidTransport.h +++ b/include/cantera/transport/LiquidTransport.h @@ -1412,12 +1412,6 @@ private: */ bool m_debug; - //! Number of dimensions - /*! - * Either 1, 2, or 3 - */ - size_t m_nDim; - //! Throw an exception if this method is invoked. /*! * This probably indicates something is not yet implemented. diff --git a/include/cantera/transport/TransportFactory.h b/include/cantera/transport/TransportFactory.h index f4febbdcf..dd99b6b4e 100644 --- a/include/cantera/transport/TransportFactory.h +++ b/include/cantera/transport/TransportFactory.h @@ -116,8 +116,9 @@ public: * @param model String name for the transport manager * @param thermo ThermoPhase object * @param log_level log level + * @param ndim Number of dimensions for fluxes */ - virtual Transport* newTransport(const std::string& model, thermo_t* thermo, int log_level=0); + virtual Transport* newTransport(const std::string& model, thermo_t* thermo, int log_level=0, int ndim=1); //! Build a new transport manager using the default transport manager //! in the phase description and return a base class pointer to it @@ -384,11 +385,12 @@ private: * @param thermo ThermoPhase object associated with the phase, defaults to null pointer * @param loglevel int containing the Loglevel, defaults to zero * @param f ptr to the TransportFactory object if it's been malloced. + * @param ndim Number of dimensions for transport fluxes * * @ingroup transportProps */ Transport* newTransportMgr(const std::string& transportModel = "", thermo_t* thermo = 0, int loglevel = 0, - TransportFactory* f = 0); + TransportFactory* f = 0, int ndim=1); //==================================================================================================================== //! Create a new transport manager instance. /*! diff --git a/src/transport/LiquidTransport.cpp b/src/transport/LiquidTransport.cpp index 00138403b..a0e5a061d 100644 --- a/src/transport/LiquidTransport.cpp +++ b/src/transport/LiquidTransport.cpp @@ -68,8 +68,7 @@ LiquidTransport::LiquidTransport(thermo_t* thermo, int ndim) : m_lambda_temp_ok(false), m_lambda_mix_ok(false), m_mode(-1000), - m_debug(false), - m_nDim(1) + m_debug(false) { } @@ -113,8 +112,7 @@ LiquidTransport::LiquidTransport(const LiquidTransport& right) : m_lambda_temp_ok(false), m_lambda_mix_ok(false), m_mode(-1000), - m_debug(false), - m_nDim(1) + m_debug(false) { /* * Use the assignment operator to do the brunt diff --git a/src/transport/TransportFactory.cpp b/src/transport/TransportFactory.cpp index 8cbb91a95..b385a58cc 100644 --- a/src/transport/TransportFactory.cpp +++ b/src/transport/TransportFactory.cpp @@ -356,7 +356,7 @@ LiquidTranInteraction* TransportFactory::newLTI(const XML_Node& trNode, pointer to it. */ Transport* TransportFactory::newTransport(const std::string& transportModel, - thermo_t* phase, int log_level) + thermo_t* phase, int log_level, int ndim) { if (transportModel == "") { @@ -411,7 +411,7 @@ Transport* TransportFactory::newTransport(const std::string& transportModel, tr->setThermo(*phase); break; case cLiquidTransport: - tr = new LiquidTransport; + tr = new LiquidTransport(phase, ndim); initLiquidTransport(tr, phase, log_level); tr->setThermo(*phase); break; @@ -1476,12 +1476,12 @@ void TransportFactory::fitProperties(GasTransportParams& tr, * * @ingroup transportProps */ -Transport* newTransportMgr(const std::string& transportModel, thermo_t* thermo, int loglevel, TransportFactory* f) +Transport* newTransportMgr(const std::string& transportModel, thermo_t* thermo, int loglevel, TransportFactory* f, int ndim) { if (f == 0) { f = TransportFactory::factory(); } - Transport* ptr = f->newTransport(transportModel, thermo, loglevel); + Transport* ptr = f->newTransport(transportModel, thermo, loglevel, ndim); /* * Note: We delete the static s_factory instance here, instead of in * appdelete() in misc.cpp, to avoid linking problems involving