{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "127e14e8",
"metadata": {},
"outputs": [],
"source": [
"from PySDM import Builder\n",
"from PySDM.backends import CPU\n",
"from PySDM.physics import si\n",
"from PySDM.environments import Box\n",
"import numpy as np\n",
"from matplotlib import pyplot\n",
"from open_atmos_jupyter_utils import show_plot"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "e98bc23f",
"metadata": {},
"outputs": [],
"source": [
"volumes = np.linspace(.01 * si.um**3, 1 * si.um**3, num=100)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "ad975357",
"metadata": {},
"outputs": [],
"source": [
"builder = Builder(n_sd=100, backend=CPU())\n",
"builder.set_environment(Box(dt=np.nan, dv=np.nan))\n",
"builder.request_attribute('terminal velocity')\n",
"particulator = builder.build(attributes={'n': np.ones_like(volumes), 'volume': volumes})"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "c8a54ad2",
"metadata": {},
"outputs": [],
"source": [
"v_term = particulator.attributes['terminal velocity'].to_ndarray()"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "ed9ca429",
"metadata": {},
"outputs": [
{
"data": {
"image/svg+xml": [
"\n",
"\n",
"\n"
],
"text/plain": [
""
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "d184a6cdf7154a21b395cce92f3857e5",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"HTML(value=\"./terminal_velocities.pdf
\")"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"pyplot.plot(volumes / si.um**3, v_term / (si.mm / si.s))\n",
"pyplot.xlabel(r'volume [$\\mu m^3$]')\n",
"pyplot.ylabel(r'terminal velocity [$mm/s$]')\n",
"pyplot.grid()\n",
"show_plot('terminal_velocities.pdf')"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "05b69b48",
"metadata": {},
"outputs": [],
"source": []
}
],
"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.5"
}
},
"nbformat": 4,
"nbformat_minor": 5
}