diff --git a/Cantera/src/ThermoPhase.cpp b/Cantera/src/ThermoPhase.cpp index a6a273082..1e523acb0 100644 --- a/Cantera/src/ThermoPhase.cpp +++ b/Cantera/src/ThermoPhase.cpp @@ -198,10 +198,11 @@ namespace Cantera { dt = (u - intEnergy_mass())/cv_mass(); if (dt > 100.0) dt = 100.0; else if (dt < -100.0) dt = -100.0; - setTemperature(temperature() + 0.5*dt); if (fabs(dt) < tol) { + setTemperature(temperature() + dt); return; } + setTemperature(temperature() + 0.5*dt); } throw CanteraError("setState_UV", "no convergence. dt = " + fp2str(dt)+"\n" @@ -217,10 +218,11 @@ namespace Cantera { dt = (s - entropy_mass())*temperature()/cp_mass(); if (dt > 100.0) dt = 100.0; else if (dt < -100.0) dt = -100.0; - setState_TP(temperature() + dt, p); if (fabs(dt) < tol) { + setState_TP(temperature() + dt, p); return; } + setState_TP(temperature() + 0.5*dt, p); } throw CanteraError("setState_SP","no convergence. dt = " + fp2str(dt)); } @@ -233,10 +235,11 @@ namespace Cantera { dt = (s - entropy_mass())*temperature()/cv_mass(); if (dt > 100.0) dt = 100.0; else if (dt < -100.0) dt = -100.0; - setTemperature(temperature() + dt); if (fabs(dt) < tol) { + setTemperature(temperature() + dt); return; } + setTemperature(temperature() + 0.5*dt); } throw CanteraError("setState_SV","no convergence. dt = " + fp2str(dt)); } diff --git a/Cantera/src/ThermoPhase.h b/Cantera/src/ThermoPhase.h index 6327c8632..e78b589af 100755 --- a/Cantera/src/ThermoPhase.h +++ b/Cantera/src/ThermoPhase.h @@ -709,19 +709,19 @@ namespace Cantera { /** Set the specific enthalpy (J/kg) and pressure (Pa). */ virtual void setState_HP(doublereal h, doublereal p, - doublereal tol = 1.e-8); + doublereal tol = 1.e-4); /** Set the specific enthalpy (J/kg) and specific volume (m^3/kg). */ virtual void setState_UV(doublereal u, doublereal v, - doublereal tol = 1.e-8); + doublereal tol = 1.e-4); /** Set the specific entropy (J/kg/K) and pressure (Pa). */ virtual void setState_SP(doublereal s, doublereal p, - doublereal tol = 1.e-8); + doublereal tol = 1.e-4); /** Set the specific entropy (J/kg/K) and specific volume (m^3/kg). */ virtual void setState_SV(doublereal s, doublereal v, - doublereal tol = 1.e-8); + doublereal tol = 1.e-4); //@} diff --git a/Cantera/src/oneD/Domain1D.h b/Cantera/src/oneD/Domain1D.h index 83c1661a9..ae1aca0cc 100644 --- a/Cantera/src/oneD/Domain1D.h +++ b/Cantera/src/oneD/Domain1D.h @@ -70,6 +70,9 @@ namespace Cantera { */ const int domainIndex() { return m_index; } + /** + * True if the domain is a connector domain. + */ bool isConnector() { return (m_type >= cConnectorType); } /** diff --git a/Cantera/src/zeroD/Reactor.cpp b/Cantera/src/zeroD/Reactor.cpp index bd13941af..0bb04730d 100644 --- a/Cantera/src/zeroD/Reactor.cpp +++ b/Cantera/src/zeroD/Reactor.cpp @@ -166,7 +166,7 @@ namespace CanteraZeroD { mix.setTemperature(temp); if (m_energy) { - m_thermo->setState_UV(u/mass,m_vol/mass); + m_thermo->setState_UV(u/mass,m_vol/mass,1.0e-4); temp = mix.temperature(); //mix.setTemperature(temp); } //m_state[0] = temp; diff --git a/ChangeLog b/ChangeLog index 2610d42f5..40d39555d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,121 @@ +2005-12-05 10:36 dggoodwin + + * Cantera/: matlab/cantera/examples/catcomb.m, + python/Cantera/OneD/onedim.py, src/oneD/Domain1D.h, + src/oneD/MultiNewton.cpp: minor changes + +2005-11-26 08:08 dggoodwin + + * configure, Cantera/clib/src/ctreactor.cpp, + Cantera/python/Cantera/Reactor.py, + Cantera/src/CVodesIntegrator.cpp, + Cantera/src/zeroD/FlowReactor.h, Cantera/src/zeroD/ReactorBase.h, + Cantera/src/zeroD/ReactorNet.cpp, Cantera/src/zeroD/ReactorNet.h, + config/configure, config/configure.in, + tools/templates/f77/demo.mak.in, tools/templates/f90/demo.mak.in: + misc minor fixes + +2005-11-22 17:19 dggoodwin + + * Cantera/python/Cantera/ThermoPhase.py: fixed error in + restoreState + +2005-11-22 09:59 dggoodwin + + * Cantera/cxx/demos/kinetics1.cpp, Cantera/src/FalloffFactory.cpp, + Cantera/src/FalloffFactory.h, Cantera/src/GasKinetics.cpp, + Cantera/src/Integrator.h, Cantera/src/KineticsFactory.cpp, + Cantera/src/KineticsFactory.h, + Cantera/src/SpeciesThermoFactory.cpp, + Cantera/src/SpeciesThermoFactory.h, + Cantera/src/SpeciesThermoMgr.h, Cantera/src/State.cpp, + Cantera/src/StoichManager.h, Cantera/src/ThermoFactory.cpp, + Cantera/src/ThermoFactory.h, Cantera/src/ThirdBodyMgr.h, + Cantera/src/misc.cpp, Cantera/src/units.h, + Cantera/src/utilities.h, Cantera/src/vec_functions.h, + Cantera/src/transport/TransportFactory.cpp, + Cantera/src/transport/TransportFactory.h, + test_problems/silane_equil/Makefile.in, + test_problems/surfkin/Makefile.in, tools/src/Makefile.in, + tools/src/ctlibsample.mak.in, tools/src/sample.mak.in, + tools/src/sample_f90.mak.in, tools/testtools/Makefile.in: changed + some variable names to eliminate leading ddouble (and some + single) underscores + +2005-11-22 05:23 dggoodwin + + * win32/vc7/cantera/cantera.vcproj: updated + +2005-11-18 00:21 dggoodwin + + * ext/tpx/Sub.cpp: added check in set_xy for density == Undef but T + != Undef. Failure to check for this condition had resulted in + convergence to the wrong root for Hydrogen. + +2005-11-14 10:49 hkmoffa + + * Cantera/src/thermo/: Makefile.in, MolalityVPSSTP.cpp, + MolalityVPSSTP.h, StoichSubstanceSSTP.h, VPStandardStateTP.cpp, + VPStandardStateTP.h: Added a few more files to handle liquid + electrochemistry thermo. + +2005-11-14 10:47 hkmoffa + + * Cantera/src/: ThermoPhase.h, ThermoPhase.cpp: Added two sets of + functions One, InitThermoFromXML() and InitThermoFromFile() + initializes ThermoPhase objects from XML data trees. The second + set, which is incomplete, works to create a duplication + capability for ThermoPhase objects, using the function, + duplMyselfAsThermoPhase(). + +2005-11-14 10:41 hkmoffa + + * Cantera/src/: Phase.cpp, Phase.h: Addec copy constructor and + assignment operator. + +2005-11-13 03:15 dggoodwin + + * Cantera/src/: CVodesIntegrator.cpp, InterfaceKinetics.cpp, + misc.cpp: removed some diagnostic output + +2005-11-10 07:06 dggoodwin + + * Cantera/src/: CVode.cpp, CVodesIntegrator.cpp, + CVodesIntegrator.h, ChemEquil.cpp, EdgeKinetics.cpp, + FalloffMgr.h, Func1.h, FuncEval.h, GRI_30_Kinetics.cpp, + ImplicitChem.cpp, ImplicitChem.h, ImplicitSurfChem.cpp, + ImplicitSurfChem.h, Integrator.h, Makefile.in, MultiPhase.cpp, + NasaPoly1.h, NasaThermo.h, ODE_integrators.cpp, ReactionPath.cpp, + ReactionPath.h, SpeciesThermoFactory.cpp, ThermoPhase.cpp, + ctvector.h, misc.cpp, transport/SolidTransport.cpp, + transport/TransportBase.h: support for sensitivity analysis + +2005-11-10 07:02 dggoodwin + + * Cantera/src/zeroD/: FlowReactor.h, FlowReactor.cpp: initial + import + +2005-10-31 08:29 dggoodwin + + * Cantera/src/SimpleThermo.h: corrected bug that caused problems if + this SpeciesThermo manager was used in conjunction with another + one (e.g. NASA). + +2005-10-31 08:06 hkmoffa + + * Cantera/src/ChemEquil.cpp: Eliminated 2 unused variables. + +2005-10-28 21:22 dggoodwin + + * Cantera/matlab/cantera/gaussian.m: initial import + +2005-10-28 16:16 hkmoffa + + * Cantera/src/: GeneralSpeciesThermo.cpp, + SpeciesThermoInterpType.h, thermo/SingleSpeciesTP.cpp: Added a + virtual destructor for SpeciesThermoInterpType.h. Without it, + there is a memory leak. + 2005-10-24 15:13 hkmoffa * Cantera/src/thermo/SingleSpeciesTP.cpp: Forgot the member diff --git a/config/configure b/config/configure index 0f549a308..3587699cb 100755 --- a/config/configure +++ b/config/configure @@ -1584,8 +1584,10 @@ use_sundials=0 sundials_inc= CVODE_LIBS='-lcvode' +if test "$USE_SUNDIALS" = "default"; then ldsave=$LDFLAGS LDFLAGS='-L'$SUNDIALS_HOME/lib' '$ldsave +fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -2518,23 +2520,30 @@ else fi -LDFLAGS=$ldsave - if test "x$USE_SUNDIALS" = "xy"; then -if test use_sundials=1; then +use_sundials=1 +fi + +if test ${use_sundials} = 1; then cat >>confdefs.h <<\_ACEOF #define HAS_SUNDIALS 1 _ACEOF +echo "using CVODES from SUNDIALS... Sensitivity analysis enabled." CVODE_LIBS='-lsundials_cvodes -lsundials_shared -lsundials_nvecserial' sundials_include='-I'${SUNDIALS_HOME}/include fi + +if test ${use_sundials} = 0; then +echo "using CVODE... Sensitivity analysis disabled." +echo "-> To enable sensitivity analysis, install the SUNDIALS package with CVODES." fi + ######################################################### # The Cantera Kernel ######################################################### @@ -4202,7 +4211,7 @@ fi # Provide some information about the compiler. -echo "$as_me:4205:" \ +echo "$as_me:4214:" \ "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 @@ -4379,7 +4388,7 @@ _ACEOF # flags. ac_save_FFLAGS=$FFLAGS FFLAGS="$FFLAGS $ac_verb" -(eval echo $as_me:4382: \"$ac_link\") >&5 +(eval echo $as_me:4391: \"$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 @@ -4459,7 +4468,7 @@ _ACEOF # flags. ac_save_FFLAGS=$FFLAGS FFLAGS="$FFLAGS $ac_cv_prog_f77_v" -(eval echo $as_me:4462: \"$ac_link\") >&5 +(eval echo $as_me:4471: \"$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 @@ -4782,10 +4791,6 @@ F90BUILDFLAGS=${f90buildopts}' '${savef90flags} -echo "objext = " $OBJEXT - - - diff --git a/config/configure.in b/config/configure.in index 1158e4994..fc8442d68 100755 --- a/config/configure.in +++ b/config/configure.in @@ -241,21 +241,30 @@ use_sundials=0 sundials_inc= CVODE_LIBS='-lcvode' +if test "$USE_SUNDIALS" = "default"; then ldsave=$LDFLAGS LDFLAGS='-L'$SUNDIALS_HOME/lib' '$ldsave +fi AC_CHECK_LIB(sundials_cvodes, CVodeCreate, [use_sundials=1], [use_sundials=0],\ [-lsundials_shared -lsundials_nvecserial -lm]) -LDFLAGS=$ldsave - if test "x$USE_SUNDIALS" = "xy"; then -if test use_sundials=1; then +use_sundials=1 +fi + +if test ${use_sundials} = 1; then AC_DEFINE(HAS_SUNDIALS) +echo "using CVODES from SUNDIALS... Sensitivity analysis enabled." CVODE_LIBS='-lsundials_cvodes -lsundials_shared -lsundials_nvecserial' sundials_include='-I'${SUNDIALS_HOME}/include fi + +if test ${use_sundials} = 0; then +echo "using CVODE... Sensitivity analysis disabled." +echo "-> To enable sensitivity analysis, install the SUNDIALS package with CVODES." fi + AC_SUBST(use_sundials) AC_SUBST(CVODE_LIBS) AC_SUBST(sundials_include) @@ -775,13 +784,9 @@ AC_SUBST(F90) AC_SUBST(F90FLAGS) AC_SUBST(F90BUILDFLAGS) - - AC_OBJEXT AC_EXEEXT -echo "objext = " $OBJEXT - AC_SUBST(precompile_headers) AC_SUBST(CXX_DEPENDS) AC_SUBST(FLIBS) diff --git a/configure b/configure index eba37d395..29486c53c 100755 --- a/configure +++ b/configure @@ -227,16 +227,18 @@ ENABLE_TPX='y' # CVODE comes with Cantera, but it is possible to use the latest # version as well, which now supports sensitivity analysis (CVODES). # CVODES is a part of the 'sundials' package from Lawrence Livermore -# National Laboratory. Due to its size, sundials is not distributed -# with Cantera, but it is free software that may be downloaded and -# installed separately. If you have sundials, set USE_SUNDIALS to 'y', -# and set SUNDIALS_HOME to the directory where you have installed -# sundials. Note that sensitivity analysis with Cantera requires use -# of sundials. +# National Laboratory. Sundials is not distributed with Cantera, but +# it is free software that may be downloaded and installed +# separately. If you have sundials, set SUNDIALS_HOME to the directory +# where it is installed, or else put the sundials libraries on the +# library path. If you leave USE_SUNDIALS = 'default', then it will +# be used if you have it, and if not the older CVODE will be used. Or +# set USE_SUNDIALS to 'y' or 'n' to force using it or not. Note that +# sensitivity analysis with Cantera requires use of sundials. # # See: http://www.llnl.gov/CASC/sundials # -USE_SUNDIALS='y' +USE_SUNDIALS='default' SUNDIALS_HOME='/usr/local/sundials'