|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "markdown", |
| 5 | + "id": "e3f1edc815e974f4", |
| 6 | + "metadata": {}, |
| 7 | + "source": [ |
| 8 | + "[](https://github.com/open-atmos/devops_tests/blob/main/test_files/template.ipynb)\n", |
| 9 | + "[](https://mybinder.org/v2/gh/open-atmos/devops_tests.git/main?urlpath=lab/tree/test_files/template.ipynb)\n", |
| 10 | + "[](https://colab.research.google.com/github/open-atmos/devops_tests/blob/main/test_files/template.ipynb)" |
| 11 | + ] |
| 12 | + }, |
| 13 | + { |
| 14 | + "cell_type": "markdown", |
| 15 | + "id": "bb84c52c57a729ec", |
| 16 | + "metadata": {}, |
| 17 | + "source": "### based on Table 1 from B.Bolin 1958 \"On the use of tritium as a tracer for water in nature\" (https://digitallibrary.un.org/record/3892725)" |
| 18 | + }, |
| 19 | + { |
| 20 | + "cell_type": "code", |
| 21 | + "id": "5e4e58050cc01f64", |
| 22 | + "metadata": { |
| 23 | + "ExecuteTime": { |
| 24 | + "end_time": "2024-12-05T21:30:20.214060Z", |
| 25 | + "start_time": "2024-12-05T21:30:20.209298Z" |
| 26 | + } |
| 27 | + }, |
| 28 | + "source": [ |
| 29 | + "import sys\n", |
| 30 | + "if 'google.colab' in sys.modules:\n", |
| 31 | + " !pip --quiet install open-atmos-jupyter-utils\n", |
| 32 | + " from open_atmos_jupyter_utils import pip_install_on_colab\n", |
| 33 | + " pip_install_on_colab('PySDM-examples')" |
| 34 | + ], |
| 35 | + "outputs": [], |
| 36 | + "execution_count": 1 |
| 37 | + }, |
| 38 | + { |
| 39 | + "cell_type": "code", |
| 40 | + "id": "95f360dc62f373f9", |
| 41 | + "metadata": { |
| 42 | + "ExecuteTime": { |
| 43 | + "end_time": "2024-12-05T21:30:21.622672Z", |
| 44 | + "start_time": "2024-12-05T21:30:20.218383Z" |
| 45 | + } |
| 46 | + }, |
| 47 | + "source": [ |
| 48 | + "import numpy as np\n", |
| 49 | + "import pandas\n", |
| 50 | + "from PySDM.physics import in_unit, si\n", |
| 51 | + "from PySDM import Formulae" |
| 52 | + ], |
| 53 | + "outputs": [], |
| 54 | + "execution_count": 2 |
| 55 | + }, |
| 56 | + { |
| 57 | + "cell_type": "code", |
| 58 | + "id": "e29a92d6680c4e51", |
| 59 | + "metadata": { |
| 60 | + "ExecuteTime": { |
| 61 | + "end_time": "2024-12-05T21:30:21.689116Z", |
| 62 | + "start_time": "2024-12-05T21:30:21.687254Z" |
| 63 | + } |
| 64 | + }, |
| 65 | + "source": "radii = np.asarray([0.005, 0.01, 0.025, 0.05, 0.075, 0.1, 0.15, 0.20]) * si.cm", |
| 66 | + "outputs": [], |
| 67 | + "execution_count": 3 |
| 68 | + }, |
| 69 | + { |
| 70 | + "metadata": { |
| 71 | + "ExecuteTime": { |
| 72 | + "end_time": "2024-12-05T21:30:24.420354Z", |
| 73 | + "start_time": "2024-12-05T21:30:21.698737Z" |
| 74 | + } |
| 75 | + }, |
| 76 | + "cell_type": "code", |
| 77 | + "source": [ |
| 78 | + "formulae = Formulae(\n", |
| 79 | + " terminal_velocity='RogersYau',\n", |
| 80 | + " drop_growth='Mason1951',\n", |
| 81 | + " diffusion_thermics='Neglect',\n", |
| 82 | + " saturation_vapour_pressure='AugustRocheMagnus',\n", |
| 83 | + " ventilation='Froessling1938',\n", |
| 84 | + " particle_shape_and_density='LiquidSpheres',\n", |
| 85 | + " air_dynamic_viscosity='ZografosEtAl1987',\n", |
| 86 | + " constants={'BOLIN_ISOTOPE_TIMESCALE_COEFF_C1': 1.63},\n", |
| 87 | + " isotope_relaxation_timescale='Bolin1958',\n", |
| 88 | + ")\n", |
| 89 | + "const = formulae.constants\n", |
| 90 | + "any_non_zero_value = 44.\n", |
| 91 | + "temperature = const.T0 + 10 * si.K\n", |
| 92 | + "pressure = const.p_STP\n", |
| 93 | + "pvs = formulae.saturation_vapour_pressure.pvs_water(temperature)\n", |
| 94 | + "v_term = formulae.terminal_velocity.v_term(radii)\n", |
| 95 | + "eta_air=formulae.air_dynamic_viscosity.eta_air(temperature)\n", |
| 96 | + "D=formulae.diffusion_thermics.D(T=temperature, p=pressure)\n", |
| 97 | + "\n", |
| 98 | + "air_density = pressure/const.Rd/temperature\n", |
| 99 | + "assert abs(air_density - 1)/air_density <.3\n", |
| 100 | + "Re = formulae.particle_shape_and_density.reynolds_number(\n", |
| 101 | + " radius=radii,\n", |
| 102 | + " velocity_wrt_air=v_term,\n", |
| 103 | + " dynamic_viscosity=eta_air,\n", |
| 104 | + " density=air_density,\n", |
| 105 | + ")\n", |
| 106 | + "Sc = formulae.trivia.air_schmidt_number(\n", |
| 107 | + " dynamic_viscosity=eta_air, \n", |
| 108 | + " diffusivity=D, \n", |
| 109 | + " density=air_density,\n", |
| 110 | + ")\n", |
| 111 | + "F = formulae.ventilation.ventilation_coefficient(sqrt_re_times_cbrt_sc=Re**(1/2) * Sc**(1/3))\n", |
| 112 | + "\n", |
| 113 | + "r_dr_dt = formulae.drop_growth.r_dr_dt(\n", |
| 114 | + " RH_eq=1,\n", |
| 115 | + " T=temperature,\n", |
| 116 | + " RH=0,\n", |
| 117 | + " lv=0,\n", |
| 118 | + " pvs=pvs,\n", |
| 119 | + " D=D,\n", |
| 120 | + " K=any_non_zero_value,\n", |
| 121 | + " ventilation_factor=F\n", |
| 122 | + ")\n", |
| 123 | + "adjustment_time = formulae.isotope_relaxation_timescale.tau(radius = radii, r_dr_dt = r_dr_dt)\n", |
| 124 | + "\n", |
| 125 | + "\n", |
| 126 | + "pandas.options.display.float_format = '{:>,.2g}'.format\n", |
| 127 | + "data = pandas.DataFrame({\n", |
| 128 | + " 'radius [cm]': in_unit(radii, si.cm),\n", |
| 129 | + " 'adjustment time [s]': adjustment_time,\n", |
| 130 | + " 'terminal velocity [m/s]': v_term,\n", |
| 131 | + " 'distance [m]': v_term * adjustment_time,\n", |
| 132 | + "})\n", |
| 133 | + "\n", |
| 134 | + "data # pylint: disable=pointless-statement" |
| 135 | + ], |
| 136 | + "id": "314f42c310883cfa", |
| 137 | + "outputs": [ |
| 138 | + { |
| 139 | + "data": { |
| 140 | + "text/plain": [ |
| 141 | + " radius [cm] adjustment time [s] terminal velocity [m/s] distance [m]\n", |
| 142 | + "0 0.005 1.7 0.4 0.69\n", |
| 143 | + "1 0.01 5.4 0.8 4.3\n", |
| 144 | + "2 0.025 20 2 40\n", |
| 145 | + "3 0.05 48 4 1.9e+02\n", |
| 146 | + "4 0.075 81 5.5 4.4e+02\n", |
| 147 | + "5 0.1 1.2e+02 6.4 7.6e+02\n", |
| 148 | + "6 0.15 2e+02 7.8 1.6e+03\n", |
| 149 | + "7 0.2 3e+02 9 2.7e+03" |
| 150 | + ], |
| 151 | + "text/html": [ |
| 152 | + "<div>\n", |
| 153 | + "<style scoped>\n", |
| 154 | + " .dataframe tbody tr th:only-of-type {\n", |
| 155 | + " vertical-align: middle;\n", |
| 156 | + " }\n", |
| 157 | + "\n", |
| 158 | + " .dataframe tbody tr th {\n", |
| 159 | + " vertical-align: top;\n", |
| 160 | + " }\n", |
| 161 | + "\n", |
| 162 | + " .dataframe thead th {\n", |
| 163 | + " text-align: right;\n", |
| 164 | + " }\n", |
| 165 | + "</style>\n", |
| 166 | + "<table border=\"1\" class=\"dataframe\">\n", |
| 167 | + " <thead>\n", |
| 168 | + " <tr style=\"text-align: right;\">\n", |
| 169 | + " <th></th>\n", |
| 170 | + " <th>radius [cm]</th>\n", |
| 171 | + " <th>adjustment time [s]</th>\n", |
| 172 | + " <th>terminal velocity [m/s]</th>\n", |
| 173 | + " <th>distance [m]</th>\n", |
| 174 | + " </tr>\n", |
| 175 | + " </thead>\n", |
| 176 | + " <tbody>\n", |
| 177 | + " <tr>\n", |
| 178 | + " <th>0</th>\n", |
| 179 | + " <td>0.005</td>\n", |
| 180 | + " <td>1.7</td>\n", |
| 181 | + " <td>0.4</td>\n", |
| 182 | + " <td>0.69</td>\n", |
| 183 | + " </tr>\n", |
| 184 | + " <tr>\n", |
| 185 | + " <th>1</th>\n", |
| 186 | + " <td>0.01</td>\n", |
| 187 | + " <td>5.4</td>\n", |
| 188 | + " <td>0.8</td>\n", |
| 189 | + " <td>4.3</td>\n", |
| 190 | + " </tr>\n", |
| 191 | + " <tr>\n", |
| 192 | + " <th>2</th>\n", |
| 193 | + " <td>0.025</td>\n", |
| 194 | + " <td>20</td>\n", |
| 195 | + " <td>2</td>\n", |
| 196 | + " <td>40</td>\n", |
| 197 | + " </tr>\n", |
| 198 | + " <tr>\n", |
| 199 | + " <th>3</th>\n", |
| 200 | + " <td>0.05</td>\n", |
| 201 | + " <td>48</td>\n", |
| 202 | + " <td>4</td>\n", |
| 203 | + " <td>1.9e+02</td>\n", |
| 204 | + " </tr>\n", |
| 205 | + " <tr>\n", |
| 206 | + " <th>4</th>\n", |
| 207 | + " <td>0.075</td>\n", |
| 208 | + " <td>81</td>\n", |
| 209 | + " <td>5.5</td>\n", |
| 210 | + " <td>4.4e+02</td>\n", |
| 211 | + " </tr>\n", |
| 212 | + " <tr>\n", |
| 213 | + " <th>5</th>\n", |
| 214 | + " <td>0.1</td>\n", |
| 215 | + " <td>1.2e+02</td>\n", |
| 216 | + " <td>6.4</td>\n", |
| 217 | + " <td>7.6e+02</td>\n", |
| 218 | + " </tr>\n", |
| 219 | + " <tr>\n", |
| 220 | + " <th>6</th>\n", |
| 221 | + " <td>0.15</td>\n", |
| 222 | + " <td>2e+02</td>\n", |
| 223 | + " <td>7.8</td>\n", |
| 224 | + " <td>1.6e+03</td>\n", |
| 225 | + " </tr>\n", |
| 226 | + " <tr>\n", |
| 227 | + " <th>7</th>\n", |
| 228 | + " <td>0.2</td>\n", |
| 229 | + " <td>3e+02</td>\n", |
| 230 | + " <td>9</td>\n", |
| 231 | + " <td>2.7e+03</td>\n", |
| 232 | + " </tr>\n", |
| 233 | + " </tbody>\n", |
| 234 | + "</table>\n", |
| 235 | + "</div>" |
| 236 | + ] |
| 237 | + }, |
| 238 | + "execution_count": 4, |
| 239 | + "metadata": {}, |
| 240 | + "output_type": "execute_result" |
| 241 | + } |
| 242 | + ], |
| 243 | + "execution_count": 4 |
| 244 | + } |
| 245 | + ], |
| 246 | + "metadata": { |
| 247 | + "kernelspec": { |
| 248 | + "display_name": "Python 3 (ipykernel)", |
| 249 | + "language": "python", |
| 250 | + "name": "python3" |
| 251 | + }, |
| 252 | + "language_info": { |
| 253 | + "codemirror_mode": { |
| 254 | + "name": "ipython", |
| 255 | + "version": 3 |
| 256 | + }, |
| 257 | + "file_extension": ".py", |
| 258 | + "mimetype": "text/x-python", |
| 259 | + "name": "python", |
| 260 | + "nbconvert_exporter": "python", |
| 261 | + "pygments_lexer": "ipython3", |
| 262 | + "version": "3.9.6" |
| 263 | + } |
| 264 | + }, |
| 265 | + "nbformat": 4, |
| 266 | + "nbformat_minor": 5 |
| 267 | +} |
0 commit comments