{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## Analyze iRAWD mppnp simulations" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Using matplotlib backend: module://ipympl.backend_nbagg\n", "Populating the interactive namespace from numpy and matplotlib\n" ] } ], "source": [ "%pylab \n", "from nugridpy import nugridse as mp" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Searching files, please wait.......\n", "Reading preprocessor files\n", "File search complete.\n" ] } ], "source": [ "cmp=mp.se('/data/ASDR/NuGrid/iRAWDyields/mppnp_hif/H5_out_C_mesa')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## What quantities are available in this data type, and what are the units?\n", "Each of the _se_ file sets (in fact each of the dozens of hdf5 files that make up the data set for one mass/metallicty combination, or stellar evolution track) has three types of data contained in them:\n", "\n", "data type access | content \n", "----------------|---------\n", " `pt.se.hattrs` | a header section that holds the _header attributes_, including units in the form of factors so that if applied with the quantities the result is in cgs units \n", "`pt.se.cattrs` | for each cycle (or time step) the _cycle attributes_ are a number of scalar global quantities, such as total mass or star age\n", "`pt.se.dcols` | again, for each time step these are the vector quantities available, i.e. the data table columns; one of the data columns, _iso_massf_ is in fact a matrix where the matrix columns are different species, i.e. a radial vector of species vectors" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "['HDF5_version',\n", " 'SE_version',\n", " 'numcodev',\n", " 'codev',\n", " 'modname',\n", " 'mini',\n", " 'zini',\n", " 'rotini',\n", " 'overini',\n", " 'zisnb',\n", " 'age_unit',\n", " 'mass_unit',\n", " 'radius_unit',\n", " 'rho_unit',\n", " 'temperature_unit',\n", " 'dcoeff_unit']" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "cmp.se.hattrs" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "['shellnb', 'age', 'deltat', 'total_mass', 'cycle']" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "cmp.se.cattrs" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "['mass', 'radius', 'rho', 'temperature', 'dcoeff', 'iso_massf']" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "cmp.se.dcols" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Temperature profile" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "1.0" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "cmp.get('temperature_unit')/1.e9" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "61639ccec6194944a5cd226782150a2e", "version_major": 2, "version_minor": 0 }, "text/plain": [ "FigureCanvasNbAgg()" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ " reading ['mass']...100%0.14117026329040527\n" ] }, { "data": { "text/plain": [ "Text(0.5, 0, '$m_r/M_\\\\odot$')" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ifig=122;close(ifig);figure(ifig)\n", "cmp.plot('mass','temperature',fname=1000,shape=':')\n", "ylabel('$T / 10^9 \\mathrm{K}$')\n", "xlabel('$m_r/M_\\odot$')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Diffusion coefficient" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "3729ba82022d4b8da10fbffc1f1232d0", "version_major": 2, "version_minor": 0 }, "text/plain": [ "FigureCanvasNbAgg()" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ " reading ['radius']...100%0.033908843994140625\n" ] }, { "data": { "text/plain": [ "Text(0.5, 0, '$radius / [R_\\\\odot]$')" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ifig=123;close(ifig);figure(ifig)\n", "cmp.plot('radius','dcoeff',fname=1000,shape='--',logy=True)\n", "ylabel('$ \\\\log D / \\mathrm{[cm^2/s}]$')\n", "#xlabel('$m_r/M_\\odot$')\n", "xlabel('$radius / [R_\\odot]$')" ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [], "source": [ "from nugridpy import astronomy as ast" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## mixing time scale\n", "Let's assume there are three pressure scale heights and a mixing length is $0.01R_\\odot$. Then the mixing time scale is:" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Mixing time scale = 80.73 minutes.\n" ] } ], "source": [ "print(\"Mixing time scale = %.2f minutes.\"%((0.01*ast.rsun_cm)**2/1e14/60))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Abundance profiles " ] }, { "cell_type": "code", "execution_count": 14, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "3bf305f5721d438188529818401b58b7", "version_major": 2, "version_minor": 0 }, "text/plain": [ "FigureCanvasNbAgg()" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ " reading ['iso_massf']...100%" ] }, { "data": { "text/plain": [ "(-14, -3)" ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "species=['H-1','He-3','Be-7','Li-7','C-13','C-14','N-13']\n", "ifig=108;close(ifig);figure(ifig)\n", "cmp.abu_profile(isos=species, ifig=ifig, fname=5500, logy=True)\n", "ylim(-14,-3)\n", "#xlim(0.552,0.556)" ] }, { "cell_type": "code", "execution_count": 15, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "273e07ea73404ef6a45e2fa26d04f650", "version_major": 2, "version_minor": 0 }, "text/plain": [ "FigureCanvasNbAgg()" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ " reading ['iso_massf']...100%" ] }, { "data": { "text/plain": [ "(-14, -3)" ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "species=['Kr-84','Kr-85','Kr-86','Kr-87','Kr-88','Kr-89']\n", "ifig=109;close(ifig);figure(ifig)\n", "cmp.abu_profile(isos=species, ifig=ifig, fname=5500, logy=True)\n", "ylim(-14,-3)\n", "#xlim(0.552,0.556)" ] }, { "cell_type": "code", "execution_count": 16, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " reading ['mass']...100%" ] }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "0ebd612781b249859c9277f97d112db7", "version_major": 2, "version_minor": 0 }, "text/plain": [ "FigureCanvasNbAgg()" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "#ifig=1233;close(ifig);figure(ifig)\n", "cmp.abu_chart(6000,mass_range=[0.707824, 0.7209746], plotaxis=[48, 59, 35, 43],\\\n", " ilabel=True,imlabel=True,boxstable=True)\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "You can extract the trajectory and initial abundances from this model at the key mass coordinate for use in a 1-zone PPN simulation in order to study, for example, the impact of a new rate" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "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.7" } }, "nbformat": 4, "nbformat_minor": 2 }