Last active
March 11, 2019 16:05
-
-
Save smhr/0553f14d2b54aefcb04cb2df1076999c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "cells": [ | |
| { | |
| "cell_type": "markdown", | |
| "metadata": {}, | |
| "source": [ | |
| "### Filament parameters for Phantom" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 46, | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "import numpy as np\n", | |
| "import math\n", | |
| "from astropy import constants as const\n", | |
| "from astropy import units as u\n", | |
| "#from astropy.constants import si" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 47, | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "densUnit = u.solMass/(u.pc)**3." | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 48, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "text/latex": [ | |
| "$\\mathrm{\\frac{M_{\\odot}}{pc^{3}}}$" | |
| ], | |
| "text/plain": [ | |
| "Unit(\"solMass / pc3\")" | |
| ] | |
| }, | |
| "execution_count": 48, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "densUnit" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 49, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "text/latex": [ | |
| "$3.5906036 \\times 10^{-19} \\; \\mathrm{\\frac{g}{cm^{3}}}$" | |
| ], | |
| "text/plain": [ | |
| "<Quantity 3.59060364e-19 g / cm3>" | |
| ] | |
| }, | |
| "execution_count": 49, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "filamentM = 250*u.solMass #filament mass\n", | |
| "filamentL = 1.5*u.pc #filament length\n", | |
| "filamentR = 0.1*u.pc #filament radius\n", | |
| "filamentV = math.pi*filamentR**2.*filamentL\n", | |
| "filamentDens = filamentM/filamentV\n", | |
| "filamentDens.decompose(u.cgs.bases)" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 50, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "text/latex": [ | |
| "$1.1968679 \\times 10^{-20} \\; \\mathrm{\\frac{g}{cm^{3}}}$" | |
| ], | |
| "text/plain": [ | |
| "<Quantity 1.19686788e-20 g / cm3>" | |
| ] | |
| }, | |
| "execution_count": 50, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "filamentDens.decompose(u.cgs.bases)/30." | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 51, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "text/latex": [ | |
| "$7.1812073 \\times 10^{-20} \\; \\mathrm{\\frac{g}{cm^{3}}}$" | |
| ], | |
| "text/plain": [ | |
| "<Quantity 7.18120729e-20 g / cm3>" | |
| ] | |
| }, | |
| "execution_count": 51, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "filamentM = 50*u.solMass #filament mass\n", | |
| "\n", | |
| "filamentDens = filamentM/filamentV\n", | |
| "filamentDens.decompose(u.cgs.bases)" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 52, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "text/latex": [ | |
| "$2.8724829 \\times 10^{-20} \\; \\mathrm{\\frac{g}{cm^{3}}}$" | |
| ], | |
| "text/plain": [ | |
| "<Quantity 2.87248291e-20 g / cm3>" | |
| ] | |
| }, | |
| "execution_count": 52, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "filamentM = 20*u.solMass #filament mass\n", | |
| "\n", | |
| "filamentDens = filamentM/filamentV\n", | |
| "filamentDens.decompose(u.cgs.bases)" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 53, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "text/latex": [ | |
| "$9.574943 \\times 10^{-22} \\; \\mathrm{\\frac{g}{cm^{3}}}$" | |
| ], | |
| "text/plain": [ | |
| "<Quantity 9.57494305e-22 g / cm3>" | |
| ] | |
| }, | |
| "execution_count": 53, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "filamentDens.decompose(u.cgs.bases)/30." | |
| ] | |
| }, | |
| { | |
| "cell_type": "markdown", | |
| "metadata": {}, | |
| "source": [ | |
| "**Calcualtion of sound speed:**" | |
| ] | |
| }, | |
| { | |
| "cell_type": "markdown", | |
| "metadata": {}, | |
| "source": [ | |
| "Input $\\mu$ and temperature:" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 54, | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "mu = 2.381; T = 15*u.Kelvin" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 55, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "text/latex": [ | |
| "$1.3806485 \\times 10^{-23} \\; \\mathrm{\\frac{J}{K}}$" | |
| ], | |
| "text/plain": [ | |
| "<<class 'astropy.constants.codata2014.CODATA2014'> name='Boltzmann constant' value=1.38064852e-23 uncertainty=7.9e-30 unit='J / K' reference='CODATA 2014'>" | |
| ] | |
| }, | |
| "execution_count": 55, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "const.k_B" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 56, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "text/latex": [ | |
| "$1.6726219 \\times 10^{-27} \\; \\mathrm{kg}$" | |
| ], | |
| "text/plain": [ | |
| "<<class 'astropy.constants.codata2014.CODATA2014'> name='Proton mass' value=1.672621898e-27 uncertainty=2.1e-35 unit='kg' reference='CODATA 2014'>" | |
| ] | |
| }, | |
| "execution_count": 56, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "const.m_p" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 57, | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "cs = (const.k_B*T/mu/const.m_p)**(0.5)" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 58, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "text/latex": [ | |
| "$228.03873 \\; \\mathrm{\\frac{J^{1/2}}{kg^{1/2}}}$" | |
| ], | |
| "text/plain": [ | |
| "<Quantity 228.03872731 J(1/2) / kg(1/2)>" | |
| ] | |
| }, | |
| "execution_count": 58, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "cs" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 59, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "text/latex": [ | |
| "$22803.873 \\; \\mathrm{\\frac{cm}{s}}$" | |
| ], | |
| "text/plain": [ | |
| "<Quantity 22803.87273107 cm / s>" | |
| ] | |
| }, | |
| "execution_count": 59, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "soundSpeed = cs.decompose(u.cgs.bases); soundSpeed" | |
| ] | |
| }, | |
| { | |
| "cell_type": "markdown", | |
| "metadata": {}, | |
| "source": [ | |
| "But we need to know the sound speed in the code unit when we input initial parameters for the Phantom code." | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 60, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "text/latex": [ | |
| "$6.67408 \\times 10^{-11} \\; \\mathrm{\\frac{m^{3}}{kg\\,s^{2}}}$" | |
| ], | |
| "text/plain": [ | |
| "<<class 'astropy.constants.codata2014.CODATA2014'> name='Gravitational constant' value=6.67408e-11 uncertainty=3.1e-15 unit='m3 / (kg s2)' reference='CODATA 2014'>" | |
| ] | |
| }, | |
| "execution_count": 60, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "const.G" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 61, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "text/latex": [ | |
| "$\\mathrm{\\frac{m^{3}}{kg\\,s^{2}}}$" | |
| ], | |
| "text/plain": [ | |
| "Unit(\"m3 / (kg s2)\")" | |
| ] | |
| }, | |
| "execution_count": 61, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "const.G.unit" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 62, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "text/latex": [ | |
| "$\\mathrm{s}$" | |
| ], | |
| "text/plain": [ | |
| "Unit(\"s\")" | |
| ] | |
| }, | |
| "execution_count": 62, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "timeUnitSi = (u.m**3/const.G.unit/u.kg)**(0.5); timeUnitSi" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 63, | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "timeUnit = (const.pc**3/(const.G)/const.M_sun)**(0.5)" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 64, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "text/latex": [ | |
| "$4.7051124 \\times 10^{14} \\; \\mathrm{s}$" | |
| ], | |
| "text/plain": [ | |
| "<Quantity 4.70511238e+14 s>" | |
| ] | |
| }, | |
| "execution_count": 64, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "timeUnit" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 65, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "text/latex": [ | |
| "$2.1253477 \\times 10^{-15} \\; \\mathrm{\\frac{pc}{s}}$" | |
| ], | |
| "text/plain": [ | |
| "<Quantity 2.12534775e-15 pc / s>" | |
| ] | |
| }, | |
| "execution_count": 65, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "velocityUnit = u.pc/timeUnit; velocityUnit" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 66, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "text/latex": [ | |
| "$1.0729478 \\times 10^{19} \\; \\mathrm{\\frac{cm}{pc}}$" | |
| ], | |
| "text/plain": [ | |
| "<Quantity 1.07294784e+19 cm / pc>" | |
| ] | |
| }, | |
| "execution_count": 66, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "soundSpeedDimless = soundSpeed/velocityUnit; soundSpeedDimless" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 67, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "text/latex": [ | |
| "$3.4771871 \\; \\mathrm{}$" | |
| ], | |
| "text/plain": [ | |
| "<Quantity 3.47718713>" | |
| ] | |
| }, | |
| "execution_count": 67, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "soundSpeedDimless.decompose(u.cgs.bases)" | |
| ] | |
| }, | |
| { | |
| "cell_type": "markdown", | |
| "metadata": {}, | |
| "source": [ | |
| "Calculation of maximum density that can be resolved:" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 68, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "text/latex": [ | |
| "$8.3144598 \\; \\mathrm{\\frac{J}{K\\,g}}$" | |
| ], | |
| "text/plain": [ | |
| "<Quantity 8.3144598 J / (g K)>" | |
| ] | |
| }, | |
| "execution_count": 68, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "Rg = const.R*u.mol/u.gram; Rg" | |
| ] | |
| }, | |
| { | |
| "cell_type": "markdown", | |
| "metadata": {}, | |
| "source": [ | |
| "### Calculation of Jeans length:" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 73, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "text/latex": [ | |
| "$7.1812073 \\times 10^{-20} \\; \\mathrm{\\frac{g}{cm^{3}}}$" | |
| ], | |
| "text/plain": [ | |
| "<Quantity 7.18120729e-20 g / cm3>" | |
| ] | |
| }, | |
| "execution_count": 73, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "filamentM = 50*u.solMass #filament mass\n", | |
| "\n", | |
| "filamentDens = filamentM/filamentV\n", | |
| "filamentDens.decompose(u.cgs.bases)" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 80, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "text/latex": [ | |
| "$1.5188798 \\times 10^{8} \\; \\mathrm{\\frac{pc^{3/2}\\,cm\\,kg^{1/2}}{M_{\\odot}^{1/2}\\,m^{3/2}}}$" | |
| ], | |
| "text/plain": [ | |
| "<Quantity 1.51887979e+08 cm kg(1/2) pc(3/2) / (m(3/2) solMass(1/2))>" | |
| ] | |
| }, | |
| "execution_count": 80, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "JeansL = (math.pi*soundSpeed**2/const.G/filamentDens)**(1/2.); JeansL" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 81, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "text/latex": [ | |
| "$5.8383363 \\times 10^{17} \\; \\mathrm{cm}$" | |
| ], | |
| "text/plain": [ | |
| "<Quantity 5.83833632e+17 cm>" | |
| ] | |
| }, | |
| "execution_count": 81, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "JeansL.decompose(u.cgs.bases)" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 82, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "text/latex": [ | |
| "$0.18920759 \\; \\mathrm{pc}$" | |
| ], | |
| "text/plain": [ | |
| "<Quantity 0.18920759 pc>" | |
| ] | |
| }, | |
| "execution_count": 82, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "JeansL.decompose(u.cgs.bases).to(u.parsec)" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 69, | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "# function to calculate rho_crit (Bate & Burkert 1997)\n", | |
| "def calcRhoCrit (T, mu, Ntot, Mtot):\n", | |
| " Nnei = 50\n", | |
| " rhoCrit = (3./4/math.pi) * (5*Rg*T/2/const.G/mu)**3 * (Ntot/(2*Nnei)/Mtot)**2\n", | |
| " return rhoCrit.decompose(u.cgs.bases)\n", | |
| "\n", | |
| "# function to calculate rho_crit (Hubber et al. 2006)\n", | |
| "def calcRhoCritHubber (T, mu, Ntot, Mtot):\n", | |
| " ss2 = (const.k_B*T/mu/const.m_p) # sound speed ^ 2\n", | |
| " Nnei = 50\n", | |
| " rhoCritHubber = (math.pi*ss2/const.G)**3 * (math.pi/(6*Nnei*(Mtot/Ntot)))**2\n", | |
| " return rhoCritHubber.decompose(u.cgs.bases)" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 72, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "text/latex": [ | |
| "$1.0794132 \\times 10^{-14} \\; \\mathrm{\\frac{g}{cm^{3}}}$" | |
| ], | |
| "text/plain": [ | |
| "<Quantity 1.07941322e-14 g / cm3>" | |
| ] | |
| }, | |
| "execution_count": 72, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "calcRhoCrit (T = 15*u.Kelvin, mu = 2.381, Ntot = 1000000, Mtot = 65*const.M_sun)" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 70, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "text/latex": [ | |
| "$1.6270609 \\times 10^{-13} \\; \\mathrm{\\frac{g}{cm^{3}}}$" | |
| ], | |
| "text/plain": [ | |
| "<Quantity 1.62706094e-13 g / cm3>" | |
| ] | |
| }, | |
| "execution_count": 70, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "calcRhoCritHubber (T = 15*u.Kelvin, mu = 2.381, Ntot = 1000000, Mtot = 50*const.M_sun)" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 87, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "text/latex": [ | |
| "$1.6417875 \\times 10^{-15} \\; \\mathrm{\\frac{g}{cm^{3}}}$" | |
| ], | |
| "text/plain": [ | |
| "<Quantity 1.6417875e-15 g / cm3>" | |
| ] | |
| }, | |
| "execution_count": 87, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "calcRhoCrit (T = 15*u.Kelvin, mu = 2.381, Ntot = 300000, Mtot = 50*const.M_sun)" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 92, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "text/latex": [ | |
| "$4.1044688 \\times 10^{-18} \\; \\mathrm{\\frac{g}{cm^{3}}}$" | |
| ], | |
| "text/plain": [ | |
| "<Quantity 4.10446876e-18 g / cm3>" | |
| ] | |
| }, | |
| "execution_count": 92, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "calcRhoCrit (T = 15*u.Kelvin, mu = 2.381, Ntot = 30000, Mtot = 100*const.M_sun)" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 84, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "text/latex": [ | |
| "$3.1582554 \\times 10^{-14} \\; \\mathrm{\\frac{g}{cm^{3}}}$" | |
| ], | |
| "text/plain": [ | |
| "<Quantity 3.15825543e-14 g / cm3>" | |
| ] | |
| }, | |
| "execution_count": 84, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "calcRhoCrit (T = 15*u.Kelvin, mu = 2.381, Ntot = 1000000, Mtot = 38*const.M_sun)" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 83, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "text/latex": [ | |
| "$2.8424299 \\times 10^{-15} \\; \\mathrm{\\frac{g}{cm^{3}}}$" | |
| ], | |
| "text/plain": [ | |
| "<Quantity 2.84242989e-15 g / cm3>" | |
| ] | |
| }, | |
| "execution_count": 83, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "calcRhoCrit (T = 15*u.Kelvin, mu = 2.381, Ntot = 300000, Mtot = 38*const.M_sun)" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 86, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "text/latex": [ | |
| "$1.4643548 \\times 10^{-14} \\; \\mathrm{\\frac{g}{cm^{3}}}$" | |
| ], | |
| "text/plain": [ | |
| "<Quantity 1.46435485e-14 g / cm3>" | |
| ] | |
| }, | |
| "execution_count": 86, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "calcRhoCritHubber (T = 15*u.Kelvin, mu = 2.381, Ntot = 300000, Mtot = 50*const.M_sun)" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 95, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "text/latex": [ | |
| "$1.6417875 \\times 10^{-17} \\; \\mathrm{\\frac{g}{cm^{3}}}$" | |
| ], | |
| "text/plain": [ | |
| "<Quantity 1.6417875e-17 g / cm3>" | |
| ] | |
| }, | |
| "execution_count": 95, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "calcRhoCrit (T = 15*u.Kelvin, mu = 2.381, Ntot = 30000, Mtot = 50*const.M_sun)" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 32, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "text/latex": [ | |
| "$2.026205 \\times 10^{-13} \\; \\mathrm{\\frac{g}{cm^{3}}}$" | |
| ], | |
| "text/plain": [ | |
| "<Quantity 2.02620503e-13 g / cm3>" | |
| ] | |
| }, | |
| "execution_count": 32, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "calcRhoCrit (T = 15*u.Kelvin, mu = 2.46, Ntot = 3500000, Mtot = 50*const.M_sun)" | |
| ] | |
| }, | |
| { | |
| "cell_type": "markdown", | |
| "metadata": {}, | |
| "source": [ | |
| "### Jeans length at critical density:" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 122, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "name": "stdout", | |
| "output_type": "stream", | |
| "text": [ | |
| "1.6417875041937452e-15 g / cm3\n", | |
| "258.10947998676363 AU\n" | |
| ] | |
| } | |
| ], | |
| "source": [ | |
| "rhoCrit = calcRhoCrit (T = 15*u.Kelvin, mu = 2.381, Ntot = 300000, Mtot = 50*const.M_sun); print(rhoCrit)\n", | |
| "JeansLengthCrit = (math.pi*soundSpeed**2/const.G/rhoCrit)**(1/2.)\n", | |
| "print(JeansLengthCrit.decompose(u.cgs.bases).to(u.AU))" | |
| ] | |
| }, | |
| { | |
| "cell_type": "markdown", | |
| "metadata": {}, | |
| "source": [ | |
| "### Jeans length at critical density for sink creation:" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 125, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "name": "stdout", | |
| "output_type": "stream", | |
| "text": [ | |
| "10458.33210557503 AU\n", | |
| "0.050703424864096 pc\n" | |
| ] | |
| } | |
| ], | |
| "source": [ | |
| "rhoSink = 1e-18*u.gram/u.cm**3 \n", | |
| "JeansLengthSink = (math.pi*soundSpeed**2/const.G/rhoSink)**(1/2.)\n", | |
| "print(JeansLengthSink.decompose(u.cgs.bases).to(u.AU))\n", | |
| "print(JeansLengthSink.decompose(u.cgs.bases).to(u.pc))" | |
| ] | |
| }, | |
| { | |
| "cell_type": "markdown", | |
| "metadata": {}, | |
| "source": [ | |
| "### Mass per unit length for an isothermal Ostriker filament:" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 101, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "text/latex": [ | |
| "$1.558317 \\times 10^{19} \\; \\mathrm{\\frac{cm^{2}\\,kg}{m^{3}}}$" | |
| ], | |
| "text/plain": [ | |
| "<Quantity 1.55831699e+19 cm2 kg / m3>" | |
| ] | |
| }, | |
| "execution_count": 101, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "ml = 2*soundSpeed**2/const.G; ml" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 104, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "text/latex": [ | |
| "$1.558317 \\times 10^{16} \\; \\mathrm{\\frac{g}{cm}}$" | |
| ], | |
| "text/plain": [ | |
| "<Quantity 1.55831699e+16 g / cm>" | |
| ] | |
| }, | |
| "execution_count": 104, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "ml.decompose(u.cgs.bases)" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 108, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "text/latex": [ | |
| "$\\mathrm{\\frac{M_{\\odot}}{pc}}$" | |
| ], | |
| "text/plain": [ | |
| "Unit(\"solMass / pc\")" | |
| ] | |
| }, | |
| "execution_count": 108, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "solarmassperparsec = u.solMass/u.parsec; solarmassperparsec" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 111, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "text/latex": [ | |
| "$24.181661 \\; \\mathrm{\\frac{M_{\\odot}}{pc}}$" | |
| ], | |
| "text/plain": [ | |
| "<Quantity 24.18166074 solMass / pc>" | |
| ] | |
| }, | |
| "execution_count": 111, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "ml.decompose(u.cgs.bases).to(solarmassperparsec)" | |
| ] | |
| }, | |
| { | |
| "cell_type": "markdown", | |
| "metadata": {}, | |
| "source": [ | |
| "So the mass of the Ostriker filament with 1.5 pc length is:" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 112, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "name": "stdout", | |
| "output_type": "stream", | |
| "text": [ | |
| "36.27249111393573 solMass / pc\n" | |
| ] | |
| } | |
| ], | |
| "source": [ | |
| "print(ml.decompose(u.cgs.bases).to(solarmassperparsec)*1.5)" | |
| ] | |
| }, | |
| { | |
| "cell_type": "markdown", | |
| "metadata": {}, | |
| "source": [ | |
| "### Critical density for Bate (2009, MNRAS, 397, 232–248) initial condition:" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 34, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "text/latex": [ | |
| "$6.0035705 \\times 10^{-14} \\; \\mathrm{\\frac{g}{cm^{3}}}$" | |
| ], | |
| "text/plain": [ | |
| "<Quantity 6.00357047e-14 g / cm3>" | |
| ] | |
| }, | |
| "execution_count": 34, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "calcRhoCrit (T = 10*u.Kelvin, mu = 2.46, Ntot = 3500000, Mtot = 50*const.M_sun)" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 35, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "text/latex": [ | |
| "$5.3547475 \\times 10^{-13} \\; \\mathrm{\\frac{g}{cm^{3}}}$" | |
| ], | |
| "text/plain": [ | |
| "<Quantity 5.3547475e-13 g / cm3>" | |
| ] | |
| }, | |
| "execution_count": 35, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "calcRhoCritHubber (T = 10*u.Kelvin, mu = 2.46, Ntot = 3500000, Mtot = 50*const.M_sun)" | |
| ] | |
| }, | |
| { | |
| "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.4" | |
| } | |
| }, | |
| "nbformat": 4, | |
| "nbformat_minor": 2 | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment