# anaStruct 2D Frames and Trusses
[![Python tests](https://github.com/ritchie46/anaStruct/actions/workflows/test.yaml/badge.svg)](https://github.com/ritchie46/anaStruct/actions/workflows/test.yaml)
[![Documentation Status](https://readthedocs.org/projects/anastruct/badge/?version=latest)](http://anastruct.readthedocs.io/en/latest/?badge=latest)
Analyse 2D Frames and trusses for slender structures. Determine the bending moments, shear forces, axial forces and displacements.
## Installation
For the actively developed version:
```
$ pip install git+https://github.com/ritchie46/anaStruct.git
```
Or for a release:
```
$ pip install anastruct
```
## Read the docs!
[Documentation](http://anastruct.readthedocs.io)
## Questions
Got a question? Please ask on [gitter](https://gitter.im/anaStruct/lobby).
## Includes
* trusses :heavy_check_mark:
* beams :heavy_check_mark:
* moment lines :heavy_check_mark:
* axial force lines :heavy_check_mark:
* shear force lines :heavy_check_mark:
* displacement lines :heavy_check_mark:
* hinged supports :heavy_check_mark:
* fixed supports :heavy_check_mark:
* spring supports :heavy_check_mark:
* q-load in elements direction :heavy_check_mark:
* point loads in global x, y directions on nodes :heavy_check_mark:
* dead load :heavy_check_mark:
* q-loads in global y direction :heavy_check_mark:
* hinged elements :heavy_check_mark:
* rotational springs :heavy_check_mark:
* non-linear nodes :heavy_check_mark:
* geometrical non linearity :heavy_check_mark:
* load cases and load combinations :heavy_check_mark:
* generic type of section - rectangle and circle :heavy_check_mark:
* EU, US, UK steel section database :heavy_check_mark:
## Examples
```python
from anastruct import SystemElements
import numpy as np
ss = SystemElements()
element_type = 'truss'
# Create 2 towers
width = 6
span = 30
k = 5e3
# create triangles
y = np.arange(1, 10) * np.pi
x = np.cos(y) * width * 0.5
x -= x.min()
for length in [0, span]:
x_left_column = np.ones(y[::2].shape) * x.min() + length
x_right_column = np.ones(y[::2].shape[0] + 1) * x.max() + length
# add triangles
ss.add_element_grid(x + length, y, element_type=element_type)
# add vertical elements
ss.add_element_grid(x_left_column, y[::2], element_type=element_type)
ss.add_element_grid(x_right_column, np.r_[y[0], y[1::2], y[-1]], element_type=element_type)
ss.add_support_spring(
node_id=ss.find_node_id(vertex=[x_left_column[0], y[0]]),
translation=2,
k=k)
ss.add_support_spring(
node_id=ss.find_node_id(vertex=[x_right_column[0], y[0]]),
translation=2,
k=k)
# add top girder
ss.add_element_grid([0, width, span, span + width], np.ones(4) * y.max(), EI=10e3)
# Add stability elements at the bottom.
ss.add_truss_element([[0, y.min()], [width, y.min()]])
ss.add_truss_element([[span, y.min()], [span + width, y.min()]])
for el in ss.element_map.values():
# apply wind load on elements that are vertical
if np.isclose(np.sin(el.ai), 1):
ss.q_load(
q=1,
element_id=el.id,
direction='x'
)
ss.show_structure()
ss.solve()
ss.show_displacement(factor=2)
ss.show_bending_moment()
```
![](doc/source/img/examples/tower_bridge_struct.png)
![](doc/source/img/examples/tower_bridge_displa.png)
![](doc/source/img/examples/tower_bridge_moment.png)
```python
from anastruct import SystemElements
ss = SystemElements(EA=15000, EI=5000)
# Add beams to the system.
ss.add_element(location=[0, 5])
ss.add_element(location=[[0, 5], [5, 5]])
ss.add_element(location=[[5, 5], [5, 0]])
# Add a fixed support at node 1.
ss.add_support_fixed(node_id=1)
# Add a rotational spring support at node 4.
ss.add_support_spring(node_id=4, translation=3, k=4000)
# Add loads.
ss.point_load(Fx=30, node_id=2)
ss.q_load(q=-10, element_id=2)
# Solve
ss.solve()
# Get visual results.
ss.show_structure()
ss.show_reaction_force()
ss.show_axial_force()
ss.show_shear_force()
ss.show_bending_moment()
ss.show_displacement()
```
![](images/rand/structure.png)
### Real world use case.
[Non linear water accumulation analysis](https://ritchievink.com/blog/2017/08/23/a-nonlinear-water-accumulation-analysis-in-python/)
Raw data
{
"_id": null,
"home_page": "",
"name": "anastruct",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "Brooks Smith <smith120bh@gmail.com>",
"keywords": "FEA,finite element,structural engineering,structural analysis",
"author": "",
"author_email": "Ritchie Vink <ritchie46@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/b6/a4/8d2f67b51fb6a0a960a1420edf6f54039d4db9780ac3e23b0aecfe99e362/anastruct-1.5.0.tar.gz",
"platform": null,
"description": "# anaStruct 2D Frames and Trusses\n[![Python tests](https://github.com/ritchie46/anaStruct/actions/workflows/test.yaml/badge.svg)](https://github.com/ritchie46/anaStruct/actions/workflows/test.yaml)\n[![Documentation Status](https://readthedocs.org/projects/anastruct/badge/?version=latest)](http://anastruct.readthedocs.io/en/latest/?badge=latest)\n\nAnalyse 2D Frames and trusses for slender structures. Determine the bending moments, shear forces, axial forces and displacements.\n\n## Installation\n\nFor the actively developed version:\n```\n$ pip install git+https://github.com/ritchie46/anaStruct.git\n```\n\nOr for a release:\n```\n$ pip install anastruct\n```\n\n## Read the docs!\n\n[Documentation](http://anastruct.readthedocs.io)\n\n## Questions\n\nGot a question? Please ask on [gitter](https://gitter.im/anaStruct/lobby).\n\n## Includes\n\n* trusses :heavy_check_mark:\n* beams :heavy_check_mark:\n* moment lines :heavy_check_mark:\n* axial force lines :heavy_check_mark:\n* shear force lines :heavy_check_mark:\n* displacement lines :heavy_check_mark:\n* hinged supports :heavy_check_mark:\n* fixed supports :heavy_check_mark:\n* spring supports :heavy_check_mark:\n* q-load in elements direction :heavy_check_mark:\n* point loads in global x, y directions on nodes :heavy_check_mark:\n* dead load :heavy_check_mark:\n* q-loads in global y direction :heavy_check_mark:\n* hinged elements :heavy_check_mark:\n* rotational springs :heavy_check_mark:\n* non-linear nodes :heavy_check_mark:\n* geometrical non linearity :heavy_check_mark:\n* load cases and load combinations :heavy_check_mark:\n* generic type of section - rectangle and circle :heavy_check_mark:\n* EU, US, UK steel section database :heavy_check_mark:\n\n## Examples\n\n```python\nfrom anastruct import SystemElements\nimport numpy as np\n\nss = SystemElements()\nelement_type = 'truss'\n\n# Create 2 towers\nwidth = 6\nspan = 30\nk = 5e3\n\n# create triangles\ny = np.arange(1, 10) * np.pi\nx = np.cos(y) * width * 0.5\nx -= x.min()\n\nfor length in [0, span]:\n x_left_column = np.ones(y[::2].shape) * x.min() + length\n x_right_column = np.ones(y[::2].shape[0] + 1) * x.max() + length\n\n # add triangles\n ss.add_element_grid(x + length, y, element_type=element_type)\n # add vertical elements\n ss.add_element_grid(x_left_column, y[::2], element_type=element_type)\n ss.add_element_grid(x_right_column, np.r_[y[0], y[1::2], y[-1]], element_type=element_type)\n\n ss.add_support_spring(\n node_id=ss.find_node_id(vertex=[x_left_column[0], y[0]]),\n translation=2,\n k=k)\n ss.add_support_spring(\n node_id=ss.find_node_id(vertex=[x_right_column[0], y[0]]),\n translation=2,\n k=k)\n\n# add top girder\nss.add_element_grid([0, width, span, span + width], np.ones(4) * y.max(), EI=10e3)\n\n# Add stability elements at the bottom.\nss.add_truss_element([[0, y.min()], [width, y.min()]])\nss.add_truss_element([[span, y.min()], [span + width, y.min()]])\n\nfor el in ss.element_map.values():\n # apply wind load on elements that are vertical\n if np.isclose(np.sin(el.ai), 1):\n ss.q_load(\n q=1,\n element_id=el.id,\n direction='x'\n )\n\nss.show_structure()\nss.solve()\nss.show_displacement(factor=2)\nss.show_bending_moment()\n\n```\n\n![](doc/source/img/examples/tower_bridge_struct.png)\n\n![](doc/source/img/examples/tower_bridge_displa.png)\n\n![](doc/source/img/examples/tower_bridge_moment.png)\n\n\n```python\nfrom anastruct import SystemElements\n\nss = SystemElements(EA=15000, EI=5000)\n\n# Add beams to the system.\nss.add_element(location=[0, 5])\nss.add_element(location=[[0, 5], [5, 5]])\nss.add_element(location=[[5, 5], [5, 0]])\n\n# Add a fixed support at node 1.\nss.add_support_fixed(node_id=1)\n\n# Add a rotational spring support at node 4.\nss.add_support_spring(node_id=4, translation=3, k=4000)\n\n# Add loads.\nss.point_load(Fx=30, node_id=2)\nss.q_load(q=-10, element_id=2)\n\n# Solve\nss.solve()\n\n# Get visual results.\nss.show_structure()\nss.show_reaction_force()\nss.show_axial_force()\nss.show_shear_force()\nss.show_bending_moment()\nss.show_displacement()\n```\n![](images/rand/structure.png)\n\n### Real world use case.\n[Non linear water accumulation analysis](https://ritchievink.com/blog/2017/08/23/a-nonlinear-water-accumulation-analysis-in-python/)\n",
"bugtrack_url": null,
"license": "GPL-3.0",
"summary": "Finite element analysis of 2D structures",
"version": "1.5.0",
"project_urls": {
"author": "https://ritchievink.com",
"documentation": "http://anastruct.readthedocs.io",
"homepage": "https://github.com/ritchie46/anaStruct"
},
"split_keywords": [
"fea",
"finite element",
"structural engineering",
"structural analysis"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c8925d9d46885b0a834f20091fae922d0abbe99f977f60618590a76fd2589bb0",
"md5": "88a9fefebfaf83ee2d8242ab2d1f78b4",
"sha256": "cdaef55bae41818ae81c221bb5d5d64a6573da64d25917f34586846c03a4d8c9"
},
"downloads": -1,
"filename": "anastruct-1.5.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "88a9fefebfaf83ee2d8242ab2d1f78b4",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 360386,
"upload_time": "2023-10-30T11:40:13",
"upload_time_iso_8601": "2023-10-30T11:40:13.310617Z",
"url": "https://files.pythonhosted.org/packages/c8/92/5d9d46885b0a834f20091fae922d0abbe99f977f60618590a76fd2589bb0/anastruct-1.5.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "b6a48d2f67b51fb6a0a960a1420edf6f54039d4db9780ac3e23b0aecfe99e362",
"md5": "7efb2ccc1f0cf81a34d4fee53b4aa2a1",
"sha256": "d8b5c2e6d7e40a2a3edd803fb76bb435a1fdd0d3a167a9ad11edb5a9d1c56633"
},
"downloads": -1,
"filename": "anastruct-1.5.0.tar.gz",
"has_sig": false,
"md5_digest": "7efb2ccc1f0cf81a34d4fee53b4aa2a1",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 171674,
"upload_time": "2023-10-30T11:40:15",
"upload_time_iso_8601": "2023-10-30T11:40:15.349149Z",
"url": "https://files.pythonhosted.org/packages/b6/a4/8d2f67b51fb6a0a960a1420edf6f54039d4db9780ac3e23b0aecfe99e362/anastruct-1.5.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-10-30 11:40:15",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ritchie46",
"github_project": "anaStruct",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "numpy",
"specs": [
[
">=",
"1.15"
]
]
},
{
"name": "scipy",
"specs": [
[
">=",
"1.1.0"
]
]
}
],
"test_requirements": [
{
"name": "black",
"specs": [
[
"==",
"23.10.1"
]
]
},
{
"name": "mypy",
"specs": [
[
"==",
"1.6.1"
]
]
},
{
"name": "pylint",
"specs": [
[
"==",
"3.0.2"
]
]
},
{
"name": "pytest",
"specs": [
[
"==",
"7.4.3"
]
]
},
{
"name": "pytest-describe",
"specs": [
[
"==",
"2.1.0"
]
]
},
{
"name": "pytest-pspec",
"specs": [
[
"==",
"0.0.4"
]
]
},
{
"name": "pytest-raises",
"specs": [
[
"==",
"0.11"
]
]
}
],
"lcname": "anastruct"
}