FemByGen Workbench - Parametric FEM Analysis
Moderator: bernd
Forum rules
and Helpful information for the FEM forum
and Helpful information for the FEM forum
FemByGen Workbench - Parametric FEM Analysis
We have created a parametric Finite Element analysis workbench. Basically based on your paramameters, it creates freecad file and analyse generations and shows all results in a table.
github address: https://github.com/Serince/FEMbyGEN
It has 5 commands.
1) Intiate : Creating a spreadsheet which name is Parameters. User define its parameters in the file and assign his/her model.
2) Alias : Assigning name of parameter to dimesions
3) Generate: It creates files and meshes for all combination of your parameters.
4) FEA : Running all FEM analysis of generated files.
5) Results: Getting all results to master file and merge all Loadcases in one.
Usage:
First, you need to create a master file which includes Calculix Analysis. By using above commands you can generate generations. By clicking initiate following screen (spreadsheet) open and you can define your model parameter. To assign this to your model, please check spreadsheet tutorial. Then, second button to generate files. Following screen shows the generated parameters file. You can open the files by clicking row of table. Other button for analysis, by clicking it, you can run all analysis. At the end, results button to get all results to master file and shows in table. To choose best design you can use the table. bottom of the screen there is weight parameters. You can write wights here (total needs to be 100), It sorts results. And it combines all loadcases in a result object to see results under tree view in Results group. Features:
It supports more than an Analysis (Load Cases) in master file.
It combines all load cases results in one Result objects
It supports both Gmsh and Netgen
It merges all load case results in a result to see all in one to choose optimum.
You can range results by weight of output parameters.
github address: https://github.com/Serince/FEMbyGEN
It has 5 commands.
1) Intiate : Creating a spreadsheet which name is Parameters. User define its parameters in the file and assign his/her model.
2) Alias : Assigning name of parameter to dimesions
3) Generate: It creates files and meshes for all combination of your parameters.
4) FEA : Running all FEM analysis of generated files.
5) Results: Getting all results to master file and merge all Loadcases in one.
Usage:
First, you need to create a master file which includes Calculix Analysis. By using above commands you can generate generations. By clicking initiate following screen (spreadsheet) open and you can define your model parameter. To assign this to your model, please check spreadsheet tutorial. Then, second button to generate files. Following screen shows the generated parameters file. You can open the files by clicking row of table. Other button for analysis, by clicking it, you can run all analysis. At the end, results button to get all results to master file and shows in table. To choose best design you can use the table. bottom of the screen there is weight parameters. You can write wights here (total needs to be 100), It sorts results. And it combines all loadcases in a result object to see results under tree view in Results group. Features:
It supports more than an Analysis (Load Cases) in master file.
It combines all load cases results in one Result objects
It supports both Gmsh and Netgen
It merges all load case results in a result to see all in one to choose optimum.
You can range results by weight of output parameters.
Re: FemByGen Workbench - Parametric FEM Analysis
Great, running multiple analyses in the FEM workbench is very tedious - you have to delete all the result objects and resubmit the analysis manually. This makes it difficult to perform parametric studies. Also, it’s a good idea to make use of the Spreadsheet workbench to automate analyses. Hopefully, this workbench will be added to Add-on Manager and maybe merged with master in the future.
Re: FemByGen Workbench - Parametric FEM Analysis
Wow! This is amazing and covers the use case I desperately miss in our FEM WB.
You should also share your nice advertisement page:
https://mightybucket.github.io/projects ... ation.html
---------------------------
What are your plans? Would you like to work on the workbench more or do you have no other plans?
If you would like to work more on the workbench, be hereby kindly invited
From my point of view the next steps would be:
1. make the workbench installable using our AddonManager. See here how it's done (it is really easy ): https://wiki.freecadweb.org/Addon
2. use the new spreadsheet feature to have different configurations: https://wiki.freecad.org/Spreadsheet_Wo ... ion_tables
step 2. is not a must-have but I assume it eases the coding a lot since every change in geometry can be done by creating a new configuration.
Then I have a question:
in practice I am often confronted to decide in which direction I should change the geometry according to the simulation results. For example taking your headphone example: i start making the rd thicker and the simulation results show that the stress gets worse, then the process must be stopped, meaning the steps to make the rod even more thicker must be cancelled, but the rod must be made thinner. This would save a lot of calculation time.
Is this possible with your workbench?
Can you please attach here (or link) a *.FCStd file so test your workbench in action? This would help me.
best regards and again a wow
Uwe
You should also share your nice advertisement page:
https://mightybucket.github.io/projects ... ation.html
---------------------------
What are your plans? Would you like to work on the workbench more or do you have no other plans?
If you would like to work more on the workbench, be hereby kindly invited
From my point of view the next steps would be:
1. make the workbench installable using our AddonManager. See here how it's done (it is really easy ): https://wiki.freecadweb.org/Addon
2. use the new spreadsheet feature to have different configurations: https://wiki.freecad.org/Spreadsheet_Wo ... ion_tables
step 2. is not a must-have but I assume it eases the coding a lot since every change in geometry can be done by creating a new configuration.
Then I have a question:
in practice I am often confronted to decide in which direction I should change the geometry according to the simulation results. For example taking your headphone example: i start making the rd thicker and the simulation results show that the stress gets worse, then the process must be stopped, meaning the steps to make the rod even more thicker must be cancelled, but the rod must be made thinner. This would save a lot of calculation time.
Is this possible with your workbench?
Can you please attach here (or link) a *.FCStd file so test your workbench in action? This would help me.
best regards and again a wow
Uwe
Re: FemByGen Workbench - Parametric FEM Analysis
For your question, if you define max, min of rod thickness and it allows you to create as many thicknesses as you want in this range and see the analysis of all of them in a single table. In fact, not only this, you can also make the rod width another parameter and create as many combinations as you want in the range you specify.
I've attached an example file . Because of the file size, I have deleted analysis files and results. Therefore you need to open FEMbyGen workbench and continue from generate, fea analysis to run simulations and results button.
Meanwhile, the one with the best stress is not always the best. Its mass (volume) and homogeneous distribution of stress to the whole structure (Internal energy density standard deviation in the resul table) are important.
Next thing is to add this workbench to Freecad addon repository. We have also other plans.
1) Topology optimization to the selected case by using https://github.com/calculix/beso
2) It creates full combinations of the parameters to analyze (Full factorial), adding Taguchi method to analyze less number of simulation to get best case.
I've attached an example file . Because of the file size, I have deleted analysis files and results. Therefore you need to open FEMbyGen workbench and continue from generate, fea analysis to run simulations and results button.
Meanwhile, the one with the best stress is not always the best. Its mass (volume) and homogeneous distribution of stress to the whole structure (Internal energy density standard deviation in the resul table) are important.
Next thing is to add this workbench to Freecad addon repository. We have also other plans.
1) Topology optimization to the selected case by using https://github.com/calculix/beso
2) It creates full combinations of the parameters to analyze (Full factorial), adding Taguchi method to analyze less number of simulation to get best case.
Re: FemByGen Workbench - Parametric FEM Analysis
I can add to the addon manager, but has anyone done a cursory vetting of the code before we add it ?
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Re: FemByGen Workbench - Parametric FEM Analysis
That would be nice. Many thanks in advance!
Since it is an addon, it can safely be added. If there would be issues, we will find it out this way. Once it is registered as addon more people will try it and report back in case..
Re: FemByGen Workbench - Parametric FEM Analysis
Many thanks for your example.serince wrote: ↑Thu Sep 15, 2022 8:09 am Next thing is to add this workbench to Freecad addon repository. We have also other plans.
1) Topology optimization to the selected case by using https://github.com/calculix/beso
2) It creates full combinations of the parameters to analyze (Full factorial), adding Taguchi method to analyze less number of simulation to get best case.
Your plans sound interesting.
What about my proposal to use Spreadsheet's configurations. Wouldn't that be something nice to have?
Re: FemByGen Workbench - Parametric FEM Analysis
It is really nice feature. FemByGen is doing same thing one by one. When you click generate button it creates all variants of input parameters. I think I will use the configutration when I apply Taguchi method in that case not all variants will apply.
What about my proposal to use Spreadsheet's configurations. Wouldn't that be something nice to have?
Re: FemByGen Workbench - Parametric FEM Analysis
Added FEMbyGEN addon to Addon repo (https://github.com/FreeCAD/FreeCAD-addo ... 783ca18908)
Congrats!
Edit: please enable the ability to open tickets on https://github.com/Serince/FEMbyGEN
Right now there is only the ability to make PRs.
Congrats!
Edit: please enable the ability to open tickets on https://github.com/Serince/FEMbyGEN
Right now there is only the ability to make PRs.
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
-
- Posts: 1
- Joined: Fri Sep 30, 2022 9:43 am
Re: FemByGen Workbench - Parametric FEM Analysis
Hi,
I have problems with an easy test example.
The cad-generation with different parameters + fem-analysis of all examples is working, but I am getting erros during the Result output:
At the end there is no result matrix because of this.
Could anyone help?
Kindly regards
Markus
I have problems with an easy test example.
The cad-generation with different parameters + fem-analysis of all examples is working, but I am getting erros during the Result output:
Code: Select all
10:17:24 Calculating metrics...C:\Program Files\FreeCAD 0.20\bin\lib\site-packages\numpy\core\_methods.py:233: RuntimeWarning: Degrees of freedom <= 0 for slice
ret = _var(a, axis=axis, dtype=dtype, out=out, ddof=ddof,
10:17:32 C:\Program Files\FreeCAD 0.20\bin\lib\site-packages\numpy\core\_methods.py:194: RuntimeWarning: invalid value encountered in true_divide
arrmean = um.true_divide(
10:17:32 C:\Program Files\FreeCAD 0.20\bin\lib\site-packages\numpy\core\_methods.py:226: RuntimeWarning: invalid value encountered in double_scalars
ret = ret.dtype.type(ret / rcount)
10:17:32 C:\Program Files\FreeCAD 0.20\bin\lib\site-packages\numpy\core\fromnumeric.py:3372: RuntimeWarning: Mean of empty slice.
return _methods._mean(a, axis=axis, dtype=dtype,
10:17:32 C:\Program Files\FreeCAD 0.20\bin\lib\site-packages\numpy\core\_methods.py:170: RuntimeWarning: invalid value encountered in double_scalars
ret = ret.dtype.type(ret / rcount)
10:17:32 Traceback (most recent call last):
File "C:\Users\userms\AppData\Roaming\FreeCAD\Mod\FEMbyGEN\.\fembygen\Results.py", line 459, in setEdit
taskd = ResultsPanel(vobj)
File "C:\Users\userms\AppData\Roaming\FreeCAD\Mod\FEMbyGEN\.\fembygen\Results.py", line 83, in __init__
self.calcAndSaveFEAMetrics()
File "C:\Users\userms\AppData\Roaming\FreeCAD\Mod\FEMbyGEN\.\fembygen\Results.py", line 195, in calcAndSaveFEAMetrics
resultAll, resultSum = self.calculateFEAMetric()
File "C:\Users\userms\AppData\Roaming\FreeCAD\Mod\FEMbyGEN\.\fembygen\Results.py", line 242, in calculateFEAMetric
maxStr = np.max(res[k:k+j, 4])
File "<__array_function__ internals>", line 5, in amax
File "C:\Program Files\FreeCAD 0.20\bin\lib\site-packages\numpy\core\fromnumeric.py", line 2705, in amax
return _wrapreduction(a, np.maximum, 'max', axis, None, out,
File "C:\Program Files\FreeCAD 0.20\bin\lib\site-packages\numpy\core\fromnumeric.py", line 87, in _wrapreduction
return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
<class 'ValueError'>: zero-size array to reduction operation maximum which has no identity
Could anyone help?
Kindly regards
Markus
Last edited by Kunda1 on Sun Oct 02, 2022 1:15 pm, edited 1 time in total.
Reason: added code tags
Reason: added code tags