OpenSeesPyAssistant 1.1
OpenSeesPy for everyone
Units.py
Go to the documentation of this file.
1"""Module with the units conversion and the definition of the units used as default (m, N, s). \n
2Note that the decision of which unit for each measure (distance, force, mass, time) is equal to 1 is not arbitrary:
3for example the natural frequency is computed behind the scene by the OpenSeesPy framework, thus the stiffness of the structure divided by the mass should result in a unit of 1 (thus seconds). \n
4Furthermore, there are constants like the gravitational one g that is dependent on this decision. If the units are used in a consistent way (using this library), these issues can be avoided. \n
5Carmine Schipani, 2021
6"""
7
8
9# Fundamental
10m_unit = 1.0
11length_unit = "m" # It's the length unit associated with 1 (fundamental)
12N_unit = 1.0
13force_unit = "N" # It's the force unit associated with 1 (fundamental)
14s_unit = 1.0
15time_unit = "s" # It's the time unit associated with 1 (fundamental)
16
17# Distance
18mm_unit = m_unit*1e-3
19cm_unit = m_unit*1e-2
20dm_unit = m_unit*1e-1
21km_unit = m_unit*1e3
22inch_unit = m_unit*0.0254
23ft_unit = m_unit*0.3048
24mile_unit = m_unit*1609.34
25
26# Area
27mm2_unit = mm_unit*mm_unit
28cm2_unit = cm_unit*cm_unit
29dm2_unit = dm_unit*dm_unit
30m2_unit = m_unit*m_unit
31inch2_unit = inch_unit*inch_unit
32ft2_unit = ft_unit*ft_unit
33
34# Volume
35mm3_unit = mm_unit*mm_unit*mm_unit
36cm3_unit = cm_unit*cm_unit*cm_unit
37dm3_unit = dm_unit*dm_unit*dm_unit
38m3_unit = m_unit*m_unit*m_unit
39inch3_unit = inch_unit*inch_unit*inch_unit
40ft3_unit = ft_unit*ft_unit*ft_unit
41
42# Moment of inertia
43mm4_unit = mm3_unit*mm_unit
44cm4_unit = cm3_unit*cm_unit
45dm4_unit = dm3_unit*dm_unit
46m4_unit = m3_unit*m_unit
47inch4_unit = inch3_unit*inch_unit
48ft4_unit = ft3_unit*ft_unit
49
50# Force
51kN_unit = N_unit*1e3
52MN_unit = N_unit*1e6
53GN_unit = N_unit*1e9
54kip_unit = N_unit*4448.2216
55
56# Moment (and rotational stiffnes (moment-rotation))
57Nm_unit = N_unit*m_unit
58kNm_unit = kN_unit*m_unit
59MNm_unit = MN_unit*m_unit
60Nmm_unit = N_unit*mm_unit
61kNmm_unit = kN_unit*mm_unit
62MNmm_unit = MN_unit*mm_unit
63
64# Mass
65kg_unit = N_unit*s_unit**2/m_unit
66t_unit = kg_unit*1e3
67pound_unit = kg_unit*0.45359237
68
69# Pressure/Stress
70Pa_unit = N_unit/m2_unit
71kPa_unit = Pa_unit*1e3
72MPa_unit = Pa_unit*1e6
73GPa_unit = Pa_unit*1e9
74psi_unit = Pa_unit*6894.76
75ksi_unit = psi_unit*1000
76
77# Time
78min_unit = s_unit*60
79hours_unit = min_unit*60
80