Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into miner-original
Browse files Browse the repository at this point in the history
Signed-off-by: Johannes Mueller <[email protected]>
  • Loading branch information
johannes-mueller committed Sep 29, 2023
2 parents 7498c32 + a9fe148 commit 1b6f677
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 45 deletions.
4 changes: 2 additions & 2 deletions binder/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ dependencies:
- pip
- pip:
- pylife[all]
- pyvista
- panel
- pyvista[all,jupyter]
- trame<3
- plotly
- xvfbwrapper
- ipyvtklink
11 changes: 4 additions & 7 deletions demos/hotspot_beam.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,7 @@
"import pylife.mesh.hotspot\n",
"import pylife.vmap\n",
"\n",
"import pyvista as pv\n",
"\n",
"pv.set_plot_theme('document')\n",
"pv.set_jupyter_backend('panel')"
"import pyvista as pv"
]
},
{
Expand Down Expand Up @@ -102,7 +99,7 @@
"outputs": [],
"source": [
"grid = pv.UnstructuredGrid(*mesh.mesh.vtk_data())\n",
"plotter = pv.Plotter(window_size=[1920, 1080])\n",
"plotter = pv.Plotter()\n",
"plotter.add_mesh(grid, scalars=mesh.groupby('element_id')['hotspot'].first().to_numpy(), show_edges=True)\n",
"plotter.add_scalar_bar()\n",
"plotter.show()"
Expand Down Expand Up @@ -169,9 +166,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.9"
"version": "3.11.0"
}
},
"nbformat": 4,
"nbformat_minor": 2
"nbformat_minor": 4
}
18 changes: 9 additions & 9 deletions demos/lifetime_calc.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,7 @@
"# mpl.style.use('seaborn')\n",
"# mpl.style.use('seaborn-notebook')\n",
"mpl.style.use('bmh')\n",
"%matplotlib inline\n",
"\n",
"pv.set_plot_theme('document')\n",
"pv.set_jupyter_backend('panel')"
"%matplotlib inline"
]
},
{
Expand Down Expand Up @@ -255,7 +252,10 @@
{
"cell_type": "markdown",
"metadata": {
"collapsed": true
"collapsed": true,
"jupyter": {
"outputs_hidden": true
}
},
"source": [
"#### Plot the damage vs collectives"
Expand Down Expand Up @@ -433,9 +433,8 @@
"outputs": [],
"source": [
"grid = pv.UnstructuredGrid(*pyLife_mesh.mesh.vtk_data())\n",
"plotter = pv.Plotter(window_size=[1920, 1400])\n",
"plotter.add_mesh(grid, scalars=damage.to_numpy(), log_scale=True,\n",
" show_edges=True, cmap='jet')\n",
"plotter = pv.Plotter()\n",
"plotter.add_mesh(grid, scalars=damage.to_numpy(), log_scale=True, show_edges=True, cmap='jet')\n",
"plotter.add_scalar_bar()\n",
"plotter.show()"
]
Expand Down Expand Up @@ -516,7 +515,8 @@
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3"
"pygments_lexer": "ipython3",
"version": "3.11.0"
}
},
"nbformat": 4,
Expand Down
6 changes: 1 addition & 5 deletions demos/local_stress_with_FE.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,7 @@
"import pylife.stress\n",
"import pylife.strength.fatigue\n",
"import pylife.utils.histogram as psh\n",
"import pyvista as pv\n",
"\n",
"# from ansys.dpf import post\n",
"pv.set_plot_theme('document')\n",
"pv.set_jupyter_backend('panel')"
"import pyvista as pv\n"
]
},
{
Expand Down
34 changes: 16 additions & 18 deletions demos/stress_gradient.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@
"import pylife.mesh.gradient\n",
"import pylife.vmap\n",
"\n",
"import pyvista as pv\n",
"\n",
"pv.set_plot_theme('document')\n",
"pv.set_jupyter_backend('panel')"
"import pyvista as pv"
]
},
{
Expand All @@ -44,7 +41,7 @@
"outputs": [],
"source": [
"vm_mesh = pylife.vmap.VMAPImport(\"plate_with_hole.vmap\")\n",
"pyLife_mesh = (vm_mesh.make_mesh('1', 'STATE-2')\n",
"mesh = (vm_mesh.make_mesh('1', 'STATE-2')\n",
" .join_coordinates()\n",
" .join_variable('STRESS_CAUCHY')\n",
" .to_frame())"
Expand All @@ -63,7 +60,7 @@
"metadata": {},
"outputs": [],
"source": [
"pyLife_mesh['mises'] = pyLife_mesh.equistress.mises()"
"mesh['mises'] = mesh.equistress.mises()"
]
},
{
Expand All @@ -79,7 +76,10 @@
"metadata": {},
"outputs": [],
"source": [
"grad = pyLife_mesh.gradient.gradient_of('mises')"
"grad = mesh.gradient.gradient_of('mises')\n",
"grad[\"abs_grad\"] = np.linalg.norm(grad, axis = 1)\n",
"mesh = mesh.join(grad)\n",
"display(mesh)\n"
]
},
{
Expand All @@ -88,9 +88,11 @@
"metadata": {},
"outputs": [],
"source": [
"grad[\"abs_grad\"] = np.linalg.norm(grad, axis = 1)\n",
"pyLife_mesh = pyLife_mesh.join(grad)\n",
"display(pyLife_mesh)\n"
"grid = pv.UnstructuredGrid(*mesh.mesh.vtk_data())\n",
"plotter = pv.Plotter()\n",
"plotter.add_mesh(grid, scalars=mesh.groupby('element_id')[\"abs_grad\"].mean().to_numpy(), show_edges=True, cmap='jet')\n",
"plotter.add_scalar_bar()\n",
"plotter.show()"
]
},
{
Expand All @@ -99,12 +101,7 @@
"metadata": {},
"outputs": [],
"source": [
"grid = pv.UnstructuredGrid(*pyLife_mesh.mesh.vtk_data())\n",
"plotter = pv.Plotter(window_size=[1920, 1080])\n",
"plotter.add_mesh(grid, scalars=pyLife_mesh.groupby('element_id')[\"abs_grad\"].mean().to_numpy(),\n",
" show_edges=True, cmap='jet')\n",
"plotter.add_scalar_bar()\n",
"plotter.show()"
"\"That's it\""
]
}
],
Expand All @@ -123,10 +120,11 @@
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3"
"pygments_lexer": "ipython3",
"version": "3.11.0"
},
"name": "stress_gradient.ipynb"
},
"nbformat": 4,
"nbformat_minor": 2
"nbformat_minor": 4
}
3 changes: 2 additions & 1 deletion demos/stress_strength.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,8 @@
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3"
"pygments_lexer": "ipython3",
"version": "3.11.0"
}
},
"nbformat": 4,
Expand Down
6 changes: 3 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ testing =
pytest-cov
hypothesis
pyvista
panel
xvfbwrapper
testbook
ipykernel
Expand All @@ -84,8 +83,9 @@ docs =
plotly
jupyter_sphinx
myst_parser
panel
pyvista
pyvista[all,jupyter]
trame<3
ipywidgets
xvfbwrapper


Expand Down

0 comments on commit 1b6f677

Please sign in to comment.