phyem is an open-source finite element library that bridges port-based thinking to numerics and enables LEGO-like simulations. The name, phyem, stands for

  • Python

  • port-Hamiltonian

  • fem

  • physics

It was initiated as a part of the ERC advanced project PortWings awarded to prof.dr.ir. Stefano Stramigioli.


phyem is Python-shelled; users interact with it through Python scripts or in Python console (Python3 only). The library is made user-friendly such that only a basic level of Python programming skills is required.


It has two major modules:




the mathematical kernel

It is for setting up the problem and the discretization theoretically.

Natural Python; it works with Windows, Linux or Mac.


The discretization is sent to one of the implementations. It uses a particular finite element setting, generates algebraic systems to be solved, and eventually gives results to be post-processed.

Depends on particular implementations; the msepy implementation is in natural Python.


In other words, they represent the theoretical and numerical aspects of the library, respectively. And the former is pure Python; while the later has Python shells and APIs to back-ends of different kernels to make fully use of resources in the open-access community.


The tutorial of phyem has four parts,


More examples, demonstrations, explanations, etc., are available.

Contact & contributors#

📞 Getting in touch is important.


If you find any error in phyem or on this site, we appreciate it a lot if you could report it on the Github issue page of phyem or let us know through Contact.

Privacy statement

Site traffic is measured only for statistic. Absolutely no data which may lead to minimal leak of your privacy is ever recorded. Thank you very much for visiting phyem.