Skip to content

Download MATLAB script

Quick Model and Eigen Visualization¤

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.

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¤

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
clc; clear; close all;

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)

Then

1
2
3
4
5
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

Visualization based on Matlab GUI¤

1
opsMAT.vis.plotModelGUI();

image_0.png

Visualization based on Polyscope GUI¤

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

image_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.help)

For example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
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

Visualization based on Matlab GUI¤

1
opsMAT.vis.plotEigenGUI(eigenData);
figure_5.png

image_2.png

Visualization based on Polyscope GUI¤

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

image_3.png