Topology Optimization using Python
Mainly for Windows users so that you can install Pysparse via 'conda-forge'
Requirement: Install Python 2.7 in a virtual environment, I suggest (require, actually) using conda (download the Anaconda Python distribution or Miniconda).
Do the following in a terminal (on Windows in an 'Anaconda Prompt' terminal). I typed below from memory so might not be 100% correct:
conda create --name py27 python=2.7
conda activate py27
conda install -c anaconda numpy
conda
, similar to above, e.g., for PyVTK do conda install -c conda-forge pyvtk
conda install -c conda-forge pysparse
(for more info refer to https://anaconda.org/conda-forge/pysparse)You can now install ToPy in the the py27
environment by cd'ing into the topy
directory and typing python setup.py install
You should now be set if you didn't get any errors.
Try running an example in the topy\examples\mbb_beam
folder by typing (for example, on Windows) 'python .\optimise.py .\beam_2d_reci_10_iters.tpd'; you should see ToPy running (creating stiffness matrices first), you may have to type the command again. You should then see 10 iterations with accompanying images in the iterations
subfolder.
You can now create and visualize (using Gmsh) an initial domain in 3d, just like you can for 2d. See the Tutorial section which will have a 3d example in the next couple of weeks (or years), similar to the 2d one that illustrates the use of Gmsh.
It makes it a lot easier to find node numbers and elements because you can see the initial mesh in 3d and you can therefore see the node and element numbers.
You cannot (yet) use Gmsh to define problems, at this stage Gmsh is used as an aid to find node and element numbers. You still need to define a TPD file. Gmsh is therefore used as a visual aid to define ToPy's TPD files.
Mostly Ivan's additions:
See the Tutorial...
Restructured source code directories, topy subdir now contains only relevant code. This is also in preparation for adding functionality to visualisation.py. No changes to the code as such.
I thought v0.2.0 was it, but it turns out I tested the wrong code base on my local machine :-1: My bad.
This release (v0.2.1) should now work fine and closes #6.
Moved from Google Code; this release contains a few minor changes, also tested it on Windows 7 and everything still works. The source code itself contains no changes as such, just moved the files around a bit.
UPDATE: Won't install correctly, see issue #6.
William Hunter