Skip to content

Commit

Permalink
minor upates to README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
williamhunter committed Aug 22, 2017
1 parent 51b7664 commit d75a452
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 22 deletions.
4 changes: 3 additions & 1 deletion INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ following in your terminal:
You won't (shouldn't) see it again, even if ToPy is updated, since these
files shouldn't need to change. You can create the stiffness matrices without
solving a problem by simply running 'optimise.py' in the 'scripts' folder.
---

--

William Hunter
Date: 2017-08-21
50 changes: 29 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,34 @@

![ToPy Logo](https://cloud.githubusercontent.com/assets/14232913/16171741/64c6665c-3577-11e6-868c-c86f3520c594.png)

ToPy is a lightweight topology optimization framework for Python. It was originally hosted on Google Code, please refer to the [ToPy wiki](https://github.com/williamhunter/topy/wiki)
ToPy is a lightweight topology optimization framework for Python. It was originally hosted on Google Code, please refer to the [ToPy wiki](https://github.com/williamhunter/topy/wiki) for further information.

## Installation
All you need is the following:
All you need to do is the following:

```bash
$ git clone https://github.com/williamhunter/topy
$ git clone https://github.com/williamhunter/topy.git
$ cd topy/topy
$ python setup.py install
```

## Initialization
The main class of **ToPy** is `Topology`. It definess the main constraints, grid and parameters of optimization. There are 2 ways how you could define the `Topology`:
- TPD file. It is usefull for comand line
- Config dictionary. This is quite close to TPD file. However, it is a way useful if the initialization in code is needed.
Alternatively, you can download the latest stable release, but it usually lags
a little behind the Master branch (as can be expected).

### TPD (ToPy Definition)
There is a minimal set of parameters, which is required for successful definition of the problem:
## Initialization
The main class of **ToPy** is 'Topology'. It defines the main constraints, grid and parameters of optimization. There are two ways of defining a problem:
1. **TPD file**: You define the problem in a tet file and solve via the command line
2. **Config dictionary**: This is quite close to the TPD file, however,
you define the problem in a Python file; it's very useful if you want to
experiment and don't want to keep making changes to a text file.
You can later save the Config to a text file (a TPD file).

### TPD (**T**oPy **P**roblem **D**efinition) file
There is a minimal set of parameters, which is required for successful definition of a ToPy problem:
```
PROB_TYPE : comp
PROB_TYPE : comp
PROB_NAME : mbb_beam_minimal
ETA : 0.5
ETA : 0.5
DOF_PN : 2
VOL_FRAC : 0.5
FILT_RAD : 1.5
Expand All @@ -32,9 +38,9 @@ ELEM_K : Q4
NUM_ELEM_X : 60
NUM_ELEM_Y : 20
NUM_ELEM_Z : 0
NUM_ITER : 10
FXTR_NODE_X: 1|21
FXTR_NODE_Y: 1281
NUM_ITER : 10
FXTR_NODE_X: 1|21
FXTR_NODE_Y: 1281
LOAD_NODE_Y: 1
LOAD_VALU_Y: -1
```
Expand All @@ -50,7 +56,8 @@ topology.load_tpd_file('file.tpd')
```

### Config dictionary
First you have to define a config dictionary:
First you have to define a config dictionary (note the similarity with a TPD
file, especially the keywords):

```Python
config = {
Expand All @@ -72,20 +79,20 @@ config = {
'VOL_FRAC': 0.5
}
```
The requirements are the same as for `.tpd` file.
The requirements are the same as for `.tpd` file.

```Python
topology = Topology(config=config)
```
## Optimization
## Optimization (solving the problem)

You can use one-line solution:
You can use the one-line solution:

```bash
$ python topy/scripts/optimise.py <filename>.tpd
```

Or with script:
Or you can use a Python script:

```Python
import topy
Expand All @@ -97,13 +104,14 @@ topy.optimise(t)
```

## Visualization
Module `topy.visualization` allows one to save the output as a `.png` image for 2D problems or as a `.vtk` file for 3D. You can animate the obtained images with [convert](https://www.imagemagick.org/script/convert.php) tool.
Module `topy.visualization` allows one to save the output as a `.png` image for 2D problems or as a `.vtk` file for 3D. You can animate the obtained images with
the [convert](https://www.imagemagick.org/script/convert.php) tool.

```bash
convert -delay 35 *.png anim.gif
```

<div align="left">
<div align="left">
<img src="./src/beam_2d_reci_gsf.gif" width=40%>
<img src="./src/inverter_2d_eta03.gif" width=30%>
<img src="./src/t-piece_2d_Q4_eta04_gsf.gif" width=20%>
Expand Down

0 comments on commit d75a452

Please sign in to comment.