This live script is written as a guided walkthrough for a post-processing workflow. It focuses on retrieving, organizing, and visualizing model or response data after an OpenSees analysis. Read the text cells first, then run each code cell in order so that the variables, model state, and recorded results are available for the later sections.
This example demonstrates how to read a GMSH model by physical groups and convert it to an OpenSeesPy model using the Gmsh2OPS class.
In the example above, we defined the following physical groups for converting OpenSees elements. Volume 1 is used to generate elements, while the boundary consists of the bottom 1 surface, 4 lines, and 4 points!
ops.wipe()% Initialize a basic 3D model with 3 degrees of freedom per nodeops.model("basic","-ndm",3,"-ndf",3)% Define an elastic isotropic material% Material ID: 1% Elastic modulus: 3e7% Poisson's ratio: 0.2% Density: 2.55matTag=1;ops.nDMaterial("ElasticIsotropic",matTag,3e7,0.2,2.55)% Create OpenSeesPy node commands based on all nodesg2o.createNodeCmds();% Create OpenSeesPy element commands for specific entities% FourNodeTetrahedron elements%eleTags=g2o.createElementCmds(..."FourNodeTetrahedron",... % OpenSeesPy element typeOpsEleArgs={matTag},... % Additional arguments for the element (e.g., mat tag)PhysicalGroupNames="Volume");% fixed nodesfix_node_tags=g2o.getNodeTags(PhysicalGroupNames="Boundary");fori=1:numel(fix_node_tags)ops.fix(fix_node_tags(i),1,1,1);end% If there are too many geometries on the boundary, you can iterate through and extract all lines and points on a geometry using the following commands:boundary_dim_tags=g2o.getBoundaryDimTags(DimEntityTags=[2,18],IncludeSelf=true);disp(boundary_dim_tags);
Output
0 1
0 2
0 9
0 13
1 1
1 8
1 13
1 17
2 18
1
disp(physicalGroups("Boundary"));
Output
0 1
0 2
0 9
0 13
1 1
1 8
1 13
1 17
2 18
1
opsMAT.vis.plotModel();
Output
[OpenSeesMatlab] Model summary
Nodes: 166
Solid elements: 473
We can apply the load by extracting the elements belonging to surface with tag 27: First, we convert the element to which the surface load is applied to SurfaceLoad Element, and then we can apply the surface load to it:
12345
pressure=-1;load_ele_tags=g2o.createElementCmds(..."TriSurfaceLoad",... % OpenSeesPy element typeOpsEleArgs={pressure},... % Additional arguments for the elementPhysicalGroupNames="Load");
Output
[OpenSees] TriSurfaceLoad element - Written: J. A. Abell (UANDES). Inspired by the makers of SurfaceLoad