A modular approach for topology optimization
Project description
pyMOTO
Modular topology optimization framework with semi-automatic derivatives. The two main types Module
and Signal
are used to implement a problem formulation to be optimized. The Module
implements functionality (and design
sensitivity calculations) and Signal
carries data of both the variables and their derivatives.
Sensitivity calculations are done based on backpropagation. The final value of interest is seeded with sensitivity
value $\frac{\textup{d}f}{\textup{d}f}=1$. Then the modules are executed in reverse order, each applying the chain rule.
As example for a Module
which maps $x\rightarrow y$, only the following operation needs to be implemented:
$$ \frac{\textup{d}f}{\textup{d}x} = \frac{\textup{d}f}{\textup{d}y}\frac{\textup{d}y}{\textup{d}x}\text{.} $$
In this way, the order of modules can easily be adapted without having to worry about sensitivities, as these are automatically calculated.
Quick start installation
- Make sure you have Python running in some kind of virtual environment (e.g. conda, miniconda, venv)
- Install the pymoto Python package (and its dependencies)
- Option A (conda): If you are working with Conda, install by
conda install -c aatmdelissen pymoto
- Option B (pip): Type
pip install pymoto
into your console to install
- Option A (conda): If you are working with Conda, install by
- Download one of the examples found in the repository's example folder (here)
- Run the example by typing
python ex_....py
in the console
For development, a local installation of pyMOTO
can be done by first downloading/cloning the entire git repo, and then calling
pip install -e .
in the pyMOTO
folder (of course from within your virtual environment).
Dependencies
- numpy - Dense linear algebra and solvers
- scipy - Sparse linear algebra and solvers
- sympy - Symbolic differentiation for
MathGeneral
module - Matplotlib - Plotting and visualisation
- (optional) opt_einsum - Optimized function for
EinSum
module
For fast linear solvers for sparse matrices:
- (optional) pypardiso - Uses the Intel OneAPI PARDISO solver (recommended)
- (optional) scikit-umfpack - Fast LU linear solver based on UMFPACK
- (optional) scikit-sparse - Fast Cholesky solver based on CHOLMOD
- (optional) cvxopt - Another fast Cholesky solver based on CHOLMOD
Note on linear solvers for sparse matrices: Scipy implements a version of LU which is quite slow. To increase the
speed of the optimization, pypardiso
is recommended as it contains a very robust and flexible solver for symmetric
and asymmetric matrices. An alternative is scikit-umfpack
which provides a fast LU factorization. For symmetric
matrices a Cholesky factorization is recommended (not provided with Scipy), which can be used by either installing
scikit-sparse
or cvxopt
.
License
pyMOTO is available under te MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pymoto-1.4.0.tar.gz
.
File metadata
- Download URL: pymoto-1.4.0.tar.gz
- Upload date:
- Size: 97.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c51b7b16decb11725dc3832410a04e3f4a3de8bcb29945b85e89a80ed40947da |
|
MD5 | 06fcfaafc5fb4b68051aef58c77676fc |
|
BLAKE2b-256 | 100299f92445243f9b43514155f5289cfec4b806aae8900c4120f4bbda4fd919 |
File details
Details for the file pyMOTO-1.4.0-py3-none-any.whl
.
File metadata
- Download URL: pyMOTO-1.4.0-py3-none-any.whl
- Upload date:
- Size: 80.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3fe22e5031ed54c35af14c065ad7ffdc2ea466cb3ad6fbe2c05178522f8cd2e6 |
|
MD5 | 1799f7b23bbf678fe01bc9da8bb98ab3 |
|
BLAKE2b-256 | e4696b3bb8b5da16ffd1d98be3bbe9e980dd391f2081bae82d2c6f624b7b4a8a |