From 74e9fa050b9980f51becf16bfc78814a1802dafa Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Fri, 11 May 2012 15:27:38 +0000 Subject: [PATCH] Removed a layer of indirection in MultiTransport property updaters --- include/cantera/transport/MixTransport.h | 2 - include/cantera/transport/MultiTransport.h | 54 +++++++------- src/transport/MixTransport.cpp | 1 + src/transport/MultiTransport.cpp | 86 +++------------------- 4 files changed, 35 insertions(+), 108 deletions(-) diff --git a/include/cantera/transport/MixTransport.h b/include/cantera/transport/MixTransport.h index be43a808d..b2dc7c742 100644 --- a/include/cantera/transport/MixTransport.h +++ b/include/cantera/transport/MixTransport.h @@ -207,8 +207,6 @@ public: * D_{km}' = \frac{\left( \bar{M} - X_k M_k \right)}{ \bar{\qquad M \qquad } } {\left( \sum_{j \ne k} \frac{X_j}{D_{kj}} \right) }^{-1} * \f] * - * - * * @param d Output Vector of mixture diffusion coefficients, \f$ D_{km}' \f$ , for each species (m^2/s). * length m_nsp */ diff --git a/include/cantera/transport/MultiTransport.h b/include/cantera/transport/MultiTransport.h index d726364b5..f2d1f5fbf 100644 --- a/include/cantera/transport/MultiTransport.h +++ b/include/cantera/transport/MultiTransport.h @@ -221,37 +221,8 @@ public: */ virtual bool initGas(GasTransportParams& tr); - - /** - * @name Property Updating This methods are used to update - * temperature- or concentration-dependent quantities. The - * methods of the first group (with names that do not begin - * with an underscore) invoke the 'update' method of the - * relevant property updater. These methods are the ones that - * are called by other methods of the class to update - * properties. The methods that actually perform the updates - * are the ones with names beginning with an underscore. These - * are only called by the property updaters. - */ - void updateTransport_T(); - void updateTransport_C(); - - void updateThermal_T(); - void updateViscosity_T(); - void updateSpeciesViscosities_T(); - void updateDiff_T(); - - - void _update_transport_T(); - void _update_transport_C(); - void _update_species_visc_T(); - void _update_visc_T(); - void _update_diff_T(); - void _update_thermal_T(); - friend class TransportFactory; - //! Return a structure containing all of the pertinent parameters //! about a species that was used to construct the Transport properties in this object /*! @@ -259,6 +230,31 @@ public: */ struct GasTransportData getGasTransportData(int k); +protected: + + //! Update basic temperature-dependent quantities if the temperature has changed. + void updateTransport_T(); + + //! Update basic concentration-dependent quantities if the concentrations have changed. + void updateTransport_C(); + + //! Update the temperature-dependent terms needed to compute the thermal + //! conductivity and thermal diffusion coefficients. + void updateThermal_T(); + + //! Update the temperature-dependent viscosity terms + void updateViscosity_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 updateSpeciesViscosities_T(); + + //! Update the binary diffusion coefficients. + //! These are evaluated from the polynomial fits at unit pressure (1 Pa). + void updateDiff_T(); + private: doublereal m_diff_tlast; diff --git a/src/transport/MixTransport.cpp b/src/transport/MixTransport.cpp index 516f97c0d..ec6f3c2b2 100644 --- a/src/transport/MixTransport.cpp +++ b/src/transport/MixTransport.cpp @@ -481,6 +481,7 @@ void MixTransport::getMixDiffCoeffs(doublereal* const d) } } } + //=========================================================================================================== /* * @internal This is called whenever a transport property is diff --git a/src/transport/MultiTransport.cpp b/src/transport/MultiTransport.cpp index 1064fb23c..b7922f227 100644 --- a/src/transport/MultiTransport.cpp +++ b/src/transport/MultiTransport.cpp @@ -770,23 +770,6 @@ void MultiTransport::getMixDiffCoeffs(doublereal* const d) void MultiTransport::updateTransport_T() -{ - //m_thermo->update_T(m_update_transport_T); - _update_transport_T(); -} - -void MultiTransport::updateTransport_C() -{ - // {m_thermo->update_C(m_update_transport_C); - _update_transport_C(); -} - - -/** - * Update temperature-dependent quantities. This method is called - * by the temperature property updater. - */ -void MultiTransport::_update_transport_T() { if (m_temp == m_thermo->temperature()) { return; @@ -817,12 +800,7 @@ void MultiTransport::_update_transport_T() m_l0000_ok = false; } -/** - * This is called the first time any transport property - * is requested from ThermoSubstance after the concentrations - * have changed. - */ -void MultiTransport::_update_transport_C() +void MultiTransport::updateTransport_C() { // signal that concentration-dependent quantities will need to // be recomputed before use, and update the local mole @@ -839,30 +817,17 @@ void MultiTransport::_update_transport_C() } } - /************************************************************************* * * methods to update temperature-dependent properties * *************************************************************************/ -/** - * @internal - * Update the binary diffusion coefficients. These are evaluated - * from the polynomial fits at unit pressure (1 Pa). - */ void MultiTransport::updateDiff_T() { if (m_diff_tlast == m_thermo->temperature()) { return; } - _update_diff_T(); - m_diff_tlast = m_thermo->temperature(); - //m_thermo->update_T(m_update_diff_T); -} - -void MultiTransport::_update_diff_T() -{ updateTransport_T(); // evaluate binary diffusion coefficients at unit pressure @@ -886,29 +851,14 @@ void MultiTransport::_update_diff_T() } } m_diff_ok = true; + m_diff_tlast = m_thermo->temperature(); } - -/** - * @internal - * 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 MultiTransport::updateSpeciesViscosities_T() { if (m_spvisc_tlast == m_thermo->temperature()) { return; } - _update_species_visc_T(); - //m_thermo->update_T(m_update_spvisc_T); - m_spvisc_tlast = m_thermo->temperature(); -} - - -void MultiTransport::_update_species_visc_T() -{ updateTransport_T(); if (m_mode == CK_Mode) { @@ -925,24 +875,15 @@ void MultiTransport::_update_species_visc_T() } } m_spvisc_ok = true; + m_spvisc_tlast = m_thermo->temperature(); } -/** - * @internal - */ void MultiTransport::updateViscosity_T() { if (m_visc_tlast == m_thermo->temperature()) { return; } - _update_visc_T(); - m_visc_tlast = m_thermo->temperature(); -} - -void MultiTransport::_update_visc_T() -{ doublereal vratiokj, wratiojk, factor1; - updateSpeciesViscosities_T(); // see Eq. (9-5.15) of Reid, Prausnitz, and Poling @@ -965,28 +906,15 @@ void MultiTransport::_update_visc_T() } } m_visc_ok = true; + m_visc_tlast = m_thermo->temperature(); } - -/** - * @internal - * Update the temperature-dependent terms needed to compute the - * thermal conductivity and thermal diffusion coefficients. - */ void MultiTransport::updateThermal_T() { if (m_thermal_tlast == m_thermo->temperature()) { return; } - _update_thermal_T(); - // m_thermo->update_T(m_update_thermal_T); - m_thermal_tlast = m_thermo->temperature(); -} - -void MultiTransport::_update_thermal_T() -{ - // we need species viscosities and binary diffusion - // coefficients + // we need species viscosities and binary diffusion coefficients updateSpeciesViscosities_T(); updateDiff_T(); @@ -1046,7 +974,11 @@ void MultiTransport::_update_thermal_T() for (size_t k = 0; k < m_nsp; k++) { m_cinternal[k] = cp[k] - 2.5; } + + // m_thermo->update_T(m_update_thermal_T); + m_thermal_tlast = m_thermo->temperature(); } + //==================================================================================================================== /* * This function returns a Transport data object for a given species.