New version of the SMEKlib library

Woah, it’s been more than a year since I released the first version of SMEKlib (an open-source Matlab library for finite element analysis of electrical machines, in case you’ve missed). I’m happy to say it was really well received, but I also admit but an update has been long overdue. Well, I’m even happier to say you can download a new version from GitHub.

SMEKlib will also be featured in a paper of mine in this year’s ICEM conference in Greece. The paper, assuming it passes review, will double as a coarse-level documentation of the library, i.e. something that has been sorely missing. You can find a sneak peek of the paper below – a comparison between SMEKlib and the in-house software FCSMEK. The former was faster, by the way.

Sidenote about ICEM: I’ll also be hosting a tutorial there, together with an awesome colleague of mine from Austria. We’ll cover optimization and modelling of electrical machines, with yours truly focusing on the latter part. So, hope to see you there.


Anyway, what’s new in the library? Well, the basic functionality is pretty much the same. Second-order shape functions are now included, and numerous small bugs have been fixed.

Flux plot with second-order shape functions.

However, it now includes some classes for wrapping up typical functionality under one object. For example, time-stepping analysis can now be performed with a single line of code. Like this, basically:


I guess anybody with even the basest understanding of programming (and the English language, of course), can understand the intent of the above snippet.

Matlab users can try the examples themselves right away. Octave is out of the question at the moment (due to the lack of enumeration classes), put a compatibility fix will be published shortly.

I’d still consider Matlab though – the performance is so much better at least on Windows platforms, and the license is very affordable for persons and businesses alike. In the 37 kW example, it was 4.8 versus ~20 seconds on my PC. Unix users could probably do a little better by linking Octave to e.g. OpenBLAS. However, even though SMEKlib’s pretty much entirely vectorized, the inner Newton iteration is still traversed hundreds if not thousands of times during a typical time-stepping simulation. Here, Matlab’s JIT compiler simply rules. Tangentially, Python+Numba starts to seem like the preferred alternative over Octave, assuming I ever have time for porting the library into Python-based Sneklib.

Is it for you?

Finally, the big question: why should you care? Well, you don’t have to. You can, of course, do most of the same things with a commercial software of your choice. Or if you are happy with static solutions only, you can settle for FEMM.

It all boils down to personal preferences; e.g. if you want a GUI versus how much access you like. Some people like tailored products, while others off-the-shelf everything – nothing wrong with either.

Need help with electric motor design or design software? Let's get in touch - satisfaction guaranteed!
SMEKlib update

Leave a Reply

Your email address will not be published. Required fields are marked *