fluxfem 0.1.1a0__py3-none-any.whl → 0.1.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- fluxfem/core/__init__.py +2 -0
- fluxfem/core/weakform.py +10 -0
- fluxfem/{helpers_num.py → helpers_ts.py} +1 -1
- fluxfem/helpers_wf.py +2 -0
- {fluxfem-0.1.1a0.dist-info → fluxfem-0.1.3.dist-info}/METADATA +28 -14
- {fluxfem-0.1.1a0.dist-info → fluxfem-0.1.3.dist-info}/RECORD +8 -8
- {fluxfem-0.1.1a0.dist-info → fluxfem-0.1.3.dist-info}/WHEEL +1 -1
- {fluxfem-0.1.1a0.dist-info/licenses → fluxfem-0.1.3.dist-info}/LICENSE +0 -0
fluxfem/core/__init__.py
CHANGED
|
@@ -86,6 +86,7 @@ from .weakform import (
|
|
|
86
86
|
transpose,
|
|
87
87
|
log,
|
|
88
88
|
transpose_last2,
|
|
89
|
+
matmul,
|
|
89
90
|
einsum,
|
|
90
91
|
)
|
|
91
92
|
from ..mesh import (
|
|
@@ -244,6 +245,7 @@ __all__ = [
|
|
|
244
245
|
"transpose",
|
|
245
246
|
"log",
|
|
246
247
|
"transpose_last2",
|
|
248
|
+
"matmul",
|
|
247
249
|
"einsum",
|
|
248
250
|
"HexMesh",
|
|
249
251
|
"HexMeshPytree",
|
fluxfem/core/weakform.py
CHANGED
|
@@ -362,6 +362,11 @@ def transpose_last2(a) -> Expr:
|
|
|
362
362
|
return Expr("transpose_last2", _as_expr(a))
|
|
363
363
|
|
|
364
364
|
|
|
365
|
+
def matmul(a, b) -> Expr:
|
|
366
|
+
"""Matrix product with standard semantics (no special 3D contraction)."""
|
|
367
|
+
return Expr("matmul_std", _as_expr(a), _as_expr(b))
|
|
368
|
+
|
|
369
|
+
|
|
365
370
|
def einsum(subscripts: str, *args) -> Expr:
|
|
366
371
|
"""Einsum wrapper that supports Expr inputs."""
|
|
367
372
|
return Expr("einsum", subscripts, *[_as_expr(arg) for arg in args])
|
|
@@ -706,6 +711,10 @@ def _eval_expr(expr: Expr, ctx, params, u_elem=None):
|
|
|
706
711
|
):
|
|
707
712
|
return jnp.einsum("qia,qja->qij", a, b)
|
|
708
713
|
return a @ b
|
|
714
|
+
if op == "matmul_std":
|
|
715
|
+
a = _eval_value(args[0], ctx, params, u_elem=u_elem)
|
|
716
|
+
b = _eval_value(args[1], ctx, params, u_elem=u_elem)
|
|
717
|
+
return jnp.matmul(a, b)
|
|
709
718
|
if op == "neg":
|
|
710
719
|
return -_eval_value(args[0], ctx, params, u_elem=u_elem)
|
|
711
720
|
if op == "dot":
|
|
@@ -814,5 +823,6 @@ __all__ = [
|
|
|
814
823
|
"transpose",
|
|
815
824
|
"log",
|
|
816
825
|
"transpose_last2",
|
|
826
|
+
"matmul",
|
|
817
827
|
"einsum",
|
|
818
828
|
]
|
fluxfem/helpers_wf.py
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
2
|
Name: fluxfem
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.3
|
|
4
4
|
Summary: FluxFEM: A weak-form-centric differentiable finite element framework in JAX
|
|
5
5
|
License: Apache-2.0
|
|
6
|
-
License-File: LICENSE
|
|
7
6
|
Author: Kohei Watanabe
|
|
8
7
|
Author-email: koheitech001@gmail.com
|
|
9
8
|
Requires-Python: >=3.11,<3.14
|
|
9
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
10
10
|
Classifier: Programming Language :: Python :: 3
|
|
11
11
|
Classifier: Programming Language :: Python :: 3.11
|
|
12
12
|
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
14
13
|
Requires-Dist: jax (==0.8.2)
|
|
15
14
|
Requires-Dist: jaxlib (==0.8.2)
|
|
16
15
|
Requires-Dist: matplotlib (>=3.10.7,<4.0.0)
|
|
@@ -18,6 +17,7 @@ Requires-Dist: meshio (>=5.3.5,<6.0.0)
|
|
|
18
17
|
Requires-Dist: pyvista (>=0.46.4,<0.47.0)
|
|
19
18
|
Description-Content-Type: text/markdown
|
|
20
19
|
|
|
20
|
+
[](https://pypi.org/project/fluxfem/)
|
|
21
21
|
[](https://opensource.org/licenses/Apache-2.0)
|
|
22
22
|
[](https://pypi.org/project/fluxfem/)
|
|
23
23
|

|
|
@@ -27,10 +27,21 @@ Description-Content-Type: text/markdown
|
|
|
27
27
|
A weak-form-centric differentiable finite element framework in JAX
|
|
28
28
|
|
|
29
29
|
## Examples and Features
|
|
30
|
-
|
|
31
|
-
<
|
|
32
|
-
|
|
33
|
-
</
|
|
30
|
+
<table>
|
|
31
|
+
<tr>
|
|
32
|
+
<td align="center"><b>Example 1: Diffusion</b></td>
|
|
33
|
+
<td align="center"><b>Example 2: Neo Neohookean Hyper Elasticity</b></td>
|
|
34
|
+
</tr>
|
|
35
|
+
<tr>
|
|
36
|
+
<td align="center">
|
|
37
|
+
<img src="https://media.githubusercontent.com/media/kevin-tofu/fluxfem/main/assets/diffusion_mms_timeseries.gif" alt="Diffusion-mms" width="400">
|
|
38
|
+
</td>
|
|
39
|
+
<td align="center">
|
|
40
|
+
<img src="https://media.githubusercontent.com/media/kevin-tofu/fluxfem/main/assets/Neo-Hookean-deformedx20000.png" alt="Neo-Hookean" width="400">
|
|
41
|
+
</td>
|
|
42
|
+
</tr>
|
|
43
|
+
</table>
|
|
44
|
+
|
|
34
45
|
|
|
35
46
|
## Features
|
|
36
47
|
- Built on JAX, enabling automatic differentiation and high-performance execution via grad, jit, vmap, and related transformations.
|
|
@@ -39,7 +50,7 @@ Description-Content-Type: text/markdown
|
|
|
39
50
|
|
|
40
51
|
- Supports two assembly approaches: weak-form-based assembly and a tensor-based (scikit-fem–style) assembly.
|
|
41
52
|
|
|
42
|
-
- enables to handle both Linear / Non-Linear
|
|
53
|
+
- enables to handle both Linear / Non-Linear analysis with AD in JAX
|
|
43
54
|
|
|
44
55
|
## Usage
|
|
45
56
|
|
|
@@ -54,6 +65,7 @@ This is because the weak-form-based assembly is ultimately transformed into the
|
|
|
54
65
|
### weak-form-based assembly
|
|
55
66
|
```Python
|
|
56
67
|
import fluxfem as ff
|
|
68
|
+
import fluxfem.helpers_wf as h_wf
|
|
57
69
|
|
|
58
70
|
space = ff.make_hex_space(mesh, dim=3, intorder=2)
|
|
59
71
|
D = ff.isotropic_3d_D(1.0, 0.3)
|
|
@@ -71,11 +83,12 @@ K_wf = space.assemble_bilinear_form(
|
|
|
71
83
|
```Python
|
|
72
84
|
import fluxfem as ff
|
|
73
85
|
import numpy as np
|
|
86
|
+
import fluxfem.helpers_ts as h_ts
|
|
74
87
|
|
|
75
88
|
def linear_elasticity_form(ctx: ff.FormContext, D: np.ndarray) -> ff.jnp.ndarray:
|
|
76
|
-
Bu =
|
|
77
|
-
Bv =
|
|
78
|
-
return
|
|
89
|
+
Bu = h_ts.sym_grad(ctx.trial)
|
|
90
|
+
Bv = h_ts.sym_grad(ctx.test)
|
|
91
|
+
return h_ts.ddot(Bv, D, Bu)
|
|
79
92
|
|
|
80
93
|
|
|
81
94
|
space = ff.make_hex_space(mesh, dim=3, intorder=2)
|
|
@@ -88,11 +101,11 @@ K = space.assemble_bilinear_form(linear_elasticity_form, params=D)
|
|
|
88
101
|
|
|
89
102
|
## SetUp
|
|
90
103
|
|
|
91
|
-
You can install **
|
|
104
|
+
You can install **FluxFEM** either via **pip** or **Poetry**.
|
|
92
105
|
|
|
93
106
|
#### Supported Python Versions
|
|
94
107
|
|
|
95
|
-
|
|
108
|
+
FluxFEM supports **Python 3.11–3.13**:
|
|
96
109
|
|
|
97
110
|
|
|
98
111
|
**Choose one of the following methods:**
|
|
@@ -109,3 +122,4 @@ poetry add fluxfem
|
|
|
109
122
|
|
|
110
123
|
## Acknowledgements
|
|
111
124
|
I acknoldege everythings that made this work possible.
|
|
125
|
+
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
fluxfem/__init__.py,sha256=wpnJOQj4PSIzWfYd6R0WjAAxN6V8CV7GfxeZqM1WNjc,8145
|
|
2
|
-
fluxfem/core/__init__.py,sha256=
|
|
2
|
+
fluxfem/core/__init__.py,sha256=DgGJ1Z8ZPfEFjv-q_srihazOxqcPMyEWM2w495ojmHQ,7490
|
|
3
3
|
fluxfem/core/assembly.py,sha256=yhc14y4XWvmBpiLun2eH9k1mjAsNmpTbHPJS2VJFO3M,25370
|
|
4
4
|
fluxfem/core/basis.py,sha256=ZxTQUAEC2UBuvxGhiSqAPjVnUwP_nIptY_b9Wn2etak,32113
|
|
5
5
|
fluxfem/core/data.py,sha256=_byAZTasIGGwNRU3gqw_ZZR1HMVLJpk9gix2AI3AJWk,1818
|
|
@@ -8,9 +8,9 @@ fluxfem/core/forms.py,sha256=ZxmpmaZa-uTRi-0Dltvn0VkEcXpW4HgNFr8Po0b8JyQ,7264
|
|
|
8
8
|
fluxfem/core/interp.py,sha256=v9HzkYgQnEqf6GnB9tXqfrNk0N7YsmPcZBfNGNUU3b8,2004
|
|
9
9
|
fluxfem/core/solver.py,sha256=nNpb90ddZq8Ek6XPerlKzV4YWtC5ZgEcsRv4KeoFIug,3770
|
|
10
10
|
fluxfem/core/space.py,sha256=jj4koa6_7lBBtXWGrF1CehOBKWg--uUW_7q8pB2EFCk,13902
|
|
11
|
-
fluxfem/core/weakform.py,sha256=
|
|
12
|
-
fluxfem/
|
|
13
|
-
fluxfem/helpers_wf.py,sha256=
|
|
11
|
+
fluxfem/core/weakform.py,sha256=Q2SoOX1KwwPTigJMDUygQnEuKoxBAHh0R3qwI_sf4gY,27470
|
|
12
|
+
fluxfem/helpers_ts.py,sha256=T3HCqXniF116lvznq0b7CDUok5_yZZc8l9XtlE81yvg,221
|
|
13
|
+
fluxfem/helpers_wf.py,sha256=JUKiA5p_V9NmUdskHYgYYOlsa8xKTZzBkJCoeUqTu1c,574
|
|
14
14
|
fluxfem/mesh/__init__.py,sha256=3ECN0qsVzOnEGTHfrWJ2PV7RJUbSboow1ewfpknI4F4,927
|
|
15
15
|
fluxfem/mesh/base.py,sha256=NCJxqKLb6AOC2oGN-GfjC8Uu1Mddpa3E10RNYCyLYtI,10214
|
|
16
16
|
fluxfem/mesh/hex.py,sha256=37xSQDDIndbz7JfBCSdI9ptV19L4_OZ4XgKfkFRGS00,12373
|
|
@@ -41,7 +41,7 @@ fluxfem/tools/__init__.py,sha256=S7flze8kfHABc0fdhGgdELzKO8aeBCrDbwRUE3aTGpA,95
|
|
|
41
41
|
fluxfem/tools/jit.py,sha256=WVThoNs2XD8ZVCeyLjBgbFaZXHot5RK_RNzvvAjSaew,1110
|
|
42
42
|
fluxfem/tools/timer.py,sha256=fvMrKqjOT2S_DoGlTYC5L5TtBnoLS4zyiAZtJVJGt0o,22848
|
|
43
43
|
fluxfem/tools/visualizer.py,sha256=aDqSgtX9xOu120-zCzJfwlCOUmxjL_kJ6kAvj27-H14,3733
|
|
44
|
-
fluxfem-0.1.
|
|
45
|
-
fluxfem-0.1.
|
|
46
|
-
fluxfem-0.1.
|
|
47
|
-
fluxfem-0.1.
|
|
44
|
+
fluxfem-0.1.3.dist-info/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
|
|
45
|
+
fluxfem-0.1.3.dist-info/METADATA,sha256=FkdJPsdozjTFWGBp3f87EOaRp2IPdo2G2oW1qPCA4-g,4259
|
|
46
|
+
fluxfem-0.1.3.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
47
|
+
fluxfem-0.1.3.dist-info/RECORD,,
|
|
File without changes
|