zero-mech 0.1.2__tar.gz → 0.2.0__tar.gz

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.
Files changed (24) hide show
  1. {zero_mech-0.1.2/src/zero_mech.egg-info → zero_mech-0.2.0}/PKG-INFO +5 -3
  2. {zero_mech-0.1.2 → zero_mech-0.2.0}/pyproject.toml +4 -3
  3. zero_mech-0.2.0/src/zero_mech/__init__.py +23 -0
  4. {zero_mech-0.1.2 → zero_mech-0.2.0}/src/zero_mech/active.py +10 -2
  5. {zero_mech-0.1.2 → zero_mech-0.2.0}/src/zero_mech/experiments.py +35 -0
  6. zero_mech-0.2.0/src/zero_mech/ventricle.py +702 -0
  7. {zero_mech-0.1.2 → zero_mech-0.2.0/src/zero_mech.egg-info}/PKG-INFO +5 -3
  8. {zero_mech-0.1.2 → zero_mech-0.2.0}/src/zero_mech.egg-info/SOURCES.txt +3 -1
  9. {zero_mech-0.1.2 → zero_mech-0.2.0}/src/zero_mech.egg-info/requires.txt +2 -1
  10. {zero_mech-0.1.2 → zero_mech-0.2.0}/tests/test_experiments.py +11 -1
  11. zero_mech-0.2.0/tests/test_ventricle.py +388 -0
  12. zero_mech-0.1.2/src/zero_mech/__init__.py +0 -10
  13. {zero_mech-0.1.2 → zero_mech-0.2.0}/LICENSE +0 -0
  14. {zero_mech-0.1.2 → zero_mech-0.2.0}/README.md +0 -0
  15. {zero_mech-0.1.2 → zero_mech-0.2.0}/setup.cfg +0 -0
  16. {zero_mech-0.1.2 → zero_mech-0.2.0}/src/zero_mech/atoms.py +0 -0
  17. {zero_mech-0.1.2 → zero_mech-0.2.0}/src/zero_mech/compressibility.py +0 -0
  18. {zero_mech-0.1.2 → zero_mech-0.2.0}/src/zero_mech/material.py +0 -0
  19. {zero_mech-0.1.2 → zero_mech-0.2.0}/src/zero_mech/model.py +0 -0
  20. {zero_mech-0.1.2 → zero_mech-0.2.0}/src/zero_mech/viscosity.py +0 -0
  21. {zero_mech-0.1.2 → zero_mech-0.2.0}/src/zero_mech.egg-info/dependency_links.txt +0 -0
  22. {zero_mech-0.1.2 → zero_mech-0.2.0}/src/zero_mech.egg-info/entry_points.txt +0 -0
  23. {zero_mech-0.1.2 → zero_mech-0.2.0}/src/zero_mech.egg-info/not-zip-safe +0 -0
  24. {zero_mech-0.1.2 → zero_mech-0.2.0}/src/zero_mech.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: zero_mech
3
- Version: 0.1.2
3
+ Version: 0.2.0
4
4
  Summary: A zero-dimensional mechanics solver
5
5
  Author-email: Henrik Finsberg <henriknf@simula.no>
6
6
  License: MIT
@@ -28,12 +28,13 @@ Requires-Dist: pre-commit; extra == "dev"
28
28
  Requires-Dist: twine; extra == "dev"
29
29
  Requires-Dist: wheel; extra == "dev"
30
30
  Provides-Extra: docs
31
- Requires-Dist: jupyter-book; extra == "docs"
31
+ Requires-Dist: jupyter-book<2.0; extra == "docs"
32
32
  Requires-Dist: jupytext; extra == "docs"
33
33
  Requires-Dist: zero-mech[examples]; extra == "docs"
34
34
  Provides-Extra: test
35
35
  Requires-Dist: pytest; extra == "test"
36
36
  Requires-Dist: pytest-cov; extra == "test"
37
+ Requires-Dist: numpy; extra == "test"
37
38
  Provides-Extra: lite
38
39
  Requires-Dist: jupyterlite-core==0.5.0; extra == "lite"
39
40
  Requires-Dist: jupyterlab~=4.3.4; extra == "lite"
@@ -44,6 +45,7 @@ Requires-Dist: jupyterlab_miami_nights; extra == "lite"
44
45
  Requires-Dist: ipywidgets<9,>=8.1.3; extra == "lite"
45
46
  Requires-Dist: ipyevents>=2.0.1; extra == "lite"
46
47
  Requires-Dist: ipympl>=0.8.2; extra == "lite"
48
+ Dynamic: license-file
47
49
 
48
50
  # ZeroMech - A 0D mechanics simulator
49
51
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "zero_mech"
7
- version = "0.1.2"
7
+ version = "0.2.0"
8
8
  description = "A zero-dimensional mechanics solver"
9
9
  authors = [{name = "Henrik Finsberg", email = "henriknf@simula.no"}]
10
10
  license = {text = "MIT"}
@@ -42,13 +42,14 @@ dev = [
42
42
  "wheel",
43
43
  ]
44
44
  docs = [
45
- "jupyter-book",
45
+ "jupyter-book<2.0",
46
46
  "jupytext",
47
47
  "zero-mech[examples]"
48
48
  ]
49
49
  test = [
50
50
  "pytest",
51
51
  "pytest-cov",
52
+ "numpy",
52
53
 
53
54
  ]
54
55
  lite = [
@@ -157,7 +158,7 @@ tag = true
157
158
  sign_tags = false
158
159
  tag_name = "v{new_version}"
159
160
  tag_message = "Bump version: {current_version} → {new_version}"
160
- current_version = "0.1.2"
161
+ current_version = "0.2.0"
161
162
 
162
163
 
163
164
  [[tool.bumpversion.files]]
@@ -0,0 +1,23 @@
1
+ from . import experiments
2
+ from . import material
3
+ from . import compressibility
4
+ from . import model
5
+ from .model import Model
6
+ from . import active
7
+ from .active import ActiveStress
8
+ from . import ventricle
9
+ from .ventricle import SphericalVentricle, TriSeg
10
+
11
+
12
+ __all__ = [
13
+ "experiments",
14
+ "material",
15
+ "compressibility",
16
+ "model",
17
+ "Model",
18
+ "active",
19
+ "ActiveStress",
20
+ "ventricle",
21
+ "SphericalVentricle",
22
+ "TriSeg",
23
+ ]
@@ -6,20 +6,28 @@ from .atoms import AbstractStrainEnergy
6
6
 
7
7
  @dataclass(slots=True, frozen=True)
8
8
  class ActiveStress(AbstractStrainEnergy):
9
+ """An active tension along the fibres, as a strain energy.
10
+
11
+ The energy is :math:`\\frac{T_a}{2} (I_{4f} - 1)`, so that the second
12
+ Piola-Kirchhoff stress it adds is :math:`T_a \\, f_0 \\otimes f_0`. For a
13
+ fibre stretch :math:`\\lambda` the first Piola-Kirchhoff stress along the
14
+ fibre is :math:`T_a \\lambda` and the Cauchy stress :math:`T_a \\lambda^2 / J`.
15
+ """
16
+
9
17
  Ta: sp.Symbol = sp.Symbol("Ta")
10
18
  f0: sp.Matrix = field(default_factory=lambda: sp.Matrix([1, 0, 0]))
11
19
 
12
20
  def strain_energy(self, F: sp.Matrix) -> sp.Expr:
13
21
  f = F @ self.f0
14
22
  I4f = f.T.dot(f)
15
- return self.Ta * (I4f - 1)
23
+ return self.Ta / 2 * (I4f - 1)
16
24
 
17
25
  def default_parameters(self):
18
26
  return {self.Ta: 0.0}
19
27
 
20
28
  @staticmethod
21
29
  def str() -> str:
22
- return "Ta * (I4f - 1)"
30
+ return "Ta / 2 * (I4f - 1)"
23
31
 
24
32
 
25
33
  @dataclass(slots=True, frozen=True)
@@ -123,6 +123,41 @@ def uniaxial_tension(
123
123
  return MechanicalExperiment(F11=F11, F22=F22, F33=F33)
124
124
 
125
125
 
126
+ def equibiaxial(
127
+ axis: int = 2, lmbda=sp.Symbol("λ", real=True, positive=True)
128
+ ) -> MechanicalExperiment:
129
+ """Equal stretch in two directions with the third one thinning.
130
+
131
+ The deformation of an incompressible sheet, or of the wall of a
132
+ sphere that is inflated: the two in-plane directions are stretched
133
+ by λ and the direction given by ``axis`` (the wall thickness) by
134
+ λ⁻², so that the deformation is volume preserving.
135
+
136
+ Parameters
137
+ ----------
138
+ axis : int, optional
139
+ The thinning direction, by default 2
140
+ lmbda : sp.Symbol, optional
141
+ The in-plane stretch
142
+ """
143
+ F_plane = lmbda
144
+ F_thin = 1 / lmbda**2
145
+
146
+ if axis == 0:
147
+ F11 = F_thin
148
+ F22 = F33 = F_plane
149
+ elif axis == 1:
150
+ F22 = F_thin
151
+ F11 = F33 = F_plane
152
+ elif axis == 2:
153
+ F33 = F_thin
154
+ F11 = F22 = F_plane
155
+ else:
156
+ raise ValueError("axis must be 0, 1, or 2")
157
+
158
+ return MechanicalExperiment(F11=F11, F22=F22, F33=F33)
159
+
160
+
126
161
  def full_matrix() -> MechanicalExperiment:
127
162
  """Return a MechanicalExperiment with all components
128
163
  initialized as symbols.