Example #1
0
#!/usr/bin/env python
# coding: utf-8

# In[1]:

import numpy as np
import pyvista as pv
from ipywidgets import FloatSlider, FloatRangeSlider, Dropdown, Select, Box, AppLayout, jslink, Layout, VBox, HBox
from ipygany import Scene, IsoColor, TetraMesh, Component, ColorBar, colormaps

mesh = TetraMesh.from_vtk(
    'benchmarks/004-eliptic-membrane/eliptic-membrane.vtu', show_edges=True)

sigmayy_min = -3.4e7
sigmayy_max = 9.3e7

# Colorize by height
colored_mesh = IsoColor(mesh,
                        input=('S', 'YY'),
                        min=sigmayy_min,
                        max=sigmayy_max)

# Create a slider that will dynamically change the boundaries of the colormap
colormap_slider_range = FloatRangeSlider(value=[sigmayy_min, sigmayy_max],
                                         min=sigmayy_min,
                                         max=sigmayy_max,
                                         step=(sigmayy_max - sigmayy_min) /
                                         100.)

jslink((colored_mesh, 'range'), (colormap_slider_range, 'value'))
Example #2
0
#!/usr/bin/env python
# coding: utf-8

# In[1]:

import numpy as np
import pyvista as pv
from ipywidgets import FloatSlider, FloatRangeSlider, Dropdown, Select, Box, AppLayout, jslink, Layout, VBox, HBox
from ipygany import Scene, IsoColor, TetraMesh, Component, ColorBar, colormaps

mesh = TetraMesh.from_vtk(
    'benchmarks/005-hemispherical-shell-point-load/hemisperical-shell-points-load.vtu',
    show_edges=True)

u_min = 4.4e-6
u_max = 1.8e-1

# Colorize by height
colored_mesh = IsoColor(mesh, input=('u', 'X1'), min=u_min, max=u_max)

# Create a slider that will dynamically change the boundaries of the colormap
colormap_slider_range = FloatRangeSlider(value=[u_min, u_max],
                                         min=u_min,
                                         max=u_max,
                                         step=(u_max - u_min) / 100.)

jslink((colored_mesh, 'range'), (colormap_slider_range, 'value'))

# Create a colorbar widget
colorbar = ColorBar(colored_mesh)
Example #3
0
#!/usr/bin/env python
# coding: utf-8

# In[1]:

from ipygany import Scene, TetraMesh
mesh = TetraMesh.from_vtk('benchmarks/000-tuning-fork/fork.vtk')
scene = Scene([mesh])
scene
Example #4
0
#!/usr/bin/env python
# coding: utf-8

# In[1]:

import numpy as np
import pyvista as pv
from ipywidgets import FloatSlider, FloatRangeSlider, Dropdown, Select, Box, AppLayout, jslink, Layout, VBox, HBox
from ipygany import Scene, IsoColor, TetraMesh, Component, ColorBar, colormaps

mesh = TetraMesh.from_vtk('benchmarks/002-cook-membrane/elmer.vtu',
                          show_edges=True)

dispy_min = 0.0
dispy_max = 32.5

# Colorize by height
colored_mesh = IsoColor(mesh, input=('U', 'D2'), min=dispy_min, max=dispy_max)

# Create a slider that will dynamically change the boundaries of the colormap
colormap_slider_range = FloatRangeSlider(value=[dispy_min, dispy_max],
                                         min=dispy_min,
                                         max=dispy_max,
                                         step=(dispy_max - dispy_min) / 100.)

jslink((colored_mesh, 'range'), (colormap_slider_range, 'value'))

# Create a colorbar widget
colorbar = ColorBar(colored_mesh)

# Colormap choice widget
Example #5
0
#!/usr/bin/env python
# coding: utf-8

# In[1]:


from ipygany import Scene, TetraMesh, IsoColor

mesh = TetraMesh.from_vtk('benchmarks/001-LE10-THICK-PLATE/elipse.vtu')



scene = Scene([mesh])
scene

Example #6
0
#!/usr/bin/env python
# coding: utf-8

# In[1]:

import numpy as np
import pyvista as pv
from ipywidgets import FloatSlider, FloatRangeSlider, Dropdown, Select, Box, AppLayout, jslink, Layout, VBox, HBox
from ipygany import Scene, IsoColor, TetraMesh, Component, ColorBar, colormaps

mesh = TetraMesh.from_vtk(
    'benchmarks/003-Hertz-contact/very-fine-quad-hex.vtu', show_edges=True)

stress_min = 0.0
stress_max = 934

# Colorize by height
colored_mesh = IsoColor(mesh,
                        input=('S', 'Mises'),
                        min=stress_min,
                        max=stress_max)

# Create a slider that will dynamically change the boundaries of the colormap
colormap_slider_range = FloatRangeSlider(value=[stress_min, stress_max],
                                         min=stress_min,
                                         max=stress_max,
                                         step=(stress_max - stress_min) / 100.)

jslink((colored_mesh, 'range'), (colormap_slider_range, 'value'))

# Create a colorbar widget
Example #7
0
#!/usr/bin/env python
# coding: utf-8

# In[1]:

import numpy as np
import pyvista as pv
from ipywidgets import FloatSlider, FloatRangeSlider, Dropdown, Select, Box, AppLayout, jslink, Layout, VBox, HBox
from ipygany import Scene, IsoColor, TetraMesh, Component, ColorBar, colormaps

mesh = TetraMesh.from_vtk('benchmarks/007-raasch-challenge/elmer.vtu',
                          show_edges=True)

dispy_min = 0.0
dispy_max = 0.125

# Colorize by height
colored_mesh = IsoColor(mesh, input=('u', 'X3'), min=dispy_min, max=dispy_max)

# Create a slider that will dynamically change the boundaries of the colormap
colormap_slider_range = FloatRangeSlider(value=[dispy_min, dispy_max],
                                         min=dispy_min,
                                         max=dispy_max,
                                         step=(dispy_max - dispy_min) / 100.)

jslink((colored_mesh, 'range'), (colormap_slider_range, 'value'))

# Create a colorbar widget
colorbar = ColorBar(colored_mesh)

# Colormap choice widget
Example #8
0
#!/usr/bin/env python
# coding: utf-8

# In[1]:

import numpy as np
import pyvista as pv
from ipywidgets import FloatSlider, FloatRangeSlider, Dropdown, Select, Box, AppLayout, jslink, Layout, VBox, HBox
from ipygany import Scene, IsoColor, TetraMesh, Component, ColorBar, colormaps

mesh = TetraMesh.from_vtk('benchmarks/001-thick-plate/elipse.vtu',
                          show_edges=True)

sigmayy_min = -1.5e7
sigmayy_max = 1.5e7

# Colorize by height
colored_mesh = IsoColor(mesh,
                        input=('S', 'YY'),
                        min=sigmayy_min,
                        max=sigmayy_max)

# Create a slider that will dynamically change the boundaries of the colormap
colormap_slider_range = FloatRangeSlider(value=[sigmayy_min, sigmayy_max],
                                         min=sigmayy_min,
                                         max=sigmayy_max,
                                         step=(sigmayy_max - sigmayy_min) /
                                         100.)

jslink((colored_mesh, 'range'), (colormap_slider_range, 'value'))