FreeCAD for ElectroMagnetics

About the development of the FEM module/workbench.

Moderator: bernd

ediloren
Posts: 209
Joined: Wed May 08, 2013 9:23 pm
Location: Italy
Contact:

FreeCAD for ElectroMagnetics

Postby ediloren » Wed Jan 15, 2014 11:19 pm

I would like to leverage the new FEM workbench to create a connection to some electro-magnetic solvers (design/import in FreeCAD, meshing, export to the solver, import the results, view and analyze them).

FEM was the place to start in my mind, but I see that it is growing pretty mechanically-oriented, possibly for solving stress problems etc. (By the way, the solvers I have in mind are based on BEM (boundary-element methods), which is not exactly FEM - this is only semantic, but..)

So:

1. Would you be interested in having these functionality incorporated in the end in FreeCAD, or should I have it in a private branch? Please consider that, while we will link to free EM solvers like FastCap and FastHenry, the goal is also to interface to our commercial, closed-source solver FasterCap and its evolutions (seewww.fastfieldsolvers.com)

2. Do you think I should work on the FEM workbench, making it more general (e.g. another toolbar not for pulleys etc. but for electromagnetics) or open another workbench? I am worried about the 'workbench multiplication' effect, there are already so many, and most people will not be interested at all in ALL of them (e.g. robotics or ships are of low interest to people designing circuits etc.)

Thank you
Enrico
User avatar
jriegel
Site Admin
Posts: 3369
Joined: Sun Feb 15, 2009 5:29 pm
Location: Ulm, Germany
Contact:

Re: FreeCAD for ElectroMagnetics

Postby jriegel » Thu Jan 16, 2014 7:30 am

Sure I'm interested in incorporating such functionality!

The main question is, do you use the same data structure and meshers? At the moment the workflow for CAD->Tet10 vial Netgen mesher works pretty well.

If another workbench makes sense depends on your preferred work-flow. We can easily split the module in a FEM base module (which include the data structure) and special module for different specialities...

Using it for you proparitery solver is no problem, since FreeCAD LGPL.
Stop whining - start coding!
ediloren
Posts: 209
Joined: Wed May 08, 2013 9:23 pm
Location: Italy
Contact:

Re: FreeCAD for ElectroMagnetics

Postby ediloren » Thu Jan 16, 2014 5:17 pm

Not exactly. For the current workflow, I am interested only in a surface meshing (this is the meaning of 'boundary': only the surfaces are used as elements). So I am interested in meshing 3D objects, as well as emply shells (representing interfaces between different materials). To this goal, GMSH is more flexible, but it is far from having the design capabilities of FreeCAD; and in any case the Fem module has intrinsically all these functionality, since you provide access to the SMESH and Netgen capabilities.

So the idea here is to:

- write an import function for the FastCap / FasterCap format
- as part of the previous point, manage also the format import including the simulation results (each element gets a scalar value)
- be able to launch a simulation

with the above, I cover more or less the basic functionality that you can see in this short video tutorial.

but having FreeCAD behind, we can also import structures (e.g. Integrated Circuit package models) or desing them, so next step features are:

- be able to assign material properties
- mesh the surfaces with a mesh as coarse as possible, but with a certain quality (no small angles, etc.)
- export the mesh with the material annotations in FastCap / FasterCap format

Plus, going on:

- import GDSII format (IC designs) and manipulate it


What do you think?

Enrico
User avatar
jriegel
Site Admin
Posts: 3369
Joined: Sun Feb 15, 2009 5:29 pm
Location: Ulm, Germany
Contact:

Re: FreeCAD for ElectroMagnetics

Postby jriegel » Fri Jan 17, 2014 7:42 am

Mhh, I did ( 15 years ago) multi physics simulation with Ansys and AFAIK 2D will take you not very far. In lot of electromagnetic cases you need at least temperature in some form (which need 3D meshes) .

So why so a lot of work to implement 2D work-flows if you can use the 3D meshers and post-processing? Fundamental truth - the world is 3D ;)

Anyway, SMESH and Netgen can generate and handle 2D Surface meshes.
Stop whining - start coding!
ediloren
Posts: 209
Joined: Wed May 08, 2013 9:23 pm
Location: Italy
Contact:

Re: FreeCAD for ElectroMagnetics

Postby ediloren » Fri Jan 17, 2014 1:05 pm

I think I was not clear enough. I do need 2D mesh, but of a 3D surface, not of a 2D object.

In a nutshell, the reason behind the Boundary Element Methods (BEM) is that EM fields extend in space as well as in the materials, so you have to (possibly finely) discretize a whole region of space enclosing your structure, even if the space is empty. This leads to a very large number of elements, that can be intractable. One method to achieve better scalability is to transform the equations (cast into integral form) from volume integrals to surface integrals through the Green's identities, and consider only the surface. The results therefore are valid for the 3D objects, even if you are imposing conditions and solving for quantities only on the surface.

Actually this approach is already successful; you can check clicking on this Google Scholar link that the free FastCap solver (originally developed by M.I.T. for Unix, and that we distribute in Windows version) is referenced in more than one thousand papers.

So this workflow is already existing, but not in FreeCAD. I would like to move to FreeCAD because I think it can be very powerful and very versatile also for this task.

However, even using BEM, it is not unusual to have millions of unknown to deal with. This this is my second doubt with FreeCAD; so far I was not able to load big meshes (e.g. 100k elements or more) without issues. But this is another topic.

Ciao
Enrico
User avatar
jriegel
Site Admin
Posts: 3369
Joined: Sun Feb 15, 2009 5:29 pm
Location: Ulm, Germany
Contact:

Re: FreeCAD for ElectroMagnetics

Postby jriegel » Fri Jan 17, 2014 3:41 pm

We had the discussion about this Boundary models (non 2-manifilds) quit often lately. Some guys from Cern doing particle physics with that model and lately this one:
viewtopic.php?f=8&t=5113&hilit=cell&start=10

Our internal data model is BRep (strictly 2-manifold with some exceptions) and there fore would need some love for your cases. Meshing distinct surfaces is no problem. The biggest problem would be to write a algorithm which detect aligned solids and retrieve the boundary surface.

The amount of data is only limited by the memory and the graphic card you have. I'm working with FEM models with 1-2 million elements (Tet10) on a 32bit FreeCAD without problem. Sure you can use the wrong data structure to hold the data, but in FreeCAD we have a lot of data structures to choose from, some are more fat and some are quit lean. Depends on your use case.

In your case a own workbench would be good idea, since the approach is quit different to FEM. from this workbench you can use tool and data-structure from other workbenches, e.g. Mesh and MeshPart (which do surface meshing).

Do you do triangular or rectangular surface meshes?
Stop whining - start coding!
ediloren
Posts: 209
Joined: Wed May 08, 2013 9:23 pm
Location: Italy
Contact:

Re: FreeCAD for ElectroMagnetics

Postby ediloren » Sat Jan 18, 2014 5:39 pm

Mesh workbench is not good, since the meshing algorithm used there is not producing a quality triangulation (it creates thin triangles; e.g. when you mesh a cylinder, you get a central point on the top and bottom circular faces, and radial edges to the circumference. These triangles are thin towards the central point. This is I guess the standard OCC triangulation algorithm, that in fact is not quality-driven).

However, I think I can create the mesh in the BEM workbench, and manipulate it with the Mesh functions.

About STL, I tried to load big models, but failed. I will try again with the latest version, and open a topic if I still cannot.

Regarding your question, I work with both rectangular and triangular meshes.

So a new workbench it is. I will experiment a bit, then clone FreeCAD on github, and start pushing there my changes, so you and everybody else can follow what happens and decide if and when it is worth to eventually merge into master.

Thank you
Enrico
User avatar
jriegel
Site Admin
Posts: 3369
Joined: Sun Feb 15, 2009 5:29 pm
Location: Ulm, Germany
Contact:

Re: FreeCAD for ElectroMagnetics

Postby jriegel » Sat Jan 18, 2014 6:52 pm

There fore I suggested the MeshPart module, which use the FEM mesher and our own triangle mesh data structure (very efficient)....
Stop whining - start coding!
DomiChi
Posts: 54
Joined: Mon Mar 24, 2014 10:43 am
Location: Clermont Ferrand (FRANCE)

Re: FreeCAD for ElectroMagnetics

Postby DomiChi » Tue Apr 01, 2014 1:25 pm

ediloren wrote: 1. Would you be interested in having these functionality incorporated in the end in FreeCAD, or should I have it in a private branch? Please consider that, while we will link to free EM solvers like FastCap and FastHenry, the goal is also to interface to our commercial, closed-source solver FasterCap and its évolutions
Enrico
Not only commercial, think to FEMM (http://www.femm.info/wiki/HomePage) also open source.
ediloren
Posts: 209
Joined: Wed May 08, 2013 9:23 pm
Location: Italy
Contact:

Re: FreeCAD for ElectroMagnetics

Postby ediloren » Sun Apr 06, 2014 1:21 pm

Well FEMM is 2D - so not really a 100% match with FreeCAD. The authors themselves point to Radia for a 3D magnetic field solvers.
Anyway I agree with you, there are free solvers around, and I was not saying we could not address them as well. I am just saying that my primary purpose is to interface with our solvers at http://www.fastfieldsolvers.com, but the EM workbench in itself can be of course a platform for interfacing to other EM solvers as well, as the FEM workbench is.

Ciao
Enrico