effect of chevron braced viscous dampers with self centering element

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

Moderators: silvia, selimgunay, Moderators

Post Reply
ritishreddy
Posts: 4
Joined: Fri Apr 01, 2022 1:28 pm

effect of chevron braced viscous dampers with self centering element

Post by ritishreddy » Thu Feb 16, 2023 6:16 am

Hello guys, I have created a 2-dimensional steel frame with 1 Storey and 5 bays. For each bay I have provided 5 self centering viscous dampers ( self centering element is finite length which is connected in parallel with zero length viscous damper) in chevron braced configuration. The code is running but I think the damper and self centering elements are not behaving in alignment with the structure as I get the same displacement results for different damper and self centering material properties. Could you take a look on where did I go wrong?

# Analysis of steel moment resisting frame in N/S direction
# SET UP
wipe; # clear memory of all past model definitions
model BasicBuilder -ndm 2 -ndf 3; # Define the model builder, ndm=#dimension, ndf=#dofs
set dataDir Data; # set up name of data directory (you can remove this)
file mkdir $dataDir; # create data directory
set GMdir "../GMfiles/"; # ground-motion file directory
source LibUnits.tcl; # define units
source DisplayPlane.tcl; # procedure for displaying a plane in model
source DisplayModel3D.tcl; # procedure for displaying 3D perspectives of model
source rotSpring2DModIKModel.tcl; # procedure for defining a rotational spring (zero-length element)
source rotLeaningCol.tcl; # procedure for defining a rotational spring (zero-length element) with very small stiffness
source DisplayModel2D.tcl; # procedure for displaying a 2D perspective of model
source RotPanelZone2Dmodified.tcl; # procedure for defining a rotational spring (zero-length element) to capture panel zone shear distortions
source ElemPanelZone2Dosman.tcl; # procedure for defining 8 elements to create a rectangular panel zon
source rotLeaningCol.tcl; # procedure for defining a rotational spring (zero-length element) with very small stiffness
set ViewScale 0.25; # scaling factor for viewing deformed shape, it depends on the dimensions of the model

# define GEOMETRY -------------------------------------------------------------
# define structure-geometry paramters
set LCol1 [expr 180*$in]; # column height @ 1 floor
set LCol2 [ expr 150*$in ] ; # column height at all other floors
set LBeam [expr 67.2*$in]; # beam length
set Loffsetd [ expr 18.6*$in ] ; # distance of damper from left hand node and right hand node
set Ldamp [ expr 6.0*$in ] ; # length of each damper
set Hs [ exp 30.0*$in ] ; # height offset of lower nodes of each damper of self centering material
set Hd [ exp 15.0*$in ] ; # height offset of zero length nodes of each damper

# ------ frame configuration
set NStory 6; # number of stories above ground level
set NBay 5 ;# number of bays in X direction ( one part is used for p-delta rotation of columns )
puts "Number of Stories in Y: $NStory; Number of bays in X: $NBay; "



# Define parameters for rotational springs and nodes of panel zones for all storeys
# Parameters for storey 1 and 2 ( floo level 2 and 3 )
# column section W21x201 and # Beam section W27x94
set w1 [ expr 23.0*$in ] ; # width of panel zone ( depth of column section )
set d1 [ expr 26.9*$in ] ; # depth of panel zone ( depth of beam section )

# calculate panel zone dimensions
set pzlat1 [expr $w1/2.0]; # lateral dist from CL of beam-col joint to edge of panel zone (= half the column depth)
set pzvert1 [expr $d1/2.0]; # vert dist from CL of beam-col joint to edge of panel zone (= half the beam depth)

# calculate plastic hinge offsets from beam-column centerlines:
set phlat1 [expr $pzlat1 + 15.0*$in ]; # lateral dist from CL of beam-col joint to beam hinge
set phvert1 [expr $pzvert1 + 0.0*$in ]; # vert dist from CL of beam-col joint to column hinge (forms at edge of panel zone)

# calculate locations of beam/column/girder intersections:
set X1 0.;
set X2 [expr $X1 + (2*$pzlat1) + $LBeam];
set X3 [expr $X2 + (2*$pzlat1) + $LBeam];
set X4 [expr $X3 + (2*$pzlat1) + $LBeam];
set X5 [expr $X4 + (2*$pzlat1) + $LBeam];
set X6 [expr $X5 + (2*$pzlat1) + $LBeam];

set Y1 0.;
set Y2 [expr $Y1 + $LCol1];



# define nodal coordinates
# tag X Y
node 1001 0 0 ;
node 1002 $X2 0 ;
node 1003 $X3 0 ;
node 1004 $X4 0 ;
node 1005 $X5 0 ;
node 1006 $X6 0 ;

node 2002 [ expr $pzlat1 + $Loffsetd ] $Y2 ;
node 2003 [ expr $pzlat1 + $Loffsetd + $Ldamp ] $Y2 ;
node 2004 [ expr $pzlat1 + $Loffsetd + (2.0*$Ldamp) ] $Y2 ;
node 2005 [ expr $pzlat1 + $Loffsetd + (3.0*$Ldamp) ] $Y2 ;
node 2006 [ expr $pzlat1 + $Loffsetd + (4.0*$Ldamp) ] $Y2 ;
node 2007 [ expr $pzlat1 + $Loffsetd + (5.0*$Ldamp) ] $Y2 ;
node 2012 [ expr $pzlat1 + $Loffsetd ] [ expr $Y2 - $Hs ] ;
node 2013 [ expr $pzlat1 + $Loffsetd + $Ldamp ] [ expr $Y2 - $Hs ] ;
node 2014 [ expr $pzlat1 + $Loffsetd + (2.0*$Ldamp) ] [ expr $Y2 - $Hs ] ;
node 2015 [ expr $pzlat1 + $Loffsetd + (3.0*$Ldamp) ] [ expr $Y2 - $Hs ] ;
node 2515 [ expr $pzlat1 + $Loffsetd + (3.0*$Ldamp) ] [ expr $Y2 - $Hs ] ;
node 2016 [ expr $pzlat1 + $Loffsetd + (4.0*$Ldamp) ] [ expr $Y2 - $Hs ] ;
node 2017 [ expr $pzlat1 + $Loffsetd + (5.0*$Ldamp) ] [ expr $Y2 - $Hs ] ;
node 2024 [ expr $pzlat1 + $Loffsetd + (0.5*$Ldamp) ] [ expr $Y2 - $Hd ] ;
node 2025 [ expr $pzlat1 + $Loffsetd + (0.5*$Ldamp) ] [ expr $Y2 - $Hd ] ;
node 2026 [ expr $pzlat1 + $Loffsetd + (1.5*$Ldamp) ] [ expr $Y2 - $Hd ] ;
node 2027 [ expr $pzlat1 + $Loffsetd + (1.5*$Ldamp) ] [ expr $Y2 - $Hd ] ;
node 2028 [ expr $pzlat1 + $Loffsetd + (2.5*$Ldamp) ] [ expr $Y2 - $Hd ] ;
node 2029 [ expr $pzlat1 + $Loffsetd + (2.5*$Ldamp) ] [ expr $Y2 - $Hd ] ;
node 2030 [ expr $pzlat1 + $Loffsetd + (3.5*$Ldamp) ] [ expr $Y2 - $Hd ] ;
node 2031 [ expr $pzlat1 + $Loffsetd + (3.5*$Ldamp) ] [ expr $Y2 - $Hd ] ;
node 2032 [ expr $pzlat1 + $Loffsetd + (4.5*$Ldamp) ] [ expr $Y2 - $Hd ] ;
node 2033 [ expr $pzlat1 + $Loffsetd + (4.5*$Ldamp) ] [ expr $Y2 - $Hd ] ;


node 2102 [ expr $X2 + $pzlat1 + $Loffsetd ] $Y2 ;
node 2103 [ expr $X2 + $pzlat1 + $Loffsetd + $Ldamp ] $Y2 ;
node 2104 [ expr $X2 + $pzlat1 + $Loffsetd + (2.0*$Ldamp) ] $Y2 ;
node 2105 [ expr $X2 + $pzlat1 + $Loffsetd + (3.0*$Ldamp) ] $Y2 ;
node 2106 [ expr $X2 + $pzlat1 + $Loffsetd + (4.0*$Ldamp) ] $Y2 ;
node 2107 [ expr $X2 + $pzlat1 + $Loffsetd + (5.0*$Ldamp) ] $Y2 ;
node 2112 [ expr $X2 + $pzlat1 + $Loffsetd ] [ expr $Y2 - $Hs ] ;
node 2113 [ expr $X2 + $pzlat1 + $Loffsetd + $Ldamp ] [ expr $Y2 - $Hs ] ;
node 2114 [ expr $X2 + $pzlat1 + $Loffsetd + (2.0*$Ldamp) ] [ expr $Y2 - $Hs ] ;
node 2115 [ expr $X2 + $pzlat1 + $Loffsetd + (3.0*$Ldamp) ] [ expr $Y2 - $Hs ] ;
node 2615 [ expr $X2 + $pzlat1 + $Loffsetd + (3.0*$Ldamp) ] [ expr $Y2 - $Hs ] ;
node 2116 [ expr $X2 + $pzlat1 + $Loffsetd + (4.0*$Ldamp) ] [ expr $Y2 - $Hs ] ;
node 2117 [ expr $X2 + $pzlat1 + $Loffsetd + (5.0*$Ldamp) ] [ expr $Y2 - $Hs ] ;
node 2124 [ expr $X2 + $pzlat1 + $Loffsetd + (0.5*$Ldamp) ] [ expr $Y2 - $Hd ] ;
node 2125 [ expr $X2 + $pzlat1 + $Loffsetd + (0.5*$Ldamp) ] [ expr $Y2 - $Hd ] ;
node 2126 [ expr $X2 + $pzlat1 + $Loffsetd + (1.5*$Ldamp) ] [ expr $Y2 - $Hd ] ;
node 2127 [ expr $X2 + $pzlat1 + $Loffsetd + (1.5*$Ldamp) ] [ expr $Y2 - $Hd ] ;
node 2128 [ expr $X2 + $pzlat1 + $Loffsetd + (2.5*$Ldamp) ] [ expr $Y2 - $Hd ] ;
node 2129 [ expr $X2 + $pzlat1 + $Loffsetd + (2.5*$Ldamp) ] [ expr $Y2 - $Hd ] ;
node 2130 [ expr $X2 + $pzlat1 + $Loffsetd + (3.5*$Ldamp) ] [ expr $Y2 - $Hd ] ;
node 2131 [ expr $X2 + $pzlat1 + $Loffsetd + (3.5*$Ldamp) ] [ expr $Y2 - $Hd ] ;
node 2132 [ expr $X2 + $pzlat1 + $Loffsetd + (4.5*$Ldamp) ] [ expr $Y2 - $Hd ] ;
node 2133 [ expr $X2 + $pzlat1 + $Loffsetd + (4.5*$Ldamp) ] [ expr $Y2 - $Hd ] ;


node 2202 [ expr $X3 + $pzlat1 + $Loffsetd ] $Y2 ;
node 2203 [ expr $X3 + $pzlat1 + $Loffsetd + $Ldamp ] $Y2 ;
node 2204 [ expr $X3 + $pzlat1 + $Loffsetd + (2.0*$Ldamp) ] $Y2 ;
node 2205 [ expr $X3 + $pzlat1 + $Loffsetd + (3.0*$Ldamp) ] $Y2 ;
node 2206 [ expr $X3 + $pzlat1 + $Loffsetd + (4.0*$Ldamp) ] $Y2 ;
node 2207 [ expr $X3 + $pzlat1 + $Loffsetd + (5.0*$Ldamp) ] $Y2 ;
node 2212 [ expr $X3 + $pzlat1 + $Loffsetd ] [ expr $Y2 - $Hs ] ;
node 2213 [ expr $X3 + $pzlat1 + $Loffsetd + $Ldamp ] [ expr $Y2 - $Hs ] ;
node 2214 [ expr $X3 + $pzlat1 + $Loffsetd + (2.0*$Ldamp) ] [ expr $Y2 - $Hs ] ;
node 2215 [ expr $X3 + $pzlat1 + $Loffsetd + (3.0*$Ldamp) ] [ expr $Y2 - $Hs ] ;
node 2715 [ expr $X3 + $pzlat1 + $Loffsetd + (3.0*$Ldamp) ] [ expr $Y2 - $Hs ] ;
node 2216 [ expr $X3 + $pzlat1 + $Loffsetd + (4.0*$Ldamp) ] [ expr $Y2 - $Hs ] ;
node 2217 [ expr $X3 + $pzlat1 + $Loffsetd + (5.0*$Ldamp) ] [ expr $Y2 - $Hs ] ;
node 2224 [ expr $X3 + $pzlat1 + $Loffsetd + (0.5*$Ldamp) ] [ expr $Y2 - $Hd ] ;
node 2225 [ expr $X3 + $pzlat1 + $Loffsetd + (0.5*$Ldamp) ] [ expr $Y2 - $Hd ] ;
node 2226 [ expr $X3 + $pzlat1 + $Loffsetd + (1.5*$Ldamp) ] [ expr $Y2 - $Hd ] ;
node 2227 [ expr $X3 + $pzlat1 + $Loffsetd + (1.5*$Ldamp) ] [ expr $Y2 - $Hd ] ;
node 2228 [ expr $X3 + $pzlat1 + $Loffsetd + (2.5*$Ldamp) ] [ expr $Y2 - $Hd ] ;
node 2229 [ expr $X3 + $pzlat1 + $Loffsetd + (2.5*$Ldamp) ] [ expr $Y2 - $Hd ] ;
node 2230 [ expr $X3 + $pzlat1 + $Loffsetd + (3.5*$Ldamp) ] [ expr $Y2 - $Hd ] ;
node 2231 [ expr $X3 + $pzlat1 + $Loffsetd + (3.5*$Ldamp) ] [ expr $Y2 - $Hd ] ;
node 2232 [ expr $X3 + $pzlat1 + $Loffsetd + (4.5*$Ldamp) ] [ expr $Y2 - $Hd ] ;
node 2233 [ expr $X3 + $pzlat1 + $Loffsetd + (4.5*$Ldamp) ] [ expr $Y2 - $Hd ] ;



node 2302 [ expr $X4 + $pzlat1 + $Loffsetd ] $Y2 ;
node 2303 [ expr $X4 + $pzlat1 + $Loffsetd + $Ldamp ] $Y2 ;
node 2304 [ expr $X4 + $pzlat1 + $Loffsetd + (2.0*$Ldamp) ] $Y2 ;
node 2305 [ expr $X4 + $pzlat1 + $Loffsetd + (3.0*$Ldamp) ] $Y2 ;
node 2306 [ expr $X4 + $pzlat1 + $Loffsetd + (4.0*$Ldamp) ] $Y2 ;
node 2307 [ expr $X4 + $pzlat1 + $Loffsetd + (5.0*$Ldamp) ] $Y2 ;
node 2312 [ expr $X4 + $pzlat1 + $Loffsetd ] [ expr $Y2 - $Hs ] ;
node 2313 [ expr $X4 + $pzlat1 + $Loffsetd + $Ldamp ] [ expr $Y2 - $Hs ] ;
node 2314 [ expr $X4 + $pzlat1 + $Loffsetd + (2.0*$Ldamp) ] [ expr $Y2 - $Hs ] ;
node 2315 [ expr $X4 + $pzlat1 + $Loffsetd + (3.0*$Ldamp) ] [ expr $Y2 - $Hs ] ;
node 2815 [ expr $X4 + $pzlat1 + $Loffsetd + (3.0*$Ldamp) ] [ expr $Y2 - $Hs ] ;
node 2316 [ expr $X4 + $pzlat1 + $Loffsetd + (4.0*$Ldamp) ] [ expr $Y2 - $Hs ] ;
node 2317 [ expr $X4 + $pzlat1 + $Loffsetd + (5.0*$Ldamp) ] [ expr $Y2 - $Hs ] ;
node 2324 [ expr $X4 + $pzlat1 + $Loffsetd + (0.5*$Ldamp) ] [ expr $Y2 - $Hd ] ;
node 2325 [ expr $X4 + $pzlat1 + $Loffsetd + (0.5*$Ldamp) ] [ expr $Y2 - $Hd ] ;
node 2326 [ expr $X4 + $pzlat1 + $Loffsetd + (1.5*$Ldamp) ] [ expr $Y2 - $Hd ] ;
node 2327 [ expr $X4 + $pzlat1 + $Loffsetd + (1.5*$Ldamp) ] [ expr $Y2 - $Hd ] ;
node 2328 [ expr $X4 + $pzlat1 + $Loffsetd + (2.5*$Ldamp) ] [ expr $Y2 - $Hd ] ;
node 2329 [ expr $X4 + $pzlat1 + $Loffsetd + (2.5*$Ldamp) ] [ expr $Y2 - $Hd ] ;
node 2330 [ expr $X4 + $pzlat1 + $Loffsetd + (3.5*$Ldamp) ] [ expr $Y2 - $Hd ] ;
node 2331 [ expr $X4 + $pzlat1 + $Loffsetd + (3.5*$Ldamp) ] [ expr $Y2 - $Hd ] ;
node 2332 [ expr $X4 + $pzlat1 + $Loffsetd + (4.5*$Ldamp) ] [ expr $Y2 - $Hd ] ;
node 2333 [ expr $X4 + $pzlat1 + $Loffsetd + (4.5*$Ldamp) ] [ expr $Y2 - $Hd ] ;



node 2402 [ expr $X5 + $pzlat1 + $Loffsetd ] $Y2 ;
node 2403 [ expr $X5 + $pzlat1 + $Loffsetd + $Ldamp ] $Y2 ;
node 2404 [ expr $X5 + $pzlat1 + $Loffsetd + (2.0*$Ldamp) ] $Y2 ;
node 2405 [ expr $X5 + $pzlat1 + $Loffsetd + (3.0*$Ldamp) ] $Y2 ;
node 2406 [ expr $X5 + $pzlat1 + $Loffsetd + (4.0*$Ldamp) ] $Y2 ;
node 2407 [ expr $X5 + $pzlat1 + $Loffsetd + (5.0*$Ldamp) ] $Y2 ;
node 2412 [ expr $X5 + $pzlat1 + $Loffsetd ] [ expr $Y2 - $Hs ] ;
node 2413 [ expr $X5 + $pzlat1 + $Loffsetd + $Ldamp ] [ expr $Y2 - $Hs ] ;
node 2414 [ expr $X5 + $pzlat1 + $Loffsetd + (2.0*$Ldamp) ] [ expr $Y2 - $Hs ] ;
node 2415 [ expr $X5 + $pzlat1 + $Loffsetd + (3.0*$Ldamp) ] [ expr $Y2 - $Hs ] ;
node 2915 [ expr $X5 + $pzlat1 + $Loffsetd + (3.0*$Ldamp) ] [ expr $Y2 - $Hs ] ;
node 2416 [ expr $X5 + $pzlat1 + $Loffsetd + (4.0*$Ldamp) ] [ expr $Y2 - $Hs ] ;
node 2417 [ expr $X5 + $pzlat1 + $Loffsetd + (5.0*$Ldamp) ] [ expr $Y2 - $Hs ] ;
node 2424 [ expr $X5 + $pzlat1 + $Loffsetd + (0.5*$Ldamp) ] [ expr $Y2 - $Hd ] ;
node 2425 [ expr $X5 + $pzlat1 + $Loffsetd + (0.5*$Ldamp) ] [ expr $Y2 - $Hd ] ;
node 2426 [ expr $X5 + $pzlat1 + $Loffsetd + (1.5*$Ldamp) ] [ expr $Y2 - $Hd ] ;
node 2427 [ expr $X5 + $pzlat1 + $Loffsetd + (1.5*$Ldamp) ] [ expr $Y2 - $Hd ] ;
node 2428 [ expr $X5 + $pzlat1 + $Loffsetd + (2.5*$Ldamp) ] [ expr $Y2 - $Hd ] ;
node 2429 [ expr $X5 + $pzlat1 + $Loffsetd + (2.5*$Ldamp) ] [ expr $Y2 - $Hd ] ;
node 2430 [ expr $X5 + $pzlat1 + $Loffsetd + (3.5*$Ldamp) ] [ expr $Y2 - $Hd ] ;
node 2431 [ expr $X5 + $pzlat1 + $Loffsetd + (3.5*$Ldamp) ] [ expr $Y2 - $Hd ] ;
node 2432 [ expr $X5 + $pzlat1 + $Loffsetd + (4.5*$Ldamp) ] [ expr $Y2 - $Hd ] ;
node 2433 [ expr $X5 + $pzlat1 + $Loffsetd + (4.5*$Ldamp) ] [ expr $Y2 - $Hd ] ;


node 2600 $X6 $Y2


# define extra nodes for plastic hinge rotational springs
# column hinges at bottom of floor 1 (base)
# tag X Y
node 107 0 0 ;
node 108 $X2 0 ;
node 109 $X3 0 ;
node 110 $X4 0 ;
node 111 $X5 0 ;

# column hinges at top of Story 1
node 200 0 [expr $Y2 - $phvert1] ;
node 201 $X2 [expr $Y2 - $phvert1] ;
node 202 $X3 [expr $Y2 - $phvert1] ;
node 203 $X4 [expr $Y2 - $phvert1] ;
node 204 $X5 [expr $Y2 - $phvert1] ;
node 205 $X6 $Y2 ;

# beam hinges at Floor 2
node 210 [expr $X1 + $phlat1] $Y2 ; # Starts with an even and ends with an odd number
node 211 [expr $X1 + $phlat1] $Y2 ;
node 212 [expr $X2 - $phlat1] $Y2 ;
node 213 [expr $X2 - $phlat1] $Y2 ;
node 214 [expr $X2 + $phlat1] $Y2 ;
node 215 [expr $X2 + $phlat1] $Y2 ;
node 216 [expr $X3 - $phlat1] $Y2 ;
node 217 [expr $X3 - $phlat1] $Y2 ;
node 218 [expr $X3 + $phlat1] $Y2 ;
node 219 [expr $X3 + $phlat1] $Y2 ;
node 220 [expr $X4 - $phlat1] $Y2 ;
node 221 [expr $X4 - $phlat1] $Y2 ;
node 222 [expr $X4 + $phlat1] $Y2 ;
node 223 [expr $X4 + $phlat1] $Y2 ;
node 224 [expr $X5 - $phlat1] $Y2 ;
node 225 [expr $X5 - $phlat1] $Y2 ;

# define extra nodes for panel zones
#Floor 2
# panel zone at beam-column joint 1, Floor 2
node 2501 [expr $X1 - $pzlat1] [expr $Y2 + $phvert1];
node 2502 [expr $X1 - $pzlat1] [expr $Y2 + $phvert1];
node 2503 [expr $X1 + $pzlat1] [expr $Y2 + $phvert1];
node 2504 [expr $X1 + $pzlat1] [expr $Y2 + $phvert1];
node 2505 [expr $X1 + $pzlat1] [expr $Y2 ];
node 2506 [expr $X1 + $pzlat1] [expr $Y2 - $phvert1];
node 2507 [expr $X1 + $pzlat1] [expr $Y2 - $phvert1];
node 2508 [expr $X1 - $pzlat1] [expr $Y2 - $phvert1];
node 2509 [expr $X1 - $pzlat1] [expr $Y2 - $phvert1];
node 2510 [expr $X1 - $pzlat1] [expr $Y2 ];
node 2511 $X1 [expr $Y2 - $phvert1];
node 2512 $X1 [expr $Y2 + $phvert1];

# panel zone at beam-column joint 2, Floor 2
node 2521 [expr $X2 - $pzlat1] [expr $Y2 + $phvert1];
node 2522 [expr $X2 - $pzlat1] [expr $Y2 + $phvert1];
node 2523 [expr $X2 + $pzlat1] [expr $Y2 + $phvert1];
node 2524 [expr $X2 + $pzlat1] [expr $Y2 + $phvert1];
node 2525 [expr $X2 + $pzlat1] [expr $Y2 ];
node 2526 [expr $X2 + $pzlat1] [expr $Y2 - $phvert1];
node 2527 [expr $X2 + $pzlat1] [expr $Y2 - $phvert1];
node 2528 [expr $X2 - $pzlat1] [expr $Y2 - $phvert1];
node 2529 [expr $X2 - $pzlat1] [expr $Y2 - $phvert1];
node 2530 [expr $X2 - $pzlat1] [expr $Y2 ];
node 2531 $X2 [expr $Y2 - $phvert1];
node 2532 $X2 [expr $Y2 + $phvert1];

# panel zone at beam-column joint 3, Floor 2
node 2541 [expr $X3 - $pzlat1] [expr $Y2 + $phvert1];
node 2542 [expr $X3 - $pzlat1] [expr $Y2 + $phvert1];
node 2543 [expr $X3 + $pzlat1] [expr $Y2 + $phvert1];
node 2544 [expr $X3 + $pzlat1] [expr $Y2 + $phvert1];
node 2545 [expr $X3 + $pzlat1] [expr $Y2 ];
node 2546 [expr $X3 + $pzlat1] [expr $Y2 - $phvert1];
node 2547 [expr $X3 + $pzlat1] [expr $Y2 - $phvert1];
node 2548 [expr $X3 - $pzlat1] [expr $Y2 - $phvert1];
node 2549 [expr $X3 - $pzlat1] [expr $Y2 - $phvert1];
node 2550 [expr $X3 - $pzlat1] [expr $Y2 ];
node 2551 $X3 [expr $Y2 - $phvert1];
node 2552 $X3 [expr $Y2 + $phvert1];

# panel zone at beam-column joint 4, Floor 2
node 2561 [expr $X4 - $pzlat1] [expr $Y2 + $phvert1];
node 2562 [expr $X4 - $pzlat1] [expr $Y2 + $phvert1];
node 2563 [expr $X4 + $pzlat1] [expr $Y2 + $phvert1];
node 2564 [expr $X4 + $pzlat1] [expr $Y2 + $phvert1];
node 2565 [expr $X4 + $pzlat1] [expr $Y2 ];
node 2566 [expr $X4 + $pzlat1] [expr $Y2 - $phvert1];
node 2567 [expr $X4 + $pzlat1] [expr $Y2 - $phvert1];
node 2568 [expr $X4 - $pzlat1] [expr $Y2 - $phvert1];
node 2569 [expr $X4 - $pzlat1] [expr $Y2 - $phvert1];
node 2570 [expr $X4 - $pzlat1] [expr $Y2 ];
node 2571 $X4 [expr $Y2 - $phvert1];
node 2572 $X4 [expr $Y2 + $phvert1];

# panel zone at beam-column joint 5, Floor 2
node 2581 [expr $X5 - $pzlat1] [expr $Y2 + $phvert1];
node 2582 [expr $X5 - $pzlat1] [expr $Y2 + $phvert1];
node 2583 [expr $X5 + $pzlat1] [expr $Y2 + $phvert1];
node 2584 [expr $X5 + $pzlat1] [expr $Y2 + $phvert1];
node 2585 [expr $X5 + $pzlat1] [expr $Y2 ];
node 2586 [expr $X5 + $pzlat1] [expr $Y2 - $phvert1];
node 2587 [expr $X5 + $pzlat1] [expr $Y2 - $phvert1];
node 2588 [expr $X5 - $pzlat1] [expr $Y2 - $phvert1];
node 2589 [expr $X5 - $pzlat1] [expr $Y2 - $phvert1];
node 2590 [expr $X5 - $pzlat1] [expr $Y2 ];
node 2591 $X5 [expr $Y2 - $phvert1];
node 2592 $X5 [expr $Y2 + $phvert1];

# Single point constraints -- Boundary Conditions
fix 1001 1 1 1 ;
fix 1002 1 1 1 ;
fix 1003 1 1 1 ;
fix 1004 1 1 1 ;
fix 1005 1 1 1 ;
fix 1006 1 1 0 ; # P-delta column is pinned

#
fix 2515 1 2 3 ;
fix 2615 1 2 3;
fix 2715 1 2 3;
fix 2815 1 2 3;
fix 2915 1 2 3;




# restrictions for points related to dampers
# Bay 1
fix 2012 0 1 1 ;
fix 2013 0 1 1 ;
fix 2014 0 1 1 ;
fix 2015 0 1 1 ;
fix 2016 0 1 1 ;
fix 2017 0 1 1 ;
fix 2024 0 1 1 ;
fix 2025 0 1 1 ;
fix 2026 0 1 1 ;
fix 2027 0 1 1 ;
fix 2028 0 1 1 ;
fix 2029 0 1 1 ;
fix 2030 0 1 1 ;
fix 2031 0 1 1 ;
fix 2032 0 1 1 ;
fix 2033 0 1 1 ;

# Bay 2
fix 2112 0 1 1 ;
fix 2113 0 1 1 ;
fix 2114 0 1 1 ;
fix 2115 0 1 1 ;
fix 2116 0 1 1 ;
fix 2117 0 1 1 ;
fix 2124 0 1 1 ;
fix 2125 0 1 1 ;
fix 2126 0 1 1 ;
fix 2127 0 1 1 ;
fix 2128 0 1 1 ;
fix 2129 0 1 1 ;
fix 2130 0 1 1 ;
fix 2131 0 1 1 ;
fix 2132 0 1 1 ;
fix 2133 0 1 1 ;

# Bay 3
fix 2212 0 1 1 ;
fix 2213 0 1 1 ;
fix 2214 0 1 1 ;
fix 2215 0 1 1 ;
fix 2216 0 1 1 ;
fix 2217 0 1 1 ;
fix 2224 0 1 1 ;
fix 2225 0 1 1 ;
fix 2226 0 1 1 ;
fix 2227 0 1 1 ;
fix 2228 0 1 1 ;
fix 2229 0 1 1 ;
fix 2230 0 1 1 ;
fix 2231 0 1 1 ;
fix 2232 0 1 1 ;
fix 2233 0 1 1 ;

# Bay 4
fix 2312 0 1 1 ;
fix 2313 0 1 1 ;
fix 2314 0 1 1 ;
fix 2315 0 1 1 ;
fix 2316 0 1 1 ;
fix 2317 0 1 1 ;
fix 2324 0 1 1 ;
fix 2325 0 1 1 ;
fix 2326 0 1 1 ;
fix 2327 0 1 1 ;
fix 2328 0 1 1 ;
fix 2329 0 1 1 ;
fix 2330 0 1 1 ;
fix 2331 0 1 1 ;
fix 2332 0 1 1 ;
fix 2333 0 1 1 ;

# Bay 5
fix 2412 0 1 1 ;
fix 2413 0 1 1 ;
fix 2414 0 1 1 ;
fix 2415 0 1 1 ;
fix 2416 0 1 1 ;
fix 2417 0 1 1 ;
fix 2424 0 1 1 ;
fix 2425 0 1 1 ;
fix 2426 0 1 1 ;
fix 2427 0 1 1 ;
fix 2428 0 1 1 ;
fix 2429 0 1 1 ;
fix 2430 0 1 1 ;
fix 2431 0 1 1 ;
fix 2432 0 1 1 ;
fix 2433 0 1 1 ;





# constrain beam-column joints in a floor to have the same lateral displacement using the equal dof command
set dof1 1; # constrain movement in dof 1 (x-direction)
# Floor level 2
equalDOF 2505 2525 2 3 ;
equalDOF 2525 2545 2 3 ;
equalDOF 2545 2565 2 3 ;
equalDOF 2565 2585 2 3 ;
equalDOF 2585 2600 2 3 ;


#Equal Dof for all beam nodes and self centering nodes

equalDOF 2013 2003 1 ;
equalDOF 2014 2004 1 ;
equalDOF 2015 2005 1 ;
equalDOF 2016 2006 1 ;
equalDOF 2017 2007 1 ;


equalDOF 2113 2103 1 ;
equalDOF 2114 2104 1 ;
equalDOF 2115 2105 1 ;
equalDOF 2116 2106 1 ;
equalDOF 2117 2107 1 ;

equalDOF 2212 2202 1 ;
equalDOF 2213 2203 1 ;
equalDOF 2214 2204 1 ;
equalDOF 2215 2205 1 ;
equalDOF 2216 2206 1 ;
equalDOF 2217 2207 1 ;

equalDOF 2312 2302 1 ;
equalDOF 2313 2303 1 ;
equalDOF 2314 2304 1 ;
equalDOF 2315 2305 1 ;
equalDOF 2316 2306 1 ;
equalDOF 2317 2307 1 ;

equalDOF 2412 2402 1 ;
equalDOF 2413 2403 1 ;
equalDOF 2414 2404 1 ;
equalDOF 2415 2405 1 ;
equalDOF 2416 2406 1 ;
equalDOF 2417 2407 1 ;



# equal dofs for damper nodes and self centering nodes




#Equal DOF FOR ALL Zero length elements in damper point nodes
# bay 1
equalDOF 2025 2024 1 2 3 ;
equalDOF 2027 2026 1 2 3 ;
equalDOF 2029 2028 1 2 3 ;
equalDOF 2031 2030 1 2 3 ;
equalDOF 2033 2032 1 2 3 ;

# bay 2
equalDOF 2125 2124 1 2 3 ;
equalDOF 2127 2126 1 2 3 ;
equalDOF 2129 2128 1 2 3 ;
equalDOF 2131 2130 1 2 3 ;
equalDOF 2133 2132 1 2 3 ;

# bay 3
equalDOF 2225 2224 1 2 3 ;
equalDOF 2227 2226 1 2 3 ;
equalDOF 2229 2228 1 2 3 ;
equalDOF 2231 2230 1 2 3 ;
equalDOF 2233 2232 1 2 3 ;

# bay 4
equalDOF 2325 2324 1 2 3 ;
equalDOF 2327 2326 1 2 3 ;
equalDOF 2329 2328 1 2 3 ;
equalDOF 2331 2330 1 2 3 ;
equalDOF 2333 2332 1 2 3 ;

# bay 5
equalDOF 2425 2424 1 2 3 ;
equalDOF 2427 2426 1 2 3 ;
equalDOF 2429 2428 1 2 3 ;
equalDOF 2431 2430 1 2 3 ;
equalDOF 2433 2432 1 2 3 ;




# column spings
# equal dof for for same nodes ( master node and slave node )

equalDOF 200 2511 1 2 3 ;
equalDOF 201 2531 1 2 3 ;
equalDOF 202 2551 1 2 3 ;
equalDOF 203 2571 1 2 3 ;
equalDOF 204 2591 1 2 3 ;
equalDOF 205 2600 1 2 3 ;


# beam spings
# equal dof for same nodes ( master node and slave node )
equalDOF 210 211 1 2 3 ;
equalDOF 212 213 1 2 3 ;
equalDOF 214 215 1 2 3 ;
equalDOF 216 217 1 2 3 ;
equalDOF 218 219 1 2 3 ;
equalDOF 220 221 1 2 3 ;
equalDOF 222 223 1 2 3 ;
equalDOF 224 225 1 2 3 ;


# Assign masses to the nodes in x-direction

# input parameters to calculate unit mass of each floor
set g [ expr 386.0*$in/($sec*$sec) ] ; # value of accelaration due to gravity in in/sec2
set massfloor2 [ expr 1.248*1000000*$kg ] ; # mass of floor 2
set Negligible 1e-9; # a very small number to avoid problems with zero

# floor 2
set m2 [ expr $massfloor2/5 ] ; # mass assigned to each node of plane frame of floor 2

# Assign mass to the nodes of plane frame structure
# floor 2
mass 2505 $m2 $Negligible $Negligible ;
mass 2525 $m2 $Negligible $Negligible ;
mass 2545 $m2 $Negligible $Negligible ;
mass 2565 $m2 $Negligible $Negligible ;
mass 2585 $m2 $Negligible $Negligible ;


# Define Section Properties and Elements
# For floor level 2 and 3 ( elevation ) ( For N/S Frames )
# define material properties
set Es [ expr 29000.0*$ksi ] ; # steel Young's modulus
set Fy [ expr 54.3892*$ksi ] ; # Yield strength of steel used in this model
# define column section W21x201
set Acol_12 [ expr 59.3*$in2 ] ; # cross-sectional area
set Icol_12 [ expr 5310.0*$in4 ] ; # moment of inertia
set Mycol_12 [ expr 22999.0*$kip*$in ] ; # yield moment
set dcol_12 [ expr 23.0*$in ] ; # depth
set bfcol_12 [ expr 12.6*$in ]; # flange width
set tfcol_12 [ expr 1.63*$in ] ; # flange thickness
set twcol_12 [ expr 0.910*$in ] ; # web thickness
set dc [ expr $dcol_12 - $tfcol_12 ] ; # width of panel zone including this column
# define beam section W27x94
set Abeam_23 [ expr 27.6*$in2 ] ; # cross-sectional area (full section properties)
set Ibeam_23 [ expr 3270*$in4 ] ; # moment of inertia (full section properties)
set Mybeam_23 [ expr 11368.0*$kip*$in ] ; # yield moment at plastic hinge location (i.e., My of RBS section, if used)
set dbeam_23 [ expr 26.9*$in ] ; # depth of beam
set tbf [ expr 0.745*$in ] ; # Thickness of flange
set db [ expr $dbeam_23 - $tbf ] ; # Depth of panel zone

set tdp [ expr 0.875*$in ] ; #Thickness of doubler plate used in this connection
set tp [ expr $tdp + $twcol_12 ] ; # Thickness of panel zone

# calculate modified section properties to account for spring stiffness being in series with the elastic element stiffness
set n 10 ; # stiffness multiplier for rotational spring

# calculate modified moment of inertia for elastic elements
set Icol_12mod [expr $Icol_12*($n+1.0)/$n]; # modified moment of inertia for columns
set Ibeam_23mod [expr $Ibeam_23*($n+1.0)/$n]; # modified moment of inertia for beams


# calculate modified rotational stiffness for plastic hinge springs
set Ks_col_1 [expr $n*24*$Es*$Icol_12mod/(613089)] ; # rotational stiffness of Story 1 column springs
set Ks_col_2 [expr $n*384*$Es*$Icol_12mod/$LCol2]; # rotational stiffness of Story 2 column springs
set Ks_beam_23 [expr $n*24*$Es*$Ibeam_23mod/(613089)] ; # rotational stiffness of beam springs


# set up geometric transformations of element
set PDeltaTransf 1;
geomTransf PDelta $PDeltaTransf; # PDelta transformation

# define elastic column elements using "element" command
# command: element elasticBeamColumn $eleID $iNode $jNode $A $E $I $transfID
# eleID convention: "1xy" where 1 = col, x = Pier #, y = Story #
# Columns Story 1
element elasticBeamColumn 127 107 200 $Acol_12 $Es $Icol_12mod $PDeltaTransf; # Pier 1
element elasticBeamColumn 128 108 201 $Acol_12 $Es $Icol_12mod $PDeltaTransf; # Pier 2
element elasticBeamColumn 129 109 202 $Acol_12 $Es $Icol_12mod $PDeltaTransf; # Pier 3
element elasticBeamColumn 130 110 203 $Acol_12 $Es $Icol_12mod $PDeltaTransf; # Pier 4
element elasticBeamColumn 131 111 204 $Acol_12 $Es $Icol_12mod $PDeltaTransf; # Pier 5






# define elastic beam elements
# Normal beam elements
# eleID convention: "2xy" where 2 = beam, x = Bay #, y = Floor #
# floor 2 beam 1 ( elements )
#Normal elements
element elasticBeamColumn 132 2505 210 $Abeam_23 $Es $Ibeam_23mod $PDeltaTransf;
element elasticBeamColumn 133 211 2002 $Abeam_23 $Es $Ibeam_23mod $PDeltaTransf;
element elasticBeamColumn 134 2002 2003 $Abeam_23 $Es $Ibeam_23mod $PDeltaTransf;
element elasticBeamColumn 135 2003 2004 $Abeam_23 $Es $Ibeam_23mod $PDeltaTransf;
element elasticBeamColumn 136 2004 2005 $Abeam_23 $Es $Ibeam_23mod $PDeltaTransf;
element elasticBeamColumn 137 2005 2006 $Abeam_23 $Es $Ibeam_23mod $PDeltaTransf;
element elasticBeamColumn 138 2006 2007 $Abeam_23 $Es $Ibeam_23mod $PDeltaTransf;
element elasticBeamColumn 140 2007 212 $Abeam_23 $Es $Ibeam_23mod $PDeltaTransf ;
element elasticBeamColumn 141 213 2530 $Abeam_23 $Es $Ibeam_23mod $PDeltaTransf;

# floor 2 beam 2 ( $normal elements )

element elasticBeamColumn 142 2525 214 $Abeam_23 $Es $Ibeam_23mod $PDeltaTransf;
element elasticBeamColumn 143 215 2102 $Abeam_23 $Es $Ibeam_23mod $PDeltaTransf;
element elasticBeamColumn 144 2102 2103 $Abeam_23 $Es $Ibeam_23mod $PDeltaTransf;
element elasticBeamColumn 145 2103 2104 $Abeam_23 $Es $Ibeam_23mod $PDeltaTransf;
element elasticBeamColumn 146 2104 2105 $Abeam_23 $Es $Ibeam_23mod $PDeltaTransf;
element elasticBeamColumn 147 2105 2106 $Abeam_23 $Es $Ibeam_23mod $PDeltaTransf;
element elasticBeamColumn 148 2106 2107 $Abeam_23 $Es $Ibeam_23mod $PDeltaTransf;
element elasticBeamColumn 150 2107 216 $Abeam_23 $Es $Ibeam_23mod $PDeltaTransf ;
element elasticBeamColumn 151 217 2550 $Abeam_23 $Es $Ibeam_23mod $PDeltaTransf;


# floor 2 beam 3 ( $normal elements )

element elasticBeamColumn 152 2545 218 $Abeam_23 $Es $Ibeam_23mod $PDeltaTransf;
element elasticBeamColumn 153 219 2202 $Abeam_23 $Es $Ibeam_23mod $PDeltaTransf;
element elasticBeamColumn 154 2202 2203 $Abeam_23 $Es $Ibeam_23mod $PDeltaTransf;
element elasticBeamColumn 155 2203 2204 $Abeam_23 $Es $Ibeam_23mod $PDeltaTransf;
element elasticBeamColumn 156 2204 2205 $Abeam_23 $Es $Ibeam_23mod $PDeltaTransf;
element elasticBeamColumn 157 2205 2206 $Abeam_23 $Es $Ibeam_23mod $PDeltaTransf;
element elasticBeamColumn 158 2206 2207 $Abeam_23 $Es $Ibeam_23mod $PDeltaTransf;
element elasticBeamColumn 160 2207 220 $Abeam_23 $Es $Ibeam_23mod $PDeltaTransf ;
element elasticBeamColumn 161 221 2570 $Abeam_23 $Es $Ibeam_23mod $PDeltaTransf;


# floor 2 beam 4 ( $normal elements )

element elasticBeamColumn 162 2565 222 $Abeam_23 $Es $Ibeam_23mod $PDeltaTransf;
element elasticBeamColumn 163 223 2302 $Abeam_23 $Es $Ibeam_23mod $PDeltaTransf;
element elasticBeamColumn 164 2302 2303 $Abeam_23 $Es $Ibeam_23mod $PDeltaTransf;
element elasticBeamColumn 165 2303 2304 $Abeam_23 $Es $Ibeam_23mod $PDeltaTransf;
element elasticBeamColumn 166 2304 2305 $Abeam_23 $Es $Ibeam_23mod $PDeltaTransf;
element elasticBeamColumn 167 2305 2306 $Abeam_23 $Es $Ibeam_23mod $PDeltaTransf;
element elasticBeamColumn 168 2306 2307 $Abeam_23 $Es $Ibeam_23mod $PDeltaTransf;
element elasticBeamColumn 170 2307 224 $Abeam_23 $Es $Ibeam_23mod $PDeltaTransf ;
element elasticBeamColumn 171 225 2590 $Abeam_23 $Es $Ibeam_23mod $PDeltaTransf;


# define p-delta columns and rigid links
set TrussMatID 600; # define a material ID
set Arigid [ expr 1000.0*$in*$in ]; # define area of truss section (make much larger than A of frame elements)
set Irigid [ expr 100000.0*$in4 ] ; # moment of inertia for p-delta columns (make much larger than I of frame elements)
uniaxialMaterial Elastic $TrussMatID $Es; # define truss material


# floor 2 beam 5 ( $truss elements )

element truss 172 2585 2402 $Arigid $TrussMatID ;
element truss 174 2402 2403 $Arigid $TrussMatID;
element truss 175 2403 2404 $Arigid $TrussMatID;
element truss 176 2404 2405 $Arigid $TrussMatID;
element truss 177 2405 2406 $Arigid $TrussMatID;
element truss 178 2406 2407 $Arigid $TrussMatID;
element truss 180 2407 2600 $Arigid $TrussMatID ;

# p-delta columns
# eleID convention: 7xy, 7 = p-delta columns, x = Pier #, y = Story #
element elasticBeamColumn 190 1006 2600 $Arigid $Es $Irigid $PDeltaTransf; # Story 1

# Define SMA Alloy ( which is a part of superelastic viscous damper as a self recentering material )
# define input paramters
set k1 [ expr 2.92*$KN/$mm ] ; # initial stiffness
set k2 [ expr 0.99*$KN/$mm] ; # post activation stiffness
set fa [ expr 53.1*$KN ] ; # forward activation force
set b 1 ; # ratio of forward to reverse activation stress
uniaxialMaterial SelfCentering 1 $k1 $k2 $fa $b




# Define viscous damper material
# Input parameters for viscous damper material
set k [ expr 1.43*$KN/$mm ] ; # elastic stiffness of damper
set Cd [ expr 1.0*$KN*$sec/$mm ] ; # viscous damping coefficient
set ad 0.8 ; # non linear exponent coefficient

uniaxialMaterial ViscousDamper 2 $k $Cd $ad



set A1 [ expr 1000*$in*$in ] ; # area for other connecting column type connections
set I1 [ expr 1.0e6*$in4 ] ; # Moment of inertia for other connecting column type connections
set DeltaTransf 10;
geomTransf PDelta $DeltaTransf; # Linear transformation
# Beams connecting column bottom nodes and main supporting node for dampers( Bay 1 )
element elasticBeamColumn 100 1001 2515 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 101 1002 2515 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 102 2005 2015 $A1 $Es $I1 $DeltaTransf ;

# Beams connecting column bottom nodes and main supporting node for dampers( Bay 2 )
element elasticBeamColumn 103 1002 2615 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 104 1003 2615 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 105 2105 2115 $A1 $Es $I1 $DeltaTransf ;

# Beams connecting column bottom nodes and main supporting node for dampers( Bay 3 )
element elasticBeamColumn 106 1003 2715 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 107 1004 2715 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 108 2205 2215 $A1 $Es $I1 $DeltaTransf ;

# Beams connecting column bottom nodes and main supporting node for dampers( Bay 4 )
element elasticBeamColumn 109 1004 2815 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 110 1005 2815 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 111 2305 2315 $A1 $Es $I1 $DeltaTransf ;

# Beams connecting column bottom nodes and main supporting node for dampers( Bay 5 )
element elasticBeamColumn 112 1005 2915 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 113 1006 2915 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 114 2405 2415 $A1 $Es $I1 $DeltaTransf ;

# Two node links connecting as self centering elements
# Bay1
element twoNodeLink 1 2012 2013 -mat 1 -dir 1 ; puts "a"

element twoNodeLink 2 2013 2014 -mat 1 -dir 1; puts "a"
element twoNodeLink 3 2014 2015 -mat 1 -dir 1;puts "a"
element twoNodeLink 4 2015 2016 -mat 1 -dir 1;puts "a"
element twoNodeLink 5 2016 2017 -mat 1 -dir 1;puts "a"

# Bay2
element twoNodeLink 6 2112 2113 -mat 1 -dir 1;puts "a"
element twoNodeLink 7 2113 2114 -mat 1 -dir 1;puts "a"
element twoNodeLink 8 2114 2115 -mat 1 -dir 1;puts "a"
element twoNodeLink 9 2115 2116 -mat 1 -dir 1;puts "a"
element twoNodeLink 10 2116 2117 -mat 1 -dir 1;puts "a"


# Bay3
element twoNodeLink 11 2212 2213 -mat 1 -dir 1;puts "a"
element twoNodeLink 12 2213 2214 -mat 1 -dir 1;puts "a"
element twoNodeLink 13 2214 2215 -mat 1 -dir 1;puts "a"
element twoNodeLink 14 2215 2216 -mat 1 -dir 1;puts "a"
element twoNodeLink 15 2216 2217 -mat 1 -dir 1;puts "a"


# Bay4
element twoNodeLink 16 2312 2313 -mat 1 -dir 1;puts "a"
element twoNodeLink 17 2313 2314 -mat 1 -dir 1;puts "a"
element twoNodeLink 18 2314 2315 -mat 1 -dir 1;puts "a"
element twoNodeLink 19 2315 2316 -mat 1 -dir 1;puts "a"
element twoNodeLink 20 2316 2317 -mat 1 -dir 1;puts "a"


# Bay5
element twoNodeLink 21 2412 2413 -mat 1 -dir 1;puts "a"
element twoNodeLink 22 2413 2414 -mat 1 -dir 1;puts "a"
element twoNodeLink 23 2414 2415 -mat 1 -dir 1;puts "a"
element twoNodeLink 24 2415 2416 -mat 1 -dir 1;puts "a"
element twoNodeLink 25 2416 2417 -mat 1 -dir 1;puts "a"

# Beam elements vertically connecting the beam nodes to self centering nodes

#( Bay 1 )
element elasticBeamColumn 30 2002 2012 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 31 2003 2013 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 32 2004 2014 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 33 2006 2016 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 34 2007 2017 $A1 $Es $I1 $DeltaTransf ;

#( Bay 2 )
element elasticBeamColumn 35 2102 2112 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 36 2103 2113 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 37 2104 2114 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 38 2106 2116 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 39 2107 2117 $A1 $Es $I1 $DeltaTransf ;
#( Bay 3 )
element elasticBeamColumn 40 2202 2212 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 41 2203 2213 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 42 2204 2214 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 43 2206 2216 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 44 2207 2217 $A1 $Es $I1 $DeltaTransf ;

#( Bay 4 )
element elasticBeamColumn 45 2302 2312 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 46 2303 2313 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 47 2304 2314 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 48 2306 2316 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 49 2307 2317 $A1 $Es $I1 $DeltaTransf ;

#( Bay 5 )
element elasticBeamColumn 50 2402 2412 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 51 2403 2413 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 52 2404 2414 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 53 2406 2416 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 54 2407 2417 $A1 $Es $I1 $DeltaTransf ;

# zero length elements for dampers
#Bay1
element zeroLength 55 2024 2025 -mat 2 -dir 1
element zeroLength 56 2026 2027 -mat 2 -dir 1
element zeroLength 57 2028 2029 -mat 2 -dir 1
element zeroLength 58 2030 2031 -mat 2 -dir 1
element zeroLength 59 2032 2033 -mat 2 -dir 1

#Bay2
element zeroLength 60 2124 2125 -mat 2 -dir 1
element zeroLength 61 2126 2127 -mat 2 -dir 1
element zeroLength 62 2128 2129 -mat 2 -dir 1
element zeroLength 63 2130 2131 -mat 2 -dir 1
element zeroLength 64 2132 2133 -mat 2 -dir 1

#Bay3
element zeroLength 65 2224 2225 -mat 2 -dir 1
element zeroLength 66 2226 2227 -mat 2 -dir 1
element zeroLength 67 2228 2229 -mat 2 -dir 1
element zeroLength 68 2230 2231 -mat 2 -dir 1
element zeroLength 69 2232 2233 -mat 2 -dir 1

#Bay4
element zeroLength 70 2324 2325 -mat 2 -dir 1
element zeroLength 71 2326 2327 -mat 2 -dir 1
element zeroLength 72 2328 2329 -mat 2 -dir 1
element zeroLength 73 2330 2331 -mat 2 -dir 1
element zeroLength 74 2332 2333 -mat 2 -dir 1

#Bay5
element zeroLength 75 2424 2425 -mat 2 -dir 1
element zeroLength 76 2426 2427 -mat 2 -dir 1
element zeroLength 77 2428 2429 -mat 2 -dir 1
element zeroLength 78 2430 2431 -mat 2 -dir 1
element zeroLength 79 2432 2433 -mat 2 -dir 1


# Elements connecting self centering nodes and damping nodes
#Bay 1
element elasticBeamColumn 200 2024 2012 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 201 2025 2013 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 202 2026 2013 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 203 2027 2014 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 204 2028 2014 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 205 2029 2015 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 206 2030 2015 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 207 2031 2016 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 208 2032 2016 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 209 2033 2017 $A1 $Es $I1 $DeltaTransf ;

#Bay2
element elasticBeamColumn 210 2124 2112 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 211 2125 2113 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 212 2126 2113 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 213 2127 2114 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 214 2128 2114 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 215 2129 2115 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 216 2130 2115 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 217 2131 2116 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 218 2132 2116 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 219 2133 2117 $A1 $Es $I1 $DeltaTransf ;

#Bay3
element elasticBeamColumn 220 2224 2212 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 221 2225 2213 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 222 2226 2213 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 223 2227 2214 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 224 2228 2214 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 225 2229 2215 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 226 2230 2215 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 227 2231 2216 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 228 2232 2216 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 229 2233 2217 $A1 $Es $I1 $DeltaTransf ;

#Bay4
element elasticBeamColumn 230 2324 2312 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 231 2325 2313 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 232 2326 2313 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 233 2327 2314 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 234 2328 2314 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 235 2329 2315 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 236 2330 2315 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 237 2331 2316 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 238 2332 2316 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 239 2333 2317 $A1 $Es $I1 $DeltaTransf ;

#Bay5
element elasticBeamColumn 240 2424 2412 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 241 2425 2413 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 242 2426 2413 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 243 2427 2414 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 244 2428 2414 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 245 2429 2415 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 246 2430 2415 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 247 2431 2416 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 248 2432 2416 $A1 $Es $I1 $DeltaTransf ;
element elasticBeamColumn 249 2433 2417 $A1 $Es $I1 $DeltaTransf ;

# Provide rigid links

element rigidLink 2515 2015 ;
element rigidLink 2615 2115 ;
element rigidLink 2715 2215 ;
element rigidLink 2815 2315 ;
element rigidLink 2915 2415 ;







# Bilinear rotational hinges for reduced beam sections


# Redefine the deterioration parameters as the Wsection has changed
# Define input parameters for rotational spring properties ( for columns of storey 3 and 4 )
set fcfy 1.05 ; # average value of steel beams without a floor slab (fc/fy)
set McMy 1.09; # ratio of capping moment to yield moment, Mc / My
set LS 3.931; # basic strength deterioration (a very large # = no cyclic deterioration)
set LK [expr 3.931*2 ] ; # unloading stiffness deterioration (a very large # = no cyclic deterioration)
set LA 1000 ; # accelerated reloading stiffness deterioration (a very large # = no cyclic deterioration)
set LD 3.931; # post-capping strength deterioration (a very large # = no deterioration)
set cS 1.0; # exponent for basic strength deterioration (c = 1.0 for no deterioration)
set cK 1.0; # exponent for unloading stiffness deterioration (c = 1.0 for no deterioration)
set cA 1.0; # exponent for accelerated reloading stiffness deterioration (c = 1.0 for no deterioration)
set cD 1.0; # exponent for post-capping strength deterioration (c = 1.0 for no deterioration)
set th_pP 0.035; # plastic rot capacity for pos loading
set th_pN 0.035; # plastic rot capacity for neg loading
set th_pcP 0.425; # post-capping rot capacity for pos loading
set th_pcN 0.425; # post-capping rot capacity for neg loading
set ResP 0.4; # residual strength ratio for pos loading
set ResN 0.4; # residual strength ratio for neg loading
set th_uP 0.07; # ultimate rot capacity for pos loading
set th_uN 0.07; # ultimate rot capacity for neg loading
set DP 1.0; # rate of cyclic deterioration for pos loading
set DN 1.0; # rate of cyclic deterioration for neg loading
set a_mem [expr ($n+1.0)*($Mycol_12*($McMy-1.0)) / ($Ks_col_1*$th_pP)]; # strain hardening ratio of spring
set b 0.0028 ; #[expr ($a_mem)/(1.0+$n*( 1.0 - $a_mem))]

# define column springs of storey 1
# command: rotSpring2DModIKModel id ndR ndC K asPos asNeg MyPos MyNeg LS LK LA LD cS cK cA cD th_p+ th_p- th_pc+ th_pc- Res+ Res- th_u+ th_u- D+ D-
# col springs @ bottom of Storey 1 (at base)
rotSpring2DModIKModel 181 1001 107 $Ks_col_1 $b $b $Mycol_12 [expr -$Mycol_12] $LS $LK $LA $LD $cS $cK $cA $cD $th_pP $th_pN $th_pcP $th_pcN $ResP $ResN $th_uP $th_uN $DP $DN;
rotSpring2DModIKModel 182 1002 108 $Ks_col_1 $b $b $Mycol_12 [expr -$Mycol_12] $LS $LK $LA $LD $cS $cK $cA $cD $th_pP $th_pN $th_pcP $th_pcN $ResP $ResN $th_uP $th_uN $DP $DN;
rotSpring2DModIKModel 183 1003 109 $Ks_col_1 $b $b $Mycol_12 [expr -$Mycol_12] $LS $LK $LA $LD $cS $cK $cA $cD $th_pP $th_pN $th_pcP $th_pcN $ResP $ResN $th_uP $th_uN $DP $DN;
rotSpring2DModIKModel 184 1004 110 $Ks_col_1 $b $b $Mycol_12 [expr -$Mycol_12] $LS $LK $LA $LD $cS $cK $cA $cD $th_pP $th_pN $th_pcP $th_pcN $ResP $ResN $th_uP $th_uN $DP $DN;
rotSpring2DModIKModel 185 1005 111 $Ks_col_1 $b $b $Mycol_12 [expr -$Mycol_12] $LS $LK $LA $LD $cS $cK $cA $cD $th_pP $th_pN $th_pcP $th_pcN $ResP $ResN $th_uP $th_uN $DP $DN;

# col springs @ top of Story 1 (at base)
rotSpring2DModIKModel 186 2511 200 $Ks_col_1 $b $b $Mycol_12 [expr -$Mycol_12] $LS $LK $LA $LD $cS $cK $cA $cD $th_pP $th_pN $th_pcP $th_pcN $ResP $ResN $th_uP $th_uN $DP $DN;
rotSpring2DModIKModel 187 2531 201 $Ks_col_1 $b $b $Mycol_12 [expr -$Mycol_12] $LS $LK $LA $LD $cS $cK $cA $cD $th_pP $th_pN $th_pcP $th_pcN $ResP $ResN $th_uP $th_uN $DP $DN;
rotSpring2DModIKModel 188 2551 202 $Ks_col_1 $b $b $Mycol_12 [expr -$Mycol_12] $LS $LK $LA $LD $cS $cK $cA $cD $th_pP $th_pN $th_pcP $th_pcN $ResP $ResN $th_uP $th_uN $DP $DN;
rotSpring2DModIKModel 189 2571 203 $Ks_col_1 $b $b $Mycol_12 [expr -$Mycol_12] $LS $LK $LA $LD $cS $cK $cA $cD $th_pP $th_pN $th_pcP $th_pcN $ResP $ResN $th_uP $th_uN $DP $DN;
rotSpring2DModIKModel 191 2591 204 $Ks_col_1 $b $b $Mycol_12 [expr -$Mycol_12] $LS $LK $LA $LD $cS $cK $cA $cD $th_pP $th_pN $th_pcP $th_pcN $ResP $ResN $th_uP $th_uN $DP $DN;
rotSpring2DModIKModel 192 2600 205 $Ks_col_1 $b $b $Mycol_12 [expr -$Mycol_12] $LS $LK $LA $LD $cS $cK $cA $cD $th_pP $th_pN $th_pcP $th_pcN $ResP $ResN $th_uP $th_uN $DP $DN;


# Creating rotational springs for beams
# input values for Beam of floor 2 and 3 beam springs
set McMy 1.09; # ratio of capping moment to yield moment, Mc / My
set LS 0.95; # basic strength deterioration (a very large # = no cyclic deterioration)
set LK [ expr 0.95*2 ] ; # unloading stiffness deterioration (a very large # = no cyclic deterioration)
set LA 1000 ; # accelerated reloading stiffness deterioration (a very large # = no cyclic deterioration)
set LD 0.95; # post-capping strength deterioration (a very large # = no deterioration)
set cS 1.0; # exponent for basic strength deterioration (c = 1.0 for no deterioration)
set cK 1.0; # exponent for unloading stiffness deterioration (c = 1.0 for no deterioration)
set cA 1.0; # exponent for accelerated reloading stiffness deterioration (c = 1.0 for no deterioration)
set cD 1.0; # exponent for post-capping strength deterioration (c = 1.0 for no deterioration)
set th_pP 0.02; # plastic rot capacity for pos loading
set th_pN 0.02; # plastic rot capacity for neg loading
set th_pcP 0.162; # post-capping rot capacity for pos loading
set th_pcN 0.162; # post-capping rot capacity for neg loading
set ResP 0.4; # residual strength ratio for pos loading
set ResN 0.4; # residual strength ratio for neg loading
set th_uP 0.07; # ultimate rot capacity for pos loading
set th_uN 0.07; # ultimate rot capacity for neg loading
set DP 1.0; # rate of cyclic deterioration for pos loading
set DN 1.0; # rate of cyclic deterioration for neg loading
set a_mem [expr ($n+1.0)*($Mybeam_23*($McMy-1.0)) / ($Ks_beam_23*$th_pP)]; # strain hardening ratio of spring
set b 0.0028 ; # modified strain hardening ratio of spring (Ibarra & Krawinkler 2005, note: Eqn B.5 is incorrect) [expr ($a_mem)/(1.0+$n*(1.0 - $a_mem))]

# Beam springs @ floor 2
rotSpring2DModIKModel 250 210 211 $Ks_beam_23 $b $b $Mybeam_23 [expr -$Mybeam_23] $LS $LK $LA $LD $cS $cK $cA $cD $th_pP $th_pN $th_pcP $th_pcN $ResP $ResN $th_uP $th_uN $DP $DN
rotSpring2DModIKModel 251 212 213 $Ks_beam_23 $b $b $Mybeam_23 [expr -$Mybeam_23] $LS $LK $LA $LD $cS $cK $cA $cD $th_pP $th_pN $th_pcP $th_pcN $ResP $ResN $th_uP $th_uN $DP $DN
rotSpring2DModIKModel 252 214 215 $Ks_beam_23 $b $b $Mybeam_23 [expr -$Mybeam_23] $LS $LK $LA $LD $cS $cK $cA $cD $th_pP $th_pN $th_pcP $th_pcN $ResP $ResN $th_uP $th_uN $DP $DN
rotSpring2DModIKModel 253 216 217 $Ks_beam_23 $b $b $Mybeam_23 [expr -$Mybeam_23] $LS $LK $LA $LD $cS $cK $cA $cD $th_pP $th_pN $th_pcP $th_pcN $ResP $ResN $th_uP $th_uN $DP $DN
rotSpring2DModIKModel 254 218 219 $Ks_beam_23 $b $b $Mybeam_23 [expr -$Mybeam_23] $LS $LK $LA $LD $cS $cK $cA $cD $th_pP $th_pN $th_pcP $th_pcN $ResP $ResN $th_uP $th_uN $DP $DN
rotSpring2DModIKModel 255 220 221 $Ks_beam_23 $b $b $Mybeam_23 [expr -$Mybeam_23] $LS $LK $LA $LD $cS $cK $cA $cD $th_pP $th_pN $th_pcP $th_pcN $ResP $ResN $th_uP $th_uN $DP $DN
rotSpring2DModIKModel 256 222 223 $Ks_beam_23 $b $b $Mybeam_23 [expr -$Mybeam_23] $LS $LK $LA $LD $cS $cK $cA $cD $th_pP $th_pN $th_pcP $th_pcN $ResP $ResN $th_uP $th_uN $DP $DN
rotSpring2DModIKModel 257 224 225 $Ks_beam_23 $b $b $Mybeam_23 [expr -$Mybeam_23] $LS $LK $LA $LD $cS $cK $cA $cD $th_pP $th_pN $th_pcP $th_pcN $ResP $ResN $th_uP $th_uN $DP $DN

# define elastic panel zone elements (assume rigid)
set Apz [ expr 1000.0*$in2 ]; # area of panel zone element (make much larger than A of frame elements)
set Ipz [ expr 1.0e5*$in4 ] ; # moment of intertia of panel zone element (make much larger than I of frame elements)
# elemPanelZone2D eleID nodeR E A_PZ I_PZ transfTag
# Floor 2

elemPanelZone2D 260 2501 $Es $Apz $Ipz $PDeltaTransf; # joint 1
elemPanelZone2D 270 2521 $Es $Apz $Ipz $PDeltaTransf; # joint 2
elemPanelZone2D 280 2541 $Es $Apz $Ipz $PDeltaTransf; # joint 3
elemPanelZone2D 290 2561 $Es $Apz $Ipz $PDeltaTransf; # joint 4
elemPanelZone2D 300 2581 $Es $Apz $Ipz $PDeltaTransf; # joint 5

#define panel zone springs
# input paramters for panel zone springs ( For floor level 2 and 3 )
# rotPanelZone2D creates a uniaxial material spring with a trilinear response based on the Krawinkler Model
# It also constrains the nodes in the corners of the panel zone.
# references provided in rotPanelZone2D.tcl
# note: the upper right corner nodes of the PZ must be imported
set Ry 1.2; # expected yield strength multiplier (have to check )
set as_PZ 0.06; # strain hardening of panel zones
# Spring ID: "4xy00" where 4 = panel zone spring, x = Pier #, y = Floor #
#2nd Floor PZ springs
# ElemID ndR ndC E Fy dc bf_c tf_c tp db Ry as
rotPanelZone2D 4120 2503 2504 $Es $Fy $dc $bfcol_12 $tfcol_12 $tp $db $Ry $as_PZ; #joint 1
rotPanelZone2D 4124 2523 2524 $Es $Fy $dc $bfcol_12 $tfcol_12 $tp $db $Ry $as_PZ; #joint 2
rotPanelZone2D 4128 2543 2544 $Es $Fy $dc $bfcol_12 $tfcol_12 $tp $db $Ry $as_PZ; #joint 3
rotPanelZone2D 4132 2563 2564 $Es $Fy $dc $bfcol_12 $tfcol_12 $tp $db $Ry $as_PZ; #joint 4
rotPanelZone2D 4136 2583 2584 $Es $Fy $dc $bfcol_12 $tfcol_12 $tp $db $Ry $as_PZ; #joint 5

# Record--------------------------------------------------------------------
# define p-delta column spring: zero-stiffness elastic spring
#Spring ID: "5xya" where 5 = leaning column spring, x = Pier #, y = Story #, a = location in story
# "a" convention: 1 = bottom of story, 2 = top of story
# rotLeaningCol ElemID ndR ndC
rotLeaningCol 4141 205 2600; # top of Story 1

source LibAnalysisDynamicParameters.tcl ;
# set the loads gravity load analysis to be constant and set the time to be 0.0
# Source in TCL proc to read PEER SMD record
source ReadSMDFile.tcl ;
# Permform the conversion from SMD record to OpenSees record
# inFile outFile dt
ReadSMDFile RSN4_IMPVALL.BG_B-ELC000.AT2 groundmotionlow.txt 0.01 ; # values from file 1 will go to output file (values.tcl)





recorder Node -file Damperdisp1.txt -timeSeries 1 -time -node 2015 2115 2215 2315 2415 2505 2525 2545 2565 2585 2005 2105 2205 2305 2405 -dof 1 disp ;
recorder Element -file Damperdisp.txt -time -ele 3 8 13 18 23 28 localForce ;
# set damping based on first eigen mode
set lambadI [ expr [ eigen 1 ] ] ;
set freq [expr pow($lambadI,0.5) ] ;
set period [expr (2*3.14)/$freq]
puts $period
set damp 0.02;
rayleigh [expr 2*$damp*$freq] 0. 0. 0.

# define ground motion parameters
set patternID 3; # load pattern ID
set GMdirection 1; # ground motion direction (1 = x)
set GMfile "groundmotionlow.txt"; # ground motion filename
set dt 0.01; # timestep of input GM file
set Scalefact 8.0; # ground motion scaling factor

# define the acceleration series for the ground motion
# syntax: "Series -dt $timestep_of_record -filePath $filename_with_acc_history -factor $scale_record_by_this_amount
set accelSeries "Series -dt $dt -filePath $GMfile -factor [expr $Scalefact*$g]"; puts "a"

# create load pattern: apply acceleration to all fixed nodes with UniformExcitation
# command: pattern UniformExcitation $patternID $GMdir -accel $timeSeriesID
pattern UniformExcitation $patternID $GMdirection -accel $accelSeries;



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

# create the analysis
# clear previously-define analysis parameters
constraints Transformation; # how it handles boundary conditions
numberer RCM; # renumber dof's to minimize band-width (optimization), if you want to
system UmfPack; # how to store and solve the system of equations in the analysis (large model: try UmfPack)
test EnergyIncr 1.0e-10 100; # test Eneregy incerment
algorithm KrylovNewton; # use Kyrlow-Newton algorithm
integrator Newmark 0.5 0.25 ; # determine the next time step for an analysis
analysis Transient; # define type of analysis: time-dependent
analyze [expr 6000] 0.01;

puts "Done!"
wipe

mhscott
Posts: 872
Joined: Tue Jul 06, 2004 3:38 pm
Location: Corvallis, Oregon USA
Contact:

Re: effect of chevron braced viscous dampers with self centering element

Post by mhscott » Thu Feb 16, 2023 6:59 am

Simplify your model and track down the issue. Start small and build up. No one can run this script as there's so many dependencies to other files.

ritishreddy
Posts: 4
Joined: Fri Apr 01, 2022 1:28 pm

Re: effect of chevron braced viscous dampers with self centering element

Post by ritishreddy » Thu Feb 16, 2023 8:03 am

Hello sir, thanks for the advice. I will simplify the model and see what is the issue

ritishreddy
Posts: 4
Joined: Fri Apr 01, 2022 1:28 pm

Re: effect of chevron braced viscous dampers with self centering element

Post by ritishreddy » Sun Feb 19, 2023 4:43 pm

Hello sir, I scaled down the model to troubleshoot but could not find a solution, please help. Here, i provide the code for 1 bay , 1 storey frame with finite length uniaxial self centering element and a zero length viscous damper in parallel. I get same displacement values for different properties of viscous damper and self centering material.

# Analysis of steel moment resisting frame in N/S direction
# SET UP
wipe; # clear memory of all past model definitions
model BasicBuilder -ndm 2 -ndf 3; # Define the model builder, ndm=#dimension, ndf=#dofs
source LibUnits.tcl; # define units
source DisplayPlane.tcl; # procedure for displaying a plane in model

set ViewScale 0.25; # scaling factor for viewing deformed shape, it depends on the dimensions of the model

# define GEOMETRY -------------------------------------------------------------
# define structure-geometry parameters
set LCol1 [expr 180*$in]; # column height @ 1 floor
set LBeam [expr 30*$in]; # beam length
set Loffsetd [ expr 5*$in ] ; # distance of damper from left hand node and right hand node
set Ldamp [ expr 10*$in ] ; # length of each damper
set Hs [ exp 8.0*$in ] ; # height offset of lower nodes of each damper of self centering material
set Hd [ exp 4.0*$in ] ; # height offset of zero length nodes of each damper


# calculate locations of beam/column/girder intersections:
set X1 0.;
set X2 [expr $X1 + $LBeam];

set Y1 0.;
set Y2 [expr $Y1 + $LCol1];



# define nodal coordinates
# tag X Y
node 1001 0 0 ;
node 1002 $X2 0 ;

#Beam nodes
node 2001 0 $Y2 ;
node 2002 [ expr 0 + $Loffsetd ] $Y2 ;
node 2003 [ expr 0 + $Loffsetd + (1.0*$Ldamp) ] $Y2 ;
node 2004 [ expr 0 + $Loffsetd + (2.0*$Ldamp) ] $Y2 ;

#Self centering element nodes
node 2005 [ expr 0 + $Loffsetd ] [ expr $Y2 -$Hs ] ;
node 2006 [ expr 0 + $Loffsetd + (1.0*$Ldamp) ] [ expr $Y2 -$Hs ] ;
node 2007 [ expr 0 + $Loffsetd + (2.0*$Ldamp) ] [ expr $Y2 -$Hs ] ;
#Dameper nodes
node 2008 [ expr 0 + $Loffsetd + (0.5*$Ldamp) ] [ expr $Y2 -$Hd ] ;
node 2009 [ expr 0 + $Loffsetd + (0.5*$Ldamp) ] [ expr $Y2 -$Hd ] ;
node 2010 [ expr 0 + $Loffsetd + (1.5*$Ldamp) ] [ expr $Y2 -$Hd ] ;
node 2011 [ expr 0 + $Loffsetd + (1.5*$Ldamp) ] [ expr $Y2 -$Hd ] ;

# End node of the beam
node 2012 $X2 $Y2 ;







Single point constraints -- Boundary Conditions
fix 1001 1 1 1 ;
fix 1002 1 1 1 ;

# restrictions for nodes related to self centering elements and dampers
fix 2005 0 1 1 ;
fix 2006 0 1 1 ;
fix 2007 0 1 1 ;
fix 2008 0 1 1 ;
fix 2009 0 1 1 ;
fix 2010 0 1 1 ;
fix 2011 0 1 1 ;





# constrain beam-column joints in a floor to have the same displacement in y and z directions using the equal dof command
# Floor level 2
equalDOF 2001 2012 2 3 ;


#constrain nodes of self centering elements and nodes of the beam to have the same displacement in x directions using the equal dof command
# Floor level 2

equalDOF 2002 2005 1 ;
equalDOF 2003 2006 1 ;
equalDOF 2004 2007 1 ;

# Constrain damper nodes havong zero length elements to have same displacements in all directions
equalDOF 2008 2009 1 2 3 ;
equalDOF 2010 2011 1 2 3 ;

# Assign masses to the nodes in x-direction

# input parameters to calculate unit mass of each floor
set g [ expr 386.0*$in/($sec*$sec) ] ; # value of accelaration due to gravity in in/sec2
set massfloor2 [ expr 1.248*1000000*$kg ] ; # mass of floor 2
set Negligible 1e-9; # a very small number to avoid problems with zero

# floor 2
set m2 [ expr $massfloor2/5 ] ; # mass assigned to each node of plane frame of floor 2

# Assign mass to the nodes of plane frame structure
# floor 2
mass 2001 $m2 $Negligible $Negligible ;
mass 2012 $m2 $Negligible $Negligible ;

# Define Section Properties and Elements
# For floor level 2 and 3 ( elevation ) ( For N/S Frames )
# define material properties
set Es [ expr 29000.0*$ksi ] ; # steel Young's modulus
set Fy [ expr 54.3892*$ksi ] ; # Yield strength of steel used in this model
# define column section W21x201
set Acol_12 [ expr 59.3*$in2 ] ; # cross-sectional area
set Icol_12 [ expr 5310.0*$in4 ] ; # moment of inertia
# define beam section W27x94
set Abeam_23 [ expr 27.6*$in2 ] ; # cross-sectional area (full section properties)
set Ibeam_23 [ expr 3270*$in4 ] ; # moment of inertia (full section properties)




set Lineartransform 2
geomTransf Linear $Lineartransform ; # Linear transformation


# define elastic column elements using "element" command
# command: element elasticBeamColumn $eleID $iNode $jNode $A $E $I $transfID
# eleID convention: "1xy" where 1 = col, x = Pier #, y = Story #
# Columns Story 1
element elasticBeamColumn 1 1001 2001 $Acol_12 $Es $Icol_12 $Lineartransform; # Pier 1
element elasticBeamColumn 2 1002 2012 $Acol_12 $Es $Icol_12 $Lineartransform;


# define elastic beam elements
# Normal beam elements
# eleID convention: "2xy" where 2 = beam, x = Bay #, y = Floor #
# floor 2 beam 1 ( elements )
#Normal elements
element elasticBeamColumn 3 2001 2002 $Abeam_23 $Es $Ibeam_23 $Lineartransform;
element elasticBeamColumn 4 2002 2003 $Abeam_23 $Es $Ibeam_23 $Lineartransform;
element elasticBeamColumn 5 2003 2004 $Abeam_23 $Es $Ibeam_23 $Lineartransform;
element elasticBeamColumn 6 2004 2012 $Abeam_23 $Es $Ibeam_23 $Lineartransform;



# Define SMA Alloy ( which is a part of superelastic viscous damper as a self recentering material )
# define input paramters
set k1 [ expr 2.92*$KN/$mm ] ; # initial stiffness
set k2 [ expr 0.99*$KN/$mm] ; # post activation stiffness
set fa [ expr 53.1*$KN ] ; # forward activation force
set b 1 ; # ratio of forward to reverse activation stress
uniaxialMaterial SelfCentering 1 $k1 $k2 $fa $b

# Define viscous damper material
# Input parameters for viscous damper material
set k [ expr 14.3*$KN/$mm ] ; # elastic stiffness of damper
set Cd [ expr 8*$KN*$sec/$mm ] ; # viscous damping coefficient
set ad 0.8 ; # non linear exponent coefficient

uniaxialMaterial ViscousDamper 2 $k $Cd $ad

# Provide rigid elements for chevron braces with high moment of inertia
set A1 [ expr 1000*$in*$in ] ; # area for other connecting column type connections
set I1 [ expr 1.0e6*$in4 ] ; # Moment of inertia for other connecting column type connections

# Beams connecting column bottom nodes and main supporting node for dampers( Bay 1 )
element elasticBeamColumn 7 1001 2006 $A1 $Es $I1 $Lineartransform -releasez 3 ;
element elasticBeamColumn 8 1002 2006 $A1 $Es $I1 $Lineartransform -releasez 3 ;



# Two node links connecting as self centering elements
# Bay1
element twoNodeLink 9 2005 2006 -mat 1 -dir 1 ; puts "a"
element twoNodeLink 10 2006 2007 -mat 1 -dir 1 ; puts "a"





# Rigid elements vertically connecting the beam nodes to self centering nodes


element elasticBeamColumn 11 2002 2005 $A1 $Es $I1 $Lineartransform ;
element elasticBeamColumn 12 2003 2006 $A1 $Es $I1 $Lineartransform ;
element elasticBeamColumn 13 2004 2007 $A1 $Es $I1 $Lineartransform ;

#Zero length elements for damper nodes
element zeroLength 14 2008 2009 -mat 2 -dir 1
element zeroLength 15 2010 2011 -mat 2 -dir 1


# Rigid elements connecting the damper nodes to self centering nodes

#( Bay 1 )
element elasticBeamColumn 16 2008 2005 $A1 $Es $I1 $Lineartransform ;
element elasticBeamColumn 17 2009 2006 $A1 $Es $I1 $Lineartransform ;
element elasticBeamColumn 18 2010 2006 $A1 $Es $I1 $Lineartransform ;
element elasticBeamColumn 19 2011 2007 $A1 $Es $I1 $Lineartransform ;




source LibAnalysisDynamicParameters.tcl ;
# Source in TCL proc to read PEER SMD record
source ReadSMDFile.tcl ;
# Permform the conversion from SMD record to OpenSees record
# inFile outFile dt
ReadSMDFile RSN4_IMPVALL.BG_B-ELC000.AT2 groundmotionlow.txt 0.01 ; # values from earthquake file ( Elcentro) will go to output file (groundmotionlow.txt)


recorder Node -file nodedisplacement.txt -timeSeries 1 -time -node 2001 2012 -dof 1 disp ;
recorder Element -file damperforce.txt -time -ele 9 10 localForce ;
# set damping based on first eigen mode
set lambadI [ expr [ eigen 1 ] ] ;
set freq [expr pow($lambadI,0.5) ] ;
set period [expr (2*3.14)/$freq]
puts $period
set damp 0.02;
rayleigh [expr 2*$damp*$freq] 0. 0. 0.

# define ground motion parameters
set patternID 3; # load pattern ID
set GMdirection 1; # ground motion direction (1 = x)
set GMfile "groundmotionlow.txt"; # ground motion filename
set dt 0.01; # timestep of input GM file
set Scalefact 1.0; # ground motion scaling factor

# define the acceleration series for the ground motion
# syntax: "Series -dt $timestep_of_record -filePath $filename_with_acc_history -factor $scale_record_by_this_amount
set accelSeries "Series -dt $dt -filePath $GMfile -factor [expr $Scalefact*$g]"; puts "a"

# create load pattern: apply acceleration to all fixed nodes with UniformExcitation
# command: pattern UniformExcitation $patternID $GMdir -accel $timeSeriesID
pattern UniformExcitation $patternID $GMdirection -accel $accelSeries;



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

# create the analysis
# clear previously-define analysis parameters
constraints Transformation; # how it handles boundary conditions
numberer RCM; # renumber dof's to minimize band-width (optimization), if you want to
system UmfPack; # how to store and solve the system of equations in the analysis (large model: try UmfPack)
test EnergyIncr 1.0e-10 100; # test Eneregy incerment
algorithm KrylovNewton; # use Kyrlow-Newton algorithm
integrator Newmark 0.5 0.25 ; # determine the next time step for an analysis
analysis Transient; # define type of analysis: time-dependent
analyze [expr 6000] 0.01;

Post Reply