Skip to content

Commit

Permalink
update the free-vibration test
Browse files Browse the repository at this point in the history
  • Loading branch information
adtzlr committed Nov 28, 2024
1 parent 3ce9893 commit ad36bc1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
17 changes: 12 additions & 5 deletions src/felupe/mechanics/_free_vibration.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@


class FreeVibration:
"""A Free-Vibration Step.
"""A Free-Vibration Step/Job.
Parameters
----------
Expand All @@ -33,23 +33,30 @@ class FreeVibration:
matrices.
boundaries : dict of Boundary, optional
A dict with :class:`~felupe.Boundary` conditions (default is None).
Notes
-----
.. note::
Boundary conditions with non-zero values are not supported.
Examples
--------
.. pyvista-plot::
>>> import felupe as fem
>>> import numpy as np
>>> from scipy.sparse.linalg import eigsh
>>>
>>> mesh = fem.Rectangle(b=(5, 1), n=(50, 10))
>>> region = fem.RegionQuad(mesh)
>>> field = fem.FieldContainer([fem.FieldPlaneStrain(region, dim=2)])
>>>
>>> boundaries = dict(left=fem.Boundary(field[0], fx=0))
>>> dof0, dof1 = fem.dof.partition(field, boundaries)
>>>
>>> solid = fem.SolidBody(umat=fem.LinearElastic(E=2.5, nu=0.25), field=field)
>>> solid = fem.SolidBody(fem.LinearElastic(E=2.5, nu=0.25), field, density=1.0)
>>> modal = fem.FreeVibration(items=[solid], boundaries=boundaries).evaluate()
>>>
>>> eigenvector, frequency = modal.extract(n=4, inplace=True)
>>> solid.plot("Stress", component=0).show()
"""

def __init__(self, items, boundaries=None):
Expand Down
4 changes: 2 additions & 2 deletions tests/test_free_vibration.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ def test_free_vibration():
umat = fem.NeoHooke(mu=1, bulk=2)
solid = fem.SolidBody(umat=umat, field=field, density=1.5e-9)

job = fem.FreeVibration([solid]).evaluate(x0=field)
new_field, frequency = job.extract(x0=field, n=-1, inplace=False)
job = fem.FreeVibration([solid]).evaluate()
new_field, frequency = job.extract(n=-1, inplace=False)


def test_free_vibration_mixed():
Expand Down

0 comments on commit ad36bc1

Please sign in to comment.