Skip to content
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

Add FreeVibration(items, boundaries) #909

Merged
merged 11 commits into from
Nov 28, 2024
Merged

Add FreeVibration(items, boundaries) #909

merged 11 commits into from
Nov 28, 2024

Conversation

adtzlr
Copy link
Owner

@adtzlr adtzlr commented Nov 27, 2024

with methods to evaluate() and extract() the n-th eigenvector to a field.

Tasks

  • check for mixed-field solid bodies
  • test the performance for typical (10^5) degrees-of-freedom models

Example

import felupe as fem

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))
solid = fem.SolidBody(umat=fem.LinearElastic(E=2.5, nu=0.25), field=field, density=1.0)

res = fem.FreeVibration(items=[solid], boundaries=boundaries).evaluate()
field, frequency = res.extract(n=4, inplace=True)

ax = solid.imshow("Stress", component=0)
ax.set_title(rf"Frequency $f_5$ = {frequency:.2} Hz")

image

with methods to `evaluate()` and `extract()` the n-th eigenvector to a field
@adtzlr adtzlr added the enhancement New feature or request label Nov 27, 2024
@adtzlr adtzlr self-assigned this Nov 27, 2024
@adtzlr
Copy link
Owner Author

adtzlr commented Nov 28, 2024

This is also possible

import felupe as fem

meshes = [
    fem.Cube(a=(0, 0, 30), b=(50, 100, 35), n=(6, 11, 2)),
    fem.Cube(a=(0, 0, 5), b=(50, 100, 30), n=(6, 11, 6)),
    fem.Cube(a=(0, 0, 0), b=(50, 100, 5), n=(6, 11, 2)),
]
container = fem.MeshContainer(meshes, merge=True)
mesh = container.stack()

regions = [fem.RegionHexahedron(m) for m in container.meshes]
fields = [
    fem.FieldsMixed(regions[0], n=1),
    fem.FieldsMixed(regions[1], n=3),
    fem.FieldsMixed(regions[2], n=1),
]

region = fem.RegionHexahedron(mesh)
field = fem.FieldContainer([fem.Field(region, dim=3), fields[1][1], fields[1][2]])

boundaries = dict(left=fem.Boundary(field[0], fx=0))
rubber = fem.ThreeFieldVariation(fem.NeoHooke(mu=1, bulk=5000))
steel = fem.LinearElasticLargeStrain(2.1e5, 0.3)
solids = [
    fem.SolidBody(umat=steel, field=fields[0], density=7.85e-9),
    fem.SolidBody(umat=rubber, field=fields[1], density=1.5e-9),
    fem.SolidBody(umat=steel, field=fields[2], density=7.85e-9),
]

job = fem.FreeVibration(solids, boundaries).evaluate(x0=field)

import matplotlib.pyplot as plt

fig, ax = plt.subplots(figsize=(10, 2), ncols=3)

for n in range(3):
    f, frequency = job.extract(x0=field, n=n, inplace=False)
    ax[n] = f.imshow(show_undeformed=False, factor=10 / f[0].values.max(), ax=ax[n])
    ax[n].set_title(r"Frequency $f" + f"_{n+1}$ = {frequency:.0f} Hz")
image

Copy link

codecov bot commented Nov 28, 2024

Codecov Report

Attention: Patch coverage is 98.33333% with 1 line in your changes missing coverage. Please review.

Project coverage is 97.30%. Comparing base (e2305db) to head (95c965d).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/felupe/mechanics/_free_vibration.py 97.95% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #909   +/-   ##
=======================================
  Coverage   97.30%   97.30%           
=======================================
  Files         179      180    +1     
  Lines        6337     6393   +56     
=======================================
+ Hits         6166     6221   +55     
- Misses        171      172    +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@adtzlr adtzlr merged commit c77b69f into main Nov 28, 2024
5 checks passed
@adtzlr adtzlr deleted the add-free-vibration branch November 28, 2024 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant