OpenSeesPyAssistant 1.1
OpenSeesPy for everyone
Analysis Class Reference

Class dedicated to the analysis of the OpenSeesPy model. More...

Public Member Functions

def __init__ (self, str data_dir, str name_ODB, algo="KrylovNewton", test_type="NormDispIncr", test_opt=0, max_iter=MAX_ITER, tol=TOL, allow_smaller_step=False)
 The constructor of the class. More...
 
def DeformedShape (self, scale=1, animate=False, dt=0.01)
 Method that shows the final deformed shape of the model. More...
 
def FiberResponse (self, int ele_fiber_ID_analysed, fiber_section=1, animate_stress=False, animate_strain=False, fps=25)
 Method that shows the final stress response of the fiber section chosen. More...
 
def Gravity (self, list loaded_nodes, list Fy, int timeSeries_ID, int pattern_ID, n_step=10, timeSeries_type="Linear", pattern_type="Plain", constraints_type="Plain", numberer_type="RCM", system_type="BandGeneral", analysis_type="Static", show_plot=False)
 Method to perform the gravity analyisis with vertical loadings (load-control). More...
 
def LateralForce (self, list loaded_nodes, list Fx, int timeSeries_ID, int pattern_ID, n_step=1000, fiber_ID_analysed=-1, fiber_section=1, timeSeries_type="Linear", pattern_type="Plain", constraints_type="Plain", numberer_type="RCM", system_type="BandGeneral", analysis_type="Static", show_plot=True, block=False)
 Method to perform the lateral force analyisis with lateral loading (load-control). More...
 
def LoadingProtocol (self, int CtrlNode, np.ndarray discr_LP, int timeSeries_ID, int pattern_ID, Fx=1 *kN_unit, ele_fiber_ID_analysed=-1, fiber_section=1, timeSeries_type="Linear", pattern_type="Plain", constraints_type="Plain", numberer_type="RCM", system_type="UmfPack", analysis_type="Static", show_plot=True, block=False)
 Method to perform a loading protocol analysis (displacement-control). More...
 
def Pushover (self, int CtrlNode, Dmax, Dincr, int timeSeries_ID, int pattern_ID, Fx=1 *kN_unit, ele_fiber_ID_analysed=-1, fiber_section=1, timeSeries_type="Linear", pattern_type="Plain", constraints_type="Plain", numberer_type="RCM", system_type="UmfPack", analysis_type="Static", show_plot=True, block=False)
 Method to perform a pushover analysis (displacement-control). More...
 

Public Attributes

 algo
 
 allow_smaller_step
 
 data_dir
 
 load_case
 
 max_iter
 
 name_ODB
 
 test_opt
 
 test_type
 
 tol
 

Detailed Description

Class dedicated to the analysis of the OpenSeesPy model.

The Gravity method should be run first to perform the Load-control analysis (apply the vertical load). If no vertical load, this method can be omitted.
Then only one of the Displacement-control (Pushover or LoadingProtocol) or Load-control (LateralForce) analysis can ran.
After the analysis reach convergence in the last step, for the postprocessing, the DeformedShape method can be used to see the final deformed shape and the animation of the entire loading protocol; the FiberResponse method can be used to see the animation of the same fiber section recorded during the analysis (strain and/or stress).

Definition at line 16 of file AnalysisAndPostProcessing.py.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
str  data_dir,
str  name_ODB,
  algo = "KrylovNewton",
  test_type = "NormDispIncr",
  test_opt = 0,
  max_iter = MAX_ITER,
  tol = TOL,
  allow_smaller_step = False 
)

The constructor of the class.

Parameters
data_dir(str): Directory in which the results from the analysis will be stored. Use the recorders (from OpenSeesPy) or the Record method from MemberModel.
name_ODB(str): Name for the folder in which the data for the animations and the fibers are stored.
algo(str, optional): Type of alghoritm chosen for the analysis. It detemines how to construct a SolutionAlgorithm object, which determines the sequence of steps taken to solve the non-linear equation. For more information on the available types, see the OpenSeesPy documentation. Defaults to "KrylovNewton".
test_type(str, optional): Type of test chosen for the analysis. It determines how to construct a ConvergenceTest object. Certain SolutionAlgorithm objects require a ConvergenceTest object to determine if convergence has been achieved at the end of an iteration step. For more information on the available types, see the OpenSeesPy documentation. Defaults to "NormDispIncr".
test_opt(int, optional): Print-flag from 0 to 5 used to receive more info during the iteration (for example: 0 print nothing and 2 print information on norms and number of iterations at end of successful test). For more information, see the OpenSeesPy documentation. Defaults to 0.
max_iter(float, optional): Maximal number of iterations to check. Defaults to MAX_ITER (from Constants Module).
tol(float, optional): Tolerance criteria used to check for convergence. Defaults to TOL (from Constants Module).
allow_smaller_step(bool, optional): Allow smaller steps in the displacement-control analysis. Defaults to False.
Exceptions
NegativeValueThe argument max_iter should be positive.
NegativeValueThe argument tol should be positive.

Definition at line 22 of file AnalysisAndPostProcessing.py.

22 def __init__(self, data_dir: str, name_ODB: str, algo = "KrylovNewton", test_type = "NormDispIncr", test_opt = 0, max_iter = MAX_ITER, tol = TOL, allow_smaller_step = False):
23 """
24 The constructor of the class.
25
26 @param data_dir (str): Directory in which the results from the analysis will be stored. Use the recorders (from OpenSeesPy) or the Record method from MemberModel.
27 @param name_ODB (str): Name for the folder in which the data for the animations and the fibers are stored.
28 @param algo (str, optional): Type of alghoritm chosen for the analysis. It detemines how to construct a SolutionAlgorithm object, which determines the sequence of steps taken to solve the non-linear equation.
29 For more information on the available types, see the OpenSeesPy documentation. Defaults to "KrylovNewton".
30 @param test_type (str, optional): Type of test chosen for the analysis. It determines how to construct a ConvergenceTest object.
31 Certain SolutionAlgorithm objects require a ConvergenceTest object to determine if convergence has been achieved at the end of an iteration step.
32 For more information on the available types, see the OpenSeesPy documentation. Defaults to "NormDispIncr".
33 @param test_opt (int, optional): Print-flag from 0 to 5 used to receive more info during the iteration
34 (for example: 0 print nothing and 2 print information on norms and number of iterations at end of successful test).
35 For more information, see the OpenSeesPy documentation. Defaults to 0.
36 @param max_iter (float, optional): Maximal number of iterations to check. Defaults to MAX_ITER (from Constants Module).
37 @param tol (float, optional): Tolerance criteria used to check for convergence. Defaults to TOL (from Constants Module).
38 @param allow_smaller_step (bool, optional): Allow smaller steps in the displacement-control analysis. Defaults to False.
39
40 @exception NegativeValue: The argument max_iter should be positive.
41 @exception NegativeValue: The argument tol should be positive.
42 """
43 if max_iter < 0: raise NegativeValue()
44 if tol < 0: raise NegativeValue()
45 if not os.path.exists(data_dir):
46 print("Folder {} not found in this directory; creating one".format(data_dir))
47 os.makedirs(data_dir)
48
49 self.data_dir = data_dir
50 self.name_ODB = name_ODB
51 self.algo = algo
52 self.test_type = test_type
53 self.tol = tol
54 self.test_opt = test_opt
55 self.max_iter = max_iter
56 self.allow_smaller_step = allow_smaller_step
57 self.load_case = "None"
58
59

Member Function Documentation

◆ DeformedShape()

def DeformedShape (   self,
  scale = 1,
  animate = False,
  dt = 0.01 
)

Method that shows the final deformed shape of the model.

It can also show the animation that shows how the model behaved during the analysis.

Parameters
scale(int, optional): The scaling factor to magnify the deformation. The value should be adjusted for each model. Defaults to 1.
animate(bool, optional): Option to show the animation of the model during the analysis. Defaults to False.
dt(float, optional): The time step between every iteration. Defaults to 0.01.
Exceptions
NameErrorThe methods for the analysis were not called.

Definition at line 652 of file AnalysisAndPostProcessing.py.

652 def DeformedShape(self, scale = 1, animate = False, dt = 0.01):
653 """
654 Method that shows the final deformed shape of the model. It can also show the animation that shows how the model behaved during the analysis.
655
656 @param scale (int, optional): The scaling factor to magnify the deformation. The value should be adjusted for each model. Defaults to 1.
657 @param animate (bool, optional): Option to show the animation of the model during the analysis. Defaults to False.
658 @param dt (float, optional): The time step between every iteration. Defaults to 0.01.
659
660 @exception NameError: The methods for the analysis were not called.
661 """
662 if self.load_case == "None": raise NameError("The analysis is not complete.")
663
664 # Display deformed shape, the scaling factor needs to be adjusted for each model
665 opsplt.plot_deformedshape(Model = self.name_ODB, LoadCase=self.load_case, scale = scale)
666 if animate:
667 opsplt.animate_deformedshape(Model = self.name_ODB, LoadCase=self.load_case, dt = dt, scale = scale)
668
669

◆ FiberResponse()

def FiberResponse (   self,
int  ele_fiber_ID_analysed,
  fiber_section = 1,
  animate_stress = False,
  animate_strain = False,
  fps = 25 
)

Method that shows the final stress response of the fiber section chosen.

It can also show the animation that shows how the fiber section behaved during the analysis. The fiber ID and section needs to be recorded during the analysis, thus if the method LateralForce, Pushover or LoadingProtocol was used, the same fiber ID and section need to be used.

Parameters
ele_fiber_ID_analysed(int): The ID of the analysed fiber. If fibers are present in the model and the user wants to save ODB data (to use in the post-processing with for example FiberResponse), assign to this argument the ID of the fiber chosen. -1 will ignore the storage of data for fibers.
fiber_section(int, optional): The section number, i.e. the Gauss integratio number. If the fiber_ID_analysed is equal to -1, this argument is not used. Defaults to 1.
animate_stress(bool, optional): Option to show the animation of the fiber stress during the analysis. Defaults to False.
animate_strain(bool, optional): Option to show the animation of the fiber strain during the analysis. Defaults to False.
fps(int, optional): Number of frame per seconds for the animations. Defaults to 25.
Exceptions
NameErrorThe methods for the analysis were not called.

Definition at line 670 of file AnalysisAndPostProcessing.py.

670 def FiberResponse(self, ele_fiber_ID_analysed: int, fiber_section = 1, animate_stress = False, animate_strain = False, fps = 25):
671 """
672 Method that shows the final stress response of the fiber section chosen.
673 It can also show the animation that shows how the fiber section behaved during the analysis. The fiber ID and section needs to be recorded during the analysis,
674 thus if the method LateralForce, Pushover or LoadingProtocol was used, the same fiber ID and section need to be used.
675
676 @param ele_fiber_ID_analysed (int): The ID of the analysed fiber. If fibers are present in the model and the user wants to save ODB data
677 (to use in the post-processing with for example FiberResponse), assign to this argument the ID of the fiber chosen.
678 -1 will ignore the storage of data for fibers.
679 @param fiber_section (int, optional): The section number, i.e. the Gauss integratio number.
680 If the fiber_ID_analysed is equal to -1, this argument is not used. Defaults to 1.
681 @param animate_stress (bool, optional): Option to show the animation of the fiber stress during the analysis. Defaults to False.
682 @param animate_strain (bool, optional): Option to show the animation of the fiber strain during the analysis. Defaults to False.
683 @param fps (int, optional): Number of frame per seconds for the animations. Defaults to 25.
684 @exception NameError: The methods for the analysis were not called.
685 """
686 if self.load_case == "None": raise NameError("The analysis is not complete.")
687
688 opsplt.plot_fiberResponse2D(self.name_ODB, self.load_case, ele_fiber_ID_analysed, fiber_section, InputType = 'stress')
689 if animate_stress:
690 ani1 = opsplt.animate_fiberResponse2D(self.name_ODB, self.load_case, ele_fiber_ID_analysed, fiber_section, InputType = 'stress', fps = fps)
691 if animate_strain:
692 ani1 = opsplt.animate_fiberResponse2D(self.name_ODB, self.load_case, ele_fiber_ID_analysed, fiber_section, InputType = 'strain', fps = fps)
693
694

◆ Gravity()

def Gravity (   self,
list  loaded_nodes,
list  Fy,
int  timeSeries_ID,
int  pattern_ID,
  n_step = 10,
  timeSeries_type = "Linear",
  pattern_type = "Plain",
  constraints_type = "Plain",
  numberer_type = "RCM",
  system_type = "BandGeneral",
  analysis_type = "Static",
  show_plot = False 
)

Method to perform the gravity analyisis with vertical loadings (load-control).

It can be used before calling the Pushover or LoadingProtocol methods that perform the actual anlysis. If no vertical loadings present, this method can be avoided.

Parameters
loaded_nodes(list): List of nodes that are loaded by the the forces in Fy. The first node will be recorded (thus usually should be in the roof).
Fy(list): List of vertical loadings (negative is toward the ground, thus compression; see global coordinate system).
timeSeries_ID(int): ID of the timeseries.
pattern_ID(int): ID of the pattern.
n_step(int, optional): Number of steps used to during the analysis to reach the objective state (with 100% vertical loadings imposed). Defaults to 10.
timeSeries_type(str, optional): Type of timeseries chosen. For more information, see the OpenSeesPy documentation. Defaults to "Linear".
pattern_type(str, optional): Type of pattern chosen. For more information, see the OpenSeesPy documentation. Defaults to "Plain".
constraints_type(str, optional): Type of contraints chosen. It detemines how the constraint equations are enforced in the analysis. For more information, see the OpenSeesPy documentation. Defaults to "Plain".
numberer_type(str, optional): Type of numberer chosen. It determines the mapping between equation numbers and degrees-of-freedom. For more information, see the OpenSeesPy documentation. Defaults to "RCM".
system_type(str, optional): Type of system of equations chosen. It determines how to construct the LinearSOE and LinearSolver objects to store and solve the system of equations in the analysis. For more information, see the OpenSeesPy documentation. Defaults to "BandGeneral".
analysis_type(str, optional): Type of analysis chosen. It determines how to construct the Analysis object, which defines what type of analysis is to be performed. For more information, see the OpenSeesPy documentation. Defaults to "Static".
show_plot(bool, optional): Option to show the 'vertical displacement vs. vertical loading' curve after the analysis. Defaults to False.
Exceptions
WrongDimensionThe dimension of the loaded_nodes and Fy arguments needs to be the same.
NegativeValueThe ID of timeSeries_ID needs to be a positive integer.
NegativeValueThe ID of pattern_ID needs to be a positive integer.

Definition at line 60 of file AnalysisAndPostProcessing.py.

61 constraints_type = "Plain", numberer_type = "RCM", system_type = "BandGeneral", analysis_type = "Static", show_plot = False):
62 """
63 Method to perform the gravity analyisis with vertical loadings (load-control).
64 It can be used before calling the Pushover or LoadingProtocol methods that perform the actual anlysis. If no vertical loadings present, this method can be avoided.
65
66 @param loaded_nodes (list): List of nodes that are loaded by the the forces in Fy. The first node will be recorded (thus usually should be in the roof).
67 @param Fy (list): List of vertical loadings (negative is toward the ground, thus compression; see global coordinate system).
68 @param timeSeries_ID (int): ID of the timeseries.
69 @param pattern_ID (int): ID of the pattern.
70 @param n_step (int, optional): Number of steps used to during the analysis to reach the objective state (with 100% vertical loadings imposed). Defaults to 10.
71 @param timeSeries_type (str, optional): Type of timeseries chosen.
72 For more information, see the OpenSeesPy documentation. Defaults to "Linear".
73 @param pattern_type (str, optional): Type of pattern chosen.
74 For more information, see the OpenSeesPy documentation. Defaults to "Plain".
75 @param constraints_type (str, optional): Type of contraints chosen. It detemines how the constraint equations are enforced in the analysis.
76 For more information, see the OpenSeesPy documentation. Defaults to "Plain".
77 @param numberer_type (str, optional): Type of numberer chosen. It determines the mapping between equation numbers and degrees-of-freedom.
78 For more information, see the OpenSeesPy documentation. Defaults to "RCM".
79 @param system_type (str, optional): Type of system of equations chosen. It determines how to construct the LinearSOE and LinearSolver objects to store and solve the system of equations in the analysis.
80 For more information, see the OpenSeesPy documentation. Defaults to "BandGeneral".
81 @param analysis_type (str, optional): Type of analysis chosen. It determines how to construct the Analysis object, which defines what type of analysis is to be performed.
82 For more information, see the OpenSeesPy documentation. Defaults to "Static".
83 @param show_plot (bool, optional): Option to show the 'vertical displacement vs. vertical loading' curve after the analysis. Defaults to False.
84
85 @exception WrongDimension: The dimension of the loaded_nodes and Fy arguments needs to be the same.
86 @exception NegativeValue: The ID of timeSeries_ID needs to be a positive integer.
87 @exception NegativeValue: The ID of pattern_ID needs to be a positive integer.
88 """
89 if len(loaded_nodes) != len(Fy): raise WrongDimension()
90 if timeSeries_ID < 1: raise NegativeValue()
91 if pattern_ID < 1: raise NegativeValue()
92
93 # for mass defined: opsplt.createODB(self.name_ODB, "Gravity", Nmodes = nEigen);
94 # for tracking gravity with ODB: opsplt.createODB(self.name_ODB, "Gravity");
95
96 # Create load pattern
97 timeSeries(timeSeries_type, timeSeries_ID)
98 pattern(pattern_type, timeSeries_ID, pattern_ID)
99 for ii, node_ID in enumerate(loaded_nodes):
100 load(node_ID, 0.0, Fy[ii], 0.0) # load(IDNode, Fx, Fy, Mz)
101 DGravity = 1.0/n_step # load increment
102
103 # Set up analysis options
104 constraints(constraints_type) # how it handles boundary conditions
105 numberer(numberer_type) # renumber dof's to minimize band-width (optimization)
106 system(system_type) # how to store and solve the system of equations in the analysis
107 # For static model, BandGeneral, for transient and/or big model, UmfPack
108 integrator("LoadControl", DGravity) # LoadControl and DisplacementControl only with static model, linear TimeSeries w/ factor of 1
109 # Newmark used for transient model
110 algorithm("Newton") # placeholder
111 analysis(analysis_type) # define type of analysis: static for pushover
112
113 # Analysis
114 dataG = np.zeros((n_step+1,2))
115 print("")
116 print("Gravity analysis starts")
117 for iteration in range(n_step):
118 convergence = self.__LoadCtrlLoop(DGravity, iteration,
119 self.algo, self.test_type, self.tol, self.test_opt, self.max_iter)
120 if convergence != 0: break
121 dataG[iteration+1,0] = nodeDisp(loaded_nodes[0], 2)/mm_unit
122 dataG[iteration+1,1] = getLoadFactor(pattern_ID)*Fy[0]/kN_unit
123
124 if show_plot:
125 plt.plot(dataG[:,0], dataG[:,1])
126 plt.xlabel('Vertical Displacement [mm]')
127 plt.ylabel('Vertical Load [kN]')
128 plt.title('Gravity curve')
129 plt.show()
130
131 loadConst("-time", 0.0)
132
133 print("")
134 print("Gravity complete")
135
136

◆ LateralForce()

def LateralForce (   self,
list  loaded_nodes,
list  Fx,
int  timeSeries_ID,
int  pattern_ID,
  n_step = 1000,
  fiber_ID_analysed = -1,
  fiber_section = 1,
  timeSeries_type = "Linear",
  pattern_type = "Plain",
  constraints_type = "Plain",
  numberer_type = "RCM",
  system_type = "BandGeneral",
  analysis_type = "Static",
  show_plot = True,
  block = False 
)

Method to perform the lateral force analyisis with lateral loading (load-control).

If this method is called, the LoadingProtocol and Pushover methods should be avoided.

Parameters
loaded_nodes(list): List of nodes that are loaded by the the forces in Fx. The first node will be recorded (thus usually should be in the roof).
Fx(list): List of horizontal loadings (negative is toward left; see global coordinate system).
timeSeries_ID(int): ID of the timeseries.
pattern_ID(int): ID of the pattern.
n_step(int, optional): Number of steps used to during the analysis to reach the objective state (with 100% horizontal loadings imposed). Defaults to 1000.
fiber_ID_analysed(int, optional): The ID of the analysed fiber. If fibers are present in the model and the user wants to save ODB data (to use in the post-processing with for example FiberResponse), assign to this argument the ID of the fiber chosen. -1 will ignore the storage of data for fibers. Defaults to -1.
fiber_section(int, optional): The section number, i.e. the Gauss integratio number. If the fiber_ID_analysed is equal to -1, this argument is not used. Defaults to 1.
timeSeries_type(str, optional): Type of timeseries chosen. For more information, see the OpenSeesPy documentation. Defaults to "Linear".
pattern_type(str, optional): Type of pattern chosen. For more information, see the OpenSeesPy documentation. Defaults to "Plain".
constraints_type(str, optional): Type of contraints chosen. It detemines how the constraint equations are enforced in the analysis. For more information, see the OpenSeesPy documentation. Defaults to "Plain".
numberer_type(str, optional): Type of numberer chosen. It determines the mapping between equation numbers and degrees-of-freedom. For more information, see the OpenSeesPy documentation. Defaults to "RCM".
system_type(str, optional): Type of system of equations chosen. It determines how to construct the LinearSOE and LinearSolver objects to store and solve the system of equations in the analysis. For more information, see the OpenSeesPy documentation. Defaults to "BandGeneral".
analysis_type(str, optional): Type of analysis chosen. It determines how to construct the Analysis object, which defines what type of analysis is to be performed. For more information, see the OpenSeesPy documentation. Defaults to "Static".
show_plot(bool, optional): Option to show the 'Horizontal displacement vs. Horizontal loading' curve after the analysis. Defaults to True.
block(bool, optional): Option to wait the user command 'plt.show()' (avoiding the stop of the program everytime that a plot should pop up). Defaults to False.
Exceptions
WrongDimensionThe dimension of the loaded_nodes and Fx arguments needs to be the same.
NegativeValueThe ID of timeSeries_ID needs to be a positive integer.
NegativeValueThe ID of pattern_ID needs to be a positive integer.
NegativeValueThe ID of fiber_ID_analysed needs to be a positive integer.

Definition at line 137 of file AnalysisAndPostProcessing.py.

139 show_plot = True, block = False):
140 """
141 Method to perform the lateral force analyisis with lateral loading (load-control).
142 If this method is called, the LoadingProtocol and Pushover methods should be avoided.
143
144 @param loaded_nodes (list): List of nodes that are loaded by the the forces in Fx. The first node will be recorded (thus usually should be in the roof).
145 @param Fx (list): List of horizontal loadings (negative is toward left; see global coordinate system).
146 @param timeSeries_ID (int): ID of the timeseries.
147 @param pattern_ID (int): ID of the pattern.
148 @param n_step (int, optional): Number of steps used to during the analysis to reach the objective state (with 100% horizontal loadings imposed). Defaults to 1000.
149 @param fiber_ID_analysed (int, optional): The ID of the analysed fiber. If fibers are present in the model and the user wants to save ODB data
150 (to use in the post-processing with for example FiberResponse), assign to this argument the ID of the fiber chosen.
151 -1 will ignore the storage of data for fibers. Defaults to -1.
152 @param fiber_section (int, optional): The section number, i.e. the Gauss integratio number.
153 If the fiber_ID_analysed is equal to -1, this argument is not used. Defaults to 1.
154 @param timeSeries_type (str, optional): Type of timeseries chosen.
155 For more information, see the OpenSeesPy documentation. Defaults to "Linear".
156 @param pattern_type (str, optional): Type of pattern chosen.
157 For more information, see the OpenSeesPy documentation. Defaults to "Plain".
158 @param constraints_type (str, optional): Type of contraints chosen. It detemines how the constraint equations are enforced in the analysis.
159 For more information, see the OpenSeesPy documentation. Defaults to "Plain".
160 @param numberer_type (str, optional): Type of numberer chosen. It determines the mapping between equation numbers and degrees-of-freedom.
161 For more information, see the OpenSeesPy documentation. Defaults to "RCM".
162 @param system_type (str, optional): Type of system of equations chosen. It determines how to construct the LinearSOE and LinearSolver objects to store and solve the system of equations in the analysis.
163 For more information, see the OpenSeesPy documentation. Defaults to "BandGeneral".
164 @param analysis_type (str, optional): Type of analysis chosen. It determines how to construct the Analysis object, which defines what type of analysis is to be performed.
165 For more information, see the OpenSeesPy documentation. Defaults to "Static".
166 @param show_plot (bool, optional): Option to show the 'Horizontal displacement vs. Horizontal loading' curve after the analysis. Defaults to True.
167 @param block (bool, optional): Option to wait the user command 'plt.show()' (avoiding the stop of the program everytime that a plot should pop up). Defaults to False.
168
169 @exception WrongDimension: The dimension of the loaded_nodes and Fx arguments needs to be the same.
170 @exception NegativeValue: The ID of timeSeries_ID needs to be a positive integer.
171 @exception NegativeValue: The ID of pattern_ID needs to be a positive integer.
172 @exception NegativeValue: The ID of fiber_ID_analysed needs to be a positive integer.
173 """
174 if len(loaded_nodes) != len(Fx): raise WrongDimension()
175 if timeSeries_ID < 1: raise NegativeValue()
176 if pattern_ID < 1: raise NegativeValue()
177 if fiber_ID_analysed != -1 and fiber_ID_analysed < 1: raise NegativeValue()
178
179 # for mass defined: opsplt.createODB(self.name_ODB, "LateralForce", Nmodes = nEigen);
180 opsplt.createODB(self.name_ODB, "LateralForce");
181 if fiber_ID_analysed != -1: opsplt.saveFiberData2D(self.name_ODB, "LateralForce", fiber_ID_analysed, fiber_section)
182
183 # Create load pattern
184 timeSeries(timeSeries_type, timeSeries_ID)
185 pattern(pattern_type, timeSeries_ID, pattern_ID)
186 for ii, node_ID in enumerate(loaded_nodes):
187 load(node_ID, Fx[ii], 0.0, 0.0) # load(IDNode, Fx, Fy, Mz)
188 force = 1.0/n_step # load increment
189
190 # Set up analysis options
191 constraints(constraints_type) # how it handles boundary conditions
192 numberer(numberer_type) # renumber dof's to minimize band-width (optimization)
193 system(system_type) # how to store and solve the system of equations in the analysis
194 # For static model, BandGeneral, for transient and/or big model, UmfPack
195 integrator("LoadControl", force)# LoadControl and DisplacementControl only with static model, linear TimeSeries w/ factor of 1
196 # Newmark used for transient model
197 algorithm("Newton") # placeholder
198 analysis(analysis_type) # define type of analysis: static for pushover
199
200 # Analysis
201 dataLF = np.zeros((n_step+1,2))
202 print("")
203 print("Lateral Force analysis starts")
204 for iteration in range(n_step):
205 convergence = self.__LoadCtrlLoop(force, iteration,
206 self.algo, self.test_type, self.tol, self.test_opt, self.max_iter)
207 if convergence != 0: break
208 dataLF[iteration+1,0] = nodeDisp(loaded_nodes[0], 1)/mm_unit
209 dataLF[iteration+1,1] = getLoadFactor(pattern_ID)*Fx[0]/kN_unit
210
211 if show_plot:
212 plt.plot(dataLF[:,0], dataLF[:,1])
213 plt.xlabel('Lateral Displacement [mm]')
214 plt.ylabel('Lateral Load [kN]')
215 plt.title('Lateral force curve')
216 if block:
217 plt.show()
218
219 loadConst("-time", 0.0)
220
221 print("")
222 print("Lateral force complete")
223 self.load_case = "LateralForce"
224
225 wipe()
226
227

◆ LoadingProtocol()

def LoadingProtocol (   self,
int  CtrlNode,
np.ndarray  discr_LP,
int  timeSeries_ID,
int  pattern_ID,
  Fx = 1*kN_unit,
  ele_fiber_ID_analysed = -1,
  fiber_section = 1,
  timeSeries_type = "Linear",
  pattern_type = "Plain",
  constraints_type = "Plain",
  numberer_type = "RCM",
  system_type = "UmfPack",
  analysis_type = "Static",
  show_plot = True,
  block = False 
)

Method to perform a loading protocol analysis (displacement-control).

If this method is called, the Pushover and LateralForce methods should be avoided.

Parameters
CtrlNode(int): The node that will be used to impose the displacement from the discr_LP to perform the analysis.
discr_LP(np.ndarray): The loading protocol array (1 dimension) discretised. It needs to be filled with imposed displacement, not SDR. Use the functions DiscretizeLoadProtocol and DiscretizeLinearly in FunctionalFeatures module to help create and/or discretise one.
timeSeries_ID(int): ID of the timeseries.
pattern_ID(int): ID of the pattern.
Fx(float, optional): The force imposed at the control node CtrlNode. It is used for convergence reasons and it can be arbitrarly small. Defaults to 1*kN_unit.
ele_fiber_ID_analysed(int, optional): The ID of the analysed element with fibers. If fibers are present in the model and the user wants to save ODB data (to use in the post-processing with for example FiberResponse), assign to this argument the ID of the element with fibers chosen. -1 will ignore the storage of data for fibers. Defaults to -1.
fiber_section(int, optional): The section number, i.e. the Gauss integratio number. If the fiber_ID_analysed is equal to -1, this argument is not used. Defaults to 1.
timeSeries_type(str, optional): Type of timeseries chosen. For more information, see the OpenSeesPy documentation. Defaults to "Linear".
pattern_type(str, optional): Type of pattern chosen. For more information, see the OpenSeesPy documentation. Defaults to "Plain".
constraints_type(str, optional): Type of contraints chosen. It detemines how the constraint equations are enforced in the analysis. For more information, see the OpenSeesPy documentation. Defaults to "Plain".
numberer_type(str, optional): Type of numberer chosen. It determines the mapping between equation numbers and degrees-of-freedom. For more information, see the OpenSeesPy documentation. Defaults to "RCM".
system_type(str, optional): Type of system of equations chosen. It determines how to construct the LinearSOE and LinearSolver objects to store and solve the system of equations in the analysis. For more information, see the OpenSeesPy documentation. Defaults to "UmfPack".
analysis_type(str, optional): Type of analysis chosen. It determines how to construct the Analysis object, which defines what type of analysis is to be performed. For more information, see the OpenSeesPy documentation. Defaults to "Static".
show_plot(bool, optional): Option to show the 'lateral displacement vs. lateral loading' curve after the analysis. Defaults to True.
block(bool, optional): Option to wait the user command 'plt.show()' (avoiding the stop of the program everytime that a plot should pop up). Defaults to False.
Exceptions
NegativeValueThe ID of CtrlNode needs to be a positive integer.
NegativeValueThe ID of timeSeries_ID needs to be a positive integer.
NegativeValueThe ID of pattern_ID needs to be a positive integer.
NegativeValueThe ID of fiber_ID_analysed needs to be a positive integer if is different from -1.

Definition at line 319 of file AnalysisAndPostProcessing.py.

321 show_plot = True, block = False):
322 """
323 Method to perform a loading protocol analysis (displacement-control). If this method is called, the Pushover and LateralForce methods should be avoided.
324
325 @param CtrlNode (int): The node that will be used to impose the displacement from the discr_LP to perform the analysis.
326 @param discr_LP (np.ndarray): The loading protocol array (1 dimension) discretised. It needs to be filled with imposed displacement, not SDR.
327 Use the functions DiscretizeLoadProtocol and DiscretizeLinearly in FunctionalFeatures module to help create and/or discretise one.
328 @param timeSeries_ID (int): ID of the timeseries.
329 @param pattern_ID (int): ID of the pattern.
330 @param Fx (float, optional): The force imposed at the control node CtrlNode. It is used for convergence reasons and it can be arbitrarly small.
331 Defaults to 1*kN_unit.
332 @param ele_fiber_ID_analysed (int, optional): The ID of the analysed element with fibers. If fibers are present in the model and the user wants to save ODB data
333 (to use in the post-processing with for example FiberResponse), assign to this argument the ID of the element with fibers chosen.
334 -1 will ignore the storage of data for fibers. Defaults to -1.
335 @param fiber_section (int, optional): The section number, i.e. the Gauss integratio number.
336 If the fiber_ID_analysed is equal to -1, this argument is not used. Defaults to 1.
337 @param timeSeries_type (str, optional): Type of timeseries chosen.
338 For more information, see the OpenSeesPy documentation. Defaults to "Linear".
339 @param pattern_type (str, optional): Type of pattern chosen.
340 For more information, see the OpenSeesPy documentation. Defaults to "Plain".
341 @param constraints_type (str, optional): Type of contraints chosen. It detemines how the constraint equations are enforced in the analysis.
342 For more information, see the OpenSeesPy documentation. Defaults to "Plain".
343 @param numberer_type (str, optional): Type of numberer chosen. It determines the mapping between equation numbers and degrees-of-freedom.
344 For more information, see the OpenSeesPy documentation. Defaults to "RCM".
345 @param system_type (str, optional): Type of system of equations chosen. It determines how to construct the LinearSOE and LinearSolver objects to store and solve the system of equations in the analysis.
346 For more information, see the OpenSeesPy documentation. Defaults to "UmfPack".
347 @param analysis_type (str, optional): Type of analysis chosen. It determines how to construct the Analysis object, which defines what type of analysis is to be performed.
348 For more information, see the OpenSeesPy documentation. Defaults to "Static".
349 @param show_plot (bool, optional): Option to show the 'lateral displacement vs. lateral loading' curve after the analysis. Defaults to True.
350 @param block (bool, optional): Option to wait the user command 'plt.show()' (avoiding the stop of the program everytime that a plot should pop up). Defaults to False.
351
352 @exception NegativeValue: The ID of CtrlNode needs to be a positive integer.
353 @exception NegativeValue: The ID of timeSeries_ID needs to be a positive integer.
354 @exception NegativeValue: The ID of pattern_ID needs to be a positive integer.
355 @exception NegativeValue: The ID of fiber_ID_analysed needs to be a positive integer if is different from -1.
356 """
357 if CtrlNode < 1: raise NegativeValue()
358 if timeSeries_ID < 1: raise NegativeValue()
359 if pattern_ID < 1: raise NegativeValue()
360 if ele_fiber_ID_analysed != -1 and ele_fiber_ID_analysed < 1: raise NegativeValue()
361
362 # for mass defined: opsplt.createODB(self.name_ODB, "LoadingProtocol", Nmodes = nEigen);
363 opsplt.createODB(self.name_ODB, "LoadingProtocol");
364 if ele_fiber_ID_analysed != -1: opsplt.saveFiberData2D(self.name_ODB, "LoadingProtocol", ele_fiber_ID_analysed, fiber_section)
365
366 # Create load pattern
367 timeSeries(timeSeries_type, timeSeries_ID)
368 pattern(pattern_type, timeSeries_ID, pattern_ID)
369 load(CtrlNode, Fx, 0.0, 0.0) # load(IDNode, Fx, Fy, Mz)
370 dU_prev = 0
371 Nsteps = np.size(discr_LP) # number of pushover analysis steps
372
373 # Set up analysis options
374 constraints(constraints_type) # how it handles boundary conditions
375 numberer(numberer_type) # renumber dof's to minimize band-width (optimization)
376 system(system_type) # how to store and solve the system of equations in the analysis
377 # For static model, BandGeneral, for transient and/or big model, UmfPack
378 integrator("LoadControl", 1) # placeholder
379 algorithm("Newton") # placeholder
380 analysis(analysis_type) # define type of analysis: static for LoadingProtocol
381
382 # Analysis
383 dataLP = np.zeros((Nsteps+1,2))
384 next_step = 0
385 print("")
386 print("Loading Protocol analysis starts")
387 for iteration in range(Nsteps):
388 # Compute displacement usinf the given loading protocol (discretized)
389 dU_next = discr_LP[iteration]
390 dU = dU_next - dU_prev
391 dU_prev = dU_next
392
393 next_step = ProgressingPercentage(Nsteps, iteration, next_step)
394 convergence = self.__LatDispCtrlLoop(CtrlNode, dU, iteration,
395 self.algo, self.test_type, self.tol, self.test_opt, self.max_iter, self.allow_smaller_step)
396 if convergence != 0: break
397 dataLP[iteration+1,0] = nodeDisp(CtrlNode, 1)/mm_unit
398 dataLP[iteration+1,1] = getLoadFactor(pattern_ID)*Fx/kN_unit
399
400 if show_plot:
401 plt.plot(dataLP[:,0], dataLP[:,1])
402 plt.xlabel('Horizontal Displacement [mm]')
403 plt.ylabel('Horizontal Load [kN]')
404 plt.title('Loading Protocol curve')
405 if block:
406 plt.show()
407
408 print("")
409 print("Loading Protocol complete")
410 self.load_case = "LoadingProtocol"
411
412 wipe()
413
414
def ProgressingPercentage(max_iter, int i, int next_step, step=10)
Function that shows the progressing percentage of an iterative process.

◆ Pushover()

def Pushover (   self,
int  CtrlNode,
  Dmax,
  Dincr,
int  timeSeries_ID,
int  pattern_ID,
  Fx = 1*kN_unit,
  ele_fiber_ID_analysed = -1,
  fiber_section = 1,
  timeSeries_type = "Linear",
  pattern_type = "Plain",
  constraints_type = "Plain",
  numberer_type = "RCM",
  system_type = "UmfPack",
  analysis_type = "Static",
  show_plot = True,
  block = False 
)

Method to perform a pushover analysis (displacement-control).

If this method is called, the LoadingProtocol and LateralForce methods should be avoided.

Parameters
CtrlNode(int): The node that will be used to impose the displacement Dmax of the pushover analysis. If the show_plot option is True, the curve displayed follows this node.
Dmax(float): The imposed displacement.
Dincr(float): The incremental displacement to reach Dmax. To converge, it should be small enough (1000 times smaller of Dmax).
timeSeries_ID(int): ID of the timeseries.
pattern_ID(int): ID of the pattern.
Fx(float, optional): The force imposed at the control node CtrlNode. It is used for convergence reasons and it can be arbitrarly small. Defaults to 1*kN_unit.
ele_fiber_ID_analysed(int, optional): The ID of the analysed element with fibers. If fibers are present in the model and the user wants to save ODB data (to use in the post-processing with for example FiberResponse), assign to this argument the ID of the element with fibers chosen. -1 will ignore the storage of data for fibers. Defaults to -1.
fiber_section(int, optional): The section number, i.e. the Gauss integratio number. If the fiber_ID_analysed is equal to -1, this argument is not used. Defaults to 1.
timeSeries_type(str, optional): Type of timeseries chosen. For more information, see the OpenSeesPy documentation. Defaults to "Linear".
pattern_type(str, optional): Type of pattern chosen. For more information, see the OpenSeesPy documentation. Defaults to "Plain".
constraints_type(str, optional): Type of contraints chosen. It detemines how the constraint equations are enforced in the analysis. For more information, see the OpenSeesPy documentation. Defaults to "Plain".
numberer_type(str, optional): Type of numberer chosen. It determines the mapping between equation numbers and degrees-of-freedom. For more information, see the OpenSeesPy documentation. Defaults to "RCM".
system_type(str, optional): Type of system of equations chosen. It determines how to construct the LinearSOE and LinearSolver objects to store and solve the system of equations in the analysis. For more information, see the OpenSeesPy documentation. Defaults to "UmfPack".
analysis_type(str, optional): Type of analysis chosen. It determines how to construct the Analysis object, which defines what type of analysis is to be performed. For more information, see the OpenSeesPy documentation. Defaults to "Static".
show_plot(bool, optional): Option to show the 'lateral displacement vs. lateral loading' curve after the analysis. Defaults to True.
block(bool, optional): Option to wait the user command 'plt.show()' (avoiding the stop of the program everytime that a plot should pop up). Defaults to False.
Exceptions
NegativeValueThe ID of CtrlNode needs to be a positive integer.
NegativeValueThe ID of timeSeries_ID needs to be a positive integer.
NegativeValueThe ID of pattern_ID needs to be a positive integer.
NegativeValueThe ID of ele_fiber_ID_analysed needs to be a positive integer if is different from -1.

Definition at line 228 of file AnalysisAndPostProcessing.py.

230 show_plot = True, block = False):
231 """
232 Method to perform a pushover analysis (displacement-control). If this method is called, the LoadingProtocol and LateralForce methods should be avoided.
233
234 @param CtrlNode (int): The node that will be used to impose the displacement Dmax of the pushover analysis.
235 If the show_plot option is True, the curve displayed follows this node.
236 @param Dmax (float): The imposed displacement.
237 @param Dincr (float): The incremental displacement to reach Dmax. To converge, it should be small enough (1000 times smaller of Dmax).
238 @param timeSeries_ID (int): ID of the timeseries.
239 @param pattern_ID (int): ID of the pattern.
240 @param Fx (float, optional): The force imposed at the control node CtrlNode. It is used for convergence reasons and it can be arbitrarly small.
241 Defaults to 1*kN_unit.
242 @param ele_fiber_ID_analysed (int, optional): The ID of the analysed element with fibers. If fibers are present in the model and the user wants to save ODB data
243 (to use in the post-processing with for example FiberResponse), assign to this argument the ID of the element with fibers chosen.
244 -1 will ignore the storage of data for fibers. Defaults to -1.
245 @param fiber_section (int, optional): The section number, i.e. the Gauss integratio number.
246 If the fiber_ID_analysed is equal to -1, this argument is not used. Defaults to 1.
247 @param timeSeries_type (str, optional): Type of timeseries chosen.
248 For more information, see the OpenSeesPy documentation. Defaults to "Linear".
249 @param pattern_type (str, optional): Type of pattern chosen.
250 For more information, see the OpenSeesPy documentation. Defaults to "Plain".
251 @param constraints_type (str, optional): Type of contraints chosen. It detemines how the constraint equations are enforced in the analysis.
252 For more information, see the OpenSeesPy documentation. Defaults to "Plain".
253 @param numberer_type (str, optional): Type of numberer chosen. It determines the mapping between equation numbers and degrees-of-freedom.
254 For more information, see the OpenSeesPy documentation. Defaults to "RCM".
255 @param system_type (str, optional): Type of system of equations chosen. It determines how to construct the LinearSOE and LinearSolver objects to store and solve the system of equations in the analysis.
256 For more information, see the OpenSeesPy documentation. Defaults to "UmfPack".
257 @param analysis_type (str, optional): Type of analysis chosen. It determines how to construct the Analysis object, which defines what type of analysis is to be performed.
258 For more information, see the OpenSeesPy documentation. Defaults to "Static".
259 @param show_plot (bool, optional): Option to show the 'lateral displacement vs. lateral loading' curve after the analysis. Defaults to True.
260 @param block (bool, optional): Option to wait the user command 'plt.show()' (avoiding the stop of the program everytime that a plot should pop up). Defaults to False.
261
262 @exception NegativeValue: The ID of CtrlNode needs to be a positive integer.
263 @exception NegativeValue: The ID of timeSeries_ID needs to be a positive integer.
264 @exception NegativeValue: The ID of pattern_ID needs to be a positive integer.
265 @exception NegativeValue: The ID of ele_fiber_ID_analysed needs to be a positive integer if is different from -1.
266 """
267 if CtrlNode < 1: raise NegativeValue()
268 if timeSeries_ID < 1: raise NegativeValue()
269 if pattern_ID < 1: raise NegativeValue()
270 if ele_fiber_ID_analysed != -1 and ele_fiber_ID_analysed < 1: raise NegativeValue()
271
272 # for mass defined: opsplt.createODB(self.name_ODB, "Pushover", Nmodes = nEigen);
273 opsplt.createODB(self.name_ODB, "Pushover");
274 if ele_fiber_ID_analysed != -1: opsplt.saveFiberData2D(self.name_ODB, "Pushover", ele_fiber_ID_analysed, fiber_section)
275
276 # Create load pattern
277 timeSeries(timeSeries_type, timeSeries_ID)
278 pattern(pattern_type, timeSeries_ID, pattern_ID)
279 load(CtrlNode, Fx, 0.0, 0.0) # load(IDNode, Fx, Fy, Mz)
280 Nsteps = int(abs(Dmax/Dincr)) # number of pushover analysis steps
281
282 # Set up analysis options
283 constraints(constraints_type) # how it handles boundary conditions
284 numberer(numberer_type) # renumber dof's to minimize band-width (optimization)
285 system(system_type) # how to store and solve the system of equations in the analysis
286 # For static model, BandGeneral, for transient and/or big model, UmfPack
287 integrator("LoadControl", 1) # placeholder
288 algorithm("Newton") # placeholder
289 analysis(analysis_type) # define type of analysis: static for pushover
290
291 # Analysis
292 dataPO = np.zeros((Nsteps+1,2))
293 next_step = 0
294 print("")
295 print("Pushover analysis starts")
296 for iteration in range(Nsteps):
297 next_step = ProgressingPercentage(Nsteps, iteration, next_step)
298 convergence = self.__LatDispCtrlLoop(CtrlNode, Dincr, iteration,
299 self.algo, self.test_type, self.tol, self.test_opt, self.max_iter, self.allow_smaller_step)
300 if convergence != 0: break
301 dataPO[iteration+1,0] = nodeDisp(CtrlNode, 1)/mm_unit
302 dataPO[iteration+1,1] = getLoadFactor(pattern_ID)*Fx/kN_unit
303
304 if show_plot:
305 plt.plot(dataPO[:,0], dataPO[:,1])
306 plt.xlabel('Horizontal Displacement [mm]')
307 plt.ylabel('Horizontal Load [kN]')
308 plt.title('Pushover curve')
309 if block:
310 plt.show()
311
312 print("")
313 print("Pushover complete")
314 self.load_case = "Pushover"
315
316 wipe()
317
318

Member Data Documentation

◆ algo

algo

Definition at line 51 of file AnalysisAndPostProcessing.py.

◆ allow_smaller_step

allow_smaller_step

Definition at line 56 of file AnalysisAndPostProcessing.py.

◆ data_dir

data_dir

Definition at line 49 of file AnalysisAndPostProcessing.py.

◆ load_case

load_case

Definition at line 57 of file AnalysisAndPostProcessing.py.

◆ max_iter

max_iter

Definition at line 55 of file AnalysisAndPostProcessing.py.

◆ name_ODB

name_ODB

Definition at line 50 of file AnalysisAndPostProcessing.py.

◆ test_opt

test_opt

Definition at line 54 of file AnalysisAndPostProcessing.py.

◆ test_type

test_type

Definition at line 52 of file AnalysisAndPostProcessing.py.

◆ tol

tol

Definition at line 53 of file AnalysisAndPostProcessing.py.


The documentation for this class was generated from the following file: