From 45c2e077d12d10f62f22d894f39dec17470b0942 Mon Sep 17 00:00:00 2001 From: John Hewson Date: Fri, 23 Oct 2009 22:34:08 +0000 Subject: [PATCH] LiquidTransport.h LiquidTransport.cpp Added methods void getSpeciesHydrodynamicRadius() -- similar to getSpeciesViscosities() void updateHydrodynamicRadius_T() -- similar to updateViscosities_T() void updateHydrodynamicRadius_C() Added private members bool m_radi_temp_ok; bool m_radi_conc_ok; --- Cantera/src/transport/LiquidTransport.cpp | 76 ++++++++++++++++++++++- Cantera/src/transport/LiquidTransport.h | 30 ++++++++- 2 files changed, 101 insertions(+), 5 deletions(-) diff --git a/Cantera/src/transport/LiquidTransport.cpp b/Cantera/src/transport/LiquidTransport.cpp index 5c47c4b8e..d581b3215 100644 --- a/Cantera/src/transport/LiquidTransport.cpp +++ b/Cantera/src/transport/LiquidTransport.cpp @@ -46,6 +46,8 @@ namespace Cantera { m_visc_mix_ok(false), m_visc_temp_ok(false), m_visc_conc_ok(false), + m_radi_temp_ok(false), + m_radi_conc_ok(false), m_diff_mix_ok(false), m_diff_temp_ok(false), m_cond_temp_ok(false), @@ -71,6 +73,8 @@ namespace Cantera { m_visc_mix_ok(false), m_visc_temp_ok(false), m_visc_conc_ok(false), + m_radi_temp_ok(false), + m_radi_conc_ok(false), m_diff_mix_ok(false), m_diff_temp_ok(false), m_cond_temp_ok(false), @@ -112,6 +116,7 @@ namespace Cantera { m_bdiff = right.m_bdiff; m_viscSpecies = right.m_viscSpecies; m_logViscSpecies = right.m_logViscSpecies; + m_hydrodynamic_radius = right.m_hydrodynamic_radius; m_lambdaSpecies = right.m_lambdaSpecies; m_iStateMF = -1; m_molefracs = right.m_molefracs; @@ -131,6 +136,8 @@ namespace Cantera { m_visc_mix_ok = false; m_visc_temp_ok = false; m_visc_conc_ok = false; + m_radi_temp_ok = false; + m_radi_conc_ok = false; m_diff_mix_ok = false; m_diff_temp_ok = false; m_cond_temp_ok = false; @@ -378,7 +385,8 @@ namespace Cantera { m_visc_mix_ok = false; m_visc_temp_ok = false; m_visc_conc_ok = false; - + m_radi_temp_ok = false; + m_radi_conc_ok = false; m_cond_temp_ok = false; m_cond_mix_ok = false; m_diff_temp_ok = false; @@ -457,15 +465,23 @@ namespace Cantera { } copy(m_viscSpecies.begin(), m_viscSpecies.end(), visc); } - //==================================================================================================================== + + //=============================================================== // Returns the hydrodynamic radius for all species /* * The pure species viscosities are to be given in an Arrhenius * form in accordance with activated-jump-process dominated transport. */ void LiquidTransport::getSpeciesHydrodynamicRadius(doublereal* const radius) { + update_T(); + if (!m_radi_temp_ok) { + updateHydrodynamicRadius_T(); + } + copy(m_hydrodynamic_radius.begin(), m_hydrodynamic_radius.end(), radius); + } - //==================================================================================================================== + + //================================================================ /******************* binary diffusion coefficients **************/ @@ -746,6 +762,7 @@ namespace Cantera { // temperature has changed so temp flags are flipped m_visc_temp_ok = false; + m_radi_temp_ok = false; m_diff_temp_ok = false; // temperature has changed, so polynomial temperature @@ -1002,6 +1019,59 @@ namespace Cantera { } + //! Update the pure-species viscosities functional dependence on concentration. + void LiquidTransport::updateHydrodynamicRadius_C() { + m_visc_conc_ok = true; + } + + + /** + * Update the temperature-dependent hydrodynamic radius 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 LiquidTransport::updateHydrodynamicRadius_T() { + int k; + + for (k = 0; k < m_nsp; k++) { + vector_fp &coeffk = m_coeffRadius_Ns[k]; + + if ( m_radiusTempDepType_Ns[k] == LTR_MODEL_CONSTANT ) { + m_hydrodynamic_radius[k] = coeffk[0] ; + + } else if ( m_radiusTempDepType_Ns[k] == LTR_MODEL_ARRHENIUS ) { + //m_coeffRadius_Ns[k][0] holds A + //m_coeffRadius_Ns[k][1] holds n + //m_coeffRadius_Ns[k][2] holds Tact + //m_coeffRadius_Ns[k][3] holds log(A) + m_hydrodynamic_radius[k] = coeffk[0] * exp( coeffk[1] * m_logt + - coeffk[2] / m_temp ); + + } else if ( m_radiusTempDepType_Ns[k] == LTR_MODEL_POLY ) { + m_hydrodynamic_radius[k] = coeffk[0] + + coeffk[1] * m_temp + + coeffk[2] * m_temp * m_temp + + coeffk[3] * m_temp * m_temp * m_temp + + coeffk[4] * m_temp * m_temp * m_temp * m_temp; + + } else if ( m_radiusTempDepType_Ns[k] == LTR_MODEL_NOTSET ) { + throw CanteraError("LiquidTransport::updateHydrodynamicRadius_T", + "Hydrodynamic Radius Model is not set for species " + + m_thermo->speciesName(k) + + " in the input file"); + } else { + throw CanteraError("LiquidTransport::updateHydrodynamicRadius_T", + "Hydrodynamic Radius Model for species " + + m_thermo->speciesName(k) + + " is not handled by this object"); + } + m_radi_temp_ok = true; + m_diff_mix_ok = false; + } + } + + /* * * Solve for the diffusional velocities in the Stefan-Maxwell equations diff --git a/Cantera/src/transport/LiquidTransport.h b/Cantera/src/transport/LiquidTransport.h index 4d6c43638..b56129fce 100644 --- a/Cantera/src/transport/LiquidTransport.h +++ b/Cantera/src/transport/LiquidTransport.h @@ -446,6 +446,13 @@ namespace Cantera { */ void updateViscosity_T(); + //! Update the temperature-dependent hydrodynamic radius terms + //! for each species + /*! + * The flag m_radi_temp_ok is set to true. + */ + void updateHydrodynamicRadius_T(); + //! Update the temperature-dependent parts of the mixture-averaged //! thermal conductivity. void updateCond_T(); @@ -453,13 +460,23 @@ namespace Cantera { //! Update the concentration parts of the viscosities /*! * Internal routine is run whenever the update_boolean - * m_visc_conc_ok is false. This routine will calculate - * internal values for the species viscosities. + * m_visc_conc_ok is false. Currently there is no concentration + * dependence for the pure species viscosities. * * @internal */ void updateViscosities_C(); + //! Update the concentration dependence of the hydrodynamic radius + /*! + * Internal routine is run whenever the update_boolean + * m_radi_conc_ok is false. Currently there is no concentration + * dependence for the hydrodynamic radius. + * + * @internal + */ + void updateHydrodynamicRadius_C(); + //! Update the binary diffusion coefficients wrt T. /*! * These are evaluated @@ -535,6 +552,7 @@ namespace Cantera { vector m_diffTempDepType_Ns; //! Pure species diffusvities in temperature-dependent form. + //! Not currently used since we get diffusivity from hydrodynamic radius. std::vector m_coeffDiff_Ns; @@ -829,6 +847,14 @@ namespace Cantera { //! are current wrt the concentration bool m_visc_conc_ok; + //! Boolean indicating that temperature dependence of + //! hydrodynamic radius is current + bool m_radi_temp_ok; + + //! Flag to indicate that the hydrodynamic radius is current + //! is current wrt the concentration + bool m_radi_conc_ok; + //! Boolean indicating that mixture diffusion coeffs are current bool m_diff_mix_ok;