{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Getting Set up to Run the Code\n", "\n", "In this tutorial you will learn: \n", "\n", "1. How to pick condensates to run in a cloud model \n", "2. What is $f_{sed}$ and what number is right for my model? \n", "3. What are the chemical limitations in the code \n", "4. How to compute initial Mie scattering grid\n", "\n", "If you are already familiar with these things, I recommend moving to the next tutorial" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from bokeh.io import output_notebook \n", "from bokeh.plotting import show, figure\n", "from bokeh.palettes import Colorblind\n", "output_notebook()\n", "import numpy as np\n", "import pandas as pd\n", "import astropy.units as u\n", "\n", "#here is virga\n", "import virga.justdoit as jdi" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We will be pretty thorough in this first tutorial. In the very first step, we will set up our calculation run. This includes: \n", "\n", "1. Defining what gas condensates we want to include in the calculation. \n", "\n", "2. Defining the sedimentation efficiency $f_{sed}$. \n", "\n", "3. Defining metallicity and atmospheric mean molecular weight\n", "\n", "3. Defining grid of particle radii for the Mie code\n", "\n", "Let's briefly go through these one-by-one." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## How to Pick Gas Condensates \n", "\n", "We highly recommend looking at your climate profile first to give an informed decision to the cloud model. First check out what current condensates are available" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "#you can print the available condensate species in the code\n", "jdi.available()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Then you can let `virga` give you a recommendation with some visualization aid" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "pressure = np.logspace(-5,3,30) #simple isotherml PT profile (kelvin)\n", "temperature = np.zeros(30)+1300 \n", "metallicity = 1 #atmospheric metallicity relative to Solar\n", "mean_molecular_weight = 2.2 # atmospheric mean molecular weight\n", "\n", "#get virga recommendation for which gases to run\n", "recommended = jdi.recommend_gas(pressure, temperature, metallicity,mean_molecular_weight, \n", " #Turn on plotting \n", " plot=True)\n", "#print the results\n", "print(recommended)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### How to Compute Temperature Condensation Curves" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "`jdi.recommend` is comparing your pressure-temperature curve against __condensation temperature curves__ for each species. If you are interested in computing your own you can do so!" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "cond_t_fig = figure(y_axis_type='log',y_range=[1e2,1e-3],height=400, width=400,\n", " y_axis_label='Pressure(bars)',x_axis_label='Temperature (K)',\n", " title='Condensation Temperatures')\n", "metallicity = 1 \n", "mean_molecular_weight = 2.2\n", "for gas_name, c in zip(['Cr','MgSiO3','MnS'],Colorblind[8]): #case sensitive names\n", " #grab p,t from eddysed\n", " p,t = jdi.condensation_t(gas_name, metallicity, mean_molecular_weight)\n", " #plot it up\n", " cond_t_fig.line(t,p, legend_label=gas_name,color=c,line_width=3)\n", "\n", "show(cond_t_fig) \n", " " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## How to pick $f_{sed}$\n", "\n", "This parameter will set the vertical extent of our cloud. The general equation is: \n", "\n", "`condensate concentration (z)` $\\propto$ `concentration at cloud base` $exp(-f_{sed}z/H)$\n", "\n", "Therefore, high values of $f_{sed}$ deplete the cloud quickly, low values of $f_{sed}$ create large vertically thick clouds. __For context, it is thought that Hot Jupiters have fractional $f_{sed}$ values around 0.1, while Jupiter clouds can be parameterized with much larger values of 3-6.__\n", "\n", "Here is a little schematic to show the general behavior of $f_{sed}$" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "#km, arbitrary planet scale height \n", "H = 27 \n", "\n", "#define the cloud base \n", "cloud_base = 0.8 #bars \n", "\n", "#and some arbitrary height\n", "z = np.linspace(0,300,100)#km \n", "pressure_grid=100*np.exp(-z/H)#bars \n", "\n", "#setup figure\n", "toy_model = figure(x_axis_type='log',x_range=[1e-3,1.1],y_range=[1,1e-2],height=400, width=400,\n", " y_axis_label='Pressure(bars)',x_axis_label='Arbitrary Fake Cloud Concentration Units',\n", " title='F_sed Toy Model')\n", "\n", "#loop through some fseds and plot them up \n", "for fsed,c in zip([10,6,3,1,0.1],['red','orange','green','blue','purple']):\n", " cloud=np.zeros(100)+1e-13 #start with empty array \n", " \n", " #exponential equation I mentioned above \n", " fake_cloud = np.exp(-fsed*z[pressure_grid