Find MAX from output data

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

Moderators: silvia, selimgunay, Moderators

Post Reply
hibahashim
Posts: 7
Joined: Sun Jul 01, 2018 6:13 pm
Location: Kookmin University

Find MAX from output data

Post by hibahashim »

Dear All,
How can i find the maximum peak value from output data that i get after analysis?
The output,say DBase.out, contains time and displacement data of a node and i want to find the maximum displacement. Also i want to do this in a loop and find the peak response for various iterations and plot it.
So how can i record the maximum values from each iteration?

I am new to tcl and opensees. Please HELP! :)
Hwoarang
Posts: 18
Joined: Mon Jul 16, 2018 11:27 pm

Re: Find MAX from output data

Post by Hwoarang »

Dear Hibahashim

you can do it simply by using MATLAB or Excel.
hibahashim
Posts: 7
Joined: Sun Jul 01, 2018 6:13 pm
Location: Kookmin University

Re: Find MAX from output data

Post by hibahashim »

Dear Hwoarang,

Thank you very much for your speedy reply.
Yes, Matlab and excel are good but how will I record the displacement values. Also my for loop isnt working no matter what i try.


"# SET UP
wipe; # clear opensees model
model basic -ndm 2 -ndf 3; # 2 dimensions, 3 dof per node
file mkdir data; # create data directory

# define GEOMETRY -------------------------------------------------------------
# nodal coordinates:
node 1 0. 0.; # node#, X Y
node 2 0. 432.

# Single point constraints -- Boundary Conditions
fix 1 1 1 1; # node DX DY RZ

# nodal masses:
for {set i 0} {$i<10} {incr $i} {set m 5.18+$i
mass 2 $m 0. 0.} # node#, Mx My Mz, Mass=Weight/g.

# Define ELEMENTS -------------------------------------------------------------
# define geometric transformation: performs a linear geometric transformation of beam stiffness and resisting force from the basic system to the global-coordinate system
geomTransf Linear 1; # associate a tag to transformation

# connectivity:
element elasticBeamColumn 1 1 2 3600 3225 1080000 1; # element elasticBeamColumn $eleTag $iNode $jNode $A $E $Iz $transfTag

# Define RECORDERS -------------------------------------------------------------
recorder Node -file Data/DFree.out -time -node 2 -dof 1 2 3 disp; # displacements of free nodes
recorder Node -file Data/RBase.out -time -node 1 -dof 1 2 3 reaction; # support reaction
recorder Drift -file Data/Drift.out -time -iNode 1 -jNode 2 -dof 1 -perpDirn 2 ; # lateral drift
recorder Element -file Data/FCol.out -time -ele 1 force; # element forces -- column

# define GRAVITY -------------------------------------------------------------
timeSeries Linear 1
pattern Plain 1 1 {
load 2 0. -2000. 0.; # node#, FX FY MZ -- superstructure-weight
}
constraints Plain; # how it handles boundary conditions
numberer Plain; # renumber dof's to minimize band-width (optimization), if you want to
system BandGeneral; # how to store and solve the system of equations in the analysis
algorithm Linear; # use Linear algorithm for linear analysis
integrator LoadControl 0.1; # determine the next time step for an analysis, # apply gravity in 10 steps
analysis Static # define type of analysis static or transient
analyze 10; # perform gravity analysis
loadConst -time 0.0; # hold gravity constant and restart time

# DYNAMIC ground-motion analysis -------------------------------------------------------------
# create load pattern
set G 386
timeSeries Path 2 -dt 0.005 -filePath A10000.tcl -factor $G; # define acceleration vector from file (dt=0.005 is associated with the input file gm)
pattern UniformExcitation 2 1 -accel 2; # define where and how (pattern tag, dof) acceleration is applied

# set damping based on first eigen mode
set freq [expr [eigen -fullGenLapack 1]**0.5]
set dampRatio 0.02
rayleigh 0. 0. 0. [expr 2*$dampRatio/$freq]

# display displacement shape of the column
recorder display "Displaced shape" 10 10 500 500 -wipe
prp 200. 50. 1;
vup 0 1 0;
vpn 0 0 1;
display 1 5 40

# create the analysis
wipeAnalysis; # clear previously-define analysis parameters
constraints Plain; # how it handles boundary conditions
numberer Plain; # renumber dof's to minimize band-width (optimization), if you want to
system BandGeneral; # how to store and solve the system of equations in the analysis
algorithm Linear # use Linear algorithm for linear analysis
integrator Newmark 0.5 0.25 ; # determine the next time step for an analysis
analysis Transient; # define type of analysis: time-dependent
analyze 3995 0.01; # apply 3995 0.01-sec time steps in analysis


puts "Done!"
wipe
"
This is the code I'm working on...what i want to do is repeat the analysis with changing values of mass and note the peak displacement for each iteration.

I'm very new in all of this. Please excuse any mistakes
Please HELP :)
kesavapraba
Posts: 46
Joined: Mon Jan 22, 2018 1:38 am

Re: Find MAX from output data

Post by kesavapraba »

Dear Friend
I used the following procedure to find the maximum value in one of my code. Please try it for your case if it works.


# This section reads the data from your DBase.out file i.e. displacements
set fid01 [open DBase.out r];
set file_Data [read $fid01];
close $fid01;
set data [split $file_Data "\n"];


# ------Proc for finding maximum value from a list------------
proc maxindex list {
set index 10; # Pushover data starts from 11th line
set maxindex $index
set maxval [lindex $list 10]
foreach val $list {
if {$val > $maxval} {
set maxindex $index
set maxval $val
}
incr index
}
return $maxval
};

# This section returns maximum value from the DBase.out
set MaxVal [maxindex $data];
puts $MaxVal
Hwoarang
Posts: 18
Joined: Mon Jul 16, 2018 11:27 pm

Re: Find MAX from output data

Post by Hwoarang »

If you remove $ between incr and i, the problem with your loop will be resolved.
rrodriguez
Posts: 1
Joined: Wed Oct 10, 2018 6:34 pm

Re: Find MAX from output data

Post by rrodriguez »

I have a similar question where I am trying to read values from an output file called maxA.out. The file consists of just three maximum acceleration values obtained from the node envelope command. I copied the text below and was not able to extract the absolute value of maximum acceleration. Any help?

e.g. maxA.out
-12.8
13.7
13.7

My code is pretty lengthy, but I wish to eventually plot maximum acceleration against exciting frequency of my system. Thus, I will loop my program a couple times to do this plot.
Post Reply