From ad36bc111b455511e1c6606a46fd3063c329412c Mon Sep 17 00:00:00 2001 From: Andreas Dutzler Date: Thu, 28 Nov 2024 21:08:22 +0100 Subject: [PATCH] update the free-vibration test --- src/felupe/mechanics/_free_vibration.py | 17 ++++++++++++----- tests/test_free_vibration.py | 4 ++-- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/felupe/mechanics/_free_vibration.py b/src/felupe/mechanics/_free_vibration.py index dc28ff6f..fa149b88 100644 --- a/src/felupe/mechanics/_free_vibration.py +++ b/src/felupe/mechanics/_free_vibration.py @@ -24,7 +24,7 @@ class FreeVibration: - """A Free-Vibration Step. + """A Free-Vibration Step/Job. Parameters ---------- @@ -33,6 +33,12 @@ 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 -------- @@ -40,16 +46,17 @@ class FreeVibration: >>> 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): diff --git a/tests/test_free_vibration.py b/tests/test_free_vibration.py index 43c9f271..83708194 100644 --- a/tests/test_free_vibration.py +++ b/tests/test_free_vibration.py @@ -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():