Better mesh last instead of mesh first?

About the development of the FEM module/workbench.

Moderator: bernd

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

Re: Better mesh last instead of mesh first?

Post by bernd »

bernd wrote:small update to the macre the group mesh was created with:

https://gist.github.com/berndhahnebach/ ... 6df1c909bf
another small update. It works on windows too.
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Better mesh last instead of mesh first?

Post by bernd »

The use of groupdata for speed up file writing for multibody material fem is in master 0.17.8584 (git commit 56b1530) An example can be downloaded here: http://www.b75.ch/download/multiple-mat ... mple.fcstd The mesh with group data needs 2.5 seconds on my laptop, the mesh without group data needs 270 seconds to write CalculiX input file. Be aware CalculiX itself takes quite some time too.
ulrich1a
Veteran
Posts: 1957
Joined: Sun Jul 07, 2013 12:08 pm

Re: Better mesh last instead of mesh first?

Post by ulrich1a »

bernd wrote: The mesh with group data needs 2.5 seconds on my laptop, the mesh without group data needs 270 seconds to write CalculiX input file.
These are really good news. :)
It sounds, like FreeCAD will make much more fun with real cases.

I need to check, what is needed to make pressure constraints fast as well.

Ulrich
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Better mesh last instead of mesh first?

Post by bernd »

ulrich1a wrote:
bernd wrote: The mesh with group data needs 2.5 seconds on my laptop, the mesh without group data needs 270 seconds to write CalculiX input file.
These are really good news. :)
It sounds, like FreeCAD will make much more fun with real cases.

I need to check, what is needed to make pressure constraints fast as well.
The groups will be created for every reference shape if you use my GMSH macro. But they are used only for material solids. It's a bit more work to do to use the for constraint force and constraint pressure as these constraints do not work on element set but on the nodes directly. But try some speed tests. Most time consume is material multi body solid. The constraint pressure should be pretty fast.
ulrich1a
Veteran
Posts: 1957
Joined: Sun Jul 07, 2013 12:08 pm

Re: Better mesh last instead of mesh first?

Post by ulrich1a »

bernd wrote:Most time consume is material multi body solid. The constraint pressure should be pretty fast
This depends largely on the model. I am interested in stress in pressure vessels. There I have 1099 face elements and 52142 volumes. Writing this mesh takes 34 seconds on my machine and no gain from the element groups.

Due to my former analysis, the c++-code to get the node-list is one of bottlenecks. With a nodes-list already available, we need just to use this list instead of the internal call that calculates a long time in order to identify all needed nodes. An if-clause at the right place should give a performance advantage.

The other bottleneck may the python-code to calculate the face numbers. I will work on this one.

By the way, your macro does not work with the element sizes set to anything else than the default values. (At least at my system with a German setting.)
The following changes are needed: retrieving the numbers from the qt-user form should use the function value() instead of text()
I added also a str() in the code writing to the geo-file.

Code: Select all

    def get_max_element_size(self):
        # Max Element size
        if self.element_size_max_dspin.text() == '0,00' or self.element_size_max_dspin.text() == '0.00':
            self.clmax = '1e+22'
        else:
            #self.clmax = self.element_size_max_dspin.text()
            self.clmax = self.element_size_max_dspin.value()

    def get_min_element_size(self):
        # Min Element size
        if self.element_size_min_dspin.text() == '0,00' or self.element_size_min_dspin.text() == '0.00':
            self.clmin = '0.0'
        else:
            #self.clmin = self.element_size_min_dspin.text()
            self.clmin = self.element_size_min_dspin.value()
and

Code: Select all

        geo.write("Mesh.CharacteristicLengthMax = " + str(self.clmax) + ";\n")
        geo.write("Mesh.CharacteristicLengthMin = " + str(self.clmin) + ";\n")
Ulrich
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Better mesh last instead of mesh first?

Post by bernd »

ulrich1a wrote:
bernd wrote:Most time consume is material multi body solid. The constraint pressure should be pretty fast
This depends largely on the model. I am interested in stress in pressure vessels. There I have 1099 face elements and 52142 volumes. Writing this mesh takes 34 seconds on my machine and no gain from the element groups.
Sure they only work on material solids at the moment.
ulrich1a wrote:Due to my former analysis, the c++-code to get the node-list is one of bottlenecks. With a nodes-list already available, we need just to use this list instead of the internal call that calculates a long time in order to identify all needed nodes. An if-clause at the right place should give a performance advantage.

The other bottleneck may the python-code to calculate the face numbers. I will work on this one.
OK, I will come up with something which uses the groups for pressure too. I'm curious how you will solve the face nomber in a fast way.
ulrich1a wrote:By the way, your macro does not work with the element sizes set to anything else than the default values. (At least at my system with a German setting.)
The following changes are needed: retrieving the numbers from the qt-user form should use the function value() instead of text()
I added also a str() in the code writing to the geo-file.
I will adapt this.

Bernd
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Better mesh last instead of mesh first?

Post by bernd »

ulrich1a wrote:By the way, your macro does not work with the element sizes set to anything else than the default values. (At least at my system with a German setting.)
Fixed, and a few minor improvements. Mostly prints. Would you give it a try?
ulrich1a
Veteran
Posts: 1957
Joined: Sun Jul 07, 2013 12:08 pm

Re: Better mesh last instead of mesh first?

Post by ulrich1a »

bernd wrote:Would you give it a try?
Setting the characteristic length does work now. The script does not find the shape for the simple case of only one MechanicalMaterial without references. So I changed it a little bit, in order to handle this case.

The changed script is attached below. I used the following simple testcase:
compound_test.fcstd
(8.63 KiB) Downloaded 33 times
It seems I need a more sophisticated work flow for collaborative work. Is it possible to make pull requests on a gist?

Ulrich
Attachments
GMSH_Mesh_with_groups2.py.zip
(5.32 KiB) Downloaded 36 times
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Better mesh last instead of mesh first?

Post by bernd »

ulrich1a wrote:
bernd wrote:Would you give it a try?
Setting the characteristic length does work now. The script does not find the shape for the simple case of only one MechanicalMaterial without references. So I changed it a little bit, in order to handle this case.
The changed script is attached below. I used the following simple testcase:
compound_test.fcstd
It seems I need a more sophisticated work flow for collaborative work. Is it possible to make pull requests on a gist?
Ahh yes, I never tested with the simplest of all, just one material ... I will have a look at your script.

In the regard of workflow and PullRequest to gist. i do not know. You can comment. How about this: https://github.com/berndhahnebach/FreeC ... mgmshgroup and https://github.com/berndhahnebach/FreeC ... ps.FCMacro

I just copied it to FEM source and made a branch in my repo. You should be able to make an Pull Request.

I have already been thinking what is the best way to get this into FreeCAD. The ideas is to move all helper methods from the Macro to FemMeshTools.py module in FEM. The Macro could be moved to a separate Tool in FEM. But we first need to get in working.

What do you think?

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

Re: Better mesh last instead of mesh first?

Post by bernd »

ulrich1a wrote:The script does not find the shape for the simple case of only one MechanicalMaterial without references. So I changed it a little bit, in order to handle this case.
I did it slightly different How about this? https://github.com/berndhahnebach/FreeC ... ab09f74801

https://gist.github.com/berndhahnebach/ ... 6df1c909bf
or
https://github.com/berndhahnebach/FreeC ... ps.FCMacro
Post Reply