Skip to content

Download MATLAB script

Static analysis and visualization of 2D Portal Frame¤

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.

See the original example in opsvis.

1
clc; clear; close all;

First, instantiate the class and obtain the OpenSees interface.

1
2
opsMAT = OpenSeesMatlab();
ops = opsMAT.opensees;

Model construction and load application¤

This section creates the finite-element idealization used by the rest of the example. Check the dimensions, tags, and connectivity here before moving on.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
ops.wipe();
ops.model('basic', '-ndm', 2, '-ndf', 3);

colL = 4.0;
girL = 6.0;

Acol  = 2.0e-3;
Agir  = 6.0e-3;
IzCol = 1.6e-5;
IzGir = 5.4e-5;

E = 200.0e9;

ops.node(1, 0.0,   0.0);
ops.node(2, 0.0,   colL);
ops.node(3, girL,  0.0);
ops.node(4, girL,  colL);

ops.fix(1, 1, 1, 1);
ops.fix(3, 1, 1, 0);

ops.geomTransf('Linear', 1);

% columns
ops.element('elasticBeamColumn', 1, 1, 2, Acol, E, IzCol, 1);
ops.element('elasticBeamColumn', 2, 3, 4, Acol, E, IzCol, 1);

% girder
ops.element('elasticBeamColumn', 3, 2, 4, Agir, E, IzGir, 1);

% ops.section('Elastic', 1, E, Agir, IzGir, E/2, 0.75)
% ops.beamIntegration('Lobatto', 1, 1, 5)
% ops.element('forceBeamColumn', 3, 2, 4, 1, 1)

Px =  2.0e3;
Wy = -10.0e3;
Wx =  0.0;
ops.timeSeries('Linear', 1);
ops.pattern('Plain', 1, 1);
ops.load(2, Px, 0.0, 0.0);
ops.eleLoad('-ele', 3, '-type', '-beamUniform', Wy, Wx);
1
modelData = opsMAT.post.getModelData();
1
2
3
4
5
opts = opsMAT.vis.defaultPlotModelOptions;
opts.loads.showNodal = true;
opts.loads.showElement = true;
opts.loads.scale = 1.2;
opsMAT.vis.plotModel(opts=opts);
Output
[OpenSeesMatlab] Model summary Nodes: 4 Beam elements: 3
figure_0.png
1
opsMAT.vis.plotModelGUI();

Static analysis¤

This section configures and runs the analysis. The solver, constraints, convergence test, and step size should be read together because they control numerical robustness.

1
ODB = opsMAT.post.createODB("myODB", interpolateBeamDisp=11);
Output
Output file: .openseesmatlab.output\Responses-myODB.odb\output.h5
1
2
3
4
5
6
7
8
Nsteps = 10;
ops.constraints('Transformation');
ops.numberer('RCM');
ops.system('BandGeneral');
ops.test('NormDispIncr', 1.0e-6, 6, 2);
ops.algorithm('Linear');
ops.integrator('LoadControl', 1 / Nsteps);
ops.analysis('Static');
1
ops.analyze(Nsteps);

Results visualization¤

This section collects the quantities of interest from the analysis. The recorded data are used later for plotting, verification, or post-processing.

1
2
3
4
nodeResp = opsMAT.post.getNodalResponse("myODB");

opsMAT.vis.plotNodalResponse(nodeResp, stepIdx="absMax");
grid off
figure_1.png
1
2
3
4
5
eleResp = opsMAT.post.getElementResponse("myODB", eleType="Frame");

opsMAT.vis.plotFrameResponse(eleResp, ...
    stepIdx="absMax", respType="sectionForces", respComponent="MZ");
grid off
figure_2.png
1
2
3
4
5
6
opts = opsMAT.vis.defaultPlotFrameResponseOptions;
opts.style = "wireframe";
opsMAT.vis.plotFrameResponse(eleResp, ...
    stepIdx="absMax", respType="sectionForces", respComponent="Mz",...
    opts=opts);
grid off
figure_3.png
1
2
3
4
5
opts.color.useColormap = false;
opsMAT.vis.plotFrameResponse(eleResp, ...
    stepIdx="absMax", respType="sectionForces", respComponent="N",...
    opts=opts);
grid off
figure_4.png
1
2
3
4
opsMAT.vis.plotFrameResponse(eleResp, ...
    stepIdx="absMax", respType="sectionForces", respComponent="VY",...
    opts=opts);
grid off
figure_5.png
1
2
3
4
opsMAT.vis.plotFrameResponse(eleResp, ...
    stepIdx="absMax", respType="basicForces", respComponent="MZ",...
    opts=opts);
grid off
figure_6.png
1
2
3
4
opsMAT.vis.plotFrameResponse(eleResp, ...
    stepIdx="absMax", respType="localForces", respComponent="FY",...
    opts=opts);
grid off
figure_7.png

Visualization based on Matlab GUI¤

1
opsMAT.vis.plotModelGUI();

image_0.png

1
opsMAT.vis.plotNodalResponseGUI(nodeResp);

image_1.png

1
opsMAT.vis.plotFrameResponseGUI(eleResp);

image_2.png

Visualization based on Polyscope GUI¤

1
opsMAT.vis.polyscope.plotModel();
Output
[OpenSeesMatlab] Backend: openGL3_glfw -- Loaded openGL version: 3.3.0 NVIDIA 561.09

image_3.png

1
opsMAT.vis.polyscope.plotNodalResponse(nodeResp);

image_4.png

1
opsMAT.vis.polyscope.plotFrameResponse(eleResp);
Output
[OpenSeesMatlab] Backend: openGL3_glfw -- Loaded openGL version: 3.3.0 NVIDIA 561.09

image_5.png