Read Structural Model Data (.k file)#
To get the data (effective properties) from the output file (.k), use the
sgio.read_output_model() function.
import sgio
model = sgio.read_output_model(
file_name, # Name of the output file.
file_format, # Format of the output file.
model_type, # Type of the structural model.
)
file_name includes the .k extension. file_format can be 'vabs' for
VABS output or 'sc'/'swiftcomp' for SwiftComp output. model_type should
be chosen from a list of built-in keywords indicating the type of the
structural model. See Section Material and Structural Models for more details.
The function returns a structural model (Model).
Get Timoshenko Beam Properties from a VABS Output File#
Consider the following VABS output file
(sgio/examples/files/cs_box_t_vabs41.sg.K):
The 6X6 Mass Matrix
========================================================
5.8177756375E+00 0.0000000000E+00 0.0000000000E+00 0.0000000000E+00 3.7260617944E-01 -9.5280621981E+01
0.0000000000E+00 5.8177756375E+00 0.0000000000E+00 -3.7260617944E-01 0.0000000000E+00 0.0000000000E+00
0.0000000000E+00 0.0000000000E+00 5.8177756375E+00 9.5280621981E+01 0.0000000000E+00 0.0000000000E+00
0.0000000000E+00 -3.7260617944E-01 9.5280621981E+01 1.7135907226E+03 0.0000000000E+00 0.0000000000E+00
3.7260617944E-01 0.0000000000E+00 0.0000000000E+00 0.0000000000E+00 1.0380909063E+00 -4.9410599903E+00
-9.5280621981E+01 0.0000000000E+00 0.0000000000E+00 0.0000000000E+00 -4.9410599903E+00 1.7125526316E+03
The Mass Center of the Cross Section
========================================================
1.6377500254E+01 6.4046158301E-02
The 6X6 Mass Matrix at the Mass Center
========================================================
5.817775637474E+00 0.000000000000E+00 0.000000000000E+00 0.000000000000E+00 0.000000000000E+00 0.000000000000E+00
0.000000000000E+00 5.817775637474E+00 0.000000000000E+00 0.000000000000E+00 0.000000000000E+00 0.000000000000E+00
0.000000000000E+00 0.000000000000E+00 5.817775637474E+00 0.000000000000E+00 0.000000000000E+00 0.000000000000E+00
0.000000000000E+00 0.000000000000E+00 0.000000000000E+00 1.531084478603E+02 0.000000000000E+00 0.000000000000E+00
0.000000000000E+00 0.000000000000E+00 0.000000000000E+00 0.000000000000E+00 1.014226911963E+00 1.161297808140E+00
0.000000000000E+00 0.000000000000E+00 0.000000000000E+00 0.000000000000E+00 1.161297808140E+00 1.520942209484E+02
The Mass Properties with respect to Principal Inertial Axes
========================================================
Mass per unit span = 5.8177756375E+00
Mass moment of inertia i11 = 1.5310844786E+02
Principal mass moments of inertia i22 = 1.0053009590E+00
Principal mass moments of inertia i33 = 1.5210314690E+02
The principal inertial axes rotated from user coordinate system by
179.559622552555 degrees about the positive direction of x1 axis.
The mass-weighted radius of gyration = 5.1300440301E+00
The Geometric Center of the Cross Section
========================================================
1.1161263263E+01 1.1933318248E-01
The Area of the Cross Section
========================================================
Area = 1.9601033633E+01
Classical Stiffness Matrix (1-extension; 2-twist; 3,4-bending)
========================================================
3.0720493126E+08 -3.9135812366E+05 4.6917399239E+07 -4.2834130803E+09
-3.9135812366E+05 1.9429803967E+08 -6.4940288267E+04 5.6954183423E+06
4.6917399239E+07 -6.4940288267E+04 2.1613620627E+08 -6.7167229189E+08
-4.2834130803E+09 5.6954183423E+06 -6.7167229189E+08 6.3377360845E+10
Classical Compliance Matrix (1-extension; 2-twist; 3,4-bending)
========================================================
5.6510846844E-08 1.8599837341E-12 -4.1145399917E-10 3.8149731147E-09
1.8599837341E-12 5.1467459391E-09 9.9241222590E-14 -3.3575293615E-13
-4.1145399917E-10 9.9241222590E-14 4.7872765472E-09 2.2927003963E-11
3.8149731147E-09 -3.3575293615E-13 2.2927003963E-11 2.7385973248E-10
The Tension Center of the Cross Section
========================================================
1.3943176570E+01 1.5272342352E-01
The extension stiffness EA 3.0720414298E+08
The torsional stiffness GJ 1.9429752543E+08
Principal bending stiffness EI22 2.0888195275E+08
Principal bending stiffness EI33 3.6530578162E+09
The principal bending axes rotated from the user coordinate system by
0.291037904417929 degrees about the positive direction of x1 axis.
The following code (sgio/examples/read_vabs_output_h.py) shows how to read
the output file and get some Timoshenko beam properties:
"""Example: Read VABS Homogenized Output (Beam Properties)
This example demonstrates how to read VABS homogenized output to obtain
the effective beam properties (stiffness matrix, mass matrix, etc.).
The example reads a VABS 4.1 output file (.K file) for a Timoshenko beam model.
"""
import logging
from pathlib import Path
import sgio
logging.basicConfig(level=logging.INFO)
cwd = Path(__file__).resolve().parent
# Define the output file path
# Note: The .K file contains homogenized beam properties
output_file = str(cwd / 'cs_box_t_vabs41.sg.K')
# Read the VABS homogenized output
# - file_format='vabs': Specifies VABS format
# - model_type='BM2': Timoshenko beam model (includes shear deformation)
model = sgio.read_output_model(
str(output_file),
file_format='vabs',
model_type='BM2'
)
# Extract beam properties using direct typed attributes
ea = model.ea # Axial stiffness
gj = model.gj # Torsional stiffness
ei22 = model.ei22 # Bending stiffness about axis 2
ei33 = model.ei33 # Bending stiffness about axis 3
# Print the extracted beam properties
print(f"Axial Stiffness (EA): {ea:.3e} N")
print(f"Torsional Stiffness (GJ): {gj:.3e} N*m^2")
print(f"Bending Stiffness about axis 2 (EI22): {ei22:.3e} N*m^2")
print(f"Bending Stiffness about axis 3 (EI33): {ei33:.3e} N*m^2")
The output should be:
EA = 1653700.125
GJ = 6322.4210975
EI22 = 79466.796504
EI33 = 200742.66655
For named beam properties such as ea, gj, ei22, and ei33, prefer the
direct model attributes. Use the typed section-query methods only when you need
matrix or theory-schema quantities.