how to use region node or element command

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

Moderators: silvia, selimgunay, Moderators

Post Reply
payamdindar
Posts: 21
Joined: Sun Jul 24, 2011 4:48 am
Location: SRBIAU

how to use region node or element command

Post by payamdindar »

hi friends
(first): I decided to modeling 2D , 2story frame with 2 different damping ratio (each story have a uniqe damping ratio) . i use region command in tcl but unfortunately dont work correct. i guess , i write uncorrect region command.
(second): after modeling 2story frame with 2 different damping ratio i will write command for this model in order that these damping ration can change together in each time. (C1 and C2 can switching together depending with time)
can any body help me?
my tcl will attach




wipe

model BasicBuilder -ndm 2 -ndf 3

file mkdir nonclasic

set L [expr 5]
set H [expr 5]

node 1 0 0
node 2 $L 0
node 3 0 $H
node 4 $L $H
node 5 0 [expr 2*$H]
node 6 $L [expr 2*$H]

fix 1 1 1 1
fix 2 1 1 1

equalDOF 3 4 1
equalDOF 5 6 1

set M1 [expr 1000]
set M2 [expr 1000]

mass 3 $M1 0. 1e-10
mass 4 $M1 0. 1e-10
mass 5 $M2 0. 1e-10
mass 6 $M2 0. 1e-10

geomTransf Linear 1

set E1 [expr 2.e11]
set E2 [expr 2.e11]

set Fy1 [expr 2.e8]
set Fy2 [expr 2.e8]

uniaxialMaterial Steel01 1 $Fy1 $E1 0.02

section fiberSec 1 {
patch quad 1 2 4 -0.1 -0.1 0.1 -0.1 0.1 -0.09 -0.1 -0.09
patch quad 1 2 8 -0.005 -0.09 0.005 -0.09 0.005 0.09 -0.005 0.09
patch quad 1 2 4 -0.1 0.09 0.1 0.09 0.1 0.1 -0.1 0.1
}

uniaxialMaterial Steel01 2 $Fy2 $E2 0.02

section fiberSec 2 {
patch quad 2 2 4 -0.1 -0.1 0.1 -0.1 0.1 -0.09 -0.1 -0.09
patch quad 2 2 8 -0.005 -0.09 0.005 -0.09 0.005 0.09 -0.005 0.09
patch quad 2 2 4 -0.1 0.09 0.1 0.09 0.1 0.1 -0.1 0.1
}

#set I1 [expr 4.1e-5]
#set I2 [expr 4.1e-5]
#set K1 [expr (2*12*$E1*$I1)/pow($H,3)]
#set K2 [expr (2*12*$E2*$I2)/pow($H,3)]
#set X1 [expr 0.15]
#set X2 [expr 0.1]
#set K [expr $K1+$K2]
#set M [expr $M1+$M2]
#set W [expr sqrt($K/$M)]
#set C1 [expr $X1*(2*$M*$W)]
#set C2 [expr $X2*(2*$M*$W)]

element nonlinearBeamColumn 1 1 3 10 1 1
element nonlinearBeamColumn 2 2 4 10 1 1
element nonlinearBeamColumn 3 3 4 10 1 1
element nonlinearBeamColumn 4 3 5 10 2 1
element nonlinearBeamColumn 5 4 6 10 2 1
element nonlinearBeamColumn 6 5 6 10 2 1

set accel "Series -dt 0.01 -filePath ElCentroArray9180(dt=0.01)PGA=0.4g.txt -factor [expr 10*9.81]"

pattern UniformExcitation 3 1 -accel $accel

set x1Damp 0.1;
set M1propSwitch 1.0;
set K1currSwitch 0.0;
set K1commSwitch 1.0;
set K1initSwitch 0.0;
set nEigenI 1;
set nEigenJ 2;
set lambdaN [eigen [expr $nEigenJ]];
set lambdaI [lindex $lambdaN [expr $nEigenI-1]];
set lambdaJ [lindex $lambdaN [expr $nEigenJ-1]];
set omegaI [expr pow($lambdaI,0.5)];
set omegaJ [expr pow($lambdaJ,0.5)];
set alphaM1 [expr $M1propSwitch*$x1Damp*(2*$omegaI*$omegaJ)/($omegaI+$omegaJ)];
set betaK1curr [expr $K1currSwitch*2.*$x1Damp/($omegaI+$omegaJ)];
set betaK1comm [expr $K1commSwitch*2.*$x1Damp/($omegaI+$omegaJ)];
set betaK1init [expr $K1initSwitch*2.*$x1Damp/($omegaI+$omegaJ)];

region 1 -eleRange 1 3 rayleigh $alphaM1 $betaK1curr $betaK1init $betaK1comm;
region 3 -nodeRange 1 4 rayleigh $alphaM1 $betaK1curr $betaK1init $betaK1comm;

rayleigh $alphaM1 $betaK1curr $betaK1init $betaK1comm;

set x2Damp 0.01;
set M2propSwitch 1.0;
set K2currSwitch 0.0;
set K2commSwitch 1.0;
set K2initSwitch 0.0;
set nEigenI 1;
set nEigenJ 2;
set lambdaN [eigen [expr $nEigenJ]];
set lambdaI [lindex $lambdaN [expr $nEigenI-1]];
set lambdaJ [lindex $lambdaN [expr $nEigenJ-1]];
set omegaI [expr pow($lambdaI,0.5)];
set omegaJ [expr pow($lambdaJ,0.5)];
set alphaM2 [expr $M2propSwitch*$x2Damp*(2*$omegaI*$omegaJ)/($omegaI+$omegaJ)];
set betaK2curr [expr $K2currSwitch*2.*$x2Damp/($omegaI+$omegaJ)];
set betaK2comm [expr $K2commSwitch*2.*$x2Damp/($omegaI+$omegaJ)];
set betaK2init [expr $K2initSwitch*2.*$x2Damp/($omegaI+$omegaJ)];

region 2 -eleRange 4 6 rayleigh $alphaM2 $betaK2curr $betaK2init $betaK2comm;
region 4 -nodeRange 5 6 rayleigh $alphaM2 $betaK2curr $betaK2init $betaK2comm;

rayleigh $alphaM2 $betaK2curr $betaK2init $betaK2comm;

recorder Node -file nonclasic/node4disp.out -time -node 4 -dof 1 disp
recorder Node -file nonclasic/node6disp.out -time -node 6 -dof 1 disp
recorder Node -file nonclasic/RBase1.out -time -node 1 -dof 1 2 3 reaction
recorder Node -file nonclasic/RBase2.out -time -node 2 -dof 1 2 3 reaction
recorder Drift -file nonclasic/Drift1.out -time -iNode 2 -jNode 4 -dof 1 -perpDirn 2
recorder Drift -file nonclasic/Drift2.out -time -iNode 4 -jNode 6 -dof 1 -perpDirn 2
recorder Element -file nonclasic/FCol1.out -time -ele 1 globalForce;
recorder Element -file nonclasic/FCol2.out -time -ele 2 globalForce;
recorder Element -file nonclasic/FCol4.out -time -ele 4 globalForce;
recorder Element -file nonclasic/FCol5.out -time -ele 5 globalForce;
recorder Element -file nonclasic/FBeam3.out -time -ele 3 globalForce;
recorder Element -file nonclasic/FBeam6.out -time -ele 6 globalForce;

recorder display "nonclasic" 500 0 500 500 -wipe
prp 0 0 1
vup 0 1 0
vpn 0 0 1
viewWindow -10 10 -10 10
display 1 5 5

constraints Plain
numberer Plain
system BandGeneral
test NormDispIncr 1.0e-10 10
algorithm Newton
integrator Newmark 0.5 0.25
analyze 5000 0.01

#for {set i 1} {$i <= 5000} {incr i 1} {
#analyze 5000 0.01
if {[expr $Dispnode4 1] > 0.01} {
puts "[getTime] [nodeDisp 4 1]"
set x3Damp 1;
set M3propSwitch 1.0;
set K3currSwitch 0.0;
set K3commSwitch 1.0;
set K3initSwitch 0.0;
set nEigenI 1;
set nEigenJ 2;
set lambdaN [eigen [expr $nEigenJ]];
set lambdaI [lindex $lambdaN [expr $nEigenI-1]];
set lambdaJ [lindex $lambdaN [expr $nEigenJ-1]];
set omegaI [expr pow($lambdaI,0.5)];
set omegaJ [expr pow($lambdaJ,0.5)];
set alphaM3 [expr $M3propSwitch*$x3Damp*(2*$omegaI*$omegaJ)/($omegaI+$omegaJ)];
set betaK3curr [expr $K3currSwitch*2.*$x3Damp/($omegaI+$omegaJ)];
set betaK3comm [expr $K3commSwitch*2.*$x3Damp/($omegaI+$omegaJ)];
set betaK3init [expr $K3initSwitch*2.*$x3Damp/($omegaI+$omegaJ)];
rayleigh $alphaM3 $betaK3curr $betaK3init $betaK3comm;
region 1 -eleRange 1 3 rayleigh $alphaM3 $betaK3curr $betaK3init $betaK3comm;
region 3 -nodeRange 1 4 rayleigh $alphaM3 $betaK3curr $betaK3init $betaK3comm;
} if {[expr abs([nodeDisp 6 1])]>0.001} {
puts "[getTime] [nodeDisp 6 1]"
set x4Damp 2;
set M2propSwitch 1.0;
set K4currSwitch 0.0;
set K4commSwitch 1.0;
set K4initSwitch 0.0;
set nEigenI 1;
set nEigenJ 2;
set lambdaN [eigen [expr $nEigenJ]];
set lambdaI [lindex $lambdaN [expr $nEigenI-1]];
set lambdaJ [lindex $lambdaN [expr $nEigenJ-1]];
set omegaI [expr pow($lambdaI,0.5)];
set omegaJ [expr pow($lambdaJ,0.5)];
set alphaM4 [expr $M4propSwitch*$x4Damp*(2*$omegaI*$omegaJ)/($omegaI+$omegaJ)];
set betaK4curr [expr $K4currSwitch*2.*$x4Damp/($omegaI+$omegaJ)];
set betaK4comm [expr $K4commSwitch*2.*$x4Damp/($omegaI+$omegaJ)];
set betaK4init [expr $K4initSwitch*2.*$x4Damp/($omegaI+$omegaJ)];
rayleigh $alphaM2 $betaK4curr $betaK4init $betaK4comm;
region 2 -eleRange 4 6 rayleigh $alphaM4 $betaK4curr $betaK4init $betaK4comm;
region 4 -nodeRange 5 6 rayleigh $alphaM4 $betaK4curr $betaK4init $betaK4comm;
} else {
constraints Plain
numberer Plain
system BandGeneral
test NormDispIncr 1.0e-10 10
algorithm Newton
integrator Newmark 0.5 0.25
analysis Transient
analyze 1 0.01
set i [expr $i+1]
}
}

set a [eigen 2]
set eigen1 [lindex $a 0]
set eigen2 [lindex $a 1]
puts "eigens are $eigen1,$eigen2"
set Period1 [expr 2*3.1416/sqrt($eigen1)]
set Period2 [expr 2*3.1416/sqrt($eigen2)]
puts "Periods are $Period1,$Period2"

set numModes 2
for { set k 1 } { $k <= $numModes } { incr k } {
recorder Node -file nonclasic/mode$k.out -nodeRange 1 6 -dof 1 2 3 "eigen $k"
}

set lambda [eigen $numModes];
set omega {}
set f {}
set T {}
set pi 3.141593

foreach lam $lambda {
lappend omega [expr sqrt($lam)]
lappend f [expr sqrt($lam)/(2*$pi)]
lappend T [expr (2*$pi)/sqrt($lam)]
}

set period "Periods.txt"
set Periods [open $period "w"]
foreach t $T {
puts $Periods " $t"
}
close $Periods



thank you
payamdindar
Posts: 21
Joined: Sun Jul 24, 2011 4:48 am
Location: SRBIAU

Re: how to use region node or element command

Post by payamdindar »

which region command suitable for my target? (for assign 2 different damping ratio to beams and columns in each story "story 1 and story2". mass assign to each joint and dont assign mass to elements )
region node or region element?
fmk
Site Admin
Posts: 5884
Joined: Fri Jun 11, 2004 2:33 pm
Location: UC Berkeley
Contact:

Re: how to use region node or element command

Post by fmk »

move the rayleigh command above the region commands .. the elements and nodes use the last damping values asssigned, when you have rayleigh after the regions, all elements and nodes will use the values given in rayleigh command.
payamdindar
Posts: 21
Joined: Sun Jul 24, 2011 4:48 am
Location: SRBIAU

Re: how to use region node or element command

Post by payamdindar »

Thank you frank
i am decided to apply 3 damping ratio to model.(active control problem-TTSOONG).for specifiec time apply specified damping ratio to model. damping ratio are: Cmin,Copt,Cmax. in other words 3 damping ratio can switching together. for this purpose i apply some criteria to model for switching damping together like a displacement node 4 more than certain content. i write this code but nnot correct properly

for {set i 1} {$i <= 5000} {incr i 1} {
analyze 5000 0.01
if {[expr $Dispnode4 1] > 0.01} {
puts "[getTime] [nodeDisp 4 1]"
set x3Damp 1;
set M3propSwitch 1.0;
set K3currSwitch 0.0;
set K3commSwitch 1.0;
set K3initSwitch 0.0;
set nEigenI 1;
set nEigenJ 2;
set lambdaN [eigen [expr $nEigenJ]];
set lambdaI [lindex $lambdaN [expr $nEigenI-1]];
set lambdaJ [lindex $lambdaN [expr $nEigenJ-1]];
set omegaI [expr pow($lambdaI,0.5)];
set omegaJ [expr pow($lambdaJ,0.5)];
set alphaM3 [expr $M3propSwitch*$x3Damp*(2*$omegaI*$omegaJ)/($omegaI+$omegaJ)];
set betaK3curr [expr $K3currSwitch*2.*$x3Damp/($omegaI+$omegaJ)];
set betaK3comm [expr $K3commSwitch*2.*$x3Damp/($omegaI+$omegaJ)];
set betaK3init [expr $K3initSwitch*2.*$x3Damp/($omegaI+$omegaJ)];
rayleigh $alphaM3 $betaK3curr $betaK3init $betaK3comm;
region 1 -eleRange 1 3 rayleigh $alphaM3 $betaK3curr $betaK3init $betaK3comm;
region 3 -nodeRange 1 4 rayleigh $alphaM3 $betaK3curr $betaK3init $betaK3comm;
} if {[expr abs([nodeDisp 6 1])]>0.001} {
puts "[getTime] [nodeDisp 6 1]"
set x4Damp 2;
set M2propSwitch 1.0;
set K4currSwitch 0.0;
set K4commSwitch 1.0;
set K4initSwitch 0.0;
set nEigenI 1;
set nEigenJ 2;
set lambdaN [eigen [expr $nEigenJ]];
set lambdaI [lindex $lambdaN [expr $nEigenI-1]];
set lambdaJ [lindex $lambdaN [expr $nEigenJ-1]];
set omegaI [expr pow($lambdaI,0.5)];
set omegaJ [expr pow($lambdaJ,0.5)];
set alphaM4 [expr $M4propSwitch*$x4Damp*(2*$omegaI*$omegaJ)/($omegaI+$omegaJ)];
set betaK4curr [expr $K4currSwitch*2.*$x4Damp/($omegaI+$omegaJ)];
set betaK4comm [expr $K4commSwitch*2.*$x4Damp/($omegaI+$omegaJ)];
set betaK4init [expr $K4initSwitch*2.*$x4Damp/($omegaI+$omegaJ)];
rayleigh $alphaM2 $betaK4curr $betaK4init $betaK4comm;
region 2 -eleRange 4 6 rayleigh $alphaM4 $betaK4curr $betaK4init $betaK4comm;
region 4 -nodeRange 5 6 rayleigh $alphaM4 $betaK4curr $betaK4init $betaK4comm;
} else {
constraints Plain
numberer Plain
system BandGeneral
test NormDispIncr 1.0e-10 10
algorithm Newton
integrator Newmark 0.5 0.25
analysis Transient
analyze 1 0.01
set i [expr $i+1]
}
}

thank you
fmk
Site Admin
Posts: 5884
Joined: Fri Jun 11, 2004 2:33 pm
Location: UC Berkeley
Contact:

Re: how to use region node or element command

Post by fmk »

seems to be o.k if your intent was to use 3 different sets of rayleigh factors .. i could not really understand the question.
payamdindar
Posts: 21
Joined: Sun Jul 24, 2011 4:48 am
Location: SRBIAU

Re: how to use region node or element command

Post by payamdindar »

thank you frank

if nod4 disp > 0.01
assign C1=0.01 for region 1 (region1 -ele 1 2 3 4)
if node6 disp > 0.05
assign C2=0.2 for region 2 (region2 -ele 5 6)
if Drift1<0.005
assign Copt=0.1 for all

how to write and apply this algoritm to my opensees code?
payamdindar
Posts: 21
Joined: Sun Jul 24, 2011 4:48 am
Location: SRBIAU

Re: how to use region node or element command

Post by payamdindar »

I want to apply 2 different damping ratio for my model by use region commmand. I wrote a code but it did'nt work correctly , please tell me my mistake?

wipe

model BasicBuilder -ndm 2 -ndf 3

file mkdir nonclasic

set L [expr 5]
set H [expr 5]

node 1 0 0
node 2 $L 0
node 3 0 $H
node 4 $L $H
node 5 0 [expr 2*$H]
node 6 $L [expr 2*$H]

fix 1 1 1 1
fix 2 1 1 1

equalDOF 3 4 1
equalDOF 5 6 1

set M1 [expr 1000]
set M2 [expr 1000]

mass 3 $M1 0. 1e-10
mass 4 $M1 0. 1e-10
mass 5 $M2 0. 1e-10
mass 6 $M2 0. 1e-10

geomTransf Linear 1

set E1 [expr 2.1e10]
set E2 [expr 2.1e10]

set Fy1 [expr 2.4e7]
set Fy2 [expr 2.4e7]

uniaxialMaterial Steel01 1 $Fy1 $E1 0.02

section fiberSec 1 {
patch quad 1 2 4 -0.1 -0.1 0.1 -0.1 0.1 -0.09 -0.1 -0.09
patch quad 1 2 8 -0.005 -0.09 0.005 -0.09 0.005 0.09 -0.005 0.09
patch quad 1 2 4 -0.1 0.09 0.1 0.09 0.1 0.1 -0.1 0.1
}

uniaxialMaterial Steel01 2 $Fy2 $E2 0.02

section fiberSec 2 {
patch quad 2 2 4 -0.1 -0.1 0.1 -0.1 0.1 -0.09 -0.1 -0.09
patch quad 2 2 8 -0.005 -0.09 0.005 -0.09 0.005 0.09 -0.005 0.09
patch quad 2 2 4 -0.1 0.09 0.1 0.09 0.1 0.1 -0.1 0.1
}

#set I1 [expr 4.1e-5]
#set I2 [expr 4.1e-5]
#set K1 [expr (2*12*$E1*$I1)/pow($H,3)]
#set K2 [expr (2*12*$E2*$I2)/pow($H,3)]
#set X1 [expr 0.15]
#set X2 [expr 0.1]
#set K [expr $K1+$K2]
#set M [expr $M1+$M2]
#set W [expr sqrt($K/$M)]
#set C1 [expr $X1*(2*$M*$W)]
#set C2 [expr $X2*(2*$M*$W)]

element nonlinearBeamColumn 1 1 3 10 1 1
element nonlinearBeamColumn 2 2 4 10 1 1
element nonlinearBeamColumn 3 3 4 10 1 1
element nonlinearBeamColumn 4 3 5 10 2 1
element nonlinearBeamColumn 5 4 6 10 2 1
element nonlinearBeamColumn 6 5 6 10 2 1

set accel "Series -dt 0.01 -filePath ElCentroArray9180(dt=0.01)PGA=0.4g.txt -factor [expr 9.81]"

pattern UniformExcitation 3 1 -accel $accel

set pi [expr 2.0*asin(1.0)]
set nEigenI 1
set nEigenJ 2
set lambdaN [eigen [expr $nEigenJ]]
set lambdaI [lindex $lambdaN [expr 0]]
set lambdaJ [lindex $lambdaN [expr $nEigenJ-1]]
set w1 [expr pow($lambdaI,0.5)]
set w2 [expr pow($lambdaJ,0.5)]
set T1 [expr 2.0*$pi/$w1]
set T2 [expr 2.0*$pi/$w2]
puts "T1 = $T1 s"
puts "T2 = $T2 s"

set n1 3

set zeta1 10.01
set a01 [expr $zeta1*2.0*$w1*$w2/($w1 + $w2)]
set a11 [expr $zeta1*2.0/($w1 + $w2)]
set a11_mod [expr $a11*(1.0+$n1)/$n1]

region 1 -eleRange 1 3 -rayleigh 0.0 0.0 $a11_mod 0.0
region 2 -node 1 2 3 4 -rayleigh $a01 0.0 0.0 0.0

set n2 3

set zeta2 0.01
set a02 [expr $zeta2*2.0*$w1*$w2/($w1 + $w2)]
set a12 [expr $zeta2*2.0/($w1 + $w2)]
set a12_mod [expr $a12*(1.0+$n2)/$n2]

region 3 -eleRange 4 6 -rayleigh 0.0 0.0 $a12_mod 0.0
region 4 -node 5 6 -rayleigh $a02 0.0 0.0 0.0

recorder Node -file nonclasic/node4disp.out -time -node 4 -dof 1 disp
recorder Node -file nonclasic/node6disp.out -time -node 6 -dof 1 disp
recorder Node -file nonclasic/RBase1.out -time -node 1 -dof 1 2 3 reaction
recorder Node -file nonclasic/RBase2.out -time -node 2 -dof 1 2 3 reaction
recorder Drift -file nonclasic/Drift1.out -time -iNode 2 -jNode 4 -dof 1 -perpDirn 2
recorder Drift -file nonclasic/Drift2.out -time -iNode 4 -jNode 6 -dof 1 -perpDirn 2
recorder Element -file nonclasic/FCol1.out -time -ele 1 globalForce;
recorder Element -file nonclasic/FCol2.out -time -ele 2 globalForce;
recorder Element -file nonclasic/FCol4.out -time -ele 4 globalForce;
recorder Element -file nonclasic/FCol5.out -time -ele 5 globalForce;
recorder Element -file nonclasic/FBeam3.out -time -ele 3 globalForce;
recorder Element -file nonclasic/FBeam6.out -time -ele 6 globalForce;

recorder display "nonclasic" 500 0 500 500 -wipe
prp 0 0 1
vup 0 1 0
vpn 0 0 1
viewWindow -10 10 -10 10
display 1 5 5

constraints Plain
numberer Plain
system BandGeneral
test NormDispIncr 1.0e-10 10
algorithm Newton
integrator Newmark 0.5 0.25
analyze 5000 0.01

set a [eigen 2]
set eigen1 [lindex $a 0]
set eigen2 [lindex $a 1]
puts "eigens are $eigen1,$eigen2"
set Period1 [expr 2*3.1416/sqrt($eigen1)]
set Period2 [expr 2*3.1416/sqrt($eigen2)]
puts "Periods are $Period1,$Period2"

set numModes 2
for { set k 1 } { $k <= $numModes } { incr k } {
recorder Node -file nonclasic/mode$k.out -nodeRange 1 6 -dof 1 2 3 "eigen $k"
}

set lambda [eigen $numModes];
set omega {}
set f {}
set T {}
set pi 3.141593

foreach lam $lambda {
lappend omega [expr sqrt($lam)]
lappend f [expr sqrt($lam)/(2*$pi)]
lappend T [expr (2*$pi)/sqrt($lam)]
}

set period "Periods.txt"
set Periods [open $period "w"]
foreach t $T {
puts $Periods " $t"
}
close $Periods


#Thank You
Post Reply