Open fishlittlefish opened 5 months ago
set start_time [clock seconds] set folder_path "C:\Users\traveller\Desktop\ABS\ek22"
set files [glob -directory $folder_path "*"] set i 0
wipe;
model basic -ndm 2 -ndf 3 if {[file exists output]==0} { file mkdir output;
} node 1 0 0 node 2 0 3 node 3 0 6 fix 1 1 1 1 geomTransf Linear 1
element elasticBeamColumn 1 1 2 0.25 3E10 5.2E-3 1 element elasticBeamColumn 2 2 3 0.25 3E10 5.2E-3 1
pattern Plain 20000 Linear { load 2 0.5 0 0 load 3 1 0 0 }
system SparseGeneral constraints Transformation numberer RCM test NormDispIncr 1.0e-4 10 algorithm Newton integrator LoadControl 0.1 analysis Static initialize analyze 10 puts "selfweight analysis is over"
mass 2 1e4 0 0 mass 3 1e4 0 0 loadConst -time 0 rayleigh 0.2 0 0.1 0
if {0} { foreach file $files { puts "first" puts $file puts "and" } puts $file }
foreach file $files { puts "$i第一次浏览" if {1} { wipeAnalysis loadConst -time 0 set i [expr $i+1] after 100 recorder Node -file output/disp$i.out -time -node 3 -dof 1 disp
timeSeries Path $i -dt 0.01 -filePath $file pattern UniformExcitation $i 1 -accel $i rayleigh 0.2 0 0.1 0 constraints Plain numberer Plain system BandGeneral test NormDispIncr 1e-8 10 2 algorithm Newton integrator Newmark 0.5 0.25 analysis Transient analyze 10 0.02
} puts $file puts "地面运动分析$i完成"
}
if {0} { foreach file $files { puts "$i 第一次浏览" wipeAnalysis loadConst -time 0
timeSeries Path $i -dt 0.01 -filePath $file pattern UniformExcitation $i 1 -accel $i rayleigh 0.2 0 0.1 0 constraints Plain numberer Plain system BandGeneral test NormDispIncr 1e-8 10 2 algorithm Newton integrator Newmark 0.5 0.25 analysis Transient analyze 10000 5 puts "地面运动分析 $i 完成" incr i } # 标记文件列表已经遍历 set fileListTraversed 1
set end_time [clock seconds]
set runtime [expr {$end_time - $start_time}]
puts "程序运行时间:$runtime 秒"
模型建立需要包含在foreach循环中,且每一次循环都要以wipe开头,且对于输出文件文件名用到的变量i 也需要在模型建立相对较前的位置进行加减,要不然在输出文件代码中,相应的i值会·来不及变化使用之前循环的值,我也不知道怎么回事,有大佬还请讲一下
记录程序开始时间
set start_time [clock seconds] set folder_path "C:\Users\traveller\Desktop\ABS\ek22"
使用glob获取所有文件名
set files [glob -directory $folder_path "*"] set i 0
if {1} {
opensees代码
wipe;
model basic -ndm 2 -ndf 3 if {[file exists output]==0} { file mkdir output;
} node 1 0 0 node 2 0 3 node 3 0 6 fix 1 1 1 1 geomTransf Linear 1
uniaxialMaterial Concrete02 1 -49300.0 -0.005 -9860.0 -0.020 0.1 3000.0 2000000.0 ; #核心混凝土
element elasticBeamColumn 1 1 2 0.25 3E10 5.2E-3 1 element elasticBeamColumn 2 2 3 0.25 3E10 5.2E-3 1
pattern Plain 20000 Linear { load 2 0.5 0 0 load 3 1 0 0 }
system SparseGeneral constraints Transformation numberer RCM test NormDispIncr 1.0e-4 10 algorithm Newton integrator LoadControl 0.1 analysis Static initialize analyze 10 puts "selfweight analysis is over"
mass 2 1e4 0 0 mass 3 1e4 0 0 loadConst -time 0 rayleigh 0.2 0 0.1 0
打印文件名
if {0} { foreach file $files { puts "first" puts $file puts "and" } puts $file }
foreach file $files { puts "$i第一次浏览" if {1} { wipeAnalysis loadConst -time 0 set i [expr $i+1] after 100 recorder Node -file output/disp$i.out -time -node 3 -dof 1 disp
} puts $file puts "地面运动分析$i完成"
puts $file
}
}
如果尚未遍历文件列表,则遍历文件列表并执行分析操作
if {0} { foreach file $files { puts "$i 第一次浏览" wipeAnalysis loadConst -time 0
recorder Node -file output/disp$i.out -time -node 3 -dof 1 disp
}
在这里放置您要计时的代码
Your code here
记录程序结束时间
set end_time [clock seconds]
计算程序运行时间(以秒为单位)
set runtime [expr {$end_time - $start_time}]
puts "程序运行时间:$runtime 秒"