pyfebio 0.1.1__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.
pyfebio/loads.py ADDED
@@ -0,0 +1,55 @@
1
+ from typing import Literal
2
+
3
+ from pydantic_xml import BaseXmlModel, attr, element
4
+
5
+ from ._types import (
6
+ StringFloatVec3,
7
+ )
8
+
9
+
10
+ class Scale(BaseXmlModel, validate_assignment=True):
11
+ lc: int = attr()
12
+ text: float = 1.0
13
+
14
+
15
+ class NodalLoad(BaseXmlModel, validate_assignment=True):
16
+ type: Literal["nodal_load"] = attr(default="nodal_load", frozen=True)
17
+ dof: Literal["x", "y", "z", "p"] = element(default="x")
18
+
19
+
20
+ class TractionLoad(BaseXmlModel, tag="surface_load", validate_assignment=True):
21
+ type: Literal["traction"] = attr(default="traction", frozen=True)
22
+ surface: str = attr()
23
+ scale: Scale = element()
24
+ traction: StringFloatVec3 = element(default="0,0,1")
25
+
26
+
27
+ class PressureLoad(BaseXmlModel, tag="surface_load", validate_assignment=True):
28
+ type: Literal["pressure"] = attr(default="pressure", frozen=True)
29
+ surface: str = attr()
30
+ symmetric_stiffness: Literal[0, 1] = element(default=0)
31
+ linear: Literal[0, 1] = element(default=0)
32
+ shell_bottom: Literal[0, 1] = element(default=0)
33
+ pressure: Scale = element()
34
+
35
+
36
+ class FluidFlux(BaseXmlModel, tag="surface_load", validate_assignment=True):
37
+ flux: Scale = element()
38
+ linear: Literal[0, 1] = element(default=0)
39
+ mixture: Literal[0, 1] = element(default=1)
40
+
41
+
42
+ class FluidPressure(BaseXmlModel, tag="surface_load", validate_assignment=True):
43
+ type: Literal["fluid pressure"] = attr(default="fluid pressure", frozen=True)
44
+ pressure: float = element(default=1.0)
45
+
46
+
47
+ class Loads(BaseXmlModel, validate_assignment=True):
48
+ all_surface_loads: list[TractionLoad | PressureLoad | FluidFlux | FluidPressure] = element(default=[])
49
+ all_nodal_loads: list[NodalLoad] = element(default=[])
50
+
51
+ def add_surface_load(self, new_load: PressureLoad | TractionLoad | FluidFlux | FluidPressure):
52
+ self.all_surface_loads.append(new_load)
53
+
54
+ def add_nodal_load(self, new_load: NodalLoad):
55
+ self.all_nodal_loads.append(new_load)