OpenSeesPyAssistant 1.1
OpenSeesPy for everyone
SpringBasedElement Class Reference

Class that handles the storage and manipulation of a spring-based element's information (mechanical and geometrical parameters, etc) and the initialisation in the model. More...

Inheritance diagram for SpringBasedElement:
MemberModel SpringBasedElementModifiedIMKSteelIShape SpringBasedElementSteelIShape

Public Member Functions

def __init__ (self, int iNode_ID, int jNode_ID, A, E, Iy_mod, int geo_transf_ID, mat_ID_i=-1, mat_ID_j=-1, ele_ID=-1)
 Constructor of the class. More...
 
def CreateMember (self)
 Method that initialises the member by calling the OpenSeesPy commands through various functions. More...
 
def Record (self, str spring_or_element, str name_txt, str data_dir, force_rec=True, def_rec=True, time_rec=True)
 Implementation of the homonym abstract method. More...
 
def RecordNodeDef (self, str name_txt, str data_dir, time_rec=True)
 Implementation of the homonym abstract method. More...
 
def ReInit (self, ele_ID=-1)
 Implementation of the homonym abstract method. More...
 
def ShowInfo (self, plot=False, block=False)
 Implementation of the homonym abstract method. More...
 
def UpdateStoredData (self)
 Implementation of the homonym abstract method. More...
 
def Record (self, ele_ID, str name_txt, str data_dir, force_rec=True, def_rec=True, time_rec=True)
 Abstract method that records the forces, deformation and time of the member associated with the class. More...
 
def RecordNodeDef (self, int iNode_ID, int jNode_ID, str name_txt, str data_dir, time_rec=True)
 Abstract method that records the deformation and time of the member's nodes associated with the class. More...
 

Public Attributes

 A
 
 data
 
 E
 
 ele_orientation
 
 element_array
 
 element_ID
 
 geo_transf_ID
 
 Initialized
 
 iNode_ID
 
 iNode_ID_spring
 
 iSpring_ID
 
 Iy_mod
 
 jNode_ID
 
 jNode_ID_spring
 
 jSpring_ID
 
 mat_ID_i
 
 mat_ID_j
 
 section_name_tag
 

Detailed Description

Class that handles the storage and manipulation of a spring-based element's information (mechanical and geometrical parameters, etc) and the initialisation in the model.

Parameters
MemberModelParent abstract class.

Definition at line 659 of file MemberModel.py.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
int  iNode_ID,
int  jNode_ID,
  A,
  E,
  Iy_mod,
int  geo_transf_ID,
  mat_ID_i = -1,
  mat_ID_j = -1,
  ele_ID = -1 
)

Constructor of the class.

Parameters
iNode_ID(int): ID of the first end node.
jNode_ID(int): ID of the second end node.
A(float): Area of the member.
E(float): Young modulus.
Iy_mod(float): Second moment of inertia (strong axis).
geo_transf_ID(int): A geometric transformation (for more information, see OpenSeesPy documentation).
mat_ID_i(int, optional): ID of the material model for the spring in the node i (if present). Defaults to -1.
mat_ID_j(int, optional): ID of the material model for the spring in the node j (if present). Defaults to -1.
ele_ID(int, optional): Optional ID of the element. Defaults to -1, e.g. use IDConvention to define it.
Exceptions
NegativeValueID needs to be a positive integer.
NegativeValueID needs to be a positive integer.
NegativeValueA needs to be positive.
NegativeValueE needs to be positive.
NegativeValueIy_mod needs to be positive.
NegativeValueID needs to be a positive integer.
NegativeValueID needs to be a positive integer, if different from -1.
NegativeValueID needs to be a positive integer, if different from -1.
NameErrorat least one spring needs to be defined.
NegativeValueID needs to be a positive integer, if different from -1.

Reimplemented in SpringBasedElementSteelIShape, and SpringBasedElementModifiedIMKSteelIShape.

Definition at line 665 of file MemberModel.py.

665 def __init__(self, iNode_ID: int, jNode_ID: int, A, E, Iy_mod, geo_transf_ID: int, mat_ID_i = -1, mat_ID_j = -1, ele_ID = -1):
666 """
667 Constructor of the class.
668
669 @param iNode_ID (int): ID of the first end node.
670 @param jNode_ID (int): ID of the second end node.
671 @param A (float): Area of the member.
672 @param E (float): Young modulus.
673 @param Iy_mod (float): Second moment of inertia (strong axis).
674 @param geo_transf_ID (int): A geometric transformation (for more information, see OpenSeesPy documentation).
675 @param mat_ID_i (int, optional): ID of the material model for the spring in the node i (if present). Defaults to -1.
676 @param mat_ID_j (int, optional): ID of the material model for the spring in the node j (if present). Defaults to -1.
677 @param ele_ID (int, optional): Optional ID of the element. Defaults to -1, e.g. use IDConvention to define it.
678
679 @exception NegativeValue: ID needs to be a positive integer.
680 @exception NegativeValue: ID needs to be a positive integer.
681 @exception NegativeValue: A needs to be positive.
682 @exception NegativeValue: E needs to be positive.
683 @exception NegativeValue: Iy_mod needs to be positive.
684 @exception NegativeValue: ID needs to be a positive integer.
685 @exception NegativeValue: ID needs to be a positive integer, if different from -1.
686 @exception NegativeValue: ID needs to be a positive integer, if different from -1.
687 @exception NameError: at least one spring needs to be defined.
688 @exception NegativeValue: ID needs to be a positive integer, if different from -1.
689 """
690 # Check
691 if iNode_ID < 1: raise NegativeValue()
692 if jNode_ID < 1: raise NegativeValue()
693 if A < 0: raise NegativeValue()
694 if E < 0: raise NegativeValue()
695 if Iy_mod < 0: raise NegativeValue()
696 if geo_transf_ID < 1: raise NegativeValue()
697 if mat_ID_i != -1 and mat_ID_i < 0: raise NegativeValue()
698 if mat_ID_j != -1 and mat_ID_j < 0: raise NegativeValue()
699 if mat_ID_i == -1 and mat_ID_j == -1: raise NameError("No springs defined for element ID = {}".format(IDConvention(iNode_ID, jNode_ID)))
700 if ele_ID != -1 and ele_ID < 0: raise NegativeValue()
701
702 # Arguments
703 self.iNode_ID = iNode_ID
704 self.jNode_ID = jNode_ID
705 self.A = A
706 self.E = E
707 self.Iy_mod = Iy_mod
708 self.geo_transf_ID = geo_transf_ID
709 self.mat_ID_i = mat_ID_i
710 self.mat_ID_j = mat_ID_j
711
712 # Initialized the parameters that are dependent from others
713 self.section_name_tag = "None"
714 self.Initialized = False
715 self.ReInit(ele_ID)
716
717
def IDConvention(int prefix, int suffix, n_zeros_between=0)
Function used to construct IDs for elements and offgrid nodes.

Member Function Documentation

◆ CreateMember()

def CreateMember (   self)

Method that initialises the member by calling the OpenSeesPy commands through various functions.

Definition at line 799 of file MemberModel.py.

799 def CreateMember(self):
800 """
801 Method that initialises the member by calling the OpenSeesPy commands through various functions.
802 """
803 self.element_array = [[self.element_ID, self.iNode_ID_spring, self.jNode_ID_spring]]
804 if self.mat_ID_i != -1:
805 # Define zero length element i
806 node(self.iNode_ID_spring, *nodeCoord(self.iNode_ID))
807 self.iSpring_ID = IDConvention(self.iNode_ID, self.iNode_ID_spring)
808 RotationalSpring(self.iSpring_ID, self.iNode_ID, self.iNode_ID_spring, self.mat_ID_i)
809 self.element_array.append([self.iSpring_ID, self.iNode_ID, self.iNode_ID_spring])
810 if self.mat_ID_j != -1:
811 # Define zero length element j
812 node(self.jNode_ID_spring, *nodeCoord(self.jNode_ID))
813 self.jSpring_ID = IDConvention(self.jNode_ID, self.jNode_ID_spring)
814 RotationalSpring(self.jSpring_ID, self.jNode_ID, self.jNode_ID_spring, self.mat_ID_j)
815 self.element_array.append([self.jSpring_ID, self.jNode_ID, self.jNode_ID_spring])
816
817 # Define element
818 element("elasticBeamColumn", self.element_ID, self.iNode_ID_spring, self.jNode_ID_spring, self.A, self.E, self.Iy_mod, self.geo_transf_ID)
819
820 # Update class
821 self.Initialized = True
822 self.UpdateStoredData()
823
824
def RotationalSpring(int ElementID, int NodeRID, int NodeCID, int MatID, Rigid=False)
Function that defines a zero-length spring and constrains the translations DOFs of the spring.
Definition: Connections.py:42

◆ Record()

def Record (   self,
str  spring_or_element,
str  name_txt,
str  data_dir,
  force_rec = True,
  def_rec = True,
  time_rec = True 
)

Implementation of the homonym abstract method.

See parent class MemberModel for detailed information.

Reimplemented from MemberModel.

Definition at line 825 of file MemberModel.py.

825 def Record(self, spring_or_element: str, name_txt: str, data_dir: str, force_rec=True, def_rec=True, time_rec=True):
826 """
827 Implementation of the homonym abstract method.
828 See parent class MemberModel for detailed information.
829 """
830 if spring_or_element == "element":
831 super().Record(self.element_ID, name_txt, data_dir, force_rec=force_rec, def_rec=def_rec, time_rec=time_rec)
832 elif spring_or_element == "spring_i":
833 if self.mat_ID_i == -1:
834 print("Spring i recorded not present in element ID = {}".format(self.element_ID))
835 else:
836 super().Record(self.iSpring_ID, name_txt, data_dir, force_rec=force_rec, def_rec=def_rec, time_rec=time_rec)
837 elif spring_or_element == "spring_j":
838 if self.mat_ID_j == -1:
839 print("Spring j recorded not present in element ID = {}".format(self.element_ID))
840 else:
841 super().Record(self.jSpring_ID, name_txt, data_dir, force_rec=force_rec, def_rec=def_rec, time_rec=time_rec)
842 else:
843 print("No recording option with: '{}' with element ID: {}".format(spring_or_element, self.element_ID))
844
845
Module for the member model.
Definition: MemberModel.py:1

◆ RecordNodeDef()

def RecordNodeDef (   self,
str  name_txt,
str  data_dir,
  time_rec = True 
)

Implementation of the homonym abstract method.

See parent class MemberModel for detailed information.

Reimplemented from MemberModel.

Definition at line 846 of file MemberModel.py.

846 def RecordNodeDef(self, name_txt: str, data_dir: str, time_rec=True):
847 """
848 Implementation of the homonym abstract method.
849 See parent class MemberModel for detailed information.
850 """
851 super().RecordNodeDef(self.iNode_ID, self.jNode_ID, name_txt, data_dir, time_rec=time_rec)
852
853

◆ ReInit()

def ReInit (   self,
  ele_ID = -1 
)

Implementation of the homonym abstract method.

See parent class DataManagement for detailed information.

Parameters
ele_ID(int, optional): Optional ID of the element. Defaults to -1, e.g. use IDConvention to define it.

Definition at line 718 of file MemberModel.py.

718 def ReInit(self, ele_ID = -1):
719 """
720 Implementation of the homonym abstract method.
721 See parent class DataManagement for detailed information.
722
723 @param ele_ID (int, optional): Optional ID of the element. Defaults to -1, e.g. use IDConvention to define it.
724 """
725 # Members
726 if self.section_name_tag != "None": self.section_name_tag = self.section_name_tag + " (modified)"
727 # orientation:
728 self.ele_orientation = NodesOrientation(self.iNode_ID, self.jNode_ID)
729 if self.ele_orientation == "zero_length": raise ZeroLength(IDConvention(self.iNode_ID, self.jNode_ID))
730
731 if self.mat_ID_i != -1:
732 self.iNode_ID_spring = OffsetNodeIDConvention(self.iNode_ID, self.ele_orientation, "i")
733 else:
734 self.iNode_ID_spring = self.iNode_ID
735
736 if self.mat_ID_j != -1:
737 self.jNode_ID_spring = OffsetNodeIDConvention(self.jNode_ID, self.ele_orientation, "j")
738 else:
739 self.jNode_ID_spring = self.jNode_ID
740
741 # element ID
742 self.element_ID = IDConvention(self.iNode_ID_spring, self.jNode_ID_spring) if ele_ID == -1 else ele_ID
743
744 # Data storage for loading/saving
745 self.UpdateStoredData()
746
747
Module with the parent abstract class DataManagement.
def OffsetNodeIDConvention(int node_ID, str orientation, str position_i_or_j)
Function used to add node on top of existing ones in the extremes of memebers with springs.
def NodesOrientation(int iNode_ID, int jNode_ID)
Function that finds the orientation of the vector with direction 'jNode_ID''iNode_ID'.

◆ ShowInfo()

def ShowInfo (   self,
  plot = False,
  block = False 
)

Implementation of the homonym abstract method.

See parent class DataManagement for detailed information.

Parameters
plot(bool, optional): Option to show the plot of the material model. Defaults to False.
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.

Definition at line 771 of file MemberModel.py.

771 def ShowInfo(self, plot = False, block = False):
772 """
773 Implementation of the homonym abstract method.
774 See parent class DataManagement for detailed information.
775
776 @param plot (bool, optional): Option to show the plot of the material model. Defaults to False.
777 @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.
778 """
779 print("")
780 print("Requested info for SpringBasedElement member model, ID = {}".format(self.element_ID))
781 print("Section associated {} ".format(self.section_name_tag))
782 print("Material model of the spring i, ID = {}".format(self.mat_ID_i))
783 print("Material model of the spring j, ID = {}".format(self.mat_ID_j))
784 print("Area A = {} mm2".format(self.A/mm2_unit))
785 print("Young modulus E = {} GPa".format(self.E/GPa_unit))
786 print("n modified moment of inertia Iy_mod = {} mm4".format(self.Iy_mod/mm4_unit))
787 print("Geometric transformation = {}".format(self.geo_transf_ID))
788 print("")
789
790 if plot:
791 if self.Initialized:
792 plot_member(self.element_array, "SpringBased Element, ID = {}".format(self.element_ID))
793 if block:
794 plt.show()
795 else:
796 print("The SpringBasedElement is not initialized (node and elements not created), ID = {}".format(self.element_ID))
797
798
def plot_member(list element_array, member_name="Member name not defined", show_element_ID=True, show_node_ID=True)
Function that plots a set of elements.

◆ UpdateStoredData()

def UpdateStoredData (   self)

Implementation of the homonym abstract method.

See parent class DataManagement for detailed information.

Definition at line 749 of file MemberModel.py.

749 def UpdateStoredData(self):
750 """
751 Implementation of the homonym abstract method.
752 See parent class DataManagement for detailed information.
753 """
754 self.data = [["INFO_TYPE", "SpringBasedElement"], # Tag for differentiating different data
755 ["element_ID", self.element_ID],
756 ["section_name_tag", self.section_name_tag],
757 ["A", self.A],
758 ["E", self.E],
759 ["Iy_mod", self.Iy_mod],
760 ["iNode_ID", self.iNode_ID],
761 ["iNode_ID_spring", self.iNode_ID_spring],
762 ["mat_ID_i", self.mat_ID_i],
763 ["jNode_ID", self.jNode_ID],
764 ["jNode_ID_spring", self.jNode_ID_spring],
765 ["mat_ID_j", self.mat_ID_j],
766 ["ele_orientation", self.ele_orientation],
767 ["tranf_ID", self.geo_transf_ID],
768 ["Initialized", self.Initialized]]
769
770

Member Data Documentation

◆ A

A

Definition at line 705 of file MemberModel.py.

◆ data

data

Definition at line 754 of file MemberModel.py.

◆ E

E

Definition at line 706 of file MemberModel.py.

◆ ele_orientation

ele_orientation

Definition at line 728 of file MemberModel.py.

◆ element_array

element_array

Definition at line 803 of file MemberModel.py.

◆ element_ID

element_ID

Definition at line 742 of file MemberModel.py.

◆ geo_transf_ID

geo_transf_ID

Definition at line 708 of file MemberModel.py.

◆ Initialized

Initialized

Definition at line 714 of file MemberModel.py.

◆ iNode_ID

iNode_ID

Definition at line 703 of file MemberModel.py.

◆ iNode_ID_spring

iNode_ID_spring

Definition at line 732 of file MemberModel.py.

◆ iSpring_ID

iSpring_ID

Definition at line 807 of file MemberModel.py.

◆ Iy_mod

Iy_mod

Definition at line 707 of file MemberModel.py.

◆ jNode_ID

jNode_ID

Definition at line 704 of file MemberModel.py.

◆ jNode_ID_spring

jNode_ID_spring

Definition at line 737 of file MemberModel.py.

◆ jSpring_ID

jSpring_ID

Definition at line 813 of file MemberModel.py.

◆ mat_ID_i

mat_ID_i

Definition at line 709 of file MemberModel.py.

◆ mat_ID_j

mat_ID_j

Definition at line 710 of file MemberModel.py.

◆ section_name_tag

section_name_tag

Definition at line 713 of file MemberModel.py.


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