HajimeKawahara/exojax

View on GitHub
documents/tutorials/jupiters/cloud_sigmag_range.ipynb

Summary

Maintainability
Test Coverage
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "from exojax.atm.atmphys import AmpAmcloud\n",
    "from exojax.spec.pardb import PdbCloud\n",
    "from exojax.utils.zsol import nsol\n",
    "from exojax.atm.mixratio import vmr2mmr\n",
    "from exojax.spec.molinfo import molmass_isotope\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      ".database/particulates/virga/virga.zip  exists. Remove it if you wanna re-download and unzip.\n",
      "Refractive index file found:  .database/particulates/virga/NH3.refrind\n",
      "Miegrid file exists: .database/particulates/virga/miegrid_lognorm_NH3.mg.npz\n"
     ]
    }
   ],
   "source": [
    "pdb_nh3 = PdbCloud(\"NH3\")\n",
    "amp_nh3 = AmpAmcloud(pdb_nh3, bkgatm=\"H2\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "# condensate substance density\n",
    "rhoc = pdb_nh3.condensate_substance_density  # g/cc\n",
    "n = nsol()\n",
    "abundance_nh3 = 3.0 * n[\"N\"]  # x 3 solar abundance\n",
    "molmass_nh3 = molmass_isotope(\"NH3\", db_HIT=False)\n",
    "mu=2.33\n",
    "MMRbase_nh3 = vmr2mmr(abundance_nh3, molmass_nh3, mu)\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[2.5258229e-05 2.5258229e-05 2.5258229e-05 2.5258229e-05]\n",
      "2.2433715\n"
     ]
    },
    {
     "ename": "",
     "evalue": "",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31mThe Kernel crashed while executing code in the current cell or a previous cell. \n",
      "\u001b[1;31mPlease review the code in the cell(s) to identify a possible cause of the failure. \n",
      "\u001b[1;31mClick <a href='https://aka.ms/vscodeJupyterKernelCrash'>here</a> for more info. \n",
      "\u001b[1;31mView Jupyter <a href='command:jupyter.viewOutput'>log</a> for further details."
     ]
    }
   ],
   "source": [
    "import jax.numpy as jnp\n",
    "from exojax.utils.astrofunc import gravity_jupiter\n",
    "from exojax.atm.amclouds import sigmag_from_effective_radius\n",
    "\n",
    "Parr = jnp.array([0.01, 0.1, 1.0, 10.0])\n",
    "Tarr = 100.0*jnp.ones_like(Parr)\n",
    "gravity = gravity_jupiter(1.0, 1.0)\n",
    "\n",
    "fsed = 10.0\n",
    "Kzz = 1.0e4\n",
    "reff = 3.0e-5  # 10um\n",
    "alpha = 2.0\n",
    "\n",
    "\n",
    "rw_layer, MMRc = amp_nh3.calc_ammodel_rw(\n",
    "    Parr, Tarr, mu, molmass_nh3, gravity, fsed, Kzz, MMRbase_nh3\n",
    ")\n",
    "rw = jnp.mean(rw_layer)\n",
    "print(rw_layer)\n",
    "sigmag = sigmag_from_effective_radius(reff, fsed, rw, alpha)\n",
    "print(sigmag)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "base",
   "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.10.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}