OpenSees Blog 日本語 目次

最初に「このブログをみるためのガイド」をご覧ください。

Update中OpenSees コマンド 日本語解説 の 目次 OpenSeesコマンド はじめての方は「ここから」
このblogで使用しているOpenSeesコマンド集は「ここ」 Update中
OpenSees のソースコード 解析に挑戦してみる 目次最初のページは「ソースコードのダウンロードとビルド」
Appendix:C言語での 「有限要素法における平面トラスの解析」目次最初のページは「Microsoft Visual Studioの導入方法」







目次の中で、更新したページにはNewがついています

このブログ内の単語を検索したい場合は、左上OpenSeesロゴの上に検索窓から検索できます。


2016年5月11日水曜日

OpenSees Developer : Microsoft Visual Studio と OpenSeesソースコードの関係について


OpenSeesソースコード revision / version 番号とMicrosoft Visual stuido の関係をまとめてみました (2016/5/11現在)


このblogの中で、出てきましたVisual Studioについての情報は、以下の通りです。

 OpenSees Developer : ソースコードのダウンロードとビルド

冬休みのお知らせ

これらのblogにありますとおり、Visual Studio とOpenSeesのrevisionには、相性の関係があるらしく(^^) Buildできる組み合わせとできない組み合わせがあるようです。

ここでは、
私が試してみて、buildできて、正常に動作している(と思われる)組み合わせ
を、記載します。
(すべての組み合わせを試しているわけではないので、他にも動作可能な組み合わせがあるかもしれません)

なお
Visual Studio は 下記のURLからダウンロードできます
https://www.visualstudio.com/downloads/download-visual-studio-vs

最新版の2015 や すこし古い2013もここからダウンロードできます。
ちなみに OpenSeesで一番相性が良いのは、2013の様に見えます。
(2013は企業以外のアプリケーション開発用に無料で提供されています)

OpenSees  Visual Studio
Version revision 2010 2013 2015
2.4.3 5621 OK(32bit) 未調査 NG
2.4.5 5855 NG 未調査 NG
2.4.6 6016 NG 未調査 NG
2.4.6 6062 NG 未調査 NG
2.4.6 6185 未調査 OK(32bit) NG

現在の所、OpenSeesのソースコード解析をする場合には、
Visual Studio 2013 と revision 6185 
の組み合わせがよさそうです。

ただし、この組み合わせでBuildをしますと、下記のようなリンクエラーが出ます。

これは、バークレーのThe OpenSees Communityのblogに書かれている方法で回避できます

具体的には、

OpenSeesのプロパティを開いて
その中のLinker -> Advanced の中の赤丸部分 を No (/SAFESEH:NO) に設定
しますと、無事にOpenSees.exeが作成できます!

2016年2月9日火曜日

OpenSees Developer : ユークリッドノルムの計算

OpenSees Basic Examples (鉄筋コンクリート門型フレーム: 横荷重解析) 例題

の

# Create a recorder to monitor element forces in columns
recorder EnvelopeElement -file ele32.txt -time -ele 1 2 forces

で、出力されるele32.txtの中のデータ ユークリッドノルムのソースコードについての解説です。


StaticAnalysis.cpp 
のresult = theIntegrator->commit();
で、ele32.txtへ出力される timestampとユークリッドノルムが計算されています。

StaticAnalysis::analyze(int numSteps)




このcommit( ) が読んでいるファンクションの中に、
軸力、せん断力、曲げモーメント
を計算している部分があり、それは、PDeltaCrdTransf2d.cpp にあります。

(*) StaticAnalysis.cpp については、こちらも参照してください

PDeltaCrdTransf2d::getGlobalResistingForce(const Vector &pb, const Vector &p0)




赤でかこまれた部分で
pl[0], pl[3] が軸力
pl[1], pl[4] がせん断力
pl[2], pl[5] が曲げモーメント
を算出しています。

(特にせん断力 Vは、曲げモーメントの傾きから求めています)

つぎに
緑線の部分で 軸力とせん断力を部材座標系から全体座標系へ変換しています。

最終的に

pg(0), pg(3)  に 軸力
pg(1), pg(4)  に せん断力
pg(2), pg(5)  に 曲げモーメント
を入力して、このfunctionは終了します。

次に、

recorder EnvelopeElement -file ele32.txt -time -ele 1 2 forces
コマンドで、出力されるデータを計算している部分です。



EnvelopeElementRecorder.cpp
EnvelopeElementRecorder::record(int commitTag, double timeStamp)

で、ユークリッドノルムが計算されています。





① から、(最終的に)EnvelopeElementRecorder::record(int commitTag, double timeStamp)
が呼ばれます。

② の
eleInfo.getData();
で、上記の
pg(0), pg(3)  に 軸力
pg(1), pg(4)  に せん断力
pg(2), pg(5)  に 曲げモーメント
の値(ここでは、eleDataの成分になっています。)を取得します。

次に③、
normV += eleData(j) * eleData(j);

で、


の1/2 乗(√)の中身を計算してます。

1/2 乗(√)は、④で計算しています。

# Create a recorder to monitor element forces in columns

recorder EnvelopeElement -file ele32.txt -time -ele 1 2 forces

で、出力されるele32.txtの中のデータ は
<Time Stamp> <ユークリッドノルム> のペアで出力されていますが、
currentData( )に

<ユークリッドノルム>
が保存されることになります。

OpenSees のソースコード解析に挑戦してみる : 目次





2016年1月13日水曜日

OpenSees Basic Examples (E7:鉄筋コンクリート門型フレーム 地震波を作用させた解析) コマンドサマリ 2



OpenSees Basic Examples (E2:鉄筋コンクリート門型フレーム 地震波を作用させた解析) 解説 (外力としての地震波の設定 1) で解説した ARL360.at2 ファイルを、
OpenSees Basic Examples (E6:鉄筋コンクリート門型フレーム 地震波を作用させた解析) コマンドサマリ 1
における 地震波をの入力データとするための tclスクリプトが入っている ReadRecord.tcl は、以下の通りです。

----- ReadRecord.tcl 始まり ------

# ReadRecord.tcl
# ------------------------------------------------------------------------------------------------------------
#
# Written: fmk
# Date: July 2010

# A procedure which parses a ground motion record from the PEER
# strong motion database by finding dt in the record header, then
# echoing data values to the output file.
#
# Formal arguments
# inFilename -- file which contains PEER strong motion record
# outFilename -- file to be written in format G3 can read
# dt -- time step determined from file header
# nPts -- number of data points from file header
#
# Assumptions
# The header in the PEER record is, e.g., formatted as 1 of following:
#  1) new PGA database
# PACIFIC ENGINEERING AND ANALYSIS STRONG-MOTION DATA
#  IMPERIAL VALLEY 10/15/79 2319, EL CENTRO ARRAY 6, 230                        
#  ACCELERATION TIME HISTORY IN UNITS OF G                                      
#  3930 0.00500 NPTS, DT

#   2) old SMD database
# PACIFIC ENGINEERING AND ANALYSIS STRONG-MOTION DATA
#  IMPERIAL VALLEY 10/15/79 2319, EL CENTRO ARRAY 6, 230                        
#  ACCELERATION TIME HISTORY IN UNITS OF G                                      
#  NPTS=  3930, DT= .00500 SEC


proc ReadRecord {inFilename outFilename dt nPts} {

    # Pass dt by reference
    upvar $dt DT
    upvar $nPts NPTS
 
    # Open the input file and catch the error if it can't be read
    if [catch {open $inFilename r} inFileID] {
puts stderr "Cannot open $inFilename for reading"
    } else {
# Open output file for writing
set outFileID [open $outFilename w]

# Flag indicating dt is found and that ground motion
# values should be read -- ASSUMES dt is on last line
# of header!!!
set flag 0

# Look at each line in the file
foreach line [split [read $inFileID] \n] {
 
   if {[llength $line] == 0} {
# Blank line --> do nothing
continue
   } elseif {$flag == 1} {
# Echo ground motion values to output file
puts $outFileID $line
   } else {

# Search header lines for dt
set lengthLine [llength $line]

if {$lengthLine >= 4} {

   set word0 [lindex $line 0]
   set wordN [lindex $line [expr $lengthLine-1]]
 
   if {$word0 == "NPTS=" } {
# old SMD format
set count 0
foreach word [split $line] {
   incr count 1
   if {$word != ""} {
# Read in the time step
if {$flag == 1} {
   set DT $word
   break;
}
if {$flag == 2} {
   set NPTS [string trim $word ","]
   set flag 0
}
# Find the desired token and set the flag
if {[string match $word "DT="] == 1} {
   set flag 1
}
# Find the desired token and set the flag
if {[string match $word "NPTS="] == 1} {
   set flag 2
}
   }
}

   } elseif {$wordN == "DT"} {

# new NGA format
set count 0;
foreach word [split $line] {
   if {$word != ""} {
if {$count == 0} {
   set NPTS $word;
} elseif {$count == 1} {
   set DT $word;
} elseif {[string match $word "DT"] == 1} {
   set flag 1;
   break;
}
incr count 1
   }
}
   }
}
   }
}
# Close the output file
close $outFileID

# Close the input file
close $inFileID
    }
}


----- ReadRecord.tcl 終わり ------

 次のページ → 
OpenSees Basic Examples (鉄筋コンクリート門型フレーム 地震波を作用させた解析) 解析結果1

Opensees コマンド 日本語解説 : 目次

2015年12月26日土曜日

Merry christmas and Happy new year 2016 (冬休みのお知らせ)

OpenSees ファンの皆様、

このblogを見ていただきまして、ありがとうございます。冬休みのお知らせです。
毎週1つづつのペースで、投稿しておりますが、今週から3週間ほど、お休みさせていただきます。

「OpenSees コマンド 日本語解説」につきましては、自分が見慣れてしまってきているせいか、だんだん書き方がぞんざいになってきているような気がします。過去の投稿にリンクを張ることで、わかりやすくなってるかなあ、と思ってはいますが。。。

「OpenSeesのソースコード解析」は、「OpenSees コマンド 日本語解説」でのexampleを調査しているとき、わからない部分がでてくると、その部分のソースコードを読んでみたりしているため、どうも統一的な解説を書くことが難しい状態です。あるていどまとまりができてから、まとめてUpしようと思ってはいます(できる時が来るのだろうか・・・)

と、言ったような状態です。

ところで、
Microsoft Visual Studio 2015
が、公開されました。

やはり、OpenSeesのSourceCodeも、Microsoft Visual Studio 2015上で展開してみたいと思い、現在これに挑戦しています。
しかしながら、
VisualStudio 2010では問題なく動作しているSolutionが2015上で動作していない、という状況です。
(2015/12/25現在)

なにはともあれ、Microsoft Visual Studio 2015の導入方法についての説明です
(Visual Studio 2010のインストール方法は、ここ にあります。が、現在MicrosoftのWebSiteからは消えてしまっています)

こちらのページ
https://www.visualstudio.com/products/free-developer-offers-vs.aspx
から、ダウンロードできます。




使用するものは、
"Visual Studio Community"
です。

赤丸の"Visual Studio Community"をクリックしますと ダウンロードページに進みます。

最初に、Visual Studio2015の「ご利用について」をよく読んでください。

ダウンロードを行いますと
vs_community.exe
ファイルが、ダウンロードされますので、これをinstall します。

途中、「標準」と「カスタム」のどちらかを選択する表示がでてきますので
「プログラミング言語」の「Visual C++」が選択できる「カスタム」を選びます。
(Visual C++を選択することを、忘れないように)

Installする際に、MicrosoftのID (メールアドレス等)を要求されますので
指定して、Installを行います。 

また、2015/11/30 にリリースされた Visual Studio 2015 Update 1 も、
ダウンロードしてインストールしてください。
https://www.visualstudio.com/news/vs2015-update1-vs



Installが成功すると、上記のアイコンが生成されますので、"Visual Studio 2015"をクリックし、起動することができます。

Visual Studio2015が立ち上がった後、「プロジェクトを開く」で、
OpenSeesではない、たとえば「「有限要素法における平面トラスの解析」プログラム」
で、作成したSolutionを選択しますと、
2010から2015用にsolutionの変換がプロセスされたあと、2010と変わらず、使用することができます。

こちらのブログは、あくまで趣味として、まったりと追記しておりますが、
冬休み後は、さらにまったりモードで投稿していく予定です。

Innovativeな建物がたくさんできますように!

2015/12/25 
Satoko Toengawa





2015年12月18日金曜日

OpenSees Basic Examples (E6:鉄筋コンクリート門型フレーム 地震波を作用させた解析) コマンドサマリ 1


Basic Examples (鉄筋コンクリート門型フレーム 地震波を作用させた解析)   解説
のコマンドのサマリは以下の通りです。

このコマンドを ファイル名 RCF-GE.tcl として、テキストフォーマットで作成し、
OpenSeesの起動環境 で 起動しているOpenSees のコマンドラインに

OpenSees RCF-GE.tcl  <Enter>

と打ち込んで、実行します。

この時、このtcl スクリプトは、

Basic Examples (鉄筋コンクリート門型フレーム:重力の柱軸力のみを作用させた解析)  で作成した RCF-G.tcl ファイル

OpenSees Basic Examples (:鉄筋コンクリート門型フレーム 地震波を作用させた解析) 解説(地震加速度データについて)  で会絶した ARL360.at2 ファイル

と、 このファイルをOpenSeesコマンドの入力データにするための tclスクリプトが入っている
ReadRecord.tcl ファイル

も使用しますので、同じディレクトリに、これらの ファイルもおいておきます。

----- RCF-GE.tcl 始まり ------
#Reinforced Concrete Frame Earthquake Analysis

# Do operations of RCFrameGravity by sourcing in the tcl file
source RCF-G.tcl

# Set the gravity loads to be constant & reset the time in the domain
loadConst -time 0.0

# Define nodal mass in terms of axial load on columns
set g 386.4
set m [expr $P/$g];       # expr command to evaluate an expression

#    tag   MX   MY   RZ
mass  3    $m   $m    0
mass  4    $m   $m    0

# Set some parameters
set record ARL360

# Source in TCL proc to read PEER SMD record
source ReadRecord.tcl

# Permform the conversion from SMD record to OpenSees record
#              inFile     outFile dt
ReadRecord $record.at2 $record.dat dt nPts

# Set time series to be passed to uniform excitation
timeSeries Path 1 -filePath $record.dat -dt $dt -factor $g

# Create UniformExcitation load pattern
#                         tag dir 
pattern UniformExcitation  2   1  -accel 1

# set the rayleigh damping factors for nodes & elements
rayleigh 0.0 0.0 0.0 0.000625

# Create a recorder to monitor nodal displacements
recorder Node -time -file disp12.txt -node 1 2 -dof 1 2 3 disp
recorder Node -time -file disp.txt -node 3 4 -dof 1 2 3 disp

# Create recorders to monitor section forces and deformations
# at the base of the left column
recorder Element -time -file ele1secForce.txt -ele 1 section 1 force
recorder Element -time -file ele1secDef.txt   -ele 1 section 1 deformation

# Delete the old analysis and all it's component objects
wipeAnalysis

# Create the system of equation, a banded general storage scheme
system BandGeneral

# Create the constraint handler, a plain handler as homogeneous boundary
constraints Plain

# Create the convergence test, the norm of the residual with a tolerance of 
# 1e-12 and a max number of iterations of 10
test NormDispIncr 1.0e-12  10 

# Create the solution algorithm, a Newton-Raphson algorithm
algorithm Newton

# Create the DOF numberer, the reverse Cuthill-McKee algorithm
numberer RCM

# Create the integration scheme, the Newmark with alpha =0.5 and beta =.25
integrator Newmark  0.5  0.25 

# Create the analysis object
analysis Transient

# Perform an eigenvalue analysis
puts "eigen values at start of transient: [eigen 2]"

# set some variables
set tFinal [expr $nPts * $dt]
set tCurrent [getTime]
set ok 0

# Perform the transient analysis
while {$ok == 0 && $tCurrent < $tFinal} {
    
    set ok [analyze 1 .01]
    
    # if the analysis fails try initial tangent iteration
    if {$ok != 0} {
puts "regular newton failed .. lets try an initail stiffness for this step"
test NormDispIncr 1.0e-12  100 0
algorithm ModifiedNewton -initial
set ok [analyze 1 .01]
if {$ok == 0} {puts "that worked .. back to regular newton"}
test NormDispIncr 1.0e-12  10 
algorithm Newton
    }
    
    set tCurrent [getTime]
}

# Print a message to indicate if analysis succesfull or not
if {$ok == 0} {
   puts "Transient analysis completed SUCCESSFULLY";
} else {
   puts "Transient analysis completed FAILED";    
}

# Perform an eigenvalue analysis
puts "eigen values at end of transient: [eigen -Umfpack 2]"

# Print state of node 3
print node 3

----- RCF-GE.tcl 終わり ------


 次のページ → 

OpenSees Basic Examples (E6:鉄筋コンクリート門型フレーム 地震波を作用させた解析) コマンドサマリ 2

Opensees コマンド 日本語解説 : 目次

2015年12月9日水曜日

OpenSees Basic Examples (E5:鉄筋コンクリート門型フレーム 地震波を作用させた解析) 解説(解析の設定)


まず、解析をおこなった結果について収集するデータについての設定を行います。

まず、Nodeについては、3,4 について時間ごとの変位を disp.txtに出力させます。


# Create a recorder to monitor nodal displacements
recorder Node -time -file disp.txt -node 3 4 -dof 1 2 3 disp

Elementについては、1 についての、軸力と、曲げモーメントについての 時間ごとの変位を ele1secForce.txt に出力させます。
また、1 についての 部品座標系における変形を  ele1secDef.txt   に出力させます。

# Create recorders to monitor section forces and deformations
# at the base of the left column
recorder Element -time -file ele1secForce.txt -ele 1 section 1 force
recorder Element -time -file ele1secDef.txt   -ele 1 section 1 deformation

最初に RCF-G.tcl を読み込むことで行われた 「鉄筋コンクリート門型フレーム重力荷重解析」の解析をリセットします。

# Delete the old analysis and all it's component objects
wipeAnalysis


5)解析の設定

解析する時の、連立方程式の解き方の手法などを設定します。
各コマンドの説明は、「OpenSeesコマンド集」を参照してください


# Create the system of equation, a banded general storage scheme
system BandGeneral

# Create the constraint handler, a plain handler as homogeneous boundary
constraints Plain

# Create the convergence test, the norm of the residual with a tolerance of 
# 1e-12 and a max number of iterations of 10
test NormDispIncr 1.0e-12  10 

# Create the solution algorithm, a Newton-Raphson algorithm
algorithm Newton

# Create the DOF numberer, the reverse Cuthill-McKee algorithm
numberer RCM

# Create the integration scheme, the Newmark with alpha =0.5 and beta =.25
integrator Newmark  0.5  0.25 

# Create the analysis object
analysis Transient

最初に2次固有値の値を表示します。

# Perform an eigenvalue analysis
puts "eigen values at start of transient: [eigen 2]"

次に、解析時間を求めます。
これは、データ数(nPts)と、測定間隔(dt)を掛け合わせることで算出できます。
この値を tFinal に代入します。
また、解析している現在の時間を getTimeコマンドで求め
この値を tCurrent に代入します。

また、analyzeコマンドの戻り値は シンボル ok に入りますが、
ここで初期化をします(ok を 0 にセットします)

# set some variables
set tFinal [expr $nPts * $dt]
set tCurrent [getTime]
set ok 0


While 文で tCurrent がtFinal になるまで、
analyzeコマンドを実行します。

ここで 解析1回ごとに、0.01secごと、時間を増加させます。

analyze [実行する回数] [transient analysis の時の時間増加数]

analyzeの戻り値が、0であれば、解析計算が成功してていますが、
そうではなかった場合($ok !=0) 計算方法を、modified Newton法に変更して、解析計算をし直します。(この計算が成功した場合は、Newton法に戻します)

また、
set tCurrent [getTime]
で、tCurrentに現在の時間をセットします。

# Perform the transient analysis
while {$ok == 0 && $tCurrent < $tFinal} {
    
    set ok [analyze 1 .01]
    
    # if the analysis fails try initial tangent iteration
    if {$ok != 0} {
puts "regular newton failed .. lets try an initail stiffness for this step"
test NormDispIncr 1.0e-12  100 0
algorithm ModifiedNewton -initial
set ok [analyze 1 .01]
if {$ok == 0} {puts "that worked .. back to regular newton"}
test NormDispIncr 1.0e-12  10 
algorithm Newton
    }
    
    set tCurrent [getTime]
}

tCurrent がtFinal になったら、最後の解析計算の戻り値を見て、
成功していたら、SUCCESSFULLY、失敗していたら、FAILED を画面上に表示します。


# Print a message to indicate if analysis succesfull or not
if {$ok == 0} {
   puts "Transient analysis completed SUCCESSFULLY";
} else {
   puts "Transient analysis completed FAILED";    
}

また最後に、再び、2次固有値の値を表示します。これは、解析最後の状態で計算した固有値の値になります。

# Perform an eigenvalue analysis
puts "eigen values at end of transient: [eigen -Umfpack 2]"

Node 3 の情報を出力します。

# Print state of node 3
print node 3


 次のページ → 
OpenSees Basic Examples (鉄筋コンクリート門型フレーム 地震波を作用させた解析) コマンドサマリ

Opensees コマンド 日本語解説 : 目次

2015年12月2日水曜日

OpenSees Basic Examples (E4: 鉄筋コンクリート門型フレーム 地震波を作用させた解析) 外力としての地震波の設定 2



OpenSees Basic Examples (E3:鉄筋コンクリート門型フレーム 地震波を作用させた解析) 解説(地震加速度データについて)
での、ARL360.at2 ファイルを変換して、地震データとして読み込ませる方法です。

最初に、
record というシンボルに”ARL360” という文字列をセットします。

# Set some parameters
set record ARL360


次に、変換を行うための
proc ReadRecord {inFilename outFilename dt nPts}
プログラムが格納されているtcl スクリプトファイル ReadRecord.tcl を
ソースとして読み込ませます。

# Source in TCL proc to read PEER SMD record
source ReadRecord.tcl


ReadRecord ( ) を動作させます

# Permform the conversion from SMD record to OpenSees record
#              inFile     outFile dt
ReadRecord $record.at2 $record.dat dt nPts

ここで、


NPTS は number of points で、このファイルに入っている地震加速度データの総数です。
DT は delta time で、地震の測定された加速度データの測定間隔⊿t です。

$record には ”ARL360” という文字列 が入っているので
入力ファイルは ARL360.at2、 出力ファイルは、ARL360.dat
と、なります。


出力した ARL360.dat を 地震加速度データとして、取り扱うために、
timeSeries コマンドを使用します。
このコマンドについての説明は、ここ。 ( または「OpenSeesコマンド集」を参照してください )
入力したデータの間隔が いつも一定時間の場合は、このコマンドを使用します。

timeSeries Path [タグ番号] -dt [測定間隔] -filePath[入力ファイル] -factor [入力したデータに掛けるデータ]


# Set time series to be passed to uniform excitation
timeSeries Path 1 -filePath $record.dat -dt $dt -factor $g

ここで、
-dt には、dt の値 (0.02sec)
-factor には、重力加速度 g 386.4
が入ります。
これは、ARL360.datのデータが重力加速度に対しての比率として入っている為
地震波の加速度は、このデータと重力加速度の積となるためです。
このコマンドは tag 1 として考えます。

次に、実際にOpenSeesとして動作するときに、加速度として読み込ませるため、

UniformExcitation [タグ番号] [読み込ませる軸方向] -accel [データのあるタグ番号]
# Create UniformExcitation load pattern
#                         tag dir 
pattern UniformExcitation  2   1  -accel 1

ここでは1:X軸方向に読み込むように指示しています。
( 「OpenSeesコマンド集」を参照してください )

レ 次に加速度データの入力に対する減衰方法について定義します。
   ここではレイリー減衰を使用します。

rayleigh [$alphaM] [$betaK] [$betaKinit] [$betaKcomm]

# set the rayleigh damping factors for nodes & elements
rayleigh 0.0 0.0 0.0 0.000625

これについての説明は、OpenSeesのコマンドはここ、 Blog内では ここ を参照してください。
( または「OpenSeesコマンド集」を参照してください )

 次のページ → 
OpenSees Basic Examples (鉄筋コンクリート門型フレーム 地震波を作用させた解析)解説 解析の設定

Opensees コマンド 日本語解説 : 目次