diff --git a/Cantera/cxx/include/equilibrium.h b/Cantera/cxx/include/equilibrium.h index efe63d9dd..edf6a1d4f 100755 --- a/Cantera/cxx/include/equilibrium.h +++ b/Cantera/cxx/include/equilibrium.h @@ -4,6 +4,7 @@ #ifndef CT_EQUIL_INCL #define CT_EQUIL_INCL #include "kernel/ChemEquil.h" +#include "kernel/MultiPhaseEquil.h" #endif diff --git a/Cantera/fortran/src/Makefile.in b/Cantera/fortran/src/Makefile.in index d39f1452c..36e7f0617 100644 --- a/Cantera/fortran/src/Makefile.in +++ b/Cantera/fortran/src/Makefile.in @@ -12,7 +12,7 @@ .SUFFIXES : .cpp .d .o .f90 .mod CXX_FLAGS = @CXXFLAGS@ $(CXX_OPT) -FORT_FLAGS = @F90FLAGS@ +FORT_FLAGS = @F90BUILDFLAGS@ CXX_OBJS = fct.o fctxml.o @@ -77,7 +77,7 @@ FTLIB = @buildlib@/$(LIB_NAME) $(FTLIB): $(MODFILES) $(USER_MODULE_OBJS) $(CXX_OBJS) $(LIB_DEPS) $(RM) $(FTLIB) - @ARCHIVE@ $(FTLIB) $(OBJS) + @ARCHIVE@ $(FTLIB) $(OBJS) clean: $(RM) $(OBJS) $(FTLIB) $(MODFILES) diff --git a/Cantera/python/ctml_writer.py b/Cantera/python/ctml_writer.py index 0ccf68d1e..ca5edb2d7 100644 --- a/Cantera/python/ctml_writer.py +++ b/Cantera/python/ctml_writer.py @@ -1479,6 +1479,15 @@ class Lindemann: #get_atomic_wts() validate() +if __name__ == "__main__": + import sys, os + file = sys.argv[1] + base = os.path.basename(file) + root, ext = os.path.splitext(base) + dataset(root) + execfile(file) + write() + ########################################## # @@ -1486,7 +1495,10 @@ validate() # $Revision$ # $Date$ # $Log$ -# Revision 1.6 2004-09-29 11:00:39 dggoodwin +# Revision 1.7 2004-11-15 02:33:21 dggoodwin +# changed f90 mod file handling in Makefiles +# +# Revision 1.6 2004/09/29 11:00:39 dggoodwin # *** empty log message *** # # Revision 1.5 2004/09/20 10:25:02 dggoodwin diff --git a/Cantera/src/ChemEquil.cpp b/Cantera/src/ChemEquil.cpp index 20abe2140..eeb0b3eb2 100755 --- a/Cantera/src/ChemEquil.cpp +++ b/Cantera/src/ChemEquil.cpp @@ -100,20 +100,35 @@ namespace Cantera { for (m = 0; m < m_mm; m++) { for (k = 0; k < m_kk; k++) { na = m_phase->nAtoms(k,m); + + // handle the case of negative atom numbers (used to + // represent positive ions) if (na < 0.0) { + + // if negative atom numbers have already been specified + // for some element other than this one, throw + // an exception if (mneg >= 0 && mneg != m) throw CanteraError("ChemEquil::initialize", "negative atom numbers allowed for only one element"); mneg = m; ewt = m_phase->atomicWeight(m); + + // the element should be an electron... if it isn't + // print a warning. if (ewt > 1.0e-3) - writelog(string("WARNING: species "+m_phase->speciesName(k) - +" has "+fp2str(m_phase->nAtoms(k,m))+" atoms of element " - +m_phase->elementName(m)+", but this element is not an electron.\n")); + writelog(string("WARNING: species " + +m_phase->speciesName(k) + +" has "+fp2str(m_phase->nAtoms(k,m)) + +" atoms of element " + +m_phase->elementName(m)+ + ", but this element is not an electron.\n")); } } } m_eloc = mneg; + + // set up the elemental composition matrix for (k = 0; k < m_kk; k++) { for (m = 0; m < m_mm; m++) { m_comp[k*m_mm + m] = m_phase->nAtoms(k,m); @@ -134,6 +149,7 @@ namespace Cantera { void ChemEquil::setToEquilState(thermo_t& s, const vector_fp& lambda_RT, doublereal t) { + // compute the chemical potentials by summing element potentials fill(m_mu_RT.begin(), m_mu_RT.end(), 0.0); for (int k = 0; k < m_kk; k++) for (int m = 0; m < m_mm; m++) @@ -141,6 +157,10 @@ namespace Cantera { // set the temperature s.setTemperature(t); + + // call the phase-specific method to set the phase to the + // equilibrium state with the specified species chemical + // potentials. s.setToEquilState(m_mu_RT.begin()); update(s); } @@ -148,13 +168,16 @@ namespace Cantera { /** * update internally stored state information. + * @todo argument not used. */ void ChemEquil::update(const thermo_t& s) { + + // get the mole fractions, temperature, and density m_phase->getMoleFractions(m_molefractions.begin()); m_temp = m_phase->temperature(); m_dens = m_phase->density(); - // elemental mole fractions + // compute the elemental mole fractions doublereal sum = 0.0; int m, k; for (m = 0; m < m_mm; m++) { @@ -198,16 +221,11 @@ namespace Cantera { // first column contains fixed element moles for (m = 0; m < mm; m++) { - aa(m+1,0) = elementMoles[m]; - //if (elementMoles[m] < 0.0) { - // throw CanteraError("setInitialMoles", - // "negative element moles for " - // +m_phase->elementName(m)+": "+fp2str(elementMoles[m])); - // } + aa(m+1,0) = elementMoles[m] + 0.01; } - - // get the array of non-dimensional Gibbs functions + // get the array of non-dimensional Gibbs functions for the pure + // species s.getGibbs_RT(m_grt.begin()); int kpp = 0; @@ -258,8 +276,11 @@ namespace Cantera { { int k, ksp, m, n; for (k = 0; k < m_kk; k++) { - if (m_molefractions[k] > 0.0) + if (m_molefractions[k] > 0.0) { m_molefractions[k] = fmaxx(m_molefractions[k], 0.05); + } + //else + // m_molefractions[k] = 0.001; } s.setState_PX(s.pressure(), m_molefractions.begin()); @@ -293,33 +314,44 @@ namespace Cantera { if (j == m_mm) break; } } - if (j < m_mm) - // return -1; - throw CanteraError("estimateElementPotentials", - "too few species (" + int2str(j) + ")."); + //if (j < m_mm) + // return -1; + //throw CanteraError("estimateElementPotentials", + // "too few species (" + int2str(j) + ")."); + + for (m = 0; m < j; m++) { - for (m = 0; m < m_mm; m++) { for (n = 0; n < m_mm; n++) { aa(m,n) = nAtoms(kc[m], n); } b[m] = mu_RT[kc[m]]; } + for (m = j+1; m < m_mm; m++) { + aa(m,m) = 1.0; + b[m] = lambda[m]; + } int info; try { info = solve(aa, b.begin()); } catch (CanteraError) { - return -2; //throw CanteraError("estimateElementPotentials","singular matrix."); + return -2; } if (info == 0) { - for (m = 0; m < m_mm; m++) + for (m = 0; m < m_mm; m++) { lambda[m] = b[m]; + } } return info; } + + /** + * Equilibrate a phase, holding the elemental composition fixed + * at the initial vaollue. + */ int ChemEquil::equilibrate(thermo_t& s, int XY) { vector_fp emol(s.nElements()); initialize(s); @@ -343,6 +375,7 @@ namespace Cantera { delete m_p2; bool tempFixed = true; initialize(s); + update(s); switch (XY) { case TP: case PT: m_p1 = new TemperatureCalculator; @@ -367,9 +400,11 @@ namespace Cantera { m_p1 = new IntEnergyCalculator; m_p2 = new DensityCalculator; break; default: - throw CanteraError("equilibrate","illegal property pair."); // IllegalPropertyPair(XY); + throw CanteraError("equilibrate","illegal property pair."); } + // If the temperature is one of the specified variables, and + // it is outside the valid range, throw an exception. if (tempFixed) { double tfixed = s.temperature(); if (tfixed > s.maxTemp() + 1.0 || tfixed < s.minTemp() - 1.0) { @@ -387,19 +422,25 @@ namespace Cantera { int nvar = mm + 1; DenseMatrix jac(nvar, nvar); // jacobian - vector_fp x(nvar, -100.0); // solution vector + vector_fp x(nvar, -102.0); // solution vector vector_fp res_trial(nvar); vector_fp elementMol(mm, 0.0); double perturb; for (m = 0; m < mm; m++) { if (m_skip < 0 && elMoles[m] > 0.0 ) m_skip = m; +#define PERTURB_ELEMENT_MOLES +#ifdef PERTURB_ELEMENT_MOLES perturb = Cutoff*(1.0 + rand()); +#else + perturb = 0.0; +#endif elementMol[m] = elMoles[m] + perturb; } update(s); + // loop to estimate T if (!tempFixed) { @@ -460,11 +501,15 @@ namespace Cantera { } } - - setInitialMoles(s, elementMol); - - for (int ii = 0; ii < m_mm; ii++) x[ii] = -100.0; - estimateElementPotentials(s, x); + if (m_lambda[0] == -100.0) { + setInitialMoles(s, elementMol); + for (int ii = 0; ii < m_mm; ii++) x[ii] = -101.0; + estimateElementPotentials(s, x); + } + else { + doublereal rt = GasConstant * m_phase->temperature(); + for (int ii = 0; ii < m_mm; ii++) x[ii] = m_lambda[ii]/rt; + } x[m_mm] = log(m_phase->temperature()); @@ -472,7 +517,7 @@ namespace Cantera { vector_fp below(nvar); for (m = 0; m < mm; m++) { - above[m] = 200.0; + above[m] = 30.0; below[m] = -2000.0; if (elMoles[m] < Cutoff && m != m_eloc) x[m] = -1000.0; //if (m == m_eloc) x[m] = -10.0; @@ -489,20 +534,33 @@ namespace Cantera { int iter = 0; int info=0; doublereal fctr = 1.0, newval; - + + goto converge; + next: + + // if the problem involves charged species, then the + // "electron" element equation is a charge balance. Compute + // the sum of the absolute values of the charge to use as the + // normalizing factor. if (m_eloc >= 0) { m_abscharge = 0.0; int k; - for (k = 0; k < m_kk; k++) m_abscharge += fabs(m_phase->charge(k)*m_molefractions[k]); + for (k = 0; k < m_kk; k++) + m_abscharge += fabs(m_phase->charge(k)*m_molefractions[k]); } + iter++; + + // compute the residual and the jacobian using the current + // solution vector equilResidual(s, x, elMoles, res_trial, XY, xval, yval); f = 0.5*dot(res_trial.begin(), res_trial.end(), res_trial.begin()); equilJacobian(s, x, elMoles, jac, XY, xval, yval); + // compute grad f = F*J jac.leftMult(res_trial.begin(), grad.begin()); copy(x.begin(), x.end(), oldx.begin()); copy(oldx.begin(), oldx.end(), prevx.begin()); @@ -512,6 +570,13 @@ namespace Cantera { info = solve(jac, res_trial.begin()); } catch (CanteraError) { + cout << x << endl; + //cout << res_trial << endl; + //cout << grad << endl; + cout << elMoles << endl; + //cout << jac << endl; + + //cout << "m_skip = " << m_skip << endl; throw CanteraError("equilibrate", "Jacobian is singular. \nTry adding more species, " "changing the elemental composition slightly, \nor removing " @@ -519,18 +584,21 @@ namespace Cantera { return -3; } + // find the factor by which the Newton step can be multiplied + // to keep the solution within bounds. fctr = 1.0; for (m = 0; m < nvar; m++) { newval = x[m] + res_trial[m]; if (newval > above[m]) { fctr = fmaxx( 0.0, fminn( fctr, - 0.8*(above[m] - x[m])/(newval - x[m]))); + 0.4*(above[m] - x[m])/(newval - x[m]))); } else if (newval < below[m]) { - fctr = fminn(fctr, 0.8*(x[m] - below[m])/(x[m] - newval)); + fctr = fminn(fctr, 0.4*(x[m] - below[m])/(x[m] - newval)); } } + // multiply the step by the scaing factor scale(res_trial.begin(), res_trial.end(), res_trial.begin(), fctr); if (!dampStep(s, oldx, oldf, grad, res_trial, @@ -544,7 +612,8 @@ namespace Cantera { } } else fail = 0; - + +converge: // check for convergence. @@ -573,8 +642,8 @@ namespace Cantera { +fp2str(m_thermo->temperature())+" K) outside " "valid range of "+fp2str(m_thermo->minTemp())+" K to " +fp2str(m_thermo->maxTemp())+" K\n"); - } - + } + return 0; } @@ -611,7 +680,7 @@ namespace Cantera { double minDamp = 0.0; double xTol = 1.e-7; - vector_fp res_new(nvar); // fix + static vector_fp res_new(nvar); // fix //slope = grad * step; slope = dot(grad.begin(), grad.end(), step.begin()); @@ -698,6 +767,7 @@ namespace Cantera { if (elmtotal[n] < Cutoff && n != m_eloc) resid[n] = x[n] + 1000.0; else + // resid[n] = elmtotal[n] - elm[n]; // log( (1.0 + elmtotal[n]) / (1.0 + elm[n]) ); resid[n] = log( (1.0 + elmtotal[n]) / (1.0 + elm[n]) ); } if (m_eloc >= 0) { diff --git a/Cantera/src/ChemEquil.h b/Cantera/src/ChemEquil.h index 737cf6164..d513644cb 100755 --- a/Cantera/src/ChemEquil.h +++ b/Cantera/src/ChemEquil.h @@ -154,6 +154,7 @@ namespace Cantera { inline void equilibrate(thermo_t& s, int XY) { ChemEquil e; e.equilibrate(s,XY); + s.setElementPotentials(e.elementPotentials()); } /** diff --git a/Cantera/src/ct_defs.h b/Cantera/src/ct_defs.h index 239322bdd..d75dbc455 100755 --- a/Cantera/src/ct_defs.h +++ b/Cantera/src/ct_defs.h @@ -140,6 +140,10 @@ namespace Cantera { return inner_product(u.begin(), u.end(), v.begin(), 0.0); } + // inline ostream& operator<<(ostream& s, const vector_fp& v) { + // return ct::operator<<(s, v); + //} + // template // inline ostream& operator<<(ostream& s, const vector& v) { // int n = v.size(); diff --git a/Cantera/src/ctvector.cpp b/Cantera/src/ctvector.cpp index 0d489d989..12a222286 100755 --- a/Cantera/src/ctvector.cpp +++ b/Cantera/src/ctvector.cpp @@ -13,32 +13,33 @@ #include using namespace std; #include "ctvector.h" -using namespace ct; - - ostream& operator<<(ostream& s, const ctvector_int& v) { - int n = v.size(); - s << "<"; - for (int i = 0; i < n; i++) { - s << v[i]; - if (i < n-1) s << ", "; - } - s << ">"; - return s; - } - - ostream& operator<<(ostream& s, const ctvector_fp& v) { - int n = v.size(); - s << "<"; - for (int i = 0; i < n; i++) { - s << v[i]; - if (i < n-1) s << ", "; - } - s << ">"; - return s; - } +//using namespace ct; namespace ct { + +std::ostream& operator<<(std::ostream& s, const ctvector_int& v) { + int n = v.size(); + s << "<"; + for (int i = 0; i < n; i++) { + s << v[i]; + if (i < n-1) s << ", "; + } + s << ">"; + return s; + } + +std::ostream& operator<<(std::ostream& s, const ctvector_fp& v) { + int n = v.size(); + s << "<"; + for (int i = 0; i < n; i++) { + s << v[i]; + if (i < n-1) s << ", "; + } + s << ">"; + return s; + } + ctvector_fp::ctvector_fp(size_t n) : _size(0), _alloc(0), _data(0) { resize(n); } diff --git a/Cantera/src/ctvector.h b/Cantera/src/ctvector.h index 96adfaa48..76b416446 100755 --- a/Cantera/src/ctvector.h +++ b/Cantera/src/ctvector.h @@ -153,13 +153,12 @@ namespace ct { private: }; -} std::ostream& operator<<(std::ostream& s, const ct::ctvector_fp& v); -std::ostream& operator<<(std::ostream& s, ct::ctvector_fp& v); + //std::ostream& operator<<(std::ostream& s, ct::ctvector_fp& v); //std::ostream& operator<<(std::ostream& s, const ct::ctvector_float& v); //std::ostream& operator<<(std::ostream& s, ct::ctvector_float& v); std::ostream& operator<<(std::ostream& s, const ct::ctvector_int& v); - +} #endif diff --git a/Makefile.in b/Makefile.in index 3ce75c850..859ca43e0 100755 --- a/Makefile.in +++ b/Makefile.in @@ -69,6 +69,7 @@ endif fortran: ifeq ($(build_f90),1) cd Cantera/fortran/src; @MAKE@ + @INSTALL@ Cantera/fortran/src/*.mod build/include/cantera else @echo skipping building the Fortran 90/95 interface endif @@ -116,7 +117,7 @@ hdr-install: f90-modules-install: ifeq ($(build_f90),1) - cp -f build/include/cantera/*.mod @ct_incroot@/cantera + @INSTALL@ -m 644 build/include/cantera/*.mod @ct_incroot@/cantera endif # collect scattered header files and build the include directory @@ -135,9 +136,7 @@ hdr-collect: @INSTALL@ Cantera/src/zeroD/*.h build/include/cantera/kernel/zeroD @INSTALL@ Cantera/src/converters/*.h build/include/cantera/kernel/converters @INSTALL@ Cantera/src/transport/*.h build/include/cantera/kernel/transport -ifeq ($(build_f90),1) - @INSTALL@ Cantera/fortran/src/*.mod build/include/cantera -endif + particles: ifeq ($(build_particles),1) diff --git a/config/configure b/config/configure index c85466df1..d29391168 100755 --- a/config/configure +++ b/config/configure @@ -271,7 +271,7 @@ PACKAGE_STRING= PACKAGE_BUGREPORT= ac_unique_file="Cantera.README" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CVF_LIBDIR local_inst local_python_inst python_prefix python_win_prefix ctversion homedir ct_libdir ct_incdir ct_incroot ct_bindir ct_datadir ct_demodir ct_templdir ct_mandir ct_tutdir ct_docdir ct_dir COMPACT_INSTALL build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os username ctroot buildinc buildlib buildbin MAKE ARCHIVE DO_RANLIB RANLIB SOEXT SHARED PIC LCXX_FLAGS LCXX_END_LIBS USERDIR INCL_USER_CODE KERNEL BUILD_CK LIB_DIR build_lapack build_blas BLAS_LAPACK_LIBS BLAS_LAPACK_DIR build_with_f2c LOCAL_LIB_DIRS LOCAL_LIBS CANTERA_PARTICLES_DIR BUILD_PARTICLES CT_SHARED_LIB F77FLAGS PYTHON_CMD WIN_PYTHON_CMD BUILD_PYTHON MATLAB_CMD BUILD_MATLAB BUILD_CLIB export_name INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT CC CFLAGS ac_ct_CC F77 FFLAGS ac_ct_F77 FLIBS BUILD_F90 F90 F90FLAGS precompile_headers CXX_DEPENDS OS_IS_DARWIN OS_IS_WIN OS_IS_CYGWIN SHARED_CTLIB mex_ext F77_EXT CXX_EXT OBJ_EXT EXE_EXT local_math_libs math_libs SO LDSHARED LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CVF_LIBDIR USE_CLIB_DLL local_inst local_python_inst python_prefix python_win_prefix ctversion homedir ct_libdir ct_incdir ct_incroot ct_bindir ct_datadir ct_demodir ct_templdir ct_mandir ct_tutdir ct_docdir ct_dir COMPACT_INSTALL build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os username ctroot buildinc buildlib buildbin MAKE ARCHIVE DO_RANLIB RANLIB SOEXT SHARED PIC LCXX_FLAGS LCXX_END_LIBS USERDIR INCL_USER_CODE KERNEL BUILD_CK LIB_DIR build_lapack build_blas BLAS_LAPACK_LIBS BLAS_LAPACK_DIR build_with_f2c LOCAL_LIB_DIRS LOCAL_LIBS CANTERA_PARTICLES_DIR BUILD_PARTICLES CT_SHARED_LIB F77FLAGS PYTHON_CMD WIN_PYTHON_CMD BUILD_PYTHON MATLAB_CMD BUILD_MATLAB BUILD_CLIB export_name INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT CC CFLAGS ac_ct_CC F77 FFLAGS ac_ct_F77 FLIBS BUILD_F90 F90 F90FLAGS F90BUILDFLAGS precompile_headers CXX_DEPENDS OS_IS_DARWIN OS_IS_WIN OS_IS_CYGWIN SHARED_CTLIB mex_ext F77_EXT CXX_EXT OBJ_EXT EXE_EXT local_math_libs math_libs SO LDSHARED LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -1285,6 +1285,18 @@ if test "x${OS_IS_CYGWIN}" = "x1"; then fi +# +# Determine if clib is to be a static or dynamic library +# -> will test to see if USE_DLL is defined in the cygwmin environment +# +USE_CLIB_DLL=0 +if test "x${OS_IS_WIN}" = "x1"; then + if test -n ${USE_CLIB_DLL} ; then + USE_CLIB_DLL=1 + fi +fi + + prdef="/usr/local" if test "x$OS_IS_DARWIN" = "x1"; then prdef="/Applications/Cantera"; fi #AC_PREFIX_DEFAULT([$prdef]) @@ -1415,7 +1427,6 @@ fi - # # Cantera directory structure # @@ -1859,7 +1870,8 @@ fi WIN_PYTHON_CMD=python if test $BUILD_PYTHON -gt 0; then - if test "$PYTHON_CMD" = "default"; then + if test "$PYTHON_CMD" = "default" -o \ + "$PYTHON_CMD"x = "x"; then for ac_prog in python2 python do # Extract the first word of "$ac_prog", so it can be a program name with args. @@ -1905,6 +1917,11 @@ fi done test -n "$PYTHON_CMD" || PYTHON_CMD=""none"" + if test "$PYTHON_CMD" = "none" ; then + echo "ERROR: python requested, but no python executable found!" + else + echo "Python command set to " $PYTHON_CMD + fi if test "x$OS_IS_WIN" = "x1"; then for ac_prog in python do @@ -3465,7 +3482,7 @@ fi # Provide some information about the compiler. -echo "$as_me:3468:" \ +echo "$as_me:3485:" \ "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 @@ -3642,7 +3659,7 @@ _ACEOF # flags. ac_save_FFLAGS=$FFLAGS FFLAGS="$FFLAGS $ac_verb" -(eval echo $as_me:3645: \"$ac_link\") >&5 +(eval echo $as_me:3662: \"$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 @@ -3722,7 +3739,7 @@ _ACEOF # flags. ac_save_FFLAGS=$FFLAGS FFLAGS="$FFLAGS $ac_cv_prog_f77_v" -(eval echo $as_me:3725: \"$ac_link\") >&5 +(eval echo $as_me:3742: \"$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 @@ -3929,14 +3946,16 @@ EOF isnag=`grep -c NAGWare f90out` if test "x${isnag}" != "x0"; then f90type="NAG" - f90opts="-I. -I${ct_incroot}" + f90opts="-I. -I${ct_incdir}" + f90buildopts="-I." fi # msg=`${F90} -V -c testf90.f90 &> f90out` isabsoft=`grep -c Absoft f90out` if test "x${isabsoft}" != "x0"; then f90type="Absoft" - f90opts="-p. -p${ct_incroot} -s -YEXT_NAMES=LCS -YEXT_SFX=_ -YCFRL=1" + f90opts="-p. -p${ct_incdir} -s -YEXT_NAMES=LCS -YEXT_SFX=_ -YCFRL=1" + f90buildopts="-p. -s -YEXT_NAMES=LCS -YEXT_SFX=_ -YCFRL=1" fi rm -f testf90.f90 f90out echo "$as_me:$LINENO: result: ${f90type}" >&5 @@ -3948,7 +3967,10 @@ echo "${ECHO_T}${f90type}" >&6 fi fi fi +savef90flags=${F90FLAGS} F90FLAGS=${f90opts}' '${F90FLAGS} +F90BUILDFLAGS=${f90buildopts}' '${savef90flags} + @@ -4049,7 +4071,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - ac_config_files="$ac_config_files ../Cantera/Makefile ../Cantera/src/Makefile ../Cantera/src/zeroD/Makefile ../Cantera/src/oneD/Makefile ../Cantera/src/converters/Makefile ../Cantera/src/transport/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/tpx/Makefile ../ext/Makefile ../ext/recipes/Makefile ../ext/f2c_libs/Makefile ../ext/f2c_blas/Makefile ../ext/f2c_lapack/Makefile ../ext/f2c_math/Makefile ../ext/f2c_recipes/Makefile ../examples/Makefile ../examples/cxx/Makefile ../Makefile ../tools/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 ../test_problems/Makefile ../test_problems/cxx_ex/Makefile ../test_problems/silane_equil/Makefile ../test_problems/surfkin/Makefile ../test_problems/diamondSurf/Makefile ../test_problems/ck2cti_test/Makefile ../test_problems/ck2cti_test/runtest ../test_problems/python/Makefile" + ac_config_files="$ac_config_files ../Cantera/Makefile ../Cantera/src/Makefile ../Cantera/src/zeroD/Makefile ../Cantera/src/oneD/Makefile ../Cantera/src/converters/Makefile ../Cantera/src/transport/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/tpx/Makefile ../ext/Makefile ../ext/recipes/Makefile ../ext/f2c_libs/Makefile ../ext/f2c_blas/Makefile ../ext/f2c_lapack/Makefile ../ext/f2c_math/Makefile ../ext/f2c_recipes/Makefile ../examples/Makefile ../examples/cxx/Makefile ../Makefile ../tools/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 ../test_problems/Makefile ../test_problems/cxx_ex/Makefile ../test_problems/silane_equil/Makefile ../test_problems/surfkin/Makefile ../test_problems/diamondSurf/Makefile ../test_problems/ck2cti_test/Makefile ../test_problems/ck2cti_test/runtest ../test_problems/python/Makefile ../bin/install_tsc" test "x$prefix" = xNONE && prefix=$ac_default_prefix @@ -4574,6 +4596,7 @@ do "../test_problems/ck2cti_test/Makefile" ) CONFIG_FILES="$CONFIG_FILES ../test_problems/ck2cti_test/Makefile" ;; "../test_problems/ck2cti_test/runtest" ) CONFIG_FILES="$CONFIG_FILES ../test_problems/ck2cti_test/runtest" ;; "../test_problems/python/Makefile" ) CONFIG_FILES="$CONFIG_FILES ../test_problems/python/Makefile" ;; + "../bin/install_tsc" ) CONFIG_FILES="$CONFIG_FILES ../bin/install_tsc" ;; "../config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS ../config.h" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} @@ -4660,6 +4683,7 @@ s,@ECHO_N@,$ECHO_N,;t t s,@ECHO_T@,$ECHO_T,;t t s,@LIBS@,$LIBS,;t t s,@CVF_LIBDIR@,$CVF_LIBDIR,;t t +s,@USE_CLIB_DLL@,$USE_CLIB_DLL,;t t s,@local_inst@,$local_inst,;t t s,@local_python_inst@,$local_python_inst,;t t s,@python_prefix@,$python_prefix,;t t @@ -4747,6 +4771,7 @@ s,@FLIBS@,$FLIBS,;t t s,@BUILD_F90@,$BUILD_F90,;t t s,@F90@,$F90,;t t s,@F90FLAGS@,$F90FLAGS,;t t +s,@F90BUILDFLAGS@,$F90BUILDFLAGS,;t t s,@precompile_headers@,$precompile_headers,;t t s,@CXX_DEPENDS@,$CXX_DEPENDS,;t t s,@OS_IS_DARWIN@,$OS_IS_DARWIN,;t t @@ -5231,6 +5256,10 @@ fi if test -f "../test_problems/ck2cti_test/runtest"; then chmod +x ../test_problems/ck2cti_test/runtest fi +if test -f "../bin/install_tsc"; then + chmod +x ../bin/install_tsc +fi + echo if test "x${OS_IS_WIN}" = "x0"; then diff --git a/config/configure.in b/config/configure.in index e9902aedc..b308831a6 100755 --- a/config/configure.in +++ b/config/configure.in @@ -691,14 +691,16 @@ EOF isnag=`grep -c NAGWare f90out` if test "x${isnag}" != "x0"; then f90type="NAG" - f90opts="-I. -I${ct_incroot}" + f90opts="-I. -I${ct_incdir}" + f90buildopts="-I." fi # msg=`${F90} -V -c testf90.f90 &> f90out` isabsoft=`grep -c Absoft f90out` if test "x${isabsoft}" != "x0"; then f90type="Absoft" - f90opts="-p. -p${ct_incroot} -s -YEXT_NAMES=LCS -YEXT_SFX=_ -YCFRL=1" + f90opts="-p. -p${ct_incdir} -s -YEXT_NAMES=LCS -YEXT_SFX=_ -YCFRL=1" + f90buildopts="-p. -s -YEXT_NAMES=LCS -YEXT_SFX=_ -YCFRL=1" fi rm -f testf90.f90 f90out AC_MSG_RESULT(${f90type}) @@ -709,10 +711,13 @@ EOF fi fi fi +savef90flags=${F90FLAGS} F90FLAGS=${f90opts}' '${F90FLAGS} +F90BUILDFLAGS=${f90buildopts}' '${savef90flags} AC_SUBST(BUILD_F90) AC_SUBST(F90) AC_SUBST(F90FLAGS) +AC_SUBST(F90BUILDFLAGS) diff --git a/configure b/configure index c13bc0096..faf5287c1 100755 --- a/configure +++ b/configure @@ -163,7 +163,6 @@ F90=${F90:=f95} F90FLAGS=${F90FLAGS:='-O2'} - #---------------------------------------------------------------------- # Customizations / Extensions #---------------------------------------------------------------------- diff --git a/ext/tpx/RedlichKwong.cpp b/ext/tpx/RedlichKwong.cpp index 6128d70aa..185f73b95 100644 --- a/ext/tpx/RedlichKwong.cpp +++ b/ext/tpx/RedlichKwong.cpp @@ -10,7 +10,6 @@ namespace tpx { double RedlichKwong::up() { double u = -Pp()/Rho + hresid() + m_energy_offset; - //cout << "up = " << u << endl; return u; } @@ -23,23 +22,19 @@ namespace tpx { double RedlichKwong::sresid(){ double hh = m_b * (Rho/m_mw); - //cout << "hh = " << hh << endl; double sresid_mol_R = log(z()*(1.0 - hh)) - (0.5*m_a/(m_b*8314.3*T*sqrt(T)))*log(1.0 + hh); double sp = 8314.3*sresid_mol_R/m_mw; - //cout << "sresid = " << sp << endl; return sp; } double RedlichKwong::sp() { const double Pref = 101325.0; double rgas = 8314.3/m_mw; - //cout << "P = " << Rho*rgas*T << endl; double ss = rgas*(log(Pref/(Rho*rgas*T))); double sr = sresid(); double p = Pp(); double s = rgas*(log(Pref/p)) + sr + m_entropy_offset; - //cout << "sp = " << s << " " << ss << " " << sr << " " << m_entropy_offset << endl; return s; } @@ -52,9 +47,7 @@ namespace tpx { double R = 8314.3; double V = m_mw/Rho; double pp = R*T/(V - m_b) - m_a/(sqrt(T)*V*(V+m_b)); - //cout << "molar V, T, P = " << V << " " << T << " " << pp << endl; return pp; - //cout << "Rho, T, Pp = " << pp << endl; } double RedlichKwong::Psat(){ @@ -71,15 +64,11 @@ namespace tpx { double pp = Psat(); double Rhsave = Rho; for (i = 0; i < 50; i++) { - //pp = Pp(); c = m_b*m_b + m_b*GasConstant*T/pp - m_a/(pp*sqt); vnew = (1.0/c)*(v*v*v - GasConstant*T*v*v/pp - m_a*m_b/(pp*sqt)); v = vnew; - //Rho = m_mw/v; - //cout << "ldens Rho = " << Rho << " " << z() << " " << Pp() << endl; } Rho = Rhsave; - //cout << "ldens: " << m_mw/vnew << endl; return m_mw/vnew; }