FElupe ドキュメント#
FElupe is a Python 3.10+ finite element analysis package focusing on the formulation and numerical solution of nonlinear problems in continuum mechanics of solid bodies. This package is intended for scientific research, but is also suitable for running nonlinear simulations in general. In addition to the transformation of general weak forms into sparse vectors and matrices, FElupe provides an efficient high-level abstraction layer for the simulation of the deformation of solid bodies.
FElupeは初めてですか?ビギナーズガイドでは、FElupeのコンセプトについて紹介しています。
リファレンス・ガイドには、FElupe API の詳細な説明が含まれています。メソッドがどのように動作し、どのパラメータを使用できるかを説明しています。 キーコンセプトの理解が必要です。
特定のタスクや問題に対するステップバイステップのガイドで、完全性ではなく実用的な使いやすさに重点を置いています。 キーコンセプトの理解が必要です。
例のギャラリー。
注目ポイント
easy to learn and productive high-level API
nonlinear deformation of
solid bodiesinteractive views on meshes, fields and solid bodies (using PyVista)
typical finite elements
cartesian, axisymmetric, plane strain and mixed fields
インストール#
Install Python, open a terminal and run
pip install felupe[all]
where [all] is a combination of [autodiff,io,parallel,plot,progress,view] and installs all optional dependencies. FElupe has minimal requirements, all available at PyPI supporting all platforms.
In order to make use of all features of FElupe, it is suggested to install all optional dependencies.
(スレッド)並列アセンブリのための einsumt
jax for automatic differentiation in material formulations (JAX-based)
XDMF結果ファイル書き込みのための h5py
グラフのプロットのための matplotlib
メッシュ関連I/Oのための meshio
インタラクティブなビジュアライゼーションのための pyvista
tensortrax for automatic differentiation in material formulations (NumPy-based)
ジョブの評価時にプログレスバーを表示するための tqdm
The development version may contain not yet released bug fixes and features. Consider using the --user option to install the package into your home directory (see pip documentation for more details). To install FElupe from the latest development branch, use
pip install git+https://github.com/adtzlr/felupe.git@main
or clone the repository and install the package in editable mode.
git clone https://github.com/adtzlr/felupe.git
cd felupe
pip install --editable .
Optional dependencies may also be installed by replacing the last line.
pip install --editable ".[all]"
拡張パッケージ#
FElupeの機能は、コミュニティによって作成された拡張パッケージによって強化されるかもしれません。
パッケージ |
説明 |
|---|---|
Numerical continuation of nonlinear equilibrium equations. |
|
構成的超弾性材料の定式化 |
|
自動微分(AD)による材料定義 |
|
Snapshot-Driven State Upscaling |
|
NumPyの配列に基づく微分可能なテンソル(FElupeにバンドル) |
|
FElupeのための視覚化ツール |
パフォーマンス#
これは、四面体上の線形弾性と超弾性のアセンブリ時間を比較する簡単なベンチマークです。
解析 |
DOF/s |
|---|---|
線形弾性 |
130039 +/-23464 |
超弾性 |
116819 +/-21979 |
テスト環境:Windows 10、Python 3.11、インテル® Core™ i7-11850H @ 2.50GHz、32GB RAM。
from timeit import timeit
import matplotlib.pyplot as plt
import numpy as np
import felupe as fem
def pre_linear_elastic(n, **kwargs):
mesh = fem.Cube(n=n).triangulate()
region = fem.RegionTetra(mesh)
field = fem.FieldContainer([fem.Field(region, dim=3)])
umat = fem.LinearElastic(E=1, nu=0.3)
solid = fem.SolidBody(umat, field)
return mesh, solid
def pre_hyperelastic(n, **kwargs):
mesh = fem.Cube(n=n).triangulate()
region = fem.RegionTetra(mesh)
field = fem.FieldContainer([fem.Field(region, dim=3)])
umat = fem.NeoHookeCompressible(mu=1.0, lmbda=2.0)
solid = fem.SolidBody(umat, field)
return mesh, solid
print("# Assembly Runtimes")
print("")
print("| DOF | Linear-Elastic in s | Hyperelastic in s |")
print("| ------- | ------------------- | ----------------- |")
points_per_axis = np.round((np.logspace(3, 5, 6) / 3)**(1 / 3)).astype(int)
number = 3
parallel = False
runtimes = np.zeros((len(points_per_axis), 2))
for i, n in enumerate(points_per_axis):
mesh, solid = pre_linear_elastic(n)
matrix = solid.assemble.matrix(parallel=parallel)
time_linear_elastic = (
timeit(lambda: solid.assemble.matrix(parallel=parallel), number=number) / number
)
mesh, solid = pre_hyperelastic(n)
matrix = solid.assemble.matrix(parallel=parallel)
time_hyperelastic = (
timeit(lambda: solid.assemble.matrix(parallel=parallel), number=number) / number
)
runtimes[i] = time_linear_elastic, time_hyperelastic
print(
f"| {mesh.points.size:7d} | {runtimes[i][0]:19.2f} | {runtimes[i][1]:17.2f} |"
)
dofs_le = points_per_axis ** 3 * 3 / runtimes[:, 0]
dofs_he = points_per_axis ** 3 * 3 / runtimes[:, 1]
print("")
print("| Analysis | DOF/s |")
print("| -------------- | ----------------- |")
print(
f"| Linear-Elastic | {np.mean(dofs_le):5.0f} +/-{np.std(dofs_le):5.0f} |"
)
print(f"| Hyperelastic | {np.mean(dofs_he):5.0f} +/-{np.std(dofs_he):5.0f} |")
plt.figure()
plt.loglog(
points_per_axis ** 3 * 3,
runtimes[:, 1],
"C0",
label=r"Stiffness Matrix (Hyperelastic)",
)
plt.loglog(
points_per_axis ** 3 * 3,
runtimes[:, 0],
"C1--",
label=r"Stiffness Matrix (Linear-Elastic)",
)
plt.xlabel(r"Number of degrees of freedom $\longrightarrow$")
plt.ylabel(r"Runtime in s $\longrightarrow$")
plt.legend()
plt.tight_layout()
plt.savefig("benchmark.png")
ライセンス#
FElupe - Finite Element Analysis (C) 2021-2026 Andreas Dutzler, Graz (Austria).
このプログラムはフリー・ソフトウェアです。あなたは、フリー・ソフトウェア財団によって発行されたGNU一般公衆利用許諾契約書のバージョン3、または(あなたの選択により)それ以降のバージョンのいずれかに従って、このプログラムを再配布、または改変することができます。
このプログラムは有用であることを願って配布されていますが、いかなる保証もありません。商品性や特定目的への適合性の暗黙の保証さえもありません。詳細はGNU一般公衆利用許諾契約書をご覧ください。
あなたはこのプログラムとともにGNU一般公衆利用許諾契約書のコピーを受け取っているはずです。そうでない場合は、 https://www.gnu.org/licenses/ を参照してください。