recorders in loop
Moderators: silvia, selimgunay, Moderators
-
- Posts: 82
- Joined: Tue Jun 19, 2012 1:56 am
recorders in loop
Dear Sir,
I am using the recorder Node command in a loop. But it is giving me the results for the first loop and overwrite the same values for the others loops. Can you please tell me what should I do to get the right results.
for {set i 1} {$i <=10} { incr i 1} {
recorder Node -file disp/pyDisplace$i.out -time -node 3711 3611 3511 3411 301 401 501 601 701 801 901 1101 1301 1501 1701 1901 2101 2301 2501 2701 3001 3201 -dof 1 disp;
}
set a [nodeDisp 3511 1];
Here, I am getting the same values of a. And I have also the check the file showing the same values in all.
I am using the recorder Node command in a loop. But it is giving me the results for the first loop and overwrite the same values for the others loops. Can you please tell me what should I do to get the right results.
for {set i 1} {$i <=10} { incr i 1} {
recorder Node -file disp/pyDisplace$i.out -time -node 3711 3611 3511 3411 301 401 501 601 701 801 901 1101 1301 1501 1701 1901 2101 2301 2501 2701 3001 3201 -dof 1 disp;
}
set a [nodeDisp 3511 1];
Here, I am getting the same values of a. And I have also the check the file showing the same values in all.
Re: recorders in loop
and where is the analyze command in relation to the for loop? if outside then you will simply have a number of recorders all recording the same results. if inside, unless you have a remove recorder commmand, the first recorder will have 10 lines, and each subsequent one 1 line less.
as neither really makes much sense, what are you trying to do?
as neither really makes much sense, what are you trying to do?
Re: recorders in loop
if the analysis be inside the loop, how can we remove recorder?
Re: recorders in loop
the recorder command actually returns an integer value .. that value can be used to "remove recorder $recorderTag"
http://opensees.berkeley.edu/wiki/index ... er_Command
http://opensees.berkeley.edu/wiki/index ... er_Command
Re: recorders in loop
so how should use remove recorder command in the loop, to record disp for each i?
Re: recorders in loop
for {set i 1 }{$i <= 10} {incr i 1} {
set rTag [recorder Node -file $i.out ..... .]
analyze 1
remove recorder $rTag
}
set rTag [recorder Node -file $i.out ..... .]
analyze 1
remove recorder $rTag
}
-
- Posts: 82
- Joined: Tue Jun 19, 2012 1:56 am
Re: recorders in loop
Dear Sir,
I have done the same thing as you have told earlier. Here is the recorder part.......
pattern Plain 1 Constant {
load 3511 1350 0 0 0 0 0;
}
file mkdir disp
recorder Node -file [ format "disp/pyDisplace%i.out" $i] -time -node 3711 3611 3511 3411 301 401 501 601 701 801 901 1101 1301 1501 1701 1901 2101 2301 2501 2701 3001 3201 -dof 1 disp;
recorder Node -file disp/pyforces.out -time -node 2 3 4 5 6 7 8 9 11 13 15 17 19 21 23 25 27 30 32 -dof 1 reaction;
integrator LoadControl 1;
numberer Plain;
system BandGeneral;
constraints Transformation;
algorithm Linear;
analysis Static;
set startT [clock seconds]
analyze 1;
set endT [clock seconds]
puts " analysis execution time : [expr $endT -$startT] seconds"
#set x [eval "recorder Node -file disp/pyDisplace$i.out -time -node 3711 3611 3511 3411 301 401 501 601 701 801 901 1101 1301 1501 1701 1901 2101 2301 2501 2701 3001 3201 -dof 1 disp"];
remove recorders
remove loadPattern 1
set cal_top_disp [nodeDisp 3711 1]
Actually, I have used the nested loop, in which recorder is in the outside loop. like
for {set i 1 } {$i<=10} {incr i 1} {
for {set j 1 } {$j<=10} {incr j 1} {
}
recorder and analyses command (shown above)
}
Please tell me how to overcome the problem of getting the same output for each i
I have done the same thing as you have told earlier. Here is the recorder part.......
pattern Plain 1 Constant {
load 3511 1350 0 0 0 0 0;
}
file mkdir disp
recorder Node -file [ format "disp/pyDisplace%i.out" $i] -time -node 3711 3611 3511 3411 301 401 501 601 701 801 901 1101 1301 1501 1701 1901 2101 2301 2501 2701 3001 3201 -dof 1 disp;
recorder Node -file disp/pyforces.out -time -node 2 3 4 5 6 7 8 9 11 13 15 17 19 21 23 25 27 30 32 -dof 1 reaction;
integrator LoadControl 1;
numberer Plain;
system BandGeneral;
constraints Transformation;
algorithm Linear;
analysis Static;
set startT [clock seconds]
analyze 1;
set endT [clock seconds]
puts " analysis execution time : [expr $endT -$startT] seconds"
#set x [eval "recorder Node -file disp/pyDisplace$i.out -time -node 3711 3611 3511 3411 301 401 501 601 701 801 901 1101 1301 1501 1701 1901 2101 2301 2501 2701 3001 3201 -dof 1 disp"];
remove recorders
remove loadPattern 1
set cal_top_disp [nodeDisp 3711 1]
Actually, I have used the nested loop, in which recorder is in the outside loop. like
for {set i 1 } {$i<=10} {incr i 1} {
for {set j 1 } {$j<=10} {incr j 1} {
}
recorder and analyses command (shown above)
}
Please tell me how to overcome the problem of getting the same output for each i
Re: recorders in loop
you have a constant load pattern .. displacements are not going to change!
-
- Posts: 82
- Joined: Tue Jun 19, 2012 1:56 am
Re: recorders in loop
then, what should I do
Re: recorders in loop
use a different load pattern! add more loads!! i can't tell you what to do it is your model and only you know what it is you are trying to do.
-
- Posts: 82
- Joined: Tue Jun 19, 2012 1:56 am
Re: recorders in loop
In each loop, I am not only removing the recorder, but also the load pattern. Then, in each loop, loop will be apply again. Then, what can be a problem in this.
( problem of constant load pattern)
( problem of constant load pattern)
-
- Posts: 82
- Joined: Tue Jun 19, 2012 1:56 am
Re: recorders in loop
Actually, I want to tell you one more thing, I am using elastic isotropic material whose strength is changing in each loop. I am calculating the displacement corresponding to that strength. Hence, I use constant load pattern in each loop. Now, I don't thing so, there will a ant problem in using constant load pattern.
-
- Posts: 82
- Joined: Tue Jun 19, 2012 1:56 am
Re: recorders in loop
I want to know how to apply a load in a loop so that we will have same load everytime in a loop.
I tried constant - getting same results for each loop.
Linear - results are different, but giving very high value.
Rectangular - giving same results as the constant load command
I tried constant - getting same results for each loop.
Linear - results are different, but giving very high value.
Rectangular - giving same results as the constant load command
Re: recorders in loop
when you use constant the load values are the same in every loop! .. so i can only ask you to rephrase the question.
-
- Posts: 82
- Joined: Tue Jun 19, 2012 1:56 am
Re: recorders in loop
Actually, the value of the load has to be constant. Here is my code. I reduce its length.
wipe;
model BasicBuilder -ndm 3 -ndf 3;
node 3 0 0 29.5; #0.5
node 4 0 0 28.5; #1.5
node 5 0 0 27.5; #2.5
node 6 0 0 26.5; #3.5
node 7 0 0 25.5; #4.5
# node for spring end is created.
node 301 1 0 29.5;
node 401 1 0 28.5;
node 501 1 0 27.5;
node 601 1 0 26.5;
node 701 1 0 25.5;
# node for the spring start is calculated...
fix 3 1 1 1;
fix 4 1 1 1;
fix 5 1 1 1;
fix 6 1 1 1;
fix 7 1 1 1;
# base of spring is fixed
fix 301 0 1 1;
fix 401 0 1 1;
fix 501 0 1 1;
fix 601 0 1 1;
fix 701 0 1 1;
# springs are allowed to move in x-direction only.
set strain {0.00001 0.00002 0.00003 0.00004 0.00005 }
set strain_factor {0.955 0.925 0.905 0.885 0.865}
set G_max {
104265
169540
234816
656797
1078779
}
set spring_factor 1
set strain_incr 0
set deflection 0.0015
set deflection1 [expr $deflection+0.1*$deflection]
set deflection2 [expr $deflection-0.1*$deflection]
set n [llength $strain]
set l [llength $G_max]
for {set i 1} {$i<=$n} {incr i 1} {
puts "\n\n Iteration $i \n"
set S($i) [lindex $strain $strain_incr]
puts "strain $S($i)"
set SF($i) [lindex $strain_factor $strain_incr]
puts "strain_factor $SF($i)"
set G_incr 0
for {set j 1} {$j<=$l} {incr j 1} {
set G_maximum($j) [lindex $G_max $G_incr]
set G($j) [expr $SF($i)*$G_maximum($j)]
set k($j) [expr $G($j)*$spring_factor]
incr G_incr
}
puts "$G(1) $G(2) $G(3)";
uniaxialMaterial Elastic 300$i [expr $k(1) ] 0;
uniaxialMaterial Elastic 400$i [expr $k(2) ] 0;
uniaxialMaterial Elastic 500$i [expr $k(3) ] 0;
uniaxialMaterial Elastic 600$i [expr $k(4) ] 0;
uniaxialMaterial Elastic 700$i [expr $k(5) ] 0;
element truss 300$i 3 301 1 300$i;
element truss 400$i 4 401 1 400$i;
element truss 500$i 5 501 1 500$i;
element truss 600$i 6 601 1 600$i;
element truss 700$i 7 701 1 700$i;
if {$i == 1} {
model BasicBuilder -ndm 3 -ndf 6;
set transTag 1;
geomTransf Linear $transTag 0 -1 0;
node 3511 1 0 30.6;
node 3411 1 0 30.1;
node 311 1 0 29.5;
node 411 1 0 28.5;
node 511 1 0 27.5;
node 611 1 0 26.5;
node 711 1 0 25.5;
node 811 1 0 24.5;
fix 3511 0 1 0 1 0 1;
fix 3411 0 1 0 1 0 1;
fix 311 0 1 0 1 0 1;
fix 411 0 1 0 1 0 1;
fix 511 0 1 0 1 0 1;
fix 611 0 1 0 1 0 1;
fix 711 0 1 0 1 0 1;
fix 811 0 1 1 1 0 1;
equalDOF 311 301 1;
equalDOF 411 401 1;
equalDOF 511 501 1;
equalDOF 611 601 1;
equalDOF 711 701 1;
set pi 3.14;
set r 1.2;
set a [expr $pi*$r*$r/4];
set I [expr $pi*$r*$r*$r*$r/4.0];
set J [expr 2*$I];
set E [expr 29.58e06*1.0]; #M35 grade
set nu 0.3;
set G_pile [expr $E/(2.0*(1.0+$nu))]
set nIntpts 3;
set sectag 1;
set sectag3D 3;
section Elastic $sectag $E $a $I $I $G_pile $J;
uniaxialMaterial Elastic 100 1.e10;
section Aggregator $sectag3D 100 T -section $sectag
# create pile element
element dispBeamColumn 3511 3511 3411 $nIntpts $sectag3D $transTag;
element dispBeamColumn 3411 3411 311 $nIntpts $sectag3D $transTag;
element dispBeamColumn 311 311 411 $nIntpts $sectag3D $transTag;
element dispBeamColumn 411 411 511 $nIntpts $sectag3D $transTag;
element dispBeamColumn 511 511 611 $nIntpts $sectag3D $transTag;
element dispBeamColumn 611 611 711 $nIntpts $sectag3D $transTag;
element dispBeamColumn 711 711 811 $nIntpts $sectag3D $transTag;
}
pattern Plain 1 Constant {
load 3511 100 0 0 0 0 0;
}
file mkdir disp
recorder Node -file disp/pyDisplace.out -time -node 3511 3411 301 401 501 601 701 -dof 1 disp;
recorder Node -file disp/pyforces.out -time -node 3 4 5 6 7 -dof 1 reaction;
integrator LoadControl 1;
numberer Plain;
system BandGeneral;
constraints Transformation;
algorithm Linear;
analysis Static;
set startT [clock seconds]
analyze 1;
set endT [clock seconds]
puts " analysis execution time : [expr $endT -$startT] seconds"
remove recorders
remove loadPattern 1
set cal_top_disp [nodeDisp 3511 1]
set top_disp [format "%6.8f" $cal_top_disp]
puts "top_disp $top_disp"
if { $top_disp >= $deflection2} {
if { $top_disp <=$deflection1} {
puts $S($i)
puts $deflection
break;
}
}
incr strain_incr
}
puts "done"
Here, you can see that the stiffness of the truss element changes in every loop and load is constant throughout the code. But, I am getting the same displacement for every loop. However, it should increase with loop number.
Now, I think that you have understand my problem. Please tell me how to overcome this problem
wipe;
model BasicBuilder -ndm 3 -ndf 3;
node 3 0 0 29.5; #0.5
node 4 0 0 28.5; #1.5
node 5 0 0 27.5; #2.5
node 6 0 0 26.5; #3.5
node 7 0 0 25.5; #4.5
# node for spring end is created.
node 301 1 0 29.5;
node 401 1 0 28.5;
node 501 1 0 27.5;
node 601 1 0 26.5;
node 701 1 0 25.5;
# node for the spring start is calculated...
fix 3 1 1 1;
fix 4 1 1 1;
fix 5 1 1 1;
fix 6 1 1 1;
fix 7 1 1 1;
# base of spring is fixed
fix 301 0 1 1;
fix 401 0 1 1;
fix 501 0 1 1;
fix 601 0 1 1;
fix 701 0 1 1;
# springs are allowed to move in x-direction only.
set strain {0.00001 0.00002 0.00003 0.00004 0.00005 }
set strain_factor {0.955 0.925 0.905 0.885 0.865}
set G_max {
104265
169540
234816
656797
1078779
}
set spring_factor 1
set strain_incr 0
set deflection 0.0015
set deflection1 [expr $deflection+0.1*$deflection]
set deflection2 [expr $deflection-0.1*$deflection]
set n [llength $strain]
set l [llength $G_max]
for {set i 1} {$i<=$n} {incr i 1} {
puts "\n\n Iteration $i \n"
set S($i) [lindex $strain $strain_incr]
puts "strain $S($i)"
set SF($i) [lindex $strain_factor $strain_incr]
puts "strain_factor $SF($i)"
set G_incr 0
for {set j 1} {$j<=$l} {incr j 1} {
set G_maximum($j) [lindex $G_max $G_incr]
set G($j) [expr $SF($i)*$G_maximum($j)]
set k($j) [expr $G($j)*$spring_factor]
incr G_incr
}
puts "$G(1) $G(2) $G(3)";
uniaxialMaterial Elastic 300$i [expr $k(1) ] 0;
uniaxialMaterial Elastic 400$i [expr $k(2) ] 0;
uniaxialMaterial Elastic 500$i [expr $k(3) ] 0;
uniaxialMaterial Elastic 600$i [expr $k(4) ] 0;
uniaxialMaterial Elastic 700$i [expr $k(5) ] 0;
element truss 300$i 3 301 1 300$i;
element truss 400$i 4 401 1 400$i;
element truss 500$i 5 501 1 500$i;
element truss 600$i 6 601 1 600$i;
element truss 700$i 7 701 1 700$i;
if {$i == 1} {
model BasicBuilder -ndm 3 -ndf 6;
set transTag 1;
geomTransf Linear $transTag 0 -1 0;
node 3511 1 0 30.6;
node 3411 1 0 30.1;
node 311 1 0 29.5;
node 411 1 0 28.5;
node 511 1 0 27.5;
node 611 1 0 26.5;
node 711 1 0 25.5;
node 811 1 0 24.5;
fix 3511 0 1 0 1 0 1;
fix 3411 0 1 0 1 0 1;
fix 311 0 1 0 1 0 1;
fix 411 0 1 0 1 0 1;
fix 511 0 1 0 1 0 1;
fix 611 0 1 0 1 0 1;
fix 711 0 1 0 1 0 1;
fix 811 0 1 1 1 0 1;
equalDOF 311 301 1;
equalDOF 411 401 1;
equalDOF 511 501 1;
equalDOF 611 601 1;
equalDOF 711 701 1;
set pi 3.14;
set r 1.2;
set a [expr $pi*$r*$r/4];
set I [expr $pi*$r*$r*$r*$r/4.0];
set J [expr 2*$I];
set E [expr 29.58e06*1.0]; #M35 grade
set nu 0.3;
set G_pile [expr $E/(2.0*(1.0+$nu))]
set nIntpts 3;
set sectag 1;
set sectag3D 3;
section Elastic $sectag $E $a $I $I $G_pile $J;
uniaxialMaterial Elastic 100 1.e10;
section Aggregator $sectag3D 100 T -section $sectag
# create pile element
element dispBeamColumn 3511 3511 3411 $nIntpts $sectag3D $transTag;
element dispBeamColumn 3411 3411 311 $nIntpts $sectag3D $transTag;
element dispBeamColumn 311 311 411 $nIntpts $sectag3D $transTag;
element dispBeamColumn 411 411 511 $nIntpts $sectag3D $transTag;
element dispBeamColumn 511 511 611 $nIntpts $sectag3D $transTag;
element dispBeamColumn 611 611 711 $nIntpts $sectag3D $transTag;
element dispBeamColumn 711 711 811 $nIntpts $sectag3D $transTag;
}
pattern Plain 1 Constant {
load 3511 100 0 0 0 0 0;
}
file mkdir disp
recorder Node -file disp/pyDisplace.out -time -node 3511 3411 301 401 501 601 701 -dof 1 disp;
recorder Node -file disp/pyforces.out -time -node 3 4 5 6 7 -dof 1 reaction;
integrator LoadControl 1;
numberer Plain;
system BandGeneral;
constraints Transformation;
algorithm Linear;
analysis Static;
set startT [clock seconds]
analyze 1;
set endT [clock seconds]
puts " analysis execution time : [expr $endT -$startT] seconds"
remove recorders
remove loadPattern 1
set cal_top_disp [nodeDisp 3511 1]
set top_disp [format "%6.8f" $cal_top_disp]
puts "top_disp $top_disp"
if { $top_disp >= $deflection2} {
if { $top_disp <=$deflection1} {
puts $S($i)
puts $deflection
break;
}
}
incr strain_incr
}
puts "done"
Here, you can see that the stiffness of the truss element changes in every loop and load is constant throughout the code. But, I am getting the same displacement for every loop. However, it should increase with loop number.
Now, I think that you have understand my problem. Please tell me how to overcome this problem