diff --git a/test_problems/silane_equil/IdealGasMix.h b/test_problems/silane_equil/IdealGasMix.h new file mode 100644 index 000000000..f84d0be95 --- /dev/null +++ b/test_problems/silane_equil/IdealGasMix.h @@ -0,0 +1,52 @@ +#ifndef CXX_IDEALGASMIX +#define CXX_IDEALGASMIX + +#include + +#include "IdealGasPhase.h" +#include "GasKinetics.h" +#include "importCTML.h" + +namespace Cantera { + + class IdealGasMix : + public IdealGasPhase, public GasKinetics + { + public: + + IdealGasMix() : m_ok(false), m_r(0) {} + + IdealGasMix(string infile, string id="") : m_ok(false), m_r(0) { + + m_r = get_XML_File(infile); + if (id == "-") id = ""; + m_ok = buildSolutionFromXML(*m_r, id, "phase", this, this); + if (!m_ok) throw CanteraError("IdealGasMix", + "buildSolutionFromXML returned false"); + } + + + IdealGasMix(XML_Node& root, string id) : m_ok(false), m_r(0) { + m_ok = buildSolutionFromXML(root, id, "phase", this, this); + } + + virtual ~IdealGasMix() {} + + bool operator!() { return !m_ok;} + bool ready() { return m_ok; } + friend ostream& operator<<(ostream& s, IdealGasMix& mix) { + string r = report(mix, true); + s << r; + return s; + } + + protected: + bool m_ok; + XML_Node* m_r; + + private: + }; +} + + +#endif diff --git a/test_problems/silane_equil/Makefile.in b/test_problems/silane_equil/Makefile.in index fad215e5b..3c4107181 100644 --- a/test_problems/silane_equil/Makefile.in +++ b/test_problems/silane_equil/Makefile.in @@ -17,6 +17,10 @@ PROG_NAME = silane_equil # and from C/C++ separately OBJS = silane_equil.o +# Location of the current build. Will assume that tests are run +# in the source directory tree location +src_dir_tree = 1 + # additional flags to be passed to the linker. If your program # requires other external libraries, put them here LINK_OPTIONS = @EXTRA_LINK@ @@ -33,7 +37,11 @@ FORT_LIBS = @FLIBS@ CXX = @CXX@ # C++ compile flags +ifeq ($(src_dir_tree), 1) +CXX_FLAGS = -DSRCDIRTREE @CXXFLAGS@ +else CXX_FLAGS = @CXXFLAGS@ +endif # Ending C++ linking libraries LCXX_END_LIBS = @LCXX_END_LIBS@ @@ -45,7 +53,11 @@ CANTERA_LIBDIR=@buildlib@ CANTERA_LIBS = @LOCAL_LIBS@ -lctcxx # the directory where Cantera include files may be found. +ifeq ($(src_dir_tree), 1) +CANTERA_INCDIR=../../Cantera/src +else CANTERA_INCDIR=@ctroot@/build/include/cantera +endif # flags passed to the C++ compiler/linker for the linking step LCXX_FLAGS = -L$(CANTERA_LIBDIR) @LOCAL_LIB_DIRS@ @CXXFLAGS@ diff --git a/test_problems/silane_equil/output_blessed.txt b/test_problems/silane_equil/output_blessed.txt index a1bb95546..b8b248068 100644 --- a/test_problems/silane_equil/output_blessed.txt +++ b/test_problems/silane_equil/output_blessed.txt @@ -44,7 +44,7 @@ For species SI2, discontinuity in s/R detected at Tmid = 1000 H 0.000559189 0.000246765 -12.7639 HE 0 0 SIH4 1.05394e-07 1.48198e-06 -50.9842 - SI 0.00105469 0.0129687 0.0713037 + SI 0.00105469 0.0129687 0.0713036 SIH 1.2607e-05 0.000160581 -12.6926 SIH2 1.1852e-05 0.000156195 -25.4564 SIH3 1.18896e-07 1.61938e-06 -38.2203 diff --git a/test_problems/silane_equil/silane.xml b/test_problems/silane_equil/silane.xml index 49d3c6d5b..a14a81351 100644 --- a/test_problems/silane_equil/silane.xml +++ b/test_problems/silane_equil/silane.xml @@ -22,12 +22,12 @@ 2.344331120E+00, 7.980520750E-03, -1.947815100E-05, 2.015720940E-08, - -7.376117610E-12, -9.179351730E+02, 6.830102380E-01, + -7.376117610E-12, -9.179351730E+02, 6.830102380E-01 3.337279200E+00, -4.940247310E-05, 4.994567780E-07, -1.795663940E-10, - 2.002553760E-14, -9.501589220E+02, -3.205023310E+00, + 2.002553760E-14, -9.501589220E+02, -3.205023310E+00 @@ -39,12 +39,12 @@ 2.500000000E+00, 7.053328190E-13, -1.995919640E-15, 2.300816320E-18, - -9.277323320E-22, 2.547365990E+04, -4.466828530E-01, + -9.277323320E-22, 2.547365990E+04, -4.466828530E-01 2.500000010E+00, -2.308429730E-11, 1.615619480E-14, -4.735152350E-18, - 4.981973570E-22, 2.547365990E+04, -4.466829140E-01, + 4.981973570E-22, 2.547365990E+04, -4.466829140E-01 @@ -56,12 +56,12 @@ 2.500000000E+00, 0.000000000E+00, 0.000000000E+00, 0.000000000E+00, - 0.000000000E+00, -7.453750000E+02, 9.153488000E-01, + 0.000000000E+00, -7.453750000E+02, 9.153488000E-01 2.500000000E+00, 0.000000000E+00, 0.000000000E+00, 0.000000000E+00, - 0.000000000E+00, -7.453750000E+02, 9.153489000E-01, + 0.000000000E+00, -7.453750000E+02, 9.153489000E-01 @@ -73,12 +73,12 @@ 1.451640400E+00, 1.398736300E-02, -4.234563900E-06, -2.360614200E-09, - 1.371208900E-12, 3.113410500E+03, 1.232185500E+01, + 1.371208900E-12, 3.113410500E+03, 1.232185500E+01 7.935938000E-01, 1.767189900E-02, -1.139800900E-05, 3.599260400E-09, - -4.524157100E-13, 3.198212700E+03, 1.524225700E+01, + -4.524157100E-13, 3.198212700E+03, 1.524225700E+01 @@ -90,12 +90,12 @@ 3.179353700E+00, -2.764699200E-03, 4.478403800E-06, -3.283317700E-09, - 9.121363100E-13, 5.333903200E+04, 2.727320400E+00, + 9.121363100E-13, 5.333903200E+04, 2.727320400E+00 2.650601400E+00, -3.576385200E-04, 2.959229300E-07, -7.280482900E-11, - 5.796332900E-15, 5.343705400E+04, 5.220405700E+00, + 5.796332900E-15, 5.343705400E+04, 5.220405700E+00 @@ -107,12 +107,12 @@ 3.836010000E+00, -2.702657000E-03, 6.849070000E-06, -5.424184000E-09, - 1.472131000E-12, 4.507593000E+04, 9.350778000E-01, + 1.472131000E-12, 4.507593000E+04, 9.350778000E-01 3.110430000E+00, 1.094946000E-03, 2.898629000E-08, -2.745104000E-10, - 7.051799000E-14, 4.516898000E+04, 4.193487000E+00, + 7.051799000E-14, 4.516898000E+04, 4.193487000E+00 @@ -124,12 +124,12 @@ 3.475092000E+00, 2.139338000E-03, 7.672306000E-07, 5.217668000E-10, - -9.898824000E-13, 3.147397000E+04, 4.436585000E+00, + -9.898824000E-13, 3.147397000E+04, 4.436585000E+00 4.142390000E+00, 2.150191000E-03, -2.190730000E-07, -2.073725000E-10, - 4.741018000E-14, 3.110484000E+04, 2.930745000E-01, + 4.741018000E-14, 3.110484000E+04, 2.930745000E-01 @@ -141,12 +141,12 @@ 2.946733000E+00, 6.466764000E-03, 5.991653000E-07, -2.218413000E-09, - 3.052670000E-13, 2.270173000E+04, 7.347948000E+00, + 3.052670000E-13, 2.270173000E+04, 7.347948000E+00 5.015906000E+00, 3.732750000E-03, -3.609053000E-07, -3.729193000E-10, - 8.468490000E-14, 2.190233000E+04, -4.291368000E+00, + 8.468490000E-14, 2.190233000E+04, -4.291368000E+00 @@ -158,12 +158,12 @@ 3.698707000E+00, 1.870180000E-02, -1.430704000E-05, 6.005836000E-09, - -1.116293000E-12, 3.590825000E+04, 8.825191000E+00, + -1.116293000E-12, 3.590825000E+04, 8.825191000E+00 1.127202000E+01, 2.538145000E-03, -2.998472000E-07, -9.465367000E-11, - 1.855053000E-14, 3.297169000E+04, -3.264598000E+01, + 1.855053000E-14, 3.297169000E+04, -3.264598000E+01 @@ -175,12 +175,12 @@ 6.734798300E-01, 4.093153100E-02, -4.484125500E-05, 2.995223200E-08, - -8.901085400E-12, 7.932787500E+03, 1.862740300E+01, + -8.901085400E-12, 7.932787500E+03, 1.862740300E+01 3.407493600E+00, 2.720647900E-02, -1.771320400E-05, 5.639117700E-09, - -7.137868200E-13, 7.532184200E+03, 6.132175400E+00, + -7.137868200E-13, 7.532184200E+03, 6.132175400E+00 @@ -192,12 +192,12 @@ 5.133186000E+00, 1.252855000E-02, -4.620421000E-07, -6.606075000E-09, - 2.864345000E-12, 2.956915000E+04, 7.605133000E-01, + 2.864345000E-12, 2.956915000E+04, 7.605133000E-01 8.986817000E+00, 5.405047000E-03, -5.214022000E-07, -5.313742000E-10, - 1.188727000E-13, 2.832748000E+04, -2.004478000E+01, + 1.188727000E-13, 2.832748000E+04, -2.004478000E+01 @@ -209,12 +209,12 @@ 7.719684600E-01, 6.344274000E-02, -7.672610900E-05, 5.454371500E-08, - -1.661172900E-11, 1.207126300E+04, 2.153250700E+01, + -1.661172900E-11, 1.207126300E+04, 2.153250700E+01 6.093334100E+00, 3.658011200E-02, -2.389236100E-05, 7.627193200E-09, - -9.676938400E-13, 1.129720500E+04, -2.747565400E+00, + -9.676938400E-13, 1.129720500E+04, -2.747565400E+00 @@ -226,12 +226,12 @@ 2.967197600E+00, 6.311955800E-03, -1.097079000E-05, 8.927868000E-09, - -2.787368900E-12, 6.987073800E+04, 9.278950300E+00, + -2.787368900E-12, 6.987073800E+04, 9.278950300E+00 4.144677900E+00, 6.523467700E-04, -5.010852000E-07, 1.806284300E-10, - -2.516111100E-14, 6.969470700E+04, 3.862736600E+00, + -2.516111100E-14, 6.969470700E+04, 3.862736600E+00 @@ -243,12 +243,12 @@ 4.597912900E+00, 1.071527400E-02, -1.610042200E-05, 1.096920700E-08, - -2.783287500E-12, 7.476632400E+04, 3.442167100E+00, + -2.783287500E-12, 7.476632400E+04, 3.442167100E+00 7.421336000E+00, -1.170994800E-04, 8.982077500E-08, 7.193596400E-12, - -2.567083700E-15, 7.414669900E+04, -1.036527400E+01, + -2.567083700E-15, 7.414669900E+04, -1.036527400E+01 diff --git a/test_problems/silane_equil/silane_equil.cpp b/test_problems/silane_equil/silane_equil.cpp index 2bf2e97d9..e0560b8b3 100644 --- a/test_problems/silane_equil/silane_equil.cpp +++ b/test_problems/silane_equil/silane_equil.cpp @@ -8,9 +8,16 @@ * */ +#ifdef SRCDIRTREE +#include "ct_defs.h" +#include "ThermoPhase.h" +#include "IdealGasMix.h" +#include "equil.h" +#else #include "Cantera.h" #include "IdealGasMix.h" #include "equilibrium.h" +#endif int main(int argc, char **argv) { try {