OpenSees Cloud

OpenSees AMI

Multi-Threaded SDF Analysis

Original Post - 25 Nov 2022 - Michael H. Scott

Visit Structural Analysis Is Simple on Substack.


A previous post showed that, when compared to a couple of brute force approaches, using the sdfResponse command is the most computationally efficient approach to generating an earthquake response spectrum.

During an OpenSees Cafe, Dr. Silvia Mazzoni suggested taking a more intelligent approach by “batching” the brute force SDF analyses. Instead of analyzing one oscillator at a time, create all the oscillators in a single model and shake all the oscillators in a single analysis. Would this multi-threading (shown below) be faster than using the sdfResponse approach from the previous post?

import openseespy.opensees as ops

dTn = 0.02
Tno = dTn
Tnf = 3.0

ops.wipe()
ops.model('basic','-ndm',1,'-ndf',1)

ops.timeSeries('Path',1,'-dt',0.02,'-filePath','tabasFN.txt')
ops.pattern('UniformExcitation',1,1,'-accel',1)

Tgm = 30.0

i = 0
Tn = Tno
ops.node(0,0); ops.fix(0,1)
while Tn <= Tnf:
    i += 1
    ops.node(i,0); ops.mass(i,1.0) # m = 1
    ops.uniaxialMaterial('Elastic',i,(2*pi/Tn)**2) # k = m*omega**2    
    ops.element('zeroLength',i,0,i,'-mat',i,'-dir',1)
    Tn += dTn
    
ops.recorder('EnvelopeNode','-file','dispAll.out','-nodeRange',1,i,'-dof',1,'disp')    
    
ops.system('Diagonal')
ops.analysis('Transient')

dt = 0.02
N = int(Tgm/dt)
ops.analyze(N,dt)

The resulting model is multiple SDF oscillators connected to one base node.

Multiple springs in parallel

Because the SDFs are uncoupled from each other, this is perhaps the only acceptable use of the Diagonal solver outside of explicit time integration with coupled systems. Also, note that the maximum displacement of each oscillator is dumped to a single file using the -nodeRange option to the EnvelopeNode recorder.

I didn’t make any plots, so you’ll have to take my word for it: the sdfResponse approach generates an elastic response spectrum about 2-3 times faster than the batched SDF approach. Note that the sdfResponse approach was 6-8 times faster than brute force approaches from the previous post–that is a win in and of itself. Still, the overhead of a proper finite element analysis dominates SDF analysis.

The batched SDF approach is a good idea in many situations though, particularly using nonlinear hysteretic models where the oscillators can do their thing simultaneously or if you have simple (elastic or inelastic) systems that sdfResponse cannot handle, e.g., a two DOF SSI system. However, the drawbacks of “multi-threading” and SDF analysis are 1) the analysis cannot proceed to the next time step until all nonlinear oscillators have reached equilibrium and 2) non-convergence of one nonlinear oscillator will cause the analysis to stop for all oscillators.