misc minor fixes
This commit is contained in:
parent
bcfc876a0a
commit
623dba2b67
12 changed files with 1043 additions and 309 deletions
|
|
@ -72,6 +72,8 @@ extern "C" {
|
|||
reactor_t* r=0;
|
||||
if (type == ReactorType)
|
||||
r = new Reactor();
|
||||
else if (type == FlowReactorType)
|
||||
r = new FlowReactor();
|
||||
else if (type == ReservoirType)
|
||||
r = new Reservoir();
|
||||
else
|
||||
|
|
|
|||
|
|
@ -375,6 +375,48 @@ class Reactor(ReactorBase):
|
|||
ReactorBase.__init__(self, contents = contents, name = name,
|
||||
volume = volume, energy = energy,
|
||||
verbose = verbose, type = 1)
|
||||
|
||||
|
||||
|
||||
class FlowReactor(ReactorBase):
|
||||
"""
|
||||
"""
|
||||
def __init__(self, contents = None, name = '',
|
||||
volume = 1.0, energy = 'on',
|
||||
mdot = -1.0,
|
||||
verbose = 0):
|
||||
"""
|
||||
contents - Reactor contents. If not specified, the reactor is
|
||||
initially empty. In this case, call method 'insert' to specify
|
||||
the contents.
|
||||
|
||||
name - Used only to identify this reactor in output. If not
|
||||
specified, defaults to 'Reactor_n', where n is an integer
|
||||
assigned in the order Reactor objects are created.
|
||||
|
||||
volume - Initial reactor volume. Defaults to 1 m^3.
|
||||
|
||||
energy - Set to 'on' or 'off'. If set to 'off', the energy
|
||||
equation is not solved, and the temperature is held at its
|
||||
initial value. The default in 'on'.
|
||||
|
||||
verbose - if set to a non-zero value, additional diagnostic
|
||||
information will be printed.
|
||||
"""
|
||||
global _reactorcount
|
||||
if name == '':
|
||||
name = 'FlowReactor_'+`_reactorcount`
|
||||
_reactorcount += 1
|
||||
ReactorBase.__init__(self, contents = contents, name = name,
|
||||
volume = volume, energy = energy,
|
||||
verbose = verbose, type = 3)
|
||||
if mdot > 0.0:
|
||||
self.setMassFlowRate(mdot)
|
||||
|
||||
def setMassFlowRate(self, mdot):
|
||||
_cantera.flowReactor_setMassFlowRate(self.__reactor_id, mdot)
|
||||
|
||||
|
||||
|
||||
|
||||
class Reservoir(ReactorBase):
|
||||
|
|
|
|||
|
|
@ -111,8 +111,8 @@ namespace Cantera {
|
|||
CVodeSensFree(m_cvode_mem);
|
||||
CVodeFree(m_cvode_mem);
|
||||
}
|
||||
if (m_y) N_VDestroy_Serial(nv(m_y)); //N_VFree(nv(m_y));
|
||||
if (m_abstol) N_VDestroy_Serial(nv(m_abstol)); //N_VFree(nv(m_abstol));
|
||||
if (m_y) N_VDestroy_Serial(nv(m_y));
|
||||
if (m_abstol) N_VDestroy_Serial(nv(m_abstol));
|
||||
delete m_fdata;
|
||||
|
||||
//delete[] m_iopt;
|
||||
|
|
@ -166,14 +166,12 @@ namespace Cantera {
|
|||
m_hmax = hmax;
|
||||
if (m_cvode_mem)
|
||||
CVodeSetMaxStep(m_cvode_mem, hmax);
|
||||
//m_ropt[HMAX] = hmax;
|
||||
}
|
||||
|
||||
void CVodesIntegrator::setMinStepSize(doublereal hmin) {
|
||||
m_hmin = hmin;
|
||||
if (m_cvode_mem)
|
||||
CVodeSetMinStep(m_cvode_mem, hmin);
|
||||
//m_ropt[HMIN] = hmin;
|
||||
}
|
||||
|
||||
void CVodesIntegrator::setMaxSteps(int nmax) {
|
||||
|
|
@ -228,16 +226,10 @@ namespace Cantera {
|
|||
// check abs tolerance array size
|
||||
if (m_itol == CV_SV && m_nabs < m_neq)
|
||||
throw CVodesErr("not enough absolute tolerance values specified.");
|
||||
//try {
|
||||
func.getInitialConditions(m_t0, m_neq, NV_DATA_S(nv(m_y)));
|
||||
//}
|
||||
//catch (CanteraError) {
|
||||
//showErrors();
|
||||
//error("Teminating execution");
|
||||
// }
|
||||
|
||||
func.getInitialConditions(m_t0, m_neq, NV_DATA_S(nv(m_y)));
|
||||
|
||||
if (m_cvode_mem) CVodeFree(m_cvode_mem);
|
||||
|
||||
m_cvode_mem = CVodeCreate(m_method, m_iter);
|
||||
if (!m_cvode_mem) throw CVodesErr("CVodeCreate failed.");
|
||||
|
||||
|
|
@ -246,19 +238,11 @@ namespace Cantera {
|
|||
// vector atol
|
||||
flag = CVodeMalloc(m_cvode_mem, cvodes_rhs, m_t0, nv(m_y), m_itol,
|
||||
m_reltol, nv(m_abstol));
|
||||
//m_cvode_mem = CVodeMalloc(m_neq, cvode_rhs, m_t0, nv(m_y), m_method,
|
||||
// m_iter, m_itol, &m_reltol,
|
||||
// nv(m_abstol), m_data, NULL, TRUE, m_iopt,
|
||||
// m_ropt.begin(), NULL);
|
||||
}
|
||||
else {
|
||||
// scalar atol
|
||||
flag = CVodeMalloc(m_cvode_mem, cvodes_rhs, m_t0, nv(m_y), m_itol,
|
||||
m_reltol, &m_abstols);
|
||||
//m_cvode_mem = CVodeMalloc(m_neq, cvode_rhs, m_t0, nv(m_y), m_method,
|
||||
// m_iter, m_itol, &m_reltol,
|
||||
// &m_abstols, m_data, NULL, TRUE, m_iopt,
|
||||
// m_ropt.begin(), NULL);
|
||||
}
|
||||
if (flag != CV_SUCCESS) {
|
||||
if (flag == CV_MEM_FAIL) {
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@
|
|||
namespace CanteraZeroD {
|
||||
|
||||
/**
|
||||
* Adiabatic, reversible flow in a constant-area duct.
|
||||
*/
|
||||
|
||||
class FlowReactor : public Reactor {
|
||||
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@ namespace CanteraZeroD {
|
|||
class FlowDevice;
|
||||
class Wall;
|
||||
|
||||
const int ReactorType = 1;
|
||||
const int ReservoirType = 2;
|
||||
const int ReservoirType = 1;
|
||||
const int ReactorType = 2;
|
||||
const int FlowReactorType = 3;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -10,6 +10,9 @@ namespace CanteraZeroD {
|
|||
m_maxstep(-1.0),
|
||||
m_verbose(false), m_ntotpar(0)
|
||||
{
|
||||
#ifdef DEBUG_MODE
|
||||
m_verbose = true;
|
||||
#endif
|
||||
m_integ = newIntegrator("CVODE");// CVodeInt;
|
||||
|
||||
// use backward differencing, with a full Jacobian computed
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ namespace CanteraZeroD {
|
|||
//@}
|
||||
|
||||
void addReactor(ReactorBase* r) {
|
||||
if (r->type() == ReactorType) {
|
||||
if (r->type() >= ReactorType) {
|
||||
m_r.push_back(r);
|
||||
m_nr++;
|
||||
}
|
||||
|
|
|
|||
1212
config/configure
vendored
1212
config/configure
vendored
File diff suppressed because it is too large
Load diff
|
|
@ -240,11 +240,19 @@ AC_SUBST(INCL_USER_CODE)
|
|||
use_sundials=0
|
||||
sundials_inc=
|
||||
CVODE_LIBS='-lcvode'
|
||||
|
||||
AC_LANG_C
|
||||
|
||||
if test "x$USE_SUNDIALS" = "xy"; then
|
||||
use_sundials=1
|
||||
ldsave=$LDFLAGS
|
||||
LDFLAGS='-L'${SUNDIALS_HOME}/lib' '$ldsave
|
||||
AC_CHECK_LIB(sundials_cvodes, CVodeCreate, [use_sundials=1;], [use_sundials=0;],[-lsundials_shared -lsundials_nvecserial])
|
||||
LDFLAGS=$ldsave
|
||||
if test use_sundials=1; then
|
||||
AC_DEFINE(HAS_SUNDIALS)
|
||||
CVODE_LIBS='-lsundials_cvodes -lsundials_shared -lsundials_nvecserial'
|
||||
sundials_include='-I '${SUNDIALS_HOME}/include
|
||||
sundials_include='-I'${SUNDIALS_HOME}/include
|
||||
fi
|
||||
fi
|
||||
AC_SUBST(use_sundials)
|
||||
AC_SUBST(CVODE_LIBS)
|
||||
|
|
@ -493,8 +501,6 @@ fi
|
|||
if test -n "$SUNDIALS_HOME"
|
||||
then LOCAL_LIB_DIRS=$LOCAL_LIB_DIRS' -L'$SUNDIALS_HOME/lib
|
||||
fi
|
||||
echo $SUNDIALS_HOME
|
||||
echo $LOCAL_LIB_DIRS
|
||||
|
||||
|
||||
AC_SUBST(LOCAL_LIB_DIRS)
|
||||
|
|
|
|||
43
configure
vendored
43
configure
vendored
|
|
@ -245,16 +245,13 @@ SUNDIALS_HOME='/usr/local/sundials'
|
|||
#-----------------------------------------------------------------
|
||||
#
|
||||
# Cantera comes with Fortran versions of those parts of BLAS and
|
||||
# LAPACK it requires. But performance *may* be better if you use a
|
||||
# LAPACK it requires. But performance may be better if you use a
|
||||
# version of these libraries optimized for your machine hardware. If
|
||||
# you want to use your own libraries, set BLAS_LAPACK_LIBS to the
|
||||
# string that should be passed to the linker to link to these
|
||||
# libraries, and set BLAS_LAPACK_DIR to the directory where these
|
||||
# libraries are located. Otherwise, leave these lines commented out.
|
||||
#
|
||||
# (The settings shown here are appropriate if you are using the ATLAS
|
||||
# libraries.)
|
||||
#
|
||||
#BLAS_LAPACK_LIBS='-llapack -lblas'
|
||||
#'-llapack -lf77blas -lcblas -latlas'
|
||||
#BLAS_LAPACK_DIR='/usr/lib'
|
||||
|
|
@ -278,7 +275,6 @@ LAPACK_FTN_STRING_LEN_AT_END='y'
|
|||
#------------------------------------------------------------------
|
||||
|
||||
# the C++ compiler to use.
|
||||
#
|
||||
CXX=${CXX:=g++}
|
||||
|
||||
# the C compiler to use. This is only used to compile CVODE and
|
||||
|
|
@ -286,7 +282,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.
|
||||
|
|
@ -427,7 +423,6 @@ export SHARED
|
|||
export SOEXT
|
||||
export MAKE
|
||||
export RPFONT
|
||||
export USE_VISUAL_STUDIO
|
||||
export FORTRAN_LIB_DIR
|
||||
export CANTERA_INSTALL_DIR
|
||||
export USE_NUMERIC
|
||||
|
|
@ -463,39 +458,5 @@ fi
|
|||
./configure $CCPREFIX $1 $2 $3 $4
|
||||
|
||||
|
||||
#-------------- deprecated options ------------------------------------
|
||||
#
|
||||
#----------------------------------------------------------------------
|
||||
# MS-Windows Options
|
||||
#----------------------------------------------------------------------
|
||||
#
|
||||
# These options only need to be set if you are building Cantera on
|
||||
# a Windows PC.
|
||||
#
|
||||
# NOTE: These options are now deprecated. You should build Cantera
|
||||
# using Visual Studio .NET on Windows PCs, and not use this script
|
||||
# unless you are doing a unix-like build using cygwin.
|
||||
#
|
||||
# Cantera will be installed by default in c:\cantera. Change this to
|
||||
# install it somewhere else. Use forward slashes in the path name.
|
||||
#CANTERA_INSTALL_DIR=${CANTERA_INSTALL_DIR:="c:/cantera"}
|
||||
|
||||
# On a PC running MS-Windows, Cantera can be built either using
|
||||
# Microsoft Visual Studio, with the Visual C++ and (optionally)
|
||||
# Visual Fortran compilers, or using the linux-like cygwin
|
||||
# environment with the g++ and g77 compilers. Set this to "y" to use
|
||||
# Visual Studio.
|
||||
#USE_VISUAL_STUDIO=${USE_VISUAL_STUDIO:="y"}
|
||||
|
||||
# If you are using Visual Studio, set this to the location of the
|
||||
# directory containing the Fortran libraries. This is only needed to
|
||||
# build the Matlab interface.
|
||||
#FORTRAN_LIB_DIR="D:\Program Files\Microsoft Visual Studio\DF98\LIB"
|
||||
|
||||
#
|
||||
# If you are using Visual Studio, set this variable to indicates
|
||||
# whether you want to use DLL's. Note you need this for MSVCv7.0
|
||||
# but this is turned off for MSVCv6.0
|
||||
# USE_DLL=yes
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ CANTERA_LIBDIR=@ct_libdir@
|
|||
CANTERA_INCDIR=@ct_incroot@
|
||||
|
||||
# flags passed to the C++ compiler/linker for the linking step
|
||||
LCXXFLAGS = -L$(CANTERA_LIBDIR) @LCXX_FLAGS@
|
||||
LCXXFLAGS = -L$(CANTERA_LIBDIR) @LOCAL_LIB_DIRS@ @LCXX_FLAGS@
|
||||
|
||||
# how to compile C++ source files to object files
|
||||
.@CXX_EXT@.@OBJ_EXT@:
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ CANTERA_INCDIR=@ct_incroot@
|
|||
CANTERA_MODULE_DIR=@ct_incroot@/cantera
|
||||
|
||||
# flags passed to the C++ compiler/linker for the linking step
|
||||
LCXXFLAGS = -L$(CANTERA_LIBDIR)
|
||||
LCXXFLAGS = -L$(CANTERA_LIBDIR) @LOCAL_LIB_DIRS@
|
||||
|
||||
# how to compile C++ source files to object files
|
||||
%.o : %.cpp
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue