pystran 0.0.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.
pystran/__init__.py ADDED
@@ -0,0 +1,92 @@
1
+ """
2
+ pystran - Python package for structural analysis with trusses and beams
3
+
4
+ (C) 2025, Petr Krysl
5
+
6
+ This package is intended for educational purposes.
7
+
8
+ ## Approach
9
+
10
+ The approach is based on classical weighted residual formulation (Galerkin).
11
+ The formulations are derived in the "Finite element modeling with shells and
12
+ beams" [book](http://hogwarts.ucsd.edu/~pkrysl/femstructures-book/).
13
+
14
+ The approach here is modern as opposed to classic.
15
+
16
+ Classically, the geometrical transformations are developed explicitly to push
17
+ the stiffness and mass matrices from special orientations to the real
18
+ orientation in space. This requires multiplication of the stiffness and mass
19
+ matrices by large transformation matrices on the left and right. The matrices
20
+ in special orientations are usually derived analytically, and these explicit
21
+ expressions become the starting point for developing computations. So for
22
+ instance for spatial beams, the starting point are 12x12 matrices.
23
+
24
+ The modern approach develops an expression for the strains in a basic element,
25
+ for instance curvature in beams. This leads to a small basic stiffness matrix,
26
+ 4x4 matrix in the case of a 2D beam. The geometrical transformation is then
27
+ introduced implicitly by projecting displacements in the real space onto the
28
+ local basis vectors of the element. The Galerkin weighted residual method then
29
+ naturally completes the development of the matrices.
30
+
31
+ The three dimensional beam is in such a modern framework treated as a
32
+ superposition of four stiffness mechanisms, each with its own
33
+ strain-displacement matrix. The stiffness and mass matrices are obtained
34
+ readily using numerical integration.
35
+
36
+
37
+ ## Features and limitations
38
+
39
+ - The package analyzes two-dimensional and three-dimensional structures made up
40
+ of truss (axial) members and beams (even in combination), rigid links, and
41
+ general springs. Concentrated masses can be added at joints.
42
+ - Linear statics and dynamics (free vibration) solvers are included.
43
+ - Only elastic models can be solved.
44
+ - For beams, only the Bernoulli-Euler model is implemented, so no shear
45
+ deformation is taken into account.
46
+ - Only straight members are treated.
47
+ - It is assumed that there is no coupling between the bending actions in the
48
+ two orthogonal planes.
49
+ - Coupling of axial and bending action is not implemented. This means that the
50
+ neutral axis must pass through the centroid.
51
+ - Warping of the cross sections is not modelled, hence only free torsion
52
+ effects are included.
53
+ - Member loading is not considered. All member loading needs to be converted to
54
+ nodal forces.
55
+ - Internal hinges can be modelled with linked joints. No member end releases
56
+ are implemented.
57
+ - Degrees of freedom are only along the global Cartesian axes. Skew supports
58
+ are not included (except with a penalty method based on springs)
59
+ - Offsets of the beams from the joints are currently not implemented.
60
+ - Rigid links between pairs of joints can be modeled with a penalty approach.
61
+
62
+ """
63
+
64
+ # Define the __all__ variable
65
+ __all__ = [
66
+ "gauss",
67
+ "freedoms",
68
+ "model",
69
+ "section",
70
+ "rotation",
71
+ "geometry",
72
+ "assemble",
73
+ "truss",
74
+ "rigid",
75
+ "beam",
76
+ "spring",
77
+ "plots",
78
+ ]
79
+
80
+ # Import the submodules
81
+ from . import freedoms
82
+ from . import model
83
+ from . import section
84
+ from . import rotation
85
+ from . import geometry
86
+ from . import gauss
87
+ from . import assemble
88
+ from . import truss
89
+ from . import rigid
90
+ from . import beam
91
+ from . import spring
92
+ from . import plots
pystran/assemble.py ADDED
@@ -0,0 +1,33 @@
1
+ """
2
+ Define utility for assembling.
3
+ """
4
+
5
+ from numpy import arange
6
+
7
+
8
+ def assemble(kg, dof, k):
9
+ """
10
+ Assemble local matrix into a global matrix.
11
+
12
+ Assemble local (stiffness or mass) matrix ``k`` into global (stiffness or
13
+ mass) matrix ``kg``, using the array of degrees of freedom, ``dof``, for both
14
+ the rows and columns. In other words, ``k`` must be symmetric.
15
+
16
+ Parameters
17
+ ----------
18
+ kg
19
+ Global matrix.
20
+ dof
21
+ Array of degrees of freedom.
22
+ k
23
+ Local (for instance, member) matrix.
24
+
25
+ Returns
26
+ -------
27
+ kg
28
+ """
29
+ for r in arange(len(dof)):
30
+ for c in arange(len(dof)):
31
+ gr, gc = dof[r], dof[c]
32
+ kg[gr, gc] += k[r, c]
33
+ return kg