anastruct
Submodules
Classes
Modelling any structure starts with an object of this class. |
|
Group different loads in a load case |
|
Utility point in 2D. |
Package Contents
- class anastruct.SystemElements(figsize: Tuple[float, float] | None = (12, 8), EA: float = 15000.0, EI: float = 5000.0, load_factor: float = 1.0, mesh: int = 50, invert_y_loads: bool = True)[source]
Modelling any structure starts with an object of this class.
- Attributes:
EA: Standard axial stiffness of elements, default=15,000 EI: Standard bending stiffness of elements, default=5,000 figsize: (tpl) Matplotlibs standard figure size element_map: (dict) Keys are the element ids, values are the element objects node_map: (dict) Keys are the node ids, values are the node objects. node_element_map: (dict) maps node ids to element objects. loads_point: (dict) Maps node ids to point loads. loads_q: (dict) Maps element ids to q-loads. loads_moment: (dict) Maps node ids to moment loads. loads_dead_load: (set) Element ids that have a dead load applied.
- Methods:
add_element: Add a new element to the structure. add_element_grid: Add multiple elements based upon sequential x and y coordinates. add_sequential_elements: Add multiple elements based upon any number of sequential points. add_multiple_elements: Add multiple elements defined by the first and the last point. add_truss_element: Add a new truss element (an element that only has axial force) to the structure. add_support_hinged: Add a hinged support to a node. add_support_fixed: Add a fixed support to a node. add_support_roll: Add a roll support to a node. add_support_rotational: Add a rotational support to a node. add_support_spring: Add a spring support to a node. insert_node: Insert a node into an existing structure. solve: Compute the results of current model. validate: Validate the current model.
- post_processor
- plotter
- plot_values
- EA = 15000.0
- EI = 5000.0
- figsize = (12, 8)
- orientation_cs = -1
- element_map: Dict[int, anastruct.fem.elements.Element]
- node_map: Dict[int, anastruct.fem.node.Node]
- node_element_map: Dict[int, List[anastruct.fem.elements.Element]]
- supports_fixed: List[anastruct.fem.node.Node] = []
- supports_hinged: List[anastruct.fem.node.Node] = []
- supports_rotational: List[anastruct.fem.node.Node] = []
- internal_hinges: List[anastruct.fem.node.Node] = []
- supports_roll: List[anastruct.fem.node.Node] = []
- supports_spring_x: List[Tuple[anastruct.fem.node.Node, bool]] = []
- supports_spring_y: List[Tuple[anastruct.fem.node.Node, bool]] = []
- supports_spring_z: List[Tuple[anastruct.fem.node.Node, bool]] = []
- supports_roll_direction: List[Literal[1, 2]] = []
- reaction_forces: Dict[int, anastruct.fem.node.Node]
- non_linear = False
- _previous_point
- load_factor = 1.0
- count = 0
- _vertices: Dict[anastruct.vertex.Vertex, int]
- property id_last_element: int
ID of the last element added to the structure
- Returns:
int: ID of the last element added to the structure
- property id_last_node: int
ID of the last node added to the structure
- Returns:
int: ID of the last node added to the structure
- add_sequential_elements(location: Sequence[anastruct._types.VertexLike], EA: List[float] | numpy.ndarray | float | None = None, EI: List[float] | numpy.ndarray | float | None = None, g: List[float] | numpy.ndarray | float | None = None, mp: anastruct._types.MpType | None = None, spring: anastruct._types.Spring | None = None, **kwargs: dict) None[source]
Add multiple elements based upon any number of sequential points.
- Args:
- location (Sequence[VertexLike]): Sequence of points
that define the elements.
EA (Optional[Union[List[float], np.ndarray, float]], optional): Axial stiffnesses. Defaults to None. EI (Optional[Union[List[float], np.ndarray, float]], optional): Bending stiffnesses. Defaults to None. g (Optional[Union[List[float], np.ndarray, float]], optional): Self-weights. Defaults to None. mp (Optional[MpType], optional): Maximum plastic moment capacities for all elements. Defaults to None. spring (Optional[Spring], optional): Springs for all elements. Defaults to None.
- Raises:
FEMException: The mp parameter should be a dictionary.
- add_element_grid(x: List[float] | numpy.ndarray, y: List[float] | numpy.ndarray, EA: List[float] | numpy.ndarray | float | None = None, EI: List[float] | numpy.ndarray | float | None = None, g: List[float] | numpy.ndarray | float | None = None, mp: anastruct._types.MpType | None = None, spring: anastruct._types.Spring | None = None, **kwargs: dict) None[source]
Add multiple elements based upon sequential x and y coordinates.
- Args:
x (Union[List[float], np.ndarray]): X coordinates of the grid y (Union[List[float], np.ndarray]): Y coordinates of the grid EA (Optional[Union[List[float], np.ndarray, float]], optional): Axial stiffnesses. Defaults to None. EI (Optional[Union[List[float], np.ndarray, float]], optional): Bending stiffnesses. Defaults to None. g (Optional[Union[List[float], np.ndarray, float]], optional): Self-weights. Defaults to None. mp (Optional[MpType], optional): Maximum plastic moment capacities for all elements. Defaults to None. spring (Optional[Spring], optional): Springs for all elements. Defaults to None.
- Raises:
FEMException: x and y should have the same length.
- add_truss_element(location: Sequence[anastruct._types.VertexLike] | anastruct._types.VertexLike, EA: float | None = None, **kwargs: dict) int[source]
Add a new truss element (an element that only has axial force) to the structure Example:
location=[[x, y], [x, y]] location=[Vertex, Vertex] location=[x, y] location=Vertex
- Args:
- location (Union[Sequence[VertexLike], VertexLike]):
The two nodes of the element or the next node of the element.
EA (Optional[float], optional): Axial stiffness of the new element. Defaults to None.
- Returns:
int: ID of the new element
- add_element(location: Sequence[anastruct._types.VertexLike] | anastruct._types.VertexLike, EA: float | None = None, EI: float | None = None, g: float = 0, mp: anastruct._types.MpType | None = None, spring: anastruct._types.Spring | None = None, **kwargs: Any) int[source]
Add a new general element (an element with axial and lateral force) to the structure Example:
location=[[x, y], [x, y]] location=[Vertex, Vertex] location=[x, y] location=Vertex mp={1: 210e3, 2: 180e3} spring={1: k, 2: k} # Set a hinged node: spring={1: 0}
- Args:
- location (Union[Sequence[VertexLike], VertexLike]):
The two nodes of the element or the next node of the element
EA (Optional[float], optional): Axial stiffness of the new element. Defaults to None. EI (Optional[float], optional): Bending stiffness of the new element. Defaults to None. g (float, optional): Self-weight of the new element. Defaults to 0. mp (Optional[MpType], optional): Maximum plastic moment of each end node. Keys are integers representing
the nodes. Values are the bending moment capacity. Defaults to None.
- spring (Optional[Spring], optional): Rotational spring or hinge (k=0) of each end node.
Keys are integers representing the nodes. Values are the bending moment capacity. Defaults to None.
- Optional Keyword Args:
element_type (ElementType): “general” (axial and lateral force) or “truss” (axial force only) steelsection (str): Steel section name like IPE 300 orient (OrientAxis): Steel section axis for moment of inertia - ‘y’ and ‘z’ possible b (float): Width of generic rectangle section h (float): Height of generic rectangle section d (float): Diameter of generic circle section sw (bool): If true self weight of section is considered as dead load E (float): Modulus of elasticity for section material gamma (float): Weight of section material per volume unit. [kN/m3] / [N/m3]s
- Returns:
int: ID of the new element
- remove_element(element_id: int) None[source]
Remove an element from the structure.
- Args:
element_id (int): ID of the element to remove
- add_multiple_elements(location: Sequence[anastruct._types.VertexLike] | anastruct._types.VertexLike, n: int | None = None, dl: float | None = None, EA: float | None = None, EI: float | None = None, g: float = 0, mp: anastruct._types.MpType | None = None, spring: anastruct._types.Spring | None = None, **kwargs: Any) List[int][source]
Add multiple elements defined by the first and the last point.
Example:
last={'EA': 1e3, 'mp': 290}
- Args:
- location (Union[Sequence[VertexLike], VertexLike]):
The two nodes of the element or the next node of the element.
n (Optional[int], optional): Number of elements to add between the first and last nodes. Defaults to None. dl (Optional[float], optional): Length of sub-elements to add between the first and last nodes.
Length will be rounded down if necessary such that all sub-elements will have the same length. Defaults to None.
EA (Optional[float], optional): Axial stiffness. Defaults to None. EI (Optional[float], optional): Bending stiffness. Defaults to None. g (float, optional): Self-weight. Defaults to 0. mp (Optional[MpType], optional): Maximum plastic moment capacity at ends of element. Defaults to None. spring (Optional[Spring], optional): Rotational springs or hinges (k=0) at ends of element.
Defaults to None.
- Optional Keyword Args:
element_type (ElementType): “general” (axial and lateral force) or “truss” (axial force only) first (dict): Different arguments for the first element last (dict): Different arguments for the last element steelsection (str): Steel section name like IPE 300 orient (OrientAxis): Steel section axis for moment of inertia - ‘y’ and ‘z’ possible b (float): Width of generic rectangle section h (float): Height of generic rectangle section d (float): Diameter of generic circle section sw (bool): If true self weight of section is considered as dead load E (float): Modulus of elasticity for section material gamma (float): Weight of section material per volume unit. [kN/m3] / [N/m3]s
- Raises:
FEMException: One, and only one, of n and dl should be passed as argument.
- Returns:
List[int]: IDs of the new elements
- insert_node(element_id: int, location: anastruct._types.VertexLike | None = None, factor: float | None = None) dict[str, int][source]
Insert a node into an existing structure. This can be done by adding a new Vertex at any given location, or by setting a factor of the elements length. E.g. if you want a node at 40% of the elements length, you pass factor = 0.4.
- Args:
element_id (int): Id number of the element in which you want to insert the node location (Optional[VertexLike], optional): Location in which to insert the node.
Defaults to None.
- factor (Optional[float], optional): Fraction of distance from start to end of elmeent on which to
divide the element. Must be between 0 and 1. Defaults to None.
- Returns:
- dict[str, int]: Dictionary with keys:
‘new_node_id’: ID of the newly created node ‘new_element_id1’: ID of the first new element created ‘new_element_id2’: ID of the second new element created ‘old_element_id’: ID of the old element that was split
- insert_node_old(element_id: int, location: anastruct._types.VertexLike | None = None, factor: float | None = None) None[source]
Insert a node into an existing structure. This can be done by adding a new Vertex at any given location, or by setting a factor of the elements length. E.g. if you want a node at 40% of the elements length, you pass factor = 0.4.
Note: this method completely rebuilds the SystemElements object and is therefore slower then building a model with add_element methods.
- Args:
element_id (int): Id number of the element in which you want to insert the node location (Optional[VertexLike], optional): Location in which to insert the node.
Defaults to None.
- factor (Optional[float], optional): Fraction of distance from start to end of elmeent on which to
divide the element. Must be between 0 and 1. Defaults to None.
- solve(force_linear: bool = False, verbosity: int = 0, max_iter: int = 200, geometrical_non_linear: int = False, **kwargs: Any) numpy.ndarray[source]
Compute the results of current model.
- Args:
- force_linear (bool, optional): Force a linear calculation, even when the system has non-linear nodes.
Defaults to False.
verbosity (int, optional): Log calculation outputs (0), or silence (1). Defaults to 0. max_iter (int, optional): Maximum allowed iterations. Defaults to 200. geometrical_non_linear (int, optional): Calculate second order effects and determine the buckling factor.
Defaults to False.
- Optional Keyword Args:
naked (bool): Whether or not to run the solve function without doing post processing. discretize_kwargs (dict): When doing a geometric non linear analysis you can reduce or
increase the number of elements created that are used for determining the buckling_factor
- Raises:
- FEMException: The eigenvalues of the stiffness matrix are non zero, which indicates an unstable structure.
Check your support conditions
- Returns:
np.ndarray: Displacements vector.
- validate(min_eigen: float = 1e-09) bool[source]
Validate the stability of the stiffness matrix.
- Args:
- min_eigen (float, optional): Minimum value of the eigenvalues of the stiffness matrix. This value
should be close to zero. Defaults to 1e-9.
- Returns:
bool: True if the structure is stable, False if not.
- add_support_hinged(node_id: int | Sequence[int]) None[source]
Model a hinged support at a given node.
- Args:
node_id (Union[int, Sequence[int]]): Represents the nodes ID
- add_support_rotational(node_id: int | Sequence[int]) None[source]
Model a rotational support at a given node.
- Args:
node_id (Union[int, Sequence[int]]): Represents the nodes ID
- add_internal_hinge(node_id: int | Sequence[int]) None[source]
Model a internal hinge at a given node. This may alternatively be done by setting a spring restraint to zero ({1: 0} or {2: 0}). The effect is the same, though this function may be easier to use.
- Args:
node_id (Union[int, Sequence[int]]): Represents the nodes ID
- add_support_roll(node_id: Sequence[int] | int, direction: Sequence[anastruct._types.SupportDirection] | anastruct._types.SupportDirection = 'x', angle: Sequence[float | None] | float | None = None, rotate: Sequence[bool] | bool = True) None[source]
Add a rolling support at a given node.
- Args:
node_id (Union[Sequence[int], int]): Represents the nodes ID direction (Union[Sequence[SupportDirection], SupportDirection], optional): Represents the direction
that is free (“x”, “y”, “1”, or “2”). Defaults to “x”.
- angle (Union[Sequence[Optional[float]], Optional[float]], optional): Angle in degrees relative to
global x-axis. If angle is given, the support will be inclined. Defaults to None.
- rotate (Union[Sequence[bool], bool], optional): If set to False, rotation at the roller will also
be restrianed. Defaults to True.
- Raises:
FEMException: Invalid direction, if the direction parameter is invalid
- add_support_fixed(node_id: Sequence[int] | int) None[source]
Add a fixed support at a given node.
- Args:
node_id (Union[Sequence[int], int]): Represents the nodes ID
- add_support_spring(node_id: Sequence[int] | int, translation: Sequence[anastruct._types.AxisNumber] | anastruct._types.AxisNumber, k: Sequence[float] | float, roll: Sequence[bool] | bool = False) None[source]
Add a spring support at a given node.
- Args:
node_id (Union[Sequence[int], int]): Represents the nodes ID translation (Union[Sequence[AxisNumber], AxisNumber]): Represents the prevented translation or rotation.
1 = translation in x, 2 = translation in y, 3 = rotation about z
k (Union[Sequence[float], float]): Stiffness of the spring roll (Union[Sequence[bool], bool], optional): If set to True, only the translation of the
spring is controlled. Defaults to False.
- q_load(q: float | Sequence[float], element_id: int | Sequence[int], direction: anastruct._types.LoadDirection | Sequence[anastruct._types.LoadDirection] = 'element', rotation: float | Sequence[float] | None = None, q_perp: float | Sequence[float] | None = None) None[source]
Apply a q-load (distributed load) to an element.
- Args:
q (Union[float, Sequence[float]]): Value of the q-load element_id (Union[int, Sequence[int]]): The element ID to which to apply the load direction (Union["LoadDirection", Sequence["LoadDirection"]], optional):
“element”, “x”, “y”, “parallel”, or “perpendicular”. Defaults to “element”.
- rotation (Optional[Union[float, Sequence[float]]], optional): Rotate the force clockwise.
Rotation is in degrees. Defaults to None.
- q_perp (Optional[Union[float, Sequence[float]]], optional): Value of any q-load perpendicular
to the indicated direction/rotatione. Defaults to None.
- Raises:
FEMException: _description_
- point_load(node_id: int | Sequence[int], Fx: float | Sequence[float] = 0.0, Fy: float | Sequence[float] = 0.0, rotation: float | Sequence[float] = 0.0, Fz: float | Sequence[float] | None = None) None[source]
Apply a point load to a node.
- Args:
node_id (Union[int, Sequence[int]]): The node ID to which to apply the load Fx (Union[float, Sequence[float]], optional): Force in the global X direction. Defaults to 0.0. Fy (Union[float, Sequence[float]], optional): Force in the global Y direction. Defaults to 0.0. rotation (Union[float, Sequence[float]], optional): Rotate the force clockwise by the given
angle in degrees. Defaults to 0.0.
- Raises:
FEMException: Point loads may not be placed at the location of inclined roller supports
- moment_load(node_id: int | Sequence[int], Tz: float | Sequence[float] = 0.0, Ty: float | Sequence[float] | None = None) None[source]
Apply a moment load to a node.
- Args:
node_id (Union[int, Sequence[int]]): The node ID to which to apply the load Tz (Union[float, Sequence[float]]): Moment load (about the global Y direction) to apply
- show_structure(verbosity: int, scale: float, offset: Tuple[float, float], figsize: Tuple[float, float] | None, show: bool, supports: bool, values_only: Literal[True], annotations: bool) Tuple[numpy.ndarray, numpy.ndarray][source]
- show_structure(verbosity: int, scale: float, offset: Tuple[float, float], figsize: Tuple[float, float] | None, show: Literal[False], supports: bool, values_only: Literal[False], annotations: bool) matplotlib.figure.Figure
- show_structure(verbosity: int = 0, scale: float = 1.0, offset: Tuple[float, float] = (0, 0), figsize: Tuple[float, float] | None = None, show: Literal[True] = True, supports: bool = True, values_only: Literal[False] = False, annotations: bool = False) None
Plot the structure.
- Args:
verbosity (int, optional): 0: All information, 1: Suppress information. Defaults to 0. scale (float, optional): Scale of the plot. Defaults to 1.0. offset (Tuple[float, float], optional): Offset the plots location on the figure. Defaults to (0, 0). figsize (Optional[Tuple[float, float]], optional): Change the figure size. Defaults to None. show (bool, optional): Plot the result or return a figure. Defaults to True. supports (bool, optional): Plot the supports. Defaults to True. values_only (bool, optional): Return the values that would be plotted as tuple containing
two arrays: (x, y). Defaults to False.
annotations (bool, optional): if True, structure annotations are plotted. It includes section name.
- Returns:
Figure: If show is False, return a figure.
- change_plot_colors(plot_colors: Dict) None[source]
Calls the change_plot_colors method of the plotter object
- Args:
colors (Dict): A dictionary containing plot components and colors as key-value pairs.
- show_bending_moment(factor: float | None, verbosity: int, scale: float, offset: Tuple[float, float], figsize: Tuple[float, float] | None, show: bool, values_only: Literal[True]) Tuple[numpy.ndarray, numpy.ndarray][source]
- show_bending_moment(factor: float | None, verbosity: int, scale: float, offset: Tuple[float, float], figsize: Tuple[float, float] | None, show: Literal[False], values_only: Literal[False]) matplotlib.figure.Figure
- show_bending_moment(factor: float | None = None, verbosity: int = 0, scale: float = 1.0, offset: Tuple[float, float] = (0, 0), figsize: Tuple[float, float] | None = None, show: Literal[True] = True, values_only: Literal[False] = False) None
Plot the bending moment.
- Args:
factor (Optional[float], optional): Influence the plotting scale. Defaults to None. verbosity (int, optional): 0: All information, 1: Suppress information. Defaults to 0. scale (float, optional): Scale of the plot. Defaults to 1. offset (Tuple[float, float], optional): Offset the plots location on the figure. Defaults to (0, 0). figsize (Optional[Tuple[float, float]], optional): Change the figure size. Defaults to None. show (bool, optional): Plot the result or return a figure. Defaults to True. values_only (bool, optional): Return the values that would be plotted as tuple containing
two arrays: (x, y). Defaults to False.
- Returns:
Figure: If show is False, return a figure.
- show_axial_force(factor: float | None, verbosity: int, scale: float, offset: Tuple[float, float], figsize: Tuple[float, float] | None, show: bool, values_only: Literal[True]) Tuple[numpy.ndarray, numpy.ndarray][source]
- show_axial_force(factor: float | None, verbosity: int, scale: float, offset: Tuple[float, float], figsize: Tuple[float, float] | None, show: Literal[False], values_only: Literal[False]) matplotlib.figure.Figure
- show_axial_force(factor: float | None = None, verbosity: int = 0, scale: float = 1.0, offset: Tuple[float, float] = (0, 0), figsize: Tuple[float, float] | None = None, show: Literal[True] = True, values_only: Literal[False] = False) None
Plot the axial force.
- Args:
factor (Optional[float], optional): Influence the plotting scale. Defaults to None. verbosity (int, optional): 0: All information, 1: Suppress information. Defaults to 0. scale (float, optional): Scale of the plot. Defaults to 1. offset (Tuple[float, float], optional): Offset the plots location on the figure. Defaults to (0, 0). figsize (Optional[Tuple[float, float]], optional): Change the figure size. Defaults to None. show (bool, optional): Plot the result or return a figure. Defaults to True. values_only (bool, optional): Return the values that would be plotted as tuple containing
two arrays: (x, y). Defaults to False.
- Returns:
Figure: If show is False, return a figure.
- show_shear_force(factor: float | None, verbosity: int, scale: float, offset: Tuple[float, float], figsize: Tuple[float, float] | None, show: bool, values_only: Literal[True]) Tuple[numpy.ndarray, numpy.ndarray][source]
- show_shear_force(factor: float | None, verbosity: int, scale: float, offset: Tuple[float, float], figsize: Tuple[float, float] | None, show: Literal[False], values_only: Literal[False]) matplotlib.figure.Figure
- show_shear_force(factor: float | None = None, verbosity: int = 0, scale: float = 1.0, offset: Tuple[float, float] = (0, 0), figsize: Tuple[float, float] | None = None, show: Literal[True] = True, values_only: Literal[False] = False) None
Plot the shear force.
- Args:
factor (Optional[float], optional): Influence the plotting scale. Defaults to None. verbosity (int, optional): 0: All information, 1: Suppress information. Defaults to 0. scale (float, optional): Scale of the plot. Defaults to 1. offset (Tuple[float, float], optional): Offset the plots location on the figure. Defaults to (0, 0). figsize (Optional[Tuple[float, float]], optional): Change the figure size. Defaults to None. show (bool, optional): Plot the result or return a figure. Defaults to True. values_only (bool, optional): Return the values that would be plotted as tuple containing
two arrays: (x, y). Defaults to False.
- Returns:
Figure: If show is False, return a figure.
- show_reaction_force(verbosity: int, scale: float, offset: Tuple[float, float], figsize: Tuple[float, float] | None, show: Literal[False]) matplotlib.figure.Figure[source]
- show_reaction_force(verbosity: int = 0, scale: float = 1.0, offset: Tuple[float, float] = (0, 0), figsize: Tuple[float, float] | None = None, show: Literal[True] = True) None
Plot the reaction force.
- Args:
verbosity (int, optional): 0: All information, 1: Suppress information. Defaults to 0. scale (float, optional): Scale of the plot. Defaults to 1. offset (Tuple[float, float], optional): Offset the plots location on the figure. Defaults to (0, 0). figsize (Optional[Tuple[float, float]], optional): Change the figure size. Defaults to None. show (bool, optional): Plot the result or return a figure. Defaults to True.
- Returns:
Figure: If show is False, return a figure.
- show_displacement(factor: float | None, verbosity: int, scale: float, offset: Tuple[float, float], figsize: Tuple[float, float] | None, show: bool, linear: bool, values_only: Literal[True]) Tuple[numpy.ndarray, numpy.ndarray][source]
- show_displacement(factor: float | None, verbosity: int, scale: float, offset: Tuple[float, float], figsize: Tuple[float, float] | None, show: Literal[False], linear: bool, values_only: Literal[False]) matplotlib.figure.Figure
- show_displacement(factor: float | None = None, verbosity: int = 0, scale: float = 1.0, offset: Tuple[float, float] = (0, 0), figsize: Tuple[float, float] | None = None, show: Literal[True] = True, linear: bool = False, values_only: Literal[False] = False) None
Plot the displacement.
- Args:
factor (Optional[float], optional): Influence the plotting scale. Defaults to None. verbosity (int, optional): 0: All information, 1: Suppress information. Defaults to 0. scale (float, optional): Scale of the plot. Defaults to 1. offset (Tuple[float, float], optional): Offset the plots location on the figure. Defaults to (0, 0). figsize (Optional[Tuple[float, float]], optional): Change the figure size. Defaults to None. show (bool, optional): Plot the result or return a figure. Defaults to True. linear (bool, optional): Don’t evaluate the displacement values in between the elements. Defaults to False. values_only (bool, optional): Return the values that would be plotted as tuple containing
two arrays: (x, y). Defaults to False.
- Returns:
Figure: If show is False, return a figure.
- show_results(verbosity: int, scale: float, offset: Tuple[float, float], figsize: Tuple[float, float] | None, show: Literal[False]) matplotlib.figure.Figure[source]
- show_results(verbosity: int = 0, scale: float = 1.0, offset: Tuple[float, float] = (0, 0), figsize: Tuple[float, float] | None = None, show: Literal[True] = True) None
Plot all the results in one window.
- Args:
verbosity (int, optional): 0: All information, 1: Suppress information. Defaults to 0. scale (float, optional): Scale of the plot. Defaults to 1. offset (Tuple[float, float], optional): Offset the plots location on the figure. Defaults to (0, 0). figsize (Optional[Tuple[float, float]], optional): Change the figure size. Defaults to None. show (bool, optional): Plot the result or return a figure. Defaults to True.
- Returns:
Figure: If show is False, return a figure.
- get_node_results_system(node_id: None = None) List[Dict[str, int | float]][source]
- get_node_results_system(node_id: int) Dict[str, int | float]
Get the node results. These are the opposite of the forces and displacements working on the elements and may seem counter intuitive.
- Args:
- node_id (int, optional): The node’s ID. If node_id == None or 0, the results of all nodes are returned.
Defaults to None.
- Returns:
- Union[ List[Dict[str, Union[int, float]]], Dict[str, Union[int, float]] ]:
If node_id == 0, returns a list containing tuples with the results: [(id, Fx, Fy, Tz, ux, uy, phi_z), (id, Fx, Fy…), () .. ] If node_id > 0, returns a dict with the results: {“id”: id, “Fx”: Fx, “Fy”: Fy, “Tz”: Tz, “ux”: ux, “uy”: uy, “phi_z”: phi_z}
- get_node_displacements(node_id: None) List[Dict[str, Any]][source]
- get_node_displacements(node_id: int) Dict[str, Any]
Get the node displacements.
- Args:
- node_id (int, optional): The node’s ID. If node_id == None or 0, the results of all nodes are returned.
Defaults to None.
- Returns:
- Union[List[Dict[str, Any]], Dict[str, Any]]: If node_id == 0, returns a list containing
tuples with the results: [(id, ux, uy, phi_z), (id, ux, uy, phi_z), … (id, ux, uy, phi_z) ] If node_id > 0, returns a dict with the results: {“id”: id, “ux”: ux, “uy”: uy, “phi_z”: phi_z}
- get_element_results(element_id: None, verbose: bool) List[Dict[str, Any]][source]
- get_element_results(element_id: int, verbose: bool) Dict[str, Any]
Get the element results.
- Args:
- element_id (int, optional): The element’s ID. If element_id == None or 0, the results of all elements
are returned. Defaults to None.
- verbose (bool, optional): If set to True, then numerical results for the deflection and the bending
moment are also returned. Defaults to False.
- Returns:
- Union[List[Dict[str, Any]], Dict[str, Any]]: If element_id == 0,
- returns a list containing dicts with the results: [{“id”: id, “length”: length, “alpha”: alpha,
“umax”: umax, “umin”: umin, “u”: u, “wmax”: wmax, “wmin”: wmin, “w”: w, “Mmin”: Mmin, “Mmax”: Mmax, “M”: M, “Qmin”: Qmin, “Qmax”: Qmax, “Q”: Q, “Nmin”: Nmin, “Nmax”: Nmax, “N”: N, “q”: q}, … ]
- If element_id > 0, returns a dict with the results: {“id”: id, “length”: length, “alpha”: alpha,
“umax”: umax, “umin”: umin, “u”: u, “wmax”: wmax, “wmin”: wmin, “w”: w, “Mmin”: Mmin, “Mmax”: Mmax, “M”: M, “Qmin”: Qmin, “Qmax”: Qmax, “Q”: Q, “Nmin”: Nmin, “Nmax”: Nmax, “N”: N, “q”: q}
- get_element_result_range(unit: Literal['shear', 'moment', 'axial'], minmax: Literal['min', 'max', 'abs']) List[float][source]
- get_element_result_range(unit: Literal['shear', 'moment', 'axial'], minmax: Literal['both']) List[Tuple[float, float]]
Get the element results. Returns a list with the min/max results of each element for a certain unit.
- Args:
unit (str): “shear”, “moment”, or “axial” minmax (str), optional: “min”, “max”, “abs”, or “both”. Defaults to “abs”.
Note that “both” returns a tuple with two values: (min, max)
- Raises:
NotImplementedError: If the unit is not implemented.
- Returns:
List[Union[float, Tuple[float]]]: List with min and/or max results of each element for a certain unit.
- get_node_result_range(unit: Literal['ux', 'uy', 'phi_z']) List[float][source]
Get the node results. Returns a list with the node results for a certain unit.
- Args:
unit (str): “uy”, “ux”, or “phi_z”
- Raises:
NotImplementedError: If the unit is not implemented.
- Returns:
List[float]: List with the node results for a certain unit.
- find_node_id(vertex: anastruct.vertex.Vertex | Sequence[float], tolerance: float = 1e-09) int | None[source]
Find the ID of a certain location.
- Args:
vertex (Union[Vertex, Sequence[float]]): Vertex_xz, [x, y], (x, y) tolerance (float): Tolerance for matching existing node locations (length units). Defaults to 1e-9.
- Raises:
TypeError: vertex must be a list, tuple or Vertex
- Returns:
Optional[int]: id of the node at the location of the vertex
- nodes_range(dimension: anastruct._types.Dimension) List[float | Tuple[float, float] | None][source]
Retrieve a list with coordinates x or y.
- Args:
dimension (str): “both”, ‘x’ or ‘y’
- Returns:
List[Union[float, Tuple[float, float], None]]: List with coordinates x or y
- nearest_node(dimension: anastruct._types.Dimension, val: float | Sequence[float]) int | None[source]
Retrieve the nearest node ID.
- Args:
dimension (str): “both”, ‘x’, ‘y’ or ‘z’ val (Union[float, Sequence[float]]): Value of the dimension.
- Returns:
Union[int, None]: ID of the node.
- discretize(n: int = 10) None[source]
Discretize the elements. Takes an already defined
SystemElementsobject and increases the number of elements.- Args:
n (int, optional): Divide the elements into n sub-elements.. Defaults to 10.
- remove_loads(dead_load: bool = False) None[source]
Remove all the applied loads from the structure.
- Args:
dead_load (bool, optional): Also remove the self-weights? Defaults to False.
- apply_load_case(loadcase: anastruct.fem.util.load.LoadCase) None[source]
Apply a load case to the structure.
- Args:
loadcase (LoadCase): Load case to apply.
- get_stiffness_matrix(element_id: int) numpy.ndarray | None[source]
Return the stiffness matrix for a specific element by its ID. Args:
element_id (int): ID of the element.
Returns: Optional[Union[list, None]]: The stiffness matrix of the element if it exists, otherwise None.
- __deepcopy__(_: str) SystemElements[source]
Deepcopy the SystemElements object.
- Args:
_ (str): Unnecessary argument.
- Returns:
SystemElements: Copied SystemElements object.
- class anastruct.LoadCase(name: str)[source]
Group different loads in a load case
- q_load(q: float | Sequence[float], element_id: int | Sequence[int], direction: str | Sequence[str] = 'element', rotation: float | Sequence[float] | None = None, q_perp: float | Sequence[float] | None = None) None[source]
Apply a q-load to an element.
- Parameters:
element_id – (int/ list) representing the element ID
q – (flt) value of the q-load
direction – (str) “element”, “x”, “y”, “parallel”
- point_load(node_id: int | Sequence[int], Fx: float | Sequence[float] = 0, Fy: float | Sequence[float] = 0, rotation: float | Sequence[float] = 0) None[source]
Apply a point load to a node.
- Parameters:
node_id – (int/ list) Nodes ID.
Fx – (flt/ list) Force in global x direction.
Fy – (flt/ list) Force in global x direction.
rotation – (flt/ list) Rotate the force clockwise. Rotation is in degrees.
- moment_load(node_id: int | Sequence[int], Tz: float | Sequence[float]) None[source]
Apply a moment on a node.
- Parameters:
node_id – (int/ list) Nodes ID.
Tz – (flt/ list) Moments acting on the node.
- class anastruct.LoadCombination(name: str)[source]
-
- add_load_case(lc: LoadCase | Sequence[LoadCase], factor: float | Sequence[float]) None[source]
Add a load case to the load combination.
- Parameters:
lc – (
anastruct.fem.util.LoadCase)factor – (flt) Multiply all the loads in this LoadCase with this factor.
- solve(system: anastruct.fem.system.SystemElements, force_linear: bool = False, verbosity: int = 0, max_iter: int = 200, geometrical_non_linear: bool = False, **kwargs: Any) Dict[str, anastruct.fem.system.SystemElements][source]
Evaluate the Load Combination.
- Parameters:
system – (
anastruct.fem.system.SystemElements) Structure to apply loads on.force_linear – (bool) Force a linear calculation. Even when the system has non linear nodes.
verbosity – (int) 0: Log calculation outputs. 1: silence.
max_iter – (int) Maximum allowed iterations.
geometrical_non_linear – (bool) Calculate second order effects and determine the buckling factor.
- Returns:
(ResultObject)
- Development **kwargs:
- param naked:
(bool) Whether or not to run the solve function without doing post processing.
- param discretize_kwargs:
When doing a geometric non linear analysis you can reduce or increase the number of elements created that are used for determining the buckling_factor
- class anastruct.Vertex(x: anastruct._types.VertexLike | anastruct._types.NumberLike, y: anastruct._types.NumberLike | None = None)[source]
Utility point in 2D.
- property y_neg: float
Y negative coordinate (equals negative of Y coordinate)
- Returns:
float: Y_neg coordinate
- modulus() float[source]
Magnitude of the vector from the origin to the Vertex
- Returns:
float: Magnitude of the vector from the origin to the Vertex
- unit() Vertex[source]
Unit vector from the origin to the Vertex
- Returns:
Vertex: Unit vector from the origin to the Vertex
- displace_polar(alpha: float, radius: float, inverse_y_axis: bool = False) None[source]
Displace the Vertex by a polar coordinate
- Args:
alpha (float): Angle in radians radius (float): Radius inverse_y_axis (bool, optional): Return a negative Y coordinate. Defaults to False.
- __add__(other: anastruct._types.VertexLike | anastruct._types.NumberLike) Vertex[source]
Add two Vertex objects
- Args:
other (Union[VertexLike, NumberLike]): Vertex to add
- Returns:
Vertex: Sum of the two Vertex objects
- __radd__(other: anastruct._types.VertexLike | anastruct._types.NumberLike) Vertex[source]
Add two Vertex objects
- Args:
other (Union[VertexLike, NumberLike]): Vertex to add
- Returns:
Vertex: Sum of the two Vertex objects
- __sub__(other: anastruct._types.VertexLike | anastruct._types.NumberLike) Vertex[source]
Subtract two Vertex objects
- Args:
other (Union[VertexLike, NumberLike]): Vertex to subtract
- Returns:
Vertex: Difference of the two Vertex objects
- __rsub__(other: anastruct._types.VertexLike | anastruct._types.NumberLike) Vertex[source]
Subtract two Vertex objects
- Args:
other (Union[VertexLike, NumberLike]): Vertex to subtract
- Returns:
Vertex: Difference of the two Vertex objects
- __mul__(other: anastruct._types.VertexLike | anastruct._types.NumberLike) Vertex[source]
Multiply two Vertex objects
- Args:
other (Union[VertexLike, NumberLike]): Vertex to multiply
- Returns:
Vertex: Product of the two Vertex objects
- __rmul__(other: anastruct._types.VertexLike | anastruct._types.NumberLike) Vertex[source]
Multiply two Vertex objects
- Args:
other (Union[VertexLike, NumberLike]): Vertex to multiply
- Returns:
Vertex: Product of the two Vertex objects
- __truediv__(other: anastruct._types.VertexLike | anastruct._types.NumberLike) Vertex[source]
Divide two Vertex objects
- Args:
other (Union[VertexLike, NumberLike]): Vertex to divide
- Returns:
Vertex: Quotient of the two Vertex objects
- __eq__(other: object) bool[source]
Check if two Vertex objects are equal
- Args:
other (object): Object to compare
- Raises:
NotImplementedError: If the object is not a Vertex object or a tuple or list of length 2
- Returns:
bool: True if the two Vertex objects are equal