FEM anaylsis of GDML Designs.

About the development of the FEM module/workbench.

Moderator: bernd

keithsloan52
Posts: 1450
Joined: Mon Feb 27, 2012 5:31 pm

FEM anaylsis of GDML Designs.

Post by keithsloan52 » Thu Sep 19, 2019 7:39 am

I am in the process of developing a GDML workbench see https://github.com/KeithSloan/FreeCAD_Python_GDML

Currently a number of GDML solid types are supported.
The GDML Solids are implemented as FreeCAD Python Objects.

The main purpose of a GDML design is for Monte Carlo Particle analysis (which needs Solid Geometries rather than any Mesh)
but I wondering about other analysis, such as heat transfer etc. So wondering if one could analyse a GDML design with the FEM work bench.

Knowing very little about FEM the above would be a very large learning curve for me,
so was wondering if somebody who is familiar with FEM could try the above and let me know what I need to do to facilitate the above and if it is possible provide a short write up that I could add to my documentation.

Thanks
vocx
Posts: 5206
Joined: Thu Oct 18, 2018 9:18 pm

Re: FEM anaylsis of GDML Designs.

Post by vocx » Thu Sep 19, 2019 5:12 pm

keithsloan52 wrote:
Thu Sep 19, 2019 7:39 am
...

The main purpose of a GDML design is for Monte Carlo Particle analysis (which needs Solid Geometries rather than any Mesh)
but I wondering about other analysis, such as heat transfer etc. So wondering if one could analyse a GDML design with the FEM work bench.
What exactly is Monte Carlo Particle analysis, and why does it need solid geometries?

The way the finite element method works, and other numerical methods like it, is that it breaks a single object into many small individual components; that's what "finite element" indicates. This necessarily means that you create a mesh (a cloud of points) from your solid, so a particular mathematical function is evaluated in each of the vertices of the mesh.

Operating on an entire solid, that is, not on a mesh, means that you only use the outer edges of the body; you don't know what happens "inside", so to speak. Is this what you want?
... could try the above and let me know what I need to do to facilitate the above and if it is possible provide a short write up that I could add to my documentation.
What above? Heat transfer in solids? In any case, it sounds like a solid needs to be meshed in order to be able to do any sort of analysis.
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
keithsloan52
Posts: 1450
Joined: Mon Feb 27, 2012 5:31 pm

Re: FEM anaylsis of GDML Designs.

Post by keithsloan52 » Fri Sep 20, 2019 5:05 am

Fully aware that FEM needs to produce a MESH for analysis.

I assume that the programs that produce Meshes take as input a single Part.

Now with an imported GDML file, things are under a Part ( World Volume ) but within Parts they can be separate Objects
and the Objects are all FreeCAD Python Objects i..e. just have a valid OpenCascade Shape i.e. Object,Shape. So the question is
can the Mesh programs handle this.

I would upload a saved FreeCAD file made from an import GDML file, but currently the FreeCAD Python Objects do not save properly.
So it would be good it somebody installed the workbench from Github and opened one of the Sample files. I would start with G4Box.gdml
under SampleFile/GDML_Solids and see if a Mesh can be produced. If yes try with more complicated files.

There is also the question of materials. Like is there way to convert the GDML definitions to something that FEM uses.
For info on what GDML uses for materials see http://geant4.in2p3.fr/2007/prog/Giovan ... ls_v08.pdf
User avatar
bernd
Posts: 11012
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: FEM anaylsis of GDML Designs.

Post by bernd » Fri Sep 20, 2019 5:22 am

keithsloan52 wrote:
Fri Sep 20, 2019 5:05 am
I assume that the programs that produce Meshes take as input a single Part.
What do you mean by a single Part? If you mean a single Solid, than no. If you nean a single Shape than yes the mesher could only handle one Shape. But a Shape could be a Compound and a Compound could be made from everything even from the Shapes of a thousand Parts.

For multimaterial we use CompSolids. These are Solids which share faces, thus they are connected. For mixedelement analysis (1D (line) and 2D (area) and 3D (volume) we use compounds.

That said at the moment we need to pass one Part. But if we need to pass more Parts we just make a Compound of all Parts and pass this one. ATM FreeCAD FEM does not support analysis with multiple meshes. This because it is not implemented to connect the meshes. But one mesh could consist of not connected elements (from twe not connected solids in one compound) and they are connected by a contact constraint.

Would be great to see an example of these GDML design.
keithsloan52
Posts: 1450
Joined: Mon Feb 27, 2012 5:31 pm

Re: FEM anaylsis of GDML Designs.

Post by keithsloan52 » Fri Sep 20, 2019 7:42 am

This is an example of a file that is more than one object but not too complex.
structure.png
structure.png (304.73 KiB) Viewed 810 times
I don't really want to have to learn how to use FEM to test this out as I already have too much on my plate. If you could advise or test out
that would be great.

All GDML files have a World Volume ( implemented as a FreeCAD Part ) it contains one GDML Object/Solid which is like a bounding box.
This Volume then has 1-n Volumes, these contain 1-n GDML Object which may or may not overlap.

Should I add a function to scan down from the World Volume but avoid its bounding box object and create a compound that I can then call some mesh function. What if the objects don't overlap?

I thought there were a number of Mesh making programs, how does one make selecting one and performing a Mesh operations
vocx
Posts: 5206
Joined: Thu Oct 18, 2018 9:18 pm

Re: FEM anaylsis of GDML Designs.

Post by vocx » Fri Sep 20, 2019 5:34 pm

keithsloan52 wrote:
Fri Sep 20, 2019 7:42 am
...
All GDML files have a World Volume ( implemented as a FreeCAD Part ) it contains one GDML Object/Solid which is like a bounding box.
This Volume then has 1-n Volumes, these contain 1-n GDML Object which may or may not overlap.
What does it mean "overlap" in this case? Overlap as in one body penetrates the other? Or just superficially touching the other? Creating meshes of bodies that intersect (penetrate) each other is generally not good. But touching, or not touching, is fine.
Should I add a function to scan down from the World Volume but avoid its bounding box object and create a compound that I can then call some mesh function. What if the objects don't overlap?
That seems sensible. Then you would be compounding different solid shapes. As Bernd said, the objects don't need to be touching to be meshed.
I thought there were a number of Mesh making programs, how does one make selecting one and performing a Mesh operations
FEM doesn't have an internal mesher, it uses either Gmsh or Netgen. These are programs that you can download, install, and run by themselves. It's generally simple to produce a basic triangular (tetrahedral) mesh; just import the solid (Step, Brep, CatPart, etc.) and press mesh. Obviously each program has a multitude of options to control the mesh size, density, shape, etc. You can use any mesher you want, as long as it generates something that FEM can read, like .inp (Abaqus format).
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
keithsloan52
Posts: 1450
Joined: Mon Feb 27, 2012 5:31 pm

Re: FEM anaylsis of GDML Designs.

Post by keithsloan52 » Fri Sep 20, 2019 6:41 pm

Okay suppose I add a function that scans down a Volume ( Part ) and creates a compound that I attach to the hierarchy under the selected Volume/Part. Could one then switch to the FEM work bench, then select that compound and go from there?
vocx
Posts: 5206
Joined: Thu Oct 18, 2018 9:18 pm

Re: FEM anaylsis of GDML Designs.

Post by vocx » Sat Sep 21, 2019 12:30 am

keithsloan52 wrote:
Fri Sep 20, 2019 6:41 pm
Okay suppose I add a function that scans down a Volume ( Part ) and creates a compound that I attach to the hierarchy under the selected Volume/Part. Could one then switch to the FEM work bench, then select that compound and go from there?
Yes, that sounds like it should work. Just select the compound, then click FEM MeshGmshFromShape, and if it works, that means you could probably continue with any FEM analysis (structural, thermal, etc.).

Don't forget to install Gmsh first.
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
keithsloan52
Posts: 1450
Joined: Mon Feb 27, 2012 5:31 pm

Re: FEM anaylsis of GDML Designs.

Post by keithsloan52 » Sat Sep 21, 2019 5:52 am

Okay I tried to see if I creating a Mesh for a simple GDML Object i.e. implemented as a FreeCAD Python Object.

When in FEM workbench. Have it selected then click on Mesh icon window pops up with Apply | Cancel | OK
but before I get to try Apply I get a message in Report View
Fem::FemMeshObjectPython / FEMMeshGmsh: Links go out of the allowed scope

If I try Apply I get
0.0: We are going to start ...
0.0: Start Gmsh ...
1.0: Clean run of Gmsh
1.0: Gmsh done!

But No mesh created as far as I can tell

Using Check Geometry in Part Workbench gives
1 processed out of 1 selecfed
0 invalid shapes
User avatar
bernd
Posts: 11012
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: FEM anaylsis of GDML Designs.

Post by bernd » Sat Sep 21, 2019 6:51 am

keithsloan52 wrote:
Sat Sep 21, 2019 5:52 am
Okay I tried to see if I creating a Mesh for a simple GDML Object i.e. implemented as a FreeCAD Python Object.

When in FEM workbench. Have it selected then click on Mesh icon window pops up with Apply | Cancel | OK
but before I get to try Apply I get a message in Report View
Fem::FemMeshObjectPython / FEMMeshGmsh: Links go out of the allowed scope

If I try Apply I get
0.0: We are going to start ...
0.0: Start Gmsh ...
1.0: Clean run of Gmsh
1.0: Gmsh done!

But No mesh created as far as I can tell

Using Check Geometry in Part Workbench gives
1 processed out of 1 selecfed
0 invalid shapes
would you post the FreeCAD file with that object ?
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests