Fenics as Solver

About the development of the FEM module/workbench.

Moderator: bernd

joha2
Posts: 215
Joined: Tue Oct 11, 2016 9:48 pm

Re: Fenics as Solver

Postby joha2 » Sun Jul 15, 2018 10:57 am

HoWil wrote:
Sat Jun 16, 2018 9:10 am
Hi Johannes,
I tested the integration over an inner boundary in a minimal fenics example where I created the geometry and mesh in fenics and the result is the same. I get zero when simply integrating over such an inner boundary.
So there has to be a solution inside fenics.
I am thinking of using the normal vector in combination with an inner product but did not succeed until now.
Do you have any new ideas about that?
Br,
Howil
Heyhey HoWil,

sorry for the late reply, but I was on vacation the last two weeks. First to your question:

Since my experience in Fenics is quite limited I also was not able to extract the normal vector information from the boundary. I will check whether it is possible to access different points or facets of the boundary from a facet function. From that you could easily calculate the normal vector from e.g. three points A, B, C by using (A - B) x (B - C)/||(A - B) x (B - C)||. Maybe it would also be nice to make an accessible object which extracts these quantities in the Fenics tools :-) Another possibility would be to calculate the normal vector direclty from an expression if you know your boundary analytically (i.e. for a sphere with center C it is just (x - C)/||x-C||). Hope this helps a bit.

Now to the Fenics interface: I refactored the interface such that you can load the facet functions and cell functions directly from an XDMF reader class. Also the mesh is available there which you need to define the vector spaces. They could be used as before, but now you can also define vector expressions for the cell functions (i.e. to define a current or something like this). I think the interface becomes more and more useful. Although due to the value_shape() method in the Expression class I had to define an ugly class hierarchy. Maybe this could be removed in the future. The PR is created on bernds femdev branch. Maybe you could give me your opinion.

In a few days I will provide some code for solving a vector Poisson equation or something like this.

Best wishes
Johannes
joha2
Posts: 215
Joined: Tue Oct 11, 2016 9:48 pm

Re: Fenics as Solver

Postby joha2 » Sat Apr 06, 2019 9:48 am

Hey guys,

due to one of the last PRs (https://forum.freecadweb.org/viewtopic.php?f=17&t=35171) the Fenics JIT compiler works now from a macro. This can be used to calculate FEM simulations with a FEMMesh from FreeCAD. Still missing:
  • Fenics simulation is done directly in Python code, therefore no interface necessary, but maybe needed
  • Embedding into Analysis structure (not necessary right now)
  • Creating of result object from Paraview solution files
Any suggestions?

Best wishes
Johannes