+
Skip to content

Make the examples run faster on CI/CD #890

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion docs/felupe/constitution/autodiff.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,13 @@ It is straightforward to switch between these backends.
"Strain energy function of the Neo-Hookean material formulation."
return mu / 2 * (jnp.linalg.det(C) ** (-1/3) * jnp.trace(C) - 3)

umat = mat.Hyperelastic(neo_hooke, mu=1.0)
umat = mat.Hyperelastic(neo_hooke, mu=1.0)


.. note::

The default backend is available in the top-level package namespace, this includes
all models from :mod:`felupe.constitution.tensortrax.models.hyperelastic` and
:mod:`felupe.constitution.tensortrax.models.lagrange` as well as the material
classes :class:`felupe.constitution.tensortrax.Material` and
:class:`felupe.constitution.tensortrax.Hyperelastic`.
28 changes: 17 additions & 11 deletions docs/felupe/constitution/autodiff/jax.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,41 +7,47 @@ This page contains material model formulations with automatic differentiation us

**Frameworks**

.. currentmodule:: felupe
.. currentmodule:: felupe.constitution.jax

.. autosummary::

constitution.jax.Hyperelastic
constitution.jax.Material
constitution.jax.total_lagrange
constitution.jax.updated_lagrange
Hyperelastic
Material
total_lagrange
updated_lagrange

**Material Models for** :class:`felupe.constitution.jax.Hyperelastic`

These material model formulations are defined by a strain energy density function.

.. currentmodule:: felupe.constitution.jax.models.hyperelastic

.. autosummary::

felupe.constitution.jax.models.hyperelastic.mooney_rivlin
felupe.constitution.jax.models.hyperelastic.third_order_deformation
felupe.constitution.jax.models.hyperelastic.yeoh
mooney_rivlin
third_order_deformation
yeoh

**Material Models for** :class:`felupe.constitution.jax.Material`

The material model formulations are defined by the first Piola-Kirchhoff stress tensor.
Function-decorators are available to use Total-Lagrange and Updated-Lagrange material
formulations in :class:`~felupe.constitution.jax.Material`.

.. currentmodule:: felupe.constitution.jax.models.lagrange

.. autosummary::

felupe.constitution.jax.models.lagrange.morph
felupe.constitution.jax.models.lagrange.morph_representative_directions
morph
morph_representative_directions

**Tools**

.. currentmodule:: felupe.constitution.jax

.. autosummary::

constitution.jax.vmap
vmap

**Detailed API Reference**

Expand Down
53 changes: 29 additions & 24 deletions docs/felupe/constitution/autodiff/tensortrax.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,21 @@ This page contains hyperelastic material model formulations with automatic diffe

**Frameworks**

.. currentmodule:: felupe
.. currentmodule:: felupe.constitution.tensortrax

.. autosummary::

constitution.tensortrax.Hyperelastic
constitution.tensortrax.Material
constitution.tensortrax.total_lagrange
constitution.tensortrax.updated_lagrange
Hyperelastic
Material
total_lagrange
updated_lagrange

**Material Models for** :class:`felupe.constitution.tensortrax.Hyperelastic`

These material model formulations are defined by a strain energy density function.

.. currentmodule:: felupe.constitution.tensortrax.models.hyperelastic

.. autosummary::

alexander
Expand All @@ -46,8 +48,11 @@ These material model formulations are defined by a strain energy density functio
**Material Models for** :class:`felupe.constitution.tensortrax.Material`

The material model formulations are defined by the first Piola-Kirchhoff stress tensor.
Function-decorators are available to use Total-Lagrange and Updated-Lagrange material
formulations in :class:`~felupe.constitution.tensortrax.Material`.
Function-decorators are available to use :func:`~felupe.constitution.tensortrax.total_lagrange`
and :func:`~felupe.constitution.tensortrax.updated_lagrange` material formulations in
:class:`~felupe.constitution.tensortrax.Material`.

.. currentmodule:: felupe.constitution.tensortrax.models.lagrange

.. autosummary::

Expand Down Expand Up @@ -84,36 +89,36 @@ formulations in :class:`~felupe.constitution.tensortrax.Material`.

.. autofunction:: felupe.updated_lagrange

.. autofunction:: felupe.alexander
.. autofunction:: felupe.constitution.tensortrax.models.hyperelastic.alexander

.. autofunction:: felupe.anssari_benam_bucchi
.. autofunction:: felupe.constitution.tensortrax.models.hyperelastic.anssari_benam_bucchi

.. autofunction:: felupe.arruda_boyce
.. autofunction:: felupe.constitution.tensortrax.models.hyperelastic.arruda_boyce

.. autofunction:: felupe.extended_tube
.. autofunction:: felupe.constitution.tensortrax.models.hyperelastic.extended_tube

.. autofunction:: felupe.finite_strain_viscoelastic
.. autofunction:: felupe.constitution.tensortrax.models.hyperelastic.finite_strain_viscoelastic

.. autofunction:: felupe.lopez_pamies
.. autofunction:: felupe.constitution.tensortrax.models.hyperelastic.lopez_pamies

.. autofunction:: felupe.miehe_goektepe_lulei
.. autofunction:: felupe.constitution.tensortrax.models.hyperelastic.miehe_goektepe_lulei

.. autofunction:: felupe.mooney_rivlin
.. autofunction:: felupe.constitution.tensortrax.models.hyperelastic.mooney_rivlin

.. autofunction:: felupe.neo_hooke
.. autofunction:: felupe.constitution.tensortrax.models.hyperelastic.neo_hooke

.. autofunction:: felupe.ogden
.. autofunction:: felupe.constitution.tensortrax.models.hyperelastic.ogden

.. autofunction:: felupe.ogden_roxburgh
.. autofunction:: felupe.constitution.tensortrax.models.hyperelastic.ogden_roxburgh

.. autofunction:: felupe.saint_venant_kirchhoff
.. autofunction:: felupe.constitution.tensortrax.models.hyperelastic.saint_venant_kirchhoff

.. autofunction:: felupe.third_order_deformation
.. autofunction:: felupe.constitution.tensortrax.models.hyperelastic.third_order_deformation

.. autofunction:: felupe.van_der_waals
.. autofunction:: felupe.constitution.tensortrax.models.hyperelastic.van_der_waals

.. autofunction:: felupe.yeoh
.. autofunction:: felupe.constitution.tensortrax.models.hyperelastic.yeoh

.. autofunction:: felupe.morph
.. autofunction:: felupe.constitution.tensortrax.models.lagrange.morph

.. autofunction:: felupe.morph_representative_directions
.. autofunction:: felupe.constitution.tensortrax.models.lagrange.morph_representative_directions
2 changes: 1 addition & 1 deletion examples/ex03_plasticity.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

import felupe as fem

mesh = fem.Cube(b=(3, 1, 1), n=(16, 6, 6))
mesh = fem.Cube(b=(3, 1, 1), n=(10, 4, 4))
region = fem.RegionHexahedron(mesh)
displacement = fem.Field(region, dim=3)
field = fem.FieldContainer([displacement])
Expand Down
16 changes: 8 additions & 8 deletions examples/ex11_notch-stress.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
pip install pypardiso

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 quadratic wedge element formulation
implemented and hence, the quadratic wedges in the mesh are converted to quadratic
hexahedrons.
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.
"""

# sphinx_gallery_thumbnail_number = -1
Expand All @@ -36,13 +36,13 @@

m = pv.examples.download_notch_displacement()

hex20 = [0, 2, 1, 1, 3, 5, 4, 4, 8, 7, 1, 6, 11, 10, 4, 9, 12, 14, 13, 13]
hex8 = [0, 2, 1, 1, 3, 5, 4, 4]
mesh = fem.Mesh(
m.points * 250,
np.vstack([m.cells_dict[25], m.cells_dict[26][:, hex20]]),
"hexahedron20",
np.vstack([m.cells_dict[25][:, :8], m.cells_dict[26][:, hex8]]),
"hexahedron",
)
region = fem.RegionQuadraticHexahedron(mesh)
region = fem.RegionHexahedron(mesh)
field = fem.FieldContainer([fem.Field(region, dim=3)])

boundaries, loadcase = fem.dof.uniaxial(field, clamped=True, sym=False, move=0.02)
Expand All @@ -64,7 +64,7 @@
# principal value of the Cauchy stress tensor is used to evaluate the fatigue life.
# For simplicity, the stress is evaluated for the total solid body. To consider only
# stresses on points which lie on the surface of the solid body, the cells on faces
# :meth:`~felupe.RegionQuadraticHexahedronBoundary.mesh.cells_faces` must be determined
# :meth:`~felupe.RegionHexahedronBoundary.mesh.cells_faces` must be determined
# first.
#
# .. math::
Expand Down
32 changes: 20 additions & 12 deletions src/felupe/constitution/tensortrax/_hyperelastic.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,18 +139,26 @@ def viscoelastic(C, Cin, mu, eta, dtime):

See Also
--------
saint_venant_kirchhoff : Strain energy function of the Saint
Venant-Kirchhoff material formulation.
neo_hooke : Strain energy function of the Neo-Hookean material formulation.
mooney_rivlin : Strain energy function of the Mooney-Rivlin material formulation.
yeoh : "Strain energy function of the Yeoh material formulation.
third_order_deformation : Strain energy function of the
Third-Order-Deformation material formulation.
ogden : Strain energy function of the Ogden material formulation.
arruda_boyce : Strain energy function of the Arruda-Boyce material formulation.
extended_tube : Strain energy function of the Extended-Tube material formulation.
van_der_waals : Strain energy function of the Van der Waals material formulation.
finite_strain_viscoelastic : Finite strain viscoelastic material formulation.
felupe.constitution.tensortrax.models.hyperelastic.saint_venant_kirchhoff : Strain
energy function of the Saint Venant-Kirchhoff material formulation.
felupe.constitution.tensortrax.models.hyperelastic.neo_hooke : Strain energy
function of the Neo-Hookean material formulation.
felupe.constitution.tensortrax.models.hyperelastic.mooney_rivlin : Strain energy
function of the Mooney-Rivlin material formulation.
felupe.constitution.tensortrax.models.hyperelastic.yeoh : "Strain energy function of
the Yeoh material formulation.
felupe.constitution.tensortrax.models.hyperelastic.third_order_deformation : Strain
energy function of the Third-Order-Deformation material formulation.
felupe.constitution.tensortrax.models.hyperelastic.ogden : Strain energy function of
the Ogden material formulation.
felupe.constitution.tensortrax.models.hyperelastic.arruda_boyce : Strain energy
function of the Arruda-Boyce material formulation.
felupe.constitution.tensortrax.models.hyperelastic.extended_tube : Strain energy
function of the Extended-Tube material formulation.
felupe.constitution.tensortrax.models.hyperelastic.van_der_waals : Strain energy
function of the Van der Waals material formulation.
felupe.constitution.tensortrax.models.hyperelastic.finite_strain_viscoelastic :
Finite strain viscoelastic material formulation.

"""

Expand Down
Loading
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载