diff --git a/test/SConscript b/test/SConscript index d026a6771..52158445c 100644 --- a/test/SConscript +++ b/test/SConscript @@ -119,7 +119,8 @@ addTestProgram('thermo', 'nasapoly') if localenv['python_package'] == 'full': addTestScript('python', 'runTests.py', interpreter=sys.executable, - dependencies=['testSolution.py', localenv['python_module']]) + dependencies=['testSolution.py', 'testReactors.py', + localenv['python_module']]) if localenv['matlab_toolbox'] == 'y': addMatlabTest('runCanteraTests.m', diff --git a/test/data/CombustorTest-integrateWithAdvance.csv b/test/data/CombustorTest-integrateWithAdvance.csv new file mode 100644 index 000000000..5ebf36f72 --- /dev/null +++ b/test/data/CombustorTest-integrateWithAdvance.csv @@ -0,0 +1,100 @@ +2.500000e-03, 3.000239e+02, 6.059886e-03, 8.824431e-10, 8.079887e-12, 6.059766e-03, 1.963675e-10, 2.001948e-10, 1.195364e-07, 8.341401e-10, 9.878802e-01 +5.000000e-03, 3.000250e+02, 1.193618e-02, 7.604985e-10, 2.207130e-11, 1.193586e-02, 2.359906e-10, 1.114248e-09, 3.070840e-07, 1.002044e-08, 9.761276e-01 +7.500000e-03, 3.000278e+02, 1.763446e-02, 8.635001e-10, 3.905857e-11, 1.763384e-02, 3.246143e-10, 3.086084e-09, 5.738788e-07, 4.865817e-08, 9.647311e-01 +1.000000e-02, 3.000334e+02, 2.316017e-02, 1.088059e-09, 5.784065e-11, 2.315909e-02, 4.819667e-10, 7.184873e-09, 9.218762e-07, 1.594431e-07, 9.536796e-01 +1.250000e-02, 3.000436e+02, 2.851859e-02, 1.442291e-09, 8.143767e-11, 2.851683e-02, 7.281175e-10, 1.532534e-08, 1.347057e-06, 4.127781e-07, 9.429628e-01 +1.500000e-02, 3.000613e+02, 3.371487e-02, 1.964114e-09, 1.145486e-10, 3.371211e-02, 1.104382e-09, 3.084504e-08, 1.852321e-06, 9.127330e-07, 9.325702e-01 +1.750000e-02, 3.000908e+02, 3.875408e-02, 2.713356e-09, 1.618349e-10, 3.874982e-02, 1.676244e-09, 5.958958e-08, 2.453313e-06, 1.811614e-06, 9.224918e-01 +2.000000e-02, 3.001384e+02, 4.364118e-02, 3.774159e-09, 2.289035e-10, 4.363467e-02, 2.539171e-09, 1.117811e-07, 3.173021e-06, 3.336810e-06, 9.127175e-01 +2.250000e-02, 3.002136e+02, 4.838108e-02, 5.260522e-09, 3.231754e-10, 4.837121e-02, 3.825424e-09, 2.050658e-07, 4.035655e-06, 5.826490e-06, 9.032376e-01 +2.500000e-02, 3.003301e+02, 5.297869e-02, 7.324050e-09, 4.544962e-10, 5.296383e-02, 5.712831e-09, 3.693731e-07, 5.065473e-06, 9.773240e-06, 8.940423e-01 +2.750000e-02, 3.005075e+02, 5.743896e-02, 1.016371e-08, 6.358324e-10, 5.741673e-02, 8.434440e-09, 6.545868e-07, 6.287811e-06, 1.587887e-05, 8.851215e-01 +3.000000e-02, 3.007733e+02, 6.176695e-02, 1.403819e-08, 8.841521e-10, 6.173395e-02, 1.228763e-08, 1.142498e-06, 7.729962e-06, 2.512306e-05, 8.764651e-01 +3.250000e-02, 3.011657e+02, 6.596792e-02, 1.928178e-08, 1.221611e-09, 6.591933e-02, 1.764262e-08, 1.965198e-06, 9.421905e-06, 3.884664e-05, 8.680625e-01 +3.500000e-02, 3.017366e+02, 7.004741e-02, 2.632592e-08, 1.677219e-09, 6.997652e-02, 2.495180e-08, 3.333163e-06, 1.139735e-05, 5.884895e-05, 8.599024e-01 +3.750000e-02, 3.025557e+02, 7.401141e-02, 3.572978e-08, 2.289321e-09, 7.390897e-02, 3.476426e-08, 5.578106e-06, 1.369541e-05, 8.749687e-05, 8.519728e-01 +4.000000e-02, 3.037152e+02, 7.786647e-02, 4.822575e-08, 3.109438e-09, 7.771993e-02, 4.775340e-08, 9.218790e-06, 1.636312e-05, 1.278403e-04, 8.442601e-01 +4.250000e-02, 3.053355e+02, 8.161988e-02, 6.478990e-08, 4.208407e-09, 8.141244e-02, 6.477128e-08, 1.506365e-05, 1.945921e-05, 1.837239e-04, 8.367493e-01 +4.500000e-02, 3.075719e+02, 8.527984e-02, 8.675330e-08, 5.686374e-09, 8.498937e-02, 8.695039e-08, 2.437426e-05, 2.305926e-05, 2.598782e-04, 8.294233e-01 +4.750000e-02, 3.106230e+02, 8.885571e-02, 1.159807e-07, 7.689291e-09, 8.845345e-02, 1.158830e-07, 3.913286e-05, 2.726264e-05, 3.619573e-04, 8.222622e-01 +5.000000e-02, 3.147414e+02, 9.235815e-02, 1.551607e-07, 1.043649e-08, 9.180736e-02, 1.539253e-07, 6.249274e-05, 3.220133e-05, 4.964676e-04, 8.152430e-01 +5.250000e-02, 3.202468e+02, 9.579936e-02, 2.082814e-07, 1.426745e-08, 9.505385e-02, 2.047012e-07, 9.955869e-05, 3.805043e-05, 6.704823e-04, 8.083383e-01 +5.500000e-02, 3.275461e+02, 9.919318e-02, 2.814265e-07, 1.972263e-08, 9.819605e-02, 2.739369e-07, 1.587763e-04, 4.503935e-05, 8.909529e-04, 8.015154e-01 +5.750000e-02, 3.371625e+02, 1.025550e-01, 3.841430e-07, 2.768710e-08, 1.012380e-01, 3.708553e-07, 2.544684e-04, 5.346069e-05, 1.163272e-03, 7.947351e-01 +6.000000e-02, 3.497830e+02, 1.059010e-01, 5.319095e-07, 3.965573e-08, 1.041854e-01, 5.105505e-07, 4.115815e-04, 6.366992e-05, 1.488492e-03, 7.879488e-01 +6.250000e-02, 3.663440e+02, 1.092463e-01, 7.509652e-07, 5.825411e-08, 1.070469e-01, 7.181193e-07, 6.748024e-04, 7.606007e-05, 1.858218e-03, 7.810962e-01 +6.500000e-02, 3.881970e+02, 1.125985e-01, 1.089103e-06, 8.837170e-08, 1.098352e-01, 1.036120e-06, 1.126711e-03, 9.097454e-05, 2.245810e-03, 7.741006e-01 +6.750000e-02, 4.174734e+02, 1.159393e-01, 1.644860e-06, 1.400541e-07, 1.125649e-01, 1.538967e-06, 1.926271e-03, 1.084570e-04, 2.592402e-03, 7.668654e-01 +7.000000e-02, 4.580074e+02, 1.191668e-01, 2.667449e-06, 2.376582e-07, 1.152359e-01, 2.363495e-06, 3.400840e-03, 1.274822e-04, 2.786977e-03, 7.592767e-01 +7.250000e-02, 5.181427e+02, 1.218964e-01, 5.007182e-06, 4.566780e-07, 1.177551e-01, 3.767927e-06, 6.312825e-03, 1.432019e-04, 2.641550e-03, 7.512417e-01 +7.500000e-02, 6.204753e+02, 1.227113e-01, 1.277621e-05, 1.112691e-06, 1.196008e-01, 5.984195e-06, 1.276238e-02, 1.389242e-04, 1.884082e-03, 7.428826e-01 +7.750000e-02, 8.434530e+02, 1.155667e-01, 7.745047e-05, 1.102140e-05, 1.180431e-01, 1.268444e-05, 3.010736e-02, 9.570296e-05, 3.883501e-04, 7.356976e-01 +8.000000e-02, 2.197742e+03, 2.567608e-03, 9.466580e-04, 2.257526e-03, 6.387346e-02, 8.663829e-03, 1.675799e-01, 4.144136e-06, 1.588994e-07, 7.541067e-01 +8.250000e-02, 2.428391e+03, 4.639008e-03, 1.883731e-03, 3.855268e-03, 6.369824e-02, 1.420073e-02, 1.835091e-01, 6.600087e-06, 2.534663e-07, 7.282071e-01 +8.500000e-02, 2.589056e+03, 8.412096e-03, 4.037099e-03, 6.622664e-03, 6.254994e-02, 2.127162e-02, 1.939997e-01, 9.940492e-06, 3.860943e-07, 7.030965e-01 +8.750000e-02, 2.699491e+03, 1.312782e-02, 7.219037e-03, 9.867616e-03, 6.102578e-02, 2.815316e-02, 2.003563e-01, 1.283302e-05, 4.980843e-07, 6.802370e-01 +9.000000e-02, 2.778488e+03, 1.804601e-02, 1.096054e-02, 1.305294e-02, 5.940715e-02, 3.410831e-02, 2.040287e-01, 1.509149e-05, 5.835245e-07, 6.603807e-01 +9.250000e-02, 2.836859e+03, 2.273551e-02, 1.485051e-02, 1.592762e-02, 5.782680e-02, 3.901201e-02, 2.059782e-01, 1.678698e-05, 6.465320e-07, 6.436519e-01 +9.500000e-02, 2.880723e+03, 2.695503e-02, 1.858083e-02, 1.839119e-02, 5.637593e-02, 4.293184e-02, 2.068528e-01, 1.803044e-05, 6.920590e-07, 6.298937e-01 +9.750000e-02, 2.913684e+03, 3.056427e-02, 2.192680e-02, 2.041417e-02, 5.512725e-02, 4.598290e-02, 2.071110e-01, 1.892649e-05, 7.244446e-07, 6.188540e-01 +1.000000e-01, 2.937964e+03, 3.347973e-02, 2.472689e-02, 2.199991e-02, 5.413814e-02, 4.828135e-02, 2.070860e-01, 1.956315e-05, 7.472127e-07, 6.102677e-01 +1.025000e-01, 2.954986e+03, 3.565473e-02, 2.687064e-02, 2.316652e-02, 5.345178e-02, 4.992951e-02, 2.070191e-01, 2.001019e-05, 7.631042e-07, 6.038870e-01 +1.050000e-01, 2.965701e+03, 3.707065e-02, 2.829258e-02, 2.393795e-02, 5.309900e-02, 5.101169e-02, 2.070795e-01, 2.032025e-05, 7.741569e-07, 5.994876e-01 +1.075000e-01, 2.970763e+03, 3.773306e-02, 2.896876e-02, 2.433976e-02, 5.310056e-02, 5.159411e-02, 2.073776e-01, 2.053056e-05, 7.817954e-07, 5.968648e-01 +1.100000e-01, 2.970638e+03, 3.766968e-02, 2.891385e-02, 2.439731e-02, 5.346934e-02, 5.172651e-02, 2.079749e-01, 2.066500e-05, 7.869183e-07, 5.958269e-01 +1.125000e-01, 2.965675e+03, 3.692886e-02, 2.817756e-02, 2.413546e-02, 5.421200e-02, 5.144480e-02, 2.088916e-01, 2.073610e-05, 7.899814e-07, 5.961882e-01 +1.150000e-01, 2.956141e+03, 3.557788e-02, 2.683984e-02, 2.357901e-02, 5.532982e-02, 5.077429e-02, 2.101137e-01, 2.074699e-05, 7.910747e-07, 5.977639e-01 +1.175000e-01, 2.942256e+03, 3.370083e-02, 2.500473e-02, 2.275378e-02, 5.681878e-02, 4.973342e-02, 2.115997e-01, 2.069319e-05, 7.899971e-07, 6.003672e-01 +1.200000e-01, 2.924213e+03, 3.139566e-02, 2.279301e-02, 2.168792e-02, 5.866888e-02, 4.833777e-02, 2.132868e-01, 2.056459e-05, 7.863319e-07, 6.038086e-01 +1.225000e-01, 2.902197e+03, 2.877044e-02, 2.033410e-02, 2.041319e-02, 6.086289e-02, 4.660418e-02, 2.150969e-01, 2.034748e-05, 7.795272e-07, 6.078972e-01 +1.250000e-01, 2.876400e+03, 2.593860e-02, 1.775741e-02, 1.896605e-02, 6.337478e-02, 4.455483e-02, 2.169434e-01, 2.002683e-05, 7.689844e-07, 6.124442e-01 +1.275000e-01, 2.847041e+03, 2.301349e-02, 1.518402e-02, 1.738821e-02, 6.616821e-02, 4.222074e-02, 2.187378e-01, 1.958892e-05, 7.541546e-07, 6.172672e-01 +1.300000e-01, 2.814385e+03, 2.010243e-02, 1.271919e-02, 1.572632e-02, 6.919562e-02, 3.964438e-02, 2.203964e-01, 1.902404e-05, 7.346386e-07, 6.221959e-01 +1.325000e-01, 2.778757e+03, 1.730095e-02, 1.044650e-02, 1.403066e-02, 7.239837e-02, 3.688078e-02, 2.218466e-01, 1.832919e-05, 7.102814e-07, 6.270771e-01 +1.350000e-01, 2.740563e+03, 1.468765e-02, 8.424160e-03, 1.235260e-02, 7.570831e-02, 3.399673e-02, 2.230319e-01, 1.751021e-05, 6.812466e-07, 6.317805e-01 +1.375000e-01, 2.700300e+03, 1.232066e-02, 6.684090e-03, 1.074120e-02, 7.905116e-02, 3.106776e-02, 2.239160e-01, 1.658284e-05, 6.480539e-07, 6.362019e-01 +1.400000e-01, 2.658561e+03, 1.023585e-02, 5.233648e-03, 9.239278e-03, 8.235121e-02, 2.817307e-02, 2.244848e-01, 1.557234e-05, 6.115670e-07, 6.402660e-01 +1.425000e-01, 2.616023e+03, 8.447373e-03, 4.059796e-03, 7.879873e-03, 8.553694e-02, 2.538891e-02, 2.247457e-01, 1.451136e-05, 5.729257e-07, 6.439263e-01 +1.450000e-01, 2.573428e+03, 6.950176e-03, 3.134838e-03, 6.683789e-03, 8.854652e-02, 2.278184e-02, 2.247256e-01, 1.343648e-05, 5.334300e-07, 6.471633e-01 +1.475000e-01, 2.531537e+03, 5.724195e-03, 2.422713e-03, 5.658953e-03, 9.133202e-02, 2.040292e-02, 2.244660e-01, 1.238389e-05, 4.943977e-07, 6.499803e-01 +1.500000e-01, 2.491082e+03, 4.739388e-03, 1.884743e-03, 4.801639e-03, 9.386179e-02, 1.828430e-02, 2.240179e-01, 1.138537e-05, 4.570234e-07, 6.523984e-01 +1.525000e-01, 2.452712e+03, 3.960756e-03, 1.484065e-03, 4.099153e-03, 9.612047e-02, 1.643880e-02, 2.234352e-01, 1.046534e-05, 4.222697e-07, 6.544506e-01 +1.550000e-01, 2.416950e+03, 3.352628e-03, 1.188385e-03, 3.533201e-03, 9.810718e-02, 1.486210e-02, 2.227699e-01, 9.639476e-06, 3.908048e-07, 6.561766e-01 +1.575000e-01, 2.384170e+03, 2.881725e-03, 9.711551e-04, 3.083126e-03, 9.983238e-02, 1.353691e-02, 2.220675e-01, 8.914910e-06, 3.629921e-07, 6.576180e-01 +1.600000e-01, 2.354582e+03, 2.518938e-03, 8.115890e-04, 2.728452e-03, 1.013144e-01, 1.243769e-02, 2.213650e-01, 8.291562e-06, 3.389207e-07, 6.588153e-01 +1.625000e-01, 2.328250e+03, 2.240011e-03, 6.939910e-04, 2.450517e-03, 1.025760e-01, 1.153507e-02, 2.206903e-01, 7.764014e-06, 3.184618e-07, 6.598060e-01 +1.650000e-01, 2.305114e+03, 2.025447e-03, 6.068083e-04, 2.233286e-03, 1.036421e-01, 1.079928e-02, 2.200621e-01, 7.323468e-06, 3.013348e-07, 6.606234e-01 +1.675000e-01, 2.285014e+03, 1.859984e-03, 5.416782e-04, 2.063538e-03, 1.045375e-01, 1.020242e-02, 2.194914e-01, 6.959442e-06, 2.871717e-07, 6.612962e-01 +1.700000e-01, 2.267725e+03, 1.731897e-03, 4.926025e-04, 1.930692e-03, 1.052855e-01, 9.719718e-03, 2.189834e-01, 6.661059e-06, 2.755702e-07, 6.618492e-01 +1.725000e-01, 2.252984e+03, 1.632280e-03, 4.552934e-04, 1.826443e-03, 1.059079e-01, 9.329936e-03, 2.185384e-01, 6.417916e-06, 2.661331e-07, 6.623030e-01 +1.750000e-01, 2.240509e+03, 1.554415e-03, 4.266809e-04, 1.744357e-03, 1.064238e-01, 9.015357e-03, 2.181538e-01, 6.220588e-06, 2.584937e-07, 6.626751e-01 +1.775000e-01, 2.230020e+03, 1.493245e-03, 4.045564e-04, 1.679482e-03, 1.068502e-01, 8.761435e-03, 2.178250e-01, 6.060855e-06, 2.523283e-07, 6.629798e-01 +1.800000e-01, 2.221249e+03, 1.444957e-03, 3.873192e-04, 1.628019e-03, 1.072017e-01, 8.556362e-03, 2.175464e-01, 5.931739e-06, 2.473605e-07, 6.632291e-01 +1.825000e-01, 2.213949e+03, 1.406667e-03, 3.737985e-04, 1.587047e-03, 1.074909e-01, 8.390610e-03, 2.173120e-01, 5.827432e-06, 2.433601e-07, 6.634329e-01 +1.850000e-01, 2.207896e+03, 1.376180e-03, 3.631293e-04, 1.554319e-03, 1.077283e-01, 8.256520e-03, 2.171161e-01, 5.743165e-06, 2.401381e-07, 6.635995e-01 +1.875000e-01, 2.202894e+03, 1.351819e-03, 3.546662e-04, 1.528098e-03, 1.079231e-01, 8.147945e-03, 2.169530e-01, 5.675057e-06, 2.375413e-07, 6.637355e-01 +1.900000e-01, 2.198770e+03, 1.332290e-03, 3.479227e-04, 1.507032e-03, 1.080825e-01, 8.059948e-03, 2.168179e-01, 5.619971e-06, 2.354464e-07, 6.638465e-01 +1.925000e-01, 2.195377e+03, 1.316592e-03, 3.425285e-04, 1.490068e-03, 1.082130e-01, 7.988568e-03, 2.167063e-01, 5.575379e-06, 2.337544e-07, 6.639371e-01 +1.950000e-01, 2.192591e+03, 1.303941e-03, 3.381993e-04, 1.476378e-03, 1.083197e-01, 7.930618e-03, 2.166143e-01, 5.539249e-06, 2.323862e-07, 6.640111e-01 +1.975000e-01, 2.190305e+03, 1.293725e-03, 3.347148e-04, 1.465310e-03, 1.084070e-01, 7.883536e-03, 2.165386e-01, 5.509948e-06, 2.312785e-07, 6.640714e-01 +2.000000e-01, 2.188433e+03, 1.285461e-03, 3.319036e-04, 1.456348e-03, 1.084782e-01, 7.845255e-03, 2.164764e-01, 5.486164e-06, 2.303806e-07, 6.641207e-01 +2.025000e-01, 2.186899e+03, 1.278764e-03, 3.296307e-04, 1.449081e-03, 1.085364e-01, 7.814111e-03, 2.164254e-01, 5.466841e-06, 2.296521e-07, 6.641608e-01 +2.050000e-01, 2.185644e+03, 1.273331e-03, 3.277900e-04, 1.443180e-03, 1.085840e-01, 7.788757e-03, 2.163837e-01, 5.451131e-06, 2.290604e-07, 6.641936e-01 +2.075000e-01, 2.184618e+03, 1.268918e-03, 3.262969e-04, 1.438385e-03, 1.086228e-01, 7.768107e-03, 2.163494e-01, 5.438349e-06, 2.285794e-07, 6.642204e-01 +2.100000e-01, 2.183779e+03, 1.265330e-03, 3.250845e-04, 1.434485e-03, 1.086545e-01, 7.751279e-03, 2.163214e-01, 5.427942e-06, 2.281881e-07, 6.642422e-01 +2.125000e-01, 2.183093e+03, 1.262410e-03, 3.240988e-04, 1.431310e-03, 1.086804e-01, 7.737561e-03, 2.162985e-01, 5.419465e-06, 2.278695e-07, 6.642600e-01 +2.150000e-01, 2.182532e+03, 1.260032e-03, 3.232968e-04, 1.428724e-03, 1.087016e-01, 7.726373e-03, 2.162798e-01, 5.412556e-06, 2.276100e-07, 6.642746e-01 +2.175000e-01, 2.182073e+03, 1.258095e-03, 3.226437e-04, 1.426616e-03, 1.087189e-01, 7.717246e-03, 2.162645e-01, 5.406922e-06, 2.273985e-07, 6.642864e-01 +2.200000e-01, 2.181699e+03, 1.256516e-03, 3.221116e-04, 1.424897e-03, 1.087330e-01, 7.709798e-03, 2.162519e-01, 5.402328e-06, 2.272261e-07, 6.642961e-01 +2.225000e-01, 2.181392e+03, 1.255228e-03, 3.216778e-04, 1.423496e-03, 1.087445e-01, 7.703719e-03, 2.162417e-01, 5.398579e-06, 2.270854e-07, 6.643041e-01 +2.250000e-01, 2.181142e+03, 1.254177e-03, 3.213241e-04, 1.422352e-03, 1.087539e-01, 7.698757e-03, 2.162333e-01, 5.395519e-06, 2.269706e-07, 6.643105e-01 +2.275000e-01, 2.180938e+03, 1.253319e-03, 3.210355e-04, 1.421418e-03, 1.087616e-01, 7.694705e-03, 2.162265e-01, 5.393022e-06, 2.268769e-07, 6.643158e-01 +2.300000e-01, 2.180771e+03, 1.252619e-03, 3.207999e-04, 1.420656e-03, 1.087679e-01, 7.691396e-03, 2.162209e-01, 5.390982e-06, 2.268005e-07, 6.643201e-01 +2.325000e-01, 2.180634e+03, 1.252048e-03, 3.206077e-04, 1.420034e-03, 1.087730e-01, 7.688693e-03, 2.162163e-01, 5.389317e-06, 2.267380e-07, 6.643237e-01 +2.350000e-01, 2.180523e+03, 1.251581e-03, 3.204507e-04, 1.419526e-03, 1.087772e-01, 7.686486e-03, 2.162126e-01, 5.387957e-06, 2.266871e-07, 6.643265e-01 +2.375000e-01, 2.180431e+03, 1.251200e-03, 3.203226e-04, 1.419111e-03, 1.087807e-01, 7.684683e-03, 2.162095e-01, 5.386847e-06, 2.266454e-07, 6.643289e-01 +2.400000e-01, 2.180357e+03, 1.250889e-03, 3.202179e-04, 1.418772e-03, 1.087835e-01, 7.683210e-03, 2.162070e-01, 5.385940e-06, 2.266114e-07, 6.643308e-01 +2.425000e-01, 2.180296e+03, 1.250635e-03, 3.201324e-04, 1.418495e-03, 1.087858e-01, 7.682006e-03, 2.162050e-01, 5.385198e-06, 2.265836e-07, 6.643324e-01 +2.450000e-01, 2.180246e+03, 1.250427e-03, 3.200626e-04, 1.418269e-03, 1.087876e-01, 7.681023e-03, 2.162033e-01, 5.384593e-06, 2.265609e-07, 6.643337e-01 +2.475000e-01, 2.180206e+03, 1.250257e-03, 3.200055e-04, 1.418084e-03, 1.087892e-01, 7.680220e-03, 2.162019e-01, 5.384098e-06, 2.265424e-07, 6.643347e-01 +2.500000e-01, 2.180172e+03, 1.250119e-03, 3.199589e-04, 1.417933e-03, 1.087904e-01, 7.679564e-03, 2.162008e-01, 5.383694e-06, 2.265272e-07, 6.643356e-01 diff --git a/test/data/h2o2.xml b/test/data/h2o2.xml new file mode 100644 index 000000000..69760eb24 --- /dev/null +++ b/test/data/h2o2.xml @@ -0,0 +1,661 @@ + + + + + + + O H Ar + H2 H O O2 OH H2O HO2 H2O2 AR + + + 300.0 + 101325.0 + + + + + + + + + O H Ar + H2 H O O2 OH H2O HO2 H2O2 AR + + + 300.0 + 101325.0 + + + + + + + + + + + + H:2 + TPIS78 + + + + 2.344331120E+00, 7.980520750E-03, -1.947815100E-05, 2.015720940E-08, + -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 + + + + linear + 38.000 + 2.920 + 0.000 + 0.790 + 280.000 + + + + + + H:1 + L 7/88 + + + + 2.500000000E+00, 7.053328190E-13, -1.995919640E-15, 2.300816320E-18, + -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 + + + + atom + 145.000 + 2.050 + 0.000 + 0.000 + 0.000 + + + + + + O:1 + L 1/90 + + + + 3.168267100E+00, -3.279318840E-03, 6.643063960E-06, -6.128066240E-09, + 2.112659710E-12, 2.912225920E+04, 2.051933460E+00 + + + + 2.569420780E+00, -8.597411370E-05, 4.194845890E-08, -1.001777990E-11, + 1.228336910E-15, 2.921757910E+04, 4.784338640E+00 + + + + atom + 80.000 + 2.750 + 0.000 + 0.000 + 0.000 + + + + + + O:2 + TPIS89 + + + + 3.782456360E+00, -2.996734160E-03, 9.847302010E-06, -9.681295090E-09, + 3.243728370E-12, -1.063943560E+03, 3.657675730E+00 + + + + 3.282537840E+00, 1.483087540E-03, -7.579666690E-07, 2.094705550E-10, + -2.167177940E-14, -1.088457720E+03, 5.453231290E+00 + + + + linear + 107.400 + 3.460 + 0.000 + 1.600 + 3.800 + + + + + + H:1 O:1 + RUS 78 + + + + 3.992015430E+00, -2.401317520E-03, 4.617938410E-06, -3.881133330E-09, + 1.364114700E-12, 3.615080560E+03, -1.039254580E-01 + + + + 3.092887670E+00, 5.484297160E-04, 1.265052280E-07, -8.794615560E-11, + 1.174123760E-14, 3.858657000E+03, 4.476696100E+00 + + + + linear + 80.000 + 2.750 + 0.000 + 0.000 + 0.000 + + + + + + H:2 O:1 + L 8/89 + + + + 4.198640560E+00, -2.036434100E-03, 6.520402110E-06, -5.487970620E-09, + 1.771978170E-12, -3.029372670E+04, -8.490322080E-01 + + + + 3.033992490E+00, 2.176918040E-03, -1.640725180E-07, -9.704198700E-11, + 1.682009920E-14, -3.000429710E+04, 4.966770100E+00 + + + + nonlinear + 572.400 + 2.600 + 1.840 + 0.000 + 4.000 + + + + + + H:1 O:2 + L 5/89 + + + + 4.301798010E+00, -4.749120510E-03, 2.115828910E-05, -2.427638940E-08, + 9.292251240E-12, 2.948080400E+02, 3.716662450E+00 + + + + 4.017210900E+00, 2.239820130E-03, -6.336581500E-07, 1.142463700E-10, + -1.079085350E-14, 1.118567130E+02, 3.785102150E+00 + + + + nonlinear + 107.400 + 3.460 + 0.000 + 0.000 + 1.000 + + + + + + H:2 O:2 + L 7/88 + + + + 4.276112690E+00, -5.428224170E-04, 1.673357010E-05, -2.157708130E-08, + 8.624543630E-12, -1.770258210E+04, 3.435050740E+00 + + + + 4.165002850E+00, 4.908316940E-03, -1.901392250E-06, 3.711859860E-10, + -2.879083050E-14, -1.786178770E+04, 2.916156620E+00 + + + + nonlinear + 107.400 + 3.460 + 0.000 + 0.000 + 3.800 + + + + + + Ar:1 + 120186 + + + + 2.500000000E+00, 0.000000000E+00, 0.000000000E+00, 0.000000000E+00, + 0.000000000E+00, -7.453750000E+02, 4.366000000E+00 + + + + 2.500000000E+00, 0.000000000E+00, 0.000000000E+00, 0.000000000E+00, + 0.000000000E+00, -7.453750000E+02, 4.366000000E+00 + + + + atom + 136.500 + 3.330 + 0.000 + 0.000 + 0.000 + + + + + + + + 2 O + M [=] O2 + M + + + 1.200000E+11 + -1 + 0.000000 + + AR:0.83 H2:2.4 H2O:15.4 + + O:2.0 + O2:1.0 + + + + + O + H + M [=] OH + M + + + 5.000000E+11 + -1 + 0.000000 + + AR:0.7 H2:2 H2O:6 + + H:1 O:1.0 + OH:1.0 + + + + + O + H2 [=] H + OH + + + 3.870000E+01 + 2.7000000000000002 + 6260.000000 + + + H2:1 O:1.0 + H:1.0 OH:1 + + + + + O + HO2 [=] OH + O2 + + + 2.000000E+10 + 0 + 0.000000 + + + HO2:1 O:1.0 + O2:1 OH:1.0 + + + + + O + H2O2 [=] OH + HO2 + + + 9.630000E+03 + 2 + 4000.000000 + + + H2O2:1 O:1.0 + HO2:1 OH:1.0 + + + + + H + 2 O2 [=] HO2 + O2 + + + 2.080000E+13 + -1.24 + 0.000000 + + + H:1.0 O2:2.0 + HO2:1.0 O2:1 + + + + + H + O2 + H2O [=] HO2 + H2O + + + 1.126000E+13 + -0.76000000000000001 + 0.000000 + + + H:1.0 H2O:1 O2:1 + H2O:1 HO2:1.0 + + + + + H + O2 + AR [=] HO2 + AR + + + 7.000000E+11 + -0.80000000000000004 + 0.000000 + + + H:1.0 AR:1 O2:1 + AR:1 HO2:1.0 + + + + + H + O2 [=] O + OH + + + 2.650000E+13 + -0.67069999999999996 + 17041.000000 + + + H:1.0 O2:1 + O:1.0 OH:1 + + + + + 2 H + M [=] H2 + M + + + 1.000000E+12 + -1 + 0.000000 + + AR:0.63 H2:0 H2O:0 + + H:2.0 + H2:1.0 + + + + + 2 H + H2 [=] 2 H2 + + + 9.000000E+10 + -0.59999999999999998 + 0.000000 + + + H2:1 H:2.0 + H2:2.0 + + + + + 2 H + H2O [=] H2 + H2O + + + 6.000000E+13 + -1.25 + 0.000000 + + + H:2.0 H2O:1 + H2:1.0 H2O:1 + + + + + H + OH + M [=] H2O + M + + + 2.200000E+16 + -2 + 0.000000 + + AR:0.38 H2:0.73 H2O:3.65 + + H:1.0 OH:1 + H2O:1.0 + + + + + H + HO2 [=] O + H2O + + + 3.970000E+09 + 0 + 671.000000 + + + H:1.0 HO2:1 + H2O:1 O:1.0 + + + + + H + HO2 [=] O2 + H2 + + + 4.480000E+10 + 0 + 1068.000000 + + + H:1.0 HO2:1 + H2:1 O2:1.0 + + + + + H + HO2 [=] 2 OH + + + 8.400000E+10 + 0 + 635.000000 + + + H:1.0 HO2:1 + OH:2.0 + + + + + H + H2O2 [=] HO2 + H2 + + + 1.210000E+04 + 2 + 5200.000000 + + + H:1.0 H2O2:1 + H2:1 HO2:1.0 + + + + + H + H2O2 [=] OH + H2O + + + 1.000000E+10 + 0 + 3600.000000 + + + H:1.0 H2O2:1 + H2O:1 OH:1.0 + + + + + OH + H2 [=] H + H2O + + + 2.160000E+05 + 1.51 + 3430.000000 + + + H2:1 OH:1.0 + H:1.0 H2O:1 + + + + + 2 OH (+ M) [=] H2O2 (+ M) + + + 7.400000E+10 + -0.37 + 0.000000 + + + 2.300000E+12 + -0.90000000000000002 + -1700.000000 + + AR:0.7 H2:2 H2O:6 + 0.7346 94 1756 5182 + + OH:2.0 + H2O2:1.0 + + + + + 2 OH [=] O + H2O + + + 3.570000E+01 + 2.3999999999999999 + -2110.000000 + + + OH:2.0 + H2O:1 O:1.0 + + + + + OH + HO2 [=] O2 + H2O + + + 1.450000E+10 + 0 + -500.000000 + + + HO2:1 OH:1.0 + H2O:1 O2:1.0 + + + + + OH + H2O2 [=] HO2 + H2O + + + 2.000000E+09 + 0 + 427.000000 + + + H2O2:1 OH:1.0 + H2O:1 HO2:1.0 + + + + + OH + H2O2 [=] HO2 + H2O + + + 1.700000E+15 + 0 + 29410.000000 + + + H2O2:1 OH:1.0 + H2O:1 HO2:1.0 + + + + + 2 HO2 [=] O2 + H2O2 + + + 1.300000E+08 + 0 + -1630.000000 + + + HO2:2.0 + O2:1.0 H2O2:1 + + + + + 2 HO2 [=] O2 + H2O2 + + + 4.200000E+11 + 0 + 12000.000000 + + + HO2:2.0 + O2:1.0 H2O2:1 + + + + + OH + HO2 [=] O2 + H2O + + + 5.000000E+12 + 0 + 17330.000000 + + + HO2:1 OH:1.0 + H2O:1 O2:1.0 + + + diff --git a/test/python/runTests.py b/test/python/runTests.py index a01b9b1cd..7dc9fa361 100644 --- a/test/python/runTests.py +++ b/test/python/runTests.py @@ -17,4 +17,7 @@ if __name__ == '__main__': loader = unittest.TestLoader() runner = unittest.TextTestRunner(verbosity=2) suite = loader.loadTestsFromName('testSolution') - runner.run(suite) + suite.addTests(loader.loadTestsFromName('testReactors')) + + results = runner.run(suite) + sys.exit(len(results.errors) + len(results.failures)) diff --git a/test/python/testReactors.py b/test/python/testReactors.py new file mode 100644 index 000000000..fb134b5f2 --- /dev/null +++ b/test/python/testReactors.py @@ -0,0 +1,113 @@ +import unittest +import pprint + +import numpy as np + +import Cantera as ct +from Cantera import Reactor as reactors +from Cantera.Func import Gaussian + +import utilities + +class CombustorTestImplementation(object): + """ + These tests are based on the sample: + + python/reactors/combustor_sim/combustor.py + + with some simplifications so that they run faster and produce more + consistent output. + """ + + referenceFile = '../data/CombustorTest-integrateWithAdvance.csv' + def setUp(self): + self.gas = ct.importPhase('../../data/inputs/h2o2.cti') + + # create a reservoir for the fuel inlet, and set to pure methane. + self.gas.set(T=300.0, P=ct.OneAtm, X='H2:1.0') + fuel_in = reactors.Reservoir(self.gas) + fuel_mw = self.gas.meanMolarMass() + + # Oxidizer inlet + self.gas.set(T=300.0, P=ct.OneAtm, X='O2:1.0, AR:3.0') + oxidizer_in = reactors.Reservoir(self.gas) + oxidizer_mw = self.gas.meanMolarMass() + + # to ignite the fuel/air mixture, we'll introduce a pulse of radicals. + # The steady-state behavior is independent of how we do this, so we'll + # just use a stream of pure atomic hydrogen. + self.gas.set(T=300.0, P=ct.OneAtm, X='H:1.0') + self.igniter = reactors.Reservoir(self.gas) + + # create the combustor, and fill it in initially with a diluent + self.gas.set(T=300.0, P=ct.OneAtm, X='AR:1.0') + self.combustor = reactors.Reactor(contents=self.gas, volume=1.0) + + # create a reservoir for the exhaust + self.exhaust = reactors.Reservoir(self.gas) + + # compute fuel and air mass flow rates + factor = 0.1 + oxidizer_mdot = 4 * factor*oxidizer_mw + fuel_mdot = factor*fuel_mw + + # create and install the mass flow controllers. Controllers + # m1 and m2 provide constant mass flow rates, and m3 provides + # a short Gaussian pulse only to ignite the mixture + m1 = reactors.MassFlowController(upstream=fuel_in, + downstream=self.combustor, + mdot=fuel_mdot) + + m2 = reactors.MassFlowController(upstream=oxidizer_in, + downstream=self.combustor, + mdot=oxidizer_mdot) + + # The igniter will use a Gaussian 'functor' object to specify the + # time-dependent igniter mass flow rate. + igniter_mdot = Gaussian(t0=0.1, FWHM=0.05, A=0.1) + m3 = reactors.MassFlowController(upstream=self.igniter, + downstream=self.combustor, + mdot=igniter_mdot) + + # put a valve on the exhaust line to regulate the pressure + self.v = reactors.Valve(upstream=self.combustor, + downstream=self.exhaust, Kv=1.0) + + # the simulation only contains one reactor + self.sim = reactors.ReactorNet([self.combustor]) + #self.sim.setTolerances(1e-8, 1e-12) + + def test_integrateWithStep(self): + tnow = 0.0 + tfinal = 0.25 + self.data = [] + while tnow < tfinal: + tnow = self.sim.step(tfinal) + self.data.append([tnow, self.combustor.temperature()] + + list(self.combustor.moleFractions())) + + self.assertTrue(tnow >= tfinal) + bad = utilities.compareTimeSeries(self.referenceFile, self.data, + rtol=1e-3, atol=1e-9) + self.assertFalse(bad, bad) + + def test_integrateWithAdvance(self, saveReference=False): + times = np.linspace(0, 0.25, 101) + self.data = [] + for t in times[1:]: + self.sim.advance(t) + self.data.append([t, self.combustor.temperature()] + + list(self.combustor.moleFractions())) + + if saveReference: + np.savetxt(self.referenceFile, np.array(self.data), '%11.6e', ', ') + else: + bad = utilities.compareTimeSeries(self.referenceFile, self.data, + rtol=1e-6, atol=1e-12) + self.assertFalse(bad, bad) + +# Keep the implementation separate from the unittest-derived class +# so that it can be run independently to generate the reference data file. +class CombustorTest(CombustorTestImplementation, unittest.TestCase): + pass + diff --git a/test/python/utilities.py b/test/python/utilities.py new file mode 100644 index 000000000..4bc1f7168 --- /dev/null +++ b/test/python/utilities.py @@ -0,0 +1,51 @@ +import numpy as np + +def compareTimeSeries(reference, sample, rtol=1e-5, atol=1e-12): + """ + Compare two 2D arrays of time series data. Each data set should contain + the time in the first column and data series to be compared in successive + columns. + + The times in each data set do not need to be the same: The data from the + second data set will be interpolated onto the times in the first data set + before being compared. This means that the time range of the "sample" data + set should be at least as long as the "reference" data set. + + After interpolation, each data point must satisfy either the relative + error tolerance specified by `rtol` or the absolute error tolerance + specified by `atol`. + + If the comparison succeeds, this function returns `None`. If the comparison + fails, a formatted report of the differing elements is returned. + """ + if isinstance(reference, str): + reference = np.genfromtxt(reference, delimiter=',').T + else: + reference = np.asarray(reference).T + + sample = np.asarray(sample).T + + assert reference.shape[0] == sample.shape[0] + + nVars = reference.shape[0] + nTimes = reference.shape[1] + + bad = [] + template = '{0:9.4e} {1: 3d} {2:14.8e} {3:14.8e} {4:9.3e} {5:9.3e}' + for i in range(1, nVars): + comp = np.interp(reference[0], sample[0], sample[i]) + for j in range(nTimes): + a = comp[j] + b = reference[i,j] + abserr = abs(a-b) + relerr = 2 * abs(a-b) / (abs(a) + abs(b) + atol) + if abserr > atol and relerr > rtol: + bad.append(template.format(reference[0][j], i, a, b, abserr, relerr)) + + if bad: + header = ['Failed time series comparisons:', + ' time component reference test value abs. err. rel. err', + '---------- --- -------------- -------------- --------- ---------'] + return '\n'.join(header + bad) + else: + return None