{ "cells": [ { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [], "source": [ "import pencilnew as pcn" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "You may need to compile and run simlation object from below first!" ] }, { "cell_type": "code", "execution_count": 13, "metadata": { "collapsed": true }, "outputs": [], "source": [ "sim = pcn.get_sim('../sample_simulations/2d_streaming_instability/')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Reading simulation parameters the easy way\n", "Use typ what quantitiy you need, parser does the rest!" ] }, { "cell_type": "code", "execution_count": 14, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "array([-0.1, 0. , 0. ])" ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "sim.get_value('beta_glnrho_global')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Getting an overview of VAR files and PVAR files" ] }, { "cell_type": "code", "execution_count": 15, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "VAR190\n", "PVAR190\n" ] } ], "source": [ "sim = pcn.get_sim('../sample_simulations/2d_streaming_instability/')\n", "varlist = sim.get_varlist()\n", "pvarlist = sim.get_varlist(particle=True)\n", "print(varlist[-1])\n", "print(pvarlist[-1])" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Get last 10 VAR files\n", "Also check out all abilities of get_varlist and come up with your own!" ] }, { "cell_type": "code", "execution_count": 16, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "['VAR181', 'VAR182', 'VAR183', 'VAR184', 'VAR185', 'VAR186', 'VAR187', 'VAR188', 'VAR189', 'VAR190']\n" ] } ], "source": [ "sim = pcn.get_sim('../sample_simulations/2d_streaming_instability/')\n", "varlist = sim.get_varlist(pos='last10')\n", "print(varlist)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Get VAR file object directly\n", "Also check out all abilities of get_var and come up with your own!" ] }, { "cell_type": "code", "execution_count": 16, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "['VAR181', 'VAR182', 'VAR183', 'VAR184', 'VAR185', 'VAR186', 'VAR187', 'VAR188', 'VAR189', 'VAR190']\n" ] } ], "source": [ "sim = pcn.get_sim('../sample_simulations/2d_streaming_instability/')\n", "var = sim.get_var(12)\n", "print(var.t)\n", "var = sim.get_var('last')\n", "print(var.t)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 2", "language": "python", "name": "python2" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.5" } }, "nbformat": 4, "nbformat_minor": 1 }