Using for loop

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

Moderators: silvia, selimgunay, Moderators

Post Reply
madarshahian
Posts: 16
Joined: Thu Jun 08, 2006 3:17 pm
Location: University of California at San Diego
Contact:

Using for loop

Post by madarshahian »

Dear All;
I want to use harmonic analysis for one story and one way frame. I want repeat this analysis ten times and in each, period of harmonic will change and I want save results in separate files, therefor I defined a loop with "for". then analysis were done without any error and warning and I have ten output file too, but unfortunately nine files have identical results which is extra ordinary. I guess there is a mistake in changing of period of excitation. could please help me if using "for" loop is correct or not and if there is better way or not?
I added our file here too.
thank you in advance.

for {set ax 1} {$ax < 10} {incr ax} {

source geoandmat.tcl
source gravity.tcl
print output.out
#static analysis
source staticanalysis.tcl
#-----------------------------------------------------------------
set PI [expr 2*asin(1.0)];
#Eigen analysis
source eigenanalysis.tcl
#analysis Transient
set g 9.81
set GMdirection 1;#ground motion direction
set GMSineAccAmpl [expr 0.50*$g];#sine ground motion amplitude
set TPeriodSine [expr 1/($ax)];#period of input sine wave per sec
set DurationSine 3;#duration of input sine wave
# set up ground motion analysis parameters
set DtAnalysis 0.01;#time step Dt for lateral analysis
set TmaxAnalysis 10;#maximum duration of ground motion analysis
# set up analysis parameters
source LibAnalysisDynamicParameters.tcl
# define DAMPING
source RayleighDamping.tcl

#----------- perform Dynamic Ground-Motion Analysis
# the following commands are unique to the sine-wave excitation
set IDloadTag 400;# for uniformSupport excitation
set DtGround 0.005;# time-step Dt for input ground motion
set omegaSine [expr 2*$PI/$TPeriodSine];
set vel0 [expr $GMSineAccAmpl*(-1)/$omegaSine];
set AccelSeries "Sine 0. $DurationSine $TPeriodSine -factor $GMSineAccAmpl "
pattern UniformExcitation $IDloadTag $GMdirection -accel $AccelSeries -vel0 $vel0
set Nstep [expr int($TmaxAnalysis/$DtAnalysis)];
recorder Node -file result[expr $ax].out -time -node 3 -dof 1 disp -time
#recorder Node -file result2.out -node 1 -dof 1 2 3 4 5 6 reaction -time
set ok [analyze $Nstep $DtAnalysis];#actually perform analysis;return ok=0 if analysis was successful
source convergensproblem.tcl
puts "Ground Motion Done. End Time: [getTime]"
puts "ax is $ax"
}
madarshahian
Posts: 16
Joined: Thu Jun 08, 2006 3:17 pm
Location: University of California at San Diego
Contact:

Post by madarshahian »

Dear frends;
I understand that when I replace 1/$ax by 1./$ax; my problem is solved.
I just want to know if my way is the better one for this goal or not?
fmk
Site Admin
Posts: 5884
Joined: Fri Jun 11, 2004 2:33 pm
Location: UC Berkeley
Contact:

Post by fmk »

your choice of method is correct.
Post Reply