Implementing a new FEM solver (MoFEM)

About the development of the FEM module/workbench.

Moderator: bernd

Helios113
Posts: 27
Joined: Mon Jun 07, 2021 7:30 pm

Implementing a new FEM solver (MoFEM)

Post by Helios113 »

Hello everyone!
My name is Preslav and I am implementing a new FEM solver into FreeCAD.

I am part of the MoFEM development team and I am working on implementing our FEM code (MoFEM) to work with FreeCAD. This post is long overdue, as I have been working on this for the past month and a half, but I wanted to play around with the code and get a better idea of the scope of this project before I posted here. I want to use this opportunity as my first contact with the FreeCAD community and tell all of you a bit about what I am doing.

I joined the MoFEM team about two months ago and immediately began working on FreeCAD, trying to integrate MoFEM's user modules into the FEM workbench. MoFEM, which is the name of the core FEM library, is a very powerful code which is currently under development and hopefully will be in the coming years as it is the main FEM project supported by the University of Glasgow. MoFEM is currently controlled fully through code and the terminal, and is designed for very advanced user. MoFEM has been used on industrial projects and there are publications about it. You can find more info about MoFEM at: http://mofem.eng.gla.ac.uk/.

As MoFEM's ui is quite complex or, as some will argue, non-existent, integrating it's functionality into FreeCAD will make MoFEM more accessible to people of all skill and knowledge levels.

I have integrated the linear elasticity module. I am now working on building a few tools that MoFEM needs to work properly with FreeCAD and later I will be implementing more modules and designing a system that will allow my team to update MoFEM and FreeCAD more easily with new features and modules. I will leave this vague for now as I myself have not figured everything out.

So this is basically what is happening. I would love to hear from all you lovely people what you think about our little endeavour and what features or analysis types you would like to see implemented by our module. I will be checking this forum regularly and relaying any info to my team. I am also very happy to answer any questions that you may have.

Thank you all for your time.

Edit: made link work
Last edited by Helios113 on Thu Jul 08, 2021 2:52 pm, edited 1 time in total.
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Implementing a new FEM solver (MoFEM)

Post by bernd »

Hi Preslav

welcome to FreeCAD FEM. May I ask some questions ...

- Is MoFEM OpenSource? Can it be used in buissiness environment (For example OpenSees is OpenSource but is not allowed to use in buissiness environment without extra licence.)
- Is your MoFEM integration OpenSource? If yes where is the food? :mrgreen:
- Did you use the existent solver framework of FreeCAD FEM which makes it easy to make a new solver or did you write a new one?
- Questions over questions?

cheers bernd
Helios113
Posts: 27
Joined: Mon Jun 07, 2021 7:30 pm

Re: Implementing a new FEM solver (MoFEM)

Post by Helios113 »

Hello Bernd,

MoFEM is licenced under LGPL, so yes it can be run by industry and my team lead asked me to make a point that it is currently run by industry ;) .
The implementation will fall under the same licence as well. The food is on my fork :mrgreen:. I plan on breaking down everything into a few pull requests because I had to modify more than one module.

Implementation wise, I used the code from elmer and ccx as inspiration when implementing MoFEM, so it has a solver, tasks and writer script. I don't know if that is what you meant by existent framework.

Speaking about pull requests, for some of our modules we need spring boundary conditions, so I had to add stiffness as a unit. Was there a particular reason why it has not been added yet and is it ok to add it?

Regards,
Preslav
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Implementing a new FEM solver (MoFEM)

Post by Kunda1 »

Subscribed to this thread :D
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Implementing a new FEM solver (MoFEM)

Post by bernd »

Helios113 wrote: Thu Jul 08, 2021 2:45 pm MoFEM is licenced under LGPL, so yes it can be run by industry and my team lead asked me to make a point that it is currently run by industry ;) .
The implementation will fall under the same licence as well.
very good news

Helios113 wrote: Thu Jul 08, 2021 2:45 pm The food is on my fork :mrgreen:. I plan on breaking down everything into a few pull requests because I had to modify more than one module.
how about a link to a git repo? I am curious ;) If it is FEM related code it is me who does the review and merge into main repo. Before you go for a PR to FreeCAD main repo present it here. It is much easier to disscuss on the forum. Make small PRs. If you would like to make changes outside FEM module make a separate PR only for this code. Such a PR might be reviewed by others as well.

Helios113 wrote: Thu Jul 08, 2021 2:45 pm Implementation wise, I used the code from elmer and ccx as inspiration when implementing MoFEM, so it has a solver, tasks and writer script. I don't know if that is what you meant by existent framework.
In FEM module is a solver framework. These are all the modules in package femsolver. This makes it easy to add a new solver. Just add the solver object and you are done. As an example https://github.com/berndhahnebach/FreeC ... ec44a08109 and https://github.com/berndhahnebach/FreeC ... 8070ccbe59 Furthermore the new solver needs a writer. ATM we do have two main systems. The writer for calculix and the one for elmer. They are totally separate modules and do not share any code. It's a shame, but the elmer writer was written from scratch. I am curious if you used some existant code, what would be great or if you added a third independent writer.

Helios113 wrote: Thu Jul 08, 2021 2:45 pm Speaking about pull requests, for some of our modules we need spring boundary conditions, so I had to add stiffness as a unit. Was there a particular reason why it has not been added yet and is it ok to add it?
Great. Go for a small PR which only adds this new unit. No one did do anything else in this regard. For Calculix I had just not had the time and need to implement it.


cheers bernd
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Implementing a new FEM solver (MoFEM)

Post by bernd »

does MoFEM support real beam and shell analysis?
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Implementing a new FEM solver (MoFEM)

Post by Kunda1 »

Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Helios113
Posts: 27
Joined: Mon Jun 07, 2021 7:30 pm

Re: Implementing a new FEM solver (MoFEM)

Post by Helios113 »

Hello all,

To reply to bernd first. We do not support beam and shell elements but they can be implemented if the need arises.
The implementation repo is here: https://github.com/Helios113/FreeCAD
It's not polished yet, so take it with a grain of salt. Also I have only made basic linear elasticity work for now.

To reply to Kunda1. Yes, that is the repo. (https://bitbucket.org/likask/mofem-cephas/src/master/)

My first goal for now is to make a few PRs about small auxiliary things. The first major PR will implement linear elasticity and bone remodelling, the module for which you can check out at: https://bitbucket.org/likask/mofem_um_b ... rc/master/

Cheers,
Preslav
Helios113
Posts: 27
Joined: Mon Jun 07, 2021 7:30 pm

Re: Implementing a new FEM solver (MoFEM)

Post by Helios113 »

Hi all,

First PR is ready, you can find it here: https://github.com/Helios113/FreeCAD/tree/BaseStiff

I will read the forum and formally make the PR.

Cheers,
Preslav
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Implementing a new FEM solver (MoFEM)

Post by bernd »

Great stuff...

Did I read it correct... MoFEM only supports first order elements ATM.
Post Reply