[solved] How do I export Fenics mesh with domain information?

About the development of the FEM module/workbench.

Moderator: bernd

Post Reply
bbatazai
Posts: 7
Joined: Wed Feb 20, 2019 1:19 pm

[solved] How do I export Fenics mesh with domain information?

Post by bbatazai »

Dear community,

I am stuck with the problem of converting a FreeCAD FEM mesh to fenics with subdomain marks included. Does anyone have an example on how to achieve this?

I read though the wiki and the post fenics solver.
Then I tried to figure it out on my own with these steps:

1) Create a simple geometry: Sphere in extruded hexagon, apply combound filter following this tutorial:
overview.png
overview.png (205.66 KiB) Viewed 2133 times

2) Create gmsh mesh using FEM workbench and mark the sphere and the hexagon as groups by the following steps:
  1. Mesh-> FEM Mesh from shape by Gmsh, click ok (not apply)
  2. click on the new created object and add groups by:
    Mesh-> FEM Mesh group, double click on the newly created object in the tree, tick solid, add reference from solid, choose the outer solid
    do the same for the sphere. The sphere is chosen by changing the view to 'right view' (pressing 3), then it appears in the hexagonial shape.
  3. create mesh by clicking on double clicking on the FEMMeshGmsh object and clicking apply
3) export to fenics xml: Mark FEMMeshGmsh object, click File -> Export -> FEM mesh Fenics
what I would have loved to have are two files: mesh_name.xml and mesh_name_physical_regions.xml, the latter containing two regions I have marked using the FEM Mesh groups.

Does anyone have experience / ideas how to continue?

Thank you in advance

Baltasar


FreeCad info:
OS: Debian GNU/Linux buster/sid
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.
Build type: None
Python version: 2.7.15+
Qt version: 5.11.3
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedStates (en_US)
Last edited by bbatazai on Thu Apr 25, 2019 11:02 am, edited 1 time in total.
chrisb
Veteran
Posts: 54293
Joined: Tue Mar 17, 2015 9:14 am

Re: How do I export Fenics mesh with domain information?

Post by chrisb »

Moved to FEM forum.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: How do I export Fenics mesh with domain information?

Post by bernd »

joha2 wrote: ping
HoWil wrote: ping
joha2
Posts: 303
Joined: Tue Oct 11, 2016 9:48 pm

Re: How do I export Fenics mesh with domain information?

Post by joha2 »

Sorry for my late reply. I will have a look at it.

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

Re: How do I export Fenics mesh with domain information?

Post by joha2 »

bbatazai wrote: Wed Feb 20, 2019 2:15 pm
3) export to fenics xml: Mark FEMMeshGmsh object, click File -> Export -> FEM mesh Fenics
what I would have loved to have are two files: mesh_name.xml and mesh_name_physical_regions.xml, the latter containing two regions I have marked using the FEM Mesh groups.
From my understanding the Fenics XML format is deprecated and therefore I didn't implement it very sophistically. If it is possible, please use the Fenics XDMF format for using domain information. See, e.g.:

https://forum.freecadweb.org/viewtopic. ... &start=180

Maybe this helps already with your problem. Or is there a deeper reason, why you need XML?

Best wishes
Johannes
bbatazai
Posts: 7
Joined: Wed Feb 20, 2019 1:19 pm

Re: How do I export Fenics mesh with domain information?

Post by bbatazai »

Sorry I hadn't seen your answer (notification was off).

There was no reason I need xml. I hadn't understood how to use the regions from the xdmf file in fenics but now I did.

Thank you for your efforts

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

Re: How do I export Fenics mesh with domain information?

Post by joha2 »

Nice that it worked now.

Best wishes
Johannes

PS: Please change the topic of the thread to [Solved] How do I export ...
Post Reply