Skip to content

Commit

Permalink
remove PyVista-example downloads
Browse files Browse the repository at this point in the history
to avoid errors on read-the-docs
  • Loading branch information
adtzlr committed Nov 13, 2024
1 parent e6135d0 commit 1b5716f
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 28 deletions.
35 changes: 21 additions & 14 deletions examples/ex11_notch-stress.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
.. topic:: Three-dimensional linear-elastic analysis.
* read a mesh file
* create a hexahedron mesh
* define a linear-elastic solid body
Expand All @@ -23,28 +23,35 @@
A linear-elastic notched plate is subjected to uniaxial tension. The cell-based mean of
the stress tensor is projected to the mesh-points and its maximum principal value is
plotted. FElupe has no wedge element formulation implemented and hence, the wedges in
the mesh are converted to hexahedrons.
plotted.
"""

# sphinx_gallery_thumbnail_number = -1
import numpy as np
import pypardiso
import pyvista as pv

import felupe as fem

m = pv.examples.download_notch_displacement()
meshes = []

hex8 = [0, 2, 1, 1, 3, 5, 4, 4]
mesh = fem.Mesh(
m.points * 250,
np.vstack([m.cells_dict[25][:, :8], m.cells_dict[26][:, hex8]]),
"hexahedron",
radius = fem.mesh.Point(a=-2.5).revolve(n=9, phi=90).translate(5, axis=1)
radius = fem.mesh.flip(radius)
middle = fem.mesh.Line(a=-7.5, b=0, n=9).expand(n=0)
meshes.append(middle.fill_between(radius, n=6))

left = fem.mesh.Line(-7.5, 5, n=11).expand(n=0).rotate(90, axis=2, center=[-7.5, 0])
right = (
fem.mesh.Line(a=-2.5, b=5, n=11)
.expand(n=0)
.rotate(90, axis=2, center=[-2.5, 0])
.translate(5, axis=1)
)
point_ids = np.zeros(mesh.npoints, dtype=int)
point_ids[mesh.points_with_cells] = np.arange(len(mesh.points_with_cells))
mesh.update(points=mesh.points[mesh.points_with_cells], cells=point_ids[mesh.cells])
meshes.append(right.fill_between(left, n=6))
meshes.append(fem.Rectangle(a=(-50, 0), b=(-7.5, 12.5), n=(36, 11)))

mesh = fem.MeshContainer(meshes, merge=True).stack()
mesh = fem.MeshContainer([mesh, mesh.mirror(axis=0)], merge=True, decimals=6).stack()
mesh = fem.MeshContainer([mesh, mesh.mirror(axis=1)], merge=True, decimals=6).stack()
mesh = mesh.expand(n=3, z=2.5)

region = fem.RegionHexahedron(mesh)
field = fem.FieldContainer([fem.Field(region, dim=3)])
Expand Down
17 changes: 3 additions & 14 deletions examples/ex12_foot-bone.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,15 @@
r"""
Voxelized Foot Bone
-------------------
Voxelized Foot Bones
--------------------
A :class:`~felupe.Region` on a voxel-based mesh with uniform hexahedrons should be
created with ``uniform=True`` to enhance performance.
"""

import numpy as np
import pyvista as pv
from pyvista import examples

import felupe as fem

surface = examples.download_foot_bones()
voxels = pv.voxelize(surface, density=0.6)

mesh = fem.Mesh(
points=voxels.points,
cells=voxels.cell_connectivity.reshape(-1, 8),
cell_type="hexahedron",
).rotate(90, axis=0)
mesh.points *= 25
mesh.update(points=np.vstack([mesh.points, [0, 0, mesh.z.min() - 2]]))
mesh = fem.mesh.read("ex12_foot-bones_mesh-voxels.vtu")[0]

region = fem.RegionHexahedron(mesh, uniform=True)
field = fem.FieldContainer([fem.Field(region, dim=3)])
Expand Down
24 changes: 24 additions & 0 deletions examples/ex12_foot-bones_mesh-voxels.vtu
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0"?>
<VTKFile type="UnstructuredGrid" version="0.1" byte_order="LittleEndian" compressor="vtkZLibDataCompressor">
<!--This file was created by meshio v5.3.5-->
<UnstructuredGrid>
<Piece NumberOfPoints="485" NumberOfCells="253">
<Points>
<DataArray type="Float64" Name="Points" NumberOfComponents="3" format="binary">
AQAAAACAAAB4LQAAhgYAAA==eJyF2r2rXFUUxuGTm4gxqFhEDNgEK1EkWzEkoOCNQdTYqPiFSkRJITaprp0IFhapbCT40fhH2ImZUgRDCssBLQIOOmBEouLHjHvOzJv7rt9eO0l3H+FknXfts9e6xCvL5Wdf3PnM9jAMnx/66NT2nmF49+0TT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cPN/pB6rZOuOlOvddJVJ13fC13fS+r1fqPrfqPrfqMzB+4PqVsO3B9Stxy4P9DVL7rOG13nja7zRtd3R9d3R9d3R2e/uD+kbv3i/kBnv7g/RC+dfpVOv0qnX6XTr9LpV+n0q3T6VTr9Kp1+lU6/SqdfpdOv0ulX6fSrdPpVOv0qnX7t7g//bvwy9ofUa7/o6lfqtV909YuuftHVL7r6RVe/6OoXXf2iq1909YuuftGV838bvwn7Q+o1Z7pyTr3mTFfOdOVMV8505UxXznTlTFfON3pf7gmp2/tyT6Dzfbkn0Pm+3BPo9nvr6NwTUl//3hrcfm8Nbr+3Bte5uq3W9cj7d0+4J6Re66SrztRrnXTVSVeedOVJV550nR+6zg9d3yld3yld32nq9V6lK+dbN849JPWaM105p15zpitnus4DXfnTlT9d+dOVP13505U/XfnTlX/qNX96nn/p5F86+ZdO/qWTf+nkXzr5l07+pZN/6eRfOvmXTv6lk3/p5F86+ZdO/rt7woGN/4g9IfWaP135p17zpyt/uvKnK3+68qcrf7rypyt/uvKnK3+68qcr5/0b556Qes2ZrpxTrznTlTNdOdOVM10505UzXTnf6L24D6Ru78V9gM734vNv3jjnNV3Pp+v5dOW2r+Z08YejzXykKze6cqPrfNJ1Puk6n3SdT7r6IudcS73mRldudOVGZ26ca3TmxrlGZ26ca3TmxrlGV257g+/Oo9RrbnTlRldudOVGV2505UZXbnTlRldudOVGV2505jbFHEndcptijtCZ2xRzhM7cppgjdOY2xRyhM7cp5sh16jzz09nHm/uEbnUGtzqDW53Brc7gVmdw629w1b+1cX7XdNVPV/101U9X/XTVT1f9dNa/wPdFZ/0LfF901r/A90Vn/Qt8X72/d9/Kfx3/PWEHcyS43YfB7T4Mzucv2vs2OJ+/QF/o+fNL5/ml8/zSef6494Y/6/8v+qnJ/6MSUxk=
</DataArray>
</Points>
<Cells>
<DataArray type="Int64" Name="connectivity" format="binary">
AQAAAACAAABAPwAAoAkAAA==eJyNmVXUllUXRXnADrA7sKVVwu5OwARFxe7uxlbA7ka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PVP28b+Wp7mea/t3fyfN/ii/JuQ==
</DataArray>
<DataArray type="Int64" Name="offsets" format="binary">
AQAAAACAAADoBwAAWwEAAA==eJwtxRsAqwAAAMDePwzDMAzDMAzDcBiGYRiGYRiGYRiGYTgcPtidXBh8RY6dOHXm3IVLV67d+OXWnXsPHj159uLVm3cfPn359uO3Pw5+fAsdOXbi1JlzFy5duXbjl1t37j149OTZi1dv3n349OXbj9/+OPj5LXTk2IlTZ85duHTl2o1fbt259+DRk2cvXr159+HTl28/fvvj4Ne30JFjJ06dOXfh0pVrN365defeg0dPnr149ebdh09fvv347Y+D399CR46dOHXm3IVLV67d+OXWnXsPHj159uLVm3cfPn359uO3Pw7+fAsdOXbi1JlzFy5duXbjl1t37j149OTZi1dv3n349OXbj9/+OPj7LXTk2IlTZ85duHTl2o1fbt259+DRk2cvXr159+HTl28/fvvj4N+30JFjJ06dOXfh0pVrN365defeg0dPnr149ebdh09fvv34P55hfYs=
</DataArray>
<DataArray type="Int64" Name="types" format="binary">
AQAAAACAAADoBwAAGwAAAA==eJzjYYAAnlF6lB6lR+lRepQepYcdDQAbyQvd
</DataArray>
</Cells>
</Piece>
</UnstructuredGrid>
</VTKFile>

0 comments on commit 1b5716f

Please sign in to comment.