{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import pencil as pc" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "You may need to compile and run simlation object from below first!" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "sim = pc.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": 3, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[-0.1, 0.0, 0.0]" ] }, "execution_count": 3, "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": 4, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "VAR11\n", "PVAR11\n" ] } ], "source": [ "sim = pc.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": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "['VAR2', 'VAR3', 'VAR4', 'VAR5', 'VAR6', 'VAR7', 'VAR8', 'VAR9', 'VAR10', 'VAR11']\n" ] } ], "source": [ "sim = pc.get_sim('../sample_simulations/2d_streaming_instability/')\n", "varlist = sim.get_varlist(pos='last10')\n", "print(varlist)" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.9" } }, "nbformat": 4, "nbformat_minor": 1 }