Skip to content

Quick Model and Eigen Visualization¤

At any point during model creation, you can run the ops.vis.plotModel() or ops.vis.plotEigen() to visualize the current model’s geometric details and eigen modes.

Model visualization¤

1
2
clear
clc

First, instantiate the OpenSeesMatlab interface class. This class provides native OpenSees commands, as well as additional visualization, pre/post-processing, and utility methods.

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

For example, the tool property provides a function loadExamples to run some built-in models. Of course, you can run your own model; the built-in model is used here for demonstration purposes only.

1
2
3
ops.wipe();
opsMAT.utils.loadExamples("ArchBridge2");
% or your model here

We can visualize the model using the plotModel function in the vis attribute.

1
opsMAT.vis.plotModel();
Output
[OpenSeesMatlab] Model summary Nodes: 241 Beam elements: 367 Shell elements: 72
figure_0.png

We can retrieve data from the current model, which returns a nested struct. You can view the data using MATLAB's workspace variables.

1
2
modelData = opsMAT.post.getModelData();
disp(modelData)
Output
Nodes: [1x1 struct] Fixed: [1x1 struct] MPConstraint: [1x1 struct] Loads: [1x1 struct] Elements: [1x1 struct] NumNode: 241 NumElement: 439

Finally, we can customize the control parameters for model visualization. Let's first take a look at the default parameter settings.

1
2
opts = opsMAT.vis.defaultPlotModelOptions;
disp(opts)
Output
general: [1x1 struct] style: [1x1 struct] nodes: [1x1 struct] elements: [1x1 struct] fixed: [1x1 struct] mpConstraint: [1x1 struct] localAxes: [1x1 struct] loads: [1x1 struct] outline: [1x1 struct] summary: [1x1 struct] performance: [1x1 struct]

Then

1
2
3
4
5
6
opts.nodes.show = true;
opts.nodes.size = 20;
opts.nodes.showLabels = true;


opsMAT.vis.plotModel(opts=opts);
Output
[OpenSeesMatlab] Model summary Nodes: 241 Beam elements: 367 Shell elements: 72
1
axis off
figure_1.png

Eigen visualization¤

First, we need to save the eigenvalue analysis results data for future reuse.

Then, data is retrieved from the file, returning a nested structure that stores the various results of the eigenvalue analysis.

1
2
3
4
tag = 1;
opsMAT.post.saveEigenData(tag, 10, solver='-genBandArpack');  % save
eigenData = opsMAT.post.getEigenData(odbTag=tag);  % get
disp(eigenData)
Output
EigenVectors: [1x1 struct] InterpolatedEigenVectors: [1x1 struct] ModalProps: [1x1 struct] ModelInfo: [1x1 struct] ModeTags: [10x1 double]

Using this data, we can visualize the first modal shapes.

1
opsMAT.vis.plotEigen(1, eigenData);
figure_2.png

and 5th

1
opsMAT.vis.plotEigen(5, eigenData);
figure_3.png

Similarly, we obtain the default parameters.

1
2
opts = opsMAT.vis.defaultPlotEigenOptions;
disp(opts)
Output
general: [1x1 struct] mode: [1x1 struct] color: [1x1 struct] line: [1x1 struct] unstructured: [1x1 struct] scalar: [1x1 struct] nodes: [1x1 struct] fixed: [1x1 struct] mpConstraint: [1x1 struct] performance: [1x1 struct]

For example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
opts.color.useColormap = true;
% opts.color.colormap = jet(256);
modeTags = [1 3 5 7];
cmps = {"parula", "turbo", "cool", "winter"};


% Create a figure at position (100,100) with width=1200px and height=900px
figure('Position', [100, 100, 1200, 900]);
for i = 1:4
    subplot(2,2,i)
    ax = gca();
    opsMAT.vis.plotEigen(modeTags(i), eigenData, opts=opts, ax=ax);
    axis off;
    colormap(ax, cmps{i});
end
figure_4.png