This library implements the finite element method (FEM) for various thermo-piezoelectric systems in Python. The solvers are written using numpy and scipy as well as gmsh for generating 2D meshes. The models are always assumed to be rotational symmetric but besides that arbitray geometies can be simulated. Excitations and material parameters can be set freely based on the definition of physical groups in gmsh.
Right now various simulation types are supported:
- Heat condution simulation in time domain
- Piezoelectric simulation (coupled mechanical and electrical field) in time and frequency domain
- Coupled thermo-piezoelectric simulations in time domain
- Nonlinear piezoelectric simulations using mechanical quadratic nonlinearities in time and frequency domain
Additionaly there helper classes for specific coupled simulation types:
- Thermo-piezoelectric simulation in time domain with mechanical loss calculation for hamonic exictations with a subsequent separate heat conduction simulation utilizing the averaged mechanical losses
- Thermo-piezoelectric simulation in frequency domain with a subsequent heat conduction simulation in time domain which can utilize temperature dependent material parameters
The package can be cloned using git and installed using pip install. It is recommended to install and activate a python virtual environment first.
Some example simulation setups can be found here. The examples in this file are documented in detail.
For the solvers some basic tests are implemented. They run simple example simulations and compare the results with known test data which is created at a verified solver state. In order to run the tests it is necessary to install pytest.
pip install pytestThen the tests can be run using
pytestIn order to run the documentation sphinx and sphinx_rtd_theme must be installed.
pip install sphinx sphinx_rtd_themeIn order to build the documentation the code *.rst files can be created with
sphinx-apidoc -f -o docs pluthoand afterwards, the whole documentation can be built using:
sphinx-build -M html docs docs/buildIn order to make changes to the local plutho installation make sure to install it using the -e parameter:
pip install -e .Here are some additional features and optimizations which could be applied to the code. Some of those feature can be discussed and are not mandatory:
- Remove print statements and implement logging
- Add tests for the nonlinear solvers
- Simulation speedups
- Using lru caches?
- Using jit from numba?
- Parallelizing assembly procedure?
- When creating the simulation results folder the simulation name can be removed from the file names
- Update importing structure Use add and import *
- Check if multiple materials already works or if continuity and boundary conditions are needed
- Add test for thermal simulation with convective boundary condition
- Put all nonlinear options into one data class
- Creating post processing views for gmsh takes a very long time