Skip to content

Commit

Permalink
Merge pull request #21 from Krande/pr-0.0.14
Browse files Browse the repository at this point in the history
PR 0.0.14 [release]
  • Loading branch information
Krande authored Jun 14, 2021
2 parents 580a264 + 4f1a516 commit 24176ed
Show file tree
Hide file tree
Showing 19 changed files with 536 additions and 238 deletions.
73 changes: 46 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,39 @@
# ADA - Assembly for Design & Analysis

A python library for structural analysis and design that focus on interoperability between
IFC and various Finite Element formats.
A python library for working with structural analysis and design delivering an object-oriented framework for modelling
and Finite Element (FE) model conversion, editing, analysis and postprocessing.

With `ada` you can (among other things) convert your FE models to IFC, create your own recipes for creating FE mesh from
your IFC models, or build your design from the ground up using fully customizable and extendible python classes and
functions to build parametric designs with rules for automated joint/penetration identification and steel detailing.

Additionally, you can create unittests to not only test the code that makes your structure, but also create tests
that checks the capacity of your structure by running FE analysis on it and validating the resulting
stresses and strains generated by your FE software of choice.

And since everything is open source and written in regular python you are free to easily
customize and create whatever design and analysis pipeline of your choosing.

The FEM formats that has received the most development are Abaqus and Code Aster (the latter being under development
now), but there is also basic support for Calculix, Sesam and Usfos. There is also support for conversion of FEM meshes
to/from meshio (which supports many more FEM formats, but does not support FEM information such as beam/shell thickness,
materials etc..)

Part of the goal is to build the necessary tools for anyone to add support for their favorite FEM format with as
few lines of code as possible.

This library is still undergoing significant development so expect there to be occasional bugs and breaking changes.

Try the latest build online here
## Quick Links

Clicking the link below will open a jupyter notebook client in the cloud using the latest version of adapy with
Code Aster and Calculix pre-installed.

[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/Krande/adapy/main)

(clicking the link above will open a jupyter notebook client in the cloud using the latest version of adapy)
![img.png](docs/_static/figures/jupyter-example.png)


## Quick Links
* Feel free to start/join any informal topic related to adapy [here](https://github.com/Krande/adapy/discussions).
* Issues related to adapy can be raised [here](https://github.com/Krande/adapy/issues)

Expand All @@ -33,7 +54,7 @@ To install ada using pip

First you need to have installed `ifcopenshell` and `pythonocc-core` from conda-forge.

`conda -c conda-forge ifcopenshell pythonocc-core`
`conda -c conda-forge ifcopenshell pythonocc-core==7.5.1 occt==7.5.1`

After the conda-forge dependencies are installed you can install ada using

Expand All @@ -51,8 +72,7 @@ Note! Conda installation is not yet set up.


## Usage
Some example of using the ada package

Some examples of using the ada package


### Create an IFC file
Expand All @@ -62,24 +82,28 @@ The following code
```python
from ada import Assembly, Part, Beam

a = Assembly("MyAssembly") / (Part("MyPart") / Beam("MyBeam", (0,0,0), (1,0,0), "IPE300"))
a = Assembly("MyAssembly") / (Part("MyPart") / Beam("MyBeam", (0, 0, 0), (1, 0, 0), "IPE300"))
a.to_ifc("C:/temp/myifc.ifc")
```

creates an IFC with the following hierarchy (as shown in the figure below taken from the awesome
[blender](https://blender.org) plugin [blenderbim](https://blenderbim.org/))
creates an Ifc file containing an IfcBeam with the following hierarchy

MyAssembly (IfSite)
MyPart (IfcBuildingStorey)
MyBeam (IfcBeam)

![Beam Visualized in BlenderBIM](docs/_static/figures/my_beam.png)

The resulting IfcBeam (and corresponding hierarchy) shown in the figure above is taken from the awesome
[blender](https://blender.org) plugin [blenderbim](https://blenderbim.org/).


### Create and execute a FEM analysis in Calculix, Code Aster and Abaqus

This example uses a function `beam_ex1` from [here](src/ada/param_models/fem_models.py) that returns an
Assembly object ready to be written to FEM.
Assembly object with a single `Beam` with a few holes in it (to demonstrate a small portion of the steel detailing
capabilities in ada and IFC) converted to a shell element mesh using a FE mesh recipe `create_beam_mesh` found
[here](ada/fem/io/mesh/recipes.py).

```python
from ada.param_models.fem_models import beam_ex1
Expand All @@ -91,16 +115,16 @@ a.to_fem("MyCantilever_calculix", "calculix", overwrite=True, execute=True)
a.to_fem("MyCantilever_code_aster", "code_aster", overwrite=True, execute=True)
```

after the execution is finished you can look at the results using supported post-processing software or directly
after the code is executed you can look at the results using supported post-processing software or directly
in python using Jupyter notebook/lab (currently only supported for Code Aster) for the FEA results.


![Calculix (Paraview) Results](docs/_static/figures/fem_beam_paraview.png)
![Abaqus Results](docs/_static/figures/fem_beam_abaqus.png)
![Code Aster (jupyter) results](docs/_static/figures/code_aster_jupyter_displ.png)

or if your prefer to keep it in python here is a way you can use meshio to read the results from calculix and do your
postprocessing using python only.
To access the stress and displacement data directly using python here is a way you can use meshio to read the results
from Calculix and Code Aster (continuing on the previous example).

```python
from ada.config import Settings
Expand All @@ -119,29 +143,24 @@ ca_mesh = meshio.read(rmed, 'med')
print('Code Aster:',ca_mesh.point_data['DISP[10] - 1'][-1][:3])
```

In short `beam_ex1` creates a `Beam` object which it uses to create a shell element `FEM` mesh using
a mesh recipe [create_beam_mesh](https://github.com/Krande/adapy/blob/c594ccbfbdd2ea9384fa8a4721a65580331b4a09/src/ada/fem/io/mesh/recipes.py#L99-L223).
The recipe uses [GMSH](https://gmsh.info/) to construct elements on nodes.


The current reasoning is to work with a base representation of beam/plates and have the ability
to easily create a FEM representation of any of the base objects in 1D (beam elements),
2D (shell elements) or 3D (elements) using your own meshing recipes (i.e. not just build a mesh, but a recipe for
building meshes).


**Note!**

The above example assumes you have installed Abaqus and Calculix locally on your computer.
The above example assumes you have installed Abaqus, Calculix and Code Aster locally on your computer.

To set correct paths to your installations of Abaqus or Calculix you wish to use there are a few ways of doing so.

1. Add directory path of abaqus.bat or ccx.exe to your system path.
2. Add directory paths to system environment variables. This can be done by using the control panel or running the following from a cmd prompt with administrator rights:

```cmd
:: Windows
setx ADA_abaqus_exe <path to your abaqus.bat>
setx ADA_ccx_exe <path to your ccx.exe>
setx ADA_code_aster_exe <path to your ccx.exe>
:: Linux?
:: Mac?
```
3. Set parameters in python by using environment variables or the ada.config.Settings class, like so:

Expand Down
Binary file added docs/_static/figures/jupyter-example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion examples/cantilever_fem.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"cell_type": "markdown",
"source": [
"# Cantilever Beam analyzed using Calculix\n",
"# Cantilever Beam analyzed using Calculix and Code Aster\n",
"\n",
"The following example demonstrates how you can use `ada` to quickly build, visualize, simulate and postprocess FEM analysis."
],
Expand Down
3 changes: 2 additions & 1 deletion examples/cantilever_fem_extended.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"source": [
"# Design and Analyze a beam with holes\n",
"\n",
"The following example demonstrates how you can add penetrations to a beam using various primitives and finally export it to an IFC file"
"The following example demonstrates how you can add penetrations to a beam using various primitives and finally\n",
"export it to an IFC file"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = ada-py
version = 0.0.13
version = 0.0.14
author = Kristoffer H. Andersen
author_email = kristoffer_andersen@outlook.com
description = Assembly for Design & Analysis - A python library for structural analysis and design
Expand Down
Loading

0 comments on commit 24176ed

Please sign in to comment.