From 7cb44220ef17b6af55257ec05d27474e15adb5c1 Mon Sep 17 00:00:00 2001 From: Philipp Holl Date: Sun, 15 Dec 2024 14:06:00 +0100 Subject: [PATCH] [demos] Update FVM_Cylinder_GMsh.ipynb --- examples/mesh/FVM_Cylinder_GMsh.ipynb | 29 ++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/examples/mesh/FVM_Cylinder_GMsh.ipynb b/examples/mesh/FVM_Cylinder_GMsh.ipynb index 943b477ff..b604aa12d 100644 --- a/examples/mesh/FVM_Cylinder_GMsh.ipynb +++ b/examples/mesh/FVM_Cylinder_GMsh.ipynb @@ -13,19 +13,26 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ - "# %pip install --quiet phiflow\n", + "# %pip install --quiet phiflow meshio\n", "from phi.torch.flow import *\n", "# from phi.flow import * # If JAX is not installed. You can use phi.torch or phi.tf as well.\n", "from tqdm.notebook import trange" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Let's download the example mesh file and visualize it!" + ] + }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "metadata": {}, "outputs": [ { @@ -59,10 +66,19 @@ } ], "source": [ + "!wget https://raw.githubusercontent.com/tum-pbs/PhiFlow/master/examples/mesh/cylinder.msh -O cylinder.msh\n", + "\n", "mesh = geom.load_gmsh('cylinder.msh', ('y-', 'x+', 'y+', 'x-', 'cyl+', 'cyl-'))\n", "plot(Box(x=6, y=6), mesh, overlay='args', size=(4, 3), title='cylinder.msh')" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Next we can define the fluid dynamics. The momentum equation uses diffusion and advection while incompressibility is maintained by solving a separate linear system via `make_incompressible`." + ] + }, { "cell_type": "code", "execution_count": 3, @@ -82,6 +98,13 @@ " return v" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Now let's set the boundary and initial conditions and run the simulation!" + ] + }, { "cell_type": "code", "execution_count": 11,