diff --git a/test_problems/diamondSurf/Makefile.in b/test_problems/diamondSurf/Makefile.in index 4f1b1c4db..4c845febc 100644 --- a/test_problems/diamondSurf/Makefile.in +++ b/test_problems/diamondSurf/Makefile.in @@ -2,38 +2,24 @@ ############################################################################ # -# Makefile input to compile the Particles library within Cantera. +# Makefile to compile and link a C++ application to +# Cantera. # ############################################################################# # the name of the executable program to be created -LIBP = libParticles.a +PROG_NAME = runDiamond # the object files to be linked together. List those generated from Fortran # and from C/C++ separately -LIBOBJS = GasParticle.o GasParticleMixture.o GasSectionParticle.o GSP_init.o \ - GSP_src.o romberg.o romberg2D.o search.o \ - IdealReactingGas.o sectionBF.o sectionBF1.o sectionBF2.o \ - sectionBF1divv.o PartDiscGalerkin.o PartCoagulation.o \ - romberg2DLinear.o \ - PartInterfaceKinetics.o \ - SurfRxnModels.o PartKineticsFactory.o ParticleSurfRxn.o \ - PSR_InterfaceKinetics.o Placid.o\ - IdealSolidSolnPhase.o SolidKinetics.o +OBJS = runDiamond.o # additional flags to be passed to the linker. If your program # requires other external libraries, put them here LINK_OPTIONS = - ############################################################################# -# the Fortran compiler -FORT = @F77@ - -# Fortran compile flags -FORT_FLAGS = @FFLAGS@ - # Fortran libraries FORT_LIBS = @FLIBS@ @@ -41,88 +27,58 @@ FORT_LIBS = @FLIBS@ CXX = @CXX@ # C++ compile flags -CXX_FLAGS = @CXXFLAGS@ $(CXX_OPT) +CXX_FLAGS = @CXXFLAGS@ # external libraries -EXT_LIBS = @LOCAL_LIBS@ +EXT_LIBS = @LOCAL_LIBS@ -lctcxx # Ending C++ linking libraries LCXX_END_LIBS = @LCXX_END_LIBS@ - -#------ you probably don't have to change anything below this line ----- - - -# The directory where the Cantera libraries are located +# the directory where the Cantera libraries are located CANTERA_LIBDIR=@buildlib@ -CANTERA_LIBDEP=$(CANTERA_LIBDIR)/libcantera.a -# Required Cantera libraries -CANTERA_LIBS = -ltransport -lcantera -lctcxx +# required Cantera libraries +CANTERA_LIBS = -# The directory where Cantera include files may be found. -# CANTERA_INCDIR=@CANTERA_INCDIR@ -KERNEL_INCDIR= ../../src -CANTERA_INCDIR= ../../../include -# Flags passed to the C++ compiler/linker for the linking step +# the directory where Cantera include files may be found. +CANTERA_INCDIR=@ctroot@/build/include/cantera + +# flags passed to the C++ compiler/linker for the linking step LCXX_FLAGS = -L$(CANTERA_LIBDIR) @CXXFLAGS@ -# How to compile C++ source files to object files -.@CXX_EXT@.@OBJ_EXT@: - $(CXX) -c $< -I../util_src -I$(KERNEL_INCDIR) $(CXX_FLAGS) +# how to compile C++ source files to object files +.@CXX_EXT@.@OBJ_EXT@: Interface.h + $(CXX) -c $< -I$(CANTERA_INCDIR) $(CXX_FLAGS) -# How to compile Fortran source files to object files -.@F77_EXT@.@OBJ_EXT@: - $(FORT) -c $< -I../util_src $(FORT_FLAGS) +PROGRAM = $(PROG_NAME)$(EXE_EXT) +all: $(PROGRAM) -all: $(LIBOBJS) ISSPTester SK_ISSPTester ctitoxml xmlcopyTester +$(PROGRAM): $(OBJS) $(CANTERA_LIBDIR)/libcantera.a + $(CXX) -o $(PROGRAM) $(OBJS) $(LCXX_FLAGS) $(CANTERA_LIBS) \ + $(LINK_OPTIONS) $(EXT_LIBS) @LIBS@ $(FORT_LIBS) \ + $(LCXX_END_LIBS) -DEPENDS=$(LIBOBJS:.o=.d) - -%.d: - g++ -MM -I../util_src -I$(KERNEL_INCDIR) $(CXX_FLAGS) $*.cpp > $*.d - -$(LIBP): $(LIBOBJS) - @ARCHIVE@ $(LIBP) $(LIBOBJS) - -#################################################################### -# Executable Programs -#################################################################### - - -ISSPTester: ISSPTester.o $(LIBP) $(CANTERA_LIBDEP) - $(CXX) -o ISSPTester ISSPTester.o -L. -lParticles \ - -L$(CANTERA_LIBDIR) $(CANTERA_LIBS) -lcvode -lctlapack -lctblas \ - -lgcc -lg2c -lstdc++ -lm - -SK_ISSPTester: SK_ISSPTester.o $(LIBP) $(CANTERA_LIBDEP) - $(CXX) -o SK_ISSPTester SK_ISSPTester.o -L. -lParticles \ - -L$(CANTERA_LIBDIR) $(CANTERA_LIBS) -lcvode -lctlapack -lctblas \ - -lgcc -lg2c -lstdc++ -lm - -ctitoxml: ctitoxml.o $(LIBP) $(CANTERA_LIBDEP) - $(CXX) -o ctitoxml ctitoxml.o \ - -L$(CANTERA_LIBDIR) $(CANTERA_LIBS) -lcvode -lctlapack -lctblas \ - -lgcc -lg2c -lstdc++ -lm - -xmlcopyTester: xmlcopyTester.o $(LIBP) $(CANTERA_LIBDEP) - $(CXX) -o xmlcopyTester xmlcopyTester.o \ - -L$(CANTERA_LIBDIR) $(CANTERA_LIBS) -lcvode -lctlapack -lctblas \ - -lgcc -lg2c -lstdc++ -lm +$(OBJS): +test: + @MAKE@ $(PROGRAM) + ./runtest clean: - $(RM) $(LIBOBJS) $(LIBGP) + $(RM) $(OBJS) $(PROGRAM) + ../../bin/rm_cvsignore + + + + + + + + + -depends: $(DEPENDS) - cat *.d > .depends - $(RM) $(DEPENDS) -TAGS: - etags *.h *.cpp -ifeq ($(wildcard .depends), .depends) -include .depends -endif diff --git a/test_problems/diamondSurf/runDiamond.cpp b/test_problems/diamondSurf/runDiamond.cpp index 648fb3598..d52f84005 100644 --- a/test_problems/diamondSurf/runDiamond.cpp +++ b/test_problems/diamondSurf/runDiamond.cpp @@ -40,6 +40,14 @@ static void printUsage() using namespace Cantera; +void printDbl(double val) { + if (fabs(val) < 2.0E-17) { + cout << " nil"; + } else { + cout << val; + } +} + int main(int argc, char** argv) { int i, k; string infile = "diamond.cti"; @@ -102,7 +110,7 @@ int main(int argc, char** argv) { for (i = 0; i < 20; i++) src[i] = 0.0; iKin_ptr->getNetProductionRates(src); double sum = 0.0; - double naH; + double naH = 0.0; for (k = 0; k < 13; k++) { if (k < 4) { naH = gasTP->nAtoms(k, 0); @@ -113,16 +121,15 @@ int main(int argc, char** argv) { naH = diamond100TP->nAtoms(itp, 0); } cout << k << " " << naH << " " ; - if (fabs(src[k]) < 2.0E-17) { - cout << " nil" << endl; - } else { - cout << src[k] << endl; - } + printDbl(src[k]); + cout << endl; sum += naH * src[k]; } - cout << "sum = " << sum << endl; + cout << "sum = "; + printDbl(sum); + cout << endl; double mwd = diamondTP->molecularWeight(0); double dens = diamondTP->density(); double gr = src[4] * mwd / dens; diff --git a/test_problems/diamondSurf/runDiamond_blessed.out b/test_problems/diamondSurf/runDiamond_blessed.out index 99b87bec7..99d1b45ac 100644 --- a/test_problems/diamondSurf/runDiamond_blessed.out +++ b/test_problems/diamondSurf/runDiamond_blessed.out @@ -2,11 +2,11 @@ Number of species = 4 Number of species in diamond = 1 Number of species in diamond_100 = 8 Number of reactions = 20 -0 1 -8.96125e-05 -1 2 4.48274e-05 -2 3 -1.41433e-08 +0 1 -8.95751e-05 +1 2 4.48403e-05 +2 3 -3.51539e-08 3 4 nil -4 0 1.41433e-08 +4 0 3.51539e-08 5 2 nil 6 1 nil 7 1 nil @@ -15,14 +15,14 @@ Number of reactions = 20 10 3 nil 11 3 nil 12 2 nil -sum = -1.6718e-20 -growth rate = 0.173736 microns per hour +sum = nil +growth rate = 0.43183 microns per hour Coverages: -0 c6HH 0.46339 -1 c6H* 0.0371799 -2 c6*H 0.47592 -3 c6** 0.0223553 -4 c6HM 4.1206e-05 -5 c6HM* 1.03105e-05 -6 c6*M 0.00106559 -7 c6B 3.82635e-05 +0 c6HH 0.462262 +1 c6H* 0.037052 +2 c6*H 0.474283 +3 c6** 0.0219445 +4 c6HM 0.00174648 +5 c6HM* 2.56272e-05 +6 c6*M 0.00264858 +7 c6B 3.8171e-05