1. 引言
OpenSees是地震工程模拟开放系统(Open System for Earthquake Engineering Simulation)的缩写,它是一个面向对象的软件框架,在美国国家科学基金会资助的太平洋地震工程研究中心(PEER)时期(1997年-2007年)创建。该软件旨在开发应用程序来模拟结构和岩土系统在地震下的性能,它允许用户创建串行和并行有限元计算机应用程序,以模拟这些系统对地震和其他灾害的响应。除了核心功能外,OpenSees 还支持教育应用程序的开发。例如,PileGroupTool 是一个使用 OpenSees 构建的应用程序,允许用户检查分层土中的桩群对横向荷载的响应。
2. 准备工作
把下载下来的源代码解压到一个目录中,在Win64目录下找到OpenSees.sln,右击选择用VS 2022打开,进入到VS 2022环境下,把OpenSees设为启动项目开始,然后开始进行编译。第一次编译肯定不能通过,需要根据错误信息修改路径和环境变量,反复进行试验,直到编译不出现错误。
4. 测试
编译后的执行文件为OpenSees.exe(14.9M),位于Win64/Bin目录下。使用例子文件truss.tcl测试该程序,
source truss.tcl
# ------------------------------
# Start of model generation
# ------------------------------
# Remove existing model
wipe
# Create ModelBuilder (with two-dimensions and 2 DOF/node)
model BasicBuilder -ndm 2 -ndf 2
# Create nodes
# ------------
# Create nodes & add to Domain - command: node nodeId xCrd yCrd
node 1 0.0 0.0
node 2 144.0 0.0
node 3 168.0 0.0
node 4 72.0 96.0
# Set the boundary conditions - command: fix nodeID xResrnt? yRestrnt?
fix 1 1 1
fix 2 1 1
fix 3 1 1
# Define materials for truss elements
# -----------------------------------
# Create Elastic material prototype - command: uniaxialMaterial Elastic matID E
uniaxialMaterial Elastic 1 3000
# Define elements
# ---------------
# Create truss elements - command: element truss trussID node1 node2 A matID
element Truss 1 1 4 10.0 1
element Truss 2 2 4 5.0 1
element Truss 3 3 4 5.0 1
# Define loads
# ------------
#create a Linear TimeSeries (load factor varies linearly with time): command timeSeries Linear $tag
timeSeries Linear 1
# Create a Plain load pattern with a linear TimeSeries: command pattern Plain $tag $timeSeriesTag { $loads }
pattern Plain 1 1 {
# Create the nodal load - command: load nodeID xForce yForce
load 4 100 -50
}
# ------------------------------
# Start of analysis generation
# ------------------------------
# Create the system of equation, a SPD using a band storage scheme
system BandSPD
# Create the DOF numberer, the reverse Cuthill-McKee algorithm
numberer RCM
# Create the constraint handler, a Plain handler is used as homo constraints
constraints Plain
# Create the integration scheme, the LoadControl scheme using steps of 1.0
integrator LoadControl 1.0
# Create the solution algorithm, a Linear algorithm is created
algorithm Linear
# create the analysis object
analysis Static
# ------------------------------
# Start of recorder generation
# ------------------------------
# create a Recorder object for the nodal displacements at node 4
recorder Node -file example.out -time -node 4 -dof 1 2 disp
# Create a recorder for element forces, one in global and the other local system
recorder Element -file eleGlobal.out -time -ele 1 2 3 forces
recorder Element -file eleLocal.out -time -ele 1 2 3 basicForces
# ------------------------------
# Finally perform the analysis
# ------------------------------
# Perform the analysis
analyze 1
# ------------------------------
# Print Stuff to Screen
# ------------------------------
# Print the current state at node 4 and at all elements
puts "node 4 displacement: [nodeDisp 4]"
print node 4
print ele
运行结果与官方网站上给出的结果完全相同,表明编译成功。