*** empty log message ***

This commit is contained in:
Dave Goodwin 2005-07-14 18:54:10 +00:00
parent d0de362e22
commit d6611f5878
21 changed files with 91 additions and 44 deletions

View file

@ -493,7 +493,10 @@ extern "C" {
equilibrate(*th(n), XY, solver, rtol, maxsteps,
loglevel); return 0;
}
catch (CanteraError) {return -1;}
catch (CanteraError) {
cout << "exception caught in th_equil. returning -1." << endl;
return -1;
}
}
doublereal DLL_EXPORT th_refPressure(int n) {
@ -1040,6 +1043,11 @@ extern "C" {
catch (CanteraError) { return -1; }
}
int DLL_EXPORT write_HTML_log(char* file) {
write_logfile(string(file));
return 0;
}
int DLL_EXPORT getCanteraError(int buflen, char* buf) {
string e;
e = lastErrorMessage();

View file

@ -147,6 +147,7 @@ extern "C" {
char* id, int validate, double threshold);
int DLL_IMPORT getCanteraError(int buflen, char* buf);
int DLL_IMPORT showCanteraErrors();
int DLL_IMPORT write_HTML_log(char* file);
int DLL_IMPORT setLogWriter(void* logger);
int DLL_IMPORT addCanteraDirectory(int buflen, char* buf);
int DLL_IMPORT clearStorage();

View file

@ -96,6 +96,11 @@ extern "C" {
return 0;
}
int DLL_EXPORT mix_init(int i) {
_mix(i)->init();
return 0;
}
int DLL_EXPORT mix_nElements(int i) {
return _mix(i)->nElements();
}

View file

@ -10,6 +10,7 @@ extern "C" {
int DLL_IMPORT mix_copy(int i);
int DLL_IMPORT mix_assign(int i, int j);
int DLL_IMPORT mix_addPhase(int i, int j, double moles);
int DLL_IMPORT mix_init(int i);
int DLL_IMPORT mix_nElements(int i);
int DLL_IMPORT mix_elementIndex(int i, char* name);
int DLL_IMPORT mix_speciesIndex(int i, int k, int p);

View file

@ -49,7 +49,7 @@ void plotSoln(string fname, string fmt, string title, const G& gas, const A& sol
inline void writeCanteraHeader(ostream& s) {
s << endl;
s << " Cantera version " << CANTERA_VERSION << endl;
s << " Cantera version " << "CANTERA_VERSION" << endl;
s << " Copyright California Institute of Technology, 2002." << endl;
s << " http://www.cantera.org" << endl;
s << endl;

View file

@ -5,8 +5,11 @@
#include "../../../clib/src/ctxml.h"
#include "ctmatutils.h"
#include <string.h>
#include <iostream>
using namespace std;
void reportError() {
write_HTML_log("error_log.html");
int buflen = 0;
char* output_buf = 0;
buflen = getCanteraError(buflen, output_buf) + 1;

View file

@ -5,6 +5,9 @@
#include <string>
#include "../../../src/logger.h"
#include <iostream>
using namespace std;
static std::string ss = "disp('";
namespace Cantera {

View file

@ -52,9 +52,13 @@ class Mixture:
moles = p[1]
except:
ph = p
moles = 0
if p == phases[0]:
moles = 1
else:
moles = 0
self._addPhase(ph, moles)
self._phases.append(ph)
_cantera.mix_init(self.__mixid)
self.setTemperature(self._phases[0].temperature())
self.setPressure(self._phases[0].pressure())

View file

@ -33,14 +33,15 @@ except:
print "ChemEquil solver failed! Try the MultiPhaseEquil solver..."
# Try again. Reset the gas to the initial state
gas.set(T = temp, P = OneAtm, X = comp)
gas.set(T = temp, P = OneAtm, X = comp)
# setting parameter 'solver' to 1 requests that the
# MultiPhaseEquil solver be used (specifying 0 would cause
# ChemEquil to be used). Some other useful parameters are rtol
# (relative error tolerance, default = 1.0e-9), max_steps (default = 1000),
# loglevel (default = 0).
gas.equilibrate("TP", solver = 1, rtol = 1.0e-10, loglevel = 4)
# The MultiPhaseEquil solver is used to equilibrate 'Mixture'
# objects, since these may have more than one phase. Here we'll
# create a Mixture object containing only the gas. Some other
# useful parameters are rtol (relative error tolerance, default =
# 1.0e-9), max_steps (default = 1000), loglevel (default = 0).
mix = Mixture([(gas,1.0)])
mix.equilibrate("TP", loglevel=4)
# print a summary of the results
print gas

View file

@ -86,7 +86,7 @@ ct_writelogfile(PyObject *self, PyObject *args)
{
int iok;
char *logfile;
if (!PyArg_ParseTuple(args, "s:ck2cti", &logfile))
if (!PyArg_ParseTuple(args, "s:writelogfile", &logfile))
return NULL;
iok = writelogfile(logfile);
if (iok == -1) { return reportCanteraError();}

View file

@ -38,6 +38,20 @@ py_mix_addPhase(PyObject *self, PyObject *args)
}
static PyObject *
py_mix_init(PyObject *self, PyObject *args)
{
int i;
int _val;
if (!PyArg_ParseTuple(args, "i:mix_init", &i))
return NULL;
_val = mix_init(i);
if (_val < 0) return reportCanteraError();
return Py_BuildValue("i",_val);
}
static PyObject *
py_mix_nElements(PyObject *self, PyObject *args)
{

View file

@ -257,6 +257,7 @@ static PyMethodDef ct_methods[] = {
{"mix_new", py_mix_new, METH_VARARGS},
{"mix_del", py_mix_del, METH_VARARGS},
{"mix_addPhase", py_mix_addPhase, METH_VARARGS},
{"mix_init", py_mix_init, METH_VARARGS},
{"mix_nElements", py_mix_nElements, METH_VARARGS},
{"mix_elementIndex", py_mix_elementIndex, METH_VARARGS},
{"mix_speciesIndex", py_mix_speciesIndex, METH_VARARGS},

View file

@ -309,6 +309,8 @@ cf:
gzip cantera-cf.tar; scp cantera-cf.tar.gz dggoodwin@cf-shell.sourceforge.net:cantera.tar.gz)
sshcf './runall' &
configure: config/configure.in
(cd config; autoconf)
#info:
# echo '#define CANTERA_ROOT "@prefix@/cantera"' > include/ctdir.h

View file

@ -61,6 +61,9 @@ typedef int ftnlen; // Fortran hidden string length type
#undef DARWIN
#undef HAS_SSTREAM
// Cantera version
#undef CANTERA_VERSION
// Identify whether the operating system is cygwin's overlay of
// windows, with gcc being used as the compiler.
#undef CYGWIN
@ -86,6 +89,7 @@ typedef int ftnlen; // Fortran hidden string length type
//--------------------- Cantera -----------------------------------
#undef CANTERA_ROOT
// This data pathway is used to locate a directory where datafiles
// are to be found. Note, the local directory is always searched
// as well.

27
config/configure vendored
View file

@ -1353,6 +1353,10 @@ fi
ctversion=${CANTERA_VERSION}
cat >>confdefs.h <<_ACEOF
#define CANTERA_VERSION $ctversion
_ACEOF
homedir=${HOME}
@ -1829,11 +1833,7 @@ fi
#
# Fortran90 Interface
# Before turning on this interface, we do a rudimentary check
# to make sure that the F90 compiler can be found
#
BUILD_F90=1
if test "x$BUILD_F90_INTERFACE" = "xn"; then
BUILD_F90=0
@ -3339,7 +3339,7 @@ echo "${ECHO_T}${has_sstream}" >&6
# Fortran
#---------------------------------
if test x"$build_with_f2c" = "x0"; then
#if test x"$build_with_f2c" = "x0"; then
ac_ext=f
ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5'
ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
@ -3860,7 +3860,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
override_f77_libs=0;
case $ac_sys_system in
Darwin*) FLIBS='-lstdc++ -lg2c -lcc_dynamic'; override_f77_libs=1; SHARED_CTLIB=0;;
Darwin*) FLIBS='-lSystem'; override_f77_libs=1; SHARED_CTLIB=0;;
esac
if test $override_f77_libs -gt 0; then
@ -3869,13 +3869,14 @@ if test $override_f77_libs -gt 0; then
echo FLIBS = $FLIBS
fi
fi
#fi
#--------------------------------------------
if test -n ${BUILD_F90}; then
if test "x${BUILD_F90}" != "x0"; then
echo F90 = $F90
echo BUILD_F90 = $BUILD_F90
if test "$F90" = "default" -o \
"$F90"x = "x"; then
for ac_prog in f95 gfortran g95
@ -3938,7 +3939,7 @@ f90type=none
f90_module_dir='-I'
f90_opts=''
if test -n ${BUILD_F90}; then
if test "x${BUILD_F90}" != "x0"; then
echo "$as_me:$LINENO: checking Fortran 90 compiler ($F90) type" >&5
echo $ECHO_N "checking Fortran 90 compiler ($F90) type... $ECHO_C" >&6
cat >> testf90.f90 << EOF
@ -3970,9 +3971,9 @@ EOF
f90type="g95"
f90opts="-fno-second-underscore -I. -I${ct_incdir}"
f90buildopts="-fno-second-underscore -I."
case $ac_sys_system in
Darwin*) FLIBS='-lg2c -lcc_dynamic';;
esac
#case $ac_sys_system in
# Darwin*) FLIBS='-lg2c -lcc_dynamic';;
#esac
fi
msg=`${F90} -V &> f90out`

View file

@ -109,6 +109,7 @@ AC_SUBST(python_win_prefix)
ctversion=${CANTERA_VERSION}
AC_SUBST(ctversion)
AC_DEFINE_UNQUOTED(CANTERA_VERSION,$ctversion)
homedir=${HOME}
AC_SUBST(homedir)
@ -474,11 +475,7 @@ AC_SUBST(LOCAL_LIBS)
AC_SUBST(CT_SHARED_LIB)
#
# Fortran90 Interface
# Before turning on this interface, we do a rudimentary check
# to make sure that the F90 compiler can be found
#
BUILD_F90=1
if test "x$BUILD_F90_INTERFACE" = "xn"; then
BUILD_F90=0
@ -624,7 +621,7 @@ AC_MSG_RESULT(${has_sstream})
# Fortran
#---------------------------------
if test x"$build_with_f2c" = "x0"; then
#if test x"$build_with_f2c" = "x0"; then
AC_PROG_F77()
# if G77 is defined, then add a flag to turn off adding a second underscore
@ -638,7 +635,7 @@ AC_F77_LIBRARY_LDFLAGS()
override_f77_libs=0;
case $ac_sys_system in
Darwin*) FLIBS='-lstdc++ -lg2c -lcc_dynamic'; override_f77_libs=1; SHARED_CTLIB=0;;
Darwin*) FLIBS='-lSystem'; override_f77_libs=1; SHARED_CTLIB=0;;
esac
if test $override_f77_libs -gt 0; then
@ -647,13 +644,12 @@ if test $override_f77_libs -gt 0; then
echo FLIBS = $FLIBS
fi
fi
#fi
#--------------------------------------------
if test ${BUILD_F90} = "1"; then
echo F90 = $F90
if test "x${BUILD_F90}" != "x0"; then
if test "$F90" = "default" -o \
"$F90"x = "x"; then
AC_PATH_PROGS(F90, f95 gfortran g95, "none")
@ -672,7 +668,7 @@ f90type=none
f90_module_dir='-I'
f90_opts=''
if test ${BUILD_F90} = "1" ; then
if test "x${BUILD_F90}" != "x0"; then
AC_MSG_CHECKING(Fortran 90 compiler ($F90) type)
cat >> testf90.f90 << EOF
module mt
@ -703,9 +699,9 @@ EOF
f90type="g95"
f90opts="-fno-second-underscore -I. -I${ct_incdir}"
f90buildopts="-fno-second-underscore -I."
case $ac_sys_system in
Darwin*) FLIBS='-lg2c -lcc_dynamic';;
esac
#case $ac_sys_system in
# Darwin*) FLIBS='-lg2c -lcc_dynamic';;
#esac
fi
msg=`${F90} -V &> f90out`

2
configure vendored
View file

@ -309,7 +309,7 @@ FFLAGS=${FFLAGS:='-O3 -g'}
# the additional Fortran flags required for linking, if any. Leave commented
# out if no additional flags are required.
LFORT_FLAGS="-lcc_dynamic"
#LFORT_FLAGS="-lcc_dynamic"
#------------------------------------------------------

View file

@ -50,7 +50,7 @@ void plotSoln(string fname, string fmt, string title, const G& gas, const A& sol
inline void writeCanteraHeader(ostream& s) {
s << endl;
s << " Cantera version " << CANTERA_VERSION << endl;
s << " Cantera version " << "CANTERA_VERSION" << endl;
s << " Copyright California Institute of Technology, 2002." << endl;
s << " http://www.cantera.org" << endl;
s << endl;

View file

@ -1,2 +1,4 @@
#define IEEE_8087
#define Arith_Kind_ASL 1
#define IEEE_MC68k
#define Arith_Kind_ASL 2
#define Double_Align
#define NANCHECK

View file

@ -28,7 +28,7 @@ PYTHON_CMD=${FIRSTARG:=PYTHON_CMDA}
#echo $PYTHON_CMD
$PYTHON_CMD ../../Cantera/python/examples/flame1.py > flame1.out
$PYTHON_CMD ../../Cantera/python/examples/flames/flame1.py > flame1.out
retnStat=$?
if [ $retnStat != "0" ]
then
@ -36,7 +36,7 @@ then
echo "flame1.py returned with bad status, $retnStat, check output"
fi
$PYTHON_CMD ../../Cantera/python/examples/diamond.py > diamond.out
$PYTHON_CMD ../../Cantera/python/examples/surface_chemistry/diamond.py > diamond.out
retnStat=$?
if [ $retnStat != "0" ]
then

View file

@ -32,6 +32,7 @@
#endif
// add any other Cantera header files you need here
#include <cantera/Cantera.h>
#include <cantera/IdealGasMix.h>