{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "2f7a51f0-5af2-4672-b899-e9c47a43bfff",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pint; u = pint.UnitRegistry()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "3eed55fa-740f-4d44-b71b-619098ace966",
   "metadata": {},
   "source": [
    "# US Yearly use\n",
    "100 Quadrillion BTU per year"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "67634382-f448-45bc-af3f-045413f74f4a",
   "metadata": {},
   "outputs": [],
   "source": [
    "US_energy = 100E15 * u.BTU/u.year"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "3bf085d3-4fc9-4cf3-92f9-56dd5548e67e",
   "metadata": {},
   "source": [
    "## MW"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "2aae43f4-2311-4b81-9b82-3ebf6c126c10",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "3345383\n"
     ]
    }
   ],
   "source": [
    "J_per_Btu = 1055\n",
    "MJ_per_J = 1E-6\n",
    "s_per_yr = 365. * 24 * 3600\n",
    "\n",
    "MW = US_energy.magnitude * J_per_Btu * MJ_per_J / s_per_yr\n",
    "print(f\"{MW:.0f}\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "9b70445f-8200-451d-bf97-f1aab09f1409",
   "metadata": {},
   "source": [
    "## Coal plants @ 384 MW each"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "6fb648f7-39d6-4788-9bf7-7368bbc776fb",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "8712\n"
     ]
    }
   ],
   "source": [
    "Ncoal = MW/384\n",
    "print(f\"{Ncoal:.0f}\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "72527d34-16a3-4f40-9530-b21f3bf869c6",
   "metadata": {},
   "source": [
    "## Wind turbines @ 2.43 MW each"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "e78415ca-e9ae-4e09-8bda-f22f45c091f2",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1376701\n",
      "1.38 million\n"
     ]
    }
   ],
   "source": [
    "Nwind = MW / 2.43\n",
    "print(f\"{Nwind:.0f}\")\n",
    "print(f\"{Nwind/1E6:.2f} million\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c1aea100-8541-4c54-9326-0ff1ce390adf",
   "metadata": {},
   "source": [
    "## Olympic swimming pools"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "ee4962b5-0d77-48f3-86b4-92c62e1f299c",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "18710564 / year\n",
      "0.59 / second\n"
     ]
    }
   ],
   "source": [
    "V = 660000. * u.gal\n",
    "V.ito(u.m**3)\n",
    "m = V*1000. * u.kg/u.m**3\n",
    "Δhvap = 2257 * u.J/u.g\n",
    "ΔHvap = (m*Δhvap).to(u.J)\n",
    "ΔHvap\n",
    "Npool = (US_energy/ΔHvap).to(1/u.year)\n",
    "print(f\"{Npool:.0f}\")\n",
    "Npool.ito(1/u.s)\n",
    "print(f\"{Npool:.2f}\")"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "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": 5
}
