Edit an OpenSEES file from MATLAB and Change of variables from MATLAB

17 visualizaciones (últimos 30 días)
I have a parametric analysis to run on OpenSEES. I wonder if there is a way to do following pseudo code
  • Set a variable in MATLAB
  • Open a .tcl file
  • Set specified variable in MATLAb to a specific variable in .tcl file.
  • Run the file from MATLAB
  • Analyze results in MATLAB, save specific values in MATLAB
  • Delete results for .tcl process
  • Repeat the same process from beginning by changing variable value.
Any suggestion or example is very much appreciated.

Respuestas (4)

Abhishek Singh
Abhishek Singh el 15 de Abr. de 2019
There is a simple line of command to run OpenSees through Matlab:
! opensees.exe *******.tcl
where it is just needed to put your tcl file name beside of *******.
You just have to :
1- Create a folder, put your M file, tcl file and a copy of opensees.exe in it.
2-write that line of command in your M file. just remember to use the exact name of exe file for the first part and the exact name of tcl file for the second part of this command.
3-Define the path of created folder in "Set Path" part of Matlab.
If you needed to put or remove a text from tcl file using matlab, take a look at "dlmwrite" command in matlab help.

hikmet tutar
hikmet tutar el 6 de En. de 2021
%%Enter programs
clear all;clc;tic;
AISC_Manual
A=[251 %W8X67 %C(2n + 1) 1:5 1
254 %W8X40 %C(2n) 1:5 2
242 %W10X39 %C(2n ? 1) 1:5 3
257 %W8X28 %Br(n) 1:5 4
255 %W8X35 %B(2n + 1) 1:5 5
264 %W6X25 %B(2n) 1:5 6
128 %W21X62 %C(2n + 1) 5:10 7
242 %W10X39 %C(2n) 5:10 8
226 %W12X35 %C(2n ? 1) 5:10 9
202 %W14X26 %Br(n) 5:10 10
243 %W10X33 %B(2n + 1) 5:10 11
264 %W6X25 %B(2n) 5:10 12
256 %W8X31 %C(2n + 1) 10:15 13
226 %W12X35 %C(2n) 10:15 14
166 %W16X31 %C(2n ? 1) 10:15 15
247 %W10X19 %Br(n) 10:15 16
247 %W10X19 %B(2n + 1) 10:15 17
264 %W6X25 %B(2n) 10:15 18
167 %W16X26 %C(2n + 1) 15:20 19
200 %W14X34 %C(2n) 15:20 20
166 %W16X31 %C(2n ? 1) 15:20 21
247 %W10X19 %Br(n) 15:20 22
228 %W10X26 %B(2n + 1) 15:20 23
229 %W10X22 %B(2n) 15:20 24
247 %W10X19 %C(2n + 1) 20:25 25
244 %W10X30 %C(2n) 20:25 26
271 %W5X19 %C(2n ? 1) 20:25 27
247 %W10X19 %Br(n) 20:25 28
247 %W10X19 %B(2n + 1) 20:25 29
271 %W5X19 %B(2n) 20:25 30
230]; %W12X19 %Outrigger 31
% Outrig. leRvel 17
% A=AA(:,1);
ft=fopen('frame_25story.txt','wt');
fprintf(ft,' wipe; \n');
fprintf(ft,' model BasicBuilder -ndm 3 -ndf 6; \n');
fprintf(ft,' set dataDir Data; \n');
fprintf(ft,' file mkdir $dataDir; \n');
fprintf(ft,' set GMdir "../GMfiles"; \n');
fprintf(ft,' source LibUnits.tcl; \n');
fprintf(ft,' source DisplayPlane.tcl; \n');
fprintf(ft,' source DisplayModel3D.tcl; \n');
fprintf(ft,' source Wsection.tcl; \n');
%%
% % Input DATA
NStory=5;
NBay=6;
NBayZ=6;
NFrame=NBayZ+1;
%%
fprintf(ft,' \n');
fprintf(ft,' # define GEOMETRY -------------------------------------------------------------\n');
LCol=340/2.54;
LBeam=500/2.54;
LGird=500/2.54;
LBrace=((340/2.54)^2+(500/2.54)^2)^0.5;
fprintf(ft,' \n');
% %%
Dlevel=10000;
Dframe=100;
for frame=1:NFrame
Z=(frame-1)*LGird;
for level=1:NStory+1
Y=(level-1)*LCol;
for pier=1:NBay+1
X=(pier-1)*LBeam;
nodeID=frame*Dframe+level*Dlevel+pier;
fprintf(ft,'node %d %d %d %d;\n',nodeID,X,Y,Z);
end
end
end
% % % fprintf(ft,' # define NODAL COORDINATES\n');
fprintf(ft,' set Dlevel 10000; \n');
fprintf(ft,' set Dframe 100; \n');
%%
fprintf(ft,' # rigid diaphragm nodes\n');
fprintf(ft,' set RigidDiaphragm ON ; # options: ON, OFF. specify this before the analysis parameters are set the constraints are handled differently.\n');
Xa=(NBay*LBeam)/2;
Za=(NFrame-1)*LGird/2;
fprintf(ft,' set iMasterNode ""\n');
for level=2:NStory+1
Y= (level-1)*LCol;
MasterNodeID= 9900+level;
fprintf(ft,' node %d %d %d %d ;\n',MasterNodeID,Xa,Y,Za);
fprintf(ft,' fix %d 0 1 0 1 0 1;\n',MasterNodeID);
fprintf(ft,' lappend iMasterNode %d\n',MasterNodeID);
fprintf(ft,' set perpDirn 2; \n');
for frame=1:NFrame
for pier=1:NBay+1
nodeID=frame*Dframe+level*Dlevel+pier;
fprintf(ft,'rigidDiaphragm $perpDirn %d %d; \n',MasterNodeID,nodeID);
end;end;end
%%
fprintf(ft,' set iSupportNode ""\n');
for frame=1:NFrame;
level=1;
for pier=1:NBay+1;
nodeID= level*Dlevel+frame*Dframe+pier;
fprintf(ft,' lappend iSupportNode %d\n',nodeID);
end;end
%%
fprintf(ft,' # BOUNDARY CONDITIONS\n');
fprintf(ft,' fixY 0.0 1 1 1 0 1 0; \n');
fprintf(ft,' \n');
%%
IDctrlNode=(((NStory+1)*Dlevel+NFrame*Dframe)+1);
fprintf(ft,' set IDctrlDOF 1;\n');
LBuilding=NStory*LCol;
fprintf(ft,' \n');
%%
fprintf(ft,' # Define SECTIONS -------------------------------------------------------------\n');
fprintf(ft,' set SectionType FiberSection ; \n');
fprintf(ft,' \n');
fprintf(ft,' # define section tags:\n');
fprintf(ft,' set ColSecTag 1\n');
fprintf(ft,' set BeamSecTag 2\n');
fprintf(ft,' set GirdSecTag 3\n');
fprintf(ft,' set ColSecTagFiber 4\n');
fprintf(ft,' set BeamSecTagFiber 5\n');
fprintf(ft,' set GirdSecTagFiber 6\n');
fprintf(ft,' set SecTagTorsion 70\n');
fprintf(ft,' \n');
%%
fprintf(ft,' if {$SectionType == "Elastic"} {\n');
fprintf(ft,' # material properties:\n');
fprintf(ft,' set Es [expr 29000*$ksi]; \n');
fprintf(ft,' set nu 0.3; \n');
fprintf(ft,' set Gs [expr $Es/2./[expr 1+$nu]]; \n');
fprintf(ft,' set J $Ubig; \n');
%%
fprintf(ft,' section Elastic $ColSecTag $Es %d %d %d $Gs $J\n',AISC_Manu(A(1),2),AISC_Manu(A(1),7),AISC_Manu(A(1),10));
fprintf(ft,' section Elastic $BeamSecTag $Es $AgBeam $IzBeam $IyBeam $Gs $J\n',AISC_Manu(A(2),2),AISC_Manu(A(2),7),AISC_Manu(A(3),10));
fprintf(ft,' section Elastic $GirdSecTag $Es $AgGird $IzGird $IyGird $Gs $J\n',AISC_Manu(A(3),2),AISC_Manu(A(2),7),AISC_Manu(A(3),10));
fprintf(ft,' \n');
fprintf(ft,' set matIDhard 1; # material numbers for recorder (this stressstrain recorder will be blank, as this is an elastic section)\n');
fprintf(ft,' \n');
%%
fprintf(ft,' } elseif {$SectionType == "FiberSection"} {\n');
fprintf(ft,' # define MATERIAL properties \n');
fprintf(ft,' set Fy [expr 60.0*$ksi]\n');
fprintf(ft,' set Es [expr 29000*$ksi]; \n');
fprintf(ft,' set nu 0.3;\n');
fprintf(ft,' set Gs [expr $Es/2./[expr 1+$nu]]; # Torsional stiffness Modulus\n');
fprintf(ft,' set Hiso 0\n');
fprintf(ft,' set Hkin 1000\n');
fprintf(ft,' set matIDhard 1\n');
fprintf(ft,' uniaxialMaterial Hardening $matIDhard $Es $Fy $Hiso $Hkin\n');
fprintf(ft,' \n');
%%
fprintf(ft,' # ELEMENT properties\n');
fprintf(ft,' # column sections: W27x114 \n');
fprintf(ft,' set d [expr 27.29*$in]; # depth \n');
fprintf(ft,' set bf [expr 10.07*$in]; # flange width \n');
fprintf(ft,' set tf [expr 0.93*$in]; # flange thickness \n');
fprintf(ft,' set tw [expr 0.57*$in]; # web thickness \n');
fprintf(ft,' set nfdw 16; # number of fibers along dw \n');
fprintf(ft,' set nftw 2; # number of fibers along tw \n');
fprintf(ft,' set nfbf 16; # number of fibers along bf \n');
fprintf(ft,' set nftf 4; # number of fibers along tf \n');
fprintf(ft,' Wsection $ColSecTagFiber $matIDhard %d %d %d %d $nfdw $nftw $nfbf $nftf \n',AISC_Manu(A(1),3),AISC_Manu(A(1),4),AISC_Manu(A(1),5),AISC_Manu(A(1),6));
%%
fprintf(ft,' # beam sections: W24x94 \n');
fprintf(ft,' set d [expr 24.31*$in]; # depth \n');
fprintf(ft,' set bf [expr 9.065*$in]; # flange width \n');
fprintf(ft,' set tf [expr 0.875*$in]; # flange thickness \n');
fprintf(ft,' set tw [expr 0.515*$in]; # web thickness \n');
fprintf(ft,' Wsection $BeamSecTagFiber $matIDhard %d %d %d %d $nfdw $nftw $nfbf $nftf \n',AISC_Manu(A(2),3),AISC_Manu(A(2),4),AISC_Manu(A(2),5),AISC_Manu(A(2),6));
%%
fprintf(ft,' # girder sections: W24x94 \n');
fprintf(ft,' set d [expr 24.31*$in]; # depth \n');
fprintf(ft,' set bf [expr 9.065*$in]; # flange width \n');
fprintf(ft,' set tf [expr 0.875*$in]; # flange thickness \n');
fprintf(ft,' set tw [expr 0.515*$in]; # web thickness \n');
fprintf(ft,' Wsection $GirdSecTagFiber $matIDhard %d %d %d %d $nfdw $nftw $nfbf $nftf \n',AISC_Manu(A(3),3),AISC_Manu(A(3),4),AISC_Manu(A(3),5),AISC_Manu(A(3),6));
fprintf(ft,' \n');
%%
fprintf(ft,' # assign torsional Stiffness for 3D Model \n');
fprintf(ft,' uniaxialMaterial Elastic $SecTagTorsion $Ubig \n');
fprintf(ft,' section Aggregator $ColSecTag $SecTagTorsion T -section $ColSecTagFiber \n');
fprintf(ft,' section Aggregator $BeamSecTag $SecTagTorsion T -section $BeamSecTagFiber \n');
fprintf(ft,' section Aggregator $GirdSecTag $SecTagTorsion T -section $GirdSecTagFiber \n');
fprintf(ft,' } else { \n');
fprintf(ft,' puts "No section has been defined" \n');
fprintf(ft,' return -1 \n');
fprintf(ft,' } \n');
fprintf(ft,' \n');
fprintf(ft,' set QdlCol [expr 114*$lbf/$ft]; # W-section weight per length \n');
fprintf(ft,' set QBeam [expr 94*$lbf/$ft]; # W-section weight per length \n');
fprintf(ft,' set QGird [expr 94*$lbf/$ft]; # W-section weight per length \n');
fprintf(ft,' \n');
fprintf(ft,' set IDColTransf 1; \n');
fprintf(ft,' set IDBeamTransf 2; \n');
fprintf(ft,' set IDGirdTransf 3; \n');
fprintf(ft,' set ColTransfType Linear ; # options for columns: Linear PDelta Corotational \n');
fprintf(ft,' geomTransf $ColTransfType $IDColTransf 0 0 1; # orientation of column stiffness affects bidirectional response. \n');
fprintf(ft,' geomTransf Linear $IDBeamTransf 0 0 1 \n');
fprintf(ft,' geomTransf Linear $IDGirdTransf 1 0 0 \n');
fprintf(ft,' \n');
%%
fprintf(ft,' # Define Beam-Column Elements \n');
fprintf(ft,' set numIntgrPts 5; # number of Gauss integration points for nonlinear curvature distribution \n');
fprintf(ft,' # columns \n');
N0col=100000-1;
fprintf(ft,'set N0col %d \n',N0col);
level=0;
for frame=1:NFrame
for level=1:NStory
for pier=1:NBay+1
elemID=N0col +level*Dlevel + frame*Dframe+pier;
nodeI=level*Dlevel + frame*Dframe+pier;
nodeJ=(level+1)*Dlevel + frame*Dframe+pier;
fprintf(ft,' element nonlinearBeamColumn %d %d %d $numIntgrPts $ColSecTag $IDColTransf;\n',elemID, nodeI, nodeJ );
end
end
end
%%
fprintf(ft,' # beams -- parallel to X-axis \n');
N0beam=1000000;
fprintf(ft,' set N0beam %d \n',N0beam);
for frame=1:NFrame
for level= 2:NStory+1
for bay =1:NBay
elemID=N0beam +level*Dlevel + frame*Dframe+ bay;
nodeI=level*Dlevel + frame*Dframe+ bay;
nodeJ=level*Dlevel + frame*Dframe+ bay+1;
fprintf(ft,' element nonlinearBeamColumn %d %d %d $numIntgrPts $BeamSecTag $IDBeamTransf; # beams \n',elemID, nodeI, nodeJ );
end
end
end
%%
N0gird=2000000;
fprintf(ft,' set N0gird %d \n',N0gird);
for frame=1:NFrame-1
for level= 2:NStory+1
for bay =1:NBay+1
elemID=N0gird +level*Dlevel + frame*Dframe+ bay;
nodeI=level*Dlevel + frame*Dframe+ bay;
nodeJ=level*Dlevel + (frame+1)*Dframe+ bay;
fprintf(ft,' element nonlinearBeamColumn %d %d %d $numIntgrPts $GirdSecTag $IDGirdTransf; \n',elemID, nodeI, nodeJ );
end
end
end
%%
fprintf(ft,' set NStory %d; \n',NStory);%Number of Stories in Y: $NStory
fprintf(ft,' set NBay %d ; \n',NBay);%Number of bays in X: $NBay
fprintf(ft,' set NBayZ %d; \n',NBayZ);%Number of bays in Z: $NBayZ
fprintf(ft,' set NFrame %d; \n',NBayZ+1);
fprintf(ft,' set LCol %d;\n',LCol);
fprintf(ft,' set LBeam %d;\n',LBeam);
fprintf(ft,' set LGird %d;\n',LGird);
fprintf(ft,' set LBrace %d;\n',LBrace);
fprintf(ft,' # ---------------------------------------------------------------------------------------------\n');
fprintf(ft,' # Define GRAVITY LOADS, weight and masses\n');
fprintf(ft,' # calculate dead load of frame, assume this to be an internal frame (do LL in a similar manner)\n');
fprintf(ft,' # calculate distributed weight along the beam length\n');
fprintf(ft,' set GammaConcrete [expr 150*$pcf]; # Reinforced-Concrete floor slabs\n');
fprintf(ft,' set Tslab [expr 6*$in]; # 6-inch slab\n');
fprintf(ft,' set Lslab [expr 2*$LGird/2]; # slab extends a distance of $LGird/2 in/out of plane\n');
fprintf(ft,' set DLfactor 2.0; # scale dead load up a little\n');
fprintf(ft,' set Qslab [expr $GammaConcrete*$Tslab*$Lslab*$DLfactor]; \n');
fprintf(ft,' set QdlBeam [expr $Qslab + $QBeam]; # dead load distributed along beam (one-way slab)\n');
fprintf(ft,' set QdlGird $QGird; # dead load distributed along girder\n');
fprintf(ft,' set WeightCol [expr $QdlCol*$LCol]; # total Column weight\n');
fprintf(ft,' set WeightBeam [expr $QdlBeam*$LBeam]; # total Beam weight\n');
fprintf(ft,' set WeightGird [expr $QdlGird*$LGird]; # total Beam weight\n');
fprintf(ft,' \n');
fprintf(ft,' # assign masses to the nodes that the columns are connected to \n');
fprintf(ft,' # each connection takes the mass of 1/2 of each element framing into it (mass=weight/$g)\n');
fprintf(ft,' set iFloorWeight ""\n');
fprintf(ft,' set WeightTotal 0.0\n');
fprintf(ft,' set sumWiHi 0.0; # sum of storey weight times height, for lateral-load distribution\n');
fprintf(ft,' \n');
fprintf(ft,' for {set frame 1} {$frame <=[expr $NFrame]} {incr frame 1} {\n');
fprintf(ft,' if {$frame == 1 || $frame == $NFrame} {\n');
fprintf(ft,' set GirdWeightFact 1; # 1x1/2girder on exterior frames\n');
fprintf(ft,' } else {\n');
fprintf(ft,' set GirdWeightFact 2; # 2x1/2girder on interior frames\n');
fprintf(ft,' }\n');
fprintf(ft,' for {set level 2} {$level <=[expr $NStory+1]} {incr level 1} { ; \n');
fprintf(ft,' set FloorWeight 0.0\n');
fprintf(ft,' if {$level == [expr $NStory+1]} {\n');
fprintf(ft,' set ColWeightFact 1; # one column in top story\n');
fprintf(ft,' } else {\n');
fprintf(ft,' set ColWeightFact 2; # two columns elsewhere\n');
fprintf(ft,' }\n');
fprintf(ft,' for {set pier 1} {$pier <= [expr $NBay+1]} {incr pier 1} {;\n');
fprintf(ft,' if {$pier == 1 || $pier == [expr $NBay+1]} {\n');
fprintf(ft,' set BeamWeightFact 1; # one beam at exterior nodes\n');
fprintf(ft,' } else {;\n');
fprintf(ft,' set BeamWeightFact 2; # two beams elewhere\n');
fprintf(ft,' }\n');
fprintf(ft,' set WeightNode [expr $ColWeightFact*$WeightCol/2 + $BeamWeightFact*$WeightBeam/2 + $GirdWeightFact*$WeightGird/2]\n');
fprintf(ft,' set MassNode [expr $WeightNode/$g];\n');
fprintf(ft,' set nodeID [expr $level*$Dlevel+$frame*$Dframe+$pier]\n');
fprintf(ft,' mass $nodeID $MassNode 0. $MassNode 0. 0. 0.; # define mass\n');
fprintf(ft,' set FloorWeight [expr $FloorWeight+$WeightNode];\n');
fprintf(ft,' }\n');
fprintf(ft,' lappend iFloorWeight $FloorWeight\n');
fprintf(ft,' set WeightTotal [expr $WeightTotal+ $FloorWeight]\n');
fprintf(ft,' set sumWiHi [expr $sumWiHi+$FloorWeight*($level-1)*$LCol]; \n');
fprintf(ft,' }\n');
fprintf(ft,' }\n');
fprintf(ft,' set MassTotal [expr $WeightTotal/$g]; # total mass\n');
fprintf(ft,' \n');
%%
fprintf(ft,' # LATERAL-LOAD distribution for static pushover analysis\n');
fprintf(ft,' # calculate distribution of lateral load based on mass/weight distributions along building height\n');
fprintf(ft,' # Fj = WjHj/sum(WiHi) * Weight at each floor j\n');
fprintf(ft,' set iFj ""\n');
fprintf(ft,' for {set level 2} {$level <=[expr $NStory+1]} {incr level 1} { ; \n');
fprintf(ft,' set FloorWeight [lindex $iFloorWeight [expr $level-1-1]];\n');
fprintf(ft,' set FloorHeight [expr ($level-1)*$LCol];\n');
fprintf(ft,' lappend iFj [expr $FloorWeight*$FloorHeight/$sumWiHi*$WeightTotal]; # per floor\n');
fprintf(ft,' }\n');
fprintf(ft,' set iNodePush $iMasterNode; # nodes for pushover/cyclic, vectorized\n');
fprintf(ft,' set iFPush $iFj; # lateral load for pushover, vectorized\n');
fprintf(ft,' \n');
%%
fprintf(ft,' # Define RECORDERS -------------------------------------------------------------\n');
fprintf(ft,' set FreeNodeID [expr $NFrame*$Dframe+($NStory+1)*$Dlevel+($NBay+1)]; # ID: free node\n');
fprintf(ft,' set SupportNodeFirst [lindex $iSupportNode 0]; # ID: first support node\n');
fprintf(ft,' set SupportNodeLast [lindex $iSupportNode [expr [llength $iSupportNode]-1]]; # ID: last support node\n');
fprintf(ft,' set FirstColumn [expr $N0col + 1*$Dframe+1*$Dlevel +1]; # ID: first column\n');
fprintf(ft,' recorder Node -file $dataDir/DFree.out -time -node $FreeNodeID -dof 1 2 3 disp; \n');
fprintf(ft,' recorder Node -file $dataDir/DBase.out -time -nodeRange $SupportNodeFirst $SupportNodeLast -dof 1 2 3 disp; \n');
fprintf(ft,' recorder Node -file $dataDir/RBase.out -time -nodeRange $SupportNodeFirst $SupportNodeLast -dof 1 2 3 reaction; \n');
fprintf(ft,' recorder Drift -file $dataDir/DrNode.out -time -iNode $SupportNodeFirst -jNode $FreeNodeID -dof 1 -perpDirn 2; \n');
fprintf(ft,' recorder Element -file $dataDir/Fel1.out -time -ele $FirstColumn localForce; \n');
fprintf(ft,' recorder Element -file $dataDir/ForceEle1sec1.out -time -ele $FirstColumn section 1 force; \n');
fprintf(ft,' recorder Element -file $dataDir/DefoEle1sec1.out -time -ele $FirstColumn section 1 deformation; \n');
fprintf(ft,' recorder Element -file $dataDir/ForceEle1sec$numIntgrPts.out -time -ele $FirstColumn section $numIntgrPts force; \n');
fprintf(ft,' recorder Element -file $dataDir/DefoEle1sec$numIntgrPts.out -time -ele $FirstColumn section $numIntgrPts deformation; \n');
fprintf(ft,' set yFiber [expr 0.]; \n');
fprintf(ft,' set zFiber [expr 0.]; \n');
fprintf(ft,' recorder Element -file $dataDir/SSEle1sec1.out -time -ele $FirstColumn section $numIntgrPts fiber $yFiber $zFiber stressStrain; \n');
fprintf(ft,' \n');
%%
fprintf(ft,' # Define DISPLAY -------------------------------------------------------------\n');
fprintf(ft,' DisplayModel3D DeformedShape ; # options: DeformedShape NodeNumbers ModeShape\n');
fprintf(ft,' \n');
%%
fprintf(ft,' # GRAVITY -------------------------------------------------------------\n');
fprintf(ft,' pattern Plain 101 Linear {\n');
for frame =1:NFrame;
for level =1:NStory;
for pier =1: NBay+1;
elemID=N0col + level*Dlevel +frame*Dframe+pier;
fprintf(ft,' eleLoad -ele %d -type -beamUniform 0. 0. -$QdlCol; # COLUMNS \n',elemID);
end
end
end
for frame =1:NFrame
for level =2:NStory+1
for bay= 1:NBay
elemID=N0beam + level*Dlevel +frame*Dframe+ bay;
fprintf(ft,' eleLoad -ele %d -type -beamUniform -$QdlBeam 0.; # BEAMS\n',elemID);
end
end
end
for frame =1:NFrame-1
for level= 2:NStory+1
for bay= 1:NBay+1
elemID=N0gird + level*Dlevel +frame*Dframe+ bay;
fprintf(ft,' eleLoad -ele %d -type -beamUniform -$QdlGird 0.; # GIRDS\n',elemID);
end
end
end
fprintf(ft,' \n');
fprintf(ft,' }\n');
fprintf(ft,' # apply GRAVITY-- # apply gravity load, set it constant and reset time to zero, load pattern has already been defined\n');
fprintf(ft,' puts goGravity\n');
fprintf(ft,' # Gravity-analysis parameters -- load-controlled static analysis\n');
fprintf(ft,' set Tol 1.0e-8; # convergence tolerance for test\n');
fprintf(ft,' variable constraintsTypeGravity Plain; # default;\n');
fprintf(ft,' if { [info exists RigidDiaphragm] == 1} {\n');
fprintf(ft,' if {$RigidDiaphragm=="ON"} {\n');
fprintf(ft,' variable constraintsTypeGravity Lagrange; # large model: try Transformation\n');
fprintf(ft,' }; # if rigid diaphragm is on\n');
fprintf(ft,' }; # if rigid diaphragm exists\n');
fprintf(ft,' constraints $constraintsTypeGravity ; # how it handles boundary conditions\n');
fprintf(ft,' numberer RCM; \n');
fprintf(ft,' system BandGeneral ; # how to store and solve the system of equations in the analysis (large model: try UmfPack)\n');
fprintf(ft,' test EnergyIncr $Tol 6 ; \n');
fprintf(ft,' algorithm Newton; \n');
fprintf(ft,' set NstepGravity 10; \n');
fprintf(ft,' set DGravity [expr 1./$NstepGravity]; \n');
fprintf(ft,' integrator LoadControl $DGravity; \n');
fprintf(ft,' analysis Static; \n');
fprintf(ft,' analyze $NstepGravity; \n');
fprintf(ft,' # ------------------------------------------------- maintain constant gravity loads and reset time to zero\n');
fprintf(ft,' loadConst -time 0.0\n');
fprintf(ft,' \n');
fprintf(ft,' # -------------------------------------------------------------\n');
fprintf(ft,' puts "Model Built"\n');
% ----------------------------- Frame shape -------------------------------
fprintf(ft,'recorder display frame 700 50 700 700 -wipe \n');
fprintf(ft,'prp 40 0 50 \n');
fprintf(ft,'vup 0 0 1 \n');
fprintf(ft,'vpn 1 -5 2 \n');
fprintf(ft,'display 1 1 10 \n');
fclose(ft);
!opensees frame_25story.txt
toc

hikmet tutar
hikmet tutar el 6 de En. de 2021
2. examples
ft=fopen('Distributed.txt','wt');
fprintf(ft,' # --------------------------------------------------------------------------------------------------\n');
fprintf(ft,' # Example: 2-Story Moment Frame with Distributed Plasticity\n');
fprintf(ft,' # Centerline Model with Distributed Plastic Hinges starting at Beam-Column Joint\n');
fprintf(ft,' # Units: kips, inches, seconds\n');
%%
fprintf(ft,' ###################################################################################################\n');
fprintf(ft,' # Set Up & Source Definition \n');
fprintf(ft,' ###################################################################################################\n');
fprintf(ft,' wipe all; # clear memory of past model definitions\n');
fprintf(ft,' model BasicBuilder -ndm 2 -ndf 3; # Define the model builder, ndm = #dimension, ndf = #dofs\n');
fprintf(ft,' source DisplayModel2D.tcl; # procedure for displaying a 2D perspective of model\n');
fprintf(ft,' source DisplayPlane.tcl; # procedure for displaying a plane in the model\n');
fprintf(ft,' source rotSect2DModIKModel.tcl; # procedure for defining bilinear plastic hinge section\n');
fprintf(ft,' source rotLeaningCol.tcl; # procedure for defining a rotational spring (zero-length element) with very small stiffness\n');
fprintf(ft,' \n');
%%
fprintf(ft,' ###################################################################################################\n');
fprintf(ft,' # Define Analysis Type \n');
fprintf(ft,' ###################################################################################################\n');
fprintf(ft,' # Define type of analysis: "pushover" = pushover\n');
fprintf(ft,' set analysisType "pushover";\n');
fprintf(ft,' if {$analysisType == "pushover"} {\n');
fprintf(ft,' set dataDir Distributed-Pushover-Output; # name of output folder\n');
fprintf(ft,' file mkdir $dataDir; # create output folder\n');
fprintf(ft,' }\n');
fprintf(ft,' \n');
%%
fprintf(ft,' ###################################################################################################\n');
fprintf(ft,' # Define Building Geometry, Nodes, and Constraints \n');
fprintf(ft,' ###################################################################################################\n');
fprintf(ft,' # define structure-geometry parameters\n');
fprintf(ft,' set NStories 3; # number of stories\n');
fprintf(ft,' set NBays 4; # number of frame bays (excludes bay for P-delta column)\n');
fprintf(ft,' set WBay [expr 30.0*12.0]; # bay width in inches\n');
fprintf(ft,' set HStory1 [expr 13.0*12.0]; # 1st story height in inches\n');
fprintf(ft,' set HStoryTyp [expr 13.0*12.0]; # story height of other stories in inches\n');
fprintf(ft,' set HBuilding [expr $HStory1 + ($NStories-1)*$HStoryTyp]; # height of building\n');
fprintf(ft,' \n');
fprintf(ft,' # calculate locations of beam/column joints:\n');
fprintf(ft,' set Pier1 0.0; # leftmost column line\n');
fprintf(ft,' set Pier2 [expr $Pier1 + $WBay];\n');
fprintf(ft,' set Pier3 [expr $Pier2 + $WBay];\n');
fprintf(ft,' set Pier4 [expr $Pier3 + $WBay];\n');
fprintf(ft,' set Pier5 [expr $Pier4 + $WBay];\n');
fprintf(ft,' set Pier6 [expr $Pier5 + $WBay]; # P-delta column line \n');
fprintf(ft,' set Floor1 0.0; # ground floor\n');
fprintf(ft,' set Floor2 [expr $Floor1 + $HStory1];\n');
fprintf(ft,' set Floor3 [expr $Floor2 + $HStoryTyp];\n');
fprintf(ft,' set Floor4 [expr $Floor3 + $HStoryTyp];\n');
fprintf(ft,' \n');
fprintf(ft,' # calculate joint offset distance for beam plastic hinges\n');
fprintf(ft,' set phlat23 [expr 0.0]; # lateral dist from beam-col joint to loc of hinge on Floor 2\n');
fprintf(ft,' \n');
fprintf(ft,' # calculate nodal masses -- lump floor masses at frame nodes\n');
fprintf(ft,' set g 386.2; # acceleration due to gravity\n');
fprintf(ft,' set Floor2Weight 1054.0; # weight of Floor 2 in kips\n');
fprintf(ft,' set Floor3Weight 1054.0; # weight of Floor 3 in kips\n');
fprintf(ft,' set Floor4Weight 1140.0; # weight of Floor 4 in kips\n');
fprintf(ft,' set WBuilding [expr $Floor2Weight + $Floor3Weight+$Floor4Weight]; # total building weight\n');
fprintf(ft,' set NodalMass2 [expr ($Floor2Weight/$g) / (2.0*4.0)]; # mass at each node on Floor 2\n');
fprintf(ft,' set NodalMass22 [expr ($Floor3Weight/$g) / (1.0*4.0)]; # mass at each node on Floor 3\n');
fprintf(ft,' set NodalMass4 [expr ($Floor4Weight/$g) / (2.0*4.0)]; # mass at each node on Floor 3\n');
fprintf(ft,' set NodalMass44 [expr ($Floor4Weight/$g) / (1.0*4.0)]; # mass at each node on Floor 3\n');
fprintf(ft,' set Negligible 1e-9; # a very small number to avoid problems with zero\n');
fprintf(ft,' \n');
%%
fprintf(ft,' # define nodes and assign masses to beam-column intersections of frame\n');
fprintf(ft,' # command: node nodeID xcoord ycoord -mass mass_dof1 mass_dof2 mass_dof3\n');
fprintf(ft,' # nodeID convention: "xy" where x = Pier # and y = Floor # \n');
fprintf(ft,' node 11 $Pier1 $Floor1;\n');
fprintf(ft,' node 21 $Pier2 $Floor1;\n');
fprintf(ft,' node 31 $Pier3 $Floor1;\n');
fprintf(ft,' node 41 $Pier4 $Floor1;\n');
fprintf(ft,' node 51 $Pier5 $Floor1;\n');
fprintf(ft,' node 61 $Pier6 $Floor1;\n');
fprintf(ft,' \n');
fprintf(ft,' node 12 $Pier1 $Floor2 -mass $NodalMass2 $Negligible $Negligible;\n');
fprintf(ft,' node 22 $Pier2 $Floor2 -mass $NodalMass22 $Negligible $Negligible;\n');
fprintf(ft,' node 32 $Pier3 $Floor2 -mass $NodalMass22 $Negligible $Negligible;\n');
fprintf(ft,' node 42 $Pier4 $Floor2 -mass $NodalMass22 $Negligible $Negligible;\n');
fprintf(ft,' node 52 $Pier5 $Floor2 -mass $NodalMass2 $Negligible $Negligible;\n');
fprintf(ft,' node 62 $Pier6 $Floor2;\n');
fprintf(ft,' \n');
fprintf(ft,' node 13 $Pier1 $Floor3 -mass $NodalMass2 $Negligible $Negligible;\n');
fprintf(ft,' node 23 $Pier2 $Floor3 -mass $NodalMass22 $Negligible $Negligible;\n');
fprintf(ft,' node 33 $Pier3 $Floor3 -mass $NodalMass22 $Negligible $Negligible;\n');
fprintf(ft,' node 43 $Pier4 $Floor3 -mass $NodalMass22 $Negligible $Negligible;\n');
fprintf(ft,' node 53 $Pier5 $Floor3 -mass $NodalMass2 $Negligible $Negligible;\n');
fprintf(ft,' node 63 $Pier6 $Floor3;\n');
fprintf(ft,' \n');
fprintf(ft,' node 14 $Pier1 $Floor4 -mass $NodalMass4 $Negligible $Negligible;\n');
fprintf(ft,' node 24 $Pier2 $Floor4 -mass $NodalMass44 $Negligible $Negligible;\n');
fprintf(ft,' node 34 $Pier3 $Floor4 -mass $NodalMass44 $Negligible $Negligible;\n');
fprintf(ft,' node 44 $Pier4 $Floor4 -mass $NodalMass44 $Negligible $Negligible;\n');
fprintf(ft,' node 54 $Pier5 $Floor4 -mass $NodalMass4 $Negligible $Negligible;\n');
fprintf(ft,' node 64 $Pier6 $Floor4;\n');
fprintf(ft,' \n');
%%
fprintf(ft,' # extra nodes for springs in p-delta columns \n');
fprintf(ft,' node 626 $Pier6 $Floor2; # zero-stiffness spring will be used on p-delta column\n');
fprintf(ft,' node 627 $Pier6 $Floor2; # zero-stiffness spring will be used on p-delta column\n');
fprintf(ft,' node 636 $Pier6 $Floor3; # zero-stiffness spring will be used on p-delta column\n');
fprintf(ft,' node 637 $Pier6 $Floor3; # zero-stiffness spring will be used on p-delta column\n');
fprintf(ft,' node 646 $Pier6 $Floor4; # zero-stiffness spring will be used on p-delta column\n');
fprintf(ft,' \n');
%%
fprintf(ft,' # constrain beam-column joints in a floor to have the same lateral displacement using the "equalDOF" command\n');
fprintf(ft,' # command: equalDOF $MasterNodeID $SlaveNodeID $dof1 $dof2...\n');
fprintf(ft,' set dof1 1; # constrain movement in dof 1 (x-direction)\n');
fprintf(ft,' equalDOF 12 22 $dof1; # Floor 2: Pier 1 to Pier 2\n');
fprintf(ft,' equalDOF 12 32 $dof1; # Floor 2: Pier 1 to Pier 3\n');
fprintf(ft,' equalDOF 12 42 $dof1; # Floor 2: Pier 1 to Pier 2\n');
fprintf(ft,' equalDOF 12 52 $dof1; # Floor 2: Pier 1 to Pier 3\n');
fprintf(ft,' equalDOF 12 62 $dof1; # Floor 2: Pier 1 to Pier 3\n');
fprintf(ft,' \n');
fprintf(ft,' equalDOF 13 23 $dof1; # Floor 3: Pier 1 to Pier 2\n');
fprintf(ft,' equalDOF 13 33 $dof1; # Floor 3: Pier 1 to Pier 3\n');
fprintf(ft,' equalDOF 13 43 $dof1; # Floor 3: Pier 1 to Pier 2\n');
fprintf(ft,' equalDOF 13 53 $dof1; # Floor 3: Pier 1 to Pier 3\n');
fprintf(ft,' equalDOF 13 63 $dof1; # Floor 3: Pier 1 to Pier 3\n');
fprintf(ft,' \n');
fprintf(ft,' equalDOF 14 24 $dof1; # Floor 4: Pier 1 to Pier 2\n');
fprintf(ft,' equalDOF 14 34 $dof1; # Floor 4: Pier 1 to Pier 3\n');
fprintf(ft,' equalDOF 14 44 $dof1; # Floor 4: Pier 1 to Pier 2\n');
fprintf(ft,' equalDOF 14 54 $dof1; # Floor 4: Pier 1 to Pier 3\n');
fprintf(ft,' equalDOF 14 64 $dof1; # Floor 4: Pier 1 to Pier 3\n');
fprintf(ft,' \n');
%%
fprintf(ft,' # assign boundary condidtions\n');
fprintf(ft,' # command: fix nodeID dxFixity dyFixity rzFixity\n');
fprintf(ft,' # fixity values: 1 = constrained; 0 = unconstrained\n');
fprintf(ft,' # fix the base of the building; pin P-delta column at base\n');
fprintf(ft,' fix 11 1 1 1;\n');
fprintf(ft,' fix 21 1 1 1;\n');
fprintf(ft,' fix 31 1 1 1;\n');
fprintf(ft,' fix 41 1 1 1;\n');
fprintf(ft,' fix 51 1 1 1;\n');
fprintf(ft,' fix 61 1 1 0; # P-delta column is pinned\n');
fprintf(ft,' \n');
%%
fprintf(ft,' ###################################################################################################\n');
fprintf(ft,' # Define Section Properties and Elements \n');
fprintf(ft,' ###################################################################################################\n');
fprintf(ft,' # define material properties\n');
fprintf(ft,' set Es 29000.0; # steel Youngs modulus\n');
fprintf(ft,' \n');
%%
fprintf(ft,' # define column section W14x257 for Grup 1 & 2\n');
fprintf(ft,' set Acol_12 75.6; # cross-sectional area\n');
fprintf(ft,' set Icol_12 3400.0; # moment of inertia\n');
fprintf(ft,' set Mycol_12 17532.0; # yield moment\n');
%%
fprintf(ft,' # define column section W24x131 for Grup 2 \n');
fprintf(ft,' set Acol_22 91.4; # cross-sectional area\n');
fprintf(ft,' set Icol_22 4330.0; # moment of inertia\n');
fprintf(ft,' set Mycol_22 21708.0; # yield moment\n');
fprintf(ft,' \n');
%%
fprintf(ft,' # define beam section W27x102 for Floor 2 & 3\n');
fprintf(ft,' set Abeam_23 30.0; # cross-sectional area (full section properties)ce\n');
fprintf(ft,' set Ibeam_23 3620.0; # moment of inertia (full section properties)\n');
fprintf(ft,' set Mybeam_23 10938.0; # yield moment at plastic hinge location (i.e., My of RBS section, if used)\n');
fprintf(ft,' # note: In this example the hinges form right at the beam-column joint, so using an RBS doesnt make sense; \n');
fprintf(ft,' # however, it is done here simply for illustrative purposes.\n');
fprintf(ft,' \n');
%%
fprintf(ft,' # define plastic hinge lengths\n');
fprintf(ft,' set Lp_c1 [expr 0.004*$HStory1]; # length of plastic hinge for Story 1 columns\n');
fprintf(ft,' set Lp_cTyp [expr 0.004*$HStoryTyp]; # length of plastic hinge for typical columns\n');
fprintf(ft,' set Lp_b23 [expr 0.004*$WBay]; # length of plastic hinge for Floor 2 & 3 beams\n');
fprintf(ft,' \n');
%%
fprintf(ft,' # determine stiffness modifications so that the strain hardening of the plastic hinge region captures the actual frame members strain hardening\n');
fprintf(ft,' # Reference: Ibarra, L. F., and Krawinkler, H. (2005). "Global collapse of frame structures under seismic excitations," Technical Report 152,\n');
fprintf(ft,' # The John A. Blume Earthquake Engineering Research Center, Department of Civil Engineering, Stanford University, Stanford, CA.\n');
fprintf(ft,' set n_c1 [expr $HStory1/$Lp_c1]; # rotational stiffness ratio: (Story 1 column plastic hinge region) / (actual Story 1 column)\n');
fprintf(ft,' set n_cTyp [expr $HStoryTyp/$Lp_cTyp]; # rotational stiffness ratio: (Story 2 column plastic hinge region) / (actual Story 2 column)\n');
fprintf(ft,' set n_b23 [expr $WBay/$Lp_b23]; # rotational stiffness ratio: (beam plastic hinge region) / (actual beam)\n');
fprintf(ft,' \n');
%%
fprintf(ft,' # calculate rotational stiffness for plastic hinges\n');
fprintf(ft,' set Ks_col_1 [expr 6.0*$Es*$Icol_12/$Lp_c1]; # rotational stiffness of Story 1 column hinges\n');
fprintf(ft,' set Ks_col_2 [expr 6.0*$Es*$Icol_12/$Lp_cTyp]; # rotational stiffness of Story 2 column hinges\n');
fprintf(ft,' set Ks_beam_23 [expr 6.0*$Es*$Ibeam_23/$Lp_b23];# rotational stiffness of Floor 2 & 3 beam hinges\n');
fprintf(ft,' \n');
fprintf(ft,' set Kmem_col_1 [expr 6.0*$Es*$Icol_12/$HStory1]; # rotational stiffness of Story 1 columns\n');
fprintf(ft,' set Kmem_col_2 [expr 6.0*$Es*$Icol_12/$HStoryTyp]; # rotational stiffness of Story 2 columns\n');
fprintf(ft,' set Kmem_beam_23 [expr 6.0*$Es*$Ibeam_23/$WBay]; # rotational stiffness of Floor 2 & 3 beams\n');
fprintf(ft,' \n');
%%
fprintf(ft,' ###################################################################################################\n');
fprintf(ft,' # Define Rotational Springs for Plastic Hinges \n');
fprintf(ft,' ###################################################################################################\n');
fprintf(ft,' # define rotational spring properties and create spring elements using "rotSect2DModIKModel" procedure\n');
fprintf(ft,' # rotSect2DModIKModel creates a section with an elastic axial and bilinear flexural response based on Modified Ibarra Krawinkler Deterioration Model\n');
fprintf(ft,' # references provided in rotSect2DModIKModel.tcl\n');
fprintf(ft,' # input values for Story 1 column springs\n');
fprintf(ft,' set McMy 1.05; # ratio of capping moment to yield moment, Mc / My\n');
fprintf(ft,' set LS 1000.0; # basic strength deterioration (a very large # = no cyclic deterioration)\n');
fprintf(ft,' set LK 1000.0; # unloading stiffness deterioration (a very large # = no cyclic deterioration)\n');
fprintf(ft,' set LA 1000.0; # accelerated reloading stiffness deterioration (a very large # = no cyclic deterioration)\n');
fprintf(ft,' set LD 1000.0; # post-capping strength deterioration (a very large # = no deterioration)\n');
fprintf(ft,' set cS 1.0; # exponent for basic strength deterioration (c = 1.0 for no deterioration)\n');
fprintf(ft,' set cK 1.0; # exponent for unloading stiffness deterioration (c = 1.0 for no deterioration)\n');
fprintf(ft,' set cA 1.0; # exponent for accelerated reloading stiffness deterioration (c = 1.0 for no deterioration)\n');
fprintf(ft,' set cD 1.0; # exponent for post-capping strength deterioration (c = 1.0 for no deterioration)\n');
fprintf(ft,' set th_pP 0.025; # plastic rot capacity for pos loading\n');
fprintf(ft,' set th_pN 0.025; # plastic rot capacity for neg loading\n');
fprintf(ft,' set th_pcP 0.3; # post-capping rot capacity for pos loading\n');
fprintf(ft,' set th_pcN 0.3; # post-capping rot capacity for neg loading\n');
fprintf(ft,' set ResP 0.4; # residual strength ratio for pos loading\n');
fprintf(ft,' set ResN 0.4; # residual strength ratio for neg loading\n');
fprintf(ft,' set th_uP 0.4; # ultimate rot capacity for pos loading\n');
fprintf(ft,' set th_uN 0.4; # ultimate rot capacity for neg loading\n');
fprintf(ft,' set DP 1.0; # rate of cyclic deterioration for pos loading\n');
fprintf(ft,' set DN 1.0; # rate of cyclic deterioration for neg loading\n');
fprintf(ft,' set a_mem [expr ($Mycol_12*($McMy-1.0)) / ($Kmem_col_1*$th_pP)]; # strain hardening ratio of member\n');
fprintf(ft,' set b [expr ($a_mem)/(1.0+$n_c1*(1.0-$a_mem))]; # modified strain hardening ratio (Ibarra & Krawinkler 2005, note: Eqn B.5 is incorrect)\n');
fprintf(ft,' \n');
%%
fprintf(ft,' # define column plastic hinge sections\n');
fprintf(ft,' # command: rotSect2DModIKModel 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-\n');
fprintf(ft,' # Section ID: "10y", where 10 = col section, y = Story #\n');
fprintf(ft,' # Story 1 columns\n');
fprintf(ft,' set sec_c1 101; # section ID for Story 1 columns\n');
fprintf(ft,' rotSect2DModIKModel $sec_c1 $Es $Acol_12 $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;\n');
fprintf(ft,' \n');
%%
fprintf(ft,' # recompute strain hardening since Story 2 is not the same height as Story 1\n');
fprintf(ft,' set a_mem [expr ($Mycol_12*($McMy-1.0)) / ($Kmem_col_2*$th_pP)]; # strain hardening ratio of member\n');
fprintf(ft,' set b [expr ($a_mem)/(1.0+$n_cTyp*(1.0-$a_mem))]; # modified strain hardening ratio (Ibarra & Krawinkler 2005, note: there is mistake in Eqn B.5)\n');
fprintf(ft,' # Story 2 columns\n');
fprintf(ft,' set sec_cTyp 102; # section ID for Story 2 columns\n');
fprintf(ft,' rotSect2DModIKModel $sec_cTyp $Es $Acol_12 $Ks_col_2 $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;\n');
fprintf(ft,' \n');
%%
fprintf(ft,' # define beam plastic hinge sections\n');
fprintf(ft,' # Setion ID: "20y", where 20 = beam section, y = Floor #\n');
fprintf(ft,' # redefine the rotations since they are not the same\n');
fprintf(ft,' set th_pP 0.02;\n');
fprintf(ft,' set th_pN 0.02;\n');
fprintf(ft,' set th_pcP 0.16;\n');
fprintf(ft,' set th_pcN 0.16;\n');
fprintf(ft,' set a_mem [expr ($Mybeam_23*($McMy-1.0)) / ($Kmem_beam_23*$th_pP)]; # strain hardening ratio of member\n');
fprintf(ft,' set b [expr ($a_mem)/(1.0+$n_b23*(1.0-$a_mem))]; # modified strain hardening ratio (Ibarra & Krawinkler 2005, note: there is mistake in Eqn B.5)\n');
fprintf(ft,' #beam sections\n');
fprintf(ft,' set sec_b23 202; # section ID for beams\n');
fprintf(ft,' rotSect2DModIKModel $sec_b23 $Es $Abeam_23 $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;\n');
fprintf(ft,' \n');
%%
fprintf(ft,' # set up geometric transformations of element\n');
fprintf(ft,' set PDeltaTransf 1;\n');
fprintf(ft,' geomTransf PDelta $PDeltaTransf; # PDelta transformation\n');
fprintf(ft,' \n');
%%
fprintf(ft,' # define column elements using "element" command\n');
fprintf(ft,' # command: element beamWithHinges $eleID $iNode $jNode $secTagI $Lpi $secTagJ $Lpj $E $A $I $transfID\n');
fprintf(ft,' # eleID convention: "1xy" where 1 = col, x = Pier #, y = Story #\n');
fprintf(ft,' # Grup no 1\n');
fprintf(ft,' element beamWithHinges 1112 11 12 $sec_c1 $Lp_c1 $sec_c1 $Lp_c1 $Es $Acol_12 $Icol_12 $PDeltaTransf; # Pier 1\n');
fprintf(ft,' element beamWithHinges 1213 12 13 $sec_c1 $Lp_c1 $sec_c1 $Lp_c1 $Es $Acol_12 $Icol_12 $PDeltaTransf; # Pier 2\n');
fprintf(ft,' element beamWithHinges 1314 13 14 $sec_c1 $Lp_c1 $sec_c1 $Lp_c1 $Es $Acol_12 $Icol_12 $PDeltaTransf; # Pier 1\n');
fprintf(ft,' element beamWithHinges 5152 51 52 $sec_c1 $Lp_c1 $sec_c1 $Lp_c1 $Es $Acol_12 $Icol_12 $PDeltaTransf; # Pier 1\n');
fprintf(ft,' element beamWithHinges 5253 52 53 $sec_c1 $Lp_c1 $sec_c1 $Lp_c1 $Es $Acol_12 $Icol_12 $PDeltaTransf; # Pier 2\n');
fprintf(ft,' element beamWithHinges 5354 53 54 $sec_c1 $Lp_c1 $sec_c1 $Lp_c1 $Es $Acol_12 $Icol_12 $PDeltaTransf; # Pier 1\n');
%%
fprintf(ft,' # Grup no 2\n');
fprintf(ft,' element beamWithHinges 2122 21 22 $sec_cTyp $Lp_cTyp $sec_cTyp $Lp_cTyp $Es $Acol_12 $Icol_12 $PDeltaTransf; # Pier 1\n');
fprintf(ft,' element beamWithHinges 2223 22 23 $sec_cTyp $Lp_cTyp $sec_cTyp $Lp_cTyp $Es $Acol_12 $Icol_12 $PDeltaTransf; # Pier 2\n');
fprintf(ft,' element beamWithHinges 2324 23 24 $sec_cTyp $Lp_cTyp $sec_cTyp $Lp_cTyp $Es $Acol_12 $Icol_12 $PDeltaTransf; # Pier 1\n');
fprintf(ft,' element beamWithHinges 3132 31 32 $sec_cTyp $Lp_cTyp $sec_cTyp $Lp_cTyp $Es $Acol_12 $Icol_12 $PDeltaTransf; # Pier 1\n');
fprintf(ft,' element beamWithHinges 3233 32 33 $sec_cTyp $Lp_cTyp $sec_cTyp $Lp_cTyp $Es $Acol_12 $Icol_12 $PDeltaTransf; # Pier 2\n');
fprintf(ft,' element beamWithHinges 3334 33 34 $sec_cTyp $Lp_cTyp $sec_cTyp $Lp_cTyp $Es $Acol_12 $Icol_12 $PDeltaTransf; # Pier 1\n');
fprintf(ft,' element beamWithHinges 4142 41 42 $sec_cTyp $Lp_cTyp $sec_cTyp $Lp_cTyp $Es $Acol_12 $Icol_12 $PDeltaTransf; # Pier 1\n');
fprintf(ft,' element beamWithHinges 4243 42 43 $sec_cTyp $Lp_cTyp $sec_cTyp $Lp_cTyp $Es $Acol_12 $Icol_12 $PDeltaTransf; # Pier 2\n');
fprintf(ft,' element beamWithHinges 4344 43 44 $sec_cTyp $Lp_cTyp $sec_cTyp $Lp_cTyp $Es $Acol_12 $Icol_12 $PDeltaTransf; # Pier 1\n');
fprintf(ft,' \n');
%%
fprintf(ft,' # define elastic beam elements\n');
fprintf(ft,' # eleID convention: "2xy" where 2 = beam, x = Bay #, y = Floor #\n');
fprintf(ft,' # Beams grup1\n');
fprintf(ft,' element beamWithHinges 1222 12 22 $sec_b23 $Lp_b23 $sec_b23 $Lp_b23 $Es $Abeam_23 $Ibeam_23 $PDeltaTransf;\n');
fprintf(ft,' element beamWithHinges 2232 22 32 $sec_b23 $Lp_b23 $sec_b23 $Lp_b23 $Es $Abeam_23 $Ibeam_23 $PDeltaTransf;\n');
fprintf(ft,' element beamWithHinges 3242 32 42 $sec_b23 $Lp_b23 $sec_b23 $Lp_b23 $Es $Abeam_23 $Ibeam_23 $PDeltaTransf;\n');
fprintf(ft,' element beamWithHinges 4252 42 52 $sec_b23 $Lp_b23 $sec_b23 $Lp_b23 $Es $Abeam_23 $Ibeam_23 $PDeltaTransf;\n');
fprintf(ft,' # Beams grup2\n');
fprintf(ft,' element beamWithHinges 1323 13 23 $sec_b23 $Lp_b23 $sec_b23 $Lp_b23 $Es $Abeam_23 $Ibeam_23 $PDeltaTransf;\n');
fprintf(ft,' element beamWithHinges 2333 23 33 $sec_b23 $Lp_b23 $sec_b23 $Lp_b23 $Es $Abeam_23 $Ibeam_23 $PDeltaTransf;\n');
fprintf(ft,' element beamWithHinges 3343 33 43 $sec_b23 $Lp_b23 $sec_b23 $Lp_b23 $Es $Abeam_23 $Ibeam_23 $PDeltaTransf;\n');
fprintf(ft,' element beamWithHinges 4353 43 53 $sec_b23 $Lp_b23 $sec_b23 $Lp_b23 $Es $Abeam_23 $Ibeam_23 $PDeltaTransf;\n');
fprintf(ft,' # Beams grup3\n');
fprintf(ft,' element beamWithHinges 1424 14 24 $sec_b23 $Lp_b23 $sec_b23 $Lp_b23 $Es $Abeam_23 $Ibeam_23 $PDeltaTransf;\n');
fprintf(ft,' element beamWithHinges 2434 24 34 $sec_b23 $Lp_b23 $sec_b23 $Lp_b23 $Es $Abeam_23 $Ibeam_23 $PDeltaTransf;\n');
fprintf(ft,' element beamWithHinges 3444 34 44 $sec_b23 $Lp_b23 $sec_b23 $Lp_b23 $Es $Abeam_23 $Ibeam_23 $PDeltaTransf;\n');
fprintf(ft,' element beamWithHinges 4454 44 54 $sec_b23 $Lp_b23 $sec_b23 $Lp_b23 $Es $Abeam_23 $Ibeam_23 $PDeltaTransf;\n');
fprintf(ft,' \n');
%%
fprintf(ft,' # define p-delta columns and rigid links\n');
fprintf(ft,' set TrussMatID 600; # define a material ID\n');
fprintf(ft,' set Arigid 1000.0; # define area of truss section (make much larger than A of frame elements)\n');
fprintf(ft,' set Irigid 100000.0; # moment of inertia for p-delta columns (make much larger than I of frame elements)\n');
fprintf(ft,' uniaxialMaterial Elastic $TrussMatID $Es; # define truss material\n');
fprintf(ft,' # rigid links\n');
%%
fprintf(ft,' # command: element truss $eleID $iNode $jNode $A $materialID\n');
fprintf(ft,' # eleID convention: 6xy, 6 = truss link, x = Bay #, y = Floor #\n');
fprintf(ft,' element truss 5262 52 62 $Arigid $TrussMatID; # Floor 2\n');
fprintf(ft,' element truss 5363 53 63 $Arigid $TrussMatID; # Floor 3\n');
fprintf(ft,' element truss 5464 54 64 $Arigid $TrussMatID; # Floor 3\n');
fprintf(ft,' \n');
%%
fprintf(ft,' # p-delta columns\n');
fprintf(ft,' # eleID convention: 7xy, 7 = p-delta columns, x = Pier #, y = Story #\n');
fprintf(ft,' element elasticBeamColumn 6162 61 626 $Arigid $Es $Irigid $PDeltaTransf; # Story 1\n');
fprintf(ft,' element elasticBeamColumn 6263 627 636 $Arigid $Es $Irigid $PDeltaTransf; # Story 2\n');
fprintf(ft,' element elasticBeamColumn 6364 637 646 $Arigid $Es $Irigid $PDeltaTransf; # Story 2\n');
fprintf(ft,' \n');
%%
fprintf(ft,' # define p-delta column spring: zero-stiffness elastic spring \n');
fprintf(ft,' #Spring ID: "5xya" where 5 = leaning column spring, x = Pier #, y = Story #, a = location in story\n');
fprintf(ft,' # "a" convention: 1 = bottom of story, 2 = top of story\n');
fprintf(ft,' # rotLeaningCol ElemID ndR ndC \n');
fprintf(ft,' rotLeaningCol 62636 62 626; # top of Story 1\n');
fprintf(ft,' rotLeaningCol 62627 62 627; # bottom of Story 2\n');
fprintf(ft,' rotLeaningCol 63636 63 636; # top of Story 2\n');
fprintf(ft,' rotLeaningCol 63637 63 637; # bottom of Story 2\n');
fprintf(ft,' rotLeaningCol 64646 64 646; # top of Story 2\n');
%%
fprintf(ft,' \n');
fprintf(ft,' # display the model with the node numbers\n');
fprintf(ft,' DisplayModel2D NodeNumbers\n');
fprintf(ft,' \n');
%%
fprintf(ft,' ############################################################################\n');
fprintf(ft,' # Eigenvalue Analysis \n');
fprintf(ft,' ############################################################################\n');
fprintf(ft,' set pi [expr 2.0*asin(1.0)]; # Definition of pi\n');
fprintf(ft,' set nEigenI 1; # mode i = 1\n');
fprintf(ft,' set nEigenJ 2; # mode j = 2\n');
fprintf(ft,' set lambdaN [eigen [expr $nEigenJ]]; # eigenvalue analysis for nEigenJ modes\n');
fprintf(ft,' set lambdaI [lindex $lambdaN [expr 0]]; # eigenvalue mode i = 1\n');
fprintf(ft,' set lambdaJ [lindex $lambdaN [expr $nEigenJ-1]]; # eigenvalue mode j = 2\n');
fprintf(ft,' set w1 [expr pow($lambdaI,0.5)]; # w1 (1st mode circular frequency)\n');
fprintf(ft,' set w2 [expr pow($lambdaJ,0.5)]; # w2 (2nd mode circular frequency)\n');
fprintf(ft,' set T1 [expr 2.0*$pi/$w1]; # 1st mode period of the structure\n');
fprintf(ft,' set T2 [expr 2.0*$pi/$w2]; # 2nd mode period of the structure\n');
fprintf(ft,' puts "T1 = $T1 s"\n');
fprintf(ft,' puts "T2 = $T2 s"\n');
fprintf(ft,' \n');
%%
fprintf(ft,' ############################################################################\n');
fprintf(ft,' # Gravity Loads & Gravity Analysis\n');
fprintf(ft,' ############################################################################\n');
fprintf(ft,' # apply gravity loads\n');
fprintf(ft,' #command: pattern PatternType $PatternID TimeSeriesType\n');
fprintf(ft,' pattern Plain 101 Constant {\n');
fprintf(ft,' \n');
%%
fprintf(ft,' # point loads on leaning column nodes\n');
fprintf(ft,' # command: load node Fx Fy Mz\n');
fprintf(ft,' set P_PD2 [expr -784.166]; # Floor 2\n');
fprintf(ft,' set P_PD3 [expr -784.166]; # Floor 3\n');
fprintf(ft,' set P_PD4 [expr -849.7017]; # Floor 4\n');
fprintf(ft,' load 62 0.0 $P_PD2 0.0; # Floor 2\n');
fprintf(ft,' load 63 0.0 $P_PD3 0.0; # Floor 3\n');
fprintf(ft,' load 64 0.0 $P_PD4 0.0; # Floor 4\n');
fprintf(ft,' \n');
%%
fprintf(ft,' # point loads on frame column nodes\n');
fprintf(ft,' set P_F2 [expr 0.5*(-1.0*$Floor2Weight-$P_PD2)]; # load on each frame node in Floor 2\n');
fprintf(ft,' set P_F3 [expr 1.0*(-1.0*$Floor3Weight-$P_PD3)]; # load on each frame node in Floor 3\n');
fprintf(ft,' set P_F4 [expr 0.5*(-1.0*$Floor4Weight-$P_PD4)]; # load on each frame node in Floor 3\n');
fprintf(ft,' set P_F5 [expr 1.0*(-1.0*$Floor4Weight-$P_PD4)]; # load on each frame node in Floor 3\n');
fprintf(ft,' # Floor 2 loads\n');
fprintf(ft,' load 12 0.0 $P_F2 0.0;\n');
fprintf(ft,' load 22 0.0 $P_F3 0.0; \n');
fprintf(ft,' load 32 0.0 $P_F3 0.0;\n');
fprintf(ft,' load 42 0.0 $P_F3 0.0; \n');
fprintf(ft,' load 52 0.0 $P_F2 0.0; \n');
%%
fprintf(ft,' # Floor 3 loads \n');
fprintf(ft,' load 13 0.0 $P_F2 0.0;\n');
fprintf(ft,' load 23 0.0 $P_F3 0.0;\n');
fprintf(ft,' load 33 0.0 $P_F3 0.0;\n');
fprintf(ft,' load 43 0.0 $P_F3 0.0;\n');
fprintf(ft,' load 53 0.0 $P_F2 0.0;\n');
fprintf(ft,' # Floor 4 loads \n');
fprintf(ft,' load 14 0.0 $P_F4 0.0;\n');
fprintf(ft,' load 24 0.0 $P_F5 0.0;\n');
fprintf(ft,' load 34 0.0 $P_F5 0.0;\n');
fprintf(ft,' load 44 0.0 $P_F5 0.0;\n');
fprintf(ft,' load 54 0.0 $P_F4 0.0;\n');
fprintf(ft,' }\n');
fprintf(ft,' \n');
%%
fprintf(ft,' # Gravity-analysis: load-controlled static analysis\n');
fprintf(ft,' set Tol 1.0e-6; # convergence tolerance for test\n');
fprintf(ft,' variable constraintsTypeGravity Plain; # default;\n');
fprintf(ft,' constraints $constraintsTypeGravity ; # how it handles boundary conditions\n');
fprintf(ft,' numberer RCM; # renumber dofs to minimize band-width (optimization)\n');
fprintf(ft,' system BandGeneral ; # how to store and solve the system of equations in the analysis (large model: try UmfPack)\n');
fprintf(ft,' test NormDispIncr $Tol 6 ; # determine if convergence has been achieved at the end of an iteration step\n');
fprintf(ft,' algorithm Newton; # use Newtons solution algorithm: updates tangent stiffness at every iteration\n');
fprintf(ft,' set NstepGravity 10; # apply gravity in 10 steps\n');
fprintf(ft,' set DGravity [expr 1.0/$NstepGravity]; # first load increment;\n');
fprintf(ft,' integrator LoadControl $DGravity; # determine the next time step for an analysis\n');
fprintf(ft,' analysis Static; # define type of analysis static or transient\n');
fprintf(ft,' analyze $NstepGravity; # apply gravity\n');
fprintf(ft,' \n');
fprintf(ft,' # maintain constant gravity loads and reset time to zero\n');
fprintf(ft,' loadConst -time 0.0\n');
fprintf(ft,' puts "Model Built"\n');
fprintf(ft,' \n');
%%
fprintf(ft,' ############################################################################\n');
fprintf(ft,' # Recorders \n');
fprintf(ft,' ############################################################################\n');
fprintf(ft,' # record drift histories\n');
fprintf(ft,' # drift recorder command: recorder Drift -file $filename -iNode $NodeI_ID -jNode $NodeJ_ID -dof $dof -perpDirn $Record.drift.perpendicular.to.this.direction\n');
fprintf(ft,' recorder Drift -file $dataDir/Drift-Story1.out -iNode 11 -jNode 12 -dof 1 -perpDirn 2;\n');
fprintf(ft,' recorder Drift -file $dataDir/Drift-Story2.out -iNode 12 -jNode 13 -dof 1 -perpDirn 2;\n');
fprintf(ft,' recorder Drift -file $dataDir/Drift-Story3.out -iNode 13 -jNode 14 -dof 1 -perpDirn 2;\n');
fprintf(ft,' recorder Drift -file $dataDir/Drift-Roof.out -iNode 11 -jNode 14 -dof 1 -perpDirn 2;\n');
fprintf(ft,' \n');
%%
fprintf(ft,' # record base shear reactions\n');
fprintf(ft,' recorder Node -file $dataDir/Vbase.out -node 11 21 31 41 51 61 -dof 1 reaction; \n');
fprintf(ft,' \n');
fprintf(ft,' # record story 1 column forces in global coordinates \n');
fprintf(ft,' recorder Element -file $dataDir/Fcol1112.out -ele 1112 force;\n');
fprintf(ft,' recorder Element -file $dataDir/Fcol2122.out -ele 2122 force;\n');
fprintf(ft,' recorder Element -file $dataDir/Fcol3132.out -ele 3132 force;\n');
fprintf(ft,' recorder Element -file $dataDir/Fcol4142.out -ele 4142 force;\n');
fprintf(ft,' recorder Element -file $dataDir/Fcol5152.out -ele 5152 force;\n');
fprintf(ft,' recorder Element -file $dataDir/Fcol6162.out -ele 6162 force;\n');
fprintf(ft,' \n');
%%
fprintf(ft,' #######################################################################################\n');
fprintf(ft,' # #\n');
fprintf(ft,' # Analysis Section #\n');
fprintf(ft,' # #\n');
fprintf(ft,' #######################################################################################\n');
fprintf(ft,' \n');
fprintf(ft,' ############################################################################\n');
fprintf(ft,' # Pushover Analysis #\n');
fprintf(ft,' ############################################################################\n');
fprintf(ft,' if {$analysisType == "pushover"} { \n');
fprintf(ft,' puts "Running Pushover..." \n');
fprintf(ft,' # assign lateral loads and create load pattern: use ASCE 7-10 distribution\n');
fprintf(ft,' set lat2 0.068; # force on each frame node in Floor 2\n');
fprintf(ft,' set lat3 0.271; # force on each frame node in Floor 3\n');
fprintf(ft,' set lat4 0.661; # force on each frame node in Floor 4\n');
fprintf(ft,' pattern Plain 200 Linear { \n');
fprintf(ft,' load 12 $lat2 0.0 0.0;\n');
fprintf(ft,' load 22 $lat2 0.0 0.0;\n');
fprintf(ft,' load 32 $lat2 0.0 0.0;\n');
fprintf(ft,' load 42 $lat2 0.0 0.0;\n');
fprintf(ft,' load 52 $lat2 0.0 0.0;\n');
fprintf(ft,' load 13 $lat3 0.0 0.0;\n');
fprintf(ft,' load 23 $lat3 0.0 0.0;\n');
fprintf(ft,' load 33 $lat3 0.0 0.0;\n');
fprintf(ft,' load 43 $lat3 0.0 0.0;\n');
fprintf(ft,' load 53 $lat3 0.0 0.0;\n');
fprintf(ft,' load 14 $lat4 0.0 0.0;\n');
fprintf(ft,' load 24 $lat4 0.0 0.0;\n');
fprintf(ft,' load 34 $lat4 0.0 0.0;\n');
fprintf(ft,' load 44 $lat4 0.0 0.0;\n');
fprintf(ft,' load 54 $lat4 0.0 0.0;\n');
fprintf(ft,' }\n');
fprintf(ft,' \n');
%%
fprintf(ft,' # display deformed shape:\n');
fprintf(ft,' set ViewScale 5;\n');
fprintf(ft,' DisplayModel2D DeformedShape $ViewScale ; # display deformed shape, the scaling factor needs to be adjusted for each model\n');
fprintf(ft,' \n');
%%
fprintf(ft,' # displacement parameters\n');
fprintf(ft,' set IDctrlNode 14; # node where disp is read for disp control\n');
fprintf(ft,' set IDctrlDOF 1; # degree of freedom read for disp control (1 = x displacement)\n');
fprintf(ft,' set Dmax [expr 0.05*$HBuilding]; # maximum displacement of pushover 10 roof drift \n');
fprintf(ft,' set Dincr [expr 0.01]; # displacement increment\n');
fprintf(ft,' \n');
%%
fprintf(ft,' # analysis commands\n');
fprintf(ft,' constraints Plain; # how it handles boundary conditions\n');
fprintf(ft,' numberer RCM; # renumber dofs to minimize band-width (optimization)\n');
fprintf(ft,' system BandGeneral; # how to store and solve the system of equations in the analysis (large model: try UmfPack)\n');
fprintf(ft,' test NormUnbalance 1.0e-6 400; # tolerance, max iterations\n');
fprintf(ft,' algorithm Newton; # use Newtons solution algorithm: updates tangent stiffness at every iteration\n');
fprintf(ft,' integrator DisplacementControl $IDctrlNode $IDctrlDOF $Dincr; # use displacement-controlled analysis\n');
fprintf(ft,' analysis Static; # define type of analysis: static for pushover\n');
fprintf(ft,' set Nsteps [expr int($Dmax/$Dincr)];# number of pushover analysis steps\n');
fprintf(ft,' set ok [analyze $Nsteps]; # this will return zero if no convergence problems were encountered\n');
fprintf(ft,' puts "Pushover complete"; # display this message in the command window\n');
fprintf(ft,' } \n');
fprintf(ft,' \n');
fprintf(ft,' wipe all;\n');
fclose(ft);
!opensees Distributed.txt

hikmet tutar
hikmet tutar el 6 de En. de 2021
ft=fopen('Concentrated.txt','wt');
fprintf(ft,' # --------------------------------------------------------------------------------------------------\n');
fprintf(ft,' # Example: 2-Story Steel Moment Frame with Concentrated Plasticity\n');
fprintf(ft,' # Centerline Model with Concentrated Plastic Hinges at Beam-Column Joint\n');
fprintf(ft,' # Created by: Laura Eads, Stanford University, 2010\n');
fprintf(ft,' # Units: kips, inches, seconds\n');
fprintf(ft,' \n');
fprintf(ft,' ###################################################################################################\n');
fprintf(ft,' # Set Up & Source Definition \n');
fprintf(ft,' ###################################################################################################\n');
fprintf(ft,' wipe all; # clear memory of past model definitions\n');
fprintf(ft,' model BasicBuilder -ndm 2 -ndf 3; # Define the model builder, ndm = #dimension, ndf = #dofs\n');
fprintf(ft,' source DisplayModel2D.tcl; # procedure for displaying a 2D perspective of model\n');
fprintf(ft,' source DisplayPlane.tcl; # procedure for displaying a plane in a model\n');
fprintf(ft,' source rotSpring2DModIKModel.tcl; # procedure for defining a rotational spring (zero-length element)\n');
fprintf(ft,' source rotLeaningCol.tcl; # procedure for defining a rotational spring (zero-length element) with very small stiffness\n');
fprintf(ft,' \n');
fprintf(ft,' ###################################################################################################\n');
fprintf(ft,' # Define Analysis Type \n');
fprintf(ft,' ###################################################################################################\n');
fprintf(ft,' # Define type of analysis: "pushover" = pushover\n');
fprintf(ft,' set analysisType "pushover";\n');
fprintf(ft,' if {$analysisType == "pushover"} {\n');
fprintf(ft,' set dataDir Concentrated-Pushover-Output; # name of output folder\n');
fprintf(ft,' file mkdir $dataDir; # create output folder\n');
fprintf(ft,' }\n');
fprintf(ft,' \n');
fprintf(ft,' ###################################################################################################\n');
fprintf(ft,' # Define Building Geometry, Nodes, and Constraints \n');
fprintf(ft,' ###################################################################################################\n');
fprintf(ft,' # define structure-geometry parameters\n');
fprintf(ft,' set NStories 3; # number of stories\n');
fprintf(ft,' set NBays 4; # number of frame bays (excludes bay for P-delta column)\n');
fprintf(ft,' set WBay [expr 30.0*12.0]; # bay width in inches\n');
fprintf(ft,' set HStory1 [expr 13.0*12.0]; # 1st story height in inches\n');
fprintf(ft,' set HStoryTyp [expr 13.0*12.0]; # story height of other stories in inches\n');
fprintf(ft,' set HBuilding [expr $HStory1 + ($NStories-1)*$HStoryTyp]; # height of building\n');
fprintf(ft,' \n');
fprintf(ft,' # calculate locations of beam/column joints:\n');
fprintf(ft,' set Pier1 0.0; # leftmost column line\n');
fprintf(ft,' set Pier2 [expr $Pier1 + $WBay];\n');
fprintf(ft,' set Pier3 [expr $Pier2 + $WBay];\n');
fprintf(ft,' set Pier4 [expr $Pier3 + $WBay];\n');
fprintf(ft,' set Pier5 [expr $Pier4 + $WBay];\n');
fprintf(ft,' set Pier6 [expr $Pier5 + $WBay]; # P-delta column line \n');
fprintf(ft,' set Floor1 0.0; # ground floor\n');
fprintf(ft,' set Floor2 [expr $Floor1 + $HStory1];\n');
fprintf(ft,' set Floor3 [expr $Floor2 + $HStoryTyp];\n');
fprintf(ft,' set Floor4 [expr $Floor3 + $HStoryTyp];\n');
fprintf(ft,' \n');
fprintf(ft,' # calculate joint offset distance for beam plastic hinges\n');
fprintf(ft,' set phlat23 [expr 0.0]; # lateral dist from beam-col joint to loc of hinge on Floor 2\n');
fprintf(ft,' \n');
fprintf(ft,' # calculate nodal masses -- lump floor masses at frame nodes\n');
fprintf(ft,' set g 386.2; # acceleration due to gravity\n');
fprintf(ft,' set Floor2Weight 1054.0; # weight of Floor 2 in kips\n');
fprintf(ft,' set Floor3Weight 1054.0; # weight of Floor 3 in kips\n');
fprintf(ft,' set Floor4Weight 1140.0; # weight of Floor 4 in kips\n');
fprintf(ft,' set WBuilding [expr $Floor2Weight + $Floor3Weight+$Floor4Weight]; # total building weight\n');
fprintf(ft,' set NodalMass2 [expr ($Floor2Weight/$g) / (2.0*4.0)]; # mass at each node on Floor 2\n');
fprintf(ft,' set NodalMass22 [expr ($Floor3Weight/$g) / (1.0*4.0)]; # mass at each node on Floor 3\n');
fprintf(ft,' set NodalMass4 [expr ($Floor4Weight/$g) / (2.0*4.0)]; # mass at each node on Floor 3\n');
fprintf(ft,' set NodalMass44 [expr ($Floor4Weight/$g) / (1.0*4.0)]; # mass at each node on Floor 3\n');
fprintf(ft,' set Negligible 1e-9; # a very small number to avoid problems with zero\n');
fprintf(ft,' \n');
fprintf(ft,' # define nodes and assign masses to beam-column intersections of frame\n');
fprintf(ft,' # command: node nodeID xcoord ycoord -mass mass_dof1 mass_dof2 mass_dof3\n');
fprintf(ft,' # nodeID convention: "xy" where x = Pier # and y = Floor # \n');
fprintf(ft,' node 11 $Pier1 $Floor1;\n');
fprintf(ft,' node 21 $Pier2 $Floor1;\n');
fprintf(ft,' node 31 $Pier3 $Floor1;\n');
fprintf(ft,' node 41 $Pier4 $Floor1;\n');
fprintf(ft,' node 51 $Pier5 $Floor1;\n');
fprintf(ft,' node 61 $Pier6 $Floor1;\n');
fprintf(ft,' \n');
fprintf(ft,' node 12 $Pier1 $Floor2 -mass $NodalMass2 $Negligible $Negligible;\n');
fprintf(ft,' node 22 $Pier2 $Floor2 -mass $NodalMass22 $Negligible $Negligible;\n');
fprintf(ft,' node 32 $Pier3 $Floor2 -mass $NodalMass22 $Negligible $Negligible;\n');
fprintf(ft,' node 42 $Pier4 $Floor2 -mass $NodalMass22 $Negligible $Negligible;\n');
fprintf(ft,' node 52 $Pier5 $Floor2 -mass $NodalMass2 $Negligible $Negligible;\n');
fprintf(ft,' node 62 $Pier6 $Floor2;\n');
fprintf(ft,' \n');
fprintf(ft,' node 13 $Pier1 $Floor3 -mass $NodalMass2 $Negligible $Negligible;\n');
fprintf(ft,' node 23 $Pier2 $Floor3 -mass $NodalMass22 $Negligible $Negligible;\n');
fprintf(ft,' node 33 $Pier3 $Floor3 -mass $NodalMass22 $Negligible $Negligible;\n');
fprintf(ft,' node 43 $Pier4 $Floor3 -mass $NodalMass22 $Negligible $Negligible;\n');
fprintf(ft,' node 53 $Pier5 $Floor3 -mass $NodalMass2 $Negligible $Negligible;\n');
fprintf(ft,' node 63 $Pier6 $Floor3;\n');
fprintf(ft,' \n');
fprintf(ft,' node 14 $Pier1 $Floor4 -mass $NodalMass4 $Negligible $Negligible;\n');
fprintf(ft,' node 24 $Pier2 $Floor4 -mass $NodalMass44 $Negligible $Negligible;\n');
fprintf(ft,' node 34 $Pier3 $Floor4 -mass $NodalMass44 $Negligible $Negligible;\n');
fprintf(ft,' node 44 $Pier4 $Floor4 -mass $NodalMass44 $Negligible $Negligible;\n');
fprintf(ft,' node 54 $Pier5 $Floor4 -mass $NodalMass4 $Negligible $Negligible;\n');
fprintf(ft,' node 64 $Pier6 $Floor4;\n');
fprintf(ft,' \n');
fprintf(ft,' # define extra nodes for plastic hinge rotational springs\n');
fprintf(ft,' # nodeID convention: "xya" where x = Pier #, y = Floor #, a = location relative to beam-column joint\n');
fprintf(ft,' # "a" convention: 2 = left; 3 = right;\n');
fprintf(ft,' # "a" convention: 6 = below; 7 = above; \n');
fprintf(ft,' # column hinges at bottom of Story 1 (base)\n');
fprintf(ft,' node 117 $Pier1 $Floor1;\n');
fprintf(ft,' node 217 $Pier2 $Floor1;\n');
fprintf(ft,' node 317 $Pier3 $Floor1;\n');
fprintf(ft,' node 417 $Pier4 $Floor1;\n');
fprintf(ft,' node 517 $Pier5 $Floor1;\n');
fprintf(ft,' # column hinges at top of Story 1\n');
fprintf(ft,' node 126 $Pier1 $Floor2;\n');
fprintf(ft,' node 226 $Pier2 $Floor2;\n');
fprintf(ft,' node 326 $Pier3 $Floor2;\n');
fprintf(ft,' node 426 $Pier4 $Floor2;\n');
fprintf(ft,' node 526 $Pier5 $Floor2;\n');
fprintf(ft,' node 626 $Pier6 $Floor2; # zero-stiffness spring will be used on p-delta column\n');
fprintf(ft,' # column hinges at bottom of Story 2\n');
fprintf(ft,' node 127 $Pier1 $Floor2;\n');
fprintf(ft,' node 227 $Pier2 $Floor2;\n');
fprintf(ft,' node 327 $Pier3 $Floor2;\n');
fprintf(ft,' node 427 $Pier4 $Floor2;\n');
fprintf(ft,' node 527 $Pier5 $Floor2;\n');
fprintf(ft,' node 627 $Pier6 $Floor2; # zero-stiffness spring will be used on p-delta column\n');
fprintf(ft,' # column hinges at top of Story 3\n');
fprintf(ft,' node 136 $Pier1 $Floor3;\n');
fprintf(ft,' node 236 $Pier2 $Floor3;\n');
fprintf(ft,' node 336 $Pier3 $Floor3;\n');
fprintf(ft,' node 436 $Pier4 $Floor3;\n');
fprintf(ft,' node 536 $Pier5 $Floor3;\n');
fprintf(ft,' node 636 $Pier6 $Floor3; # zero-stiffness spring will be used on p-delta column\n');
fprintf(ft,' # column hinges at top of Story 3\n');
fprintf(ft,' node 137 $Pier1 $Floor3;\n');
fprintf(ft,' node 237 $Pier2 $Floor3;\n');
fprintf(ft,' node 337 $Pier3 $Floor3;\n');
fprintf(ft,' node 437 $Pier4 $Floor3;\n');
fprintf(ft,' node 537 $Pier5 $Floor3;\n');
fprintf(ft,' node 637 $Pier6 $Floor3; # zero-stiffness spring will be used on p-delta column\n');
fprintf(ft,' # column hinges at top of Story 4\n');
fprintf(ft,' node 146 $Pier1 $Floor4;\n');
fprintf(ft,' node 246 $Pier2 $Floor4;\n');
fprintf(ft,' node 346 $Pier3 $Floor4;\n');
fprintf(ft,' node 446 $Pier4 $Floor4;\n');
fprintf(ft,' node 546 $Pier5 $Floor4;\n');
fprintf(ft,' node 646 $Pier6 $Floor4; # zero-stiffness spring will be used on p-delta column\n');
fprintf(ft,' \n');
fprintf(ft,' # beam hinges at Floor 2\n');
fprintf(ft,' node 122 [expr $Pier1 + $phlat23] $Floor2;\n');
fprintf(ft,' node 223 [expr $Pier2 - $phlat23] $Floor2;\n');
fprintf(ft,' node 222 [expr $Pier2 + $phlat23] $Floor2;\n');
fprintf(ft,' node 323 [expr $Pier3 - $phlat23] $Floor2;\n');
fprintf(ft,' node 322 [expr $Pier3 + $phlat23] $Floor2;\n');
fprintf(ft,' node 423 [expr $Pier4 - $phlat23] $Floor2;\n');
fprintf(ft,' node 422 [expr $Pier4 + $phlat23] $Floor2;\n');
fprintf(ft,' node 523 [expr $Pier5 - $phlat23] $Floor2;\n');
fprintf(ft,' # beam hinges at Floor 3\n');
fprintf(ft,' node 132 [expr $Pier1 + $phlat23] $Floor3;\n');
fprintf(ft,' node 233 [expr $Pier2 - $phlat23] $Floor3;\n');
fprintf(ft,' node 232 [expr $Pier2 + $phlat23] $Floor3;\n');
fprintf(ft,' node 333 [expr $Pier3 - $phlat23] $Floor3;\n');
fprintf(ft,' node 332 [expr $Pier3 + $phlat23] $Floor3;\n');
fprintf(ft,' node 433 [expr $Pier4 - $phlat23] $Floor3;\n');
fprintf(ft,' node 432 [expr $Pier4 + $phlat23] $Floor3;\n');
fprintf(ft,' node 533 [expr $Pier5 - $phlat23] $Floor3;\n');
fprintf(ft,' # beam hinges at Floor 4\n');
fprintf(ft,' node 142 [expr $Pier1 + $phlat23] $Floor4;\n');
fprintf(ft,' node 243 [expr $Pier2 - $phlat23] $Floor4;\n');
fprintf(ft,' node 242 [expr $Pier2 + $phlat23] $Floor4;\n');
fprintf(ft,' node 343 [expr $Pier3 - $phlat23] $Floor4;\n');
fprintf(ft,' node 342 [expr $Pier3 + $phlat23] $Floor4;\n');
fprintf(ft,' node 443 [expr $Pier4 - $phlat23] $Floor4;\n');
fprintf(ft,' node 442 [expr $Pier4 + $phlat23] $Floor4;\n');
fprintf(ft,' node 543 [expr $Pier5 - $phlat23] $Floor4;\n');
fprintf(ft,' # constrain beam-column joints in a floor to have the same lateral displacement using the "equalDOF" command\n');
fprintf(ft,' # command: equalDOF $MasterNodeID $SlaveNodeID $dof1 $dof2...\n');
fprintf(ft,' set dof1 1; # constrain movement in dof 1 (x-direction)\n');
fprintf(ft,' equalDOF 12 22 $dof1; # Floor 2: Pier 1 to Pier 2\n');
fprintf(ft,' equalDOF 12 32 $dof1; # Floor 2: Pier 1 to Pier 3\n');
fprintf(ft,' equalDOF 12 42 $dof1; # Floor 2: Pier 1 to Pier 2\n');
fprintf(ft,' equalDOF 12 52 $dof1; # Floor 2: Pier 1 to Pier 3\n');
fprintf(ft,' equalDOF 12 62 $dof1; # Floor 2: Pier 1 to Pier 3\n');
fprintf(ft,' \n');
fprintf(ft,' equalDOF 13 23 $dof1; # Floor 3: Pier 1 to Pier 2\n');
fprintf(ft,' equalDOF 13 33 $dof1; # Floor 3: Pier 1 to Pier 3\n');
fprintf(ft,' equalDOF 13 43 $dof1; # Floor 3: Pier 1 to Pier 2\n');
fprintf(ft,' equalDOF 13 53 $dof1; # Floor 3: Pier 1 to Pier 3\n');
fprintf(ft,' equalDOF 13 63 $dof1; # Floor 3: Pier 1 to Pier 3\n');
fprintf(ft,' \n');
fprintf(ft,' equalDOF 14 24 $dof1; # Floor 4: Pier 1 to Pier 2\n');
fprintf(ft,' equalDOF 14 34 $dof1; # Floor 4: Pier 1 to Pier 3\n');
fprintf(ft,' equalDOF 14 44 $dof1; # Floor 4: Pier 1 to Pier 2\n');
fprintf(ft,' equalDOF 14 54 $dof1; # Floor 4: Pier 1 to Pier 3\n');
fprintf(ft,' equalDOF 14 64 $dof1; # Floor 4: Pier 1 to Pier 3\n');
fprintf(ft,' \n');
fprintf(ft,' # assign boundary condidtions\n');
fprintf(ft,' # command: fix nodeID dxFixity dyFixity rzFixity\n');
fprintf(ft,' # fixity values: 1 = constrained; 0 = unconstrained\n');
fprintf(ft,' # fix the base of the building; pin P-delta column at base\n');
fprintf(ft,' # assign boundary condidtions\n');
fprintf(ft,' # command: fix nodeID dxFixity dyFixity rzFixity\n');
fprintf(ft,' # fixity values: 1 = constrained; 0 = unconstrained\n');
fprintf(ft,' # fix the base of the building; pin P-delta column at base\n');
fprintf(ft,' fix 11 1 1 1;\n');
fprintf(ft,' fix 21 1 1 1;\n');
fprintf(ft,' fix 31 1 1 1;\n');
fprintf(ft,' fix 41 1 1 1;\n');
fprintf(ft,' fix 51 1 1 1;\n');
fprintf(ft,' fix 61 1 1 0; # P-delta column is pinned\n');
fprintf(ft,' \n');
fprintf(ft,' ###################################################################################################\n');
fprintf(ft,' # Define Section Properties and Elements \n');
fprintf(ft,' ###################################################################################################\n');
fprintf(ft,' # define material properties\n');
fprintf(ft,' set Es 29000.0; # steel Youngs modulus\n');
fprintf(ft,' \n');
fprintf(ft,' # define column section W24x131 for Story 1 & 2\n');
fprintf(ft,' set Acol_12 38.5; # cross-sectional area\n');
fprintf(ft,' set Icol_12 4020.0; # moment of inertia\n');
fprintf(ft,' set Mycol_12 20350.0; # yield moment\n');
fprintf(ft,' \n');
fprintf(ft,' # define beam section W27x102 for Floor 2 & 3\n');
fprintf(ft,' set Abeam_23 30.0; # cross-sectional area (full section properties)\n');
fprintf(ft,' set Ibeam_23 3620.0; # moment of inertia (full section properties)\n');
fprintf(ft,' set Mybeam_23 10938.0; # yield moment at plastic hinge location (i.e., My of RBS section, if used)\n');
fprintf(ft,' # note: In this example the hinges form right at the beam-column joint, so using an RBS doesnt make sense; \n');
fprintf(ft,' # however, it is done here simply for illustrative purposes.\n');
fprintf(ft,' \n');
fprintf(ft,' # determine stiffness modifications to equate the stiffness of the spring-elastic element-spring subassembly to the stiffness of the actual frame member\n');
fprintf(ft,' # Reference: Ibarra, L. F., and Krawinkler, H. (2005). "Global collapse of frame structures under seismic excitations," Technical Report 152,\n');
fprintf(ft,' # The John A. Blume Earthquake Engineering Research Center, Department of Civil Engineering, Stanford University, Stanford, CA.\n');
fprintf(ft,' # calculate modified section properties to account for spring stiffness being in series with the elastic element stiffness\n');
fprintf(ft,' set n 10.0; # stiffness multiplier for rotational spring\n');
fprintf(ft,' \n');
fprintf(ft,' # calculate modified moment of inertia for elastic elements\n');
fprintf(ft,' set Icol_12mod [expr $Icol_12*($n+1.0)/$n]; # modified moment of inertia for columns in Story 1 & 2\n');
fprintf(ft,' set Ibeam_23mod [expr $Ibeam_23*($n+1.0)/$n]; # modified moment of inertia for beams in Floor 2 & 3\n');
fprintf(ft,' # calculate modified rotational stiffness for plastic hinge springs\n');
fprintf(ft,' set Ks_col_1 [expr $n*6.0*$Es*$Icol_12mod/$HStory1]; # rotational stiffness of Story 1 column springs\n');
fprintf(ft,' set Ks_col_2 [expr $n*6.0*$Es*$Icol_12mod/$HStoryTyp]; # rotational stiffness of Story 2 column springs\n');
fprintf(ft,' set Ks_beam_23 [expr $n*6.0*$Es*$Ibeam_23mod/$WBay]; # rotational stiffness of Floor 2 & 3 beam springs\n');
fprintf(ft,' \n');
fprintf(ft,' # set up geometric transformations of element\n');
fprintf(ft,' set PDeltaTransf 1;\n');
fprintf(ft,' geomTransf PDelta $PDeltaTransf; # PDelta transformation\n');
fprintf(ft,' \n');
fprintf(ft,' # define elastic column elements using "element" command\n');
fprintf(ft,' # command: element elasticBeamColumn $eleID $iNode $jNode $A $E $I $transfID\n');
fprintf(ft,' # eleID convention: "1xy" where 1 = col, x = Pier #, y = Story #\n');
fprintf(ft,' # Columns Grup 1\n');
fprintf(ft,' element elasticBeamColumn 1112 117 126 $Acol_12 $Es $Icol_12mod $PDeltaTransf; # Pier 1\n');
fprintf(ft,' element elasticBeamColumn 1213 127 136 $Acol_12 $Es $Icol_12mod $PDeltaTransf; # Pier 2\n');
fprintf(ft,' element elasticBeamColumn 1314 137 146 $Acol_12 $Es $Icol_12mod $PDeltaTransf; # Pier 3\n');
fprintf(ft,' element elasticBeamColumn 5152 517 526 $Acol_12 $Es $Icol_12mod $PDeltaTransf; # Pier 1\n');
fprintf(ft,' element elasticBeamColumn 5253 527 536 $Acol_12 $Es $Icol_12mod $PDeltaTransf; # Pier 2\n');
fprintf(ft,' element elasticBeamColumn 5354 537 546 $Acol_12 $Es $Icol_12mod $PDeltaTransf; # Pier 3\n');
fprintf(ft,' # Columns Grup 2\n');
fprintf(ft,' element elasticBeamColumn 2122 217 226 $Acol_12 $Es $Icol_12mod $PDeltaTransf; # Pier 1\n');
fprintf(ft,' element elasticBeamColumn 2223 227 236 $Acol_12 $Es $Icol_12mod $PDeltaTransf; # Pier 2\n');
fprintf(ft,' element elasticBeamColumn 2324 237 246 $Acol_12 $Es $Icol_12mod $PDeltaTransf; # Pier 3\n');
fprintf(ft,' element elasticBeamColumn 3132 317 326 $Acol_12 $Es $Icol_12mod $PDeltaTransf; # Pier 1\n');
fprintf(ft,' element elasticBeamColumn 3233 327 336 $Acol_12 $Es $Icol_12mod $PDeltaTransf; # Pier 2\n');
fprintf(ft,' element elasticBeamColumn 3334 337 346 $Acol_12 $Es $Icol_12mod $PDeltaTransf; # Pier 3\n');
fprintf(ft,' element elasticBeamColumn 4142 417 426 $Acol_12 $Es $Icol_12mod $PDeltaTransf; # Pier 1\n');
fprintf(ft,' element elasticBeamColumn 4243 427 436 $Acol_12 $Es $Icol_12mod $PDeltaTransf; # Pier 2\n');
fprintf(ft,' element elasticBeamColumn 4344 437 446 $Acol_12 $Es $Icol_12mod $PDeltaTransf; # Pier 3\n');
fprintf(ft,' \n');
fprintf(ft,' # define elastic beam elements\n');
fprintf(ft,' # eleID convention: "2xy" where 2 = beam, x = Bay #, y = Floor #\n');
fprintf(ft,' # Beams Story 1\n');
fprintf(ft,' element elasticBeamColumn 1222 122 223 $Abeam_23 $Es $Ibeam_23mod $PDeltaTransf;\n');
fprintf(ft,' element elasticBeamColumn 2232 222 323 $Abeam_23 $Es $Ibeam_23mod $PDeltaTransf;\n');
fprintf(ft,' element elasticBeamColumn 3242 322 423 $Abeam_23 $Es $Ibeam_23mod $PDeltaTransf;\n');
fprintf(ft,' element elasticBeamColumn 4252 422 523 $Abeam_23 $Es $Ibeam_23mod $PDeltaTransf;\n');
fprintf(ft,' # Beams Story 2\n');
fprintf(ft,' element elasticBeamColumn 1322 132 233 $Abeam_23 $Es $Ibeam_23mod $PDeltaTransf;\n');
fprintf(ft,' element elasticBeamColumn 2332 232 333 $Abeam_23 $Es $Ibeam_23mod $PDeltaTransf;\n');
fprintf(ft,' element elasticBeamColumn 3342 332 433 $Abeam_23 $Es $Ibeam_23mod $PDeltaTransf;\n');
fprintf(ft,' element elasticBeamColumn 4352 432 533 $Abeam_23 $Es $Ibeam_23mod $PDeltaTransf;\n');
fprintf(ft,' \n');
fprintf(ft,' # Beams Story 3\n');
fprintf(ft,' element elasticBeamColumn 1422 142 243 $Abeam_23 $Es $Ibeam_23mod $PDeltaTransf;\n');
fprintf(ft,' element elasticBeamColumn 2432 242 343 $Abeam_23 $Es $Ibeam_23mod $PDeltaTransf;\n');
fprintf(ft,' element elasticBeamColumn 3442 342 443 $Abeam_23 $Es $Ibeam_23mod $PDeltaTransf;\n');
fprintf(ft,' element elasticBeamColumn 4452 442 543 $Abeam_23 $Es $Ibeam_23mod $PDeltaTransf;\n');
fprintf(ft,' \n');
fprintf(ft,' # define p-delta columns and rigid links\n');
fprintf(ft,' set TrussMatID 600; # define a material ID\n');
fprintf(ft,' set Arigid 1000.0; # define area of truss section (make much larger than A of frame elements)\n');
fprintf(ft,' set Irigid 100000.0; # moment of inertia for p-delta columns (make much larger than I of frame elements)\n');
fprintf(ft,' uniaxialMaterial Elastic $TrussMatID $Es; # define truss material\n');
fprintf(ft,' # rigid links\n');
fprintf(ft,' # command: element truss $eleID $iNode $jNode $A $materialID\n');
fprintf(ft,' # eleID convention: 6xy, 6 = truss link, x = Bay #, y = Floor #\n');
fprintf(ft,' element truss 5262 52 62 $Arigid $TrussMatID; # Floor 2\n');
fprintf(ft,' element truss 5363 53 63 $Arigid $TrussMatID; # Floor 3\n');
fprintf(ft,' element truss 5464 54 64 $Arigid $TrussMatID; # Floor 4\n');
fprintf(ft,' \n');
fprintf(ft,' # p-delta columns\n');
fprintf(ft,' # eleID convention: 7xy, 7 = p-delta columns, x = Pier #, y = Story #\n');
fprintf(ft,' element elasticBeamColumn 6162 61 626 $Arigid $Es $Irigid $PDeltaTransf; # Story 1\n');
fprintf(ft,' element elasticBeamColumn 6263 627 636 $Arigid $Es $Irigid $PDeltaTransf; # Story 2\n');
fprintf(ft,' element elasticBeamColumn 6364 637 646 $Arigid $Es $Irigid $PDeltaTransf; # Story 2\n');
fprintf(ft,' \n');
fprintf(ft,' # display the model with the node numbers\n');
fprintf(ft,' DisplayModel2D NodeNumbers\n');
fprintf(ft,' \n');
fprintf(ft,' ###################################################################################################\n');
fprintf(ft,' # Define Rotational Springs for Plastic Hinges \n');
fprintf(ft,' ###################################################################################################\n');
fprintf(ft,' # define rotational spring properties and create spring elements using "rotSpring2DModIKModel" procedure\n');
fprintf(ft,' # rotSpring2DModIKModel creates a uniaxial material spring with a bilinear response based on Modified Ibarra Krawinkler Deterioration Model\n');
fprintf(ft,' # references provided in rotSpring2DModIKModel.tcl\n');
fprintf(ft,' # input values for Story 1 column springs\n');
fprintf(ft,' set McMy 1.05; # ratio of capping moment to yield moment, Mc / My\n');
fprintf(ft,' set LS 1000.0; # basic strength deterioration (a very large # = no cyclic deterioration)\n');
fprintf(ft,' set LK 1000.0; # unloading stiffness deterioration (a very large # = no cyclic deterioration)\n');
fprintf(ft,' set LA 1000.0; # accelerated reloading stiffness deterioration (a very large # = no cyclic deterioration)\n');
fprintf(ft,' set LD 1000.0; # post-capping strength deterioration (a very large # = no deterioration)\n');
fprintf(ft,' set cS 1.0; # exponent for basic strength deterioration (c = 1.0 for no deterioration)\n');
fprintf(ft,' set cK 1.0; # exponent for unloading stiffness deterioration (c = 1.0 for no deterioration)\n');
fprintf(ft,' set cA 1.0; # exponent for accelerated reloading stiffness deterioration (c = 1.0 for no deterioration)\n');
fprintf(ft,' set cD 1.0; # exponent for post-capping strength deterioration (c = 1.0 for no deterioration)\n');
fprintf(ft,' set th_pP 0.025; # plastic rot capacity for pos loading\n');
fprintf(ft,' set th_pN 0.025; # plastic rot capacity for neg loading\n');
fprintf(ft,' set th_pcP 0.3; # post-capping rot capacity for pos loading\n');
fprintf(ft,' set th_pcN 0.3; # post-capping rot capacity for neg loading\n');
fprintf(ft,' set ResP 0.4; # residual strength ratio for pos loading\n');
fprintf(ft,' set ResN 0.4; # residual strength ratio for neg loading\n');
fprintf(ft,' set th_uP 0.4; # ultimate rot capacity for pos loading\n');
fprintf(ft,' set th_uN 0.4; # ultimate rot capacity for neg loading\n');
fprintf(ft,' set DP 1.0; # rate of cyclic deterioration for pos loading\n');
fprintf(ft,' set DN 1.0; # rate of cyclic deterioration for neg loading\n');
fprintf(ft,' set a_mem [expr ($n+1.0)*($Mycol_12*($McMy-1.0)) / ($Ks_col_1*$th_pP)]; # strain hardening ratio of spring\n');
fprintf(ft,' set b [expr ($a_mem)/(1.0+$n*(1.0-$a_mem))]; # modified strain hardening ratio of spring (Ibarra & Krawinkler 2005, note: Eqn B.5 is incorrect)\n');
fprintf(ft,' \n');
fprintf(ft,' # define column springs\n');
fprintf(ft,' # Spring ID: "3xya", where 3 = col spring, x = Pier #, y = Story #, a = location in story\n');
fprintf(ft,' # "a" convention: 1 = bottom of story, 2 = top of story\n');
fprintf(ft,' # 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-\n');
fprintf(ft,' # col springs @ bottom of Story 1 (at base)\n');
fprintf(ft,' rotSpring2DModIKModel 11117 11 117 $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;\n');
fprintf(ft,' rotSpring2DModIKModel 12126 12 126 $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;\n');
fprintf(ft,' rotSpring2DModIKModel 12127 12 127 $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;\n');
fprintf(ft,' rotSpring2DModIKModel 13136 13 136 $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;\n');
fprintf(ft,' rotSpring2DModIKModel 13137 13 137 $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;\n');
fprintf(ft,' rotSpring2DModIKModel 14146 14 146 $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;\n');
fprintf(ft,' rotSpring2DModIKModel 51517 51 517 $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;\n');
fprintf(ft,' rotSpring2DModIKModel 52526 52 526 $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;\n');
fprintf(ft,' rotSpring2DModIKModel 52527 52 527 $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;\n');
fprintf(ft,' rotSpring2DModIKModel 53536 53 536 $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;\n');
fprintf(ft,' rotSpring2DModIKModel 53537 53 537 $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;\n');
fprintf(ft,' rotSpring2DModIKModel 54546 54 546 $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;\n');
fprintf(ft,' #col springs @ top of Grup 2 (below Floor 2)\n');
fprintf(ft,' rotSpring2DModIKModel 21217 21 217 $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;\n');
fprintf(ft,' rotSpring2DModIKModel 22226 22 226 $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;\n');
fprintf(ft,' rotSpring2DModIKModel 22227 22 227 $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;\n');
fprintf(ft,' rotSpring2DModIKModel 23236 23 236 $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;\n');
fprintf(ft,' rotSpring2DModIKModel 23237 23 237 $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;\n');
fprintf(ft,' rotSpring2DModIKModel 24246 24 246 $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;\n');
fprintf(ft,' rotSpring2DModIKModel 31317 31 317 $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;\n');
fprintf(ft,' rotSpring2DModIKModel 32326 32 326 $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;\n');
fprintf(ft,' rotSpring2DModIKModel 32327 32 327 $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;\n');
fprintf(ft,' rotSpring2DModIKModel 33336 33 336 $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;\n');
fprintf(ft,' rotSpring2DModIKModel 33337 33 337 $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;\n');
fprintf(ft,' rotSpring2DModIKModel 34346 34 346 $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;\n');
fprintf(ft,' rotSpring2DModIKModel 41417 41 417 $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;\n');
fprintf(ft,' rotSpring2DModIKModel 42426 42 426 $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;\n');
fprintf(ft,' rotSpring2DModIKModel 42427 42 427 $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;\n');
fprintf(ft,' rotSpring2DModIKModel 43436 43 436 $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;\n');
fprintf(ft,' rotSpring2DModIKModel 43437 43 437 $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;\n');
fprintf(ft,' rotSpring2DModIKModel 44446 44 446 $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;\n');
fprintf(ft,' # create region for frame column springs\n');
fprintf(ft,' # command: region $regionID -ele $ele_1_ID $ele_2_ID...\n');
fprintf(ft,' region 1 -ele 11117 12126 12127 13136 13137 141346 51517 52526 52527 53536 53537 54546 21217 22226 22227 23236 23237 24246 31317 32326 32327 33336 33337 34346 41417 42426 42427 43436 43437 44446;\n');
fprintf(ft,' \n');
fprintf(ft,' # define beam springs\n');
fprintf(ft,' # Spring ID: "4xya", where 4 = beam spring, x = Bay #, y = Floor #, a = location in bay\n');
fprintf(ft,' # "a" convention: 1 = left end, 2 = right end\n');
fprintf(ft,' # redefine the rotations since they are not the same\n');
fprintf(ft,' set th_pP 0.02;\n');
fprintf(ft,' set th_pN 0.02;\n');
fprintf(ft,' set th_pcP 0.16;\n');
fprintf(ft,' set th_pcN 0.16;\n');
fprintf(ft,' set a_mem [expr ($n+1.0)*($Mybeam_23*($McMy-1.0)) / ($Ks_beam_23*$th_pP)]; # strain hardening ratio of spring\n');
fprintf(ft,' set b [expr ($a_mem)/(1.0+$n*(1.0-$a_mem))]; # modified strain hardening ratio of spring (Ibarra & Krawinkler 2005, note: there is mistake in Eqn B.5)\n');
fprintf(ft,' #beam springs at Floor 2 \n');
fprintf(ft,' rotSpring2DModIKModel 12122 12 122 $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;\n');
fprintf(ft,' rotSpring2DModIKModel 22223 22 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;\n');
fprintf(ft,' rotSpring2DModIKModel 22222 22 222 $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;\n');
fprintf(ft,' rotSpring2DModIKModel 32323 32 323 $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;\n');
fprintf(ft,' rotSpring2DModIKModel 32322 32 322 $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;\n');
fprintf(ft,' rotSpring2DModIKModel 42423 42 423 $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;\n');
fprintf(ft,' rotSpring2DModIKModel 42422 42 422 $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;\n');
fprintf(ft,' rotSpring2DModIKModel 52523 52 523 $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;\n');
fprintf(ft,' #beam springs at Floor 3 \n');
fprintf(ft,' rotSpring2DModIKModel 13132 13 132 $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;\n');
fprintf(ft,' rotSpring2DModIKModel 23233 23 233 $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;\n');
fprintf(ft,' rotSpring2DModIKModel 23232 23 232 $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;\n');
fprintf(ft,' rotSpring2DModIKModel 33333 33 333 $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;\n');
fprintf(ft,' rotSpring2DModIKModel 33332 33 332 $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;\n');
fprintf(ft,' rotSpring2DModIKModel 43433 43 433 $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;\n');
fprintf(ft,' rotSpring2DModIKModel 43432 43 432 $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;\n');
fprintf(ft,' rotSpring2DModIKModel 53533 53 533 $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;\n');
fprintf(ft,' #beam springs at Floor 4 \n');
fprintf(ft,' rotSpring2DModIKModel 14142 14 142 $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;\n');
fprintf(ft,' rotSpring2DModIKModel 24243 24 243 $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;\n');
fprintf(ft,' rotSpring2DModIKModel 24242 24 242 $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;\n');
fprintf(ft,' rotSpring2DModIKModel 34343 34 343 $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;\n');
fprintf(ft,' rotSpring2DModIKModel 34342 34 342 $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;\n');
fprintf(ft,' rotSpring2DModIKModel 44443 44 443 $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;\n');
fprintf(ft,' rotSpring2DModIKModel 44442 44 442 $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;\n');
fprintf(ft,' rotSpring2DModIKModel 54543 54 543 $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;\n');
fprintf(ft,' \n');
fprintf(ft,' # create region for beam springs\n');
fprintf(ft,' region 2 -ele 12122 22223 22222 32323 32322 42423 42422 52523 13132 23233 23232 33333 33332 43433 43432 53533 14142 24243 24242 34343 34342 44443 44442 54543;\n');
fprintf(ft,' \n');
fprintf(ft,' # define p-delta column spring: zero-stiffness elastic spring \n');
fprintf(ft,' #Spring ID: "5xya" where 5 = leaning column spring, x = Pier #, y = Story #, a = location in story\n');
fprintf(ft,' # "a" convention: 1 = bottom of story, 2 = top of story\n');
fprintf(ft,' # rotLeaningCol ElemID ndR ndC \n');
fprintf(ft,' rotLeaningCol 62626 62 626; # top of Story 1\n');
fprintf(ft,' rotLeaningCol 62627 62 627; # bottom of Story 2\n');
fprintf(ft,' rotLeaningCol 63636 63 636; # top of Story 2\n');
fprintf(ft,' rotLeaningCol 63637 63 637; # top of Story 1\n');
fprintf(ft,' rotLeaningCol 64646 64 646; # bottom of Story 2\n');
fprintf(ft,' \n');
fprintf(ft,' # create region for P-Delta column springs\n');
fprintf(ft,' region 3 -ele 62626 62627 63636 63637 64646 ;\n');
fprintf(ft,' \n');
fprintf(ft,' ############################################################################\n');
fprintf(ft,' # Eigenvalue Analysis \n');
fprintf(ft,' ############################################################################\n');
fprintf(ft,' set pi [expr 2.0*asin(1.0)]; # Definition of pi\n');
fprintf(ft,' set nEigenI 1; # mode i = 1\n');
fprintf(ft,' set nEigenJ 2; # mode j = 2\n');
fprintf(ft,' set lambdaN [eigen [expr $nEigenJ]]; # eigenvalue analysis for nEigenJ modes\n');
fprintf(ft,' set lambdaI [lindex $lambdaN [expr 0]]; # eigenvalue mode i = 1\n');
fprintf(ft,' set lambdaJ [lindex $lambdaN [expr $nEigenJ-1]]; # eigenvalue mode j = 2\n');
fprintf(ft,' set w1 [expr pow($lambdaI,0.5)]; # w1 (1st mode circular frequency)\n');
fprintf(ft,' set w2 [expr pow($lambdaJ,0.5)]; # w2 (2nd mode circular frequency)\n');
fprintf(ft,' set T1 [expr 2.0*$pi/$w1]; # 1st mode period of the structure\n');
fprintf(ft,' set T2 [expr 2.0*$pi/$w2]; # 2nd mode period of the structure\n');
fprintf(ft,' puts "T1 = $T1 s"\n');
fprintf(ft,' puts "T2 = $T2 s"\n');
fprintf(ft,' \n');
fprintf(ft,' ############################################################################\n');
fprintf(ft,' # Gravity Loads & Gravity Analysis\n');
fprintf(ft,' ############################################################################\n');
fprintf(ft,' # apply gravity loads\n');
fprintf(ft,' #command: pattern PatternType $PatternID TimeSeriesType\n');
fprintf(ft,' pattern Plain 101 Constant {\n');
fprintf(ft,' \n');
fprintf(ft,' # point loads on leaning column nodes\n');
fprintf(ft,' # command: load node Fx Fy Mz\n');
fprintf(ft,' set P_PD2 [expr -784.166]; # Floor 2\n');
fprintf(ft,' set P_PD3 [expr -784.166]; # Floor 3\n');
fprintf(ft,' set P_PD4 [expr -849.7017]; # Floor 4\n');
fprintf(ft,' load 62 0.0 $P_PD2 0.0; # Floor 2\n');
fprintf(ft,' load 63 0.0 $P_PD3 0.0; # Floor 3\n');
fprintf(ft,' load 64 0.0 $P_PD4 0.0; # Floor 4\n');
% fprintf(ft,'eleLoad -ele 1222 12 13 14 15 -type -beamUniform -%d \n',Q_total_floor);
fprintf(ft,' \n');
fprintf(ft,' # point loads on frame column nodes\n');
fprintf(ft,' set P_F2 [expr 0.5*(-1.0*$Floor2Weight-$P_PD2)]; # load on each frame node in Floor 2\n');
fprintf(ft,' set P_F3 [expr 1.0*(-1.0*$Floor3Weight-$P_PD3)]; # load on each frame node in Floor 3\n');
fprintf(ft,' set P_F4 [expr 0.5*(-1.0*$Floor4Weight-$P_PD4)]; # load on each frame node in Floor 3\n');
fprintf(ft,' set P_F5 [expr 1.0*(-1.0*$Floor4Weight-$P_PD4)]; # load on each frame node in Floor 3\n');
fprintf(ft,' # Floor 2 loads\n');
fprintf(ft,' load 12 0.0 $P_F2 0.0;\n');
fprintf(ft,' load 22 0.0 $P_F3 0.0; \n');
fprintf(ft,' load 32 0.0 $P_F3 0.0;\n');
fprintf(ft,' load 42 0.0 $P_F3 0.0; \n');
fprintf(ft,' load 52 0.0 $P_F2 0.0; \n');
fprintf(ft,' # Floor 3 loads \n');
fprintf(ft,' load 13 0.0 $P_F2 0.0;\n');
fprintf(ft,' load 23 0.0 $P_F3 0.0;\n');
fprintf(ft,' load 33 0.0 $P_F3 0.0;\n');
fprintf(ft,' load 43 0.0 $P_F3 0.0;\n');
fprintf(ft,' load 53 0.0 $P_F2 0.0;\n');
fprintf(ft,' # Floor 4 loads \n');
fprintf(ft,' load 14 0.0 $P_F4 0.0;\n');
fprintf(ft,' load 24 0.0 $P_F5 0.0;\n');
fprintf(ft,' load 34 0.0 $P_F5 0.0;\n');
fprintf(ft,' load 44 0.0 $P_F5 0.0;\n');
fprintf(ft,' load 54 0.0 $P_F4 0.0;\n');
fprintf(ft,' }\n');
fprintf(ft,' \n');
fprintf(ft,' # Gravity-analysis: load-controlled static analysis\n');
fprintf(ft,' set Tol 1.0e-6; # convergence tolerance for test\n');
fprintf(ft,' variable constraintsTypeGravity Plain; # default;\n');
fprintf(ft,' constraints $constraintsTypeGravity ; # how it handles boundary conditions\n');
fprintf(ft,' numberer RCM; # renumber dofs to minimize band-width (optimization)\n');
fprintf(ft,' system BandGeneral ; # how to store and solve the system of equations in the analysis (large model: try UmfPack)\n');
fprintf(ft,' test NormDispIncr $Tol 6 ; # determine if convergence has been achieved at the end of an iteration step\n');
fprintf(ft,' algorithm Newton; # use Newtons solution algorithm: updates tangent stiffness at every iteration\n');
fprintf(ft,' set NstepGravity 10; # apply gravity in 10 steps\n');
fprintf(ft,' set DGravity [expr 1.0/$NstepGravity]; # first load increment;\n');
fprintf(ft,' integrator LoadControl $DGravity; # determine the next time step for an analysis\n');
fprintf(ft,' analysis Static; # define type of analysis static or transient\n');
fprintf(ft,' analyze $NstepGravity; # apply gravity\n');
fprintf(ft,' \n');
fprintf(ft,' # maintain constant gravity loads and reset time to zero\n');
fprintf(ft,' loadConst -time 0.0\n');
fprintf(ft,' puts "Model Built"\n');
fprintf(ft,' \n');
fprintf(ft,' ############################################################################\n');
fprintf(ft,' # Recorders \n');
fprintf(ft,' ############################################################################\n');
fprintf(ft,' # record drift histories\n');
fprintf(ft,' # drift recorder command: recorder Drift -file $filename -iNode $NodeI_ID -jNode $NodeJ_ID -dof $dof -perpDirn $Record.drift.perpendicular.to.this.direction\n');
fprintf(ft,' recorder Drift -file $dataDir/Drift-Story1.out -iNode 11 -jNode 12 -dof 1 -perpDirn 2;\n');
fprintf(ft,' recorder Drift -file $dataDir/Drift-Story2.out -iNode 12 -jNode 13 -dof 1 -perpDirn 2;\n');
fprintf(ft,' recorder Drift -file $dataDir/Drift-Story3.out -iNode 13 -jNode 14 -dof 1 -perpDirn 2;\n');
fprintf(ft,' recorder Drift -file $dataDir/Drift-Roof.out -iNode 11 -jNode 14 -dof 1 -perpDirn 2;\n');
fprintf(ft,' \n');
fprintf(ft,' # record base shear reactions\n');
fprintf(ft,' recorder Node -file $dataDir/Vbase.out -node 117 217 317 417 517 61 -dof 1 reaction; \n');
fprintf(ft,' \n');
fprintf(ft,' # record story 1 column forces in global coordinates \n');
fprintf(ft,' recorder Element -file $dataDir/Fcol1112.out -ele 1112 force;\n');
fprintf(ft,' recorder Element -file $dataDir/Fcol2122.out -ele 2122 force;\n');
fprintf(ft,' recorder Element -file $dataDir/Fcol3132.out -ele 3132 force;\n');
fprintf(ft,' recorder Element -file $dataDir/Fcol4142.out -ele 4142 force;\n');
fprintf(ft,' recorder Element -file $dataDir/Fcol5152.out -ele 5152 force;\n');
fprintf(ft,' recorder Element -file $dataDir/Fcol6162.out -ele 6162 force;\n');
fprintf(ft,' \n');
fprintf(ft,' # record response history of all frame column springs (one file for moment, one for rotation)\n');
fprintf(ft,' recorder Element -file $dataDir/MRFcol-Mom-Hist.out -region 1 force;\n');
fprintf(ft,' recorder Element -file $dataDir/MRFcol-Rot-Hist.out -region 1 deformation;\n');
fprintf(ft,' \n');
fprintf(ft,' # record response history of all frame beam springs (one file for moment, one for rotation)\n');
fprintf(ft,' recorder Element -file $dataDir/MRFbeam-Mom-Hist.out -region 2 force;\n');
fprintf(ft,' recorder Element -file $dataDir/MRFbeam-Rot-Hist.out -region 2 deformation;\n');
fprintf(ft,' \n');
fprintf(ft,' #######################################################################################\n');
fprintf(ft,' # #\n');
fprintf(ft,' # Analysis Section #\n');
fprintf(ft,' # #\n');
fprintf(ft,' #######################################################################################\n');
fprintf(ft,' \n');
fprintf(ft,' ############################################################################\n');
fprintf(ft,' # Pushover Analysis #\n');
fprintf(ft,' ############################################################################\n');
fprintf(ft,' if {$analysisType == "pushover"} { \n');
fprintf(ft,' puts "Running Pushover..." \n');
fprintf(ft,' # assign lateral loads and create load pattern: use ASCE 7-10 distribution\n');
fprintf(ft,' set lat2 0.068; # force on each frame node in Floor 2\n');
fprintf(ft,' set lat3 0.271; # force on each frame node in Floor 3\n');
fprintf(ft,' set lat4 0.661; # force on each frame node in Floor 4\n');
fprintf(ft,' pattern Plain 200 Linear { \n');
fprintf(ft,' load 12 $lat2 0.0 0.0;\n');
fprintf(ft,' load 22 $lat2 0.0 0.0;\n');
fprintf(ft,' load 32 $lat2 0.0 0.0;\n');
fprintf(ft,' load 42 $lat2 0.0 0.0;\n');
fprintf(ft,' load 52 $lat2 0.0 0.0;\n');
fprintf(ft,' load 13 $lat3 0.0 0.0;\n');
fprintf(ft,' load 23 $lat3 0.0 0.0;\n');
fprintf(ft,' load 33 $lat3 0.0 0.0;\n');
fprintf(ft,' load 43 $lat3 0.0 0.0;\n');
fprintf(ft,' load 53 $lat3 0.0 0.0;\n');
fprintf(ft,' load 14 $lat4 0.0 0.0;\n');
fprintf(ft,' load 24 $lat4 0.0 0.0;\n');
fprintf(ft,' load 34 $lat4 0.0 0.0;\n');
fprintf(ft,' load 44 $lat4 0.0 0.0;\n');
fprintf(ft,' load 54 $lat4 0.0 0.0;\n');
fprintf(ft,' }\n');
fprintf(ft,' \n');
fprintf(ft,' # display deformed shape:\n');
fprintf(ft,' set ViewScale 5;\n');
fprintf(ft,' DisplayModel2D DeformedShape $ViewScale ; # display deformed shape, the scaling factor needs to be adjusted for each model\n');
fprintf(ft,' \n');
fprintf(ft,' # displacement parameters\n');
fprintf(ft,' set IDctrlNode 14; # node where disp is read for disp control\n');
fprintf(ft,' set IDctrlDOF 1; # degree of freedom read for disp control (1 = x displacement)\n');
fprintf(ft,' set Dmax [expr 0.05*$HBuilding]; # maximum displacement of pushover 10 roof drift \n');
fprintf(ft,' set Dincr [expr 0.01]; # displacement increment\n');
fprintf(ft,' \n');
fprintf(ft,' # analysis commands\n');
fprintf(ft,' constraints Plain; # how it handles boundary conditions\n');
fprintf(ft,' numberer RCM; # renumber dofs to minimize band-width (optimization)\n');
fprintf(ft,' system BandGeneral; # how to store and solve the system of equations in the analysis (large model: try UmfPack)\n');
fprintf(ft,' test NormUnbalance 1.0e-6 400; # tolerance, max iterations\n');
fprintf(ft,' algorithm Newton; # use Newtons solution algorithm: updates tangent stiffness at every iteration\n');
fprintf(ft,' integrator DisplacementControl $IDctrlNode $IDctrlDOF $Dincr; # use displacement-controlled analysis\n');
fprintf(ft,' analysis Static; # define type of analysis: static for pushover\n');
fprintf(ft,' set Nsteps [expr int($Dmax/$Dincr)];# number of pushover analysis steps\n');
fprintf(ft,' set ok [analyze $Nsteps]; # this will return zero if no convergence problems were encountered\n');
fprintf(ft,' puts "Pushover complete"; # display this message in the command window\n');
fprintf(ft,' } \n');
fprintf(ft,' wipe all;\n');
fclose(ft);
!opensees Concentrated.txt

Categorías

Más información sobre Text Data Preparation en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by