Elmer Magnetostatics Integration

About the development of the FEM module/workbench.

Moderator: bernd

Post Reply
rzonnie
Posts: 2
Joined: Thu Dec 09, 2021 8:54 am

Elmer Magnetostatics Integration

Post by rzonnie »

Hi All,

For the past week, I have been working on integration of the Elmer 2D magnetostatics solver into the FreeCAD FEM workbench. My first little success moment was yesterday, when I could create the SIF, calculate the 2D vector potential results from a horseshoe magnet and show the results in FreeCAD :D. My goal is to integrate the 3D solvers as well, but I have to start somewhere and 2D cases are easier to test imho.

Currently, I have a little design question that is related to post processing in Elmer. The result from the magnetostatics solver (MagDyn2D/MagDyn) is a vector potential which is not always too useful. Hence Elmer provides a post-processing solver to determine the magnetic flux density via the MagnetoDynamics module and MagnetoDynamicsCalcFields subroutine. To add this post-processing solver to FreeCAD, it would be easiest to just create another equation object. However, this seems to contradict the requirement for a general front-end where equation objects can be reused between several solvers in the FEM Workbench. Another solution would be to make the magnetostatic equation object a bit more dynamic where you can set multiple solvers in one go. So what is the preferred way of doing this? Or is there another way that I don't see?

For the ones interested, this is the repository, it is updated regularly.
https://github.com/rzonnie/FreeCAD/tree ... etostatics

I hope to hear from you.

Kind Regards,
Remi
HoWil
Veteran
Posts: 1279
Joined: Sun Jun 14, 2015 7:31 pm
Location: Austria

Re: Elmer Magnetostatics Integration

Post by HoWil »

Dear Remi,

Nice to see that the support for Elmer is worked on. Love it :D .

Magnetostatics simulations are more often used than electrostatics which are already incorporated. So go for it :!:

Regarding your question about the flux-solver ..... isn't it similar to the flux-sover/equation for electrostatics?

Some time ago I tried to integrate 'freetextinputs' to enable the user to simply input whatever he/she likes but I never had time to go for a pull-request https://github.com/HoWilgh/FreeCAD/tree ... etextinput. Maybe this is of some help or at least some inspiration for you.

BR,
HoWil

BTW, do you already know the FEM-Examples under the menu 'Utilities' .. there you can open several examples for 'Solvers'-> 'elmer'
rzonnie
Posts: 2
Joined: Thu Dec 09, 2021 8:54 am

Re: Elmer Magnetostatics Integration

Post by rzonnie »

Hey Howil,

Thanks for your response. I checked out your work on freetextinput, that is indeed handy pass custom scripts to ElmerSolver. Seems like a shame not to go for a pull request. ;)

The magnetostatics solvers are a bit different from the electrostatic ones. In case of electrostatics you can just set a few parameters in the SIF file for the eletrostatics solver and it will calculate the fields. However, in case of magnetostatics, the AV solution is directly passed to another solver to determine the fields. Hence, the SIF file needs at least two solvers to obtain the fields (not including for example result output solver section). For now I will just stick this to an equation object, so that the user can tinker around with the correct solver settings easily in the GUI. Eventually, it can always be changed when people don't agree. :roll:

I will post some updates when there is something cool to show.

Thanks, stay safe.
Remi
HoWil
Veteran
Posts: 1279
Joined: Sun Jun 14, 2015 7:31 pm
Location: Austria

Re: Elmer Magnetostatics Integration

Post by HoWil »

rzonnie wrote: Mon Dec 13, 2021 9:06 pm Thanks for your response. I checked out your work on freetextinput, that is indeed handy pass custom scripts to ElmerSolver. Seems like a shame not to go for a pull request. ;)
If it still works with current FC and somebody is willing to test it, I think it could be included during the holidays.
BR,
Howil
AlbertoR
Posts: 8
Joined: Mon May 29, 2023 7:50 am

Re: Elmer Magnetostatics Integration

Post by AlbertoR »

Hallo everyone,
I'm new to the forum and, in general, I'm not an experienced user of FC (I'm learning right now how to make a proper mesh).

Anyway I would like to exploit more the FEM capabilities of FC, in particular I would like to make some magnetostatic analysis and so: are there any news about this topic?

I sow that there is the possibility to develop new add-on for the FEM workbench but I am not enough advanced in FreeCAD to approach the problem in this way. Maybe I can help a forerunner.

Regards
Alberto

p.s.
I'm using:

Code: Select all

OS: Windows 10 Version 2009
Word size of FreeCAD: 64-bit
Version: 0.20.29177 (Git)
Build type: Release
Branch: releases/FreeCAD-0-20
Hash: 68e337670e227889217652ddac593c93b5e8dc94
Python 3.8.10, Qt 5.15.2, Coin 4.0.1, Vtk 8.2.0, OCC 7.6.2
Locale: Italian/Italy (it_IT)
User avatar
NewJoker
Veteran
Posts: 3018
Joined: Sun Oct 11, 2020 7:49 pm

Re: Elmer Magnetostatics Integration

Post by NewJoker »

AlbertoR wrote: Mon May 29, 2023 8:11 am I would like to make some magnetostatic analysis and so: are there any news about this topic?
You are lucky, those analyses were recently implemented: viewtopic.php?t=75888

FEM EquationMagnetodynamic
Post Reply