sajou.model module¶
Defines the model classes for 2D and 3D models.
-
class
sajou.model.
Model
(name, dimensionality)¶ Bases:
object
Defines a model object
Parameters: - name (str) – name of the model
- dimensionality (str) – spacial dimensions used in the model (‘2D’ or ‘3D’)
-
nodes
¶ dict – dictionary with all the nodes of the system
-
beams
¶ dict – dictionary with all the beams of the system
-
beam_sections
¶ dict – dictionary with the beam sections defined in the model
-
materials
¶ dict – dictionary with the materials defined in the model
-
n_nodes
¶ int – number of nodes of the system
-
n_elements
¶ int – number of beams in the system
-
n_materials
¶ int – number of materials defined
-
n_dimensions
¶ int – number of spacial dimensions of the model
-
n_dof_per_node
¶ int – number of degrees of freedom per node
-
_name
¶ str – name of the model
-
_dimensionality
¶ str – spacial dimensions used in the model
-
add_hinge
(node)¶ Add hinge to the specified node. Also supports list of nodes
Parameters: node (sajou.Node) – Node instance or list of node instances Returns: TODO Return type: bool
-
bc
(node, type='displacement', coord_system='global', **kwargs)¶ Introduces a border condition to the node.
Parameters: - node (sajou.Node) – Node to which the border condition will be applied
- type (str) –
type of border condition
- Options:
'displacement'
,...
- coord_system – spcifies the coordinate system to be used when applying the BC
- **kwargs – keyword arguments. At least one of the following parameters must be supplied
Keyword Arguments: - v1 (float) – displacement in the direction 1
- v2 (float) – displacement in the direction 2
- v3 (float) – displacement in the direction 3
- r1 (float) – rotation in the direction 1
- r2 (float) – rotation in the direction 2
- r3 (float) – rotation in the direction 3
Returns: True if successful
Return type: bool
-
beam_section
(name, material, data, type='rectangular')¶ Function use to create a BeamSection instance in the model
Parameters: - name (str) – name of the section
- material (sajou.Material) – material for the section
- data – data (see BeamSection class definition)
- type – type of the section (see BeamSection class definition)
Returns: a beam section instance
Return type: returns
-
export_model_data
()¶ Export all the data of the model. This means the nodes, elements, border conditions and forces are exported to a ModelData object.
Returns: the data of the whole analyzed model Return type: sajou.model.ModelData
-
load
(node, coord_system='global', **kwargs)¶ Introduces a Load in the given direction according to the selected coordinate system at the specified node.
Parameters: - node (sajou.Node) – a Node instance
- coordinate – coordinate system
- **kwargs – keyword arguments. The BC is defined for the different degree of freedom (dof) available to the node. At least one of the following parameters must be supplied:
Keyword Arguments: - f1 (float) – force in direction 1
- f2 (float) – force in direction 2
- f3 (float) – force in direction 3
- m1 (float) – moment in direction 1
- m2 (float) – moment in direction 2
- m3 (float) – moment in direction 3
Returns: the instance of the Load object created
Return type: sajou.Load
-
material
(name, data, type='isotropic')¶ Function used to create a Material instance in the model
Parameters: - name (str) – name of the material
- data – data for the material
- type (str) – type of the material
Returns: a Material instance
Return type: sajou.Material
-
class
sajou.model.
Model2D
(name, dimensionality='2D')¶ Bases:
sajou.model.Model
Subclass of the ‘Model’ class. It is intended to be used for the 2-dimensional models of frame structures.
Allocation of DOFs in each node:
[1 2 3] = [ux, uy, rz]Parameters: name (str) – name of the model -
n_dimensions
¶ int – number of spacial dimensions (2 for Model2D)
-
n_dof_per_node
¶ int – number of degrees of freedom per node
-
beam
(node1, node2)¶ Define a beam element between two nodes.
Parameters: - node1 (sajou.Node) – first node
- node2 (sajou.Node) – second node
Returns: the beam element created
Return type: sajou.Beam
-
distributed_load
(elements, **kwargs)¶ Add a distributed load to a list of beam elements.
A list of elements has to be supplied for the first variable. The rest of the variables are exactly the same as in the ‘distributed_load’ function of the corresponding elements.
Parameters: - elements (list) – list of beam elements
- p1 (float) – value of the force at start node
- p2 (float) – value of the force at end node
- direction (int) – direction of the applied load (default: 2)
- coord_system (str) – coordinate system (default: global)
Returns: TODO
Return type: bool
-
node
(x, y)¶ 2D implementation of the Node.
Parameters: - x (float) – x position
- y (float) – y position
Returns: the node created
Return type: sajou.Node
-
spring
(node1, node2, K)¶ Define a spring element between two nodes
Parameters: - node1 (Node instance) – first node
- node2 (Node instance) – second node
- K (float) – elastic constant of the spring
Returns: A Sprind 2D instance
Return type: sajou.Spring2D
-
-
class
sajou.model.
Model3D
(name, dimensionality='3D')¶ Bases:
sajou.model.Model
Subclass of the ‘Model’ class. It is intended to be used for the 3-dimensional models of frame structures.
Allocation of DOFs in each node:
[1 2 3 4 5 6] = [ux, uy, uz, rx, ry, rz]-
beam
(node1, node2)¶ Define a line between two nodes.
Node1: first node Node2: second node
-
node
(x, y, z)¶ 3D implementation of the Node.
Parameters: - x (float) – x-position of the node
- y (float) – y-position of the node
- z (float) – z-position of the node
Returns: Node
Return type: instance of Node
-
-
class
sajou.model.
ModelData
(model)¶ Bases:
object
Object to store the data of a model object. It is used to pass it to the results object
-
sajou.model.
get_dataframe_of_node_coords
(model, nodes='all')¶ Return a pandas dataframe with coordinates of selected nodes of the model
Parameters: nodes (list, str) – list of nodes or ‘all’ Returns: DataFrame with the coordinates of the nodes Return type: DataFrame
-
sajou.model.
get_node_coords
(model, nodes='all')¶ Return a dictionary with coordinates of selected nodes of the model
Parameters: nodes (list, str) – list of nodes or ‘all’ Returns: DataFrame with the coordinates of the nodes Return type: DataFrame