Skip to content

Commit

Permalink
[demos] Update FVM_Cylinder_GMsh.ipynb
Browse files Browse the repository at this point in the history
  • Loading branch information
holl- committed Dec 15, 2024
1 parent 0e1d291 commit 7cb4422
Showing 1 changed file with 26 additions and 3 deletions.
29 changes: 26 additions & 3 deletions examples/mesh/FVM_Cylinder_GMsh.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
{
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit 7cb4422

Please sign in to comment.