Getting started
To start using OpenSG, open a Python console or IDE like Spyder and import the package:
import opensg
OpenSG comes with a simple getting started example.
This script shows how to use the OpenSG package to:
Load mesh data from a YAML file
Create a BladeMesh object
Generate segment meshes
Compute ABD and stiffness matrices for each segment
Save the results
import time
from pathlib import Path
from opensg.mesh.segment import ShellBounMesh
import opensg.utils.shell as utils
tic = time.time()
mesh_yaml = Path('data') / 'Shell_1DSG' / '1Dshell_28.yaml'
segment_mesh = ShellBounMesh(mesh_yaml)
meshdata = segment_mesh.meshdata
ABD, mass = segment_mesh.compute_ABD() # MSG based ABD matrix
print('ABD time', str(time.time() - tic))
# Timoshenko stiffness and mass amtrix
Deff_srt = segment_mesh.compute_timo(ABD)[0]
mass = utils.get_mass_shell(meshdata, mass)
print('Cross-Section', 'Origin:', meshdata['origin'], '\n')
print('1D mass \n', mass)
print('1D Timo \n ', Deff_srt)
print('\n Time Taken: 1D yaml', str(time.time() - tic))
See Examples for more information on downloading and running examples.