Coupled physics, submeshes support and so on ...

About the development of the FEM module/workbench.

Moderator: bernd

User avatar
vejmarie
Posts: 706
Joined: Mon Jan 04, 2016 4:52 pm
Location: Somewhere between France, USA and Taiwan
Contact:

Coupled physics, submeshes support and so on ...

Postby vejmarie » Mon Jul 25, 2016 8:34 am

Hi,

In the intend to integrate Elmer to FreeCAD, I am struggled to something I was expecting, and which probably needs our carefull attention if we want do multiphysics.
wind_tunnel.png
wind_tunnel.png (143.84 KiB) Viewed 2407 times
Attach is a picture of a "wind tunnel" with a small asic heatsink (vertical fins) in the middle. The idea is to heat up the heatsink with some power, and see how the component ends up when the solution is stabalized, as to identify if we reach the max Tj or not. We do have at least 2 physical entities with this very basic study. One is the surrounding air and the heatsink by itself.

As to perform an analysis, we need to provide to the solvers boundaries conditions which includes Ambiant temperature, thermal properties and speed of movement of the air (if we have a fan). The heat sink by itself needs to have material allocated, and there is junctions between air and heat sink.

The air area is modelized using a Cube area currently, and I removed the heatsink from it as to define some specific boundaries conditions on the part, but this is definitly not the way to proceed. I end up with a single mesh and no issues with boundary conditions, but I can't analyze the heat sink thermal response as this is not a volume anymore just a hole inside the air space. I couldn't have 2 meshes because boundary conditions are becoming a massive mess as mesh nodes are not aligned.

This bring me to the idea that we really need to add a few core things in FEM module if we are willing to extend to new solvers which includes multiphysics. We need meshes with sub mesh (or group of mesh), or multibody mesh, I don't really know how to call them. There is something which is also key, boundaries between solid and fluid, or solid to solid must share the same nodes, as to avoid any convergence issue from solvers and simplify exchange (either forces, or energy).

It looks to me currently useless to try to implement any new solver without these features on board, as we will be really limitated to what we could do with them.

Does anybody faced the same issues ? Is there any workaround that I missed ? If somebody soon started to implement anything might be great to know how !

Bernd, I think some part of your code regarding multi-material might be interesting, how did you manage interfaces ?

vejmarie
ickby
Posts: 2992
Joined: Wed Oct 05, 2011 7:36 am

Re: Coupled physics, submeshes support and so on ...

Postby ickby » Mon Jul 25, 2016 9:18 am

Yes, it is quite clear that the current FEM meshing capabilities are only usefull for the most simple types of analysis. Anything more involved will require much more control over the meshing process. this is not only true for multiphysics, also for single-domain analysis with different material properties like in electromagnetics. IMHO everything we need is availbable in SMESH, it only must be exposed to the python interface and a GUI needs to be setup. For example have a look at this thread from pythonOCC guys which use SMESH for some nice meshing: http://www.pythonocc.org/resources/mesh ... and-smesh/

We could do exactly the same as we have everything needed in FreeCAD code already, only someone needs to start working on this. Of course this will require some serious thinking about a good python API and even more about a intuitive and powerful GUI. Not easy, but doable I think.
User avatar
bernd
Posts: 11091
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Coupled physics, submeshes support and so on ...

Postby bernd » Mon Jul 25, 2016 9:24 am

@vejmarie:
Could you post an example shape? I have been thinking on this multi body too allraedy. If the mesher is based on OCCT too it would may be an option to use an CompSolid and one mesh instead off multiple solids and multiple meshes?!

It workd for sure for multiple materials and mechanical analysis.

bernd
User avatar
bernd
Posts: 11091
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Coupled physics, submeshes support and so on ...

Postby bernd » Mon Jul 25, 2016 10:10 am

ickby wrote: For example have a look at this thread from pythonOCC guys which use SMESH for some nice meshing: http://www.pythonocc.org/resources/mesh ... and-smesh/.
Thanks for posting the link! Quit a great resource about meshing, this blog post !
User avatar
vejmarie
Posts: 706
Joined: Mon Jan 04, 2016 4:52 pm
Location: Somewhere between France, USA and Taiwan
Contact:

Re: Coupled physics, submeshes support and so on ...

Postby vejmarie » Mon Jul 25, 2016 1:30 pm

bernd wrote:@vejmarie:
Could you post an example shape? I have been thinking on this multi body too allraedy. If the mesher is based on OCCT too it would may be an option to use an CompSolid and one mesh instead off multiple solids and multiple meshes?!

It workd for sure for multiple materials and mechanical analysis.

bernd
Let me post during the day the "wind tunnel for heat sink ;)". I like the CompSolid approach it might ease a lot of things but we need to be sure that we can generate them, and that the process can be automatized (which might be the challenge if we need to downgrade the geometry to shell and then volume to generate the CompSolid).
User avatar
vejmarie
Posts: 706
Joined: Mon Jan 04, 2016 4:52 pm
Location: Somewhere between France, USA and Taiwan
Contact:

Re: Coupled physics, submeshes support and so on ...

Postby vejmarie » Mon Jul 25, 2016 1:30 pm

bernd wrote:
ickby wrote: For example have a look at this thread from pythonOCC guys which use SMESH for some nice meshing: http://www.pythonocc.org/resources/mesh ... and-smesh/.
Thanks for posting the link! Quit a great resource about meshing, this blog post !
Agree this blog is a great piece. One of the Elmer developper point me out to it either (I was knowing it before ;) ).
User avatar
bernd
Posts: 11091
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Coupled physics, submeshes support and so on ...

Postby bernd » Mon Jul 25, 2016 1:49 pm

vejmarie wrote: I like the CompSolid approach it might ease a lot of things but we need to be sure that we can generate them, and that the process can be automatized (which might be the challenge if we need to downgrade the geometry to shell and then volume to generate the CompSolid).
There have been added some great now tools to FreeCAD by DeepSOIC in this regard. Check:
viewtopic.php?f=9&t=16443
viewtopic.php?f=10&t=16644

All this is still in development but really promising IMHO. I have not had the time to test. The fem new constraints development is eating al my spare time. But will be able to merge it soon.
User avatar
vejmarie
Posts: 706
Joined: Mon Jan 04, 2016 4:52 pm
Location: Somewhere between France, USA and Taiwan
Contact:

Re: Coupled physics, submeshes support and so on ...

Postby vejmarie » Mon Jul 25, 2016 7:27 pm

bernd wrote:@vejmarie:
Could you post an example shape? I have been thinking on this multi body too allraedy. If the mesher is based on OCCT too it would may be an option to use an CompSolid and one mesh instead off multiple solids and multiple meshes?!

It workd for sure for multiple materials and mechanical analysis.

bernd
Here it is ... Not the best design I made ;)
Attachments
HeatSink.FCStd
(33.82 KiB) Downloaded 41 times
User avatar
bernd
Posts: 11091
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Coupled physics, submeshes support and so on ...

Postby bernd » Mon Jul 25, 2016 8:06 pm

vejmarie wrote:
bernd wrote:@vejmarie:
Could you post an example shape? I have been thinking on this multi body too allraedy. If the mesher is based on OCCT too it would may be an option to use an CompSolid and one mesh instead off multiple solids and multiple meshes?!

It workd for sure for multiple materials and mechanical analysis.

bernd
Here it is ... Not the best design I made ;)
make a CompSolid out of them is not so difficault. The new tools of DeepSOIC are not needed because the solids are inside each other.

see
viewtopic.php?f=8&t=13830#p110512
viewtopic.php?f=8&t=13830&start=20#p111039

Code: Select all

import Part
App.ActiveDocument.getObject("Box").Shape.ShapeType
App.ActiveDocument.getObject("Array").Shape.Solids[0].ShapeType
outer = App.ActiveDocument.getObject("Box").Shape
inner = App.ActiveDocument.getObject("Array").Shape.Solids[0]
cut = outer.cut(inner)
comp_solid = Part.CompSolid([cut.Solids[0],inner])
docobj = App.ActiveDocument.addObject("Part::Feature", "heat_sink")
docobj.Shape = comp_solid
docobj.ViewObject.Transparency = 75

# check on identical faces
s1 = comp_solid.Solids[0]
s2 = comp_solid.Solids[1]
for i in s1.Faces:
    for j in s2.Faces:
        print("Is same: %s" % (i.isSame(j)))
        if i.isSame(j):
            Part.show(i)

# save to brep! step does not support CompSolids!
comp_solid.exportBrep(u"/home/hugo/Desktop/heat_sink.brep")
If the CompSolid is meshed in GMSH it gives one big mesh glued together and the sharing face has mesh faces. In FreeCAD such mesh could be given two different materials allready. The problem is I do not know of an reasonable mechanical analysis. Mhh if youngs modulus of the inner is different from the outer the stress is different. I may try ...
HeatSink--compsolid.FCStd
(43.48 KiB) Downloaded 46 times
brep, remove .txt
heat_sink.brep.txt
(112.46 KiB) Downloaded 47 times
User avatar
vejmarie
Posts: 706
Joined: Mon Jan 04, 2016 4:52 pm
Location: Somewhere between France, USA and Taiwan
Contact:

Re: Coupled physics, submeshes support and so on ...

Postby vejmarie » Mon Jul 25, 2016 8:57 pm

bernd wrote:
vejmarie wrote:
bernd wrote:@vejmarie:
Could you post an example shape? I have been thinking on this multi body too allraedy. If the mesher is based on OCCT too it would may be an option to use an CompSolid and one mesh instead off multiple solids and multiple meshes?!

It workd for sure for multiple materials and mechanical analysis.

bernd
Here it is ... Not the best design I made ;)
make a CompSolid out of them is not so difficault. The new tools of DeepSOIC are not needed because the solids are inside each other.

see
viewtopic.php?f=8&t=13830#p110512
viewtopic.php?f=8&t=13830&start=20#p111039

Code: Select all

import Part
App.ActiveDocument.getObject("Box").Shape.ShapeType
App.ActiveDocument.getObject("Array").Shape.Solids[0].ShapeType
outer = App.ActiveDocument.getObject("Box").Shape
inner = App.ActiveDocument.getObject("Array").Shape.Solids[0]
cut = outer.cut(inner)
comp_solid = Part.CompSolid([cut.Solids[0],inner])
docobj = App.ActiveDocument.addObject("Part::Feature", "heat_sink")
docobj.Shape = comp_solid
docobj.ViewObject.Transparency = 75

# check on identical faces
s1 = comp_solid.Solids[0]
s2 = comp_solid.Solids[1]
for i in s1.Faces:
    for j in s2.Faces:
        print("Is same: %s" % (i.isSame(j)))
        if i.isSame(j):
            Part.show(i)

# save to brep! step does not support CompSolids!
comp_solid.exportBrep(u"/home/hugo/Desktop/heat_sink.brep")
If the CompSolid is meshed in GMSH it gives one big mesh glued together and the sharing face has mesh faces. In FreeCAD such mesh could be given two different materials allready. The problem is I do not know of an reasonable mechanical analysis. Mhh if youngs modulus of the inner is different from the outer the stress is different. I may try ...

HeatSink--compsolid.FCStd

brep, remove .txt
heat_sink.brep.txt
Ok I will test that. I am running currently with a Compound and it generate what I was expecting in the case of inclusion (by the way most coupled physics will integrate a global domain ;)), same thing than a compsolid mesh output in fact. The key thing is that there is still a single mesh into the file without subgroup etc ... which make it difficult to use in tool like Elmer especially on material allocation, as it still detect a single mesh.

How do you identify into multiple material which part of the single mesh is allocated ? Ok I think this is through the shape representation and you get the node out of it ? Due to the fact the interfaces are good you can generate a proper mesh ?