From c438d5846f03f943b7b5864392e483c7a744fa66 Mon Sep 17 00:00:00 2001 From: Dave Goodwin Date: Sat, 15 Dec 2007 17:15:46 +0000 Subject: [PATCH] added spectroscopy support --- Cantera/cxx/Makefile.in | 7 +- Cantera/fortran/src/Makefile.in | 2 +- Cantera/fortran/src/cantera.f90 | 13 + Cantera/fortran/src/cantera_funcs.f90 | 33 ++ Cantera/fortran/src/cantera_kinetics.f90 | 13 + Cantera/fortran/src/cantera_thermo.f90 | 9 + Cantera/fortran/src/fct.cpp | 56 ++- Cantera/fortran/src/fct_interface.f90 | 9 + Cantera/python/Cantera/constants.py | 2 +- Cantera/python/Cantera/liquidvapor.py | 7 - Cantera/python/ctml_writer.py | 80 +++- Cantera/src/Makefile.in | 3 + Cantera/src/base/ct_defs.h | 6 +- Cantera/src/base/misc.cpp | 3 +- Cantera/src/base/units.h | 369 ++++++++++--------- Cantera/src/thermo/GeneralSpeciesThermo.cpp | 29 +- Cantera/src/thermo/PureFluidPhase.h | 2 +- Cantera/src/thermo/SimpleThermo.h | 2 +- Cantera/src/thermo/SpeciesThermoFactory.cpp | 48 ++- Cantera/src/thermo/SpeciesThermoInterpType.h | 8 +- Cantera/src/thermo/ThermoFactory.cpp | 4 + Cantera/src/thermo/mix_defs.h | 1 + Cantera/src/thermo/speciesThermoTypes.h | 2 + Cantera/src/transport/Makefile.in | 5 +- Cantera/src/transport/TransportBase.h | 7 +- Cantera/src/transport/TransportFactory.cpp | 2 + configure | 31 +- configure.in | 17 + data/inputs/air.cti | 3 +- preconfig | 7 +- 30 files changed, 543 insertions(+), 237 deletions(-) diff --git a/Cantera/cxx/Makefile.in b/Cantera/cxx/Makefile.in index 18fc984de..171787515 100644 --- a/Cantera/cxx/Makefile.in +++ b/Cantera/cxx/Makefile.in @@ -19,7 +19,8 @@ CXX_H = Cantera.h equilibrium.h IncompressibleSolid.h \ kinetics.h onedim.h surface.h GRI30.h integrators.h \ Metal.h PureFluid.h transport.h Edge.h \ IdealGasMix.h Interface.h numerics.h \ - reactionpaths.h zerodim.h importPhase.h thermo.h + reactionpaths.h zerodim.h importPhase.h thermo.h \ + radiation.h spectra.h all: @(cd include ; \ @@ -48,5 +49,9 @@ install: cd src; @MAKE@ install cd demos; @MAKE@ install +demos: + cd demos; @MAKE@ + + # end of file diff --git a/Cantera/fortran/src/Makefile.in b/Cantera/fortran/src/Makefile.in index 07be698e5..1b64ea989 100644 --- a/Cantera/fortran/src/Makefile.in +++ b/Cantera/fortran/src/Makefile.in @@ -20,7 +20,7 @@ CXX_OBJS = fct.o fctxml.o INTERFACE_MODULE_OBJS = fct_interface.o fctxml_interface.o USER_MODULE_OBJS = cantera_xml.o cantera_thermo.o cantera_kinetics.o \ - cantera_transport.o cantera_funcs.o cantera.o + cantera_transport.o cantera_iface.o cantera_funcs.o cantera.o MODULES = $(INTERFACE_MODULE_OBJS:_interface.o=.mod) $(USER_MODULE_OBJS) OBJS = $(CXX_OBJS) $(USER_MODULE_OBJS) diff --git a/Cantera/fortran/src/cantera.f90 b/Cantera/fortran/src/cantera.f90 index bfcfc0450..d1a9e1579 100644 --- a/Cantera/fortran/src/cantera.f90 +++ b/Cantera/fortran/src/cantera.f90 @@ -11,6 +11,7 @@ MODULE CANTERA USE cantera_transport USE cantera_xml USE cantera_funcs + USE cantera_iface INTERFACE addAttrib MODULE PROCEDURE ctxml_addAttrib @@ -204,6 +205,10 @@ MODULE CANTERA MODULE PROCEDURE ctfunc_importPhase END INTERFACE importPhase + INTERFACE importInterface + MODULE PROCEDURE ctfunc_importInterface + END INTERFACE importInterface + INTERFACE intEnergy_mass MODULE PROCEDURE ctthermo_intEnergy_mass END INTERFACE intEnergy_mass @@ -280,6 +285,14 @@ MODULE CANTERA MODULE PROCEDURE ctkin_nTotalSpecies END INTERFACE nTotalSpecies + INTERFACE nPhases + MODULE PROCEDURE ctkin_nPhases + END INTERFACE nPhases + + INTERFACE phaseIndex + MODULE PROCEDURE ctkin_phaseIndex + END INTERFACE phaseIndex + INTERFACE phase_report MODULE PROCEDURE ctfunc_phase_report END INTERFACE phase_report diff --git a/Cantera/fortran/src/cantera_funcs.f90 b/Cantera/fortran/src/cantera_funcs.f90 index 2d2158c4a..bd5aa5096 100644 --- a/Cantera/fortran/src/cantera_funcs.f90 +++ b/Cantera/fortran/src/cantera_funcs.f90 @@ -4,6 +4,7 @@ module cantera_funcs use cantera_thermo use cantera_kinetics use cantera_transport + use cantera_iface contains @@ -39,6 +40,35 @@ module cantera_funcs return end function ctfunc_importphase + + type(interface_t) function ctfunc_importInterface(src, id, gas, bulk, loglevel) + implicit none + character*(*), intent(in) :: src + character*(*), intent(in), optional :: id + type(phase_t) gas, bulk, surf + integer, intent(in), optional :: loglevel + + character(20) :: model + type(XML_Node) root, s, str + type(interface_t) self + + root = new_XML_Node(src = src) + if (present(id)) then + s = ctxml_child(root, id = id) + else + s = ctxml_child(root, 'phase') + end if + + surf = newThermoPhase(s) + !write(*,*) 'from importInterface: nSpecies = ',ctthermo_nSpecies(surf) + self = newInterface(s,surf,gas,bulk) + ! call newKinetics(s, self) + + ctfunc_importInterface = self + return + end function ctfunc_importInterface + + subroutine ctfunc_phase_report(self, buf, show_thermo) implicit none type(phase_t), intent(inout) :: self @@ -66,3 +96,6 @@ module cantera_funcs end subroutine ctfunc_addCanteraDirectory end module cantera_funcs + + + diff --git a/Cantera/fortran/src/cantera_kinetics.f90 b/Cantera/fortran/src/cantera_kinetics.f90 index 1f1067e82..71fbea0d0 100644 --- a/Cantera/fortran/src/cantera_kinetics.f90 +++ b/Cantera/fortran/src/cantera_kinetics.f90 @@ -78,6 +78,19 @@ module cantera_kinetics ctkin_nreactions = kin_nreactions(self%kin_id) end function ctkin_nreactions + integer function ctkin_nPhases(self) + implicit none + type(phase_t), intent(inout) :: self + ctkin_nphases = kin_nphases(self%kin_id) + end function ctkin_nphases + + integer function ctkin_phaseIndex(self, name) + implicit none + type(phase_t), intent(inout) :: self + character*(*), intent(in) :: name + ctkin_phaseindex = kin_phaseindex(self%kin_id, name) + end function ctkin_phaseindex + double precision function ctkin_reactantStoichCoeff(self, k, i) implicit none type(phase_t), intent(in) :: self diff --git a/Cantera/fortran/src/cantera_thermo.f90 b/Cantera/fortran/src/cantera_thermo.f90 index ee5074a3a..33019df1a 100644 --- a/Cantera/fortran/src/cantera_thermo.f90 +++ b/Cantera/fortran/src/cantera_thermo.f90 @@ -46,12 +46,21 @@ contains self%nsp = phase_nspecies(self%thermo_id) self%nrxn = 0 self%err = 0 + self%kin_id = -1 + self%tran_id = -1 else call cantera_error('newThermoPhase','xml_phase or id must be specified.') end if newThermoPhase = self end function newThermoPhase + subroutine ctthermo_getName(self, name) + implicit none + type(phase_t), intent(inout) :: self + character*(*), intent(out) :: name + call phase_getname(self%thermo_id, name) + end subroutine ctthermo_getName + integer function ctthermo_nElements(self) implicit none type(phase_t), intent(inout) :: self diff --git a/Cantera/fortran/src/fct.cpp b/Cantera/fortran/src/fct.cpp index ce6edd873..585fb0fc5 100644 --- a/Cantera/fortran/src/fct.cpp +++ b/Cantera/fortran/src/fct.cpp @@ -43,8 +43,17 @@ inline ThermoPhase* _fph(const integer* n) { return th(*n); } -inline Kinetics* _fkin(const integer* n) { - return kin(*n); +//inline Kinetics* _fkin(const integer* n) { +// return kin(*n); +//} + +static Kinetics* _fkin(const integer* n) { + if (*n >= 0) + return kin(*n); + else { + error("_fkin: negative kinetics index"); + return kin(0); + } } inline ThermoPhase* _fth(const integer* n) { @@ -88,6 +97,18 @@ extern "C" { //--------------- Phase ---------------------// + status_t DLL_EXPORT phase_getname_(const integer* n, char* nm, + ftnlen lennm) { + try { + string pnm = _fph(n)->name(); + int lout = min(lennm,pnm.size()); + copy(pnm.c_str(), pnm.c_str() + lout, nm); + for (int nn = lout; nn < lennm; nn++) nm[nn] = ' '; + return 0; + } + catch (CanteraError) { handleError(); return -1; } + } + integer DLL_EXPORT phase_nelements_(const integer* n) { return _fph(n)->nElements(); } @@ -417,7 +438,7 @@ extern "C" { //-------------- Kinetics ------------------// - status_t DLL_EXPORT newkineticsfromxml_(integer* mxml, integer* iphase, + integer DLL_EXPORT newkineticsfromxml_(integer* mxml, integer* iphase, const integer* neighbor1, const integer* neighbor2, const integer* neighbor3, const integer* neighbor4) { try { @@ -438,13 +459,14 @@ extern "C" { } Kinetics* kin = newKineticsMgr(*x, phases); if (kin) { - return Storage::storage()->addKinetics(kin); + int k = Storage::storage()->addKinetics(kin); + return k; //Storage::storage()->addKinetics(kin); } else { return 0; } } - catch (CanteraError) { handleError(); return -1; } + catch (CanteraError) { handleError(); return 999; } } // status_t DLL_EXPORT installRxnArrays_(integer* pxml, integer* ikin, @@ -483,6 +505,15 @@ extern "C" { return _fkin(n)->nReactions(); } + integer DLL_EXPORT kin_nphases_(const integer* n) { + return _fkin(n)->nPhases(); + } + + integer DLL_EXPORT kin_phaseindex_(const integer* n, const char* ph, + ftnlen lenph) { + return _fkin(n)->phaseIndex(f2string(ph, lenph)); + } + doublereal DLL_EXPORT kin_reactantstoichcoeff_(const integer* n, integer* k, integer* i) { return _fkin(n)->reactantStoichCoeff(*k-1,*i-1); } @@ -714,21 +745,6 @@ extern "C" { return 0; } -// status_t DLL_EXPORT readlog_(const integer* n, char* buf) { -// string s; -// writelog("function readlog is deprecated!"); -// //getlog(s); -// int nlog = s.size(); -// if (n < 0) return nlog; -// int nn = min(n-1, nlog); -// copy(s.begin(), s.begin() + nn, -// buf); -// buf[min(nlog, n-1)] = '\0'; -// //clearlog(); -// return 0; - -// } - status_t DLL_EXPORT ctbuildsolutionfromxml(char* src, integer* ixml, char* id, integer* ith, integer* ikin, ftnlen lensrc, ftnlen lenid) { diff --git a/Cantera/fortran/src/fct_interface.f90 b/Cantera/fortran/src/fct_interface.f90 index c36ce38a7..b415d784b 100644 --- a/Cantera/fortran/src/fct_interface.f90 +++ b/Cantera/fortran/src/fct_interface.f90 @@ -281,6 +281,15 @@ interface integer, intent(in) :: n end function kin_nreactions + integer function kin_nphases(n) + integer, intent(in) :: n + end function kin_nphases + + integer function kin_phaseIndex(n, phase) + integer, intent(in) :: n + character*(*), intent(in) :: phase + end function kin_phaseindex + double precision function kin_reactantstoichcoeff(n, k, i) integer, intent(in) :: n integer, intent(in) :: k diff --git a/Cantera/python/Cantera/constants.py b/Cantera/python/Cantera/constants.py index c0ebb015b..c1aaababa 100755 --- a/Cantera/python/Cantera/constants.py +++ b/Cantera/python/Cantera/constants.py @@ -21,7 +21,7 @@ Boltzmann = GasConstant / Avogadro StefanBoltz = 5.67e-8 # The charge on an electron -ElectronCharge = 1.602e-19 +ElectronCharge = 1.602176487e-19 Pi = 3.1415926 diff --git a/Cantera/python/Cantera/liquidvapor.py b/Cantera/python/Cantera/liquidvapor.py index d5c29c1e8..983d99ddf 100644 --- a/Cantera/python/Cantera/liquidvapor.py +++ b/Cantera/python/Cantera/liquidvapor.py @@ -23,13 +23,6 @@ class PureFluid(ThermoPhase): mixture of gases, a liquid solution, or a solid solution, for example. - Class PureFluid derives from classes ThermoPhase, Kinetics, and - Transport. It defines very few methods of its own, and is - provided largely for convenience, so that a single object can be - used to compute thermodynamic, kinetic, and transport properties - of a solution. Functions like IdealGasMix and others defined in - module gases return objects of class PureFluid. - """ def __init__(self, src="", id=""): diff --git a/Cantera/python/ctml_writer.py b/Cantera/python/ctml_writer.py index 037f7db2d..95d19bd9a 100644 --- a/Cantera/python/ctml_writer.py +++ b/Cantera/python/ctml_writer.py @@ -678,6 +678,41 @@ class Shomate(thermo): u = n.addChild("floatArray", str) u["size"] = "7" u["name"] = "coeffs" + + +class Adsorbate(thermo): + """Adsorbed species characterized by a binding energy and a set of + vibrational frequencies.""" + + def __init__(self, range = (0.0, 0.0), + binding_energy = 0.0, + frequencies = [], p0 = -1.0): + self._t = range + self._pref = p0 + self._freqs = frequencies + self._be = binding_energy + + + def build(self, t): + n = t.addChild("adsorbate") + n['Tmin'] = `self._t[0]` + n['Tmax'] = `self._t[1]` + if self._pref <= 0.0: + n['P0'] = `_pref` + else: + n['P0'] = `self._pref` + + energy_units = _uenergy+'/'+_umol + addFloat(n,'binding_energy',self._be, defunits = energy_units) + str = "" + nfreq = len(self._freqs) + for i in range(nfreq): + str += '%17.9E, ' % self._freqs[i] + str += '\n' + u = n.addChild("floatArray", str) + u["size"] = `nfreq` + u["name"] = "freqs" + class const_cp(thermo): @@ -1627,6 +1662,7 @@ class lattice_solid(phase): k['model'] = 'none' + class liquid_vapor(phase): """A fluid with a complete liquid/vapor equation of state. This entry type selects one of a set of predefined fluids with @@ -1657,7 +1693,49 @@ class liquid_vapor(phase): e['model'] = 'PureFluid' e['fluid_type'] = `self._subflag` k = ph.addChild("kinetics") - k['model'] = 'none' + k['model'] = 'none' + + + +class redlich_kwong(phase): + """A fluid with a complete liquid/vapor equation of state. + This entry type selects one of a set of predefined fluids with + built-in liquid/vapor equations of state. The substance_flag + parameter selects the fluid. See purefluids.py for the usage + of this entry type.""" + + def __init__(self, + name = '', + elements = '', + species = '', + substance_flag = 7, + initial_state = None, + Tcrit = 1.0, + Pcrit = 1.0, + options = []): + + phase.__init__(self, name, 3, elements, species, 'none', + initial_state, options) + self._subflag = 7 + self._pure = 1 + self._tc = 1 + self._pc = 1 + + def conc_dim(self): + return (0,0) + + def build(self, p): + ph = phase.build(self, p) + e = ph.addChild("thermo") + e['model'] = 'PureFluid' + e['fluid_type'] = `self._subflag` + addFloat(e, 'Tc', self._tc, defunits = "K") + addFloat(e, 'Pc', self._pc, defunits = "Pa") + addFloat(e, 'MolWt', self._mw, defunits = _umass+"/"+_umol) + ph.addChild("kinetics") + k['model'] = 'none' + + class ideal_interface(phase): """An ideal interface.""" diff --git a/Cantera/src/Makefile.in b/Cantera/src/Makefile.in index ff44601bc..01072f159 100755 --- a/Cantera/src/Makefile.in +++ b/Cantera/src/Makefile.in @@ -18,6 +18,7 @@ all: cd thermo; @MAKE@ all cd kinetics; @MAKE@ all cd numerics; @MAKE@ all + cd spectra; @MAKE@ all clean: cd base; $(RM) .depends ; @MAKE@ clean @@ -29,6 +30,7 @@ clean: cd thermo; $(RM) .depends ; @MAKE@ clean cd kinetics; $(RM) .depends ; @MAKE@ clean cd numerics; $(RM) .depends ; @MAKE@ clean + cd spectra; $(RM) .depends ; @MAKE@ clean depends: cd base; @MAKE@ depends @@ -40,6 +42,7 @@ depends: cd thermo; @MAKE@ depends cd kinetics; @MAKE@ depends cd numerics; @MAKE@ depends + cd spectra; @MAKE@ depends TAGS: etags *.h *.cpp diff --git a/Cantera/src/base/ct_defs.h b/Cantera/src/base/ct_defs.h index ff128bc87..1fbedd40c 100755 --- a/Cantera/src/base/ct_defs.h +++ b/Cantera/src/base/ct_defs.h @@ -104,7 +104,7 @@ namespace Cantera { //@} /// @name Electron Properties //@{ - const doublereal ElectronCharge = 1.602e-19; // C + const doublereal ElectronCharge = 1.602176487e-19; // C const doublereal ElectronMass = 9.10938188e-31; // kg const doublereal Faraday = ElectronCharge * Avogadro; //@} @@ -119,6 +119,8 @@ namespace Cantera { /// Permeability of free space \f$ \mu_0 \f$ in N/A^2. const doublereal permeability_0 = 4.0e-7*Pi; // N/A^2 + const doublereal lightSpeed = 1.0/sqrt(epsilon_0 * permeability_0); + //@} //@} @@ -144,6 +146,8 @@ namespace Cantera { const doublereal SqrtTen = std::sqrt(10.0); //! sqrt(8) const doublereal SqrtEight = std::sqrt(8.0); + const doublereal SqrtTwo = std::sqrt(2.0); + //! smallest number to compare to zero. const doublereal SmallNumber = 1.e-300; //! largest number to compare to inf. diff --git a/Cantera/src/base/misc.cpp b/Cantera/src/base/misc.cpp index 1fbb48335..e90cd395d 100755 --- a/Cantera/src/base/misc.cpp +++ b/Cantera/src/base/misc.cpp @@ -1401,7 +1401,8 @@ protected: doublereal toSI(std::string unit) { doublereal f = Unit::units()->toSI(unit); if (f) return f; - else return 1.0; + else throw CanteraError("toSI","unknown unit string: "+unit); + //return 1.0; } doublereal actEnergyToSI(std::string unit) { diff --git a/Cantera/src/base/units.h b/Cantera/src/base/units.h index be4952303..b6fb22363 100644 --- a/Cantera/src/base/units.h +++ b/Cantera/src/base/units.h @@ -25,210 +25,219 @@ namespace Cantera { - //! Unit conversion utility - /*! - * - * @ingroup inputfiles - */ - class Unit { - public: - - //! Initialize the static Unit class. - static Unit* units() { - #if defined(THREAD_SAFE_CANTERA) - boost::mutex::scoped_lock lock(units_mutex) ; - #endif - if (!s_u) s_u = new Unit; - return s_u; - } - - //! Destroy the static Unit class + //! Unit conversion utility /*! - * Note this can't be done in a destructor. - */ - static void deleteUnit() { - #if defined(THREAD_SAFE_CANTERA) - boost::mutex::scoped_lock lock(units_mutex) ; - #endif - if (s_u) { - delete s_u; - s_u = 0; - } - } - - //! Empty Destructor - virtual ~Unit() {} - - /** - * Return the multiplier required to convert an activation - * energy to SI units. - * @param units activation energy units - */ - doublereal actEnergyToSI(std::string units) { - if (m_act_u.find(units) != m_act_u.end()) { - return m_act_u[units]; - } - else { - return toSI(units); - } - } - - /** - * Return the multiplier required to convert a dimensional quantity - * with units specified by string 'units' to SI units. - * The list of recognized units is storred as a stl map - * called m_u[] and m_act_u for activity - * coefficients. These maps are initialized with likely values. * - * @param units String containing the units description + * @ingroup inputfiles */ - doublereal toSI(std::string units) { + class Unit { + public: - // if dimensionless, return 1.0 - if (units == "") return 1.0; + //! Initialize the static Unit class. + static Unit* units() { +#if defined(THREAD_SAFE_CANTERA) + boost::mutex::scoped_lock lock(units_mutex) ; +#endif + if (!s_u) s_u = new Unit; + return s_u; + } - doublereal f = 1.0, fctr; - int tsize; - std::string u = units, tok, tsub; - std::string::size_type k; - char action = '-'; + //! Destroy the static Unit class + /*! + * Note this can't be done in a destructor. + */ + static void deleteUnit() { +#if defined(THREAD_SAFE_CANTERA) + boost::mutex::scoped_lock lock(units_mutex) ; +#endif + if (s_u) { + delete s_u; + s_u = 0; + } + } - while (1 > 0) { + //! Empty Destructor + virtual ~Unit() {} - // get token consisting of all characters up to the next - // dash, slash, or the end of the string - k = u.find_first_of("/-"); - if (k != std::string::npos) - tok = u.substr(0,k); - else - tok = u; - tsize = static_cast(tok.size()); - if (tsize == 0) - fctr = 1.0; - else if (tok[tsize - 1] == '2') { - tsub = tok.substr(0,tsize-1); - fctr = m_u[tsub]; - fctr *= fctr; - } - else if (tok[tsize - 1] == '3') { - tsub = tok.substr(0,tsize-1); - fctr = m_u[tsub]; - fctr *= fctr*fctr; - } - else if (tok[tsize - 1] == '4') { - tsub = tok.substr(0,tsize-1); - fctr = m_u[tsub]; - fctr *= fctr*fctr*fctr; - } - else if (tok[tsize - 1] == '5') { - tsub = tok.substr(0,tsize-1); - fctr = m_u[tsub]; - fctr *= fctr*fctr*fctr*fctr; - } - else if (tok[tsize - 1] == '6') { - tsub = tok.substr(0,tsize-1); - fctr = m_u[tsub]; - fctr *= fctr*fctr*fctr*fctr*fctr; - } - else { - tsub = tok; - fctr = m_u[tok]; - } + /** + * Return the multiplier required to convert an activation + * energy to SI units. + * @param units activation energy units + */ + doublereal actEnergyToSI(std::string units) { + if (m_act_u.find(units) != m_act_u.end()) { + return m_act_u[units]; + } + else { + return toSI(units); + } + } - // tok is not one of the entries in map m_u, then - // m_u[tok] returns 0.0. Check for this. - if (fctr == 0) - throw CanteraError("toSI","unknown unit: "+tsub); - if (action == '-') f *= fctr; - else if (action == '/') f /= fctr; - if (k == std::string::npos) break; - action = u[k]; - u = u.substr(k+1,u.size()); - } - return f; - } + /** + * Return the multiplier required to convert a dimensional quantity + * with units specified by string 'units' to SI units. + * The list of recognized units is storred as a stl map + * called m_u[] and m_act_u for activity + * coefficients. These maps are initialized with likely values. + * + * @param units String containing the units description + */ + doublereal toSI(std::string units) { + + // if dimensionless, return 1.0 + if (units == "") return 1.0; + + doublereal f = 1.0, fctr; + int tsize; + std::string u = units, tok, tsub; + std::string::size_type k; + char action = '-'; - private: + while (1 > 0) { - /// pointer to the single instance of Unit - static Unit* s_u; + // get token consisting of all characters up to the next + // dash, slash, or the end of the string + k = u.find_first_of("/-"); + if (k != std::string::npos) + tok = u.substr(0,k); + else + tok = u; + tsize = static_cast(tok.size()); + if (tsize == 0) + fctr = 1.0; + else if (tok[tsize - 1] == '2') { + tsub = tok.substr(0,tsize-1); + fctr = m_u[tsub]; + fctr *= fctr; + } + else if (tok[tsize - 1] == '3') { + tsub = tok.substr(0,tsize-1); + fctr = m_u[tsub]; + fctr *= fctr*fctr; + } + else if (tok[tsize - 1] == '4') { + tsub = tok.substr(0,tsize-1); + fctr = m_u[tsub]; + fctr *= fctr*fctr*fctr; + } + else if (tok[tsize - 1] == '5') { + tsub = tok.substr(0,tsize-1); + fctr = m_u[tsub]; + fctr *= fctr*fctr*fctr*fctr; + } + else if (tok[tsize - 1] == '6') { + tsub = tok.substr(0,tsize-1); + fctr = m_u[tsub]; + fctr *= fctr*fctr*fctr*fctr*fctr; + } + else { + tsub = tok; + fctr = m_u[tok]; + } - //! Map between a string and a units double value - /*! - * This map maps the dimension string to the units value adjustment. Example - * - m_u["m"] = 1.0; - * - m_u["cm"] = 0.01; - */ - std::map m_u; + // tok is not one of the entries in map m_u, then + // m_u[tok] returns 0.0. Check for this. + if (fctr == 0) + throw CanteraError("toSI","unknown unit: "+tsub); + if (action == '-') f *= fctr; + else if (action == '/') f /= fctr; + if (k == std::string::npos) break; + action = u[k]; + u = u.substr(k+1,u.size()); + } + return f; + } - //! Map between a string and a units double value for activation energy units - /*! - * This map maps the dimension string to the units value adjustment. Example - * - m_act_u["K"] = GasConstant; - */ - std::map m_act_u; + private: + + /// pointer to the single instance of Unit + static Unit* s_u; + + //! Map between a string and a units double value + /*! + * This map maps the dimension string to the units value adjustment. Example + * - m_u["m"] = 1.0; + * - m_u["cm"] = 0.01; + */ + std::map m_u; + + //! Map between a string and a units double value for activation energy units + /*! + * This map maps the dimension string to the units value adjustment. Example + * - m_act_u["K"] = GasConstant; + */ + std::map m_act_u; #if defined(THREAD_SAFE_CANTERA) - //! Decl for static locker for Units singelton - static boost::mutex units_mutex; + //! Decl for static locker for Units singelton + static boost::mutex units_mutex; #endif - /*! - * Units class constructor, containing the default mappings between - * strings and units. - */ - Unit(){ + /*! + * Units class constructor, containing the default mappings between + * strings and units. + */ + Unit(){ - // length - m_u["m"] = 1.0; - m_u["cm"] = 0.01; - m_u["km"] = 1.0e3; - m_u["mm"] = 1.0e-3; - m_u["micron"] = 1.0e-6; - m_u["nm"] = 1.0e-9; - m_u["A"] = 1.0e-10; - m_u["Angstrom"] = 1.0e-10; - m_u["Angstroms"] = 1.0e-10; + // length + m_u["m"] = 1.0; + m_u["cm"] = 0.01; + m_u["km"] = 1.0e3; + m_u["mm"] = 1.0e-3; + m_u["micron"] = 1.0e-6; + m_u["nm"] = 1.0e-9; + m_u["A"] = 1.0e-10; + m_u["Angstrom"] = 1.0e-10; + m_u["Angstroms"] = 1.0e-10; - // energy - m_u["J"] = 1.0; - m_u["kJ"] = 1.0e3; - m_u["cal"] = 4.184; - m_u["kcal"] = 4184.0; - m_u["eV"] = Faraday; //1.60217733e-19; + // energy + m_u["J"] = 1.0; + m_u["kJ"] = 1.0e3; + m_u["cal"] = 4.184; + m_u["kcal"] = 4184.0; + m_u["eV"] = Faraday; //1.60217733e-19; - // quantity - m_u["mol"] = 1.0e-3; - m_u["gmol"] = 1.0e-3; - m_u["mole"] = 1.0e-3; - m_u["kmol"] = 1.0; - m_u["molec"] = 1.0/Avogadro; + // quantity + m_u["mol"] = 1.0e-3; + m_u["gmol"] = 1.0e-3; + m_u["mole"] = 1.0e-3; + m_u["kmol"] = 1.0; + m_u["kgmol"] = 1.0; + m_u["molec"] = 1.0/Avogadro; - // temperature - m_u["K"] = 1.0; - m_u["C"] = 1.0; + // temperature + m_u["K"] = 1.0; + m_u["C"] = 1.0; - // mass - m_u["g"] = 1.0e-3; - m_u["kg"] = 1.0; + // mass + m_u["g"] = 1.0e-3; + m_u["kg"] = 1.0; - // pressure - m_u["atm"] = 1.01325e5; - m_u["bar"] = 1.0e5; - m_u["Pa"] = 1.0; + // pressure + m_u["atm"] = 1.01325e5; + m_u["bar"] = 1.0e5; + m_u["Pa"] = 1.0; - // time - m_u["s"] = 1.0; - m_u["min"] = 60.0; - m_u["hr"] = 3600.0; - m_u["ms"] = 0.001; + // time + m_u["s"] = 1.0; + m_u["min"] = 60.0; + m_u["hr"] = 3600.0; + m_u["ms"] = 0.001; - m_act_u["eV"] = m_u["eV"]; // /m_u["molec"]; - m_act_u["K"] = GasConstant; - m_act_u["Kelvin"] = GasConstant; - m_act_u["Dimensionless"] = (GasConstant * 273.15); - } - }; + // frequency + m_u["hZ"] = 0.01/(lightSpeed); + m_u["cm^-1"] = 1.0; + m_u["m^-1"] = 0.1; + m_u["cm-1"] = m_u["cm^-1"]; + m_u["m-1"] = m_u["m^-1"]; + m_u["wavenumbers"] = m_u["cm^-1"]; + + m_act_u["eV"] = m_u["eV"]; // /m_u["molec"]; + m_act_u["K"] = GasConstant; + m_act_u["Kelvin"] = GasConstant; + m_act_u["Dimensionless"] = (GasConstant * 273.15); + } + }; } #endif diff --git a/Cantera/src/thermo/GeneralSpeciesThermo.cpp b/Cantera/src/thermo/GeneralSpeciesThermo.cpp index 1b28f9535..005acabd7 100644 --- a/Cantera/src/thermo/GeneralSpeciesThermo.cpp +++ b/Cantera/src/thermo/GeneralSpeciesThermo.cpp @@ -15,8 +15,11 @@ #include "ShomatePoly.h" #include "ConstCpPoly.h" #include "Mu0Poly.h" +#include "AdsorbateThermo.h" + #include "SpeciesThermoFactory.h" #include + using namespace std; namespace Cantera { @@ -116,12 +119,14 @@ namespace Cantera { m_sp.resize(index+1, 0); m_kk = index+1; } - AssertThrow(m_sp[index] == 0, - "Index position isn't null, duplication of assignment: " + int2str(index)); + //AssertThrow(m_sp[index] == 0, + // "Index position isn't null, duplication of assignment: " + int2str(index)); + int nfreq = 3; /* * Create the necessary object */ + switch (type) { case NASA1: m_sp[index] = new NasaPoly1(index, minTemp, maxTemp, @@ -148,12 +153,20 @@ namespace Cantera { m_sp[index] = new NasaPoly2(index, minTemp, maxTemp, refPressure, c); break; + case ADSORBATE: + m_sp[index] = new Adsorbate(index, minTemp, maxTemp, + refPressure, c); + break; default: throw UnknownSpeciesThermoModel( "GeneralSpeciesThermo::install", "unknown species type", int2str(type)); break; } + if (!m_sp[index]) { + cout << "Null m_sp... index = " << index << endl; + cout << "type = " << type << endl; + } m_tlow_max = max(minTemp, m_tlow_max); m_thigh_min = min(maxTemp, m_thigh_min); } @@ -211,10 +224,16 @@ namespace Cantera { vector::const_iterator _begin, _end; _begin = m_sp.begin(); _end = m_sp.end(); - SpeciesThermoInterpType * sp_ptr; + SpeciesThermoInterpType * sp_ptr = 0; for (; _begin != _end; ++_begin) { sp_ptr = *(_begin); - sp_ptr->updatePropertiesTemp(t, cp_R, h_RT, s_R); + if (sp_ptr) { + + sp_ptr->updatePropertiesTemp(t, cp_R, h_RT, s_R); + } + else { + writelog("General::update: sp_ptr is NULL!"); + } } } @@ -226,7 +245,7 @@ namespace Cantera { SpeciesThermoInterpType *sp = m_sp[index]; return sp->reportType(); } - + /** * This utility function reports back the type of * parameterization and all of the parameters for the diff --git a/Cantera/src/thermo/PureFluidPhase.h b/Cantera/src/thermo/PureFluidPhase.h index c7d05a69f..73723f444 100644 --- a/Cantera/src/thermo/PureFluidPhase.h +++ b/Cantera/src/thermo/PureFluidPhase.h @@ -106,7 +106,7 @@ namespace Cantera { /// Molar Gibbs function. Units: J/kmol. virtual doublereal gibbs_mole() const; - /// Molar heat capacity at constant pressure. Units: J/kmol/K. + /// Molar heat capacity at constant pressure. Units: J/kmol/K. virtual doublereal cp_mole() const; /// Molar heat capacity at constant volume. Units: J/kmol/K. diff --git a/Cantera/src/thermo/SimpleThermo.h b/Cantera/src/thermo/SimpleThermo.h index 8c22966cc..98ae35269 100644 --- a/Cantera/src/thermo/SimpleThermo.h +++ b/Cantera/src/thermo/SimpleThermo.h @@ -153,7 +153,7 @@ namespace Cantera { virtual void install(string name, int index, int type, const doublereal* c, doublereal minTemp, doublereal maxTemp, doublereal refPressure) { - //writelog("installing const_cp for species "+name+"\n"); + writelog("installing const_cp for species "+name+"\n"); m_logt0.push_back(log(c[0])); m_t0.push_back(c[0]); m_h0_R.push_back(c[1]/GasConstant); diff --git a/Cantera/src/thermo/SpeciesThermoFactory.cpp b/Cantera/src/thermo/SpeciesThermoFactory.cpp index 10aba9a57..3a4bd2d3d 100755 --- a/Cantera/src/thermo/SpeciesThermoFactory.cpp +++ b/Cantera/src/thermo/SpeciesThermoFactory.cpp @@ -26,6 +26,8 @@ using namespace std; #include "Nasa9PolyMultiTempRegion.h" #include "Nasa9Poly1.h" +#include "AdsorbateThermo.h" + #include "SpeciesThermoMgr.h" #include "speciesThermoTypes.h" @@ -48,14 +50,14 @@ namespace Cantera { * Examine the types of species thermo parameterizations, * and return a flag indicating the type of parameterization * needed by the species. - * + * * @param spData_node Species Data XML node. This node contains a list * of species XML nodes underneath it. * * @todo Make sure that spDadta_node is species Data XML node by checking its name is speciesData */ static void getSpeciesThermoTypes(XML_Node* spData_node, - int& has_nasa, int& has_shomate, int& has_simple, + int& has_nasa, int& has_shomate, int& has_simple, int &has_other) { const XML_Node& sparray = *spData_node; std::vector sp; @@ -78,6 +80,7 @@ namespace Cantera { if (th.hasChild("Mu0")) has_other = 1; if (th.hasChild("NASA9")) has_other = 1; if (th.hasChild("NASA9MULTITEMP")) has_other = 1; + if (th.hasChild("adsorbate")) has_other = 1; } else { throw UnknownSpeciesThermoModel("getSpeciesThermoTypes:", spNode->attrib("name"), "missing"); @@ -485,6 +488,40 @@ namespace Cantera { } } + + /** + * Install an Adsorbatge thermodynamic property + * parameterization for species k into a SpeciesThermo instance. + * This is called by method installThermoForSpecies if a NASA9 + * block is found in the XML input. + */ + static void installAdsorbateThermoFromXML(std::string speciesName, + SpeciesThermo& sp, int k, + const XML_Node& f) { + vector_fp freqs; + doublereal tmin, tmax, pref; + int nfreq = 0; + tmin = fpValue(f["Tmin"]); + tmax = fpValue(f["Tmax"]); + pref = fpValue(f["P0"]); + if (tmax == 0.0) tmax = 1.0e30; + + if (f.hasChild("floatArray")) { + getFloatArray(f.child("floatArray"), freqs, false); + nfreq = freqs.size(); + } + for (int n = 0; n < nfreq; n++) { + freqs[n] *= 3.0e10; + } + vector_fp coeffs(nfreq + 2); + coeffs[0] = nfreq; + coeffs[1] = getFloat(f, "binding_energy", "-"); + copy(freqs.begin(), freqs.end(), coeffs.begin() + 2); + //posc = new Adsorbate(k, tmin, tmax, pref, + // DATA_PTR(coeffs)); + (&sp)->install(speciesName, k, ADSORBATE, &coeffs[0], tmin, tmax, pref); + } + /** * Install a species thermodynamic property parameterization * for one species into a species thermo manager. @@ -506,6 +543,8 @@ namespace Cantera { const XML_Node& thermo = s.child("thermo"); const std::vector& tp = thermo.children(); int nc = static_cast(tp.size()); + + if (nc == 1) { const XML_Node* f = tp[0]; if (f->name() == "Shomate") { @@ -522,7 +561,10 @@ namespace Cantera { } else if (f->name() == "NASA9") { installNasa9ThermoFromXML(s["name"], spthermo, k, tp); - } + } + else if (f->name() == "adsorbate") { + installAdsorbateThermoFromXML(s["name"], spthermo, k, *f); + } else { throw UnknownSpeciesThermoModel("installThermoForSpecies", s["name"], f->name()); diff --git a/Cantera/src/thermo/SpeciesThermoInterpType.h b/Cantera/src/thermo/SpeciesThermoInterpType.h index a670cd113..035b4fd49 100644 --- a/Cantera/src/thermo/SpeciesThermoInterpType.h +++ b/Cantera/src/thermo/SpeciesThermoInterpType.h @@ -76,7 +76,8 @@ namespace Cantera { //! Returns an integer representing the species index virtual int speciesIndex() const = 0; - //! Update the properties for this species, given a temperature polynomial + //! Update the properties for this species, given a temperature + //! polynomial /*! * This method is called with a pointer to an array containing the functions of * temperature needed by this parameterization, and three pointers to arrays where the @@ -96,7 +97,10 @@ namespace Cantera { */ virtual void updateProperties(const doublereal* tempPoly, doublereal* cp_R, doublereal* h_RT, - doublereal* s_R) const = 0; + doublereal* s_R) const { + double T = tempPoly[0]; + updatePropertiesTemp(T, cp_R, h_RT, s_R); + } //! Compute the reference-state property of one species /*! diff --git a/Cantera/src/thermo/ThermoFactory.cpp b/Cantera/src/thermo/ThermoFactory.cpp index c0d08661e..b0c6a1a8b 100644 --- a/Cantera/src/thermo/ThermoFactory.cpp +++ b/Cantera/src/thermo/ThermoFactory.cpp @@ -37,6 +37,10 @@ #include "MetalPhase.h" #endif +#ifdef WITH_SEMICONDUCTOR +#include "SemiconductorPhase.h" +#endif + #undef USE_SSTP #ifdef WITH_STOICH_SUBSTANCE #ifdef USE_SSTP diff --git a/Cantera/src/thermo/mix_defs.h b/Cantera/src/thermo/mix_defs.h index 72c6cb8fc..4c9d020ea 100755 --- a/Cantera/src/thermo/mix_defs.h +++ b/Cantera/src/thermo/mix_defs.h @@ -14,6 +14,7 @@ namespace Cantera { const int cNASA = 1; const int cShomate = 2; const int cNASA96 = 3; + const int cHarmonicOsc = 4; /** * Equation of state types: diff --git a/Cantera/src/thermo/speciesThermoTypes.h b/Cantera/src/thermo/speciesThermoTypes.h index b88fda8ae..7efceb267 100755 --- a/Cantera/src/thermo/speciesThermoTypes.h +++ b/Cantera/src/thermo/speciesThermoTypes.h @@ -65,6 +65,8 @@ //! This is implemented in the class Nasa9PolyMultiTempRegion in Nasa9Poly1MultiTempRegion #define NASA9MULTITEMP 513 +#define ADSORBATE 1024 + #include "ct_defs.h" #include "stringUtils.h" diff --git a/Cantera/src/transport/Makefile.in b/Cantera/src/transport/Makefile.in index 4ebcd6155..90f068700 100644 --- a/Cantera/src/transport/Makefile.in +++ b/Cantera/src/transport/Makefile.in @@ -21,10 +21,11 @@ CXX_FLAGS = @CXXFLAGS@ $(CXX_OPT) $(PIC_FLAG) # Transport Object Files OBJS = TransportFactory.o MultiTransport.o MixTransport.o MMCollisionInt.o \ - SolidTransport.o DustyGasTransport.o + SolidTransport.o DustyGasTransport.o LineBroadener.o TRAN_H = TransportFactory.h MultiTransport.h MixTransport.h \ MMCollisionInt.h SolidTransport.h DustyGasTransport.h \ - TransportBase.h L_matrix.h TransportParams.h + TransportBase.h L_matrix.h TransportParams.h \ + AbsorptionLine.h LineBroadener.h CXX_INCLUDES = -I../base -I../thermo -I../numerics @CXX_INCLUDES@ LIB = @buildlib@/libtransport.a diff --git a/Cantera/src/transport/TransportBase.h b/Cantera/src/transport/TransportBase.h index ec5f1796b..c3252d698 100755 --- a/Cantera/src/transport/TransportBase.h +++ b/Cantera/src/transport/TransportBase.h @@ -35,6 +35,7 @@ namespace Cantera { const int cUserTransport = 500; const int cFtnTransport = 600; const int cLiquidTransport = 700; + const int cRadiativeTransport = 800; // forward reference class XML_Writer; @@ -60,9 +61,9 @@ namespace Cantera { virtual int model() {return 0;} /** - * Phase object. Every transport manager is designed to - * compute properties for a specific phase of a mixture, which - * might be a liquid solution, a gas mixture, etc. This method + * Phase object. Every transport manager is designed to compute + * properties for a specific phase of a mixture, which might be a + * liquid solution, a gas mixture, a surface, etc. This method * returns a reference to the object representing the phase * itself. */ diff --git a/Cantera/src/transport/TransportFactory.cpp b/Cantera/src/transport/TransportFactory.cpp index 6652eeea6..cf7259528 100755 --- a/Cantera/src/transport/TransportFactory.cpp +++ b/Cantera/src/transport/TransportFactory.cpp @@ -254,6 +254,8 @@ namespace Cantera { m_models["CK_Mix"] = CK_MixtureAveraged; m_models["User"] = cUserTransport; m_models["None"] = None; + //m_models["Radiative"] = cRadiative; + } /** diff --git a/configure b/configure index b8a3df89f..02ec15eb5 100755 --- a/configure +++ b/configure @@ -2514,6 +2514,13 @@ _ACEOF hdrs=$hdrs' SemiconductorPhase.h' objs=$objs' SemiconductorPhase.o' fi +if test "$WITH_ADSORBATE" = "y"; then + cat >>confdefs.h <<\_ACEOF +#define WITH_ADSORBATE 1 +_ACEOF + + hdrs=$hdrs' AdsorbateThermo.h' +fi if test "$WITH_STOICH_SUBSTANCE" = "y"; then cat >>confdefs.h <<\_ACEOF #define WITH_STOICH_SUBSTANCE 1 @@ -2663,6 +2670,16 @@ _ACEOF fi +NEED_SPECTRA=0 +if test "$WITH_SPECTRA" = "y"; then + cat >>confdefs.h <<\_ACEOF +#define WITH_SPECTRA 1 +_ACEOF + + KERNEL=$KERNEL' 'spectra + NEED_SPECTRA=1 +fi + @@ -2887,6 +2904,10 @@ if test -n "$NEED_TPX" then LOCAL_LIBS=$LOCAL_LIBS' '-ltpx fi +if test -n "$NEED_SPECTRA" +then LOCAL_LIBS=$LOCAL_LIBS' '-lctspectra +fi + if test -n "$NEED_F2C" then LOCAL_LIBS=$LOCAL_LIBS' '-lctf2c else @@ -8485,7 +8506,7 @@ fi # Provide some information about the compiler. -echo "$as_me:8488:" \ +echo "$as_me:8509:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 @@ -8688,7 +8709,7 @@ _ACEOF # flags. ac_save_FFLAGS=$FFLAGS FFLAGS="$FFLAGS $ac_verb" -(eval echo $as_me:8691: \"$ac_link\") >&5 +(eval echo $as_me:8712: \"$ac_link\") >&5 ac_f77_v_output=`eval $ac_link 5>&1 2>&1 | grep -v 'Driving:'` echo "$ac_f77_v_output" >&5 FFLAGS=$ac_save_FFLAGS @@ -8766,7 +8787,7 @@ _ACEOF # flags. ac_save_FFLAGS=$FFLAGS FFLAGS="$FFLAGS $ac_cv_prog_f77_v" -(eval echo $as_me:8769: \"$ac_link\") >&5 +(eval echo $as_me:8790: \"$ac_link\") >&5 ac_f77_v_output=`eval $ac_link 5>&1 2>&1 | grep -v 'Driving:'` echo "$ac_f77_v_output" >&5 FFLAGS=$ac_save_FFLAGS @@ -9257,7 +9278,7 @@ fi - ac_config_files="$ac_config_files Makefile Cantera/Makefile Cantera/src/Makefile Cantera/src/base/Makefile Cantera/src/zeroD/Makefile Cantera/src/oneD/Makefile Cantera/src/converters/Makefile Cantera/src/transport/Makefile Cantera/src/thermo/Makefile Cantera/src/kinetics/Makefile Cantera/src/numerics/Makefile Cantera/src/equil/Makefile Cantera/clib/src/Makefile Cantera/fortran/src/Makefile Cantera/fortran/f77demos/f77demos.mak Cantera/fortran/f77demos/isentropic.dsp Cantera/matlab/Makefile Cantera/matlab/setup_matlab.py Cantera/matlab/setup_winmatlab.py Cantera/python/Makefile Cantera/python/setup.py Cantera/cxx/Makefile Cantera/cxx/src/Makefile Cantera/cxx/demos/Makefile Cantera/user/Makefile Cantera/python/src/Makefile ext/lapack/Makefile ext/blas/Makefile ext/cvode/Makefile ext/math/Makefile ext/recipes/Makefile ext/tpx/Makefile ext/Makefile ext/f2c_libs/Makefile ext/f2c_blas/Makefile ext/f2c_lapack/Makefile ext/f2c_math/Makefile examples/Makefile examples/cxx/Makefile tools/Makefile tools/doc/Cantera.cfg tools/doc/Makefile tools/src/Makefile tools/src/sample.mak tools/src/finish_install.py tools/src/package4mac tools/templates/f77/demo.mak tools/templates/f90/demo.mak tools/templates/cxx/demo.mak tools/testtools/Makefile data/inputs/Makefile data/inputs/mkxml test_problems/Makefile test_problems/cxx_ex/Makefile test_problems/silane_equil/Makefile test_problems/surfkin/Makefile test_problems/surfSolverTest/Makefile test_problems/diamondSurf/Makefile test_problems/diamondSurf_dupl/Makefile test_problems/ChemEquil_gri_matrix/Makefile test_problems/ChemEquil_gri_pairs/Makefile test_problems/ChemEquil_ionizedGas/Makefile test_problems/ChemEquil_red1/Makefile test_problems/CpJump/Makefile test_problems/mixGasTransport/Makefile test_problems/multiGasTransport/Makefile test_problems/fracCoeff/Makefile test_problems/negATest/Makefile test_problems/NASA9poly_test/Makefile test_problems/ck2cti_test/Makefile test_problems/ck2cti_test/runtest test_problems/nasa9_reader/Makefile test_problems/nasa9_reader/runtest test_problems/min_python/Makefile test_problems/min_python/minDiamond/Makefile test_problems/min_python/negATest/Makefile test_problems/pureFluidTest/Makefile test_problems/python/Makefile test_problems/cathermo/Makefile test_problems/cathermo/issp/Makefile test_problems/cathermo/ims/Makefile test_problems/cathermo/stoichSubSSTP/Makefile test_problems/cathermo/testIAPWS/Makefile test_problems/cathermo/testIAPWSPres/Makefile test_problems/cathermo/testIAPWSTripP/Makefile test_problems/cathermo/testWaterPDSS/Makefile test_problems/cathermo/testWaterTP/Makefile test_problems/cathermo/HMW_test_1/Makefile test_problems/cathermo/HMW_test_3/Makefile test_problems/cathermo/HMW_graph_GvT/Makefile test_problems/cathermo/HMW_graph_GvI/Makefile test_problems/cathermo/HMW_graph_HvT/Makefile test_problems/cathermo/HMW_graph_CpvT/Makefile test_problems/cathermo/HMW_graph_VvT/Makefile test_problems/cathermo/DH_graph_1/Makefile test_problems/cathermo/DH_graph_acommon/Makefile test_problems/cathermo/DH_graph_NM/Makefile test_problems/cathermo/DH_graph_Pitzer/Makefile test_problems/cathermo/DH_graph_bdotak/Makefile test_problems/cathermo/HMW_dupl_test/Makefile bin/install_tsc" + ac_config_files="$ac_config_files Makefile Cantera/Makefile Cantera/src/Makefile Cantera/src/base/Makefile Cantera/src/zeroD/Makefile Cantera/src/oneD/Makefile Cantera/src/converters/Makefile Cantera/src/transport/Makefile Cantera/src/thermo/Makefile Cantera/src/kinetics/Makefile Cantera/src/numerics/Makefile Cantera/src/spectra/Makefile Cantera/src/equil/Makefile Cantera/clib/src/Makefile Cantera/fortran/src/Makefile Cantera/fortran/f77demos/f77demos.mak Cantera/fortran/f77demos/isentropic.dsp Cantera/matlab/Makefile Cantera/matlab/setup_matlab.py Cantera/matlab/setup_winmatlab.py Cantera/python/Makefile Cantera/python/setup.py Cantera/cxx/Makefile Cantera/cxx/src/Makefile Cantera/cxx/demos/Makefile Cantera/user/Makefile Cantera/python/src/Makefile ext/lapack/Makefile ext/blas/Makefile ext/cvode/Makefile ext/math/Makefile ext/recipes/Makefile ext/tpx/Makefile ext/Makefile ext/f2c_libs/Makefile ext/f2c_blas/Makefile ext/f2c_lapack/Makefile ext/f2c_math/Makefile examples/Makefile examples/cxx/Makefile tools/Makefile tools/doc/Cantera.cfg tools/doc/Makefile tools/src/Makefile tools/src/sample.mak tools/src/finish_install.py tools/src/package4mac tools/templates/f77/demo.mak tools/templates/f90/demo.mak tools/templates/cxx/demo.mak tools/testtools/Makefile data/inputs/Makefile data/inputs/mkxml test_problems/Makefile test_problems/cxx_ex/Makefile test_problems/silane_equil/Makefile test_problems/surfkin/Makefile test_problems/spectroscopy/Makefile test_problems/surfSolverTest/Makefile test_problems/diamondSurf/Makefile test_problems/diamondSurf_dupl/Makefile test_problems/ChemEquil_gri_matrix/Makefile test_problems/ChemEquil_gri_pairs/Makefile test_problems/ChemEquil_ionizedGas/Makefile test_problems/ChemEquil_red1/Makefile test_problems/CpJump/Makefile test_problems/mixGasTransport/Makefile test_problems/multiGasTransport/Makefile test_problems/fracCoeff/Makefile test_problems/negATest/Makefile test_problems/NASA9poly_test/Makefile test_problems/ck2cti_test/Makefile test_problems/ck2cti_test/runtest test_problems/nasa9_reader/Makefile test_problems/nasa9_reader/runtest test_problems/min_python/Makefile test_problems/min_python/minDiamond/Makefile test_problems/min_python/negATest/Makefile test_problems/pureFluidTest/Makefile test_problems/python/Makefile test_problems/cathermo/Makefile test_problems/cathermo/issp/Makefile test_problems/cathermo/ims/Makefile test_problems/cathermo/stoichSubSSTP/Makefile test_problems/cathermo/testIAPWS/Makefile test_problems/cathermo/testIAPWSPres/Makefile test_problems/cathermo/testIAPWSTripP/Makefile test_problems/cathermo/testWaterPDSS/Makefile test_problems/cathermo/testWaterTP/Makefile test_problems/cathermo/HMW_test_1/Makefile test_problems/cathermo/HMW_test_3/Makefile test_problems/cathermo/HMW_graph_GvT/Makefile test_problems/cathermo/HMW_graph_GvI/Makefile test_problems/cathermo/HMW_graph_HvT/Makefile test_problems/cathermo/HMW_graph_CpvT/Makefile test_problems/cathermo/HMW_graph_VvT/Makefile test_problems/cathermo/DH_graph_1/Makefile test_problems/cathermo/DH_graph_acommon/Makefile test_problems/cathermo/DH_graph_NM/Makefile test_problems/cathermo/DH_graph_Pitzer/Makefile test_problems/cathermo/DH_graph_bdotak/Makefile test_problems/cathermo/HMW_dupl_test/Makefile bin/install_tsc" test "x$prefix" = xNONE && prefix=$ac_default_prefix @@ -9741,6 +9762,7 @@ do "Cantera/src/thermo/Makefile" ) CONFIG_FILES="$CONFIG_FILES Cantera/src/thermo/Makefile" ;; "Cantera/src/kinetics/Makefile" ) CONFIG_FILES="$CONFIG_FILES Cantera/src/kinetics/Makefile" ;; "Cantera/src/numerics/Makefile" ) CONFIG_FILES="$CONFIG_FILES Cantera/src/numerics/Makefile" ;; + "Cantera/src/spectra/Makefile" ) CONFIG_FILES="$CONFIG_FILES Cantera/src/spectra/Makefile" ;; "Cantera/src/equil/Makefile" ) CONFIG_FILES="$CONFIG_FILES Cantera/src/equil/Makefile" ;; "Cantera/clib/src/Makefile" ) CONFIG_FILES="$CONFIG_FILES Cantera/clib/src/Makefile" ;; "Cantera/fortran/src/Makefile" ) CONFIG_FILES="$CONFIG_FILES Cantera/fortran/src/Makefile" ;; @@ -9786,6 +9808,7 @@ do "test_problems/cxx_ex/Makefile" ) CONFIG_FILES="$CONFIG_FILES test_problems/cxx_ex/Makefile" ;; "test_problems/silane_equil/Makefile" ) CONFIG_FILES="$CONFIG_FILES test_problems/silane_equil/Makefile" ;; "test_problems/surfkin/Makefile" ) CONFIG_FILES="$CONFIG_FILES test_problems/surfkin/Makefile" ;; + "test_problems/spectroscopy/Makefile" ) CONFIG_FILES="$CONFIG_FILES test_problems/spectroscopy/Makefile" ;; "test_problems/surfSolverTest/Makefile" ) CONFIG_FILES="$CONFIG_FILES test_problems/surfSolverTest/Makefile" ;; "test_problems/diamondSurf/Makefile" ) CONFIG_FILES="$CONFIG_FILES test_problems/diamondSurf/Makefile" ;; "test_problems/diamondSurf_dupl/Makefile" ) CONFIG_FILES="$CONFIG_FILES test_problems/diamondSurf_dupl/Makefile" ;; diff --git a/configure.in b/configure.in index a3092dcde..c32210acd 100755 --- a/configure.in +++ b/configure.in @@ -436,6 +436,10 @@ if test "$WITH_SEMICONDUCTOR" = "y"; then hdrs=$hdrs' SemiconductorPhase.h' objs=$objs' SemiconductorPhase.o' fi +if test "$WITH_ADSORBATE" = "y"; then + AC_DEFINE(WITH_ADSORBATE) + hdrs=$hdrs' AdsorbateThermo.h' +fi if test "$WITH_STOICH_SUBSTANCE" = "y"; then AC_DEFINE(WITH_STOICH_SUBSTANCE) hdrs=$hdrs' StoichSubstance.h' @@ -555,6 +559,13 @@ if test "$ENABLE_TPX" = "y" ; then AC_DEFINE(INCL_PURE_FLUIDS) fi +NEED_SPECTRA=0 +if test "$WITH_SPECTRA" = "y"; then + AC_DEFINE(WITH_SPECTRA) + KERNEL=$KERNEL' 'spectra + NEED_SPECTRA=1 +fi + AC_SUBST(KERNEL) AC_SUBST(KERNEL_OBJ) AC_SUBST(BUILD_CK) @@ -773,6 +784,10 @@ if test -n "$NEED_TPX" then LOCAL_LIBS=$LOCAL_LIBS' '-ltpx fi +if test -n "$NEED_SPECTRA" +then LOCAL_LIBS=$LOCAL_LIBS' '-lctspectra +fi + if test -n "$NEED_F2C" then LOCAL_LIBS=$LOCAL_LIBS' '-lctf2c else @@ -1504,6 +1519,7 @@ AC_OUTPUT(Makefile \ Cantera/src/thermo/Makefile \ Cantera/src/kinetics/Makefile \ Cantera/src/numerics/Makefile \ + Cantera/src/spectra/Makefile \ Cantera/src/equil/Makefile \ Cantera/clib/src/Makefile \ Cantera/fortran/src/Makefile \ @@ -1549,6 +1565,7 @@ AC_OUTPUT(Makefile \ test_problems/cxx_ex/Makefile \ test_problems/silane_equil/Makefile \ test_problems/surfkin/Makefile \ + test_problems/spectroscopy/Makefile \ test_problems/surfSolverTest/Makefile \ test_problems/diamondSurf/Makefile \ test_problems/diamondSurf_dupl/Makefile \ diff --git a/data/inputs/air.cti b/data/inputs/air.cti index 96cbf7bdd..8cfaf95c0 100644 --- a/data/inputs/air.cti +++ b/data/inputs/air.cti @@ -13,7 +13,8 @@ ideal_gas(name = "air", reactions = "all", transport = "Mix", initial_state = state(temperature = 300.0, - pressure = OneAtm, mole_fractions = 'O2:0.21, N2:0.78, AR:0.01') ) + pressure = OneAtm, + mole_fractions = 'O2:0.21, N2:0.78, AR:0.01') ) diff --git a/preconfig b/preconfig index 8b6cb1352..5b3711119 100755 --- a/preconfig +++ b/preconfig @@ -188,7 +188,8 @@ WITH_LATTICE_SOLID=${WITH_LATTICE_SOLID:="y"} WITH_METAL=${WITH_METAL:="y"} WITH_STOICH_SUBSTANCE='y' WITH_SEMICONDUCTOR='y' - +WITH_ADSORBATE='y' +WITH_SPECTRA=${WITH_SPECTRA:="y"} # This flag enables the inclusion of accurate liquid/vapor equations # of state for several fluids, including water, nitrogen, hydrogen, @@ -337,7 +338,7 @@ CXX=${CXX:=g++} CC=${CC:=gcc} # C++ compiler flags -CXXFLAGS=${CXXFLAGS:="-O3 -Wall"} +CXXFLAGS=${CXXFLAGS:="-O0 -g -Wall"} # the C++ flags required for linking. Uncomment if additional flags # need to be passed to the linker. @@ -527,6 +528,8 @@ export SUNDIALS_VERSION export WITH_LATTICE_SOLID export WITH_METAL export WITH_SEMICONDUCTOR +export WITH_ADSORBATE +export WITH_SPECTRA export WITH_STOICH_SUBSTANCE export WITH_PURE_FLUIDS export WITH_IDEAL_SOLUTIONS