\n",
+ "\n",
"
\n",
" \n",
" \n",
@@ -2020,23 +2093,23 @@
"
\n",
" \n",
" | 2 O + M <=> O2 + M | \n",
- " 0.00154932 | \n",
+ " 0.00156775 | \n",
"
\n",
" \n",
" | H + O + M <=> OH + M | \n",
- " 0.00108093 | \n",
+ " 0.00110824 | \n",
"
\n",
" \n",
" | H2 + O <=> H + OH | \n",
- " 0.0251687 | \n",
+ " 0.0252473 | \n",
"
\n",
" \n",
" | HO2 + O <=> O2 + OH | \n",
- " 0.00303606 | \n",
+ " 0.00313172 | \n",
"
\n",
" \n",
" | H2O2 + O <=> HO2 + OH | \n",
- " 0.000726028 | \n",
+ " 0.000752237 | \n",
"
\n",
" \n",
"
\n",
@@ -2044,14 +2117,14 @@
],
"text/plain": [
" baseCase\n",
- "2 O + M <=> O2 + M 0.00154932\n",
- "H + O + M <=> OH + M 0.00108093\n",
- "H2 + O <=> H + OH 0.0251687\n",
- "HO2 + O <=> O2 + OH 0.00303606\n",
- "H2O2 + O <=> HO2 + OH 0.000726028"
+ "2 O + M <=> O2 + M 0.00156775\n",
+ "H + O + M <=> OH + M 0.00110824\n",
+ "H2 + O <=> H + OH 0.0252473\n",
+ "HO2 + O <=> O2 + OH 0.00313172\n",
+ "H2O2 + O <=> HO2 + OH 0.000752237"
]
},
- "execution_count": 12,
+ "execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
@@ -2069,10 +2142,8 @@
},
{
"cell_type": "code",
- "execution_count": 13,
- "metadata": {
- "collapsed": false
- },
+ "execution_count": 12,
+ "metadata": {},
"outputs": [
{
"data": {
@@ -2080,6 +2151,7 @@
"/* Put everything inside the global mpl namespace */\n",
"window.mpl = {};\n",
"\n",
+ "\n",
"mpl.get_websocket_type = function() {\n",
" if (typeof(WebSocket) !== 'undefined') {\n",
" return WebSocket;\n",
@@ -2138,6 +2210,9 @@
" this.ws.onopen = function () {\n",
" fig.send_message(\"supports_binary\", {value: fig.supports_binary});\n",
" fig.send_message(\"send_image_mode\", {});\n",
+ " if (mpl.ratio != 1) {\n",
+ " fig.send_message(\"set_dpi_ratio\", {'dpi_ratio': mpl.ratio});\n",
+ " }\n",
" fig.send_message(\"refresh\", {});\n",
" }\n",
"\n",
@@ -2152,7 +2227,7 @@
" };\n",
"\n",
" this.imageObj.onunload = function() {\n",
- " this.ws.close();\n",
+ " fig.ws.close();\n",
" }\n",
"\n",
" this.ws.onmessage = this._make_on_message_function(this);\n",
@@ -2207,6 +2282,15 @@
" this.canvas = canvas[0];\n",
" this.context = canvas[0].getContext(\"2d\");\n",
"\n",
+ " var backingStore = this.context.backingStorePixelRatio ||\n",
+ "\tthis.context.webkitBackingStorePixelRatio ||\n",
+ "\tthis.context.mozBackingStorePixelRatio ||\n",
+ "\tthis.context.msBackingStorePixelRatio ||\n",
+ "\tthis.context.oBackingStorePixelRatio ||\n",
+ "\tthis.context.backingStorePixelRatio || 1;\n",
+ "\n",
+ " mpl.ratio = (window.devicePixelRatio || 1) / backingStore;\n",
+ "\n",
" var rubberband = $('
');\n",
" rubberband.attr('style', \"position: absolute; left: 0; top: 0; z-index: 1;\")\n",
"\n",
@@ -2263,8 +2347,9 @@
" canvas_div.css('width', width)\n",
" canvas_div.css('height', height)\n",
"\n",
- " canvas.attr('width', width);\n",
- " canvas.attr('height', height);\n",
+ " canvas.attr('width', width * mpl.ratio);\n",
+ " canvas.attr('height', height * mpl.ratio);\n",
+ " canvas.attr('style', 'width: ' + width + 'px; height: ' + height + 'px;');\n",
"\n",
" rubberband.attr('width', width);\n",
" rubberband.attr('height', height);\n",
@@ -2397,10 +2482,10 @@
"}\n",
"\n",
"mpl.figure.prototype.handle_rubberband = function(fig, msg) {\n",
- " var x0 = msg['x0'];\n",
- " var y0 = fig.canvas.height - msg['y0'];\n",
- " var x1 = msg['x1'];\n",
- " var y1 = fig.canvas.height - msg['y1'];\n",
+ " var x0 = msg['x0'] / mpl.ratio;\n",
+ " var y0 = (fig.canvas.height - msg['y0']) / mpl.ratio;\n",
+ " var x1 = msg['x1'] / mpl.ratio;\n",
+ " var y1 = (fig.canvas.height - msg['y1']) / mpl.ratio;\n",
" x0 = Math.floor(x0) + 0.5;\n",
" y0 = Math.floor(y0) + 0.5;\n",
" x1 = Math.floor(x1) + 0.5;\n",
@@ -2556,8 +2641,8 @@
" this.canvas_div.focus();\n",
" }\n",
"\n",
- " var x = canvas_pos.x;\n",
- " var y = canvas_pos.y;\n",
+ " var x = canvas_pos.x * mpl.ratio;\n",
+ " var y = canvas_pos.y * mpl.ratio;\n",
"\n",
" this.send_message(name, {x: x, y: y, button: event.button,\n",
" step: event.step,\n",
@@ -2617,9 +2702,9 @@
"mpl.figure.prototype.toolbar_button_onmouseover = function(tooltip) {\n",
" this.message.textContent = tooltip;\n",
"};\n",
- "mpl.toolbar_items = [[\"Home\", \"Reset original view\", \"fa fa-home icon-home\", \"home\"], [\"Back\", \"Back to previous view\", \"fa fa-arrow-left icon-arrow-left\", \"back\"], [\"Forward\", \"Forward to next view\", \"fa fa-arrow-right icon-arrow-right\", \"forward\"], [\"\", \"\", \"\", \"\"], [\"Pan\", \"Pan axes with left mouse, zoom with right\", \"fa fa-arrows icon-move\", \"pan\"], [\"Zoom\", \"Zoom to rectangle\", \"fa fa-square-o icon-check-empty\", \"zoom\"], [\"\", \"\", \"\", \"\"], [\"Download\", \"Download plot\", \"fa fa-floppy-o icon-save\", \"download\"]];\n",
+ "mpl.toolbar_items = [[\"Home\", \"Reset original view\", \"fa fa-home icon-home\", \"home\"], [\"Back\", \"Back to previous view\", \"fa fa-arrow-left icon-arrow-left\", \"back\"], [\"Forward\", \"Forward to next view\", \"fa fa-arrow-right icon-arrow-right\", \"forward\"], [\"\", \"\", \"\", \"\"], [\"Pan\", \"Pan axes with left mouse, zoom with right\", \"fa fa-arrows icon-move\", \"pan\"], [\"Zoom\", \"Zoom to rectangle\", \"fa fa-square-o icon-check-empty\", \"zoom\"], [\"\", \"\", \"\", \"\"], [\"Download\", \"Download plot\", \"fa fa-floppy-o icon-save\", \"download\"]];\n",
"\n",
- "mpl.extensions = [\"eps\", \"jpeg\", \"pdf\", \"png\", \"ps\", \"raw\", \"svg\", \"tif\"];\n",
+ "mpl.extensions = [\"eps\", \"pdf\", \"png\", \"ps\", \"raw\", \"svg\"];\n",
"\n",
"mpl.default_extension = \"png\";var comm_websocket_adapter = function(comm) {\n",
" // Create a \"websocket\"-like object which calls the given IPython comm\n",
@@ -2637,7 +2722,7 @@
" // Register the callback with on_msg.\n",
" comm.on_msg(function(msg) {\n",
" //console.log('receiving', msg['content']['data'], msg);\n",
- " // Pass the mpl event to the overriden (by mpl) onmessage function.\n",
+ " // Pass the mpl event to the overridden (by mpl) onmessage function.\n",
" ws.onmessage(msg['content']['data'])\n",
" });\n",
" return ws;\n",
@@ -2678,6 +2763,7 @@
"};\n",
"\n",
"mpl.figure.prototype.handle_close = function(fig, msg) {\n",
+ " var width = fig.canvas.width/mpl.ratio\n",
" fig.root.unbind('remove')\n",
"\n",
" // Update the output cell to use the data from the current canvas.\n",
@@ -2686,7 +2772,7 @@
" // Re-enable the keyboard manager in IPython - without this line, in FF,\n",
" // the notebook keyboard shortcuts fail.\n",
" IPython.keyboard_manager.enable()\n",
- " $(fig.parent_element).html('

');\n",
+ " $(fig.parent_element).html('

');\n",
" fig.close_ws(fig, msg);\n",
"}\n",
"\n",
@@ -2697,8 +2783,9 @@
"\n",
"mpl.figure.prototype.push_to_output = function(remove_interactive) {\n",
" // Turn the data on the canvas into data in the output cell.\n",
+ " var width = this.canvas.width/mpl.ratio\n",
" var dataURL = this.canvas.toDataURL();\n",
- " this.cell_info[1]['text/html'] = '

';\n",
+ " this.cell_info[1]['text/html'] = '

';\n",
"}\n",
"\n",
"mpl.figure.prototype.updated_canvas_event = function() {\n",
@@ -2841,7 +2928,7 @@
{
"data": {
"text/html": [
- "

"
+ "

"
],
"text/plain": [
"
"
@@ -2849,16 +2936,6 @@
},
"metadata": {},
"output_type": "display_data"
- },
- {
- "data": {
- "text/plain": [
- ""
- ]
- },
- "execution_count": 13,
- "metadata": {},
- "output_type": "execute_result"
}
],
"source": [
@@ -2882,15 +2959,6 @@
"# Uncomment the following to save the plot. A higher than usual resolution (dpi) helps\n",
"# plt.savefig('sensitivityPlot', dpi=300)"
]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "collapsed": true
- },
- "outputs": [],
- "source": []
}
],
"metadata": {
@@ -2909,9 +2977,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.5.2"
+ "version": "3.7.2"
}
},
"nbformat": 4,
- "nbformat_minor": 0
+ "nbformat_minor": 1
}
diff --git a/flames/twin_premixed_flame_axisymmetric.ipynb b/flames/twin_premixed_flame_axisymmetric.ipynb
index 9e9ee3b..eff73b5 100644
--- a/flames/twin_premixed_flame_axisymmetric.ipynb
+++ b/flames/twin_premixed_flame_axisymmetric.ipynb
@@ -31,15 +31,13 @@
{
"cell_type": "code",
"execution_count": 1,
- "metadata": {
- "collapsed": false
- },
+ "metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
- "Running Cantera Version: 2.3.0a3\n"
+ "Running Cantera Version: 2.5.0a2\n"
]
}
],
@@ -53,6 +51,25 @@
"print(\"Running Cantera Version: \" + str(ct.__version__))"
]
},
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "%matplotlib notebook\n",
+ "import matplotlib.pyplot as plt\n",
+ "\n",
+ "plt.rcParams['figure.autolayout'] = True\n",
+ "\n",
+ "plt.rcParams['axes.labelsize'] = 14\n",
+ "plt.rcParams['xtick.labelsize'] = 12\n",
+ "plt.rcParams['ytick.labelsize'] = 12\n",
+ "plt.rcParams['legend.fontsize'] = 10\n",
+ "plt.rcParams['figure.facecolor'] = 'white'\n",
+ "plt.rcParams['figure.figsize'] = (8,6)"
+ ]
+ },
{
"cell_type": "markdown",
"metadata": {},
@@ -62,19 +79,17 @@
},
{
"cell_type": "code",
- "execution_count": 2,
- "metadata": {
- "collapsed": false
- },
+ "execution_count": 3,
+ "metadata": {},
"outputs": [],
"source": [
- "#Inlet Temperature in Kelvin and Inlet Pressure in Pascals\n",
- "#In this case we are setting the inlet T and P to room temperature conditions\n",
+ "# Inlet Temperature in Kelvin and Inlet Pressure in Pascals\n",
+ "# In this case we are setting the inlet T and P to room temperature conditions\n",
"To = 300\n",
"Po = 101325\n",
"\n",
- "#Define the gas-mixutre and kinetics\n",
- "#In this case, we are choosing a GRI3.0 gas\n",
+ "# Define the gas-mixutre and kinetics\n",
+ "# In this case, we are choosing a GRI3.0 gas\n",
"gas = ct.Solution('gri30.cti')\n",
"\n",
"# Create a CH4/Air premixed mixture with equivalence ratio=0.75\n",
@@ -87,7 +102,7 @@
"\n",
"# Done with initial conditions\n",
"# Compute the mass flux, as this is what the Flame object requires\n",
- "massFlux = gas.density * axial_velocity # units kg/m2/s\n"
+ "massFlux = gas.density * axial_velocity # units kg/m2/s"
]
},
{
@@ -99,15 +114,15 @@
},
{
"cell_type": "code",
- "execution_count": 3,
- "metadata": {
- "collapsed": true
- },
+ "execution_count": 4,
+ "metadata": {},
"outputs": [],
"source": [
- "# Differentiation function for data that has variable grid spacing Used here to\n",
- "# compute normal strain-rate\n",
+ "\n",
"def derivative(x, y):\n",
+ " \"\"\"Differentiation function for data that has variable grid spacing.\n",
+ " Used here to compute normal strain-rate.\n",
+ " \"\"\"\n",
" dydx = np.zeros(y.shape, y.dtype.type)\n",
"\n",
" dx = np.diff(x)\n",
@@ -178,10 +193,8 @@
},
{
"cell_type": "code",
- "execution_count": 4,
- "metadata": {
- "collapsed": true
- },
+ "execution_count": 5,
+ "metadata": {},
"outputs": [],
"source": [
"# Define a domain half-width of 2.5 cm, meaning the whole domain is 5 cm wide\n",
@@ -192,7 +205,7 @@
"\n",
"# Uncomment the following line to use a Multi-component formulation. Default is\n",
"# mixture-averaged\n",
- "#oppFlame.transport_model = 'Multi'"
+ "# oppFlame.transport_model = 'Multi'"
]
},
{
@@ -204,10 +217,8 @@
},
{
"cell_type": "code",
- "execution_count": 5,
- "metadata": {
- "collapsed": false
- },
+ "execution_count": 6,
+ "metadata": {},
"outputs": [
{
"name": "stdout",
@@ -231,155 +242,161 @@
" Pressure: 1.013e+05 Pa\n",
"\n",
"-------------------------------------------------------------------------------\n",
- " z u V T lambda H2 \n",
+ " z u V T lambda eField \n",
"-------------------------------------------------------------------------------\n",
" 0 2 0 300 0 0 \n",
" 0.005 1.6 32 300 0 0 \n",
- " 0.01 1.2 64 300 0 2.06e-21 \n",
- " 0.0125 1 80 1110 0 3.711e-06 \n",
- " 0.015 0.8 96 1920 0 7.422e-06 \n",
- " 0.02 0.4 128 1920 0 7.422e-06 \n",
- " 0.025 0 160 1920 0 7.422e-06 \n",
+ " 0.01 1.2 64 300 0 0 \n",
+ " 0.0125 1 80 1110 0 0 \n",
+ " 0.015 0.8 96 1920 0 0 \n",
+ " 0.02 0.4 128 1920 0 0 \n",
+ " 0.025 0 160 1920 0 0 \n",
"\n",
"-------------------------------------------------------------------------------\n",
- " z H O O2 OH H2O \n",
+ " z H2 H O O2 OH \n",
"-------------------------------------------------------------------------------\n",
- " 0 0 0 0.2232 0 0 \n",
- " 0.005 0 0 0.2232 0 0 \n",
- " 0.01 9.354e-23 1.216e-20 0.2232 1.907e-19 2.604e-17 \n",
- " 0.0125 1.685e-07 2.191e-05 0.1386 0.0003435 0.04691 \n",
- " 0.015 3.37e-07 4.382e-05 0.05403 0.0006871 0.09382 \n",
- " 0.02 3.37e-07 4.382e-05 0.05403 0.0006871 0.09382 \n",
- " 0.025 3.37e-07 4.382e-05 0.05403 0.0006871 0.09382 \n",
+ " 0 0 0 0 0.2232 0 \n",
+ " 0.005 0 0 0 0.2232 0 \n",
+ " 0.01 2.06e-21 9.354e-23 1.216e-20 0.2232 1.907e-19 \n",
+ " 0.0125 3.711e-06 1.685e-07 2.191e-05 0.1386 0.0003435 \n",
+ " 0.015 7.422e-06 3.37e-07 4.382e-05 0.05403 0.0006871 \n",
+ " 0.02 7.422e-06 3.37e-07 4.382e-05 0.05403 0.0006871 \n",
+ " 0.025 7.422e-06 3.37e-07 4.382e-05 0.05403 0.0006871 \n",
"\n",
"-------------------------------------------------------------------------------\n",
- " z HO2 H2O2 C CH CH2 \n",
+ " z H2O HO2 H2O2 C CH \n",
"-------------------------------------------------------------------------------\n",
" 0 0 0 0 0 0 \n",
" 0.005 0 0 0 0 0 \n",
- " 0.01 2.619e-22 1.513e-23 1.528e-38 1.236e-39 4.048e-39 \n",
- " 0.0125 4.718e-07 2.725e-08 2.753e-23 2.226e-24 7.292e-24 \n",
- " 0.015 9.435e-07 5.45e-08 5.506e-23 4.452e-24 1.458e-23 \n",
- " 0.02 9.435e-07 5.45e-08 5.506e-23 4.452e-24 1.458e-23 \n",
- " 0.025 9.435e-07 5.45e-08 5.506e-23 4.452e-24 1.458e-23 \n",
+ " 0.01 2.604e-17 2.619e-22 1.513e-23 1.528e-38 1.236e-39 \n",
+ " 0.0125 0.04691 4.718e-07 2.725e-08 2.753e-23 2.226e-24 \n",
+ " 0.015 0.09382 9.435e-07 5.45e-08 5.506e-23 4.452e-24 \n",
+ " 0.02 0.09382 9.435e-07 5.45e-08 5.506e-23 4.452e-24 \n",
+ " 0.025 0.09382 9.435e-07 5.45e-08 5.506e-23 4.452e-24 \n",
"\n",
"-------------------------------------------------------------------------------\n",
- " z CH2(S) CH3 CH4 CO CO2 \n",
+ " z CH2 CH2(S) CH3 CH4 CO \n",
"-------------------------------------------------------------------------------\n",
- " 0 0 0 0.04197 0 0 \n",
- " 0.005 0 0 0.04197 0 0 \n",
- " 0.01 1.788e-40 3.885e-38 0.04197 6.135e-20 3.186e-17 \n",
- " 0.0125 3.22e-25 6.999e-23 0.02098 0.0001105 0.05739 \n",
- " 0.015 6.441e-25 1.4e-22 0 0.0002211 0.1148 \n",
- " 0.02 6.441e-25 1.4e-22 8.264e-23 0.0002211 0.1148 \n",
- " 0.025 6.441e-25 1.4e-22 8.264e-23 0.0002211 0.1148 \n",
+ " 0 0 0 0 0.04197 0 \n",
+ " 0.005 0 0 0 0.04197 0 \n",
+ " 0.01 4.048e-39 1.788e-40 3.885e-38 0.04197 6.135e-20 \n",
+ " 0.0125 7.292e-24 3.22e-25 6.999e-23 0.02098 0.0001105 \n",
+ " 0.015 1.458e-23 6.441e-25 1.4e-22 0 0.0002211 \n",
+ " 0.02 1.458e-23 6.441e-25 1.4e-22 8.264e-23 0.0002211 \n",
+ " 0.025 1.458e-23 6.441e-25 1.4e-22 8.264e-23 0.0002211 \n",
"\n",
"-------------------------------------------------------------------------------\n",
- " z HCO CH2O CH2OH CH3O CH3OH \n",
+ " z CO2 HCO CH2O CH2OH CH3O \n",
"-------------------------------------------------------------------------------\n",
" 0 0 0 0 0 0 \n",
" 0.005 0 0 0 0 0 \n",
- " 0.01 2.588e-28 2.804e-30 6.75e-37 8.315e-39 5.227e-38 \n",
- " 0.0125 4.662e-13 5.052e-15 1.216e-21 1.498e-23 9.416e-23 \n",
- " 0.015 9.324e-13 1.01e-14 2.432e-21 2.996e-23 1.883e-22 \n",
- " 0.02 9.324e-13 1.01e-14 2.432e-21 2.996e-23 1.883e-22 \n",
- " 0.025 9.324e-13 1.01e-14 2.432e-21 2.996e-23 1.883e-22 \n",
+ " 0.01 3.186e-17 2.588e-28 2.804e-30 6.75e-37 8.315e-39 \n",
+ " 0.0125 0.05739 4.662e-13 5.052e-15 1.216e-21 1.498e-23 \n",
+ " 0.015 0.1148 9.324e-13 1.01e-14 2.432e-21 2.996e-23 \n",
+ " 0.02 0.1148 9.324e-13 1.01e-14 2.432e-21 2.996e-23 \n",
+ " 0.025 0.1148 9.324e-13 1.01e-14 2.432e-21 2.996e-23 \n",
"\n",
"-------------------------------------------------------------------------------\n",
- " z C2H C2H2 C2H3 C2H4 C2H5 \n",
+ " z CH3OH C2H C2H2 C2H3 C2H4 \n",
"-------------------------------------------------------------------------------\n",
" 0 0 0 0 0 0 \n",
" 0.005 0 0 0 0 0 \n",
- " 0.01 9.354e-48 7.624e-45 5.836e-51 9.138e-51 1.002e-56 \n",
- " 0.0125 1.685e-32 1.373e-29 1.051e-35 1.646e-35 1.805e-41 \n",
- " 0.015 3.37e-32 2.747e-29 2.103e-35 3.292e-35 3.61e-41 \n",
- " 0.02 3.37e-32 2.747e-29 2.103e-35 3.292e-35 3.61e-41 \n",
- " 0.025 3.37e-32 2.747e-29 2.103e-35 3.292e-35 3.61e-41 \n",
+ " 0.01 5.227e-38 9.354e-48 7.624e-45 5.836e-51 9.138e-51 \n",
+ " 0.0125 9.416e-23 1.685e-32 1.373e-29 1.051e-35 1.646e-35 \n",
+ " 0.015 1.883e-22 3.37e-32 2.747e-29 2.103e-35 3.292e-35 \n",
+ " 0.02 1.883e-22 3.37e-32 2.747e-29 2.103e-35 3.292e-35 \n",
+ " 0.025 1.883e-22 3.37e-32 2.747e-29 2.103e-35 3.292e-35 \n",
"\n",
"-------------------------------------------------------------------------------\n",
- " z C2H6 HCCO CH2CO HCCOH N \n",
+ " z C2H5 C2H6 HCCO CH2CO HCCOH \n",
"-------------------------------------------------------------------------------\n",
" 0 0 0 0 0 0 \n",
" 0.005 0 0 0 0 0 \n",
- " 0.01 7.332e-58 2.1e-41 3.353e-41 1.05e-44 3.232e-26 \n",
- " 0.0125 1.321e-42 3.783e-26 6.04e-26 1.892e-29 5.822e-11 \n",
- " 0.015 2.641e-42 7.567e-26 1.208e-25 3.785e-29 1.164e-10 \n",
- " 0.02 2.641e-42 7.567e-26 1.208e-25 3.785e-29 1.164e-10 \n",
- " 0.025 2.641e-42 7.567e-26 1.208e-25 3.785e-29 1.164e-10 \n",
+ " 0.01 1.002e-56 7.332e-58 2.1e-41 3.353e-41 1.05e-44 \n",
+ " 0.0125 1.805e-41 1.321e-42 3.783e-26 6.04e-26 1.892e-29 \n",
+ " 0.015 3.61e-41 2.641e-42 7.567e-26 1.208e-25 3.785e-29 \n",
+ " 0.02 3.61e-41 2.641e-42 7.567e-26 1.208e-25 3.785e-29 \n",
+ " 0.025 3.61e-41 2.641e-42 7.567e-26 1.208e-25 3.785e-29 \n",
"\n",
"-------------------------------------------------------------------------------\n",
- " z NH NH2 NH3 NNH NO \n",
+ " z N NH NH2 NH3 NNH \n",
"-------------------------------------------------------------------------------\n",
" 0 0 0 0 0 0 \n",
" 0.005 0 0 0 0 0 \n",
- " 0.01 2.797e-27 8.651e-28 3.559e-27 4.476e-27 8.318e-19 \n",
- " 0.0125 5.038e-12 1.559e-12 6.411e-12 8.062e-12 0.001498 \n",
- " 0.015 1.008e-11 3.117e-12 1.282e-11 1.612e-11 0.002997 \n",
- " 0.02 1.008e-11 3.117e-12 1.282e-11 1.612e-11 0.002997 \n",
- " 0.025 1.008e-11 3.117e-12 1.282e-11 1.612e-11 0.002997 \n",
+ " 0.01 3.232e-26 2.797e-27 8.651e-28 3.559e-27 4.476e-27 \n",
+ " 0.0125 5.822e-11 5.038e-12 1.559e-12 6.411e-12 8.062e-12 \n",
+ " 0.015 1.164e-10 1.008e-11 3.117e-12 1.282e-11 1.612e-11 \n",
+ " 0.02 1.164e-10 1.008e-11 3.117e-12 1.282e-11 1.612e-11 \n",
+ " 0.025 1.164e-10 1.008e-11 3.117e-12 1.282e-11 1.612e-11 \n",
"\n",
"-------------------------------------------------------------------------------\n",
- " z NO2 N2O HNO CN HCN \n",
+ " z NO NO2 N2O HNO CN \n",
"-------------------------------------------------------------------------------\n",
" 0 0 0 0 0 0 \n",
" 0.005 0 0 0 0 0 \n",
- " 0.01 1.205e-21 6.697e-23 2.279e-24 1.185e-33 8.215e-31 \n",
- " 0.0125 2.17e-06 1.206e-07 4.106e-09 2.135e-18 1.48e-15 \n",
- " 0.015 4.341e-06 2.413e-07 8.212e-09 4.269e-18 2.96e-15 \n",
- " 0.02 4.341e-06 2.413e-07 8.212e-09 4.269e-18 2.96e-15 \n",
- " 0.025 4.341e-06 2.413e-07 8.212e-09 4.269e-18 2.96e-15 \n",
+ " 0.01 8.318e-19 1.205e-21 6.697e-23 2.279e-24 1.185e-33 \n",
+ " 0.0125 0.001498 2.17e-06 1.206e-07 4.106e-09 2.135e-18 \n",
+ " 0.015 0.002997 4.341e-06 2.413e-07 8.212e-09 4.269e-18 \n",
+ " 0.02 0.002997 4.341e-06 2.413e-07 8.212e-09 4.269e-18 \n",
+ " 0.025 0.002997 4.341e-06 2.413e-07 8.212e-09 4.269e-18 \n",
"\n",
"-------------------------------------------------------------------------------\n",
- " z H2CN HCNN HCNO HOCN HNCO \n",
+ " z HCN H2CN HCNN HCNO HOCN \n",
"-------------------------------------------------------------------------------\n",
" 0 0 0 0 0 0 \n",
" 0.005 0 0 0 0 0 \n",
- " 0.01 1.546e-38 4.735e-42 1.504e-35 8.599e-31 7.04e-28 \n",
- " 0.0125 2.785e-23 8.53e-27 2.71e-20 1.549e-15 1.268e-12 \n",
- " 0.015 5.57e-23 1.706e-26 5.42e-20 3.098e-15 2.536e-12 \n",
- " 0.02 5.57e-23 1.706e-26 5.42e-20 3.098e-15 2.536e-12 \n",
- " 0.025 5.57e-23 1.706e-26 5.42e-20 3.098e-15 2.536e-12 \n",
+ " 0.01 8.215e-31 1.546e-38 4.735e-42 1.504e-35 8.599e-31 \n",
+ " 0.0125 1.48e-15 2.785e-23 8.53e-27 2.71e-20 1.549e-15 \n",
+ " 0.015 2.96e-15 5.57e-23 1.706e-26 5.42e-20 3.098e-15 \n",
+ " 0.02 2.96e-15 5.57e-23 1.706e-26 5.42e-20 3.098e-15 \n",
+ " 0.025 2.96e-15 5.57e-23 1.706e-26 5.42e-20 3.098e-15 \n",
"\n",
"-------------------------------------------------------------------------------\n",
- " z NCO N2 AR C3H7 C3H8 \n",
+ " z HNCO NCO N2 AR C3H7 \n",
"-------------------------------------------------------------------------------\n",
- " 0 0 0.7348 0 0 0 \n",
- " 0.005 0 0.7348 0 0 0 \n",
- " 0.01 1.842e-29 0.7348 0 6.242e-76 4.325e-77 \n",
- " 0.0125 3.319e-14 0.7341 0 1.125e-60 7.791e-62 \n",
- " 0.015 6.638e-14 0.7334 0 2.249e-60 1.558e-61 \n",
- " 0.02 6.638e-14 0.7334 0 2.249e-60 1.558e-61 \n",
- " 0.025 6.638e-14 0.7334 0 2.249e-60 1.558e-61 \n",
+ " 0 0 0 0.7348 0 0 \n",
+ " 0.005 0 0 0.7348 0 0 \n",
+ " 0.01 7.04e-28 1.842e-29 0.7348 0 6.242e-76 \n",
+ " 0.0125 1.268e-12 3.319e-14 0.7341 0 1.125e-60 \n",
+ " 0.015 2.536e-12 6.638e-14 0.7334 0 2.249e-60 \n",
+ " 0.02 2.536e-12 6.638e-14 0.7334 0 2.249e-60 \n",
+ " 0.025 2.536e-12 6.638e-14 0.7334 0 2.249e-60 \n",
"\n",
"-------------------------------------------------------------------------------\n",
- " z CH2CHO CH3CHO \n",
+ " z C3H8 CH2CHO CH3CHO \n",
"-------------------------------------------------------------------------------\n",
- " 0 0 0 \n",
- " 0.005 0 0 \n",
- " 0.01 1.343e-47 2.414e-48 \n",
- " 0.0125 2.42e-32 4.349e-33 \n",
- " 0.015 4.84e-32 8.698e-33 \n",
- " 0.02 4.84e-32 8.698e-33 \n",
- " 0.025 4.84e-32 8.698e-33 \n",
+ " 0 0 0 0 \n",
+ " 0.005 0 0 0 \n",
+ " 0.01 4.325e-77 1.343e-47 2.414e-48 \n",
+ " 0.0125 7.791e-62 2.42e-32 4.349e-33 \n",
+ " 0.015 1.558e-61 4.84e-32 8.698e-33 \n",
+ " 0.02 1.558e-61 4.84e-32 8.698e-33 \n",
+ " 0.025 1.558e-61 4.84e-32 8.698e-33 \n",
"\n",
"\n",
">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> products <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n",
"\n",
"\n",
"-------------------------------------------------------------------------------\n",
- " z dummy \n",
+ " z \n",
"-------------------------------------------------------------------------------\n",
- " 0 0 \n",
+ " 0 \n",
"\n",
"************ Solving on 7 point grid with energy equation enabled ************\n",
"\n",
"..............................................................................\n",
- "Attempt Newton solution of steady-state problem... failure. \n",
+ "Attempt Newton solution of steady-state problem... failure. \n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
"Take 10 timesteps 2.848e-05 5.886\n",
"Attempt Newton solution of steady-state problem... failure. \n",
- "Take 10 timesteps 0.0004865 5.142\n",
+ "Take 10 timesteps 0.0004865 5.141\n",
"Attempt Newton solution of steady-state problem... failure. \n",
- "Take 10 timesteps 0.008313 2.22\n",
+ "Take 10 timesteps 0.008313 2.219\n",
"Attempt Newton solution of steady-state problem... success.\n",
"\n",
"Problem solved on [7] point grid(s).\n",
@@ -403,9 +420,9 @@
"\n",
"..............................................................................\n",
"Attempt Newton solution of steady-state problem... failure. \n",
- "Take 10 timesteps 0.0001139 5.734\n",
+ "Take 10 timesteps 0.0001139 5.733\n",
"Attempt Newton solution of steady-state problem... failure. \n",
- "Take 10 timesteps 0.002919 3.555\n",
+ "Take 10 timesteps 0.002919 3.554\n",
"Attempt Newton solution of steady-state problem... success.\n",
"\n",
"Problem solved on [12] point grid(s).\n",
@@ -419,11 +436,11 @@
"\n",
"..............................................................................\n",
"Attempt Newton solution of steady-state problem... failure. \n",
- "Take 10 timesteps 0.0001139 5.653\n",
+ "Take 10 timesteps 0.0001139 5.652\n",
"Attempt Newton solution of steady-state problem... failure. \n",
- "Take 10 timesteps 0.0001442 5.86\n",
+ "Take 10 timesteps 0.0001442 5.842\n",
"Attempt Newton solution of steady-state problem... failure. \n",
- "Take 10 timesteps 0.002463 3.926\n",
+ "Take 10 timesteps 0.002463 3.921\n",
"Attempt Newton solution of steady-state problem... success.\n",
"\n",
"Problem solved on [20] point grid(s).\n",
@@ -437,7 +454,7 @@
"\n",
"..............................................................................\n",
"Attempt Newton solution of steady-state problem... failure. \n",
- "Take 10 timesteps 0.0001139 5.647\n",
+ "Take 10 timesteps 0.0001139 5.646\n",
"Attempt Newton solution of steady-state problem... success.\n",
"\n",
"Problem solved on [29] point grid(s).\n",
@@ -451,15 +468,13 @@
"\n",
"..............................................................................\n",
"Attempt Newton solution of steady-state problem... failure. \n",
- "Take 10 timesteps 7.594e-05 6.151\n",
+ "Take 10 timesteps 7.594e-05 6.15\n",
"Attempt Newton solution of steady-state problem... failure. \n",
- "Take 10 timesteps 0.0001442 6.013\n",
+ "Take 10 timesteps 7.208e-05 6.137\n",
"Attempt Newton solution of steady-state problem... failure. \n",
- "Take 10 timesteps 4.561e-05 5.695\n",
+ "Take 10 timesteps 0.0001368 5.859\n",
"Attempt Newton solution of steady-state problem... failure. \n",
- "Take 10 timesteps 0.0001155 5.755\n",
- "Attempt Newton solution of steady-state problem... failure. \n",
- "Take 10 timesteps 0.001973 4.03\n",
+ "Take 10 timesteps 0.0001732 5.516\n",
"Attempt Newton solution of steady-state problem... success.\n",
"\n",
"Problem solved on [39] point grid(s).\n",
@@ -474,15 +489,15 @@
"\n",
"..............................................................................\n",
"Attempt Newton solution of steady-state problem... failure. \n",
- "Take 10 timesteps 5.695e-05 5.862\n",
+ "Take 10 timesteps 5.695e-05 5.868\n",
"Attempt Newton solution of steady-state problem... failure. \n",
- "Take 10 timesteps 7.208e-05 6.072\n",
+ "Take 10 timesteps 7.208e-05 6.08\n",
"Attempt Newton solution of steady-state problem... failure. \n",
- "Take 10 timesteps 0.0005474 4.974\n",
+ "Take 10 timesteps 0.0002737 5.145\n",
"Attempt Newton solution of steady-state problem... failure. \n",
- "Take 10 timesteps 7.306e-05 6.124\n",
+ "Take 10 timesteps 0.0001948 5.71\n",
"Attempt Newton solution of steady-state problem... failure. \n",
- "Take 10 timesteps 0.001248 4.287\n",
+ "Take 10 timesteps 0.003329 3.349\n",
"Attempt Newton solution of steady-state problem... success.\n",
"\n",
"Problem solved on [45] point grid(s).\n",
@@ -498,7 +513,7 @@
"\n",
"..............................................................................\n",
"Attempt Newton solution of steady-state problem... failure. \n",
- "Take 10 timesteps 0.0001709 5.41\n",
+ "Take 10 timesteps 0.0001709 5.407\n",
"Attempt Newton solution of steady-state problem... success.\n",
"\n",
"Problem solved on [49] point grid(s).\n",
@@ -512,11 +527,11 @@
"\n",
"..............................................................................\n",
"Attempt Newton solution of steady-state problem... failure. \n",
- "Take 10 timesteps 0.0001139 5.784\n",
+ "Take 10 timesteps 0.0001139 5.78\n",
"Attempt Newton solution of steady-state problem... failure. \n",
- "Take 10 timesteps 0.0005767 5.383\n",
+ "Take 10 timesteps 0.0005767 5.313\n",
"Attempt Newton solution of steady-state problem... failure. \n",
- "Take 10 timesteps 0.0003079 5.314\n",
+ "Take 10 timesteps 0.0004105 5.218\n",
"Attempt Newton solution of steady-state problem... success.\n",
"\n",
"Problem solved on [56] point grid(s).\n",
@@ -529,11 +544,17 @@
"##############################################################################\n",
"refine: discarding point at 0.0179688\n",
"\n",
- "..............................................................................\n",
+ "..............................................................................\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
"Attempt Newton solution of steady-state problem... failure. \n",
- "Take 10 timesteps 0.0001709 5.61\n",
+ "Take 10 timesteps 0.0001709 5.602\n",
"Attempt Newton solution of steady-state problem... failure. \n",
- "Take 10 timesteps 0.001297 4.393\n",
+ "Take 10 timesteps 0.001297 4.467\n",
"Attempt Newton solution of steady-state problem... success.\n",
"\n",
"Problem solved on [63] point grid(s).\n",
@@ -549,9 +570,9 @@
"\n",
"..............................................................................\n",
"Attempt Newton solution of steady-state problem... failure. \n",
- "Take 10 timesteps 0.0002563 5.356\n",
+ "Take 10 timesteps 0.0002563 5.243\n",
"Attempt Newton solution of steady-state problem... failure. \n",
- "Take 10 timesteps 0.001297 4.473\n",
+ "Take 10 timesteps 0.001946 4.415\n",
"Attempt Newton solution of steady-state problem... success.\n",
"\n",
"Problem solved on [69] point grid(s).\n",
@@ -576,7 +597,7 @@
"##############################################################################\n",
"Refining grid in flame.\n",
" New points inserted after grid points 52 53 54 55 56 57 58 59 60 61 \n",
- " to resolve C2H2 C2H3 C2H4 C2H5 C2H6 C3H7 C3H8 CH CH2 CH2(S) CH2CHO CH2CO CH2O CH2OH CH3 CH3CHO CH3O CH3OH CH4 CO H H2 H2O H2O2 HCCO HCCOH HCN HCO HO2 N2 NO2 O O2 OH T point 61 \n",
+ " to resolve C2H2 C2H3 C2H4 C2H5 C2H6 C3H7 C3H8 CH CH2 CH2(S) CH2CHO CH2CO CH2O CH2OH CH3 CH3CHO CH3O CH3OH CH4 CO H H2 H2O H2O2 HCCO HCCOH HCN HCO HNCO HO2 N2 NO2 O O2 OH T point 61 \n",
"##############################################################################\n",
"refine: discarding point at 0.0196875\n",
"refine: discarding point at 0.0199219\n",
@@ -589,7 +610,7 @@
"..............................................................................\n",
"##############################################################################\n",
"Refining grid in flame.\n",
- " New points inserted after grid points 51 52 55 56 57 58 59 60 61 62 \n",
+ " New points inserted after grid points 49 50 54 55 56 57 58 59 60 61 \n",
" to resolve C2H2 C2H3 C2H4 C2H5 C2H6 C3H8 CH CH2 CH2(S) CH2CO CH2OH CH3 CH3CHO CH3O HCCO HCO \n",
"##############################################################################\n",
"refine: discarding point at 0.0195313\n",
@@ -602,8 +623,8 @@
"..............................................................................\n",
"##############################################################################\n",
"Refining grid in flame.\n",
- " New points inserted after grid points 46 47 48 52 54 55 72 \n",
- " to resolve C2H6 C3H8 CH3O point 52 point 72 \n",
+ " New points inserted after grid points 43 45 46 49 53 54 55 \n",
+ " to resolve C2H5 C2H6 C3H8 CH3O point 49 \n",
"##############################################################################\n",
"\n",
"..............................................................................\n",
@@ -614,18 +635,29 @@
"..............................................................................\n",
"##############################################################################\n",
"Refining grid in flame.\n",
- " New points inserted after grid points 45 80 \n",
- " to resolve point 45 point 80 \n",
+ " New points inserted after grid points 50 51 60 \n",
+ " to resolve CH3O point 60 \n",
"##############################################################################\n",
"\n",
"..............................................................................\n",
"Attempt Newton solution of steady-state problem... success.\n",
"\n",
- "Problem solved on [100] point grid(s).\n",
+ "Problem solved on [101] point grid(s).\n",
"\n",
"..............................................................................\n",
- "no new points needed in flame\n",
- "Solution saved to 'premixed_twin_flame.csv'.\n"
+ "##############################################################################\n",
+ "Refining grid in flame.\n",
+ " New points inserted after grid points 51 \n",
+ " to resolve point 51 \n",
+ "##############################################################################\n",
+ "\n",
+ "..............................................................................\n",
+ "Attempt Newton solution of steady-state problem... success.\n",
+ "\n",
+ "Problem solved on [102] point grid(s).\n",
+ "\n",
+ "..............................................................................\n",
+ "no new points needed in flame\n"
]
}
],
@@ -639,24 +671,22 @@
"# is T, Y[i], etc. The spatial variable (distance in meters) is in oppFlame.grid\n",
"# Thus to plot temperature vs distance, use oppFlame.grid and oppFlame.T\n",
"\n",
- "#This is to save output\n",
- "oppFlame.write_csv(\"premixed_twin_flame.csv\", quiet=False)"
+ "# Uncomment this is to save output\n",
+ "# oppFlame.write_csv(\"premixed_twin_flame.csv\", quiet=False)"
]
},
{
"cell_type": "code",
- "execution_count": 6,
- "metadata": {
- "collapsed": false
- },
+ "execution_count": 7,
+ "metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
- "Peak temperature: 1920.5 K\n",
- "Strain Rate: 163.6 1/s\n",
- "Consumption Speed: 20.80 cm/s\n"
+ "Peak temperature: 1921.0 K\n",
+ "Strain Rate: 163.7 1/s\n",
+ "Consumption Speed: 21.00 cm/s\n"
]
}
],
@@ -677,28 +707,6 @@
"Note that the graphs only represent one-half of the domain, because the solution is symmetric"
]
},
- {
- "cell_type": "code",
- "execution_count": 7,
- "metadata": {
- "collapsed": true
- },
- "outputs": [],
- "source": [
- "# Import plotting modules and define plotting preference\n",
- "import matplotlib.pyplot as plt\n",
- "%matplotlib notebook\n",
- "\n",
- "plt.rcParams['figure.autolayout'] = True\n",
- "\n",
- "plt.rcParams['axes.labelsize'] = 14\n",
- "plt.rcParams['xtick.labelsize'] = 12\n",
- "plt.rcParams['ytick.labelsize'] = 12\n",
- "plt.rcParams['legend.fontsize'] = 10\n",
- "plt.rcParams['figure.facecolor'] = 'white'\n",
- "plt.rcParams['figure.figsize'] = (8,6)"
- ]
- },
{
"cell_type": "markdown",
"metadata": {},
@@ -709,9 +717,7 @@
{
"cell_type": "code",
"execution_count": 8,
- "metadata": {
- "collapsed": false
- },
+ "metadata": {},
"outputs": [
{
"data": {
@@ -719,6 +725,7 @@
"/* Put everything inside the global mpl namespace */\n",
"window.mpl = {};\n",
"\n",
+ "\n",
"mpl.get_websocket_type = function() {\n",
" if (typeof(WebSocket) !== 'undefined') {\n",
" return WebSocket;\n",
@@ -777,6 +784,9 @@
" this.ws.onopen = function () {\n",
" fig.send_message(\"supports_binary\", {value: fig.supports_binary});\n",
" fig.send_message(\"send_image_mode\", {});\n",
+ " if (mpl.ratio != 1) {\n",
+ " fig.send_message(\"set_dpi_ratio\", {'dpi_ratio': mpl.ratio});\n",
+ " }\n",
" fig.send_message(\"refresh\", {});\n",
" }\n",
"\n",
@@ -791,7 +801,7 @@
" };\n",
"\n",
" this.imageObj.onunload = function() {\n",
- " this.ws.close();\n",
+ " fig.ws.close();\n",
" }\n",
"\n",
" this.ws.onmessage = this._make_on_message_function(this);\n",
@@ -846,6 +856,15 @@
" this.canvas = canvas[0];\n",
" this.context = canvas[0].getContext(\"2d\");\n",
"\n",
+ " var backingStore = this.context.backingStorePixelRatio ||\n",
+ "\tthis.context.webkitBackingStorePixelRatio ||\n",
+ "\tthis.context.mozBackingStorePixelRatio ||\n",
+ "\tthis.context.msBackingStorePixelRatio ||\n",
+ "\tthis.context.oBackingStorePixelRatio ||\n",
+ "\tthis.context.backingStorePixelRatio || 1;\n",
+ "\n",
+ " mpl.ratio = (window.devicePixelRatio || 1) / backingStore;\n",
+ "\n",
" var rubberband = $('');\n",
" rubberband.attr('style', \"position: absolute; left: 0; top: 0; z-index: 1;\")\n",
"\n",
@@ -902,8 +921,9 @@
" canvas_div.css('width', width)\n",
" canvas_div.css('height', height)\n",
"\n",
- " canvas.attr('width', width);\n",
- " canvas.attr('height', height);\n",
+ " canvas.attr('width', width * mpl.ratio);\n",
+ " canvas.attr('height', height * mpl.ratio);\n",
+ " canvas.attr('style', 'width: ' + width + 'px; height: ' + height + 'px;');\n",
"\n",
" rubberband.attr('width', width);\n",
" rubberband.attr('height', height);\n",
@@ -1036,10 +1056,10 @@
"}\n",
"\n",
"mpl.figure.prototype.handle_rubberband = function(fig, msg) {\n",
- " var x0 = msg['x0'];\n",
- " var y0 = fig.canvas.height - msg['y0'];\n",
- " var x1 = msg['x1'];\n",
- " var y1 = fig.canvas.height - msg['y1'];\n",
+ " var x0 = msg['x0'] / mpl.ratio;\n",
+ " var y0 = (fig.canvas.height - msg['y0']) / mpl.ratio;\n",
+ " var x1 = msg['x1'] / mpl.ratio;\n",
+ " var y1 = (fig.canvas.height - msg['y1']) / mpl.ratio;\n",
" x0 = Math.floor(x0) + 0.5;\n",
" y0 = Math.floor(y0) + 0.5;\n",
" x1 = Math.floor(x1) + 0.5;\n",
@@ -1195,8 +1215,8 @@
" this.canvas_div.focus();\n",
" }\n",
"\n",
- " var x = canvas_pos.x;\n",
- " var y = canvas_pos.y;\n",
+ " var x = canvas_pos.x * mpl.ratio;\n",
+ " var y = canvas_pos.y * mpl.ratio;\n",
"\n",
" this.send_message(name, {x: x, y: y, button: event.button,\n",
" step: event.step,\n",
@@ -1256,9 +1276,9 @@
"mpl.figure.prototype.toolbar_button_onmouseover = function(tooltip) {\n",
" this.message.textContent = tooltip;\n",
"};\n",
- "mpl.toolbar_items = [[\"Home\", \"Reset original view\", \"fa fa-home icon-home\", \"home\"], [\"Back\", \"Back to previous view\", \"fa fa-arrow-left icon-arrow-left\", \"back\"], [\"Forward\", \"Forward to next view\", \"fa fa-arrow-right icon-arrow-right\", \"forward\"], [\"\", \"\", \"\", \"\"], [\"Pan\", \"Pan axes with left mouse, zoom with right\", \"fa fa-arrows icon-move\", \"pan\"], [\"Zoom\", \"Zoom to rectangle\", \"fa fa-square-o icon-check-empty\", \"zoom\"], [\"\", \"\", \"\", \"\"], [\"Download\", \"Download plot\", \"fa fa-floppy-o icon-save\", \"download\"]];\n",
+ "mpl.toolbar_items = [[\"Home\", \"Reset original view\", \"fa fa-home icon-home\", \"home\"], [\"Back\", \"Back to previous view\", \"fa fa-arrow-left icon-arrow-left\", \"back\"], [\"Forward\", \"Forward to next view\", \"fa fa-arrow-right icon-arrow-right\", \"forward\"], [\"\", \"\", \"\", \"\"], [\"Pan\", \"Pan axes with left mouse, zoom with right\", \"fa fa-arrows icon-move\", \"pan\"], [\"Zoom\", \"Zoom to rectangle\", \"fa fa-square-o icon-check-empty\", \"zoom\"], [\"\", \"\", \"\", \"\"], [\"Download\", \"Download plot\", \"fa fa-floppy-o icon-save\", \"download\"]];\n",
"\n",
- "mpl.extensions = [\"eps\", \"jpeg\", \"pdf\", \"png\", \"ps\", \"raw\", \"svg\", \"tif\"];\n",
+ "mpl.extensions = [\"eps\", \"pdf\", \"png\", \"ps\", \"raw\", \"svg\"];\n",
"\n",
"mpl.default_extension = \"png\";var comm_websocket_adapter = function(comm) {\n",
" // Create a \"websocket\"-like object which calls the given IPython comm\n",
@@ -1276,7 +1296,7 @@
" // Register the callback with on_msg.\n",
" comm.on_msg(function(msg) {\n",
" //console.log('receiving', msg['content']['data'], msg);\n",
- " // Pass the mpl event to the overriden (by mpl) onmessage function.\n",
+ " // Pass the mpl event to the overridden (by mpl) onmessage function.\n",
" ws.onmessage(msg['content']['data'])\n",
" });\n",
" return ws;\n",
@@ -1317,6 +1337,7 @@
"};\n",
"\n",
"mpl.figure.prototype.handle_close = function(fig, msg) {\n",
+ " var width = fig.canvas.width/mpl.ratio\n",
" fig.root.unbind('remove')\n",
"\n",
" // Update the output cell to use the data from the current canvas.\n",
@@ -1325,7 +1346,7 @@
" // Re-enable the keyboard manager in IPython - without this line, in FF,\n",
" // the notebook keyboard shortcuts fail.\n",
" IPython.keyboard_manager.enable()\n",
- " $(fig.parent_element).html('
');\n",
+ " $(fig.parent_element).html('
');\n",
" fig.close_ws(fig, msg);\n",
"}\n",
"\n",
@@ -1336,8 +1357,9 @@
"\n",
"mpl.figure.prototype.push_to_output = function(remove_interactive) {\n",
" // Turn the data on the canvas into data in the output cell.\n",
+ " var width = this.canvas.width/mpl.ratio\n",
" var dataURL = this.canvas.toDataURL();\n",
- " this.cell_info[1]['text/html'] = '
';\n",
+ " this.cell_info[1]['text/html'] = '
';\n",
"}\n",
"\n",
"mpl.figure.prototype.updated_canvas_event = function() {\n",
@@ -1480,7 +1502,7 @@
{
"data": {
"text/html": [
- "
"
+ "
"
],
"text/plain": [
""
@@ -1516,9 +1538,7 @@
{
"cell_type": "code",
"execution_count": 9,
- "metadata": {
- "collapsed": false
- },
+ "metadata": {},
"outputs": [
{
"data": {
@@ -1526,6 +1546,7 @@
"/* Put everything inside the global mpl namespace */\n",
"window.mpl = {};\n",
"\n",
+ "\n",
"mpl.get_websocket_type = function() {\n",
" if (typeof(WebSocket) !== 'undefined') {\n",
" return WebSocket;\n",
@@ -1584,6 +1605,9 @@
" this.ws.onopen = function () {\n",
" fig.send_message(\"supports_binary\", {value: fig.supports_binary});\n",
" fig.send_message(\"send_image_mode\", {});\n",
+ " if (mpl.ratio != 1) {\n",
+ " fig.send_message(\"set_dpi_ratio\", {'dpi_ratio': mpl.ratio});\n",
+ " }\n",
" fig.send_message(\"refresh\", {});\n",
" }\n",
"\n",
@@ -1598,7 +1622,7 @@
" };\n",
"\n",
" this.imageObj.onunload = function() {\n",
- " this.ws.close();\n",
+ " fig.ws.close();\n",
" }\n",
"\n",
" this.ws.onmessage = this._make_on_message_function(this);\n",
@@ -1653,6 +1677,15 @@
" this.canvas = canvas[0];\n",
" this.context = canvas[0].getContext(\"2d\");\n",
"\n",
+ " var backingStore = this.context.backingStorePixelRatio ||\n",
+ "\tthis.context.webkitBackingStorePixelRatio ||\n",
+ "\tthis.context.mozBackingStorePixelRatio ||\n",
+ "\tthis.context.msBackingStorePixelRatio ||\n",
+ "\tthis.context.oBackingStorePixelRatio ||\n",
+ "\tthis.context.backingStorePixelRatio || 1;\n",
+ "\n",
+ " mpl.ratio = (window.devicePixelRatio || 1) / backingStore;\n",
+ "\n",
" var rubberband = $('');\n",
" rubberband.attr('style', \"position: absolute; left: 0; top: 0; z-index: 1;\")\n",
"\n",
@@ -1709,8 +1742,9 @@
" canvas_div.css('width', width)\n",
" canvas_div.css('height', height)\n",
"\n",
- " canvas.attr('width', width);\n",
- " canvas.attr('height', height);\n",
+ " canvas.attr('width', width * mpl.ratio);\n",
+ " canvas.attr('height', height * mpl.ratio);\n",
+ " canvas.attr('style', 'width: ' + width + 'px; height: ' + height + 'px;');\n",
"\n",
" rubberband.attr('width', width);\n",
" rubberband.attr('height', height);\n",
@@ -1843,10 +1877,10 @@
"}\n",
"\n",
"mpl.figure.prototype.handle_rubberband = function(fig, msg) {\n",
- " var x0 = msg['x0'];\n",
- " var y0 = fig.canvas.height - msg['y0'];\n",
- " var x1 = msg['x1'];\n",
- " var y1 = fig.canvas.height - msg['y1'];\n",
+ " var x0 = msg['x0'] / mpl.ratio;\n",
+ " var y0 = (fig.canvas.height - msg['y0']) / mpl.ratio;\n",
+ " var x1 = msg['x1'] / mpl.ratio;\n",
+ " var y1 = (fig.canvas.height - msg['y1']) / mpl.ratio;\n",
" x0 = Math.floor(x0) + 0.5;\n",
" y0 = Math.floor(y0) + 0.5;\n",
" x1 = Math.floor(x1) + 0.5;\n",
@@ -2002,8 +2036,8 @@
" this.canvas_div.focus();\n",
" }\n",
"\n",
- " var x = canvas_pos.x;\n",
- " var y = canvas_pos.y;\n",
+ " var x = canvas_pos.x * mpl.ratio;\n",
+ " var y = canvas_pos.y * mpl.ratio;\n",
"\n",
" this.send_message(name, {x: x, y: y, button: event.button,\n",
" step: event.step,\n",
@@ -2063,9 +2097,9 @@
"mpl.figure.prototype.toolbar_button_onmouseover = function(tooltip) {\n",
" this.message.textContent = tooltip;\n",
"};\n",
- "mpl.toolbar_items = [[\"Home\", \"Reset original view\", \"fa fa-home icon-home\", \"home\"], [\"Back\", \"Back to previous view\", \"fa fa-arrow-left icon-arrow-left\", \"back\"], [\"Forward\", \"Forward to next view\", \"fa fa-arrow-right icon-arrow-right\", \"forward\"], [\"\", \"\", \"\", \"\"], [\"Pan\", \"Pan axes with left mouse, zoom with right\", \"fa fa-arrows icon-move\", \"pan\"], [\"Zoom\", \"Zoom to rectangle\", \"fa fa-square-o icon-check-empty\", \"zoom\"], [\"\", \"\", \"\", \"\"], [\"Download\", \"Download plot\", \"fa fa-floppy-o icon-save\", \"download\"]];\n",
+ "mpl.toolbar_items = [[\"Home\", \"Reset original view\", \"fa fa-home icon-home\", \"home\"], [\"Back\", \"Back to previous view\", \"fa fa-arrow-left icon-arrow-left\", \"back\"], [\"Forward\", \"Forward to next view\", \"fa fa-arrow-right icon-arrow-right\", \"forward\"], [\"\", \"\", \"\", \"\"], [\"Pan\", \"Pan axes with left mouse, zoom with right\", \"fa fa-arrows icon-move\", \"pan\"], [\"Zoom\", \"Zoom to rectangle\", \"fa fa-square-o icon-check-empty\", \"zoom\"], [\"\", \"\", \"\", \"\"], [\"Download\", \"Download plot\", \"fa fa-floppy-o icon-save\", \"download\"]];\n",
"\n",
- "mpl.extensions = [\"eps\", \"jpeg\", \"pdf\", \"png\", \"ps\", \"raw\", \"svg\", \"tif\"];\n",
+ "mpl.extensions = [\"eps\", \"pdf\", \"png\", \"ps\", \"raw\", \"svg\"];\n",
"\n",
"mpl.default_extension = \"png\";var comm_websocket_adapter = function(comm) {\n",
" // Create a \"websocket\"-like object which calls the given IPython comm\n",
@@ -2083,7 +2117,7 @@
" // Register the callback with on_msg.\n",
" comm.on_msg(function(msg) {\n",
" //console.log('receiving', msg['content']['data'], msg);\n",
- " // Pass the mpl event to the overriden (by mpl) onmessage function.\n",
+ " // Pass the mpl event to the overridden (by mpl) onmessage function.\n",
" ws.onmessage(msg['content']['data'])\n",
" });\n",
" return ws;\n",
@@ -2124,6 +2158,7 @@
"};\n",
"\n",
"mpl.figure.prototype.handle_close = function(fig, msg) {\n",
+ " var width = fig.canvas.width/mpl.ratio\n",
" fig.root.unbind('remove')\n",
"\n",
" // Update the output cell to use the data from the current canvas.\n",
@@ -2132,7 +2167,7 @@
" // Re-enable the keyboard manager in IPython - without this line, in FF,\n",
" // the notebook keyboard shortcuts fail.\n",
" IPython.keyboard_manager.enable()\n",
- " $(fig.parent_element).html('
');\n",
+ " $(fig.parent_element).html('
');\n",
" fig.close_ws(fig, msg);\n",
"}\n",
"\n",
@@ -2143,8 +2178,9 @@
"\n",
"mpl.figure.prototype.push_to_output = function(remove_interactive) {\n",
" // Turn the data on the canvas into data in the output cell.\n",
+ " var width = this.canvas.width/mpl.ratio\n",
" var dataURL = this.canvas.toDataURL();\n",
- " this.cell_info[1]['text/html'] = '
';\n",
+ " this.cell_info[1]['text/html'] = '
';\n",
"}\n",
"\n",
"mpl.figure.prototype.updated_canvas_event = function() {\n",
@@ -2287,7 +2323,7 @@
{
"data": {
"text/html": [
- "
"
+ "
"
],
"text/plain": [
""
@@ -2316,9 +2352,7 @@
{
"cell_type": "code",
"execution_count": 10,
- "metadata": {
- "collapsed": false
- },
+ "metadata": {},
"outputs": [
{
"data": {
@@ -2326,6 +2360,7 @@
"/* Put everything inside the global mpl namespace */\n",
"window.mpl = {};\n",
"\n",
+ "\n",
"mpl.get_websocket_type = function() {\n",
" if (typeof(WebSocket) !== 'undefined') {\n",
" return WebSocket;\n",
@@ -2384,6 +2419,9 @@
" this.ws.onopen = function () {\n",
" fig.send_message(\"supports_binary\", {value: fig.supports_binary});\n",
" fig.send_message(\"send_image_mode\", {});\n",
+ " if (mpl.ratio != 1) {\n",
+ " fig.send_message(\"set_dpi_ratio\", {'dpi_ratio': mpl.ratio});\n",
+ " }\n",
" fig.send_message(\"refresh\", {});\n",
" }\n",
"\n",
@@ -2398,7 +2436,7 @@
" };\n",
"\n",
" this.imageObj.onunload = function() {\n",
- " this.ws.close();\n",
+ " fig.ws.close();\n",
" }\n",
"\n",
" this.ws.onmessage = this._make_on_message_function(this);\n",
@@ -2453,6 +2491,15 @@
" this.canvas = canvas[0];\n",
" this.context = canvas[0].getContext(\"2d\");\n",
"\n",
+ " var backingStore = this.context.backingStorePixelRatio ||\n",
+ "\tthis.context.webkitBackingStorePixelRatio ||\n",
+ "\tthis.context.mozBackingStorePixelRatio ||\n",
+ "\tthis.context.msBackingStorePixelRatio ||\n",
+ "\tthis.context.oBackingStorePixelRatio ||\n",
+ "\tthis.context.backingStorePixelRatio || 1;\n",
+ "\n",
+ " mpl.ratio = (window.devicePixelRatio || 1) / backingStore;\n",
+ "\n",
" var rubberband = $('');\n",
" rubberband.attr('style', \"position: absolute; left: 0; top: 0; z-index: 1;\")\n",
"\n",
@@ -2509,8 +2556,9 @@
" canvas_div.css('width', width)\n",
" canvas_div.css('height', height)\n",
"\n",
- " canvas.attr('width', width);\n",
- " canvas.attr('height', height);\n",
+ " canvas.attr('width', width * mpl.ratio);\n",
+ " canvas.attr('height', height * mpl.ratio);\n",
+ " canvas.attr('style', 'width: ' + width + 'px; height: ' + height + 'px;');\n",
"\n",
" rubberband.attr('width', width);\n",
" rubberband.attr('height', height);\n",
@@ -2643,10 +2691,10 @@
"}\n",
"\n",
"mpl.figure.prototype.handle_rubberband = function(fig, msg) {\n",
- " var x0 = msg['x0'];\n",
- " var y0 = fig.canvas.height - msg['y0'];\n",
- " var x1 = msg['x1'];\n",
- " var y1 = fig.canvas.height - msg['y1'];\n",
+ " var x0 = msg['x0'] / mpl.ratio;\n",
+ " var y0 = (fig.canvas.height - msg['y0']) / mpl.ratio;\n",
+ " var x1 = msg['x1'] / mpl.ratio;\n",
+ " var y1 = (fig.canvas.height - msg['y1']) / mpl.ratio;\n",
" x0 = Math.floor(x0) + 0.5;\n",
" y0 = Math.floor(y0) + 0.5;\n",
" x1 = Math.floor(x1) + 0.5;\n",
@@ -2802,8 +2850,8 @@
" this.canvas_div.focus();\n",
" }\n",
"\n",
- " var x = canvas_pos.x;\n",
- " var y = canvas_pos.y;\n",
+ " var x = canvas_pos.x * mpl.ratio;\n",
+ " var y = canvas_pos.y * mpl.ratio;\n",
"\n",
" this.send_message(name, {x: x, y: y, button: event.button,\n",
" step: event.step,\n",
@@ -2863,9 +2911,9 @@
"mpl.figure.prototype.toolbar_button_onmouseover = function(tooltip) {\n",
" this.message.textContent = tooltip;\n",
"};\n",
- "mpl.toolbar_items = [[\"Home\", \"Reset original view\", \"fa fa-home icon-home\", \"home\"], [\"Back\", \"Back to previous view\", \"fa fa-arrow-left icon-arrow-left\", \"back\"], [\"Forward\", \"Forward to next view\", \"fa fa-arrow-right icon-arrow-right\", \"forward\"], [\"\", \"\", \"\", \"\"], [\"Pan\", \"Pan axes with left mouse, zoom with right\", \"fa fa-arrows icon-move\", \"pan\"], [\"Zoom\", \"Zoom to rectangle\", \"fa fa-square-o icon-check-empty\", \"zoom\"], [\"\", \"\", \"\", \"\"], [\"Download\", \"Download plot\", \"fa fa-floppy-o icon-save\", \"download\"]];\n",
+ "mpl.toolbar_items = [[\"Home\", \"Reset original view\", \"fa fa-home icon-home\", \"home\"], [\"Back\", \"Back to previous view\", \"fa fa-arrow-left icon-arrow-left\", \"back\"], [\"Forward\", \"Forward to next view\", \"fa fa-arrow-right icon-arrow-right\", \"forward\"], [\"\", \"\", \"\", \"\"], [\"Pan\", \"Pan axes with left mouse, zoom with right\", \"fa fa-arrows icon-move\", \"pan\"], [\"Zoom\", \"Zoom to rectangle\", \"fa fa-square-o icon-check-empty\", \"zoom\"], [\"\", \"\", \"\", \"\"], [\"Download\", \"Download plot\", \"fa fa-floppy-o icon-save\", \"download\"]];\n",
"\n",
- "mpl.extensions = [\"eps\", \"jpeg\", \"pdf\", \"png\", \"ps\", \"raw\", \"svg\", \"tif\"];\n",
+ "mpl.extensions = [\"eps\", \"pdf\", \"png\", \"ps\", \"raw\", \"svg\"];\n",
"\n",
"mpl.default_extension = \"png\";var comm_websocket_adapter = function(comm) {\n",
" // Create a \"websocket\"-like object which calls the given IPython comm\n",
@@ -2883,7 +2931,7 @@
" // Register the callback with on_msg.\n",
" comm.on_msg(function(msg) {\n",
" //console.log('receiving', msg['content']['data'], msg);\n",
- " // Pass the mpl event to the overriden (by mpl) onmessage function.\n",
+ " // Pass the mpl event to the overridden (by mpl) onmessage function.\n",
" ws.onmessage(msg['content']['data'])\n",
" });\n",
" return ws;\n",
@@ -2924,6 +2972,7 @@
"};\n",
"\n",
"mpl.figure.prototype.handle_close = function(fig, msg) {\n",
+ " var width = fig.canvas.width/mpl.ratio\n",
" fig.root.unbind('remove')\n",
"\n",
" // Update the output cell to use the data from the current canvas.\n",
@@ -2932,7 +2981,7 @@
" // Re-enable the keyboard manager in IPython - without this line, in FF,\n",
" // the notebook keyboard shortcuts fail.\n",
" IPython.keyboard_manager.enable()\n",
- " $(fig.parent_element).html('
');\n",
+ " $(fig.parent_element).html('
');\n",
" fig.close_ws(fig, msg);\n",
"}\n",
"\n",
@@ -2943,8 +2992,9 @@
"\n",
"mpl.figure.prototype.push_to_output = function(remove_interactive) {\n",
" // Turn the data on the canvas into data in the output cell.\n",
+ " var width = this.canvas.width/mpl.ratio\n",
" var dataURL = this.canvas.toDataURL();\n",
- " this.cell_info[1]['text/html'] = '
';\n",
+ " this.cell_info[1]['text/html'] = '
';\n",
"}\n",
"\n",
"mpl.figure.prototype.updated_canvas_event = function() {\n",
@@ -3087,7 +3137,7 @@
{
"data": {
"text/html": [
- "
"
+ "
"
],
"text/plain": [
""
@@ -3122,15 +3172,6 @@
"\n",
"plt.legend(loc=2);"
]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "collapsed": true
- },
- "outputs": [],
- "source": []
}
],
"metadata": {
@@ -3149,9 +3190,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.5.2"
+ "version": "3.7.2"
}
},
"nbformat": 4,
- "nbformat_minor": 0
+ "nbformat_minor": 1
}
diff --git a/python_tutorial.ipynb b/python_tutorial.ipynb
index 07bc515..bb6cb52 100644
--- a/python_tutorial.ipynb
+++ b/python_tutorial.ipynb
@@ -26,9 +26,7 @@
{
"cell_type": "code",
"execution_count": 1,
- "metadata": {
- "collapsed": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"import cantera as ct\n",
@@ -45,9 +43,7 @@
{
"cell_type": "code",
"execution_count": 2,
- "metadata": {
- "collapsed": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"gas1 = ct.Solution('gri30.xml')"
@@ -126,9 +122,7 @@
{
"cell_type": "code",
"execution_count": 4,
- "metadata": {
- "collapsed": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"gas1.TP = 1200, 101325"
@@ -191,9 +185,7 @@
{
"cell_type": "code",
"execution_count": 6,
- "metadata": {
- "collapsed": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"gas1.TP = 1200, 101325 # temperature, pressure\n",
@@ -297,9 +289,7 @@
{
"cell_type": "code",
"execution_count": 10,
- "metadata": {
- "collapsed": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"gas1.X = 'CH4:1, O2:2, N2:7.52'"
@@ -315,9 +305,7 @@
{
"cell_type": "code",
"execution_count": 11,
- "metadata": {
- "collapsed": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"phi = 0.8\n",
@@ -384,9 +372,7 @@
{
"cell_type": "code",
"execution_count": 13,
- "metadata": {
- "collapsed": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"gas1.X = np.ones(53) # NumPy array of 53 ones"
@@ -402,9 +388,7 @@
{
"cell_type": "code",
"execution_count": 14,
- "metadata": {
- "collapsed": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"gas1.Y = np.ones(53)"
@@ -420,9 +404,7 @@
{
"cell_type": "code",
"execution_count": 15,
- "metadata": {
- "collapsed": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"gas1.SV = None, 2.1"
@@ -438,9 +420,7 @@
{
"cell_type": "code",
"execution_count": 16,
- "metadata": {
- "collapsed": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"gas1.TPX = None, None, 'CH4:1.0, O2:0.5'"
@@ -463,9 +443,7 @@
{
"cell_type": "code",
"execution_count": 17,
- "metadata": {
- "collapsed": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"Xmajor = gas1['CH4','O2','CO2','H2O','N2'].X"
@@ -481,9 +459,7 @@
{
"cell_type": "code",
"execution_count": 18,
- "metadata": {
- "collapsed": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"major = gas1['CH4','O2','CO2','H2O','N2']\n",
@@ -517,9 +493,7 @@
{
"cell_type": "code",
"execution_count": 19,
- "metadata": {
- "collapsed": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"ct.add_directory('/usr/local/cantera/my_data_files')"
@@ -537,9 +511,7 @@
{
"cell_type": "code",
"execution_count": 20,
- "metadata": {
- "collapsed": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"gas2 = ct.Solution('diamond.cti', 'gas')\n",
@@ -587,9 +559,7 @@
{
"cell_type": "code",
"execution_count": 21,
- "metadata": {
- "collapsed": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"g = ct.Solution('gri30.xml')"
@@ -605,9 +575,7 @@
{
"cell_type": "code",
"execution_count": 22,
- "metadata": {
- "collapsed": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"g?"
@@ -694,6 +662,8 @@
" '_init_cti_xml',\n",
" '_init_parts',\n",
" '_references',\n",
+ " 'activities',\n",
+ " 'activity_coefficients',\n",
" 'add_reaction',\n",
" 'add_species',\n",
" 'atomic_weight',\n",
@@ -728,7 +698,6 @@
" 'element_index',\n",
" 'element_name',\n",
" 'element_names',\n",
- " 'element_potentials',\n",
" 'elemental_mass_fraction',\n",
" 'elemental_mole_fraction',\n",
" 'enthalpy_mass',\n",
@@ -740,6 +709,7 @@
" 'forward_rate_constants',\n",
" 'forward_rates_of_progress',\n",
" 'g',\n",
+ " 'get_equivalence_ratio',\n",
" 'gibbs_mass',\n",
" 'gibbs_mole',\n",
" 'h',\n",
@@ -748,6 +718,8 @@
" 'is_reversible',\n",
" 'isothermal_compressibility',\n",
" 'kinetics_species_index',\n",
+ " 'kinetics_species_name',\n",
+ " 'kinetics_species_names',\n",
" 'mass_fraction_dict',\n",
" 'max_temp',\n",
" 'mean_molecular_weight',\n",
@@ -755,6 +727,7 @@
" 'mix_diff_coeffs',\n",
" 'mix_diff_coeffs_mass',\n",
" 'mix_diff_coeffs_mole',\n",
+ " 'mobilities',\n",
" 'modify_reaction',\n",
" 'modify_species',\n",
" 'mole_fraction_dict',\n",
@@ -802,6 +775,7 @@
" 'species_index',\n",
" 'species_name',\n",
" 'species_names',\n",
+ " 'species_viscosities',\n",
" 'standard_cp_R',\n",
" 'standard_enthalpies_RT',\n",
" 'standard_entropies_R',\n",
@@ -838,9 +812,7 @@
{
"cell_type": "code",
"execution_count": 24,
- "metadata": {
- "collapsed": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"g.species_index?"
@@ -857,7 +829,6 @@
"cell_type": "code",
"execution_count": 25,
"metadata": {
- "collapsed": true,
"scrolled": true
},
"outputs": [],
@@ -875,9 +846,7 @@
{
"cell_type": "code",
"execution_count": 26,
- "metadata": {
- "collapsed": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"g.__class__.T?"
@@ -932,9 +901,7 @@
{
"cell_type": "code",
"execution_count": 28,
- "metadata": {
- "collapsed": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"g = ct.Solution('gri30.xml')\n",
@@ -952,9 +919,7 @@
{
"cell_type": "code",
"execution_count": 29,
- "metadata": {
- "collapsed": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"g.TPX = 300.0, ct.one_atm, 'CH4:0.95, O2:2, N2:7.52'\n",
@@ -976,9 +941,7 @@
{
"cell_type": "code",
"execution_count": 30,
- "metadata": {
- "collapsed": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"g.TPX = 300.0, ct.one_atm, 'CH4:0.95, O2:2, N2:7.52'\n",
@@ -996,313 +959,313 @@
"name": "stdout",
"output_type": "stream",
"text": [
- " 0 5.285e-16 \n",
- " 1 -3.147e-15 \n",
- " 2 -2.362e-15 \n",
- " 3 -1.667e-15 \n",
- " 4 4.733e-15 \n",
- " 5 1.065e-14 \n",
- " 6 7.075e-15 \n",
- " 7 -2.011e-16 \n",
- " 8 1.046e-14 \n",
- " 9 1.745e-15 \n",
- " 10 8.84e-15 \n",
- " 11 5.404e-16 \n",
- " 12 -3.656e-15 \n",
- " 13 -3.441e-15 \n",
- " 14 1.932e-15 \n",
- " 15 5.203e-15 \n",
- " 16 3.312e-15 \n",
- " 17 -1.808e-14 \n",
- " 18 -1.598e-14 \n",
- " 19 -1.07e-14 \n",
- " 20 7.04e-15 \n",
- " 21 1.265e-14 \n",
- " 22 7.091e-15 \n",
- " 23 2.623e-16 \n",
- " 24 1.028e-14 \n",
- " 25 6.891e-15 \n",
- " 26 5.921e-15 \n",
- " 27 2.879e-15 \n",
- " 28 8.738e-16 \n",
- " 29 6.928e-15 \n",
- " 30 -2.736e-15 \n",
- " 31 2.515e-15 \n",
- " 32 2.115e-15 \n",
- " 33 8.353e-15 \n",
- " 34 8.335e-15 \n",
- " 35 8.207e-15 \n",
- " 37 -2.829e-15 \n",
- " 38 1.423e-16 \n",
- " 39 3.43e-16 \n",
- " 40 3.903e-15 \n",
- " 41 -3.341e-15 \n",
- " 42 5.475e-16 \n",
- " 43 -3.504e-15 \n",
+ " 0 -4.756e-15 \n",
+ " 1 -3.332e-15 \n",
+ " 2 -3.936e-16 \n",
+ " 3 -3.751e-15 \n",
+ " 4 -6.626e-15 \n",
+ " 5 -1.503e-15 \n",
+ " 6 5.377e-15 \n",
+ " 7 -1.609e-15 \n",
+ " 8 1.267e-14 \n",
+ " 9 -1.587e-16 \n",
+ " 10 -4.093e-15 \n",
+ " 11 7.16e-15 \n",
+ " 12 -9.032e-15 \n",
+ " 13 -1.72e-15 \n",
+ " 14 -2.147e-16 \n",
+ " 15 -5.203e-15 \n",
+ " 16 -1.743e-15 \n",
+ " 17 5.791e-15 \n",
+ " 18 1.957e-15 \n",
+ " 19 -5.548e-15 \n",
+ " 20 1.886e-15 \n",
+ " 21 1.421e-15 \n",
+ " 22 1.223e-16 \n",
+ " 23 9.182e-15 \n",
+ " 24 2.055e-15 \n",
+ " 25 -5.119e-15 \n",
+ " 26 3.383e-15 \n",
+ " 27 -1.44e-14 \n",
+ " 28 -3.495e-16 \n",
+ " 29 -1.949e-15 \n",
+ " 30 1.452e-14 \n",
+ " 31 1.048e-14 \n",
+ " 32 3.608e-15 \n",
+ " 33 -3.47e-15 \n",
+ " 34 -3.443e-15 \n",
+ " 35 9.966e-15 \n",
+ " 37 8.611e-16 \n",
+ " 38 -4.981e-15 \n",
+ " 39 -1.486e-15 \n",
+ " 40 -8.614e-15 \n",
+ " 41 -1.518e-15 \n",
+ " 42 -1.232e-15 \n",
+ " 43 -6.832e-15 \n",
" 44 -5.306e-15 \n",
- " 45 -3.81e-15 \n",
- " 46 7.042e-15 \n",
- " 47 6.951e-15 \n",
- " 48 5.15e-15 \n",
- " 49 1.929e-15 \n",
- " 50 -5.408e-15 \n",
- " 51 -4.728e-15 \n",
- " 52 4.812e-15 \n",
- " 53 -1.395e-15 \n",
- " 54 -7.24e-15 \n",
- " 55 -1.122e-14 \n",
- " 56 -8.41e-15 \n",
- " 57 -2.878e-15 \n",
- " 58 1.857e-14 \n",
- " 59 1.409e-14 \n",
- " 60 9.723e-15 \n",
- " 61 3.338e-15 \n",
- " 62 1.655e-14 \n",
- " 63 -1.881e-15 \n",
- " 64 1.077e-14 \n",
- " 65 7.982e-15 \n",
- " 66 1.713e-15 \n",
- " 67 -2.162e-14 \n",
- " 68 -1.374e-14 \n",
- " 69 -1.379e-14 \n",
- " 70 5.819e-15 \n",
- " 71 7.647e-15 \n",
- " 72 -5.403e-15 \n",
- " 73 -5.381e-15 \n",
- " 74 -7.317e-15 \n",
- " 75 -6.764e-15 \n",
- " 76 8.83e-15 \n",
- " 77 2.803e-15 \n",
- " 78 -2.353e-16 \n",
- " 79 -3.039e-15 \n",
- " 80 8.536e-15 \n",
- " 81 -3.427e-15 \n",
- " 82 7.58e-15 \n",
- " 83 4.796e-15 \n",
- " 84 5.406e-16 \n",
- " 85 5.275e-16 \n",
- " 86 -6.901e-15 \n",
- " 87 -1.658e-15 \n",
- " 88 -1.72e-15 \n",
- " 89 7.25e-15 \n",
- " 90 1.447e-14 \n",
- " 91 8.796e-15 \n",
- " 92 -3.166e-15 \n",
- " 93 8.89e-15 \n",
- " 94 7.953e-15 \n",
- " 95 -6.425e-15 \n",
- " 96 -6.243e-15 \n",
- " 97 3.487e-15 \n",
- " 98 0 \n",
- " 99 -1.069e-14 \n",
- " 100 1.697e-15 \n",
- " 101 1.078e-14 \n",
- " 102 1.072e-14 \n",
- " 103 -1.094e-14 \n",
- " 104 -1.537e-14 \n",
- " 105 -5.474e-15 \n",
- " 106 1.27e-14 \n",
- " 107 1.624e-14 \n",
- " 108 1.965e-14 \n",
- " 109 2.119e-14 \n",
- " 110 3.669e-15 \n",
- " 111 -2.852e-15 \n",
- " 112 -6.13e-15 \n",
- " 113 -4.862e-15 \n",
- " 114 -1.206e-14 \n",
- " 115 -1.234e-14 \n",
- " 116 -3.541e-16 \n",
- " 117 -3.296e-15 \n",
- " 118 -5.448e-15 \n",
- " 119 -1.78e-14 \n",
- " 120 -9.215e-15 \n",
- " 121 0 \n",
- " 122 1.878e-15 \n",
- " 123 -1.032e-14 \n",
- " 124 1.05e-14 \n",
- " 125 8.262e-15 \n",
- " 126 1.26e-14 \n",
- " 127 -3.641e-15 \n",
- " 128 1.434e-16 \n",
- " 129 1.269e-14 \n",
- " 130 1.397e-15 \n",
- " 131 1.414e-14 \n",
- " 132 5.977e-16 \n",
- " 133 -7.276e-15 \n",
- " 135 1.762e-15 \n",
- " 136 -1.105e-14 \n",
- " 137 3.411e-16 \n",
- " 138 9.284e-15 \n",
- " 139 -3.977e-16 \n",
- " 140 -3.641e-15 \n",
- " 141 6.526e-15 \n",
- " 143 3.036e-15 \n",
- " 144 -3.935e-15 \n",
- " 145 4.489e-15 \n",
- " 146 1.506e-14 \n",
- " 147 -3.013e-16 \n",
- " 148 4.12e-15 \n",
- " 149 9.76e-15 \n",
- " 150 -2.996e-16 \n",
- " 151 6.341e-15 \n",
- " 152 1.402e-14 \n",
- " 153 1.344e-14 \n",
- " 154 -1.047e-14 \n",
- " 155 -7.371e-15 \n",
- " 156 -4.354e-15 \n",
- " 157 -1.26e-14 \n",
- " 158 -6.794e-15 \n",
- " 159 -1.424e-14 \n",
- " 160 -9.318e-16 \n",
- " 161 -2.685e-14 \n",
- " 162 -3.156e-14 \n",
- " 163 -1.211e-14 \n",
- " 164 3.935e-15 \n",
- " 165 -5.618e-15 \n",
- " 166 -5.607e-15 \n",
- " 167 3.292e-15 \n",
- " 168 1.261e-14 \n",
- " 169 4.311e-15 \n",
- " 170 -3.259e-16 \n",
- " 171 -1.154e-14 \n",
- " 172 2.461e-14 \n",
- " 173 -1.329e-14 \n",
- " 174 7.51e-15 \n",
- " 175 -9.564e-16 \n",
- " 176 -7.937e-16 \n",
- " 177 3.23e-15 \n",
- " 178 1.637e-15 \n",
- " 179 3.705e-15 \n",
- " 180 2.004e-16 \n",
- " 181 3.797e-15 \n",
- " 182 -3.904e-15 \n",
- " 183 7.03e-15 \n",
- " 184 2.849e-15 \n",
- " 185 -2.256e-15 \n",
- " 186 2.02e-15 \n",
- " 187 3.979e-16 \n",
- " 188 -1.811e-15 \n",
- " 189 2.02e-15 \n",
- " 190 -8.31e-16 \n",
- " 191 0 \n",
- " 192 2.007e-15 \n",
- " 193 -2.79e-15 \n",
- " 194 0 \n",
- " 195 3.527e-15 \n",
- " 196 -5.021e-15 \n",
- " 197 -3.874e-15 \n",
- " 198 -1.844e-15 \n",
- " 199 5.081e-16 \n",
- " 200 0 \n",
- " 201 -4.036e-15 \n",
- " 202 6.85e-16 \n",
- " 203 -5.581e-15 \n",
- " 204 -5.864e-15 \n",
- " 205 1.635e-15 \n",
- " 206 -7.294e-15 \n",
- " 207 -8.683e-16 \n",
+ " 45 -9.065e-15 \n",
+ " 46 -9.2e-15 \n",
+ " 47 -1.436e-14 \n",
+ " 48 -7.131e-15 \n",
+ " 49 -1.415e-15 \n",
+ " 50 -1.151e-16 \n",
+ " 51 2.08e-15 \n",
+ " 52 -7.122e-15 \n",
+ " 53 -6.697e-15 \n",
+ " 54 -1.066e-14 \n",
+ " 55 4.771e-15 \n",
+ " 56 1.255e-15 \n",
+ " 57 -2.753e-15 \n",
+ " 58 -1.199e-14 \n",
+ " 59 -7.143e-15 \n",
+ " 60 -1.246e-14 \n",
+ " 61 -1.46e-14 \n",
+ " 62 -8.636e-15 \n",
+ " 63 4.3e-15 \n",
+ " 64 -3.79e-15 \n",
+ " 65 -7.982e-15 \n",
+ " 66 -1.074e-14 \n",
+ " 67 3.123e-15 \n",
+ " 68 -1.094e-15 \n",
+ " 69 -5.515e-15 \n",
+ " 70 -8.543e-15 \n",
+ " 71 8.996e-15 \n",
+ " 72 4.953e-15 \n",
+ " 73 6.249e-15 \n",
+ " 74 -1.42e-14 \n",
+ " 75 -8.455e-15 \n",
+ " 76 -1.624e-14 \n",
+ " 77 -2.242e-16 \n",
+ " 78 -6.353e-15 \n",
+ " 79 -3.199e-15 \n",
+ " 80 -3.712e-15 \n",
+ " 81 7.139e-16 \n",
+ " 82 5.75e-15 \n",
+ " 83 3.837e-15 \n",
+ " 84 8.785e-15 \n",
+ " 85 1.055e-15 \n",
+ " 86 3.893e-15 \n",
+ " 87 -5.307e-15 \n",
+ " 88 -5.318e-15 \n",
+ " 89 1.908e-16 \n",
+ " 90 1.085e-14 \n",
+ " 91 7.232e-15 \n",
+ " 92 2.015e-15 \n",
+ " 93 7.362e-15 \n",
+ " 94 -1.295e-15 \n",
+ " 95 2.142e-15 \n",
+ " 96 -2.141e-15 \n",
+ " 97 -3.184e-15 \n",
+ " 98 6.945e-15 \n",
+ " 99 3.564e-16 \n",
+ " 100 1.851e-15 \n",
+ " 101 -1.03e-14 \n",
+ " 102 -6.984e-15 \n",
+ " 103 7.083e-15 \n",
+ " 104 3.502e-15 \n",
+ " 105 8.553e-16 \n",
+ " 106 2.694e-15 \n",
+ " 107 2.082e-15 \n",
+ " 108 2.527e-15 \n",
+ " 109 -1.614e-15 \n",
+ " 110 1.44e-14 \n",
+ " 111 -1.036e-14 \n",
+ " 112 1.086e-14 \n",
+ " 113 -5.672e-15 \n",
+ " 114 -3.447e-15 \n",
+ " 115 -3.33e-15 \n",
+ " 116 -3.541e-15 \n",
+ " 117 -5.337e-15 \n",
+ " 118 -9.301e-16 \n",
+ " 119 1.057e-14 \n",
+ " 120 6.485e-15 \n",
+ " 121 -1.702e-15 \n",
+ " 122 2.113e-15 \n",
+ " 123 3.496e-15 \n",
+ " 124 5.331e-15 \n",
+ " 125 3.978e-15 \n",
+ " 126 5.315e-15 \n",
+ " 127 -3.337e-15 \n",
+ " 128 -6.885e-15 \n",
+ " 129 1.692e-16 \n",
+ " 130 4.969e-15 \n",
+ " 131 7.138e-15 \n",
+ " 132 1.494e-16 \n",
+ " 133 -1.433e-14 \n",
+ " 135 2.202e-15 \n",
+ " 136 -3.558e-15 \n",
+ " 137 1.705e-15 \n",
+ " 138 -5.142e-15 \n",
+ " 139 2.187e-15 \n",
+ " 140 -1.063e-14 \n",
+ " 141 4.121e-15 \n",
+ " 143 1.518e-15 \n",
+ " 144 3.739e-15 \n",
+ " 145 6.05e-15 \n",
+ " 146 2.349e-15 \n",
+ " 147 4.067e-15 \n",
+ " 148 5.183e-15 \n",
+ " 149 -4.704e-16 \n",
+ " 150 4.195e-15 \n",
+ " 151 -2.67e-15 \n",
+ " 152 -3.171e-15 \n",
+ " 153 6.19e-15 \n",
+ " 154 2.475e-15 \n",
+ " 155 1.559e-15 \n",
+ " 156 -2.177e-15 \n",
+ " 157 2.065e-15 \n",
+ " 158 1.207e-14 \n",
+ " 159 -1.072e-14 \n",
+ " 160 4.26e-15 \n",
+ " 161 9.977e-15 \n",
+ " 162 5.986e-15 \n",
+ " 163 -7.571e-15 \n",
+ " 164 1.389e-14 \n",
+ " 165 -2.985e-15 \n",
+ " 166 -8.343e-15 \n",
+ " 167 -1.873e-14 \n",
+ " 168 1.15e-14 \n",
+ " 169 1.584e-14 \n",
+ " 170 6.844e-15 \n",
+ " 171 1.539e-15 \n",
+ " 172 6.997e-15 \n",
+ " 173 -3.021e-15 \n",
+ " 174 -9.388e-15 \n",
+ " 175 -1.301e-14 \n",
+ " 176 -1.29e-14 \n",
+ " 177 1.794e-15 \n",
+ " 178 3.525e-15 \n",
+ " 179 2.044e-15 \n",
+ " 180 5.211e-15 \n",
+ " 181 3.137e-15 \n",
+ " 182 -5.092e-16 \n",
+ " 183 2.429e-15 \n",
+ " 184 6.597e-15 \n",
+ " 185 4.338e-15 \n",
+ " 186 5.61e-16 \n",
+ " 187 -2.652e-16 \n",
+ " 188 -7.74e-15 \n",
+ " 189 1.885e-15 \n",
+ " 190 -4.779e-15 \n",
+ " 191 7.254e-15 \n",
+ " 192 2.737e-15 \n",
+ " 193 1.462e-15 \n",
+ " 194 -2.185e-15 \n",
+ " 195 -3.68e-15 \n",
+ " 196 -3.195e-15 \n",
+ " 197 0 \n",
+ " 198 1.844e-16 \n",
+ " 199 -6.266e-15 \n",
+ " 200 1.042e-15 \n",
+ " 201 -2.691e-15 \n",
+ " 202 1.096e-15 \n",
+ " 203 5.445e-16 \n",
+ " 204 4.599e-16 \n",
+ " 205 3.419e-15 \n",
+ " 206 1.975e-15 \n",
+ " 207 -2.171e-16 \n",
" 208 -3.651e-15 \n",
- " 209 -1.312e-16 \n",
- " 210 -6.959e-15 \n",
- " 211 -4.865e-15 \n",
- " 212 1.528e-15 \n",
- " 213 -1.928e-15 \n",
- " 214 -3.551e-15 \n",
- " 215 3.246e-15 \n",
- " 216 0 \n",
- " 217 3.698e-15 \n",
- " 218 1.74e-15 \n",
- " 219 4.112e-15 \n",
- " 220 -3.154e-15 \n",
- " 221 1.719e-16 \n",
- " 222 -1.883e-15 \n",
- " 223 -1.395e-16 \n",
- " 224 3.45e-15 \n",
- " 225 3.525e-15 \n",
- " 226 -4.259e-16 \n",
- " 227 3.692e-15 \n",
- " 228 1.502e-16 \n",
- " 229 2.901e-15 \n",
- " 230 4.818e-15 \n",
- " 231 3.617e-15 \n",
- " 232 1.173e-15 \n",
- " 233 4.679e-15 \n",
- " 234 4.893e-15 \n",
- " 235 3.684e-15 \n",
- " 236 7.41e-15 \n",
- " 237 0 \n",
- " 238 -1.761e-15 \n",
- " 239 7.82e-16 \n",
- " 240 1.306e-15 \n",
- " 241 -7.974e-15 \n",
- " 242 -1.807e-15 \n",
- " 243 -7.132e-16 \n",
- " 244 0 \n",
- " 245 3.281e-15 \n",
- " 246 8.649e-15 \n",
- " 247 1.048e-14 \n",
- " 248 3.319e-15 \n",
- " 249 -4.6e-16 \n",
- " 250 1.996e-15 \n",
- " 251 3.33e-15 \n",
- " 252 -1.226e-16 \n",
- " 253 2.128e-15 \n",
- " 254 -1.405e-14 \n",
- " 255 -3.197e-15 \n",
- " 256 3.222e-15 \n",
- " 257 3.815e-15 \n",
- " 258 1.361e-14 \n",
- " 259 1.054e-14 \n",
- " 260 7.209e-15 \n",
- " 261 -7.213e-15 \n",
- " 262 -1.652e-15 \n",
- " 263 2.016e-16 \n",
- " 264 -7.362e-16 \n",
- " 265 -4.098e-15 \n",
- " 266 -5.895e-15 \n",
- " 267 -8.422e-16 \n",
- " 268 -4.317e-16 \n",
- " 269 3.407e-15 \n",
- " 270 -2.196e-15 \n",
- " 271 -2.216e-16 \n",
- " 272 -3.187e-16 \n",
- " 273 1.906e-15 \n",
- " 274 4.433e-15 \n",
- " 275 -3.722e-15 \n",
- " 276 4.478e-15 \n",
- " 277 2.749e-15 \n",
- " 278 1.997e-15 \n",
- " 279 6.178e-15 \n",
- " 280 5.352e-15 \n",
- " 281 3.816e-15 \n",
- " 282 0 \n",
- " 284 4.345e-15 \n",
- " 285 1.062e-14 \n",
- " 286 -7.052e-15 \n",
- " 288 9.538e-15 \n",
- " 290 6.84e-15 \n",
- " 293 1.136e-14 \n",
- " 294 2.485e-15 \n",
- " 295 -1.321e-14 \n",
- " 298 2.783e-15 \n",
- " 303 6.31e-15 \n",
- " 307 5.697e-15 \n",
- " 308 -1.076e-14 \n",
- " 309 7.356e-15 \n",
- " 310 3.072e-15 \n",
- " 311 -6.465e-15 \n",
- " 312 6.144e-15 \n",
- " 313 8.81e-15 \n",
- " 314 7.097e-15 \n",
- " 315 -8.59e-15 \n",
- " 316 4.047e-15 \n",
- " 317 3.918e-16 \n",
- " 318 1.038e-14 \n",
- " 319 -6.812e-15 \n",
- " 320 6.885e-16 \n",
- " 321 -1.572e-14 \n",
- " 322 -7.739e-15 \n",
- " 324 -5.967e-15 \n"
+ " 209 -6.822e-15 \n",
+ " 210 -3.846e-15 \n",
+ " 211 -1.802e-16 \n",
+ " 212 -3.82e-15 \n",
+ " 213 -5.635e-15 \n",
+ " 214 -1.592e-15 \n",
+ " 215 -1.546e-16 \n",
+ " 216 -8.714e-15 \n",
+ " 217 -3.328e-15 \n",
+ " 218 -4.757e-15 \n",
+ " 219 1.028e-15 \n",
+ " 220 2.253e-15 \n",
+ " 221 -1.891e-15 \n",
+ " 222 0 \n",
+ " 223 3.906e-15 \n",
+ " 224 -3.623e-15 \n",
+ " 225 1.41e-14 \n",
+ " 226 -8.518e-16 \n",
+ " 227 -5.316e-15 \n",
+ " 228 7.057e-15 \n",
+ " 229 4.955e-15 \n",
+ " 230 -2.811e-15 \n",
+ " 231 -1.608e-15 \n",
+ " 232 2.607e-16 \n",
+ " 233 1.704e-14 \n",
+ " 234 1.288e-14 \n",
+ " 235 -2.403e-15 \n",
+ " 236 -4.359e-16 \n",
+ " 237 -3.755e-15 \n",
+ " 238 5.284e-15 \n",
+ " 239 -3.91e-16 \n",
+ " 240 1.543e-15 \n",
+ " 241 1.687e-15 \n",
+ " 242 6.066e-15 \n",
+ " 243 6.419e-15 \n",
+ " 244 1.869e-16 \n",
+ " 245 -1.777e-15 \n",
+ " 246 -5.017e-15 \n",
+ " 247 7.063e-15 \n",
+ " 248 7.223e-15 \n",
+ " 249 -3.68e-15 \n",
+ " 250 2.928e-15 \n",
+ " 251 1.082e-14 \n",
+ " 252 -3.555e-15 \n",
+ " 253 3.688e-15 \n",
+ " 254 -3.464e-15 \n",
+ " 255 -7.992e-16 \n",
+ " 256 -5.37e-16 \n",
+ " 257 -8.861e-15 \n",
+ " 258 1.002e-14 \n",
+ " 259 1.473e-15 \n",
+ " 260 -3.605e-15 \n",
+ " 261 5.441e-15 \n",
+ " 262 -1.404e-14 \n",
+ " 263 -8.87e-15 \n",
+ " 264 -1.509e-14 \n",
+ " 265 -1.192e-14 \n",
+ " 266 -1.179e-15 \n",
+ " 267 -1.684e-15 \n",
+ " 268 -9.065e-15 \n",
+ " 269 5.379e-15 \n",
+ " 270 -7.503e-15 \n",
+ " 271 -1.064e-14 \n",
+ " 272 -3.506e-15 \n",
+ " 273 1.121e-16 \n",
+ " 274 1.825e-15 \n",
+ " 275 -7.158e-15 \n",
+ " 276 -1.008e-14 \n",
+ " 277 4.998e-16 \n",
+ " 278 -6.989e-15 \n",
+ " 279 -1.959e-14 \n",
+ " 280 -7.091e-15 \n",
+ " 281 -1.734e-16 \n",
+ " 282 -5.24e-15 \n",
+ " 284 6.646e-15 \n",
+ " 285 -1.078e-14 \n",
+ " 286 3.836e-15 \n",
+ " 288 2.384e-15 \n",
+ " 290 0 \n",
+ " 293 1.232e-14 \n",
+ " 294 8.698e-15 \n",
+ " 295 1.071e-14 \n",
+ " 298 7.763e-15 \n",
+ " 303 3.944e-15 \n",
+ " 307 -4.906e-15 \n",
+ " 308 -7.438e-15 \n",
+ " 309 -1.769e-14 \n",
+ " 310 7.541e-15 \n",
+ " 311 7.415e-15 \n",
+ " 312 -1.229e-14 \n",
+ " 313 -8.027e-15 \n",
+ " 314 -4.22e-15 \n",
+ " 315 -8.59e-16 \n",
+ " 316 -1.138e-15 \n",
+ " 317 1.371e-14 \n",
+ " 318 -5.547e-15 \n",
+ " 319 -1.629e-15 \n",
+ " 320 -8.262e-15 \n",
+ " 321 1.1e-14 \n",
+ " 322 -4.614e-15 \n",
+ " 324 1.068e-14 \n"
]
}
],
@@ -1463,9 +1426,7 @@
{
"cell_type": "code",
"execution_count": 37,
- "metadata": {
- "collapsed": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"g.TPX = 300, 101325, {'CH4':0.6, 'O2':1.0, 'N2':3.76}\n",
@@ -1487,8 +1448,7 @@
{
"data": {
"text/plain": [
- "array([ -1.01643954e-19, -5.08219768e-21, -1.77635684e-15,\n",
- " 9.91028548e-20])"
+ "array([-8.80914265e-20, -1.03761536e-20, -1.77635684e-15, -4.99749439e-20])"
]
},
"execution_count": 38,
@@ -1515,8 +1475,7 @@
{
"data": {
"text/plain": [
- "array([ 3.18644948e-05, 5.00489577e-08, 1.05964923e-01,\n",
- " 2.89502609e-06])"
+ "array([3.18644948e-05, 5.00489577e-08, 1.05964923e-01, 2.89502609e-06])"
]
},
"execution_count": 39,
@@ -1544,8 +1503,7 @@
{
"data": {
"text/plain": [
- "array([ -5.33034657e+08, -2.23248515e+07, -8.76650086e+07,\n",
- " -2.49169628e+08])"
+ "array([-5.33034657e+08, -2.23248515e+07, -8.76650086e+07, -2.49169628e+08])"
]
},
"execution_count": 40,
@@ -1572,7 +1530,7 @@
{
"data": {
"text/plain": [
- "-58013370.720880888"
+ "-58013370.72088288"
]
},
"execution_count": 41,
@@ -1599,7 +1557,7 @@
{
"data": {
"text/plain": [
- "-58013370.720880821"
+ "-58013370.72088274"
]
},
"execution_count": 42,
@@ -1626,7 +1584,7 @@
{
"data": {
"text/plain": [
- "-9307123.2625650223"
+ "-9307123.262565034"
]
},
"execution_count": 43,
@@ -1662,7 +1620,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.6.2"
+ "version": "3.7.2"
}
},
"nbformat": 4,
diff --git a/reactors/NonIdealShockTube.ipynb b/reactors/NonIdealShockTube.ipynb
index 6bc9197..3e85dc7 100644
--- a/reactors/NonIdealShockTube.ipynb
+++ b/reactors/NonIdealShockTube.ipynb
@@ -38,14 +38,14 @@
},
{
"cell_type": "code",
- "execution_count": 7,
+ "execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
- "Runnning Cantera version: 2.4.0a1\n"
+ "Runnning Cantera version: 2.5.0a2\n"
]
}
],
@@ -62,6 +62,21 @@
"print('Runnning Cantera version: ' + ct.__version__)"
]
},
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "%matplotlib notebook\n",
+ "import matplotlib.pyplot as plt\n",
+ "\n",
+ "plt.rcParams['axes.labelsize'] = 16\n",
+ "plt.rcParams['xtick.labelsize'] = 12\n",
+ "plt.rcParams['ytick.labelsize'] = 12\n",
+ "plt.rcParams['figure.autolayout'] = True"
+ ]
+ },
{
"cell_type": "markdown",
"metadata": {},
@@ -75,34 +90,9 @@
},
{
"cell_type": "code",
- "execution_count": 8,
+ "execution_count": 3,
"metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "\n",
- "\n",
- "**** WARNING ****\n",
- "For species c5h11, discontinuity in cp/R detected at Tmid = 1000\n",
- "\tValue computed using low-temperature polynomial: 32.0653\n",
- "\tValue computed using high-temperature polynomial: 32.1675\n",
- "\n",
- "\n",
- "**** WARNING ****\n",
- "For species c4h4, discontinuity in cp/R detected at Tmid = 1000\n",
- "\tValue computed using low-temperature polynomial: 16.6543\n",
- "\tValue computed using high-temperature polynomial: 16.6734\n",
- "\n",
- "\n",
- "**** WARNING ****\n",
- "For species A3-, discontinuity in cp/R detected at Tmid = 1000\n",
- "\tValue computed using low-temperature polynomial: 52.2095\n",
- "\tValue computed using high-temperature polynomial: 52.364\n"
- ]
- }
- ],
+ "outputs": [],
"source": [
"gas = ct.Solution('data/WangMechanismRK.cti')"
]
@@ -116,10 +106,8 @@
},
{
"cell_type": "code",
- "execution_count": 9,
- "metadata": {
- "collapsed": true
- },
+ "execution_count": 4,
+ "metadata": {},
"outputs": [],
"source": [
"# Define the reactor temperature and pressure:\n",
@@ -137,7 +125,7 @@
"r = ct.Reactor(contents=gas)\n",
"reactorNetwork = ct.ReactorNet([r])\n",
"\n",
- "# now compile a list of all variables for which we will store data\n",
+ "# Now compile a list of all variables for which we will store data\n",
"stateVariableNames = [r.component_name(item) for item in range(r.n_vars)]\n",
"\n",
"# Use the above list to create a DataFrame\n",
@@ -153,10 +141,8 @@
},
{
"cell_type": "code",
- "execution_count": 10,
- "metadata": {
- "collapsed": true
- },
+ "execution_count": 5,
+ "metadata": {},
"outputs": [],
"source": [
"def ignitionDelay(df, species):\n",
@@ -164,24 +150,24 @@
" This function computes the ignition delay from the occurence of the\n",
" peak in species' concentration.\n",
" \"\"\"\n",
- " return df[species].argmax()"
+ " return df[species].idxmax()"
]
},
{
"cell_type": "code",
- "execution_count": 11,
+ "execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
- "Computed Ignition Delay: 4.093e-04 seconds. Took 3.12s to compute\n"
+ "Computed Ignition Delay: 4.093e-04 seconds. Took 3.98s to compute\n"
]
}
],
"source": [
- "#Tic\n",
+ "# Tic\n",
"t0 = time.time()\n",
"\n",
"# This is a starting estimate. If you do not get an ignition within this time, increase it\n",
@@ -200,7 +186,7 @@
"# We will use the 'oh' species to compute the ignition delay\n",
"tau = ignitionDelay(timeHistory, 'oh')\n",
"\n",
- "#Toc\n",
+ "# Toc\n",
"t1 = time.time()\n",
"\n",
"print('Computed Ignition Delay: {:.3e} seconds. Took {:3.2f}s to compute'.format(tau, t1-t0))\n",
@@ -224,23 +210,6 @@
"### Import modules and set plotting defaults"
]
},
- {
- "cell_type": "code",
- "execution_count": 12,
- "metadata": {
- "collapsed": true
- },
- "outputs": [],
- "source": [
- "import matplotlib.pyplot as plt\n",
- "import matplotlib as mpl\n",
- "\n",
- "plt.rcParams['axes.labelsize'] = 16\n",
- "plt.rcParams['xtick.labelsize'] = 12\n",
- "plt.rcParams['ytick.labelsize'] = 12\n",
- "plt.rcParams['figure.autolayout'] = True"
- ]
- },
{
"cell_type": "markdown",
"metadata": {},
@@ -250,154 +219,8 @@
},
{
"cell_type": "code",
- "execution_count": 14,
- "metadata": {
- "collapsed": true
- },
- "outputs": [],
- "source": [
- "plt.figure()\n",
- "plt.plot(timeHistory.index, timeHistory['oh'],'-o',color='b',markersize=4)\n",
- "plt.xlabel('Time (s)',fontname='Times New Roman')\n",
- "plt.ylabel('$\\mathdefault{OH\\, mass\\, fraction,}\\, Y_{OH}}$',fontname='Times New Roman')\n",
- "\n",
- "# Figure formatting:\n",
- "plt.xlim([0,0.00075])\n",
- "ax = plt.gca()\n",
- "font = plt.matplotlib.font_manager.FontProperties(family='Times New Roman',size=14)\n",
- "ax.annotate(\"\",xy=(tau,0.005), xytext=(0,0.005),arrowprops=dict(arrowstyle=\"<|-|>\",color='r',linewidth=2.0),fontsize=14,)\n",
- "plt.annotate('Ignition Delay Time (IDT)', xy=(0,0), xytext=(0.00004, 0.00525), family='Times New Roman',fontsize=16);\n",
- "\n",
- "for tick in ax.xaxis.get_major_ticks():\n",
- " tick.label1.set_fontsize(12)\n",
- " tick.label1.set_fontname('Times New Roman')\n",
- "for tick in ax.yaxis.get_major_ticks():\n",
- " tick.label1.set_fontsize(12)\n",
- " tick.label1.set_fontname('Times New Roman')"
- ]
- },
- {
- "cell_type": "markdown",
+ "execution_count": 7,
"metadata": {},
- "source": [
- "## Illustration : NTC behavior\n",
- "In the paper by Kogekar, et al., the reactor model is used to demonstrate the impacts of non-ideal behavior on IDTs in the **N**egative **T**emperature **C**oefficient region, where observed IDTs, counter to intuition, increase with increasing temperature."
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "### Define the temperatures for which we will run the simulations"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 20,
- "metadata": {
- "collapsed": true
- },
- "outputs": [],
- "source": [
- "# Make a list of all the temperatures we would like to run simulations at\n",
- "T = [1800, 1600, 1400, 1200, 1100, 1075, 1050, 1025, 1000, 975, 950, 925, 900, 850, 825, 800,\n",
- " 750, 700]\n",
- "\n",
- "estimatedIgnitionDelayTimes = np.ones(len(T))\n",
- "\n",
- "# Set the initial guesses to a common value. We could probably speed up simulations \n",
- "# by tuning this guess, but as seen in the figure above, the 'extra' time after igntion \n",
- "# does not add many data points or simulation steps. The time savings would be small.\n",
- "estimatedIgnitionDelayTimes[:] = 0.005\n",
- "\n",
- "# Now create a dataFrame out of these\n",
- "ignitionDelays = pd.DataFrame(data={'T':T})\n",
- "ignitionDelays['ignDelay'] = np.nan"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "Run the code above for each temperature, and save the IDT for each."
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 21,
- "metadata": {
- "scrolled": false
- },
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Computed Ignition Delay: 6.354e-07 seconds for T=1800K. Took 2.02s to compute\n",
- "Computed Ignition Delay: 1.586e-06 seconds for T=1600K. Took 2.11s to compute\n",
- "Computed Ignition Delay: 5.786e-06 seconds for T=1400K. Took 2.34s to compute\n",
- "Computed Ignition Delay: 3.911e-05 seconds for T=1200K. Took 2.67s to compute\n",
- "Computed Ignition Delay: 1.326e-04 seconds for T=1100K. Took 2.94s to compute\n",
- "Computed Ignition Delay: 1.839e-04 seconds for T=1075K. Took 2.77s to compute\n",
- "Computed Ignition Delay: 2.533e-04 seconds for T=1050K. Took 2.90s to compute\n",
- "Computed Ignition Delay: 3.365e-04 seconds for T=1025K. Took 3.04s to compute\n",
- "Computed Ignition Delay: 4.093e-04 seconds for T=1000K. Took 3.13s to compute\n",
- "Computed Ignition Delay: 4.289e-04 seconds for T=975K. Took 3.06s to compute\n",
- "Computed Ignition Delay: 3.911e-04 seconds for T=950K. Took 3.34s to compute\n",
- "Computed Ignition Delay: 3.407e-04 seconds for T=925K. Took 3.21s to compute\n",
- "Computed Ignition Delay: 3.145e-04 seconds for T=900K. Took 3.30s to compute\n",
- "Computed Ignition Delay: 3.233e-04 seconds for T=850K. Took 3.51s to compute\n",
- "Computed Ignition Delay: 3.439e-04 seconds for T=825K. Took 3.48s to compute\n",
- "Computed Ignition Delay: 3.852e-04 seconds for T=800K. Took 3.63s to compute\n",
- "Computed Ignition Delay: 6.824e-04 seconds for T=750K. Took 3.92s to compute\n",
- "Computed Ignition Delay: 2.056e-03 seconds for T=700K. Took 4.04s to compute\n"
- ]
- }
- ],
- "source": [
- "for i, temperature in enumerate(T):\n",
- " # Setup the gas and reactor\n",
- " reactorTemperature = temperature\n",
- " reactorPressure = 40.0*101325.0\n",
- " gas.TP = reactorTemperature, reactorPressure\n",
- " gas.set_equivalence_ratio(phi=1.0, fuel='c12h26', oxidizer={'o2':1.0, 'n2':3.76})\n",
- " r = ct.Reactor(contents=gas)\n",
- " reactorNetwork = ct.ReactorNet([r])\n",
- "\n",
- " # Create and empty data frame\n",
- " timeHistory = pd.DataFrame(columns=timeHistory.columns)\n",
- "\n",
- " t0 = time.time()\n",
- "\n",
- " t = 0\n",
- " counter = 0\n",
- " while t < estimatedIgnitionDelayTimes[i]:\n",
- " t = reactorNetwork.step()\n",
- " if not counter % 20:\n",
- " timeHistory.loc[t] = r.get_state()\n",
- " counter += 1\n",
- "\n",
- " tau = ignitionDelay(timeHistory, 'oh')\n",
- " t1 = time.time()\n",
- "\n",
- " print('Computed Ignition Delay: {:.3e} seconds for T={}K. Took {:3.2f}s to compute'.format(tau, temperature, t1-t0))\n",
- "\n",
- " ignitionDelays.set_value(index=i, col='ignDelay', value=tau)"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "### Figure: ignition delay ($\\tau$) vs. the inverse of temperature ($\\frac{1000}{T}$). "
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 23,
- "metadata": {
- "scrolled": false
- },
"outputs": [
{
"data": {
@@ -481,7 +304,7 @@
" };\n",
"\n",
" this.imageObj.onunload = function() {\n",
- " this.ws.close();\n",
+ " fig.ws.close();\n",
" }\n",
"\n",
" this.ws.onmessage = this._make_on_message_function(this);\n",
@@ -956,7 +779,7 @@
"mpl.figure.prototype.toolbar_button_onmouseover = function(tooltip) {\n",
" this.message.textContent = tooltip;\n",
"};\n",
- "mpl.toolbar_items = [[\"Home\", \"Reset original view\", \"fa fa-home icon-home\", \"home\"], [\"Back\", \"Back to previous view\", \"fa fa-arrow-left icon-arrow-left\", \"back\"], [\"Forward\", \"Forward to next view\", \"fa fa-arrow-right icon-arrow-right\", \"forward\"], [\"\", \"\", \"\", \"\"], [\"Pan\", \"Pan axes with left mouse, zoom with right\", \"fa fa-arrows icon-move\", \"pan\"], [\"Zoom\", \"Zoom to rectangle\", \"fa fa-square-o icon-check-empty\", \"zoom\"], [\"\", \"\", \"\", \"\"], [\"Download\", \"Download plot\", \"fa fa-floppy-o icon-save\", \"download\"]];\n",
+ "mpl.toolbar_items = [[\"Home\", \"Reset original view\", \"fa fa-home icon-home\", \"home\"], [\"Back\", \"Back to previous view\", \"fa fa-arrow-left icon-arrow-left\", \"back\"], [\"Forward\", \"Forward to next view\", \"fa fa-arrow-right icon-arrow-right\", \"forward\"], [\"\", \"\", \"\", \"\"], [\"Pan\", \"Pan axes with left mouse, zoom with right\", \"fa fa-arrows icon-move\", \"pan\"], [\"Zoom\", \"Zoom to rectangle\", \"fa fa-square-o icon-check-empty\", \"zoom\"], [\"\", \"\", \"\", \"\"], [\"Download\", \"Download plot\", \"fa fa-floppy-o icon-save\", \"download\"]];\n",
"\n",
"mpl.extensions = [\"eps\", \"pdf\", \"png\", \"ps\", \"raw\", \"svg\"];\n",
"\n",
@@ -976,7 +799,7 @@
" // Register the callback with on_msg.\n",
" comm.on_msg(function(msg) {\n",
" //console.log('receiving', msg['content']['data'], msg);\n",
- " // Pass the mpl event to the overriden (by mpl) onmessage function.\n",
+ " // Pass the mpl event to the overridden (by mpl) onmessage function.\n",
" ws.onmessage(msg['content']['data'])\n",
" });\n",
" return ws;\n",
@@ -1128,9 +951,12 @@
" // Check for shift+enter\n",
" if (event.shiftKey && event.which == 13) {\n",
" this.canvas_div.blur();\n",
- " // select the cell after this one\n",
- " var index = IPython.notebook.find_cell_index(this.cell_info[0]);\n",
- " IPython.notebook.select(index + 1);\n",
+ " event.shiftKey = false;\n",
+ " // Send a \"J\" for go to next cell\n",
+ " event.which = 74;\n",
+ " event.keyCode = 74;\n",
+ " manager.command_mode();\n",
+ " manager.handle_keydown(event);\n",
" }\n",
"}\n",
"\n",
@@ -1179,7 +1005,942 @@
{
"data": {
"text/html": [
- "
"
+ "
"
+ ],
+ "text/plain": [
+ ""
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "plt.figure()\n",
+ "plt.plot(timeHistory.index, timeHistory['oh'],'-o',color='b',markersize=4)\n",
+ "plt.xlabel('Time (s)',fontname='Times New Roman')\n",
+ "plt.ylabel('$\\mathdefault{OH\\, mass\\, fraction,}\\, Y_{OH}}$',fontname='Times New Roman')\n",
+ "\n",
+ "# Figure formatting:\n",
+ "plt.xlim([0,0.00075])\n",
+ "ax = plt.gca()\n",
+ "font = plt.matplotlib.font_manager.FontProperties(family='Times New Roman',size=14)\n",
+ "ax.annotate(\"\",xy=(tau,0.005), xytext=(0,0.005),arrowprops=dict(arrowstyle=\"<|-|>\",color='r',linewidth=2.0),fontsize=14,)\n",
+ "plt.annotate('Ignition Delay Time (IDT)', xy=(0,0), xytext=(0.00004, 0.00525), family='Times New Roman',fontsize=16);\n",
+ "\n",
+ "for tick in ax.xaxis.get_major_ticks():\n",
+ " tick.label1.set_fontsize(12)\n",
+ " tick.label1.set_fontname('Times New Roman')\n",
+ "for tick in ax.yaxis.get_major_ticks():\n",
+ " tick.label1.set_fontsize(12)\n",
+ " tick.label1.set_fontname('Times New Roman')"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Illustration : NTC behavior\n",
+ "In the paper by Kogekar, et al., the reactor model is used to demonstrate the impacts of non-ideal behavior on IDTs in the **N**egative **T**emperature **C**oefficient region, where observed IDTs, counter to intuition, increase with increasing temperature."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Define the temperatures for which we will run the simulations"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 8,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Make a list of all the temperatures we would like to run simulations at\n",
+ "T = [1800, 1600, 1400, 1200, 1100, 1075, 1050, 1025, 1000, 975, 950, 925, 900, 850, 825, 800,\n",
+ " 750, 700]\n",
+ "\n",
+ "estimatedIgnitionDelayTimes = np.ones(len(T))\n",
+ "\n",
+ "# Set the initial guesses to a common value. We could probably speed up simulations \n",
+ "# by tuning this guess, but as seen in the figure above, the 'extra' time after igntion \n",
+ "# does not add many data points or simulation steps. The time savings would be small.\n",
+ "estimatedIgnitionDelayTimes[:] = 0.005\n",
+ "\n",
+ "# Now create a dataFrame out of these\n",
+ "ignitionDelays = pd.DataFrame(data={'T':T})\n",
+ "ignitionDelays['ignDelay'] = np.nan"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "Run the code above for each temperature, and save the IDT for each."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 9,
+ "metadata": {
+ "scrolled": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Computed Ignition Delay: 6.357e-07 seconds for T=1800K. Took 2.36s to compute\n",
+ "Computed Ignition Delay: 1.585e-06 seconds for T=1600K. Took 2.67s to compute\n",
+ "Computed Ignition Delay: 5.785e-06 seconds for T=1400K. Took 2.71s to compute\n",
+ "Computed Ignition Delay: 3.911e-05 seconds for T=1200K. Took 3.00s to compute\n",
+ "Computed Ignition Delay: 1.326e-04 seconds for T=1100K. Took 3.14s to compute\n",
+ "Computed Ignition Delay: 1.839e-04 seconds for T=1075K. Took 3.32s to compute\n",
+ "Computed Ignition Delay: 2.533e-04 seconds for T=1050K. Took 3.45s to compute\n",
+ "Computed Ignition Delay: 3.365e-04 seconds for T=1025K. Took 3.97s to compute\n",
+ "Computed Ignition Delay: 4.093e-04 seconds for T=1000K. Took 4.06s to compute\n",
+ "Computed Ignition Delay: 4.289e-04 seconds for T=975K. Took 4.01s to compute\n",
+ "Computed Ignition Delay: 3.911e-04 seconds for T=950K. Took 3.94s to compute\n",
+ "Computed Ignition Delay: 3.407e-04 seconds for T=925K. Took 4.10s to compute\n",
+ "Computed Ignition Delay: 3.145e-04 seconds for T=900K. Took 3.74s to compute\n",
+ "Computed Ignition Delay: 3.233e-04 seconds for T=850K. Took 4.12s to compute\n",
+ "Computed Ignition Delay: 3.439e-04 seconds for T=825K. Took 4.26s to compute\n",
+ "Computed Ignition Delay: 3.852e-04 seconds for T=800K. Took 4.51s to compute\n",
+ "Computed Ignition Delay: 6.824e-04 seconds for T=750K. Took 4.37s to compute\n",
+ "Computed Ignition Delay: 2.056e-03 seconds for T=700K. Took 4.67s to compute\n"
+ ]
+ }
+ ],
+ "source": [
+ "for i, temperature in enumerate(T):\n",
+ " # Set up the gas and reactor\n",
+ " reactorTemperature = temperature\n",
+ " reactorPressure = 40.0*101325.0\n",
+ " gas.TP = reactorTemperature, reactorPressure\n",
+ " gas.set_equivalence_ratio(phi=1.0, fuel='c12h26', oxidizer={'o2':1.0, 'n2':3.76})\n",
+ " r = ct.Reactor(contents=gas)\n",
+ " reactorNetwork = ct.ReactorNet([r])\n",
+ "\n",
+ " # Create an empty data frame\n",
+ " timeHistory = pd.DataFrame(columns=timeHistory.columns)\n",
+ "\n",
+ " t0 = time.time()\n",
+ "\n",
+ " t = 0\n",
+ " counter = 0\n",
+ " while t < estimatedIgnitionDelayTimes[i]:\n",
+ " t = reactorNetwork.step()\n",
+ " if not counter % 20:\n",
+ " timeHistory.loc[t] = r.get_state()\n",
+ " counter += 1\n",
+ "\n",
+ " tau = ignitionDelay(timeHistory, 'oh')\n",
+ " t1 = time.time()\n",
+ "\n",
+ " print('Computed Ignition Delay: {:.3e} seconds for T={}K. Took {:3.2f}s to compute'.format(tau, temperature, t1-t0))\n",
+ "\n",
+ " ignitionDelays.at[i, 'ignDelay'] = tau"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Figure: ignition delay ($\\tau$) vs. the inverse of temperature ($\\frac{1000}{T}$). "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 10,
+ "metadata": {
+ "scrolled": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "application/javascript": [
+ "/* Put everything inside the global mpl namespace */\n",
+ "window.mpl = {};\n",
+ "\n",
+ "\n",
+ "mpl.get_websocket_type = function() {\n",
+ " if (typeof(WebSocket) !== 'undefined') {\n",
+ " return WebSocket;\n",
+ " } else if (typeof(MozWebSocket) !== 'undefined') {\n",
+ " return MozWebSocket;\n",
+ " } else {\n",
+ " alert('Your browser does not have WebSocket support.' +\n",
+ " 'Please try Chrome, Safari or Firefox ≥ 6. ' +\n",
+ " 'Firefox 4 and 5 are also supported but you ' +\n",
+ " 'have to enable WebSockets in about:config.');\n",
+ " };\n",
+ "}\n",
+ "\n",
+ "mpl.figure = function(figure_id, websocket, ondownload, parent_element) {\n",
+ " this.id = figure_id;\n",
+ "\n",
+ " this.ws = websocket;\n",
+ "\n",
+ " this.supports_binary = (this.ws.binaryType != undefined);\n",
+ "\n",
+ " if (!this.supports_binary) {\n",
+ " var warnings = document.getElementById(\"mpl-warnings\");\n",
+ " if (warnings) {\n",
+ " warnings.style.display = 'block';\n",
+ " warnings.textContent = (\n",
+ " \"This browser does not support binary websocket messages. \" +\n",
+ " \"Performance may be slow.\");\n",
+ " }\n",
+ " }\n",
+ "\n",
+ " this.imageObj = new Image();\n",
+ "\n",
+ " this.context = undefined;\n",
+ " this.message = undefined;\n",
+ " this.canvas = undefined;\n",
+ " this.rubberband_canvas = undefined;\n",
+ " this.rubberband_context = undefined;\n",
+ " this.format_dropdown = undefined;\n",
+ "\n",
+ " this.image_mode = 'full';\n",
+ "\n",
+ " this.root = $('');\n",
+ " this._root_extra_style(this.root)\n",
+ " this.root.attr('style', 'display: inline-block');\n",
+ "\n",
+ " $(parent_element).append(this.root);\n",
+ "\n",
+ " this._init_header(this);\n",
+ " this._init_canvas(this);\n",
+ " this._init_toolbar(this);\n",
+ "\n",
+ " var fig = this;\n",
+ "\n",
+ " this.waiting = false;\n",
+ "\n",
+ " this.ws.onopen = function () {\n",
+ " fig.send_message(\"supports_binary\", {value: fig.supports_binary});\n",
+ " fig.send_message(\"send_image_mode\", {});\n",
+ " if (mpl.ratio != 1) {\n",
+ " fig.send_message(\"set_dpi_ratio\", {'dpi_ratio': mpl.ratio});\n",
+ " }\n",
+ " fig.send_message(\"refresh\", {});\n",
+ " }\n",
+ "\n",
+ " this.imageObj.onload = function() {\n",
+ " if (fig.image_mode == 'full') {\n",
+ " // Full images could contain transparency (where diff images\n",
+ " // almost always do), so we need to clear the canvas so that\n",
+ " // there is no ghosting.\n",
+ " fig.context.clearRect(0, 0, fig.canvas.width, fig.canvas.height);\n",
+ " }\n",
+ " fig.context.drawImage(fig.imageObj, 0, 0);\n",
+ " };\n",
+ "\n",
+ " this.imageObj.onunload = function() {\n",
+ " fig.ws.close();\n",
+ " }\n",
+ "\n",
+ " this.ws.onmessage = this._make_on_message_function(this);\n",
+ "\n",
+ " this.ondownload = ondownload;\n",
+ "}\n",
+ "\n",
+ "mpl.figure.prototype._init_header = function() {\n",
+ " var titlebar = $(\n",
+ " '');\n",
+ " var titletext = $(\n",
+ " '');\n",
+ " titlebar.append(titletext)\n",
+ " this.root.append(titlebar);\n",
+ " this.header = titletext[0];\n",
+ "}\n",
+ "\n",
+ "\n",
+ "\n",
+ "mpl.figure.prototype._canvas_extra_style = function(canvas_div) {\n",
+ "\n",
+ "}\n",
+ "\n",
+ "\n",
+ "mpl.figure.prototype._root_extra_style = function(canvas_div) {\n",
+ "\n",
+ "}\n",
+ "\n",
+ "mpl.figure.prototype._init_canvas = function() {\n",
+ " var fig = this;\n",
+ "\n",
+ " var canvas_div = $('');\n",
+ "\n",
+ " canvas_div.attr('style', 'position: relative; clear: both; outline: 0');\n",
+ "\n",
+ " function canvas_keyboard_event(event) {\n",
+ " return fig.key_event(event, event['data']);\n",
+ " }\n",
+ "\n",
+ " canvas_div.keydown('key_press', canvas_keyboard_event);\n",
+ " canvas_div.keyup('key_release', canvas_keyboard_event);\n",
+ " this.canvas_div = canvas_div\n",
+ " this._canvas_extra_style(canvas_div)\n",
+ " this.root.append(canvas_div);\n",
+ "\n",
+ " var canvas = $('');\n",
+ " canvas.addClass('mpl-canvas');\n",
+ " canvas.attr('style', \"left: 0; top: 0; z-index: 0; outline: 0\")\n",
+ "\n",
+ " this.canvas = canvas[0];\n",
+ " this.context = canvas[0].getContext(\"2d\");\n",
+ "\n",
+ " var backingStore = this.context.backingStorePixelRatio ||\n",
+ "\tthis.context.webkitBackingStorePixelRatio ||\n",
+ "\tthis.context.mozBackingStorePixelRatio ||\n",
+ "\tthis.context.msBackingStorePixelRatio ||\n",
+ "\tthis.context.oBackingStorePixelRatio ||\n",
+ "\tthis.context.backingStorePixelRatio || 1;\n",
+ "\n",
+ " mpl.ratio = (window.devicePixelRatio || 1) / backingStore;\n",
+ "\n",
+ " var rubberband = $('');\n",
+ " rubberband.attr('style', \"position: absolute; left: 0; top: 0; z-index: 1;\")\n",
+ "\n",
+ " var pass_mouse_events = true;\n",
+ "\n",
+ " canvas_div.resizable({\n",
+ " start: function(event, ui) {\n",
+ " pass_mouse_events = false;\n",
+ " },\n",
+ " resize: function(event, ui) {\n",
+ " fig.request_resize(ui.size.width, ui.size.height);\n",
+ " },\n",
+ " stop: function(event, ui) {\n",
+ " pass_mouse_events = true;\n",
+ " fig.request_resize(ui.size.width, ui.size.height);\n",
+ " },\n",
+ " });\n",
+ "\n",
+ " function mouse_event_fn(event) {\n",
+ " if (pass_mouse_events)\n",
+ " return fig.mouse_event(event, event['data']);\n",
+ " }\n",
+ "\n",
+ " rubberband.mousedown('button_press', mouse_event_fn);\n",
+ " rubberband.mouseup('button_release', mouse_event_fn);\n",
+ " // Throttle sequential mouse events to 1 every 20ms.\n",
+ " rubberband.mousemove('motion_notify', mouse_event_fn);\n",
+ "\n",
+ " rubberband.mouseenter('figure_enter', mouse_event_fn);\n",
+ " rubberband.mouseleave('figure_leave', mouse_event_fn);\n",
+ "\n",
+ " canvas_div.on(\"wheel\", function (event) {\n",
+ " event = event.originalEvent;\n",
+ " event['data'] = 'scroll'\n",
+ " if (event.deltaY < 0) {\n",
+ " event.step = 1;\n",
+ " } else {\n",
+ " event.step = -1;\n",
+ " }\n",
+ " mouse_event_fn(event);\n",
+ " });\n",
+ "\n",
+ " canvas_div.append(canvas);\n",
+ " canvas_div.append(rubberband);\n",
+ "\n",
+ " this.rubberband = rubberband;\n",
+ " this.rubberband_canvas = rubberband[0];\n",
+ " this.rubberband_context = rubberband[0].getContext(\"2d\");\n",
+ " this.rubberband_context.strokeStyle = \"#000000\";\n",
+ "\n",
+ " this._resize_canvas = function(width, height) {\n",
+ " // Keep the size of the canvas, canvas container, and rubber band\n",
+ " // canvas in synch.\n",
+ " canvas_div.css('width', width)\n",
+ " canvas_div.css('height', height)\n",
+ "\n",
+ " canvas.attr('width', width * mpl.ratio);\n",
+ " canvas.attr('height', height * mpl.ratio);\n",
+ " canvas.attr('style', 'width: ' + width + 'px; height: ' + height + 'px;');\n",
+ "\n",
+ " rubberband.attr('width', width);\n",
+ " rubberband.attr('height', height);\n",
+ " }\n",
+ "\n",
+ " // Set the figure to an initial 600x600px, this will subsequently be updated\n",
+ " // upon first draw.\n",
+ " this._resize_canvas(600, 600);\n",
+ "\n",
+ " // Disable right mouse context menu.\n",
+ " $(this.rubberband_canvas).bind(\"contextmenu\",function(e){\n",
+ " return false;\n",
+ " });\n",
+ "\n",
+ " function set_focus () {\n",
+ " canvas.focus();\n",
+ " canvas_div.focus();\n",
+ " }\n",
+ "\n",
+ " window.setTimeout(set_focus, 100);\n",
+ "}\n",
+ "\n",
+ "mpl.figure.prototype._init_toolbar = function() {\n",
+ " var fig = this;\n",
+ "\n",
+ " var nav_element = $('')\n",
+ " nav_element.attr('style', 'width: 100%');\n",
+ " this.root.append(nav_element);\n",
+ "\n",
+ " // Define a callback function for later on.\n",
+ " function toolbar_event(event) {\n",
+ " return fig.toolbar_button_onclick(event['data']);\n",
+ " }\n",
+ " function toolbar_mouse_event(event) {\n",
+ " return fig.toolbar_button_onmouseover(event['data']);\n",
+ " }\n",
+ "\n",
+ " for(var toolbar_ind in mpl.toolbar_items) {\n",
+ " var name = mpl.toolbar_items[toolbar_ind][0];\n",
+ " var tooltip = mpl.toolbar_items[toolbar_ind][1];\n",
+ " var image = mpl.toolbar_items[toolbar_ind][2];\n",
+ " var method_name = mpl.toolbar_items[toolbar_ind][3];\n",
+ "\n",
+ " if (!name) {\n",
+ " // put a spacer in here.\n",
+ " continue;\n",
+ " }\n",
+ " var button = $('');\n",
+ " button.addClass('ui-button ui-widget ui-state-default ui-corner-all ' +\n",
+ " 'ui-button-icon-only');\n",
+ " button.attr('role', 'button');\n",
+ " button.attr('aria-disabled', 'false');\n",
+ " button.click(method_name, toolbar_event);\n",
+ " button.mouseover(tooltip, toolbar_mouse_event);\n",
+ "\n",
+ " var icon_img = $('');\n",
+ " icon_img.addClass('ui-button-icon-primary ui-icon');\n",
+ " icon_img.addClass(image);\n",
+ " icon_img.addClass('ui-corner-all');\n",
+ "\n",
+ " var tooltip_span = $('');\n",
+ " tooltip_span.addClass('ui-button-text');\n",
+ " tooltip_span.html(tooltip);\n",
+ "\n",
+ " button.append(icon_img);\n",
+ " button.append(tooltip_span);\n",
+ "\n",
+ " nav_element.append(button);\n",
+ " }\n",
+ "\n",
+ " var fmt_picker_span = $('');\n",
+ "\n",
+ " var fmt_picker = $('');\n",
+ " fmt_picker.addClass('mpl-toolbar-option ui-widget ui-widget-content');\n",
+ " fmt_picker_span.append(fmt_picker);\n",
+ " nav_element.append(fmt_picker_span);\n",
+ " this.format_dropdown = fmt_picker[0];\n",
+ "\n",
+ " for (var ind in mpl.extensions) {\n",
+ " var fmt = mpl.extensions[ind];\n",
+ " var option = $(\n",
+ " '', {selected: fmt === mpl.default_extension}).html(fmt);\n",
+ " fmt_picker.append(option)\n",
+ " }\n",
+ "\n",
+ " // Add hover states to the ui-buttons\n",
+ " $( \".ui-button\" ).hover(\n",
+ " function() { $(this).addClass(\"ui-state-hover\");},\n",
+ " function() { $(this).removeClass(\"ui-state-hover\");}\n",
+ " );\n",
+ "\n",
+ " var status_bar = $('');\n",
+ " nav_element.append(status_bar);\n",
+ " this.message = status_bar[0];\n",
+ "}\n",
+ "\n",
+ "mpl.figure.prototype.request_resize = function(x_pixels, y_pixels) {\n",
+ " // Request matplotlib to resize the figure. Matplotlib will then trigger a resize in the client,\n",
+ " // which will in turn request a refresh of the image.\n",
+ " this.send_message('resize', {'width': x_pixels, 'height': y_pixels});\n",
+ "}\n",
+ "\n",
+ "mpl.figure.prototype.send_message = function(type, properties) {\n",
+ " properties['type'] = type;\n",
+ " properties['figure_id'] = this.id;\n",
+ " this.ws.send(JSON.stringify(properties));\n",
+ "}\n",
+ "\n",
+ "mpl.figure.prototype.send_draw_message = function() {\n",
+ " if (!this.waiting) {\n",
+ " this.waiting = true;\n",
+ " this.ws.send(JSON.stringify({type: \"draw\", figure_id: this.id}));\n",
+ " }\n",
+ "}\n",
+ "\n",
+ "\n",
+ "mpl.figure.prototype.handle_save = function(fig, msg) {\n",
+ " var format_dropdown = fig.format_dropdown;\n",
+ " var format = format_dropdown.options[format_dropdown.selectedIndex].value;\n",
+ " fig.ondownload(fig, format);\n",
+ "}\n",
+ "\n",
+ "\n",
+ "mpl.figure.prototype.handle_resize = function(fig, msg) {\n",
+ " var size = msg['size'];\n",
+ " if (size[0] != fig.canvas.width || size[1] != fig.canvas.height) {\n",
+ " fig._resize_canvas(size[0], size[1]);\n",
+ " fig.send_message(\"refresh\", {});\n",
+ " };\n",
+ "}\n",
+ "\n",
+ "mpl.figure.prototype.handle_rubberband = function(fig, msg) {\n",
+ " var x0 = msg['x0'] / mpl.ratio;\n",
+ " var y0 = (fig.canvas.height - msg['y0']) / mpl.ratio;\n",
+ " var x1 = msg['x1'] / mpl.ratio;\n",
+ " var y1 = (fig.canvas.height - msg['y1']) / mpl.ratio;\n",
+ " x0 = Math.floor(x0) + 0.5;\n",
+ " y0 = Math.floor(y0) + 0.5;\n",
+ " x1 = Math.floor(x1) + 0.5;\n",
+ " y1 = Math.floor(y1) + 0.5;\n",
+ " var min_x = Math.min(x0, x1);\n",
+ " var min_y = Math.min(y0, y1);\n",
+ " var width = Math.abs(x1 - x0);\n",
+ " var height = Math.abs(y1 - y0);\n",
+ "\n",
+ " fig.rubberband_context.clearRect(\n",
+ " 0, 0, fig.canvas.width, fig.canvas.height);\n",
+ "\n",
+ " fig.rubberband_context.strokeRect(min_x, min_y, width, height);\n",
+ "}\n",
+ "\n",
+ "mpl.figure.prototype.handle_figure_label = function(fig, msg) {\n",
+ " // Updates the figure title.\n",
+ " fig.header.textContent = msg['label'];\n",
+ "}\n",
+ "\n",
+ "mpl.figure.prototype.handle_cursor = function(fig, msg) {\n",
+ " var cursor = msg['cursor'];\n",
+ " switch(cursor)\n",
+ " {\n",
+ " case 0:\n",
+ " cursor = 'pointer';\n",
+ " break;\n",
+ " case 1:\n",
+ " cursor = 'default';\n",
+ " break;\n",
+ " case 2:\n",
+ " cursor = 'crosshair';\n",
+ " break;\n",
+ " case 3:\n",
+ " cursor = 'move';\n",
+ " break;\n",
+ " }\n",
+ " fig.rubberband_canvas.style.cursor = cursor;\n",
+ "}\n",
+ "\n",
+ "mpl.figure.prototype.handle_message = function(fig, msg) {\n",
+ " fig.message.textContent = msg['message'];\n",
+ "}\n",
+ "\n",
+ "mpl.figure.prototype.handle_draw = function(fig, msg) {\n",
+ " // Request the server to send over a new figure.\n",
+ " fig.send_draw_message();\n",
+ "}\n",
+ "\n",
+ "mpl.figure.prototype.handle_image_mode = function(fig, msg) {\n",
+ " fig.image_mode = msg['mode'];\n",
+ "}\n",
+ "\n",
+ "mpl.figure.prototype.updated_canvas_event = function() {\n",
+ " // Called whenever the canvas gets updated.\n",
+ " this.send_message(\"ack\", {});\n",
+ "}\n",
+ "\n",
+ "// A function to construct a web socket function for onmessage handling.\n",
+ "// Called in the figure constructor.\n",
+ "mpl.figure.prototype._make_on_message_function = function(fig) {\n",
+ " return function socket_on_message(evt) {\n",
+ " if (evt.data instanceof Blob) {\n",
+ " /* FIXME: We get \"Resource interpreted as Image but\n",
+ " * transferred with MIME type text/plain:\" errors on\n",
+ " * Chrome. But how to set the MIME type? It doesn't seem\n",
+ " * to be part of the websocket stream */\n",
+ " evt.data.type = \"image/png\";\n",
+ "\n",
+ " /* Free the memory for the previous frames */\n",
+ " if (fig.imageObj.src) {\n",
+ " (window.URL || window.webkitURL).revokeObjectURL(\n",
+ " fig.imageObj.src);\n",
+ " }\n",
+ "\n",
+ " fig.imageObj.src = (window.URL || window.webkitURL).createObjectURL(\n",
+ " evt.data);\n",
+ " fig.updated_canvas_event();\n",
+ " fig.waiting = false;\n",
+ " return;\n",
+ " }\n",
+ " else if (typeof evt.data === 'string' && evt.data.slice(0, 21) == \"data:image/png;base64\") {\n",
+ " fig.imageObj.src = evt.data;\n",
+ " fig.updated_canvas_event();\n",
+ " fig.waiting = false;\n",
+ " return;\n",
+ " }\n",
+ "\n",
+ " var msg = JSON.parse(evt.data);\n",
+ " var msg_type = msg['type'];\n",
+ "\n",
+ " // Call the \"handle_{type}\" callback, which takes\n",
+ " // the figure and JSON message as its only arguments.\n",
+ " try {\n",
+ " var callback = fig[\"handle_\" + msg_type];\n",
+ " } catch (e) {\n",
+ " console.log(\"No handler for the '\" + msg_type + \"' message type: \", msg);\n",
+ " return;\n",
+ " }\n",
+ "\n",
+ " if (callback) {\n",
+ " try {\n",
+ " // console.log(\"Handling '\" + msg_type + \"' message: \", msg);\n",
+ " callback(fig, msg);\n",
+ " } catch (e) {\n",
+ " console.log(\"Exception inside the 'handler_\" + msg_type + \"' callback:\", e, e.stack, msg);\n",
+ " }\n",
+ " }\n",
+ " };\n",
+ "}\n",
+ "\n",
+ "// from http://stackoverflow.com/questions/1114465/getting-mouse-location-in-canvas\n",
+ "mpl.findpos = function(e) {\n",
+ " //this section is from http://www.quirksmode.org/js/events_properties.html\n",
+ " var targ;\n",
+ " if (!e)\n",
+ " e = window.event;\n",
+ " if (e.target)\n",
+ " targ = e.target;\n",
+ " else if (e.srcElement)\n",
+ " targ = e.srcElement;\n",
+ " if (targ.nodeType == 3) // defeat Safari bug\n",
+ " targ = targ.parentNode;\n",
+ "\n",
+ " // jQuery normalizes the pageX and pageY\n",
+ " // pageX,Y are the mouse positions relative to the document\n",
+ " // offset() returns the position of the element relative to the document\n",
+ " var x = e.pageX - $(targ).offset().left;\n",
+ " var y = e.pageY - $(targ).offset().top;\n",
+ "\n",
+ " return {\"x\": x, \"y\": y};\n",
+ "};\n",
+ "\n",
+ "/*\n",
+ " * return a copy of an object with only non-object keys\n",
+ " * we need this to avoid circular references\n",
+ " * http://stackoverflow.com/a/24161582/3208463\n",
+ " */\n",
+ "function simpleKeys (original) {\n",
+ " return Object.keys(original).reduce(function (obj, key) {\n",
+ " if (typeof original[key] !== 'object')\n",
+ " obj[key] = original[key]\n",
+ " return obj;\n",
+ " }, {});\n",
+ "}\n",
+ "\n",
+ "mpl.figure.prototype.mouse_event = function(event, name) {\n",
+ " var canvas_pos = mpl.findpos(event)\n",
+ "\n",
+ " if (name === 'button_press')\n",
+ " {\n",
+ " this.canvas.focus();\n",
+ " this.canvas_div.focus();\n",
+ " }\n",
+ "\n",
+ " var x = canvas_pos.x * mpl.ratio;\n",
+ " var y = canvas_pos.y * mpl.ratio;\n",
+ "\n",
+ " this.send_message(name, {x: x, y: y, button: event.button,\n",
+ " step: event.step,\n",
+ " guiEvent: simpleKeys(event)});\n",
+ "\n",
+ " /* This prevents the web browser from automatically changing to\n",
+ " * the text insertion cursor when the button is pressed. We want\n",
+ " * to control all of the cursor setting manually through the\n",
+ " * 'cursor' event from matplotlib */\n",
+ " event.preventDefault();\n",
+ " return false;\n",
+ "}\n",
+ "\n",
+ "mpl.figure.prototype._key_event_extra = function(event, name) {\n",
+ " // Handle any extra behaviour associated with a key event\n",
+ "}\n",
+ "\n",
+ "mpl.figure.prototype.key_event = function(event, name) {\n",
+ "\n",
+ " // Prevent repeat events\n",
+ " if (name == 'key_press')\n",
+ " {\n",
+ " if (event.which === this._key)\n",
+ " return;\n",
+ " else\n",
+ " this._key = event.which;\n",
+ " }\n",
+ " if (name == 'key_release')\n",
+ " this._key = null;\n",
+ "\n",
+ " var value = '';\n",
+ " if (event.ctrlKey && event.which != 17)\n",
+ " value += \"ctrl+\";\n",
+ " if (event.altKey && event.which != 18)\n",
+ " value += \"alt+\";\n",
+ " if (event.shiftKey && event.which != 16)\n",
+ " value += \"shift+\";\n",
+ "\n",
+ " value += 'k';\n",
+ " value += event.which.toString();\n",
+ "\n",
+ " this._key_event_extra(event, name);\n",
+ "\n",
+ " this.send_message(name, {key: value,\n",
+ " guiEvent: simpleKeys(event)});\n",
+ " return false;\n",
+ "}\n",
+ "\n",
+ "mpl.figure.prototype.toolbar_button_onclick = function(name) {\n",
+ " if (name == 'download') {\n",
+ " this.handle_save(this, null);\n",
+ " } else {\n",
+ " this.send_message(\"toolbar_button\", {name: name});\n",
+ " }\n",
+ "};\n",
+ "\n",
+ "mpl.figure.prototype.toolbar_button_onmouseover = function(tooltip) {\n",
+ " this.message.textContent = tooltip;\n",
+ "};\n",
+ "mpl.toolbar_items = [[\"Home\", \"Reset original view\", \"fa fa-home icon-home\", \"home\"], [\"Back\", \"Back to previous view\", \"fa fa-arrow-left icon-arrow-left\", \"back\"], [\"Forward\", \"Forward to next view\", \"fa fa-arrow-right icon-arrow-right\", \"forward\"], [\"\", \"\", \"\", \"\"], [\"Pan\", \"Pan axes with left mouse, zoom with right\", \"fa fa-arrows icon-move\", \"pan\"], [\"Zoom\", \"Zoom to rectangle\", \"fa fa-square-o icon-check-empty\", \"zoom\"], [\"\", \"\", \"\", \"\"], [\"Download\", \"Download plot\", \"fa fa-floppy-o icon-save\", \"download\"]];\n",
+ "\n",
+ "mpl.extensions = [\"eps\", \"pdf\", \"png\", \"ps\", \"raw\", \"svg\"];\n",
+ "\n",
+ "mpl.default_extension = \"png\";var comm_websocket_adapter = function(comm) {\n",
+ " // Create a \"websocket\"-like object which calls the given IPython comm\n",
+ " // object with the appropriate methods. Currently this is a non binary\n",
+ " // socket, so there is still some room for performance tuning.\n",
+ " var ws = {};\n",
+ "\n",
+ " ws.close = function() {\n",
+ " comm.close()\n",
+ " };\n",
+ " ws.send = function(m) {\n",
+ " //console.log('sending', m);\n",
+ " comm.send(m);\n",
+ " };\n",
+ " // Register the callback with on_msg.\n",
+ " comm.on_msg(function(msg) {\n",
+ " //console.log('receiving', msg['content']['data'], msg);\n",
+ " // Pass the mpl event to the overridden (by mpl) onmessage function.\n",
+ " ws.onmessage(msg['content']['data'])\n",
+ " });\n",
+ " return ws;\n",
+ "}\n",
+ "\n",
+ "mpl.mpl_figure_comm = function(comm, msg) {\n",
+ " // This is the function which gets called when the mpl process\n",
+ " // starts-up an IPython Comm through the \"matplotlib\" channel.\n",
+ "\n",
+ " var id = msg.content.data.id;\n",
+ " // Get hold of the div created by the display call when the Comm\n",
+ " // socket was opened in Python.\n",
+ " var element = $(\"#\" + id);\n",
+ " var ws_proxy = comm_websocket_adapter(comm)\n",
+ "\n",
+ " function ondownload(figure, format) {\n",
+ " window.open(figure.imageObj.src);\n",
+ " }\n",
+ "\n",
+ " var fig = new mpl.figure(id, ws_proxy,\n",
+ " ondownload,\n",
+ " element.get(0));\n",
+ "\n",
+ " // Call onopen now - mpl needs it, as it is assuming we've passed it a real\n",
+ " // web socket which is closed, not our websocket->open comm proxy.\n",
+ " ws_proxy.onopen();\n",
+ "\n",
+ " fig.parent_element = element.get(0);\n",
+ " fig.cell_info = mpl.find_output_cell(\"\");\n",
+ " if (!fig.cell_info) {\n",
+ " console.error(\"Failed to find cell for figure\", id, fig);\n",
+ " return;\n",
+ " }\n",
+ "\n",
+ " var output_index = fig.cell_info[2]\n",
+ " var cell = fig.cell_info[0];\n",
+ "\n",
+ "};\n",
+ "\n",
+ "mpl.figure.prototype.handle_close = function(fig, msg) {\n",
+ " var width = fig.canvas.width/mpl.ratio\n",
+ " fig.root.unbind('remove')\n",
+ "\n",
+ " // Update the output cell to use the data from the current canvas.\n",
+ " fig.push_to_output();\n",
+ " var dataURL = fig.canvas.toDataURL();\n",
+ " // Re-enable the keyboard manager in IPython - without this line, in FF,\n",
+ " // the notebook keyboard shortcuts fail.\n",
+ " IPython.keyboard_manager.enable()\n",
+ " $(fig.parent_element).html('
');\n",
+ " fig.close_ws(fig, msg);\n",
+ "}\n",
+ "\n",
+ "mpl.figure.prototype.close_ws = function(fig, msg){\n",
+ " fig.send_message('closing', msg);\n",
+ " // fig.ws.close()\n",
+ "}\n",
+ "\n",
+ "mpl.figure.prototype.push_to_output = function(remove_interactive) {\n",
+ " // Turn the data on the canvas into data in the output cell.\n",
+ " var width = this.canvas.width/mpl.ratio\n",
+ " var dataURL = this.canvas.toDataURL();\n",
+ " this.cell_info[1]['text/html'] = '
';\n",
+ "}\n",
+ "\n",
+ "mpl.figure.prototype.updated_canvas_event = function() {\n",
+ " // Tell IPython that the notebook contents must change.\n",
+ " IPython.notebook.set_dirty(true);\n",
+ " this.send_message(\"ack\", {});\n",
+ " var fig = this;\n",
+ " // Wait a second, then push the new image to the DOM so\n",
+ " // that it is saved nicely (might be nice to debounce this).\n",
+ " setTimeout(function () { fig.push_to_output() }, 1000);\n",
+ "}\n",
+ "\n",
+ "mpl.figure.prototype._init_toolbar = function() {\n",
+ " var fig = this;\n",
+ "\n",
+ " var nav_element = $('')\n",
+ " nav_element.attr('style', 'width: 100%');\n",
+ " this.root.append(nav_element);\n",
+ "\n",
+ " // Define a callback function for later on.\n",
+ " function toolbar_event(event) {\n",
+ " return fig.toolbar_button_onclick(event['data']);\n",
+ " }\n",
+ " function toolbar_mouse_event(event) {\n",
+ " return fig.toolbar_button_onmouseover(event['data']);\n",
+ " }\n",
+ "\n",
+ " for(var toolbar_ind in mpl.toolbar_items){\n",
+ " var name = mpl.toolbar_items[toolbar_ind][0];\n",
+ " var tooltip = mpl.toolbar_items[toolbar_ind][1];\n",
+ " var image = mpl.toolbar_items[toolbar_ind][2];\n",
+ " var method_name = mpl.toolbar_items[toolbar_ind][3];\n",
+ "\n",
+ " if (!name) { continue; };\n",
+ "\n",
+ " var button = $('');\n",
+ " button.click(method_name, toolbar_event);\n",
+ " button.mouseover(tooltip, toolbar_mouse_event);\n",
+ " nav_element.append(button);\n",
+ " }\n",
+ "\n",
+ " // Add the status bar.\n",
+ " var status_bar = $('');\n",
+ " nav_element.append(status_bar);\n",
+ " this.message = status_bar[0];\n",
+ "\n",
+ " // Add the close button to the window.\n",
+ " var buttongrp = $('');\n",
+ " var button = $('');\n",
+ " button.click(function (evt) { fig.handle_close(fig, {}); } );\n",
+ " button.mouseover('Stop Interaction', toolbar_mouse_event);\n",
+ " buttongrp.append(button);\n",
+ " var titlebar = this.root.find($('.ui-dialog-titlebar'));\n",
+ " titlebar.prepend(buttongrp);\n",
+ "}\n",
+ "\n",
+ "mpl.figure.prototype._root_extra_style = function(el){\n",
+ " var fig = this\n",
+ " el.on(\"remove\", function(){\n",
+ "\tfig.close_ws(fig, {});\n",
+ " });\n",
+ "}\n",
+ "\n",
+ "mpl.figure.prototype._canvas_extra_style = function(el){\n",
+ " // this is important to make the div 'focusable\n",
+ " el.attr('tabindex', 0)\n",
+ " // reach out to IPython and tell the keyboard manager to turn it's self\n",
+ " // off when our div gets focus\n",
+ "\n",
+ " // location in version 3\n",
+ " if (IPython.notebook.keyboard_manager) {\n",
+ " IPython.notebook.keyboard_manager.register_events(el);\n",
+ " }\n",
+ " else {\n",
+ " // location in version 2\n",
+ " IPython.keyboard_manager.register_events(el);\n",
+ " }\n",
+ "\n",
+ "}\n",
+ "\n",
+ "mpl.figure.prototype._key_event_extra = function(event, name) {\n",
+ " var manager = IPython.notebook.keyboard_manager;\n",
+ " if (!manager)\n",
+ " manager = IPython.keyboard_manager;\n",
+ "\n",
+ " // Check for shift+enter\n",
+ " if (event.shiftKey && event.which == 13) {\n",
+ " this.canvas_div.blur();\n",
+ " event.shiftKey = false;\n",
+ " // Send a \"J\" for go to next cell\n",
+ " event.which = 74;\n",
+ " event.keyCode = 74;\n",
+ " manager.command_mode();\n",
+ " manager.handle_keydown(event);\n",
+ " }\n",
+ "}\n",
+ "\n",
+ "mpl.figure.prototype.handle_save = function(fig, msg) {\n",
+ " fig.ondownload(fig, null);\n",
+ "}\n",
+ "\n",
+ "\n",
+ "mpl.find_output_cell = function(html_output) {\n",
+ " // Return the cell and output element which can be found *uniquely* in the notebook.\n",
+ " // Note - this is a bit hacky, but it is done because the \"notebook_saving.Notebook\"\n",
+ " // IPython event is triggered only after the cells have been serialised, which for\n",
+ " // our purposes (turning an active figure into a static one), is too late.\n",
+ " var cells = IPython.notebook.get_cells();\n",
+ " var ncells = cells.length;\n",
+ " for (var i=0; i= 3 moved mimebundle to data attribute of output\n",
+ " data = data.data;\n",
+ " }\n",
+ " if (data['text/html'] == html_output) {\n",
+ " return [cell, data, j];\n",
+ " }\n",
+ " }\n",
+ " }\n",
+ " }\n",
+ "}\n",
+ "\n",
+ "// Register the function which deals with the matplotlib target/channel.\n",
+ "// The kernel may be null if the page has been refreshed.\n",
+ "if (IPython.notebook.kernel != null) {\n",
+ " IPython.notebook.kernel.comm_manager.register_target('matplotlib', mpl.mpl_figure_comm);\n",
+ "}\n"
+ ],
+ "text/plain": [
+ ""
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/html": [
+ "
"
],
"text/plain": [
""
@@ -1214,15 +1975,6 @@
" tick.label1.set_fontsize(12)\n",
" tick.label1.set_fontname('Times New Roman')"
]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "collapsed": true
- },
- "outputs": [],
- "source": []
}
],
"metadata": {
@@ -1241,7 +1993,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.5.2"
+ "version": "3.7.2"
}
},
"nbformat": 4,
diff --git a/reactors/batch_reactor_ignition_delay_NTC.ipynb b/reactors/batch_reactor_ignition_delay_NTC.ipynb
index 637bc21..2d21c3a 100644
--- a/reactors/batch_reactor_ignition_delay_NTC.ipynb
+++ b/reactors/batch_reactor_ignition_delay_NTC.ipynb
@@ -21,7 +21,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
- "Runnning Cantera version: 2.3.0a3\n"
+ "Runnning Cantera version: 2.5.0a2\n"
]
}
],
@@ -42,25 +42,44 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "### Define the gas\n",
- "In this example we will choose n-heptane as the gas. For a representative kinetic model, we use the 160 species [mechanism](https://combustion.llnl.gov/archived-mechanisms/alkanes/heptane-reduced-mechanism) by [Seier et al. 2000, Proc. Comb. Inst](http://dx.doi.org/10.1016/S0082-0784(00)80610-4). "
+ "### Import modules and set plotting defaults"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
+ "outputs": [],
+ "source": [
+ "%matplotlib notebook\n",
+ "import matplotlib.pyplot as plt\n",
+ "\n",
+ "plt.rcParams['axes.labelsize'] = 18\n",
+ "plt.rcParams['xtick.labelsize'] = 12\n",
+ "plt.rcParams['ytick.labelsize'] = 12\n",
+ "plt.rcParams['figure.autolayout'] = True\n",
+ "\n",
+ "plt.style.use('ggplot')\n",
+ "plt.style.use('seaborn-pastel')"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Define the gas\n",
+ "In this example we will choose n-heptane as the gas. For a representative kinetic model, we use the 160 species [mechanism](https://combustion.llnl.gov/archived-mechanisms/alkanes/heptane-reduced-mechanism) by [Seier et al. 2000, Proc. Comb. Inst](http://dx.doi.org/10.1016/S0082-0784(00)80610-4). "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
- "\n",
- "\n",
- "**** WARNING ****\n",
- "For species c7h15o-1, discontinuity in cp/R detected at Tmid = 1391\n",
- "\tValue computed using low-temperature polynomial: 53.0168\n",
- "\tValue computed using high-temperature polynomial: 52.748\n",
"\n",
"\n",
"**** WARNING ****\n",
@@ -83,7 +102,7 @@
},
{
"cell_type": "code",
- "execution_count": 3,
+ "execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
@@ -118,10 +137,8 @@
},
{
"cell_type": "code",
- "execution_count": 4,
- "metadata": {
- "collapsed": true
- },
+ "execution_count": 5,
+ "metadata": {},
"outputs": [],
"source": [
"def ignitionDelay(df, species):\n",
@@ -129,19 +146,19 @@
" This function computes the ignition delay from the occurence of the\n",
" peak in species' concentration.\n",
" \"\"\"\n",
- " return df[species].argmax()"
+ " return df[species].idxmax()"
]
},
{
"cell_type": "code",
- "execution_count": 5,
+ "execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
- "Computed Ignition Delay: 3.248e-02 seconds. Took 2.30s to compute\n"
+ "Computed Ignition Delay: 3.248e-02 seconds. Took 1.31s to compute\n"
]
}
],
@@ -182,32 +199,6 @@
"## Plot the result"
]
},
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "### Import modules and set plotting defaults"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 6,
- "metadata": {},
- "outputs": [],
- "source": [
- "import matplotlib.pyplot as plt\n",
- "import matplotlib as mpl\n",
- "%matplotlib notebook\n",
- "\n",
- "plt.rcParams['axes.labelsize'] = 18\n",
- "plt.rcParams['xtick.labelsize'] = 12\n",
- "plt.rcParams['ytick.labelsize'] = 12\n",
- "plt.rcParams['figure.autolayout'] = True\n",
- "\n",
- "plt.style.use('ggplot')\n",
- "plt.style.use('seaborn-pastel')"
- ]
- },
{
"cell_type": "markdown",
"metadata": {},
@@ -226,6 +217,7 @@
"/* Put everything inside the global mpl namespace */\n",
"window.mpl = {};\n",
"\n",
+ "\n",
"mpl.get_websocket_type = function() {\n",
" if (typeof(WebSocket) !== 'undefined') {\n",
" return WebSocket;\n",
@@ -284,6 +276,9 @@
" this.ws.onopen = function () {\n",
" fig.send_message(\"supports_binary\", {value: fig.supports_binary});\n",
" fig.send_message(\"send_image_mode\", {});\n",
+ " if (mpl.ratio != 1) {\n",
+ " fig.send_message(\"set_dpi_ratio\", {'dpi_ratio': mpl.ratio});\n",
+ " }\n",
" fig.send_message(\"refresh\", {});\n",
" }\n",
"\n",
@@ -298,7 +293,7 @@
" };\n",
"\n",
" this.imageObj.onunload = function() {\n",
- " this.ws.close();\n",
+ " fig.ws.close();\n",
" }\n",
"\n",
" this.ws.onmessage = this._make_on_message_function(this);\n",
@@ -353,6 +348,15 @@
" this.canvas = canvas[0];\n",
" this.context = canvas[0].getContext(\"2d\");\n",
"\n",
+ " var backingStore = this.context.backingStorePixelRatio ||\n",
+ "\tthis.context.webkitBackingStorePixelRatio ||\n",
+ "\tthis.context.mozBackingStorePixelRatio ||\n",
+ "\tthis.context.msBackingStorePixelRatio ||\n",
+ "\tthis.context.oBackingStorePixelRatio ||\n",
+ "\tthis.context.backingStorePixelRatio || 1;\n",
+ "\n",
+ " mpl.ratio = (window.devicePixelRatio || 1) / backingStore;\n",
+ "\n",
" var rubberband = $('');\n",
" rubberband.attr('style', \"position: absolute; left: 0; top: 0; z-index: 1;\")\n",
"\n",
@@ -409,8 +413,9 @@
" canvas_div.css('width', width)\n",
" canvas_div.css('height', height)\n",
"\n",
- " canvas.attr('width', width);\n",
- " canvas.attr('height', height);\n",
+ " canvas.attr('width', width * mpl.ratio);\n",
+ " canvas.attr('height', height * mpl.ratio);\n",
+ " canvas.attr('style', 'width: ' + width + 'px; height: ' + height + 'px;');\n",
"\n",
" rubberband.attr('width', width);\n",
" rubberband.attr('height', height);\n",
@@ -543,10 +548,10 @@
"}\n",
"\n",
"mpl.figure.prototype.handle_rubberband = function(fig, msg) {\n",
- " var x0 = msg['x0'];\n",
- " var y0 = fig.canvas.height - msg['y0'];\n",
- " var x1 = msg['x1'];\n",
- " var y1 = fig.canvas.height - msg['y1'];\n",
+ " var x0 = msg['x0'] / mpl.ratio;\n",
+ " var y0 = (fig.canvas.height - msg['y0']) / mpl.ratio;\n",
+ " var x1 = msg['x1'] / mpl.ratio;\n",
+ " var y1 = (fig.canvas.height - msg['y1']) / mpl.ratio;\n",
" x0 = Math.floor(x0) + 0.5;\n",
" y0 = Math.floor(y0) + 0.5;\n",
" x1 = Math.floor(x1) + 0.5;\n",
@@ -702,8 +707,8 @@
" this.canvas_div.focus();\n",
" }\n",
"\n",
- " var x = canvas_pos.x;\n",
- " var y = canvas_pos.y;\n",
+ " var x = canvas_pos.x * mpl.ratio;\n",
+ " var y = canvas_pos.y * mpl.ratio;\n",
"\n",
" this.send_message(name, {x: x, y: y, button: event.button,\n",
" step: event.step,\n",
@@ -763,9 +768,9 @@
"mpl.figure.prototype.toolbar_button_onmouseover = function(tooltip) {\n",
" this.message.textContent = tooltip;\n",
"};\n",
- "mpl.toolbar_items = [[\"Home\", \"Reset original view\", \"fa fa-home icon-home\", \"home\"], [\"Back\", \"Back to previous view\", \"fa fa-arrow-left icon-arrow-left\", \"back\"], [\"Forward\", \"Forward to next view\", \"fa fa-arrow-right icon-arrow-right\", \"forward\"], [\"\", \"\", \"\", \"\"], [\"Pan\", \"Pan axes with left mouse, zoom with right\", \"fa fa-arrows icon-move\", \"pan\"], [\"Zoom\", \"Zoom to rectangle\", \"fa fa-square-o icon-check-empty\", \"zoom\"], [\"\", \"\", \"\", \"\"], [\"Download\", \"Download plot\", \"fa fa-floppy-o icon-save\", \"download\"]];\n",
+ "mpl.toolbar_items = [[\"Home\", \"Reset original view\", \"fa fa-home icon-home\", \"home\"], [\"Back\", \"Back to previous view\", \"fa fa-arrow-left icon-arrow-left\", \"back\"], [\"Forward\", \"Forward to next view\", \"fa fa-arrow-right icon-arrow-right\", \"forward\"], [\"\", \"\", \"\", \"\"], [\"Pan\", \"Pan axes with left mouse, zoom with right\", \"fa fa-arrows icon-move\", \"pan\"], [\"Zoom\", \"Zoom to rectangle\", \"fa fa-square-o icon-check-empty\", \"zoom\"], [\"\", \"\", \"\", \"\"], [\"Download\", \"Download plot\", \"fa fa-floppy-o icon-save\", \"download\"]];\n",
"\n",
- "mpl.extensions = [\"eps\", \"jpeg\", \"pdf\", \"png\", \"ps\", \"raw\", \"svg\", \"tif\"];\n",
+ "mpl.extensions = [\"eps\", \"pdf\", \"png\", \"ps\", \"raw\", \"svg\"];\n",
"\n",
"mpl.default_extension = \"png\";var comm_websocket_adapter = function(comm) {\n",
" // Create a \"websocket\"-like object which calls the given IPython comm\n",
@@ -783,7 +788,7 @@
" // Register the callback with on_msg.\n",
" comm.on_msg(function(msg) {\n",
" //console.log('receiving', msg['content']['data'], msg);\n",
- " // Pass the mpl event to the overriden (by mpl) onmessage function.\n",
+ " // Pass the mpl event to the overridden (by mpl) onmessage function.\n",
" ws.onmessage(msg['content']['data'])\n",
" });\n",
" return ws;\n",
@@ -824,6 +829,7 @@
"};\n",
"\n",
"mpl.figure.prototype.handle_close = function(fig, msg) {\n",
+ " var width = fig.canvas.width/mpl.ratio\n",
" fig.root.unbind('remove')\n",
"\n",
" // Update the output cell to use the data from the current canvas.\n",
@@ -832,7 +838,7 @@
" // Re-enable the keyboard manager in IPython - without this line, in FF,\n",
" // the notebook keyboard shortcuts fail.\n",
" IPython.keyboard_manager.enable()\n",
- " $(fig.parent_element).html('
');\n",
+ " $(fig.parent_element).html('
');\n",
" fig.close_ws(fig, msg);\n",
"}\n",
"\n",
@@ -843,8 +849,9 @@
"\n",
"mpl.figure.prototype.push_to_output = function(remove_interactive) {\n",
" // Turn the data on the canvas into data in the output cell.\n",
+ " var width = this.canvas.width/mpl.ratio\n",
" var dataURL = this.canvas.toDataURL();\n",
- " this.cell_info[1]['text/html'] = '
';\n",
+ " this.cell_info[1]['text/html'] = '
';\n",
"}\n",
"\n",
"mpl.figure.prototype.updated_canvas_event = function() {\n",
@@ -987,7 +994,7 @@
{
"data": {
"text/html": [
- "
"
+ "
"
],
"text/plain": [
""
@@ -1014,6 +1021,7 @@
"metadata": {},
"source": [
"## Illustration : NTC behavior\n",
+ "\n",
"A common benchmark for a reaction mechanism is its ability to reproduce the **N**egative **T**emperature **C**oefficient behavior. Intuitively, as the temperature of an explosive mixture increases, it should ignite faster. But, under certain conditions, we observe the opposite. This is referred to as NTC behavior. Reproducing experimentally observed NTC behavior is thus an important test for any mechanism. We will do this now by computing and visualizing the ignition delay for a wide range of temperatures"
]
},
@@ -1042,7 +1050,7 @@
"estimatedIgnitionDelayTimes[-1] = 100\n",
"\n",
"# Now create a dataFrame out of these\n",
- "ignitionDelays = pd.DataFrame(data={'T':T})\n",
+ "ignitionDelays = pd.DataFrame(data={'T': T})\n",
"ignitionDelays['ignDelay'] = np.nan"
]
},
@@ -1064,25 +1072,25 @@
"name": "stdout",
"output_type": "stream",
"text": [
- "Computed Ignition Delay: 1.765e-05 seconds for T=1800K. Took 1.07s to compute\n",
- "Computed Ignition Delay: 3.454e-05 seconds for T=1600K. Took 0.99s to compute\n",
- "Computed Ignition Delay: 1.614e-04 seconds for T=1400K. Took 0.99s to compute\n",
- "Computed Ignition Delay: 1.629e-03 seconds for T=1200K. Took 1.10s to compute\n",
- "Computed Ignition Delay: 3.248e-02 seconds for T=1000K. Took 1.23s to compute\n",
- "Computed Ignition Delay: 7.909e-02 seconds for T=950K. Took 1.32s to compute\n",
- "Computed Ignition Delay: 1.252e-01 seconds for T=925K. Took 1.37s to compute\n",
- "Computed Ignition Delay: 1.983e-01 seconds for T=900K. Took 1.34s to compute\n",
- "Computed Ignition Delay: 4.266e-01 seconds for T=850K. Took 1.43s to compute\n",
- "Computed Ignition Delay: 4.726e-01 seconds for T=825K. Took 1.47s to compute\n",
- "Computed Ignition Delay: 3.795e-01 seconds for T=800K. Took 1.42s to compute\n",
- "Computed Ignition Delay: 1.462e-01 seconds for T=750K. Took 1.66s to compute\n",
- "Computed Ignition Delay: 6.427e-02 seconds for T=700K. Took 1.80s to compute\n",
- "Computed Ignition Delay: 5.791e-02 seconds for T=675K. Took 1.81s to compute\n",
- "Computed Ignition Delay: 7.723e-02 seconds for T=650K. Took 1.83s to compute\n",
- "Computed Ignition Delay: 1.503e-01 seconds for T=625K. Took 2.01s to compute\n",
- "Computed Ignition Delay: 3.754e-01 seconds for T=600K. Took 2.03s to compute\n",
- "Computed Ignition Delay: 3.749e+00 seconds for T=550K. Took 2.13s to compute\n",
- "Computed Ignition Delay: 6.945e+01 seconds for T=500K. Took 2.15s to compute\n"
+ "Computed Ignition Delay: 1.788e-05 seconds for T=1800K. Took 0.90s to compute\n",
+ "Computed Ignition Delay: 3.511e-05 seconds for T=1600K. Took 0.89s to compute\n",
+ "Computed Ignition Delay: 1.612e-04 seconds for T=1400K. Took 0.84s to compute\n",
+ "Computed Ignition Delay: 1.630e-03 seconds for T=1200K. Took 1.00s to compute\n",
+ "Computed Ignition Delay: 3.248e-02 seconds for T=1000K. Took 1.02s to compute\n",
+ "Computed Ignition Delay: 7.909e-02 seconds for T=950K. Took 1.11s to compute\n",
+ "Computed Ignition Delay: 1.252e-01 seconds for T=925K. Took 1.16s to compute\n",
+ "Computed Ignition Delay: 1.983e-01 seconds for T=900K. Took 1.20s to compute\n",
+ "Computed Ignition Delay: 4.266e-01 seconds for T=850K. Took 1.25s to compute\n",
+ "Computed Ignition Delay: 4.726e-01 seconds for T=825K. Took 1.23s to compute\n",
+ "Computed Ignition Delay: 3.795e-01 seconds for T=800K. Took 1.27s to compute\n",
+ "Computed Ignition Delay: 1.462e-01 seconds for T=750K. Took 1.48s to compute\n",
+ "Computed Ignition Delay: 6.427e-02 seconds for T=700K. Took 1.57s to compute\n",
+ "Computed Ignition Delay: 5.791e-02 seconds for T=675K. Took 1.57s to compute\n",
+ "Computed Ignition Delay: 7.723e-02 seconds for T=650K. Took 1.71s to compute\n",
+ "Computed Ignition Delay: 1.503e-01 seconds for T=625K. Took 1.79s to compute\n",
+ "Computed Ignition Delay: 3.754e-01 seconds for T=600K. Took 1.78s to compute\n",
+ "Computed Ignition Delay: 3.749e+00 seconds for T=550K. Took 2.20s to compute\n",
+ "Computed Ignition Delay: 6.945e+01 seconds for T=500K. Took 2.12s to compute\n"
]
}
],
@@ -1114,7 +1122,7 @@
"\n",
" print('Computed Ignition Delay: {:.3e} seconds for T={}K. Took {:3.2f}s to compute'.format(tau, temperature, t1-t0))\n",
"\n",
- " ignitionDelays.set_value(index=i, col='ignDelay', value=tau)"
+ " ignitionDelays.at[i, 'ignDelay'] = tau"
]
},
{
@@ -1137,6 +1145,7 @@
"/* Put everything inside the global mpl namespace */\n",
"window.mpl = {};\n",
"\n",
+ "\n",
"mpl.get_websocket_type = function() {\n",
" if (typeof(WebSocket) !== 'undefined') {\n",
" return WebSocket;\n",
@@ -1195,6 +1204,9 @@
" this.ws.onopen = function () {\n",
" fig.send_message(\"supports_binary\", {value: fig.supports_binary});\n",
" fig.send_message(\"send_image_mode\", {});\n",
+ " if (mpl.ratio != 1) {\n",
+ " fig.send_message(\"set_dpi_ratio\", {'dpi_ratio': mpl.ratio});\n",
+ " }\n",
" fig.send_message(\"refresh\", {});\n",
" }\n",
"\n",
@@ -1209,7 +1221,7 @@
" };\n",
"\n",
" this.imageObj.onunload = function() {\n",
- " this.ws.close();\n",
+ " fig.ws.close();\n",
" }\n",
"\n",
" this.ws.onmessage = this._make_on_message_function(this);\n",
@@ -1264,6 +1276,15 @@
" this.canvas = canvas[0];\n",
" this.context = canvas[0].getContext(\"2d\");\n",
"\n",
+ " var backingStore = this.context.backingStorePixelRatio ||\n",
+ "\tthis.context.webkitBackingStorePixelRatio ||\n",
+ "\tthis.context.mozBackingStorePixelRatio ||\n",
+ "\tthis.context.msBackingStorePixelRatio ||\n",
+ "\tthis.context.oBackingStorePixelRatio ||\n",
+ "\tthis.context.backingStorePixelRatio || 1;\n",
+ "\n",
+ " mpl.ratio = (window.devicePixelRatio || 1) / backingStore;\n",
+ "\n",
" var rubberband = $('');\n",
" rubberband.attr('style', \"position: absolute; left: 0; top: 0; z-index: 1;\")\n",
"\n",
@@ -1320,8 +1341,9 @@
" canvas_div.css('width', width)\n",
" canvas_div.css('height', height)\n",
"\n",
- " canvas.attr('width', width);\n",
- " canvas.attr('height', height);\n",
+ " canvas.attr('width', width * mpl.ratio);\n",
+ " canvas.attr('height', height * mpl.ratio);\n",
+ " canvas.attr('style', 'width: ' + width + 'px; height: ' + height + 'px;');\n",
"\n",
" rubberband.attr('width', width);\n",
" rubberband.attr('height', height);\n",
@@ -1454,10 +1476,10 @@
"}\n",
"\n",
"mpl.figure.prototype.handle_rubberband = function(fig, msg) {\n",
- " var x0 = msg['x0'];\n",
- " var y0 = fig.canvas.height - msg['y0'];\n",
- " var x1 = msg['x1'];\n",
- " var y1 = fig.canvas.height - msg['y1'];\n",
+ " var x0 = msg['x0'] / mpl.ratio;\n",
+ " var y0 = (fig.canvas.height - msg['y0']) / mpl.ratio;\n",
+ " var x1 = msg['x1'] / mpl.ratio;\n",
+ " var y1 = (fig.canvas.height - msg['y1']) / mpl.ratio;\n",
" x0 = Math.floor(x0) + 0.5;\n",
" y0 = Math.floor(y0) + 0.5;\n",
" x1 = Math.floor(x1) + 0.5;\n",
@@ -1613,8 +1635,8 @@
" this.canvas_div.focus();\n",
" }\n",
"\n",
- " var x = canvas_pos.x;\n",
- " var y = canvas_pos.y;\n",
+ " var x = canvas_pos.x * mpl.ratio;\n",
+ " var y = canvas_pos.y * mpl.ratio;\n",
"\n",
" this.send_message(name, {x: x, y: y, button: event.button,\n",
" step: event.step,\n",
@@ -1674,9 +1696,9 @@
"mpl.figure.prototype.toolbar_button_onmouseover = function(tooltip) {\n",
" this.message.textContent = tooltip;\n",
"};\n",
- "mpl.toolbar_items = [[\"Home\", \"Reset original view\", \"fa fa-home icon-home\", \"home\"], [\"Back\", \"Back to previous view\", \"fa fa-arrow-left icon-arrow-left\", \"back\"], [\"Forward\", \"Forward to next view\", \"fa fa-arrow-right icon-arrow-right\", \"forward\"], [\"\", \"\", \"\", \"\"], [\"Pan\", \"Pan axes with left mouse, zoom with right\", \"fa fa-arrows icon-move\", \"pan\"], [\"Zoom\", \"Zoom to rectangle\", \"fa fa-square-o icon-check-empty\", \"zoom\"], [\"\", \"\", \"\", \"\"], [\"Download\", \"Download plot\", \"fa fa-floppy-o icon-save\", \"download\"]];\n",
+ "mpl.toolbar_items = [[\"Home\", \"Reset original view\", \"fa fa-home icon-home\", \"home\"], [\"Back\", \"Back to previous view\", \"fa fa-arrow-left icon-arrow-left\", \"back\"], [\"Forward\", \"Forward to next view\", \"fa fa-arrow-right icon-arrow-right\", \"forward\"], [\"\", \"\", \"\", \"\"], [\"Pan\", \"Pan axes with left mouse, zoom with right\", \"fa fa-arrows icon-move\", \"pan\"], [\"Zoom\", \"Zoom to rectangle\", \"fa fa-square-o icon-check-empty\", \"zoom\"], [\"\", \"\", \"\", \"\"], [\"Download\", \"Download plot\", \"fa fa-floppy-o icon-save\", \"download\"]];\n",
"\n",
- "mpl.extensions = [\"eps\", \"jpeg\", \"pdf\", \"png\", \"ps\", \"raw\", \"svg\", \"tif\"];\n",
+ "mpl.extensions = [\"eps\", \"pdf\", \"png\", \"ps\", \"raw\", \"svg\"];\n",
"\n",
"mpl.default_extension = \"png\";var comm_websocket_adapter = function(comm) {\n",
" // Create a \"websocket\"-like object which calls the given IPython comm\n",
@@ -1694,7 +1716,7 @@
" // Register the callback with on_msg.\n",
" comm.on_msg(function(msg) {\n",
" //console.log('receiving', msg['content']['data'], msg);\n",
- " // Pass the mpl event to the overriden (by mpl) onmessage function.\n",
+ " // Pass the mpl event to the overridden (by mpl) onmessage function.\n",
" ws.onmessage(msg['content']['data'])\n",
" });\n",
" return ws;\n",
@@ -1735,6 +1757,7 @@
"};\n",
"\n",
"mpl.figure.prototype.handle_close = function(fig, msg) {\n",
+ " var width = fig.canvas.width/mpl.ratio\n",
" fig.root.unbind('remove')\n",
"\n",
" // Update the output cell to use the data from the current canvas.\n",
@@ -1743,7 +1766,7 @@
" // Re-enable the keyboard manager in IPython - without this line, in FF,\n",
" // the notebook keyboard shortcuts fail.\n",
" IPython.keyboard_manager.enable()\n",
- " $(fig.parent_element).html('
');\n",
+ " $(fig.parent_element).html('
');\n",
" fig.close_ws(fig, msg);\n",
"}\n",
"\n",
@@ -1754,8 +1777,9 @@
"\n",
"mpl.figure.prototype.push_to_output = function(remove_interactive) {\n",
" // Turn the data on the canvas into data in the output cell.\n",
+ " var width = this.canvas.width/mpl.ratio\n",
" var dataURL = this.canvas.toDataURL();\n",
- " this.cell_info[1]['text/html'] = '
';\n",
+ " this.cell_info[1]['text/html'] = '
';\n",
"}\n",
"\n",
"mpl.figure.prototype.updated_canvas_event = function() {\n",
@@ -1898,7 +1922,7 @@
{
"data": {
"text/html": [
- "
"
+ "
"
],
"text/plain": [
""
@@ -1911,7 +1935,7 @@
"source": [
"fig = plt.figure()\n",
"ax = fig.add_subplot(111)\n",
- "ax.semilogy(1000/ignitionDelays['T'], ignitionDelays['ignDelay'],'o-')\n",
+ "ax.semilogy(1000/ignitionDelays['T'], ignitionDelays['ignDelay'], 'o-')\n",
"ax.set_ylabel('Ignition Delay (s)')\n",
"ax.set_xlabel(r'$\\frac{1000}{T (K)}$', fontsize=18)\n",
"\n",
@@ -1923,15 +1947,6 @@
"ax2.set_xlim(ax.get_xlim())\n",
"ax2.set_xlabel(r'Temperature: $T(K)$');"
]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "collapsed": true
- },
- "outputs": [],
- "source": []
}
],
"metadata": {
@@ -1950,7 +1965,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.6.8"
+ "version": "3.7.2"
}
},
"nbformat": 4,
diff --git a/reactors/stirred_reactor.ipynb b/reactors/stirred_reactor.ipynb
index acc1cbc..96fb5aa 100644
--- a/reactors/stirred_reactor.ipynb
+++ b/reactors/stirred_reactor.ipynb
@@ -23,15 +23,13 @@
{
"cell_type": "code",
"execution_count": 1,
- "metadata": {
- "collapsed": false
- },
+ "metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
- "Running Cantera version: 2.3.0a2\n"
+ "Running Cantera version: 2.5.0a2\n"
]
}
],
@@ -47,6 +45,31 @@
"print(\"Running Cantera version: {}\".format(ct.__version__))"
]
},
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Import modules and set plotting defaults"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "%matplotlib notebook\n",
+ "import matplotlib.pyplot as plt\n",
+ "\n",
+ "plt.style.use('ggplot')\n",
+ "plt.style.use('seaborn-pastel')\n",
+ "\n",
+ "plt.rcParams['axes.labelsize'] = 18\n",
+ "plt.rcParams['xtick.labelsize'] = 14\n",
+ "plt.rcParams['ytick.labelsize'] = 14\n",
+ "plt.rcParams['figure.autolayout'] = True"
+ ]
+ },
{
"cell_type": "markdown",
"metadata": {},
@@ -58,10 +81,8 @@
},
{
"cell_type": "code",
- "execution_count": 2,
- "metadata": {
- "collapsed": false
- },
+ "execution_count": 3,
+ "metadata": {},
"outputs": [
{
"name": "stdout",
@@ -78,37 +99,7 @@
"**** WARNING ****\n",
"For species CHV, discontinuity in h/RT detected at Tmid = 1000\n",
"\tValue computed using low-temperature polynomial: 107.505\n",
- "\tValue computed using high-temperature polynomial: 107.348\n",
- "\n",
- "\n",
- "**** WARNING ****\n",
- "For species CH2CO, discontinuity in cp/R detected at Tmid = 1000\n",
- "\tValue computed using low-temperature polynomial: 10.0876\n",
- "\tValue computed using high-temperature polynomial: 10.1013\n",
- "\n",
- "\n",
- "**** WARNING ****\n",
- "For species C5H9B-A,COOH, discontinuity in cp/R detected at Tmid = 1675\n",
- "\tValue computed using low-temperature polynomial: 47.645\n",
- "\tValue computed using high-temperature polynomial: 47.5845\n",
- "\n",
- "\n",
- "**** WARNING ****\n",
- "For species C5H9B-C,DOOH, discontinuity in cp/R detected at Tmid = 1675\n",
- "\tValue computed using low-temperature polynomial: 47.645\n",
- "\tValue computed using high-temperature polynomial: 47.5845\n",
- "\n",
- "\n",
- "**** WARNING ****\n",
- "For species C5H9C-A,AOOH, discontinuity in cp/R detected at Tmid = 1681\n",
- "\tValue computed using low-temperature polynomial: 48.5491\n",
- "\tValue computed using high-temperature polynomial: 48.4914\n",
- "\n",
- "\n",
- "**** WARNING ****\n",
- "For species C5H9C-A,DOOH, discontinuity in cp/R detected at Tmid = 1681\n",
- "\tValue computed using low-temperature polynomial: 48.5491\n",
- "\tValue computed using high-temperature polynomial: 48.4914\n"
+ "\tValue computed using high-temperature polynomial: 107.348\n"
]
}
],
@@ -126,21 +117,19 @@
},
{
"cell_type": "code",
- "execution_count": 3,
- "metadata": {
- "collapsed": false
- },
+ "execution_count": 4,
+ "metadata": {},
"outputs": [],
"source": [
"# Inlet gas conditions\n",
- "reactorTemperature = 925 #Kelvin\n",
- "reactorPressure = 1.046138*ct.one_atm #in atm. This equals 1.06 bars\n",
+ "reactorTemperature = 925 # Kelvin\n",
+ "reactorPressure = 1.046138*ct.one_atm # in atm. This equals 1.06 bars\n",
"concentrations = {'NC7H16': 0.005, 'O2': 0.0275, 'HE': 0.9675}\n",
"gas.TPX = reactorTemperature, reactorPressure, concentrations \n",
"\n",
"# Reactor parameters\n",
- "residenceTime = 2 #s\n",
- "reactorVolume = 30.5*(1e-2)**3 #m3\n",
+ "residenceTime = 2 # s\n",
+ "reactorVolume = 30.5*(1e-2)**3 # m3\n",
"\n",
"# Instrument parameters\n",
"\n",
@@ -162,14 +151,12 @@
},
{
"cell_type": "code",
- "execution_count": 4,
- "metadata": {
- "collapsed": true
- },
+ "execution_count": 5,
+ "metadata": {},
"outputs": [],
"source": [
"# Simulation termination criterion\n",
- "maxSimulationTime = 50 # seconds"
+ "maxSimulationTime = 50 # seconds"
]
},
{
@@ -192,10 +179,8 @@
},
{
"cell_type": "code",
- "execution_count": 5,
- "metadata": {
- "collapsed": false
- },
+ "execution_count": 6,
+ "metadata": {},
"outputs": [],
"source": [
"fuelAirMixtureTank = ct.Reservoir(gas)\n",
@@ -216,32 +201,28 @@
},
{
"cell_type": "code",
- "execution_count": 6,
- "metadata": {
- "collapsed": false
- },
+ "execution_count": 7,
+ "metadata": {},
"outputs": [],
"source": [
- "# now compile a list of all variables for which we will store data\n",
+ "# Now compile a list of all variables for which we will store data\n",
"columnNames = [stirredReactor.component_name(item) for item in range(stirredReactor.n_vars)]\n",
"columnNames = ['pressure'] + columnNames\n",
"\n",
- "# use the above list to create a DataFrame\n",
+ "# Use the above list to create a DataFrame\n",
"timeHistory = pd.DataFrame(columns=columnNames)"
]
},
{
"cell_type": "code",
- "execution_count": 7,
- "metadata": {
- "collapsed": false
- },
+ "execution_count": 8,
+ "metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
- "Simulation Took 80.92s to compute, with 1264 steps\n"
+ "Simulation Took 8.79s to compute, with 1153 steps\n"
]
}
],
@@ -258,11 +239,11 @@
" # We will store only every 10th value. Remember, we have 1200+ species, so there will be\n",
" # 1200 columns for us to work with\n",
" if(counter%10 == 0):\n",
- " #Extract the state of the reactor\n",
+ " # Extract the state of the reactor\n",
" state = np.hstack([stirredReactor.thermo.P, stirredReactor.mass, \n",
" stirredReactor.volume, stirredReactor.T, stirredReactor.thermo.X])\n",
" \n",
- " #Update the dataframe\n",
+ " # Update the dataframe\n",
" timeHistory.loc[t] = state\n",
" \n",
" counter += 1\n",
@@ -286,34 +267,6 @@
"## Plot the results"
]
},
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "### Import modules and set plotting defaults"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 8,
- "metadata": {
- "collapsed": true
- },
- "outputs": [],
- "source": [
- "import matplotlib.pyplot as plt\n",
- "import matplotlib as mpl\n",
- "%matplotlib notebook\n",
- "\n",
- "plt.style.use('ggplot')\n",
- "plt.style.use('seaborn-pastel')\n",
- "\n",
- "plt.rcParams['axes.labelsize'] = 18\n",
- "plt.rcParams['xtick.labelsize'] = 14\n",
- "plt.rcParams['ytick.labelsize'] = 14\n",
- "plt.rcParams['figure.autolayout'] = True"
- ]
- },
{
"cell_type": "markdown",
"metadata": {},
@@ -324,9 +277,7 @@
{
"cell_type": "code",
"execution_count": 9,
- "metadata": {
- "collapsed": false
- },
+ "metadata": {},
"outputs": [
{
"data": {
@@ -334,6 +285,7 @@
"/* Put everything inside the global mpl namespace */\n",
"window.mpl = {};\n",
"\n",
+ "\n",
"mpl.get_websocket_type = function() {\n",
" if (typeof(WebSocket) !== 'undefined') {\n",
" return WebSocket;\n",
@@ -392,6 +344,9 @@
" this.ws.onopen = function () {\n",
" fig.send_message(\"supports_binary\", {value: fig.supports_binary});\n",
" fig.send_message(\"send_image_mode\", {});\n",
+ " if (mpl.ratio != 1) {\n",
+ " fig.send_message(\"set_dpi_ratio\", {'dpi_ratio': mpl.ratio});\n",
+ " }\n",
" fig.send_message(\"refresh\", {});\n",
" }\n",
"\n",
@@ -406,7 +361,7 @@
" };\n",
"\n",
" this.imageObj.onunload = function() {\n",
- " this.ws.close();\n",
+ " fig.ws.close();\n",
" }\n",
"\n",
" this.ws.onmessage = this._make_on_message_function(this);\n",
@@ -461,6 +416,15 @@
" this.canvas = canvas[0];\n",
" this.context = canvas[0].getContext(\"2d\");\n",
"\n",
+ " var backingStore = this.context.backingStorePixelRatio ||\n",
+ "\tthis.context.webkitBackingStorePixelRatio ||\n",
+ "\tthis.context.mozBackingStorePixelRatio ||\n",
+ "\tthis.context.msBackingStorePixelRatio ||\n",
+ "\tthis.context.oBackingStorePixelRatio ||\n",
+ "\tthis.context.backingStorePixelRatio || 1;\n",
+ "\n",
+ " mpl.ratio = (window.devicePixelRatio || 1) / backingStore;\n",
+ "\n",
" var rubberband = $('');\n",
" rubberband.attr('style', \"position: absolute; left: 0; top: 0; z-index: 1;\")\n",
"\n",
@@ -517,8 +481,9 @@
" canvas_div.css('width', width)\n",
" canvas_div.css('height', height)\n",
"\n",
- " canvas.attr('width', width);\n",
- " canvas.attr('height', height);\n",
+ " canvas.attr('width', width * mpl.ratio);\n",
+ " canvas.attr('height', height * mpl.ratio);\n",
+ " canvas.attr('style', 'width: ' + width + 'px; height: ' + height + 'px;');\n",
"\n",
" rubberband.attr('width', width);\n",
" rubberband.attr('height', height);\n",
@@ -651,10 +616,10 @@
"}\n",
"\n",
"mpl.figure.prototype.handle_rubberband = function(fig, msg) {\n",
- " var x0 = msg['x0'];\n",
- " var y0 = fig.canvas.height - msg['y0'];\n",
- " var x1 = msg['x1'];\n",
- " var y1 = fig.canvas.height - msg['y1'];\n",
+ " var x0 = msg['x0'] / mpl.ratio;\n",
+ " var y0 = (fig.canvas.height - msg['y0']) / mpl.ratio;\n",
+ " var x1 = msg['x1'] / mpl.ratio;\n",
+ " var y1 = (fig.canvas.height - msg['y1']) / mpl.ratio;\n",
" x0 = Math.floor(x0) + 0.5;\n",
" y0 = Math.floor(y0) + 0.5;\n",
" x1 = Math.floor(x1) + 0.5;\n",
@@ -810,8 +775,8 @@
" this.canvas_div.focus();\n",
" }\n",
"\n",
- " var x = canvas_pos.x;\n",
- " var y = canvas_pos.y;\n",
+ " var x = canvas_pos.x * mpl.ratio;\n",
+ " var y = canvas_pos.y * mpl.ratio;\n",
"\n",
" this.send_message(name, {x: x, y: y, button: event.button,\n",
" step: event.step,\n",
@@ -871,9 +836,9 @@
"mpl.figure.prototype.toolbar_button_onmouseover = function(tooltip) {\n",
" this.message.textContent = tooltip;\n",
"};\n",
- "mpl.toolbar_items = [[\"Home\", \"Reset original view\", \"fa fa-home icon-home\", \"home\"], [\"Back\", \"Back to previous view\", \"fa fa-arrow-left icon-arrow-left\", \"back\"], [\"Forward\", \"Forward to next view\", \"fa fa-arrow-right icon-arrow-right\", \"forward\"], [\"\", \"\", \"\", \"\"], [\"Pan\", \"Pan axes with left mouse, zoom with right\", \"fa fa-arrows icon-move\", \"pan\"], [\"Zoom\", \"Zoom to rectangle\", \"fa fa-square-o icon-check-empty\", \"zoom\"], [\"\", \"\", \"\", \"\"], [\"Download\", \"Download plot\", \"fa fa-floppy-o icon-save\", \"download\"]];\n",
+ "mpl.toolbar_items = [[\"Home\", \"Reset original view\", \"fa fa-home icon-home\", \"home\"], [\"Back\", \"Back to previous view\", \"fa fa-arrow-left icon-arrow-left\", \"back\"], [\"Forward\", \"Forward to next view\", \"fa fa-arrow-right icon-arrow-right\", \"forward\"], [\"\", \"\", \"\", \"\"], [\"Pan\", \"Pan axes with left mouse, zoom with right\", \"fa fa-arrows icon-move\", \"pan\"], [\"Zoom\", \"Zoom to rectangle\", \"fa fa-square-o icon-check-empty\", \"zoom\"], [\"\", \"\", \"\", \"\"], [\"Download\", \"Download plot\", \"fa fa-floppy-o icon-save\", \"download\"]];\n",
"\n",
- "mpl.extensions = [\"eps\", \"jpeg\", \"pdf\", \"png\", \"ps\", \"raw\", \"svg\", \"tif\"];\n",
+ "mpl.extensions = [\"eps\", \"pdf\", \"png\", \"ps\", \"raw\", \"svg\"];\n",
"\n",
"mpl.default_extension = \"png\";var comm_websocket_adapter = function(comm) {\n",
" // Create a \"websocket\"-like object which calls the given IPython comm\n",
@@ -891,7 +856,7 @@
" // Register the callback with on_msg.\n",
" comm.on_msg(function(msg) {\n",
" //console.log('receiving', msg['content']['data'], msg);\n",
- " // Pass the mpl event to the overriden (by mpl) onmessage function.\n",
+ " // Pass the mpl event to the overridden (by mpl) onmessage function.\n",
" ws.onmessage(msg['content']['data'])\n",
" });\n",
" return ws;\n",
@@ -932,6 +897,7 @@
"};\n",
"\n",
"mpl.figure.prototype.handle_close = function(fig, msg) {\n",
+ " var width = fig.canvas.width/mpl.ratio\n",
" fig.root.unbind('remove')\n",
"\n",
" // Update the output cell to use the data from the current canvas.\n",
@@ -940,7 +906,7 @@
" // Re-enable the keyboard manager in IPython - without this line, in FF,\n",
" // the notebook keyboard shortcuts fail.\n",
" IPython.keyboard_manager.enable()\n",
- " $(fig.parent_element).html('
');\n",
+ " $(fig.parent_element).html('
');\n",
" fig.close_ws(fig, msg);\n",
"}\n",
"\n",
@@ -951,8 +917,9 @@
"\n",
"mpl.figure.prototype.push_to_output = function(remove_interactive) {\n",
" // Turn the data on the canvas into data in the output cell.\n",
+ " var width = this.canvas.width/mpl.ratio\n",
" var dataURL = this.canvas.toDataURL();\n",
- " this.cell_info[1]['text/html'] = '
';\n",
+ " this.cell_info[1]['text/html'] = '
';\n",
"}\n",
"\n",
"mpl.figure.prototype.updated_canvas_event = function() {\n",
@@ -1095,7 +1062,7 @@
{
"data": {
"text/html": [
- "
"
+ "
"
],
"text/plain": [
""
@@ -1125,14 +1092,25 @@
{
"cell_type": "code",
"execution_count": 10,
- "metadata": {
- "collapsed": false
- },
+ "metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
+ "\n",
"
\n",
" \n",
" \n",
@@ -1211,16 +1189,14 @@
{
"cell_type": "code",
"execution_count": 11,
- "metadata": {
- "collapsed": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"# Define all the temperatures at which we will run simulations. These should overlap\n",
"# with the values reported in the paper as much as possible\n",
"T = [650, 700, 750, 775, 825, 850, 875, 925, 950, 1075, 1100]\n",
"\n",
- "# Create a data frame to store values for the above points\n",
+ "# Create a DataFrame to store values for the above points\n",
"tempDependence = pd.DataFrame(columns=timeHistory.columns)\n",
"tempDependence.index.name = 'Temperature'"
]
@@ -1235,25 +1211,23 @@
{
"cell_type": "code",
"execution_count": 12,
- "metadata": {
- "collapsed": false
- },
+ "metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
- "Simulation at T=650K took 58.23s to compute\n",
- "Simulation at T=700K took 100.27s to compute\n",
- "Simulation at T=750K took 28.14s to compute\n",
- "Simulation at T=775K took 41.86s to compute\n",
- "Simulation at T=825K took 47.44s to compute\n",
- "Simulation at T=850K took 48.12s to compute\n",
- "Simulation at T=875K took 40.04s to compute\n",
- "Simulation at T=925K took 45.77s to compute\n",
- "Simulation at T=950K took 31.00s to compute\n",
- "Simulation at T=1075K took 59.79s to compute\n",
- "Simulation at T=1100K took 36.80s to compute\n"
+ "Simulation at T=650K took 9.85s to compute\n",
+ "Simulation at T=700K took 11.86s to compute\n",
+ "Simulation at T=750K took 3.99s to compute\n",
+ "Simulation at T=775K took 5.76s to compute\n",
+ "Simulation at T=825K took 6.73s to compute\n",
+ "Simulation at T=850K took 6.59s to compute\n",
+ "Simulation at T=875K took 5.78s to compute\n",
+ "Simulation at T=925K took 6.62s to compute\n",
+ "Simulation at T=950K took 4.53s to compute\n",
+ "Simulation at T=1075K took 8.07s to compute\n",
+ "Simulation at T=1100K took 4.86s to compute\n"
]
}
],
@@ -1262,17 +1236,17 @@
"concentrations = inletConcentrations\n",
"\n",
"for temperature in T:\n",
- " #Re-initialize the gas\n",
- " reactorTemperature = temperature #Kelvin\n",
- " reactorPressure = 1.046138*ct.one_atm #in atm. This equals 1.06 bars\n",
- " reactorVolume = 30.5*(1e-2)**3 #m3\n",
+ " # Re-initialize the gas\n",
+ " reactorTemperature = temperature # Kelvin\n",
+ " reactorPressure = 1.046138*ct.one_atm # in atm. This equals 1.06 bars\n",
+ " reactorVolume = 30.5*(1e-2)**3 # m3\n",
"\n",
" gas.TPX = reactorTemperature, reactorPressure, inletConcentrations\n",
"\n",
" # Re-initialize the dataframe used to hold values\n",
" timeHistory = pd.DataFrame(columns=columnNames)\n",
" \n",
- " # Re-initialize all the reactors, reservoirs, etc\n",
+ " # Re-initialize all the reactors, reservoirs, etc.\n",
" fuelAirMixtureTank = ct.Reservoir(gas)\n",
" exhaust = ct.Reservoir(gas)\n",
" \n",
@@ -1306,8 +1280,7 @@
" concentrations = stirredReactor.thermo.X\n",
" \n",
" # Store the result in the dataframe that indexes by temperature\n",
- " tempDependence.loc[temperature] = state\n",
- " "
+ " tempDependence.loc[temperature] = state"
]
},
{
@@ -1320,9 +1293,7 @@
{
"cell_type": "code",
"execution_count": 13,
- "metadata": {
- "collapsed": false
- },
+ "metadata": {},
"outputs": [
{
"data": {
@@ -1330,6 +1301,7 @@
"/* Put everything inside the global mpl namespace */\n",
"window.mpl = {};\n",
"\n",
+ "\n",
"mpl.get_websocket_type = function() {\n",
" if (typeof(WebSocket) !== 'undefined') {\n",
" return WebSocket;\n",
@@ -1388,6 +1360,9 @@
" this.ws.onopen = function () {\n",
" fig.send_message(\"supports_binary\", {value: fig.supports_binary});\n",
" fig.send_message(\"send_image_mode\", {});\n",
+ " if (mpl.ratio != 1) {\n",
+ " fig.send_message(\"set_dpi_ratio\", {'dpi_ratio': mpl.ratio});\n",
+ " }\n",
" fig.send_message(\"refresh\", {});\n",
" }\n",
"\n",
@@ -1402,7 +1377,7 @@
" };\n",
"\n",
" this.imageObj.onunload = function() {\n",
- " this.ws.close();\n",
+ " fig.ws.close();\n",
" }\n",
"\n",
" this.ws.onmessage = this._make_on_message_function(this);\n",
@@ -1457,6 +1432,15 @@
" this.canvas = canvas[0];\n",
" this.context = canvas[0].getContext(\"2d\");\n",
"\n",
+ " var backingStore = this.context.backingStorePixelRatio ||\n",
+ "\tthis.context.webkitBackingStorePixelRatio ||\n",
+ "\tthis.context.mozBackingStorePixelRatio ||\n",
+ "\tthis.context.msBackingStorePixelRatio ||\n",
+ "\tthis.context.oBackingStorePixelRatio ||\n",
+ "\tthis.context.backingStorePixelRatio || 1;\n",
+ "\n",
+ " mpl.ratio = (window.devicePixelRatio || 1) / backingStore;\n",
+ "\n",
" var rubberband = $('');\n",
" rubberband.attr('style', \"position: absolute; left: 0; top: 0; z-index: 1;\")\n",
"\n",
@@ -1513,8 +1497,9 @@
" canvas_div.css('width', width)\n",
" canvas_div.css('height', height)\n",
"\n",
- " canvas.attr('width', width);\n",
- " canvas.attr('height', height);\n",
+ " canvas.attr('width', width * mpl.ratio);\n",
+ " canvas.attr('height', height * mpl.ratio);\n",
+ " canvas.attr('style', 'width: ' + width + 'px; height: ' + height + 'px;');\n",
"\n",
" rubberband.attr('width', width);\n",
" rubberband.attr('height', height);\n",
@@ -1647,10 +1632,10 @@
"}\n",
"\n",
"mpl.figure.prototype.handle_rubberband = function(fig, msg) {\n",
- " var x0 = msg['x0'];\n",
- " var y0 = fig.canvas.height - msg['y0'];\n",
- " var x1 = msg['x1'];\n",
- " var y1 = fig.canvas.height - msg['y1'];\n",
+ " var x0 = msg['x0'] / mpl.ratio;\n",
+ " var y0 = (fig.canvas.height - msg['y0']) / mpl.ratio;\n",
+ " var x1 = msg['x1'] / mpl.ratio;\n",
+ " var y1 = (fig.canvas.height - msg['y1']) / mpl.ratio;\n",
" x0 = Math.floor(x0) + 0.5;\n",
" y0 = Math.floor(y0) + 0.5;\n",
" x1 = Math.floor(x1) + 0.5;\n",
@@ -1806,8 +1791,8 @@
" this.canvas_div.focus();\n",
" }\n",
"\n",
- " var x = canvas_pos.x;\n",
- " var y = canvas_pos.y;\n",
+ " var x = canvas_pos.x * mpl.ratio;\n",
+ " var y = canvas_pos.y * mpl.ratio;\n",
"\n",
" this.send_message(name, {x: x, y: y, button: event.button,\n",
" step: event.step,\n",
@@ -1867,9 +1852,9 @@
"mpl.figure.prototype.toolbar_button_onmouseover = function(tooltip) {\n",
" this.message.textContent = tooltip;\n",
"};\n",
- "mpl.toolbar_items = [[\"Home\", \"Reset original view\", \"fa fa-home icon-home\", \"home\"], [\"Back\", \"Back to previous view\", \"fa fa-arrow-left icon-arrow-left\", \"back\"], [\"Forward\", \"Forward to next view\", \"fa fa-arrow-right icon-arrow-right\", \"forward\"], [\"\", \"\", \"\", \"\"], [\"Pan\", \"Pan axes with left mouse, zoom with right\", \"fa fa-arrows icon-move\", \"pan\"], [\"Zoom\", \"Zoom to rectangle\", \"fa fa-square-o icon-check-empty\", \"zoom\"], [\"\", \"\", \"\", \"\"], [\"Download\", \"Download plot\", \"fa fa-floppy-o icon-save\", \"download\"]];\n",
+ "mpl.toolbar_items = [[\"Home\", \"Reset original view\", \"fa fa-home icon-home\", \"home\"], [\"Back\", \"Back to previous view\", \"fa fa-arrow-left icon-arrow-left\", \"back\"], [\"Forward\", \"Forward to next view\", \"fa fa-arrow-right icon-arrow-right\", \"forward\"], [\"\", \"\", \"\", \"\"], [\"Pan\", \"Pan axes with left mouse, zoom with right\", \"fa fa-arrows icon-move\", \"pan\"], [\"Zoom\", \"Zoom to rectangle\", \"fa fa-square-o icon-check-empty\", \"zoom\"], [\"\", \"\", \"\", \"\"], [\"Download\", \"Download plot\", \"fa fa-floppy-o icon-save\", \"download\"]];\n",
"\n",
- "mpl.extensions = [\"eps\", \"jpeg\", \"pdf\", \"png\", \"ps\", \"raw\", \"svg\", \"tif\"];\n",
+ "mpl.extensions = [\"eps\", \"pdf\", \"png\", \"ps\", \"raw\", \"svg\"];\n",
"\n",
"mpl.default_extension = \"png\";var comm_websocket_adapter = function(comm) {\n",
" // Create a \"websocket\"-like object which calls the given IPython comm\n",
@@ -1887,7 +1872,7 @@
" // Register the callback with on_msg.\n",
" comm.on_msg(function(msg) {\n",
" //console.log('receiving', msg['content']['data'], msg);\n",
- " // Pass the mpl event to the overriden (by mpl) onmessage function.\n",
+ " // Pass the mpl event to the overridden (by mpl) onmessage function.\n",
" ws.onmessage(msg['content']['data'])\n",
" });\n",
" return ws;\n",
@@ -1928,6 +1913,7 @@
"};\n",
"\n",
"mpl.figure.prototype.handle_close = function(fig, msg) {\n",
+ " var width = fig.canvas.width/mpl.ratio\n",
" fig.root.unbind('remove')\n",
"\n",
" // Update the output cell to use the data from the current canvas.\n",
@@ -1936,7 +1922,7 @@
" // Re-enable the keyboard manager in IPython - without this line, in FF,\n",
" // the notebook keyboard shortcuts fail.\n",
" IPython.keyboard_manager.enable()\n",
- " $(fig.parent_element).html('
');\n",
+ " $(fig.parent_element).html('
');\n",
" fig.close_ws(fig, msg);\n",
"}\n",
"\n",
@@ -1947,8 +1933,9 @@
"\n",
"mpl.figure.prototype.push_to_output = function(remove_interactive) {\n",
" // Turn the data on the canvas into data in the output cell.\n",
+ " var width = this.canvas.width/mpl.ratio\n",
" var dataURL = this.canvas.toDataURL();\n",
- " this.cell_info[1]['text/html'] = '
';\n",
+ " this.cell_info[1]['text/html'] = '
';\n",
"}\n",
"\n",
"mpl.figure.prototype.updated_canvas_event = function() {\n",
@@ -2091,7 +2078,7 @@
{
"data": {
"text/html": [
- "
"
+ "
"
],
"text/plain": [
""
@@ -2117,15 +2104,6 @@
"plt.xlim([650, 1100])\n",
"plt.legend(loc=1);"
]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "collapsed": true
- },
- "outputs": [],
- "source": []
}
],
"metadata": {
@@ -2144,9 +2122,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.5.2"
+ "version": "3.7.2"
}
},
"nbformat": 4,
- "nbformat_minor": 0
+ "nbformat_minor": 1
}
diff --git a/thermo/flame_temperature.ipynb b/thermo/flame_temperature.ipynb
index 1b98a64..846a858 100644
--- a/thermo/flame_temperature.ipynb
+++ b/thermo/flame_temperature.ipynb
@@ -12,9 +12,7 @@
{
"cell_type": "code",
"execution_count": 1,
- "metadata": {
- "collapsed": false
- },
+ "metadata": {},
"outputs": [],
"source": [
"%matplotlib notebook\n",
@@ -43,9 +41,7 @@
{
"cell_type": "code",
"execution_count": 2,
- "metadata": {
- "collapsed": false
- },
+ "metadata": {},
"outputs": [],
"source": [
"# Get all of the Species objects defined in the GRI 3.0 mechanism\n",
@@ -80,9 +76,7 @@
{
"cell_type": "code",
"execution_count": 3,
- "metadata": {
- "collapsed": false
- },
+ "metadata": {},
"outputs": [],
"source": [
"# Create an IdealGas object including incomplete combustion species\n",
@@ -98,9 +92,7 @@
{
"cell_type": "code",
"execution_count": 4,
- "metadata": {
- "collapsed": false
- },
+ "metadata": {},
"outputs": [
{
"data": {
@@ -108,6 +100,7 @@
"/* Put everything inside the global mpl namespace */\n",
"window.mpl = {};\n",
"\n",
+ "\n",
"mpl.get_websocket_type = function() {\n",
" if (typeof(WebSocket) !== 'undefined') {\n",
" return WebSocket;\n",
@@ -166,6 +159,9 @@
" this.ws.onopen = function () {\n",
" fig.send_message(\"supports_binary\", {value: fig.supports_binary});\n",
" fig.send_message(\"send_image_mode\", {});\n",
+ " if (mpl.ratio != 1) {\n",
+ " fig.send_message(\"set_dpi_ratio\", {'dpi_ratio': mpl.ratio});\n",
+ " }\n",
" fig.send_message(\"refresh\", {});\n",
" }\n",
"\n",
@@ -180,7 +176,7 @@
" };\n",
"\n",
" this.imageObj.onunload = function() {\n",
- " this.ws.close();\n",
+ " fig.ws.close();\n",
" }\n",
"\n",
" this.ws.onmessage = this._make_on_message_function(this);\n",
@@ -235,6 +231,15 @@
" this.canvas = canvas[0];\n",
" this.context = canvas[0].getContext(\"2d\");\n",
"\n",
+ " var backingStore = this.context.backingStorePixelRatio ||\n",
+ "\tthis.context.webkitBackingStorePixelRatio ||\n",
+ "\tthis.context.mozBackingStorePixelRatio ||\n",
+ "\tthis.context.msBackingStorePixelRatio ||\n",
+ "\tthis.context.oBackingStorePixelRatio ||\n",
+ "\tthis.context.backingStorePixelRatio || 1;\n",
+ "\n",
+ " mpl.ratio = (window.devicePixelRatio || 1) / backingStore;\n",
+ "\n",
" var rubberband = $('');\n",
" rubberband.attr('style', \"position: absolute; left: 0; top: 0; z-index: 1;\")\n",
"\n",
@@ -291,8 +296,9 @@
" canvas_div.css('width', width)\n",
" canvas_div.css('height', height)\n",
"\n",
- " canvas.attr('width', width);\n",
- " canvas.attr('height', height);\n",
+ " canvas.attr('width', width * mpl.ratio);\n",
+ " canvas.attr('height', height * mpl.ratio);\n",
+ " canvas.attr('style', 'width: ' + width + 'px; height: ' + height + 'px;');\n",
"\n",
" rubberband.attr('width', width);\n",
" rubberband.attr('height', height);\n",
@@ -425,10 +431,10 @@
"}\n",
"\n",
"mpl.figure.prototype.handle_rubberband = function(fig, msg) {\n",
- " var x0 = msg['x0'];\n",
- " var y0 = fig.canvas.height - msg['y0'];\n",
- " var x1 = msg['x1'];\n",
- " var y1 = fig.canvas.height - msg['y1'];\n",
+ " var x0 = msg['x0'] / mpl.ratio;\n",
+ " var y0 = (fig.canvas.height - msg['y0']) / mpl.ratio;\n",
+ " var x1 = msg['x1'] / mpl.ratio;\n",
+ " var y1 = (fig.canvas.height - msg['y1']) / mpl.ratio;\n",
" x0 = Math.floor(x0) + 0.5;\n",
" y0 = Math.floor(y0) + 0.5;\n",
" x1 = Math.floor(x1) + 0.5;\n",
@@ -584,8 +590,8 @@
" this.canvas_div.focus();\n",
" }\n",
"\n",
- " var x = canvas_pos.x;\n",
- " var y = canvas_pos.y;\n",
+ " var x = canvas_pos.x * mpl.ratio;\n",
+ " var y = canvas_pos.y * mpl.ratio;\n",
"\n",
" this.send_message(name, {x: x, y: y, button: event.button,\n",
" step: event.step,\n",
@@ -645,9 +651,9 @@
"mpl.figure.prototype.toolbar_button_onmouseover = function(tooltip) {\n",
" this.message.textContent = tooltip;\n",
"};\n",
- "mpl.toolbar_items = [[\"Home\", \"Reset original view\", \"fa fa-home icon-home\", \"home\"], [\"Back\", \"Back to previous view\", \"fa fa-arrow-left icon-arrow-left\", \"back\"], [\"Forward\", \"Forward to next view\", \"fa fa-arrow-right icon-arrow-right\", \"forward\"], [\"\", \"\", \"\", \"\"], [\"Pan\", \"Pan axes with left mouse, zoom with right\", \"fa fa-arrows icon-move\", \"pan\"], [\"Zoom\", \"Zoom to rectangle\", \"fa fa-square-o icon-check-empty\", \"zoom\"], [\"\", \"\", \"\", \"\"], [\"Download\", \"Download plot\", \"fa fa-floppy-o icon-save\", \"download\"]];\n",
+ "mpl.toolbar_items = [[\"Home\", \"Reset original view\", \"fa fa-home icon-home\", \"home\"], [\"Back\", \"Back to previous view\", \"fa fa-arrow-left icon-arrow-left\", \"back\"], [\"Forward\", \"Forward to next view\", \"fa fa-arrow-right icon-arrow-right\", \"forward\"], [\"\", \"\", \"\", \"\"], [\"Pan\", \"Pan axes with left mouse, zoom with right\", \"fa fa-arrows icon-move\", \"pan\"], [\"Zoom\", \"Zoom to rectangle\", \"fa fa-square-o icon-check-empty\", \"zoom\"], [\"\", \"\", \"\", \"\"], [\"Download\", \"Download plot\", \"fa fa-floppy-o icon-save\", \"download\"]];\n",
"\n",
- "mpl.extensions = [\"eps\", \"jpeg\", \"pdf\", \"png\", \"ps\", \"raw\", \"svg\", \"tif\"];\n",
+ "mpl.extensions = [\"eps\", \"pdf\", \"png\", \"ps\", \"raw\", \"svg\"];\n",
"\n",
"mpl.default_extension = \"png\";var comm_websocket_adapter = function(comm) {\n",
" // Create a \"websocket\"-like object which calls the given IPython comm\n",
@@ -665,7 +671,7 @@
" // Register the callback with on_msg.\n",
" comm.on_msg(function(msg) {\n",
" //console.log('receiving', msg['content']['data'], msg);\n",
- " // Pass the mpl event to the overriden (by mpl) onmessage function.\n",
+ " // Pass the mpl event to the overridden (by mpl) onmessage function.\n",
" ws.onmessage(msg['content']['data'])\n",
" });\n",
" return ws;\n",
@@ -706,6 +712,7 @@
"};\n",
"\n",
"mpl.figure.prototype.handle_close = function(fig, msg) {\n",
+ " var width = fig.canvas.width/mpl.ratio\n",
" fig.root.unbind('remove')\n",
"\n",
" // Update the output cell to use the data from the current canvas.\n",
@@ -714,7 +721,7 @@
" // Re-enable the keyboard manager in IPython - without this line, in FF,\n",
" // the notebook keyboard shortcuts fail.\n",
" IPython.keyboard_manager.enable()\n",
- " $(fig.parent_element).html('
');\n",
+ " $(fig.parent_element).html('
');\n",
" fig.close_ws(fig, msg);\n",
"}\n",
"\n",
@@ -725,8 +732,9 @@
"\n",
"mpl.figure.prototype.push_to_output = function(remove_interactive) {\n",
" // Turn the data on the canvas into data in the output cell.\n",
+ " var width = this.canvas.width/mpl.ratio\n",
" var dataURL = this.canvas.toDataURL();\n",
- " this.cell_info[1]['text/html'] = '
';\n",
+ " this.cell_info[1]['text/html'] = '
';\n",
"}\n",
"\n",
"mpl.figure.prototype.updated_canvas_event = function() {\n",
@@ -869,7 +877,7 @@
{
"data": {
"text/html": [
- "
"
+ "
"
],
"text/plain": [
""
@@ -886,15 +894,6 @@
"plt.xlabel('Equivalence ratio, $\\phi$')\n",
"plt.ylabel('Temperature [K]');"
]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "collapsed": true
- },
- "outputs": [],
- "source": []
}
],
"metadata": {
@@ -913,9 +912,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.4.3"
+ "version": "3.7.2"
}
},
"nbformat": 4,
- "nbformat_minor": 0
+ "nbformat_minor": 1
}
diff --git a/thermo/heating_value.ipynb b/thermo/heating_value.ipynb
index 6c1dd00..1326de6 100644
--- a/thermo/heating_value.ipynb
+++ b/thermo/heating_value.ipynb
@@ -16,9 +16,7 @@
{
"cell_type": "code",
"execution_count": 1,
- "metadata": {
- "collapsed": false
- },
+ "metadata": {},
"outputs": [
{
"name": "stdout",
@@ -56,9 +54,7 @@
{
"cell_type": "code",
"execution_count": 2,
- "metadata": {
- "collapsed": false
- },
+ "metadata": {},
"outputs": [
{
"name": "stdout",
@@ -93,9 +89,7 @@
{
"cell_type": "code",
"execution_count": 3,
- "metadata": {
- "collapsed": false
- },
+ "metadata": {},
"outputs": [
{
"name": "stdout",
@@ -155,9 +149,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.4.3"
+ "version": "3.7.2"
}
},
"nbformat": 4,
- "nbformat_minor": 0
+ "nbformat_minor": 1
}