diff --git a/examples/PyMPDATA_examples/Jaruga_et_al_2015/fig19.ipynb b/examples/PyMPDATA_examples/Jaruga_et_al_2015/fig19.ipynb
index 53cf5365..dd92e1de 100644
--- a/examples/PyMPDATA_examples/Jaruga_et_al_2015/fig19.ipynb
+++ b/examples/PyMPDATA_examples/Jaruga_et_al_2015/fig19.ipynb
@@ -8,15 +8,17 @@
"## 2D Boussinesq (buoyancy-driven) flow example\n",
"\n",
"### equations solved:\n",
- "\n",
+ "conservation of momentum (inviscid and incompressible form of Navier-Stokes equation)\n",
"$$\n",
- "\\partial_t \\theta + \n",
+ "\\partial_t v+\\mathrm{\\nabla}\\cdot\\left(v\\otimes v\\right)=-\\mathrm{\\nabla\\pi}-g\\frac{\\theta^\\prime}{\\theta_0}\n",
"$$\n",
+ "conservation of energy\n",
"$$\n",
- "\\partial_t \\theta + \n",
+ "\\partial_t \\theta+ \\mathrm{\\nabla}-\\left(v\\theta\\right)=0\n",
"$$\n",
+ "continuity equation(conservation of mass)\n",
"$$\n",
- "\\partial_t \\theta + \n",
+ "\\mathrm{\\nabla}\\cdot\\ v=0\n",
"$$"
]
},
@@ -133,7 +135,7 @@
"\n",
"#@njit\n",
"def pressure_solver_loop_init(err,p_err,lap_p_err,dxy,lap_tmp,tmp_uvw):\n",
- " p_err[0].get()[:] = err.get()[:]\n",
+ " p_err[0].get()[:] = err.get()\n",
" lap_p_err[0][:] = lap(p_err[0], dxy, False, lap_tmp,tmp_uvw)\n",
"\n",
"#@njit\n",
@@ -166,7 +168,7 @@
" alpha[l] = - np.dot(lap_err.ravel(), lap_p_err[l].ravel()) / tmp_den[l]\n",
" if v < k_iters - 1:\n",
" p_err[v + 1].get()[:] = err.get()\n",
- " lap_p_err[v + 1][:] = lap_err[:]\n",
+ " lap_p_err[v + 1][:] = lap_err\n",
" for l in range(v):\n",
" p_err[v + 1].get()[:] += alpha[l] * p_err[l].get()\n",
" lap_p_err[v + 1][:] += alpha[l] * lap_p_err[l]\n",
@@ -231,12 +233,12 @@
"\n",
"outfreq = 1\n",
"\n",
- "N, M = 20, 20\n",
+ "N, M = 200, 200\n",
"dxy = 2000/(N), 2000/(M)\n",
"Tht_ref = 300.\n",
"g = 9.81\n",
"r0 = 250.\n",
- "dt = 7.5\n",
+ "dt = 0.75\n",
"nt = int(600//dt)\n",
"beta = 0.25\n",
"prs_tol = 1e-7\n",
@@ -368,7 +370,8 @@
"id": "229c52f6-8072-45fb-a0dd-335c7045583c",
"metadata": {},
"source": [
- "## Simulation loop"
+ "## Simulation loop\n",
+ "Progress bar stays at 0 until all functions compile"
]
},
{
@@ -380,12 +383,12 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
- "model_id": "a3a66e7d490249288d4b38f9cc3efa5c",
+ "model_id": "b5f7c922743c46b3999ff46815c44f84",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
- "FloatProgress(value=0.0, max=80.0)"
+ "FloatProgress(value=0.0, max=800.0)"
]
},
"metadata": {},
@@ -395,8 +398,8 @@
"name": "stdout",
"output_type": "stream",
"text": [
- "CPU times: total: 1min 31s\n",
- "Wall time: 1min 41s\n"
+ "CPU times: total: 38min 23s\n",
+ "Wall time: 9h 24min 18s\n"
]
}
],
@@ -406,7 +409,7 @@
"progress = ipywidgets.FloatProgress(max=nt)\n",
"display(progress)\n",
"\n",
- "output = []\n",
+ "output = np.empty((nt//outfreq+1,N,M))\n",
"with warnings.catch_warnings():\n",
" warnings.simplefilter(action=\"ignore\",category= NumbaExperimentalFeatureWarning)\n",
"\n",
@@ -453,7 +456,7 @@
" data(vip_rhs[k])[:] /= 0.5 * dt\n",
" \n",
" if step % outfreq == 0:\n",
- " output.append(solvers[_T].advectee.get().copy())\n",
+ " output[step] = solvers[_T].advectee.get().copy()\n",
" progress.value = step\n",
"with open(\"output.npy\", 'wb') as f:\n",
" np.save(f, np.array(output))"
@@ -469,19 +472,19 @@
},
{
"cell_type": "code",
- "execution_count": 9,
+ "execution_count": 16,
"id": "1ab53227-a29b-4df8-86d7-77c4fd1e5584",
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
- "model_id": "baa8f55f01f5441bb96110e9b0d523b6",
+ "model_id": "5d3ace495deb46188301ee278ac8d5b4",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
- "FloatProgress(value=0.0, max=81.0)"
+ "FloatProgress(value=0.0, max=80.1)"
]
},
"metadata": {},
@@ -490,7 +493,7 @@
{
"data": {
"text/html": [
- ""
+ ""
],
"text/plain": [
""
@@ -502,12 +505,12 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
- "model_id": "e1864a55f28a46f5850e0e2b10732fb9",
+ "model_id": "666a3e0358d048f89528e4c86fa367df",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
- "HTML(value=\".\\\\tmp531j16v4.gif
\")"
+ "HTML(value=\".\\\\tmpps5dtbt0.gif
\")"
]
},
"metadata": {},
@@ -515,7 +518,8 @@
}
],
"source": [
- "progress = ipywidgets.FloatProgress(max=len(output))\n",
+ "freq: int = 10\n",
+ "progress = ipywidgets.FloatProgress(max=len(output)/freq)\n",
"\n",
"def plot(step):\n",
" data = output[step]\n",
@@ -524,33 +528,25 @@
" colorticks = np.linspace(299.95, 300.55, 7, endpoint=True)\n",
" cmap = colors.ListedColormap([\"white\", \"purple\", \"blue\", \"green\",\"orange\",\"yellow\"])\n",
"\n",
- " fig = pyplot.figure(figsize=(4,4))\n",
+ " fig = pyplot.figure(figsize=(5,6))\n",
" pyplot.title(\"t/dt=\"+str(step))\n",
" pyplot.xlabel(\"x/dx\")\n",
" pyplot.ylabel(\"y/dy\")\n",
" pyplot.contour(x+1/2, y+1/2, data, levels=colorticks[1:], colors='k')\n",
" pyplot.imshow(data.T, origin=\"lower\", extent=(0, grid[0], 0, grid[1]),\n",
" cmap=cmap, vmin=colorticks[0], vmax=colorticks[-1])\n",
- " pyplot.colorbar(ticks=colorticks)\n",
+ " pyplot.colorbar(ticks=colorticks,label = \"Temperature[K]\")\n",
"\n",
" progress.value += 1\n",
" return fig\n",
- "\n",
+ " \n",
"display(progress)\n",
- "show_anim(plot, frame_range=range(len(output)))"
- ]
- },
- {
- "cell_type": "markdown",
- "id": "58f716ed-b17f-49de-9bdf-c655942e63bd",
- "metadata": {},
- "source": [
- "add showplot\n"
+ "show_anim(plot, frame_range=range(len(output))[::freq])"
]
},
{
"cell_type": "code",
- "execution_count": 15,
+ "execution_count": 13,
"id": "e19fba6c-c5b1-43ba-8f99-a23222e0afd1",
"metadata": {},
"outputs": [
@@ -560,12 +556,12 @@
"\n",
"\n",
- "