element command inside 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
karimtarbali
Posts: 82
Joined: Fri Aug 14, 2009 12:11 am
Location: iiees

element command inside loop

Post by karimtarbali »

hi
i write the code below to use element commad inside a FOR loop but widows error appears and opensees gets crashed

could you please tell me what is wrong with my code. thank you

wipe
model basic -ndm 2 -ndf 3

uniaxialMaterial ElasticPP 1 21000000000 0.001724 -0.001724 0
uniaxialMaterial ElasticPP 2 21000000000 0.001241 -0.001241 0



proc Wsection { seciD matiD d bf tf tw nfdw nftw nfbf nftf} {


set dw [expr $d - 2 * $tf]
set y1 [expr -$d/2]
set y2 [expr -$dw/2]
set y3 [expr $dw/2]
set y4 [expr $d/2]

set z1 [expr -$bf/2]
set z2 [expr -$tw/2]
set z3 [expr $tw/2]
set z4 [expr $bf/2]

section fiberSec $seciD {
# nfii nfiK yi zi yi zi yK zK yL zL
patch quadr $matiD $nfbf $nftf $y1 $z4 $y1 $z1 $y2 $z1 $y2 $z4
patch quadr $matiD $nftw $nfdw $y2 $z3 $y2 $z2 $y3 $z2 $y3 $z3
patch quadr $matiD $nfbf $nftf $y3 $z4 $y3 $z1 $y4 $z1 $y4 $z4
}
}


# W14X22
Wsection 7 2 0.348 0.127 0.008509 0.005842 12 4 12 4


################### creating the elements


set k 0;

for {set i 2} { $i < 496 } {incr i 23} {

set j [expr $i+23];
set k [expr $k+1];

geomTransf Linear 1;

#element dispBeamColumn $eleTag $iNode $iNode $numintgrPts $secTag $transfTag <-mass $massDens>

element dispBeamColumn $k $i $j 5 7 1;


};
kt
fmk
Site Admin
Posts: 5884
Joined: Fri Jun 11, 2004 2:33 pm
Location: UC Berkeley
Contact:

Post by fmk »

you have not defined any nodes and you need to move the geometric transformation outside the loop, or change the transformation tag.

i will update the code so it gives a warning in future.
karimtarbali
Posts: 82
Joined: Fri Aug 14, 2009 12:11 am
Location: iiees

Post by karimtarbali »

first of all thank you for your kind responses .
i put geomtransf out of loop , and i defined nodes , and i changed the tag for geomtransf but the same thing happens
could you please tell me what should i do . thank you

here is my code :

wipe
model basic -ndm 2 -ndf 3

node 1 0.0 0.0 0.0
node 2 0.0 3.66 0.0
node 3 0.0 7.32 0.0
node 4 0.0 12.81 0.0

# .
# .
# .

for { set i 5} { $i < 24 } {incr i} {;

node $i 0.0 [expr 12.81+(3.9624*($i-4))] 0.0;

};

node 24 6.1 0.0 0.0
node 25 6.1 3.66 0.0
node 26 6.1 7.32 0.0
node 27 6.1 12.81 0.0

# .
# .
# .

for { set i 28} { $i < 47 } {incr i} {;

node $i 6.1 [expr 12.81+(3.9624*($i-27))] 0.0;

};
#---------------------------------------------------------------------------
node 47 12.2 0.0 0.0
node 48 12.2 3.66 0.0
node 49 12.2 7.32 0.0
node 50 12.2 12.81 0.0

# .
# .
# .

for { set i 51} { $i < 70 } {incr i} {;

node $i 12.2 [expr 12.81+(3.9624*($i-50))] 0.0;

};
#------------------------------------------------------------------------------
node 70 18.3 0.0 0.0

node 71 18.3 3.66 0.0
node 72 18.3 7.32 0.0
node 73 18.3 12.81 0.0

# .
# .
# .

for { set i 74} { $i < 93 } {incr i} {;

node $i 18.3 [expr 12.81+(3.9624*($i-73))] 0.0;

};
#------------------------------------------------------------------------------

node 93 24.4 0.0 0.0
node 94 24.4 3.66 0.0
node 95 24.4 7.32 0.0
node 96 24.4 12.81 0.0

# .
# .
# .
for { set i 97} { $i < 116 } {incr i} {;

node $i 24.4 [expr 12.81+(3.9624*($i-96))] 0.0;

};

uniaxialMaterial ElasticPP 1 21000000000 0.001724 -0.001724 0
uniaxialMaterial ElasticPP 2 21000000000 0.001241 -0.001241 0



proc Wsection { seciD matiD d bf tf tw nfdw nftw nfbf nftf} {


set dw [expr $d - 2 * $tf]
set y1 [expr -$d/2]
set y2 [expr -$dw/2]
set y3 [expr $dw/2]
set y4 [expr $d/2]

set z1 [expr -$bf/2]
set z2 [expr -$tw/2]
set z3 [expr $tw/2]
set z4 [expr $bf/2]

section fiberSec $seciD {
# nfii nfiK yi zi yi zi yK zK yL zL
patch quadr $matiD $nfbf $nftf $y1 $z4 $y1 $z1 $y2 $z1 $y2 $z4
patch quadr $matiD $nftw $nfdw $y2 $z3 $y2 $z2 $y3 $z2 $y3 $z3
patch quadr $matiD $nfbf $nftf $y3 $z4 $y3 $z1 $y4 $z1 $y4 $z4
}
}


# W14X22
Wsection 7 2 0.348 0.127 0.008509 0.005842 12 4 12 4

geomTransf Linear 2;

################### creating the elements


set k 0;

for {set i 2} { $i < 496 } {incr i 23} {

set j [expr $i+23];
set k [expr $k+1];


#element dispBeamColumn $eleTag $iNode $iNode $numintgrPts $secTag $transfTag <-mass $massDens>

element dispBeamColumn $k $i $j 5 7 2;


};
kt
zvidrih
Posts: 39
Joined: Wed Apr 30, 2008 1:55 am
Location: Ljubljana, Slovenia

counter

Post by zvidrih »

You have only defined 116 nodes, but you want to go till 496 ...

"for {set i 2} { $i < 496 } {incr i 23} {"
Zlatko Vidrih
Institute of Structural Engineering, earthquake Engineering and Construction IT
Faculty of Civil and Geodetic Engineering
University of Ljubljana, Slovenia
karimtarbali
Posts: 82
Joined: Fri Aug 14, 2009 12:11 am
Location: iiees

Post by karimtarbali »

thanks for your response BUT i corrected the loop to be inside the defined nodes and STILL i have that problem ?

could you please tell me how can i solve it??????
kt
zvidrih
Posts: 39
Joined: Wed Apr 30, 2008 1:55 am
Location: Ljubljana, Slovenia

puts

Post by zvidrih »

Hi,

there is nothing wrong with your code if you have "enough" nodes...

use puts command inside the for loop to check where is the problem, e.g.

for...
puts "element dispBeamColumn $k $i $j 5 7 2;"

}

and then check if your model has all the nodes you need...
Zlatko Vidrih
Institute of Structural Engineering, earthquake Engineering and Construction IT
Faculty of Civil and Geodetic Engineering
University of Ljubljana, Slovenia
karimtarbali
Posts: 82
Joined: Fri Aug 14, 2009 12:11 am
Location: iiees

Post by karimtarbali »

many thanks for your kind responses.

i finally figured the right code for creating the elements with FOR loop .

here is the loop :

geomTransf Linear 2;

################### creating the elements



# k = number of element

for {set k 1} {$k <= 494} {incr k 1} {

set inode 2
set jnode 25

element dispBeamColumn $k $inode $jnode 5 7 2

incr inode 23
incr jnode 23

}
kt
Post Reply