please check my source code

Forum for OpenSees users to post questions, comments, etc. on the use of the OpenSees interpreter, OpenSees.exe

Moderators: silvia, selimgunay, Moderators

Post Reply
suciputrielza
Posts: 11
Joined: Sun Apr 08, 2012 5:17 am
Location: andalas university

please check my source code

Post by suciputrielza »

helllo..
i have some problem to record stress-strain response
please check my source code?
maybe it's wrong??
thanks..


it's my source code

# balok1.tcl
####################################################################################################
# ANALISA KUAT LENTUR BALOK BETON BERTULANG DENGAN PROGRAM OPENSEES #
####################################################################################################
# MODEL STRUKTUR
# ==================================================================================================
#
# | |
# | |
# V V
# ._______________.__________._________._______________.
# ^ (1) (2) (3) (4) ^
# 1 2 3 4 5
# [X1,Y] [X2,Y] [X3,Y] [X4,Y] [X5,Y]
#
# ==================================================================================================
# SET UP
wipe; # mengahapus memori data sebelumnya
model BasicBuilder -ndm 2 -ndf 3
set dataDir Data; # mendefinisikan folder pemnyimpanan
file mkdir $dataDir; # menulis data penyimpanan
# ==================================================================================================
# Define Units
# --------------------------------------------------------------------------------------------------
# 1. Mendefinisikan unit
# --------------------------------------------------------------------------------------------------
set mm 1.; # unit dasar - output unit
set KN 1.; # unit dasar - output unit
set sec 1.; # unit dasar - output unit
set LunitTXT "mm"; # unit dasar untuk output
set FunitTXT "KN"; # unit dasar untuk output
set TunitTXT "sec"; # unit dasar untuk output
set mm2 [expr $mm*$mm]; # mm^2a
set mm4 [expr $mm*$mm*$mm*$mm]; # mm^4
set MPa [expr 0.001*$KN/$mm2]; # unit dasar - output unit
set Ubig 1.e10; # angka besar
set Usmall [expr 1/$Ubig]; # angka kecil
puts "Units OK"

# ==================================================================================================
# Define Geometry
# ------------------------------------------------------------------------------------------------
# 2. Mendefinisakan Geometri
# ------------------------------------------------------------------------------------------------
set X1 [expr 0*$mm]; # koordinat titik X1
set X2 [expr 460*$mm]; # koordinat titik X2
set X3 [expr 710*$mm]; # koordinat titik X3
set X4 [expr 960*$mm]; # koordinat titik X4
set X5 [expr 1420*$mm]; # koordinat titik X5
set Y [expr 0*$mm]; # koordinat titik Y1
# ------------------------------------------------------------------------------------------------
# 2.1. Geometri Penampang
# ------------------------------------------------------------------------------------------------
set BBeam [expr 250.*$mm]; # lebar Penampang Balok
set HBeam [expr 500.*$mm]; # Tinggi Penampang Balok
# ------------------------------------------------------------------------------------------------
# 2.2. Parameter Geometri
# ------------------------------------------------------------------------------------------------
set ABeam [expr $BBeam*$HBeam]; # luas Penampang Balok
set IzBeam [expr 1./12.*$BBeam*pow($HBeam,3)]; # Momen Inersia Balok
# ------------------------------------------------------------------------------------------------
# 2.3. Koordinat titik
# ------------------------------------------------------------------------------------------------
# Node tag xCrd yCrd
node 1 $X1 $Y; # (koordinat titik 1)
node 2 $X2 $Y; # (koordinat titik 2)
node 3 $X3 $Y; # (koordinat titik 3)
node 4 $X4 $Y; # (koordinat titik 4)
node 5 $X5 $Y; # (koordinat titik 5)
puts "Define Geometry OK"


# ==================================================================================================
# Define Single Point Constraints
# ------------------------------------------------------------------------------------------------
# 3. Reaksi Perletakkan
# ------------------------------------------------------------------------------------------------
# SPC tag Dx Dy Rz
fix 1 1 1 0; # perletakkan sendi
fix 2 0 0 0; # perletakkan bebas
fix 3 0 0 0; # perletakkan bebas
fix 4 0 0 0; # perletakkan bebas
fix 5 0 1 0; # perletakkan rol
puts "Define Single Point Constraint OK"


# ==================================================================================================
# Define Material(s)
# ------------------------------------------------------------------------------------------------
# 3. Mendefinisikan Material
# ------------------------------------------------------------------------------------------------
# 3.1 Material Beton
# ------------------------------------------------------------------------------------------------
set matTagC 1; # material ID tag
set fc [expr -30*$MPa]; # kuat tekan beton
set epsc0 [expr -0.002]; # regangan pada kekuatan maksimum
set fcu [expr -30*$MPa]; # tegangan maksimum
set epsu [expr -0.003]; # regangan pada kekuatan ultimate
set lambda [expr 0.5]; # tegangan ultimate(ratio)
set ft [expr $fc/10*$MPa]; # Kuat tarik beton = 1/10 (fc')
set Ets [expr 4730*sqrt(-$fc)*$MPa]; # Modulus Elastisitas tarik beton = 4730(fc')^0.5
# Material "BETON": matTag fc' epsc0 fcu' epsu lambda ft Ets
uniaxialMaterial Concrete02 $matTagC $fc $epsc0 $fcu $epsu $lambda $ft $Ets
# ------------------------------------------------------------------------------------------------
# 3.2 Material Baja
# ------------------------------------------------------------------------------------------------
set matTagS 2; # material ID tag
set Fy [expr 460*$MPa]; # kuat tarik baja
set E [expr 200000*$MPa]; # modulus elastisitas baja
set b [expr 0.05*$MPa]; # rasio pergeseran regangan
set R0 [expr 18.5]; # Indeks perubahan (R0)
set cR1 [expr 0.925]; # Indeks perubahan (R1)
set cR2 [expr 0.15]; # Indeks perubahan (R2)
set a1 [expr 0]; # Parameter pengerasan (a1)
set a2 [expr 1]; # Parameter pengerasan (a2)
set a3 [expr 0]; # Parameter pengerasan (a3)
set a4 [expr 1]; # Regangan awal (si0)
set sig0 [expr 0];
# Material "BAJA": matTag Fy E b R0 cR1 cR2 <a1 a2 a3 a4> <sig0>
uniaxialMaterial Steel02 $matTagS $Fy $E $b $R0 $cR1 $cR2 $a1 $a2 $a3 $a4 $sig0
puts "Define Materials OK"

# ==================================================================================================
# MODEL SECTION
# ==================================================================================================
# y
# ^
# |
# |
# -------------------- _ _
# | o o o | | cover
# | | |
# | | |
# | | |
# | | |
# z <--- | + | H
# | | |
# | | |
# | | |
# | | |
# | o o o | _|_ cover
# --------------------
# |-------- B ---------|
#
# ==================================================================================================
# Define Section(s)
# ------------------------------------------------------------------------------------------------
# 4. Mendefinisikan Penampang
# ------------------------------------------------------------------------------------------------
# 4.1. Geometri Penampang
# ------------------------------------------------------------------------------------------------
set BeamSecTag 1; # Penomoran Penampang Balok
set CoverBeam [expr 40*$mm]; # d'=h-d
set numBars 3; # Jumlah tulangan atas / bawah
set areabar [expr 314*$mm2]; # Luas satu buah tulangan
# ------------------------------------------------------------------------------------------------
# 4.2. RC Section
# ------------------------------------------------------------------------------------------------
# RC section:
set coverY [expr $HBeam/2.0]; # jarak titik tengah ke permukaan penampang y
set coverZ [expr $BBeam/2.0]; # jarak titik tengah ke permukaan penampang z
set coreY [expr $coverY-$CoverBeam]
set coreZ [expr $coverZ-$CoverBeam]
set nfY 10; # pembagian fiber arah y
set nfZ 10; # pembagian fiber arah z
section fiberSec $BeamSecTag {; # mendefiniskan penampang fiber
patch quadr $matTagC $nfZ $nfY -$coverY $coverZ -$coverY -$coverZ $coverY -$coverZ $coverY $coverZ; # mendefinisikan patch beton
layer straight $matTagS $numBars $areabar -$coreY $coreZ -$coreY -$coreZ; # tulangan atas
layer straight $matTagS $numBars $areabar $coreY $coreZ $coreY -$coreZ; # tulangan bawah
}; # selesai
puts "Define Section OK"


# ==================================================================================================
# Define geometric transformation(s)
# ------------------------------------------------------------------------------------------------
# 5. GEOMETRIC TRANSFORMATION
# ------------------------------------------------------------------------------------------------
set BeamTransfTag 1; # menghubungkan tag untuk transformasi balok
geomTransf Linear $BeamTransfTag;
puts "geometric transformation OK"


# ==================================================================================================
# Define element(s)
# ------------------------------------------------------------------------------------------------
# 6. koneksi elemen
# ------------------------------------------------------------------------------------------------
# element connectivity:
set numIntgrPts 5; # Jumlah titik untuk kekakuan elemen
# Element: eleTag NodeI NodeJ NIP secTag geoTranTag
element nonlinearBeamColumn 1 1 2 $numIntgrPts $BeamSecTag $BeamTransfTag;
element nonlinearBeamColumn 2 2 3 $numIntgrPts $BeamSecTag $BeamTransfTag;
element nonlinearBeamColumn 3 3 4 $numIntgrPts $BeamSecTag $BeamTransfTag;
element nonlinearBeamColumn 4 4 5 $numIntgrPts $BeamSecTag $BeamTransfTag;
puts "Element OK"


# ==================================================================================================
# Define Time Series(s)
# ------------------------------------------------------------------------------------------------
# 7. time series
# ------------------------------------------------------------------------------------------------
# TimeSeries "TIMESERIES": tsTag cFactor
timeSeries Linear 1 -factor +1.000000E+000
puts "Time Series OK"


# ==================================================================================================
# Define Load(s)
# ------------------------------------------------------------------------------------------------
# 8. Mendefinisikan Load Pattern
# ------------------------------------------------------------------------------------------------
# LoadPattern "LOADPATTERN": patternTag tsTag
pattern Plain 1 1 {
# Load nodeTag LoadValues
load 2 0 0.2 0
load 4 0 0.2 0
}
puts "Load Pattern OK"

# ==================================================================================================
# Define recorder(s)
# ------------------------------------------------------------------------------------------------
# 9. Mendefinisikan Recorder
# ------------------------------------------------------------------------------------------------
# ------------------------------------------------------------------------------------------------
# 10. DEFINE RECORDER (Recorder)
# ------------------------------------------------------------------------------------------------
recorder Node -file $dataDir/DFree.out -time -node 2 3 4 -dof 1 2 3 disp;
# displacements of free nodes

recorder Node -file $dataDir/DBase.out -time -node 1 5 -dof 1 2 3 disp;
# displacements of support nodes

recorder Node -file $dataDir/RBase.out -time -node 1 5 -dof 1 2 3 reaction;
# support reaction

recorder Node -file $dataDir/UFrc.out -time -node 1 2 3 4 5 -dof 1 2 3 unbalance;

recorder Element -file $dataDir/FBeam.out -time -ele 1 2 3 4 5 globalForce;
# element forces -- beam

recorder Element -file $dataDir/ForceBeamSec1.out -time -ele 1 2 3 4 5 section 1 force;
# Beam section forces, axial and moment, node i

recorder Element -file $dataDir/DefoBeamSec1.out -time -ele 1 2 3 4 5 sectin 1 deformation;
# section deformations, axial and curvature, node i

recorder Element -file $dataDir/ForceBeamSec$numIntgrPts.out -time -ele 1 2 3 4 5 section $numIntgrPts force;
# section forces, axial and moment, node j

recorder Element -file $dataDir/DefoBeamSec$numIntgrPts.out -time -ele 1 2 3 4 5 section $numIntgrPts deformation;
# section deformations, axial and curvature, node j


recorder EnvelopeElement -file $dataDir/ele1sec1Force.out -time -ele 1 2 3 4 section $BeamSecTag fiber 5 10;
# recorder stress strain responce
puts "Recorder OK"


# ==================================================================================================
# Define analysis options
# ------------------------------------------------------------------------------------------------
# 10. Mendefinisikan Analisa Option
# ------------------------------------------------------------------------------------------------

constraints Plain
# Constraint Handler

set iteration [expr 1000]; # jumlah iterasi
# Convergance Test iteration
test FixedNumIter $iteration 0 2

set du1 [expr 0*$mm]; # First Displacment
set Jd [expr 1]; # Time Step
set MinDu [expr 0.1*$mm]; # Minimal penambahan Du
set MaxDu [expr 0.1*$mm]; # Maximal penambahan Du
#integrator type node dof du1 Jd MinDu MaxDu
integrator DisplacementControl 3 2 $du1 $Jd $MinDu $MaxDu

# Solution Algorithm
algorithm Newton

# DOF Numberer
numberer Plain

# System of Equations
system BandGeneral

# Analysis Type
analysis Static
analyze 1000
puts "Analysis Option OK"

# ==================================================================================================
# Clean up
# ==================================================================================================
wipe
suciputrielza
Posts: 11
Joined: Sun Apr 08, 2012 5:17 am
Location: andalas university

Re: please check my source code

Post by suciputrielza »

please help me, i want to check load vs deflection and momen vs curvature from this problem (beam)...
whether my data input is correct???
what should i record, analysis to get it...
thank you very much....
vesna
Posts: 3033
Joined: Tue May 23, 2006 11:23 am
Location: UC Berkeley

Re: please check my source code

Post by vesna »

replace this:
recorder EnvelopeElement -file $dataDir/ele1sec1Force.out -time -ele 1 2 3 4 section $BeamSecTag fiber 5 10

with
recorder Element -file $dataDir/ele1sec1Stress.out -time -ele 1 2 3 4 section $BeamSecTag fiber 5. 10. stress
recorder Element -file $dataDir/ele1sec1Strain.out -time -ele 1 2 3 4 section $BeamSecTag fiber 5. 10. strain

$BeamSecTag should be a number of integration point along the element.
suciputrielza
Posts: 11
Joined: Sun Apr 08, 2012 5:17 am
Location: andalas university

Re: please check my source code

Post by suciputrielza »

thanks vesna....
and,
What data should I take for compare load vs. deflection, and moment vs. curvature

for load i choose UFrc.out
for deflection i choose DFree.out
its right..
but for moment and curvature, i don't know... :(
please help me..
vesna
Posts: 3033
Joined: Tue May 23, 2006 11:23 am
Location: UC Berkeley

Re: please check my source code

Post by vesna »

to get moment-curvature relationship you need to record sectional forces and deformations. Here you can find an example: http://opensees.berkeley.edu/wiki/index ... on_Example
Post Reply