### Complete Analysis Workflow Source: https://openseesmatlab.readthedocs.io/en/latest/getting_started/post A full example demonstrating model setup, ODB creation, analysis execution, and basic deformation plotting. ```matlab % 1. Setup opsMAT = OpenSeesMatlab(); ops = opsMAT.opensees; % 2. Build your model ops.wipe(); ops.model("BasicBuilder", "-ndm", 3, "-ndf", 6); % ... nodes, elements, materials, loads ... % 3. Create ODB (before analysis) odbTag = "myODB"; ODB = opsMAT.post.createODB(odbTag); % 4. Run analysis ops.analyze(100, 0.01); % run analysis and record results ODB.close(); ops.wipe(); % 5. Retrieve and visualize nodeResp = opsMAT.post.getNodalResponse("myODB"); opsMAT.vis.plotDeformation(nodeResp, stepIdx="absMax"); ``` -------------------------------- ### Load and Visualize an Example Model Source: https://openseesmatlab.readthedocs.io/en/latest/api/OpenSeesMatlabTool Demonstrates initializing the OpenSeesMatlab object, loading a specific example model, and performing post-processing and visualization. ```matlab opsmat = OpenSeesMatlab(); opsmat.utils.loadExamples("Frame3D"); modelInfo = opsmat.post.getModelData(); h = opsmat.vis.plotModel(); ``` ```matlab opsmat = OpenSeesMatlab(); opsmat.utils.loadExamples("Frame3D"); opsmat.post.getModelData(); opsmat.vis.plotModel(); ``` -------------------------------- ### Install OpenSeesMatlab Source: https://openseesmatlab.readthedocs.io/en/latest/getting_started/installation Run these commands in the directory where the release was extracted to complete the installation. ```matlab cd('path_to_openseesmatlab_directory'); installOpenSeesMatlab; ``` -------------------------------- ### Load Example Model Syntax Source: https://openseesmatlab.readthedocs.io/en/latest/api/OpenSeesMatlabTool The syntax for invoking the loadExamples method on the utility object. ```matlab obj.loadExamples(modelName) ``` -------------------------------- ### Initialize OpenSeesMatlab Environment Source: https://openseesmatlab.readthedocs.io/en/latest/examples/opscmds/earthquake/earthquake_Two_Story_Steel_MRF.m Setup the OpenSeesMatlab interface and prepare the output directory for simulation data. ```matlab clear; clc; close all; opsMAT = OpenSeesMatlab; ops = opsMAT.opensees; opsvis = opsMAT.vis; outputDir = fullfile(pwd, 'output_data/FGU_2SSMRF_files'); if ~exist(outputDir, 'dir') mkdir(outputDir); end data = build_model(ops, outputDir); opsvis.polyscope.plotModel(); ops.wipe(); ``` -------------------------------- ### Full Model Workflow Example Source: https://openseesmatlab.readthedocs.io/en/latest/api/OpenSeesMatlab Demonstrates initializing the interface, defining a simple model, and performing post-processing and visualization. ```matlab opsmat = OpenSeesMatlab(); ops = opsmat.opensees; ops.wipe(); ops.model('basic', '-ndm', 2, '-ndf', 3); ops.node(1, 0.0, 0.0); ops.node(2, 5.0, 0.0); ops.fix(1, 1, 1, 1); ops.fix(2, 0, 1, 0); % Define materials, sections, elements, loads, and analysis commands. % The calls follow OpenSees/OpenSeesPy-style command arguments. % ops.uniaxialMaterial(...); % ops.element(...); % ops.timeSeries(...); % ops.pattern(...); modelInfo = opsmat.post.getModelData(); h = opsmat.vis.plotModel(); ``` -------------------------------- ### Select specific installation and GPU Source: https://openseesmatlab.readthedocs.io/en/latest/getting_started/extensions/cudss_solver Explicitly define the CUDA major version, installation paths, and target GPU device. ```matlab ops.system("CuDSS", ... "-cudaMajor", 12, ... "-cudaPath", "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.6", ... "-cudssPath", "C:\Program Files\NVIDIA cuDSS\v0.8", ... "-device", 0, ... "-refinement", 0); ``` ```matlab ops.system("CuDSS", ... "-cudaMajor", 12, ... "-cudaPath", "D:\runtimes\cuda12", ... "-cudssPath", "D:\runtimes\cudss08", ... "-device", 0); ``` -------------------------------- ### Apply Constraints and Element Setup Source: https://openseesmatlab.readthedocs.io/en/latest/examples/opscmds/structural/structural_steel_frame2d.m Fix base nodes and initialize beam integration tags. ```matlab ops.fix(1, 1, 1, 1); ops.fix(2, 1, 1, 1); ops.fix(3, 1, 1, 1); % Assign beam-integration tags ColIntTag1 = 1; ColIntTag2 = 2; BeamIntTag1 = 3; BeamIntTag2 = 4; BeamIntTag3 = 5; ``` -------------------------------- ### Post-Processing Workflow Example Source: https://openseesmatlab.readthedocs.io/en/latest/api/OpenSeesMatlabPost A complete workflow demonstrating model building, metadata saving, and eigenvalue data collection. ```matlab opsmat = OpenSeesMatlab(); ops = opsmat.opensees; % Build model with ops... % ops.wipe(); % ops.model(...); % ops.node(...); % ops.element(...); post = opsmat.post; post.setOutputDir(".openseesmatlab.output"); modelInfo = post.getModelData(); post.saveModelData("ModelA"); eigenData = post.getEigenData(numModes=3, solver="-genBandArpack"); post.saveEigenData("ModelA", 3, solver="-genBandArpack"); ``` -------------------------------- ### Custom Constructor Initialization Source: https://openseesmatlab.readthedocs.io/en/latest/api/OpenSeesMatlab Example of initializing the interface with custom MEX module parameters. ```matlab opsmat = OpenSeesMatlab(); ops = opsmat.opensees; opsmatCustom = OpenSeesMatlab( ... mexName="OpenSeesMATLAB", ... mexDir="derived/"); ``` -------------------------------- ### Initialize OpenSeesMatlab Environment Source: https://openseesmatlab.readthedocs.io/en/latest/examples/post/section/post_plot_fiber_section.m Setup the OpenSees environment and enable the fiber cross-section geometry recorder. ```matlab clc; clear; opsMAT = OpenSeesMatlab(); ops = opsMAT.opensees; ops.wipe(); ops.model('basic', '-ndm', 2, '-ndf', 3); % 2D frame % For demonstration purposes only ops.uniaxialMaterial('Elastic', 1, 1) ops.uniaxialMaterial('Elastic', 2, 1) ops.uniaxialMaterial('Elastic', 3, 1) ops.uniaxialMaterial('Elastic', 4, 1) ops.uniaxialMaterial('Elastic', 5, 1) opsMAT.pre.setSectionGeometryRecorder(true) ``` -------------------------------- ### loadExamples(modelName) Source: https://openseesmatlab.readthedocs.io/en/latest/api/OpenSeesMatlabTool Loads a specified bundled example model into the active OpenSees interface. This method allows users to quickly initialize predefined models for inspection, analysis, or visualization. ```APIDOC ## loadExamples(modelName) ### Description Loads a bundled example model into the active OpenSees interface. The model is executed against the command interface stored in the parent object, allowing subsequent operations via post-processing or visualization modules. ### Syntax `obj.loadExamples(modelName)` ### Parameters - **modelName** (string) - Required - The name of the example model to load. Supported values: "Frame3D", "ArchBridge", "ArchBridge2", "CableStayedBridge", "SuspensionBridge", "TrussBridge", "Dam". ### Example ```matlab opsmat = OpenSeesMatlab(); opsmat.utils.loadExamples("Frame3D"); opsmat.post.getModelData(); opsmat.vis.plotModel(); ``` ``` -------------------------------- ### Verify Installation Source: https://openseesmatlab.readthedocs.io/en/latest/getting_started/installation Execute these commands in a new MATLAB session to confirm the toolbox and MEX module are correctly loaded. ```matlab opsMat = OpenSeesMatlab(); opsMat.version opsMat.opensees.wipe(); ``` -------------------------------- ### Load and Visualize Model Source: https://openseesmatlab.readthedocs.io/en/latest/examples/post/basic/post_quick_plot.m Load a built-in example model and display its geometric details. ```matlab ops.wipe(); opsMAT.utils.loadExamples("ArchBridge2"); opsMAT.vis.plotModel(); ``` -------------------------------- ### Check Installation Path Source: https://openseesmatlab.readthedocs.io/en/latest/getting_started/installation Use this command to identify which installation of OpenSeesMatlab is being resolved by MATLAB. ```matlab which OpenSeesMatlab -all ``` -------------------------------- ### Using OpenSeesMatlabPre Utilities Source: https://openseesmatlab.readthedocs.io/en/latest/api/OpenSeesMatlabPre Example demonstrating section geometry recording, fiber section definition, and global matrix extraction. ```matlab opsmat = OpenSeesMatlab(); ops = opsmat.opensees; ops.wipe(); ops.model('basic', '-ndm', 2, '-ndf', 3); opsmat.pre.setSectionGeometryRecorder(true); ops.section('Fiber', 1, '-GJ', 1.0e6); ops.patch('rect', 1, 10, 10, -0.2, -0.3, 0.2, 0.3); opsmat.pre.plotSection(1); opsmat.pre.setSectionGeometryRecorder(false); nodeMass = opsmat.pre.getNodeMass(); K = opsmat.pre.getMCK('k'); ``` -------------------------------- ### Configure Element Recorders Source: https://openseesmatlab.readthedocs.io/en/latest/examples/post/visualization/post_soil_structure_interaction_2d_portal_frame.m Commented-out examples for recording element deformations, forces, and fiber stresses/strains. ```matlab % ops.recorder('Element', '-ele', 1, 2, '-file', 'Deformation12.out', '-time', 'section', 2, 'deformations'); % ops.recorder('Element', '-ele', 1, 2, '-file', 'Force12.out', '-time', 'section', 2, 'force'); % % ops.recorder('Element', '-ele', 3, 4, '-file', 'Deformation34.out', '-time', 'section', 2, 'deformations'); % ops.recorder('Element', '-ele', 3, 4, '-file', 'Force34.out', '-time', 'section', 2, 'force'); % % ops.recorder('Element', '-ele', 7, 9, '-file', 'Deformation79.out', '-time', 'section', 3, 'deformations'); % ops.recorder('Element', '-ele', 7, 9, '-file', 'Force79.out', '-time', 'section', 3, 'force'); % % ops.recorder('Element', '-ele', 7, '-time', '-file', 'steelstress7.out', 'section', 3, 'fiber', -0.2286, 0.2286, 'stress'); % ops.recorder('Element', '-ele', 7, '-time', '-file', 'steelstrain7.out', 'section', 3, 'fiber', -0.2286, 0.2286, 'strain'); % ops.recorder('Element', '-ele', 7, '-time', '-file', 'concretestress7.out', 'section', 3, 'fiber', 0.0, 0.0, 'stress'); % ops.recorder('Element', '-ele', 7, '-time', '-file', 'concretestrain7.out', 'section', 3, 'fiber', 0.0, 0.0, 'strain'); ``` -------------------------------- ### Perform Moment-Curvature Analysis Source: https://openseesmatlab.readthedocs.io/en/latest/api/OpenSeesMatlabAnalysis Example workflow for initializing a section, running an analysis, and generating an interaction surface. ```matlab opsmat = OpenSeesMatlab(); mc = opsmat.anlys.MomentCurvature; mc.new(secTag, axialForce); mc.analyze('axis','y','maxPhi',0.05,'incrPhi',1e-4); mc.plotMPhi(); [phiU, MU] = mc.getLimitState('matTag',1,'threshold',-0.003); mc.bilinearize(phiY, MY, phiU, 'plot', true); mc.buildNMM('NList', linspace(-2000e3,0,10)', ... 'phiMax',0.05,'nTheta',36,'useParallel',true); mc.plotNMM(); ``` -------------------------------- ### Trace Trial and Commit Lifecycle Source: https://openseesmatlab.readthedocs.io/en/latest/getting_started/extensions/substructure_analysis Example sequence of trial calls and state transitions during an analysis step. ```text trial call 1: callback("trial", trial1, S0) returns candidate S1a trial call 2: callback("trial", trial2, S0) returns candidate S1b trial call 3: callback("trial", trial3, S0) returns candidate S1c commit: accepted candidate S1c becomes the new committed state S1 next step: every new trial receives S1, not S0 ``` -------------------------------- ### Initialize and use Polyscope visualization Source: https://openseesmatlab.readthedocs.io/en/latest/api/OpenSeesMatlabVisPolyscope Basic setup for initializing the OpenSeesMatlab interface and launching interactive model and response viewers. ```matlab opsMAT = OpenSeesMatlab(); % Interactive model viewer opsMAT.vis.polyscope.plotModel(); % Interactive response viewer nodeResp = opsMAT.post.getNodalResponse("myODB"); opsMAT.vis.polyscope.plotNodalResponse(nodeResp); ``` -------------------------------- ### View cuDSS runtime diagnostics Source: https://openseesmatlab.readthedocs.io/en/latest/getting_started/extensions/cudss_solver Example output showing the loaded runtime and selected GPU device. ```text CuDSS: loaded CUDA 12 and cuDSS 0.8 at runtime CuDSS: selected GPU 0 (compute capability 8.6) ``` -------------------------------- ### Implement a Linear Callback Material Source: https://openseesmatlab.readthedocs.io/en/latest/getting_started/extensions/matlab_uniaxialmaterial This example demonstrates the full workflow of defining a linear constitutive model, setting up the OpenSees model, and executing a static analysis. ```matlab clc; clear; opsMAT = OpenSeesMatlab(); ops = opsMAT.opensees; ops.wipe(); cleanup = onCleanup(@() ops.wipe()); %#ok %% Material state % Define the complete state schema before creating the material. The callback % updates field values, but it does not add or remove fields. K = 1000.0; initialState = struct( ... "K", K, ... "lastStrain", 0.0, ... "trialEvaluationCount", 0); %% Model and callback material ops.model("basic", "-ndm", 1, "-ndf", 1); ops.node(1, 0.0); ops.node(2, 0.0); ops.fix(1, 1); ops.uniaxialMaterial( ... "MatlabUniaxialMaterial", ... 1, ... % material tag @linearCallback, ... % MATLAB constitutive callback initialState, ... % complete initial history state K); % initial tangent % zeroLength creates and owns a copy of material 1. ops.element("zeroLength", 1, 1, 2, ... "-mat", 1, "-dir", 1); %% Unit static load ops.timeSeries("Linear", 1); ops.pattern("Plain", 1, 1); ops.load(2, 1.0); ops.constraints("Plain"); ops.numberer("Plain"); ops.system("BandGeneral"); ops.test("NormDispIncr", 1.0e-12, 10); ops.algorithm("Newton"); ops.integrator("LoadControl", 1.0); ops.analysis("Static"); status = ops.analyze(1); assert(status == 0); % For K=1000 and P=1, the exact displacement is P/K=0.001. displacement = ops.nodeDisp(2, 1); force = ops.eleResponse(1, "material", 1, "stress"); assert(abs(displacement - 0.001) < 1.0e-12); assert(abs(force - 1.0) < 1.0e-12); ops.wipe(); %% Constitutive callback function [response, trialState, status] = ... linearCallback(action, trial, committedState) % Start from a copy of accepted history on every call. Never start from a % previous trial evaluation because Newton may abandon that trial. trialState = committedState; status = 0; switch action case "init" % initialState already contains every required field. Keep the schema % unchanged and return the zero-strain initial response. trialState.lastStrain = trial.strain; trialState.trialEvaluationCount = 0; case "trial" % This is candidate history. C++ commits it only after OpenSees accepts % the analysis step. trialState.lastStrain = trial.strain; trialState.trialEvaluationCount = ... committedState.trialEvaluationCount + 1; otherwise % Current versions call MATLAB only for init and trial. status = -1; end % A linear law has no path dependence, but response is still evaluated from % the supplied trial strain and the state-owned stiffness. response = struct( ... "stress", committedState.K * trial.strain, ... "tangent", committedState.K); end ``` -------------------------------- ### Configure Custom EleResp Field Layouts Source: https://openseesmatlab.readthedocs.io/en/latest/api/OpenSeesMatlabVis Detailed examples showing how to map custom EleResp fields to specific response locations. ```matlab % Element scalar: EleResp.MyScalar = [nStep x nEle] responseLocation="element" % Node scalar: EleResp.MyScalarAtNode = [nStep x nNode] responseLocation="node" % Element vector: EleResp.MyVector.data = [nStep x nEle x nComp] EleResp.MyVector.dofs = {'c1','c2',...} responseLocation="element" % Node vector: EleResp.MyVectorAtNode.data = [nStep x nNode x nComp] EleResp.MyVectorAtNode.dofs = {'c1','c2',...} responseLocation="node" % Element Layout-C: EleResp.MyLayoutC.c1 = [nStep x nEle] responseLocation="element" EleResp.MyLayoutC.c1 = [nStep x nEle x nGP] responseLocation="gp" EleResp.MyLayoutC.c1 = [nStep x nEle x nGP x nFiber] responseLocation="gp" % Node Layout-C: EleResp.MyLayoutCAtNode.c1 = [nStep x nNode] responseLocation="node" EleResp.MyLayoutCAtNode.c1 = [nStep x nNode x nFiber] responseLocation="node" ``` -------------------------------- ### Define Model Components Source: https://openseesmatlab.readthedocs.io/en/latest/getting_started/overview Example of defining materials, elements, and analysis integrators using standard OpenSees command syntax. ```matlab ops.uniaxialMaterial('Elastic', 1, 200.0e9); ops.element('Truss', 1, 1, 2, 2.0e-3, 1); ops.integrator('LoadControl', 0.1); ``` -------------------------------- ### Model Setup and Element Definition Source: https://openseesmatlab.readthedocs.io/en/latest/examples/post/basic/post_get_resp_odb.m Configures geometric transformations, beam integration, and element connectivity for the finite element model. ```matlab % Geometric transformation for beams ops.geomTransf("Linear", 2, 1.0, 1.0, 0.0); % Number of beam integration points (sections); np = 3; ops.beamIntegration("Lobatto", beamSec, beamSec, np); % Create the beam ops.elements eleType = "forceBeamColumn"; % tag ndI ndJ transfTag integrationTag ops.element(eleType, 13, 5, 6, 2, beamSec); ops.element(eleType, 14, 6, 7, 2, beamSec); ops.element(eleType, 15, 7, 8, 2, beamSec); ops.element(eleType, 16, 8, 5, 2, beamSec); ops.element(eleType, 17, 10, 11, 2, beamSec); ops.element(eleType, 18, 11, 12, 2, beamSec); ops.element(eleType, 19, 12, 13, 2, beamSec); ops.element(eleType, 20, 13, 10, 2, beamSec); ops.element(eleType, 21, 15, 16, 2, beamSec); ops.element(eleType, 22, 16, 17, 2, beamSec); ops.element(eleType, 23, 17, 18, 2, beamSec); ops.element(eleType, 24, 18, 15, 2, beamSec); dofs = ops.sectionResponseType(1, 1); % Plot Model % This section creates the finite-element idealization used by the rest of the % example. Check the dimensions, tags, and connectivity here before moving on. opsMAT.vis.plotModel(); ``` -------------------------------- ### Plot Deformation Example Source: https://openseesmatlab.readthedocs.io/en/latest/api/OpenSeesMatlabVis Example usage of plotDeformation with custom parameters. ```matlab nodeRespData = opsmat.post.getNodalResponse("MyODB"); opsmat.vis.plotDeformation(nodeRespData, ... stepIdx="absMax", ... color="red", ... useInterpolation=true, ... scaleFactor=20, ... showUndeformed=true); ``` -------------------------------- ### Configure and Run Static Analysis Source: https://openseesmatlab.readthedocs.io/en/latest/getting_started/quickstart Set up the analysis parameters and execute the solver, checking the return code for convergence. ```matlab ops.system('BandSPD'); ops.numberer('RCM'); ops.constraints('Plain'); ops.integrator('LoadControl', 1.0); ops.algorithm('Linear'); ops.analysis('Static'); ok = ops.analyze(1); assert(ok == 0, 'OpenSees analysis did not converge.'); ``` -------------------------------- ### getTime() Source: https://openseesmatlab.readthedocs.io/en/latest/api/OpenSeesMatlabCmds Get the current time in the domain. ```APIDOC ## getTime() ### Description Get the current time in the domain. ### Returns - **result** (numeric scalar) - The current time. ``` -------------------------------- ### Configure and Run Static Analysis Source: https://openseesmatlab.readthedocs.io/en/latest/examples/extension/substruct/extension_substructure_linear.m Set up the analysis parameters and execute a single load step. ```matlab ops.constraints("Plain"); ops.numberer("Plain"); ops.system("BandGeneral"); ops.test("NormUnbalance", 1.0e-12, 10); ops.algorithm("Newton"); ops.integrator("LoadControl", 1.0); ops.analysis("Static"); ok = ops.analyze(1); if ok ~= 0 error("Linear substructure analysis failed with code %d.", ok); end ``` -------------------------------- ### getNodeTags(varargin) Source: https://openseesmatlab.readthedocs.io/en/latest/api/OpenSeesMatlabCmds Get all nodes in the domain or in a mesh. ```APIDOC ## getNodeTags(varargin) ### Description Get all nodes in the domain or in a mesh. ### Parameters - **varargin** (optional) - Optional - Use '-mesh', mtag to filter by mesh. ### Returns - **result** (numeric vector) - The tags of all nodes in the domain or mesh. ``` -------------------------------- ### getEleTags(varargin) Source: https://openseesmatlab.readthedocs.io/en/latest/api/OpenSeesMatlabCmds Get all elements in the domain or in a mesh. ```APIDOC ## getEleTags(varargin) ### Description Get all elements in the domain or in a mesh. ### Parameters - **varargin** (optional) - Optional - Use '-mesh', mtag to filter by mesh. ### Returns - **result** (numeric vector) - The tags of all elements in the domain or mesh. ``` -------------------------------- ### getDiagnostics() Source: https://openseesmatlab.readthedocs.io/en/latest/api/OpenSeesMatlabAnalysis Get failure diagnostics collected during analysis. ```APIDOC ### getDiagnostics() ### Description Get failure diagnostics collected during analysis. ### Returns - **diagnostics** (struct) - Contains fields: records, lastFailure, maxRecords. ``` -------------------------------- ### Configure and Run Static Analysis Source: https://openseesmatlab.readthedocs.io/en/latest/examples/post/visualization/post_2d_Portal_Frame.m Set up the analysis parameters and execute the static solver. ```matlab ODB = opsMAT.post.createODB("myODB", interpolateBeamDisp=11); 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'); ops.analyze(Nsteps); ``` -------------------------------- ### getNormHistory() Source: https://openseesmatlab.readthedocs.io/en/latest/api/OpenSeesMatlabAnalysis Get convergence norm history as a struct array. ```APIDOC ### getNormHistory() ### Description Get convergence norm history as a struct array. ### Returns - **history** (struct array) - Contains fields: stepIndex, strategy, ok, firstNorm, lastNorm, minNorm, maxNorm, numIter, improvementRatio, isDiverging, isStagnating. ``` -------------------------------- ### Initialize OpenSeesMatlab Environment Source: https://openseesmatlab.readthedocs.io/en/latest/examples/opscmds/earthquake/earthquake_NLSMRF.m Sets up the basic environment and clears previous workspace variables. ```matlab clear; clc; close all; opsMAT = OpenSeesMatlab; ops = opsMAT.opensees; opsvis = opsMAT.vis; ``` -------------------------------- ### getLoadFactor(patternTag) Source: https://openseesmatlab.readthedocs.io/en/latest/api/OpenSeesMatlabCmds Get the load factor for a given pattern tag. ```APIDOC ## getLoadFactor(patternTag) ### Description Get the load factor for a given pattern tag. ### Parameters - **patternTag** (numeric scalar) - Required - The tag of the pattern. ### Returns - **result** (numeric scalar) - The load factor. ``` -------------------------------- ### Initialize OpenSeesMatlab Environment Source: https://openseesmatlab.readthedocs.io/en/latest/examples/post/analysis/post_mphi_analysis.m Sets up the OpenSeesMatlab interface and initializes the model space. ```matlab clear; clc; close all; opsMAT = OpenSeesMatlab(); ops = opsMAT.opensees; opsMC = opsMAT.anlys.MomentCurvature; % Get MomentCurvature instance disp(opsMC); ops.wipe(); ops.model("basic", "-ndm", 3, "-ndf", 6); ``` -------------------------------- ### Get Nodal Displacement Source: https://openseesmatlab.readthedocs.io/en/latest/api/OpenSeesMatlabCmds Retrieves displacement data for a specific node. ```matlab (nodeTag, dof=-1) ``` ```matlab disp = ops.nodeDisp(nodeTag) % all DOFs -> double vector disp = ops.nodeDisp(nodeTag, dof) % single DOF -> double scalar ``` -------------------------------- ### Get failure diagnostics Source: https://openseesmatlab.readthedocs.io/en/latest/api/OpenSeesMatlabAnalysis Retrieves failure diagnostics collected during analysis. ```matlab d = sa.getDiagnostics(); sa.printLastFailure(); ``` -------------------------------- ### Configure Recorders and Visualization Source: https://openseesmatlab.readthedocs.io/en/latest/examples/opscmds/earthquake/earthquake_frame3D_transient.m Sets up data recorders for nodes and elements and initializes the model visualization. ```matlab DataDir = "output_data"; ops.recorder('Node', '-file', fullfile(DataDir, 'Node18Disp.out'), '-time', '-node', 18, '-dof', 1,2,3, 'disp'); ops.recorder('Node', '-file', fullfile(DataDir, 'Node1React.out'), '-time', '-node', 1, '-dof', 1,2,3, 'reaction'); ops.recorder('Element', '-file', fullfile(DataDir, 'Beam1forceAndDeformation.out'), '-time', '-ele', 1, 'section', 1, 'forceAndDeformation'); % ops.recorder("mpco", fullfile(DataDir, "output.mpco"), "-N", "displacement", "rotation", "reactionForce", "reactionMoment", "modesOfVibration",... % "-E", "force", "section.force", "section.deformation", % "section.fiber.stress"); % Plot Model % This section creates the finite-element idealization used by the rest of the % example. Check the dimensions, tags, and connectivity here before moving on. opsMat.vis.plotModel(); ``` -------------------------------- ### Initialize and Configure Smart Analysis Source: https://openseesmatlab.readthedocs.io/en/latest/examples/post/analysis/post_Smart_Analysis.m Sets up the smart analysis environment with specific convergence criteria and adaptive parameters. ```matlab opsMAT.anlys.smartAnalyze.initialize(); % please make sure reset! opsMAT.anlys.smartAnalyze.configure(... analysis="Static",... testType="EnergyIncr", ... testTol=1e-10, ... tryAddTestTimes=true, ... % add test times to the analysis testIterTimes=10, ... testIterTimesMore=[50, 100], ... tryAlterAlgoTypes=true, ... % try different algorithms algoTypes=[40, 10, 20, 30], ... % algorithm types to try tryRelaxStep=true, ... % minStep=1e-6, ... % minimum step size for substepping debugMode=true, ... % False for progress bar, True for debug info printPer=50, ... % print every 100 steps recordNormHistory=true ... % Don't use it if you want fastest speed ); ``` ```matlab opsMAT.anlys.smartAnalyze.initialize(); % please make sure reset! opsMAT.anlys.smartAnalyze.configure(... analysis="Static",... testType="NormDispIncr", ... testTol=1e-8, ... tryAddTestTimes=true, ... % add test times to the analysis testIterTimes=10, ... testIterTimesMore=[50, 100], ... tryAlterAlgoTypes=true, ... % try different algorithms algoTypes=[40, 10, 20, 30], ... % algorithm types to try tryRelaxStep=true, ... % minStep=1e-6, ... % minimum step size for substepping debugMode=true, ... % False for progress bar, True for debug info printPer=50 ... % print every 100 steps ); ``` -------------------------------- ### Get Nodal Coordinate in Matlab Source: https://openseesmatlab.readthedocs.io/en/latest/api/OpenSeesMatlabCmds Retrieves nodal coordinates for all dimensions or a specific dimension. ```matlab coord = ops.nodeCoord(nodeTag) % all dimensions -> double vector coord = ops.nodeCoord(nodeTag, dim) % single dimension -> double scalar ``` -------------------------------- ### Get Nodal Acceleration in Matlab Source: https://openseesmatlab.readthedocs.io/en/latest/api/OpenSeesMatlabCmds Retrieves nodal acceleration for all DOFs or a specific DOF. ```matlab accel = ops.nodeAccel(nodeTag) % all DOFs -> double vector accel = ops.nodeAccel(nodeTag, dof) % single DOF -> double scalar ``` -------------------------------- ### Initialize and execute a basic OpenSeesMatlab model Source: https://openseesmatlab.readthedocs.io/en/latest Demonstrates the standard workflow of initializing the OpenSeesMatlab object, defining a model, and visualizing the results. ```matlab opsMat = OpenSeesMatlab(); ops = opsMat.opensees; ops.wipe(); ops.model('basic', '-ndm', 2, '-ndf', 2); ops.node(1, 0.0, 0.0); ops.node(2, 1.0, 0.0); ops.fix(1, 1, 1); % Continue with materials, elements, loads, and analysis commands. modelInfo = opsMat.post.getModelData(); %#ok opsMat.vis.plotModel(); % Or open the interactive Polyscope viewer: % opsMat.vis.polyscope.plotModel(); ``` -------------------------------- ### Get Nodal Velocity in Matlab Source: https://openseesmatlab.readthedocs.io/en/latest/api/OpenSeesMatlabCmds Retrieves nodal velocity for all DOFs or a specific DOF. ```matlab vel = ops.nodeVel(nodeTag) % all DOFs -> double vector vel = ops.nodeVel(nodeTag, dof) % single DOF -> double scalar ``` -------------------------------- ### Initialize PDE Model and Geometry Source: https://openseesmatlab.readthedocs.io/en/latest/examples/verify/verify_Bracket.m Sets up the structural static analysis model with material properties and boundary conditions. ```matlab clc; clear; E = 200e9; nu = 0.3; rho = 0.0; model = femodel(AnalysisType="structuralStatic", ... Geometry="BracketWithHole.stl"); model.MaterialProperties = materialProperties( ... YoungsModulus = E, ... PoissonsRatio = nu); model.FaceBC(4) = faceBC(Constraint="fixed"); model.FaceLoad(8) = faceLoad(SurfaceTraction=[0;0;-1e4]); figure pdegplot(model,FaceLabels="on"); view(30,30); title("Bracket with Face Labels") ``` -------------------------------- ### Get convergence norm history Source: https://openseesmatlab.readthedocs.io/en/latest/api/OpenSeesMatlabAnalysis Retrieves convergence norm history as a struct array. ```matlab history = sa.getNormHistory(); figure; semilogy([history.lastNorm], '.'); grid on; ``` -------------------------------- ### Configure and Execute Analysis Source: https://openseesmatlab.readthedocs.io/en/latest/examples/opscmds/structural/structural_nonlinear_truss.m Set up the numerical solver parameters and run the static analysis loop. ```matlab % create SOE ops.system('ProfileSPD'); % create DOF number ops.numberer('Plain'); % create constraint handler ops.constraints('Plain'); % create integrator ops.integrator('LoadControl', 1.0 / Nsteps); % create algorithm ops.algorithm('Newton'); % create test ops.test('NormUnbalance', 1e-8, 10, 0); % create analysis object ops.analysis("Static"); % Finally perform the 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. data = zeros(Nsteps + 1, 2); for j = 1:Nsteps ops.analyze(1); data(j + 1, 1) = ops.nodeDisp(4, 1); data(j + 1, 2) = ops.getLoadFactor(1) * Px; end ``` -------------------------------- ### Retrieve Analysis State Source: https://openseesmatlab.readthedocs.io/en/latest/api/OpenSeesMatlabCmds Functions to get the load factor for a pattern or the current analysis time. ```matlab (patternTag) ``` ```matlab () ``` -------------------------------- ### SmartAnalyze.initialize Source: https://openseesmatlab.readthedocs.io/en/latest/api/OpenSeesMatlabAnalysis Resets the configuration to defaults while preserving the OpenSees command interface. ```APIDOC ## initialize ### Description Resets the configuration to defaults, clearing history and progress tracking while keeping the OpenSees interface. Must be followed by a call to configure(). ### Parameters - **npts** (double) - Optional - Expected total steps for progress tracking (default 0) ``` -------------------------------- ### Retrieve Domain Tags Source: https://openseesmatlab.readthedocs.io/en/latest/api/OpenSeesMatlabCmds Functions to get all element or node tags in the domain or a specific mesh. ```matlab result = getEleTags() result = getEleTags('-mesh', mtag) ``` ```matlab result = getNodeTags() result = getNodeTags('-mesh', mtag) ``` -------------------------------- ### Initialize OpenSees Environment Source: https://openseesmatlab.readthedocs.io/en/latest/examples/post/visualization/post_soil_structure_interaction_2d_portal_frame.m Sets up the OpenSeesMatlab interface and clears the workspace. ```matlab clc; clear; close all; opsm = OpenSeesMatlab(); ops = opsm.opensees; ``` -------------------------------- ### Configure and Run Analysis Source: https://openseesmatlab.readthedocs.io/en/latest/examples/verify/verify_beam.m Sets up the static analysis parameters and executes the simulation. ```matlab Nsteps = 2; ops.constraints('Plain'); ops.numberer('RCM'); ops.system('BandGeneral'); ops.test('NormDispIncr', 1.0e-12, 50); ops.algorithm('Linear'); ops.integrator('LoadControl', 1.0 / Nsteps); ops.analysis('Static'); ODB = opsMAT.post.createODB("myODB", interpolateBeamDisp=9); % create ODB, 6 points in interpolateBeamDisp ok = ops.analyze(Nsteps); ODB.close(); ``` -------------------------------- ### Get Element Tags Source: https://openseesmatlab.readthedocs.io/en/latest/api/OpenSeesMatlabPre Retrieves unique element tags from selected entities or physical groups. ```matlab (DimEntityTags=[], PhysicalGroupNames=[]) ``` -------------------------------- ### Get Node Tags Source: https://openseesmatlab.readthedocs.io/en/latest/api/OpenSeesMatlabPre Retrieves unique node tags from selected entities or physical groups. ```matlab (DimEntityTags=[], PhysicalGroupNames=[]) ``` ```matlab tags = g2o.getNodeTags(); tags = g2o.getNodeTags(DimEntityTags=[2 1; 2 2]); tags = g2o.getNodeTags(PhysicalGroupNames='Support'); ``` -------------------------------- ### Initialize OpenSeesMatlab Environment Source: https://openseesmatlab.readthedocs.io/en/latest/examples/post/section/post_section_mesh.m Sets up the OpenSeesMatlab interface and retrieves the fiber section mesh generator. ```matlab clear; clc; opsmat = OpenSeesMatlab(); ops = opsmat.opensees; fs = opsmat.pre.fiberSectionMesh; disp(fs); ``` -------------------------------- ### Get Boundary Dimension Tags Source: https://openseesmatlab.readthedocs.io/en/latest/api/OpenSeesMatlabPre Recursively collects boundary dim-entity tags for specified entities. ```matlab (DimEntityTags=[], PhysicalGroupNames=[], IncludeSelf: logical = false) ``` -------------------------------- ### Configure Analysis Source: https://openseesmatlab.readthedocs.io/en/latest/examples/opscmds/earthquake/earthquake_RC_FRAME_EQ1.m Set up the system, constraints, numberer, test, algorithm, and integrator for static analysis. ```matlab % Create the system of equation, a sparse solver with partial pivoting ops.system('BandGeneral'); % Create the constraint handler, the transformation method ops.constraints('Transformation'); % Create the DOF numberer, the reverse Cuthill-McKee algorithm ops.numberer('RCM'); % Create the convergence test ops.test('NormDispIncr', 1.0e-12, 10, 1); % Create the solution algorithm, a Newton-Raphson algorithm ops.algorithm('Newton'); % Create the integration scheme, the LoadControl scheme using steps of 0.1 ops.integrator('LoadControl', 0.1); % Create the analysis object ops.analysis('Static'); ``` -------------------------------- ### Get Dimension Entity Tags Source: https://openseesmatlab.readthedocs.io/en/latest/api/OpenSeesMatlabPre Returns dimension-entity tag pairs, optionally filtered by dimension. ```matlab (Dim=[]) ``` -------------------------------- ### Launch Visualization GUIs Source: https://openseesmatlab.readthedocs.io/en/latest/examples/post/visualization/post_2d_Portal_Frame.m Open interactive GUIs for model, nodal, and element response visualization. ```matlab opsMAT.vis.plotModelGUI(); opsMAT.vis.plotNodalResponseGUI(nodeResp); opsMAT.vis.plotFrameResponseGUI(eleResp); ``` -------------------------------- ### Initialize and Configure Unit System Source: https://openseesmatlab.readthedocs.io/en/latest/examples/post/preprocess/post_unitsystem.m Sets up the unit system by defining base units and displays converted values for various physical quantities. ```matlab opsMAT = OpenSeesMatlab(); ops = opsMAT.opensees; % Basic usage % The following commands carry out this step of the workflow. Run this cell % after the previous sections so the required variables and model state already % exist. length_unit = "m"; % base unit force_unit = "kN"; % base unit UNIT = opsMAT.pre.unitSystem; UNIT.setBasicUnits(length_unit, force_unit, "sec"); fprintf("Length: %g %g %g %g %g %g\n", ... UNIT.mm, UNIT.mm2, UNIT.cm, UNIT.m, UNIT.inch, UNIT.ft); fprintf("Force: %g %g %g %g %g\n", ... UNIT.N, UNIT.kN, UNIT.lbf, UNIT.kip, UNIT("kN/mm")); fprintf("Stress: %g %g %g %g %g %g\n", ... UNIT.MPa, UNIT.kPa, UNIT.Pa, UNIT.psi, UNIT.ksi, UNIT("N/mm2")); fprintf("Mass: %g %g %g %g\n", ... UNIT.g, UNIT.kg, UNIT.ton, UNIT.slug); disp(UNIT) ``` -------------------------------- ### Initialize SmartAnalyze Source: https://openseesmatlab.readthedocs.io/en/latest/api/OpenSeesMatlabAnalysis Reset configuration to defaults while preserving the OpenSees interface. ```matlab (npts: double = 0) ``` -------------------------------- ### Create Output Database Source: https://openseesmatlab.readthedocs.io/en/latest/examples/post/visualization/post_excavation.m Initializes an ODB file for recording analysis results. ```matlab ODB = opsMAT.post.createODB("myODB"); ``` -------------------------------- ### Initialize OpenSeesMatlab and Access Modules Source: https://openseesmatlab.readthedocs.io/en/latest/api Instantiate the root class to access the various subsystems. Use the opensees module directly for maximum performance. ```matlab opsMAT = OpenSeesMatlab(); ops = opsMAT.opensees; % Native OpenSees commands pre = opsMAT.pre; % Preprocessing utilities post = opsMAT.post; % Post-processing & ODB vis = opsMAT.vis; % Visualization anlys = opsMAT.anlys; % Higher-level analysis workflows utils = opsMAT.utils; % General utilities ``` -------------------------------- ### Initialize and Configure Model Source: https://openseesmatlab.readthedocs.io/en/latest/examples/opscmds/sensitivity/sensitivity_sensitivity_analysis.m Sets up the OpenSees environment, defines units, and initializes the structural model. ```matlab clc; clear; opsMAT = OpenSeesMatlab(); ops = opsMAT.opensees; %% % inch = 1.0; kip = 1.0; ft = 12 * inch; ksi = kip / inch^2; ops.wipe(); ops.model('basic', '-ndm', 2, '-ndf', 3); ``` -------------------------------- ### Generate circular rebar coordinates Source: https://openseesmatlab.readthedocs.io/en/latest/api/OpenSeesMatlabPre Defines the signature and usage examples for distributing bars uniformly on a circle. ```matlab (R, varargin) ``` ```matlab % bars on a 250 mm radius circle:: c = pre.FiberSectionMesh.circRebars(250, 'n', 8); % Bars at 150 mm arc spacing:: c = pre.FiberSectionMesh.circRebars(250, 'gap', 150); % Starting from the bottom (270 deg):: c = pre.FiberSectionMesh.circRebars(250, 'n', 12, 'startAngle', 270); ``` -------------------------------- ### Configure Static Analysis Source: https://openseesmatlab.readthedocs.io/en/latest/examples/post/visualization/post_excavation.m Sets up the analysis parameters for the initial state. ```matlab ops.constraints("Transformation"); ops.test("NormDispIncr", 1e-05, 50, 0); ops.algorithm("Newton"); ops.numberer("RCM"); ops.system("BandGeneral"); ops.integrator("LoadControl", 1); ops.analysis("Static"); ``` -------------------------------- ### Compare OpenSeesPy and MATLAB command syntax Source: https://openseesmatlab.readthedocs.io/en/latest Shows the similarity between OpenSeesPy and OpenSeesMatlab command structures. ```text OpenSeesPy: ops.node(2, 1.0, 0.0) MATLAB: ops.node(2, 1.0, 0.0); ``` -------------------------------- ### Get Section Flexibility Matrix Source: https://openseesmatlab.readthedocs.io/en/latest/api/OpenSeesMatlabCmds Returns the section flexibility matrix for a beam-column element as a flattened vector. ```matlab (eleTag, secNum) ``` -------------------------------- ### Generate polygon rebar coordinates Source: https://openseesmatlab.readthedocs.io/en/latest/api/OpenSeesMatlabPre Examples of distributing bars along closed hexagonal paths or open poly-lines. ```matlab ang = (0:5) * 60; yHex = 250 * cosd(ang); zHex = 250 * sind(ang); c = pre.FiberSectionMesh.polygonRebars(yHex, zHex, 'n', 18); ``` ```matlab c = pre.FiberSectionMesh.polygonRebars( ... [-200,0,200], [0,300,0], 'gap', 80, 'closed', false); ``` -------------------------------- ### Initialize and Use Unit System Source: https://openseesmatlab.readthedocs.io/en/latest/api/OpenSeesMatlabPre Configures basic units and retrieves conversion factors for various physical quantities. ```matlab unit = pre.unitSystem; unit.setBasicUnits(lengthUnit, forceUnit, timeUnit); a = unit.mm; b = unit.kN; c = unit.MPa; d = unit.mm2; e = unit("N/mm^2"); ``` -------------------------------- ### Generate rectangular rebar coordinates Source: https://openseesmatlab.readthedocs.io/en/latest/api/OpenSeesMatlabPre Defines the signature and usage examples for distributing bars around a rectangular perimeter. ```matlab (b, h, cover, varargin) ``` ```matlab % Specify bars per face:: c = pre.FiberSectionMesh.rectRebars(400, 600, 50, 'nY',4, 'nZ',5); % Uniform gap:: c = pre.FiberSectionMesh.rectRebars(400, 600, 50, 'gap',120); % Offset section centroid:: c = pre.FiberSectionMesh.rectRebars(400,600,50,'gap',120,'cy',100,'cz',0); ``` -------------------------------- ### configure Source: https://openseesmatlab.readthedocs.io/en/latest/api/OpenSeesMatlabAnalysis Configures analysis settings and applies the initial test and algorithm. Must be called after setOPS. ```APIDOC ## configure ### Description Configures analysis settings and applies the initial test and algorithm. This method must be called after setOPS. ### Signature `sa.configure(Name=Value)` ### Parameters - **analysis** (string) - Optional - Analysis type: "Transient" (default) or "Static". - **testType** (string) - Optional - OpenSees convergence test type. - **testTol** (double) - Optional - Convergence tolerance. Default 1e-10. - **testIterTimes** (double) - Optional - Maximum convergence-test iterations. Default 10. - **tryAddTestTimes** (logical) - Optional - Retry with more iterations when norm < normTol. - **algoTypes** (double array) - Optional - Algorithm codes for convergence. ### Example `sa.configure(analysis="Transient", testTol=1e-10, tryAlterAlgoTypes=true, algoTypes=[40 10 20], tryRelaxStep=true, minStep=1e-6, debugMode=true);` ``` -------------------------------- ### Get Section Location Source: https://openseesmatlab.readthedocs.io/en/latest/api/OpenSeesMatlabCmds Returns the location of sections for a beam-column element. If secNum is omitted, returns locations for all sections. ```matlab (eleTag, secNum=-1) ``` -------------------------------- ### Generate arc rebar coordinates Source: https://openseesmatlab.readthedocs.io/en/latest/api/OpenSeesMatlabPre Examples of distributing bars along a circular arc using specified counts or spacing. ```matlab % 6 bars over the top half (0° to 180°):: c = pre.FiberSectionMesh.arcRebars(250, 0, 180, 'n', 6); % Bars at 100 mm spacing over bottom 180°, open ends:: c = pre.FiberSectionMesh.arcRebars(250, 180, 360, 'gap', 100, 'closed', false); ``` -------------------------------- ### Visualize Model and Initialize ODB Source: https://openseesmatlab.readthedocs.io/en/latest/examples/post/visualization/post_soil_structure_interaction_2d_portal_frame.m Configures visualization options and creates an ODB object for post-processing. ```matlab opts = opsm.vis.defaultPlotModelOptions; opts.nodes.showLabels = true; opsm.vis.plotModel(opts=opts); ODB = opsm.post.createODB("myODB", interpolateBeamDisp=11, flushEvery=20); ``` -------------------------------- ### Configure cuDSS runtime paths Source: https://openseesmatlab.readthedocs.io/en/latest/getting_started/extensions/cudss_solver Specify custom installation directories for CUDA and cuDSS DLLs when automatic discovery is insufficient. ```matlab % for cuda v12.6, for example cudssPath = "C:\Program Files\NVIDIA cuDSS\v0.8\bin\12"; cudaPath = "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.6\bin" % for cuda 13.1, for example cudssPath = "C:\Program Files\NVIDIA cuDSS\v0.8\bin\13"; cudaPath = "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.1\bin" ops.system("CuDSS", ... "-cudaPath", cudaPath, ... % cudart64_*.dll, cublas64_*.dll, cublasLt64_*.dll "-cudssPath", cudssPath, ... % cudss64_0.dll "-verbose"); ``` -------------------------------- ### system Source: https://openseesmatlab.readthedocs.io/en/latest/api/OpenSeesMatlabCmds Constructs the LinearSOE and LinearSolver objects to store and solve the system of equations. ```APIDOC ## system(systemType, systemArgs) ### Description This command is used to construct the LinearSOE and LinearSolver objects to store and solve the system of equations in the analysis. ### Parameters - **systemType** (str) - Required - The system type. - **systemArgs** (varargin) - Optional - Additional arguments for the system. ``` -------------------------------- ### Manage OpenSees domain state Source: https://openseesmatlab.readthedocs.io/en/latest/getting_started/overview Essential commands for maintaining model integrity. Always call wipe before starting a new model to clear the persistent domain state. ```matlab ops.wipe() ``` -------------------------------- ### Initialize and Plot Model Source: https://openseesmatlab.readthedocs.io/en/latest/api/OpenSeesMatlabVis Basic initialization of the OpenSeesMatlab interface and execution of the model plotting utility. ```matlab opsMAT = OpenSeesMatlab(); opsMAT.vis.plotModel(); ```