diff --git a/SConstruct b/SConstruct index 975b10048..c84cd091f 100644 --- a/SConstruct +++ b/SConstruct @@ -1022,7 +1022,7 @@ def install(*args, **kwargs): env.SConsignFile() -env.Append(CPPPATH=[], +env.Prepend(CPPPATH=[], LIBPATH=[Dir('build/lib')]) # preprocess input files (cti -> xml) diff --git a/doc/sphinx/compiling.rst b/doc/sphinx/compiling.rst index 348ddbe76..bb68b84a0 100644 --- a/doc/sphinx/compiling.rst +++ b/doc/sphinx/compiling.rst @@ -201,6 +201,9 @@ OS X CC=clang CXX=clang++ +* The Accelerate framework provides optimized versions of BLAS and LAPACK, so + the ``blas_lapack_libs`` option should generally be left unspecified. + Intel Compilers --------------- * Before compiling Cantera, you may need to set up the appropriate environment diff --git a/ext/SConscript b/ext/SConscript index 7989ef318..f5bd4f088 100644 --- a/ext/SConscript +++ b/ext/SConscript @@ -8,13 +8,13 @@ def prep_default(env): def prep_fortran(env): localenv = env.Clone() - localenv.Append(CPPPATH='#include/cantera/base') # for config.h + localenv.Prepend(CPPPATH='#include/cantera/base') # for config.h return localenv def prep_f2c(env): localenv = env.Clone() - localenv.Append(CPPPATH=Dir('#ext/f2c_libs')) + localenv.Prepend(CPPPATH=Dir('#ext/f2c_libs')) if not localenv['HAS_TIMES_H']: localenv.Append(CPPDEFINES=['USE_CLOCK']) if not localenv['HAS_UNISTD_H']: @@ -37,7 +37,7 @@ def prep_f2c(env): def prep_sundials(env): localenv = env.Clone() - localenv.Append(CPPPATH=Dir('#ext/cvode/include')) + localenv.Prepend(CPPPATH=Dir('#ext/cvode/include')) # Suppress warnings from external code if '-Wall' in localenv['CCFLAGS']: @@ -47,8 +47,8 @@ def prep_sundials(env): def prep_gtest(env): localenv = env.Clone() - localenv.Append(CPPPATH=[Dir('#ext/gtest'), - Dir('#ext/gtest/include')], + localenv.Prepend(CPPPATH=[Dir('#ext/gtest'), + Dir('#ext/gtest/include')], CPPDEFINES={'GTEST_HAS_PTHREAD': 0}) return localenv @@ -132,8 +132,8 @@ for subdir, extensions, prepFunction in libs: localenv = env.Clone() -localenv.Append(CPPPATH=[Dir('#ext/gtest'), - Dir('#ext/gtest/include')], +localenv.Prepend(CPPPATH=[Dir('#ext/gtest'), + Dir('#ext/gtest/include')], CPPDEFINES={'GTEST_HAS_PTHREAD': 0}) build(localenv.Library(pjoin('../lib', 'gtest'), source=['gtest/src/gtest-all.cc'])) diff --git a/include/cantera/kinetics/RxnRates.h b/include/cantera/kinetics/RxnRates.h index 2fe523d87..616100b57 100644 --- a/include/cantera/kinetics/RxnRates.h +++ b/include/cantera/kinetics/RxnRates.h @@ -422,7 +422,7 @@ public: Ea2_.resize(maxRates_); if (rdata.validate) { - validate(); + validate(rdata); } } @@ -514,7 +514,7 @@ public: //! temperatures at each interpolation pressure. This is potentially an //! issue when one of the Arrhenius expressions at a particular pressure //! has a negative pre-exponential factor. - void validate() { + void validate(const ReactionData& rdata) { double T[] = {1.0, 10.0, 100.0, 1000.0, 10000.0}; for (pressureIter iter = pressures_.begin(); iter->first < 1000; @@ -528,9 +528,10 @@ public: // message will correctly indicate that the problematic rate // expression is at the higher of the adjacent pressures. throw CanteraError("Plog::validate", - "Invalid rate coefficient at P = " + - fp2str(exp((++iter)->first)) + - ", T = " + fp2str(T[i])); + "Invalid rate coefficient for reaction #" + + int2str(rdata.number) + ":\n" + rdata.equation + "\n" + + "at P = " + fp2str(exp((++iter)->first)) + + ", T = " + fp2str(T[i])); } } } diff --git a/interfaces/python/ck2cti.py b/interfaces/python/ck2cti.py index 02dd406ab..752acc5f8 100755 --- a/interfaces/python/ck2cti.py +++ b/interfaces/python/ck2cti.py @@ -60,6 +60,7 @@ UNIT_OPTIONS = {'CAL/': 'cal/mol', 'MOLEC': 'molec', 'MOLECULES': 'molec'} +PROCESSED_UNITS = False ENERGY_UNITS = 'cal/mol' QUANTITY_UNITS = 'mol' @@ -1342,8 +1343,16 @@ def loadChemkinFile(path, speciesList=None): except IndexError: pass - ENERGY_UNITS = UNIT_OPTIONS[energyUnits] - QUANTITY_UNITS = UNIT_OPTIONS[moleculeUnits] + global PROCESSED_UNITS, ENERGY_UNITS, UNIT_OPTIONS + if not PROCESSED_UNITS: + PROCESSED_UNITS = True + ENERGY_UNITS = UNIT_OPTIONS[energyUnits] + QUANTITY_UNITS = UNIT_OPTIONS[moleculeUnits] + else: + if (ENERGY_UNITS != UNIT_OPTIONS[energyUnits] or + QUANTITY_UNITS != UNIT_OPTIONS[moleculeUnits]): + raise InputParseError("Multiple REACTIONS sections with " + "different units are not supported.") kineticsList = [] commentsList = [] diff --git a/src/SConscript b/src/SConscript index 6eef5b17a..4e81fb772 100644 --- a/src/SConscript +++ b/src/SConscript @@ -38,8 +38,8 @@ libs = [('base', ['cpp'], baseSetup), for subdir, extensions, setup in libs: localenv = env.Clone() - localenv.Append(CPPPATH=Dir('#include')) - localenv.Append(CPPPATH=Dir('#src')) # todo: remove when not needed + localenv.Prepend(CPPPATH=Dir('#include')) + localenv.Prepend(CPPPATH=Dir('#src')) # todo: remove when not needed source = setup(localenv, subdir, extensions) objects = localenv.SharedObject(source) localenv.Depends(objects, localenv['config_h_target']) diff --git a/src/apps/SConscript b/src/apps/SConscript index 0a9752080..c0730c97f 100644 --- a/src/apps/SConscript +++ b/src/apps/SConscript @@ -2,7 +2,7 @@ from buildutils import * Import('env', 'build', 'install') localenv = env.Clone() -localenv.Append(CPPPATH=['#src', '#include', '#src/apps']) +localenv.Prepend(CPPPATH=['#src', '#include', '#src/apps']) def buildProgram(name, src): prog = build(localenv.Program(target=pjoin('#build/bin', name), diff --git a/src/fortran/SConscript b/src/fortran/SConscript index c2c3b91d0..f84cd4757 100644 --- a/src/fortran/SConscript +++ b/src/fortran/SConscript @@ -3,7 +3,7 @@ from buildutils import * Import('env', 'build', 'install') localenv = env.Clone() -localenv.Append(CPPPATH=['#include', '#src']) +localenv.Prepend(CPPPATH=['#include', '#src']) f90_src = mglob(localenv, '.', 'f90', 'cpp') diff --git a/src/matlab/SConscript b/src/matlab/SConscript index 8513e993d..5e7a628ba 100644 --- a/src/matlab/SConscript +++ b/src/matlab/SConscript @@ -53,8 +53,8 @@ elif os.name == 'posix': linkflags.extend(['-Wl,--no-undefined', '-Wl,--version-script,src/matlab/mexFunction.map']) -localenv.Append(CPPPATH=['#include', '#src', matlab_include], - CPPDEFINES=['MATLAB_MEX_FILE'], +localenv.Prepend(CPPPATH=['#include', '#src', matlab_include]) +localenv.Append(CPPDEFINES=['MATLAB_MEX_FILE'], LIBPATH=[matlab_libs], LINKFLAGS=linkflags) diff --git a/src/python/SConscript b/src/python/SConscript index f96f6d47f..9bb4bad3c 100644 --- a/src/python/SConscript +++ b/src/python/SConscript @@ -31,7 +31,7 @@ make_setup = localenv.SubstFile('#interfaces/python/setup.py', extraArgs = '' if localenv['python_package'] == 'full': - localenv.Append(CPPPATH=['#src', '#include']) + localenv.Prepend(CPPPATH=['#src', '#include']) cantera_libname = 'cantera_shared' if os.name=='nt' else 'cantera' #pylinklibs = [cantera_libname, 'cvode', 'ctmath', 'ctlapack', 'ctblas', 'ctf2c', 'execstream'] diff --git a/test/SConscript b/test/SConscript index aa32410ec..e4bd48ce6 100644 --- a/test/SConscript +++ b/test/SConscript @@ -4,9 +4,9 @@ import subprocess Import('env','build','install') localenv = env.Clone() -localenv.Append(CPPPATH=['#ext/gtest/include', '#include'], - LIBPATH='#build/lib', - LIBS=['gtest'] + localenv['cantera_libs']) +localenv.Prepend(CPPPATH=['#ext/gtest/include', '#include'], + LIBPATH='#build/lib') +localenv.Append(LIBS=['gtest'] + localenv['cantera_libs']) localenv['ENV']['PYTHONPATH'] = Dir('#interfaces/python').abspath localenv['ENV']['CANTERA_DATA'] = Dir('#build/data').abspath diff --git a/test_problems/SConscript b/test_problems/SConscript index 92f60dbdd..8317aa280 100644 --- a/test_problems/SConscript +++ b/test_problems/SConscript @@ -2,7 +2,7 @@ from buildutils import * Import('env','build','install') localenv = env.Clone() -localenv.Append(CPPPATH=['#include', '#src', 'shared']) +localenv.Prepend(CPPPATH=['#include', '#src', 'shared']) os.environ['PYTHONPATH'] = pjoin(os.getcwd(), '..', 'interfaces', 'python') os.environ['CANTERA_DATA'] = pjoin(os.getcwd(), '..', 'build', 'data')