new features in the FEM WB - March 2023

About the development of the FEM module/workbench.

Moderator: bernd

Post Reply
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

new features in the FEM WB - March 2023

Post by uwestoehr »

After the work to implement electromagnetic simulations (viewtopic.php?t=75888) and the new contours filter (https://wiki.freecad.org/FEM_PostFilterContours), GitHub user mariolexis and I took some time to add some more functionality and request you to test:

- the creation of result pipelines for CCX simulations does now also work for eigenfrequency analysis and buckling. The pipelines are automatically updates when you make a change. So it is no longer necessary to recreate them manually and also your pipeline filters are kept.

- when loading a FreeCAD file containing an analysis and you are already in the FEM workbench, the analysis gets automatically activated (you have immediate access to all FEM toolbar buttons

- the preferences have a new option to define what solver should automatically be added when creating a new analysis: see https://wiki.freecad.org/FEM_Preferences#General

- there are now only toolbar buttons for solvers installed on your system. So if you only have the CCX solver installed, there is now only one button for it (in the menu we kept all supported solvers that people can explore the possibilities)

- the result pipelines got two new cut geometries: box: https://wiki.freecad.org/FEM_PostCreateFunctionBox and cylinder: https://wiki.freecad.org/FEM_PostCreateFunctionCylinder

- for the Elmer solver the equation for nonlinear stress analyses was added: https://wiki.freecad.org/FEM_EquationDeformation
Image

- it is now possible to perform transient analyses with Elmer: https://wiki.freecad.org/FEM_SolverElme ... _analyses)
FreeCAD_dQQ7oJtVed.gif
FreeCAD_dQQ7oJtVed.gif (230.78 KiB) Viewed 23425 times
- it is now possible to define a flow profile for the Elmer flow solver: https://wiki.freecad.org/FEM_Constraint ... y#Formulas and https://wiki.freecad.org/FEM_Constraint ... y#Formulas
(used in the https://wiki.freecad.org/FEM_Examples for two of the flow examples)
FreeCAD_4OBCn1OOS7.png
FreeCAD_4OBCn1OOS7.png (49.31 KiB) Viewed 23568 times

- it is now possible to define displacements as equations (displacement according to the current solver time): https://wiki.freecad.org/FEM_ConstraintDisplacement
(used in the https://wiki.freecad.org/FEM_Examples for of the deformation example)

- the existing spring constraint can now be used for Elmer mechanical analyses: https://wiki.freecad.org/FEM_ConstraintSpring
(used in the https://wiki.freecad.org/FEM_Examples for of the deformation example)

To test the new features, I created a Windows build:
https://github.com/FreeCAD/FreeCAD-Bund ... taller.exe
for Linux and MacOS, wait for the next weekly build:
https://github.com/FreeCAD/FreeCAD-Bund ... kly-builds
(must have revision number 32552 or higher)
User avatar
NewJoker
Veteran
Posts: 3018
Joined: Sun Oct 11, 2020 7:49 pm

Re: new features in the FEM WB - March 2023

Post by NewJoker »

Wow, impressive number of changes, congratulations.

uwestoehr wrote: Mon Mar 27, 2023 12:06 am does not also work for eigenfrequency analysis and buckling.
I guess that you meant "does also work", right ?
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: new features in the FEM WB - March 2023

Post by uwestoehr »

NewJoker wrote: Mon Mar 27, 2023 10:46 am I guess that you meant "does also work", right ?
I meant "does _now_ also work" :)
User avatar
ebrahim raeyat
Posts: 619
Joined: Sun Sep 09, 2018 7:00 pm
Location: Iran
Contact:

Re: new features in the FEM WB - March 2023

Post by ebrahim raeyat »

uwestoehr wrote: Mon Mar 27, 2023 12:06 am
- the existing spring constraint can now be used for Elmer mechanical analyses: https://wiki.freecad.org/FEM_ConstraintSpring
(used in the https://wiki.freecad.org/FEM_Examples for of the deformation example)
Thanks for great improvements!

I examined the springs for Elmer solver and it gives me this error:
elmer.png
elmer.png (129.03 KiB) Viewed 23248 times
output in FreeCAD:

Code: Select all

Executing solver...
Number of CPU cores to be used for the solver run: 1
ELMER SOLVER (v 9.0) STARTED AT: 2023/03/29 13:35:08

ParCommInit:  Initialize #PEs:            1
MAIN:
MAIN: =============================================================
MAIN: ElmerSolver finite element software, Welcome!
MAIN: This program is free software licensed under (L)GPL
MAIN: Copyright 1st April 1995 - , CSC - IT Center for Science Ltd.
MAIN: Webpage http://www.csc.fi/elmer, Email elmeradm@csc.fi
MAIN: Version: 9.0 (Rev: Release, Compiled: 2023-03-29)
MAIN:  Running one task without MPI parallelization.
MAIN:  Running with just one thread per task.
MAIN:  Lua interpreter linked in.
MAIN:  External optimization routines linked in.
MAIN: =============================================================
MAIN:
MAIN:
MAIN: -------------------------------------
MAIN: Reading Model: case.sif
 Caught LUA error:[string "loadfile("C:/Program Files (x86)/Elmer/shar..."]:1: attempt to call a nil value
 Caught LUA error:[string "loadstring(readsif("case.sif"))()"]:1: attempt to call global 'readsif' (a nil value)
LoadInputFile: Scanning input file: case.sif
LoadInputFile: Scanning only size info
LoadInputFile: First time visiting
LoadInputFile: Reading base load of sif file
LoadInputFile: Loading input file: case.sif
LoadInputFile: Reading base load of sif file
LoadInputFile: Number of BCs: 1
LoadInputFile: Number of Body Forces: 0
LoadInputFile: Number of Initial Conditions: 0
LoadInputFile: Number of Materials: 1
LoadInputFile: Number of Equations: 1
LoadInputFile: Number of Solvers: 2
LoadInputFile: Number of Bodies: 1
ListTagKeywords: Setting weight for keywords!
ListTagKeywords: No parameters width suffix: normalize by area
ListTagKeywords: Setting weight for keywords!
ListTagKeywords: No parameters width suffix: normalize by volume
Loading user function library: [StressSolve]...[StressSolver_Init0]
Loading user function library: [ResultOutputSolve]...[ResultOutputSolver_Init0]
LoadMesh: Loading serial mesh!
ElmerAsciiMesh: Performing step: 1
ElmerAsciiMesh: Base mesh name: .
ReadHeaderFile: Reading header info from file: ./mesh.header
InitializeMesh: Number of nodes in mesh: 277
InitializeMesh: Number of bulk elements in mesh: 124
InitializeMesh: Number of boundary elements in mesh: 28
InitializeMesh: Initial number of max element nodes: 6
ElmerAsciiMesh: Performing step: 2
ReadNodesFile: Reading nodes from file: ./mesh.nodes
MapCoordinates: Performing coordinate mapping
SetMeshDimension: Dimension of mesh is: 2
SetMeshDimension: Max dimension of mesh is: 2
MapCoordinates: Scaling coordinates: 1.000E-03 1.000E-03 1.000E+00
ElmerAsciiMesh: Performing step: 3
ReadElementsFile: Reading bulk elements from file: ./mesh.elements
ElmerAsciiMesh: Performing step: 4
ReadBoundaryFile: Reading boundary elements from file: ./mesh.boundary
PermuteNodeNumbering: Performing node mapping
ReadTargetNames: Reading names info from file: ./mesh.names
ERROR:: ReadTargetNames: Mapping of name is not unique: face1
No result file was created.

elmer output file:

Code: Select all

Check Keywords "Warn"

Header
  Mesh DB "."
End

Solver 1
  Calculate Principal = Logical True
  Displace mesh = Logical True
  Eigen Analysis = Logical False
  Equation = String "Stress Solver"
  Geometric Stiffness = Logical False
  Linear System Abort Not Converged = Logical False
  Linear System Direct Method = String "Umfpack"
  Linear System Precondition Recompute = Integer 1
  Linear System Residual Output = Integer 1
  Linear System Solver = String "Direct"
  Optimize Bandwidth = Logical True
  Procedure = File "StressSolve" "StressSolver"
  Stabilize = Logical True
  Steady State Convergence Tolerance = Real 1e-05
  Variable = String "Displacement"
  Variable DOFs = Integer 3
End

Simulation 
  Coordinate Mapping(3) = Integer 1 2 3
  Coordinate Scaling = Real 0.001
  Coordinate System = String "Cartesian"
  Simulation Type = String "Steady State"
  Steady State Max Iterations = Integer 1
  Steady State Min Iterations = Integer 0
  Use Mesh Names = Logical True
End

Constants 
End

Body 1
  Equation = Integer 1
  Material = Integer 1
  Name = String "Face1"
End

Material 1
  Name = String "Concrete"
  Poisson ratio = Real 0.17
  Youngs Modulus = Real 32000000000000.0
End

Equation 1
  Active Solvers(2) = Integer 1 2
End

Solver 2
  Coordinate Scaling Revert = Logical True
  Equation = String "ResultOutput"
  Exec Solver = String "After simulation"
  Output File Name = File "FreeCAD"
  Procedure = File "ResultOutputSolve" "ResultOutputSolver"
  Vtu Format = Logical True
  Vtu Time Collection = Logical True
End

Boundary Condition 1
  Name = String "Face1"
  Normal Force = Real -100000.0
  Spring = Real 0.0
End
FreeCAD version:

Code: Select all

OS: Windows 10 Version 2009
Word size of FreeCAD: 64-bit
Version: 0.21.0.32634 (Git)
Build type: Release
Branch: master
Hash: 161e7aca989ce15ee3cbcbb1d4b3ff47812ac899
Python 3.8.10, Qt 5.15.2, Coin 4.0.1, Vtk 8.2.0, OCC 7.6.3
Locale: English/United States (en_US)
Installed mods: 
  * beso
  * BIM_Workbench 2021.12.0
  * civilTools
  * dodo 1.0.0
  * etabs_api
  * FreeCAD-Help
  * FreeCAD-NativeIFC 2022.10.20
  * FreeCAD-render 2023.2.2
  * git.7z
  * momen
  * OSAFE 2022.5.29
User avatar
NewJoker
Veteran
Posts: 3018
Joined: Sun Oct 11, 2020 7:49 pm

Re: new features in the FEM WB - March 2023

Post by NewJoker »

I downloaded the newest Windows build (32637, details below) and I have a few questions regarding those changes to the FEM workbench:
uwestoehr wrote: Mon Mar 27, 2023 12:06 am The pipelines are automatically updates when you make a change. So it is no longer necessary to recreate them manually and also your pipeline filters are kept.
This is really great, it significantly improves the workflow in this workbench.

One more useful change would be to make the pipeline with the most common output variable (displacement magnitude or von Mises stress for mechanical analyses) active by default. So that the first thing a user sees after solving the analysis is something that he would also see in pretty much all the other FEA programs. Currently, that's what is shown after solving a stress analysis:

current.png
current.png (27.67 KiB) Viewed 23085 times

No color contour on the model, just some confusing legend. And that's what should be shown in my opinion:

changed.png
changed.png (77.05 KiB) Viewed 23085 times

So just Coloring --> Field --> Displacement --> Magnitude or von Mises Stress selected by default would suffice.

It would be also great to have field name and units displayed above the legend but I understand that it might be a bigger change that needs to wait.

uwestoehr wrote: Mon Mar 27, 2023 12:06 am - the preferences have a new option to define what solver should automatically be added when creating a new analysis: see https://wiki.freecad.org/FEM_Preferences#General
For some reason, when I used that Windows build for the first time, no solver was added and I had to add CalculiX manually. Then I entered the preferences and found out that CalculiX is selected as the default solver (I didn't change anything there). Then I restarted FreeCAD and CalculiX was added automatically this time.

uwestoehr wrote: Mon Mar 27, 2023 12:06 am - there are now only toolbar buttons for solvers installed on your system. So if you only have the CCX solver installed, there is now only one button for it (in the menu we kept all supported solvers that people can explore the possibilities)
Could you also consider indicating somehow which features/tools can be used with which solvers ? For example, with tool descriptions when hovering the cursor on them or groups in the menu or grayed-out constraints not usable in the currently selected solver. It can be quite confusing for users if they don't check the documentation.

Also, the strange thing is that Elmer's equations become active when I select the CalculiX solver.

uwestoehr wrote: Mon Mar 27, 2023 12:06 am - for the Elmer solver the equation for nonlinear stress analyses was added: https://wiki.freecad.org/FEM_EquationDeformation
As I understand, it's used for hyperelasticity and currently only neo-hookean model is supported. Maybe this feature could be renamed to Hyperelasticity or Nonlinear elasticity ? Deformation is way too general. I guess that it's the name used in Elmer but maybe we could change it to something understandable also for people who don't use standalone Elmer.

uwestoehr wrote: Mon Mar 27, 2023 12:06 am - the existing spring constraint can now be used for Elmer mechanical analyses: https://wiki.freecad.org/FEM_ConstraintSpring
(used in the https://wiki.freecad.org/FEM_Examples for of the deformation example)
It would be awesome to have it supported by the CalculiX solver too in the future.

Code: Select all

OS: Windows 11 Version 2009
Word size of FreeCAD: 64-bit
Version: 0.21.0.32637 (Git)
Build type: Release
Branch: master
Hash: 7fa7cb7f0b222864be7416c683166876eab190bc
Python 3.10.10, Qt 5.15.8, Coin 4.0.0, Vtk 9.1.0, OCC 7.6.3
Locale: Polish/Poland (pl_PL)
User avatar
FBXL5
Posts: 979
Joined: Sat Aug 03, 2019 8:45 pm

Re: new features in the FEM WB - March 2023

Post by FBXL5 »

It seems like FreeCAD uses the wrong icon for the Elasticity equation:
fem-ico-01.png
fem-ico-01.png (33.82 KiB) Viewed 21361 times
This is what the wiki displays:
fem-ico-03.png
fem-ico-03.png (30.25 KiB) Viewed 21361 times
Which one is the right one?

Code: Select all

OS: macOS 10.15
Word size of FreeCAD: 64-bit
Version: 0.21.0.33040 (Git)
Build type: Release
Branch: master
Hash: 1e830a8800156097ccb3ef6124dced30d4002e76
Python 3.11.3, Qt 5.15.8, Coin 4.0.0, Vtk 9.2.2, OCC 7.7.0
Locale: C/Default (C)
Installed mods: 
  * Reinforcement
  * fcgear 1.0.0
  * Render 2023.2.3
  * fcgear.backup1662890180.767765
  * fasteners 0.4.56
  * CurvedShapes 1.0.4
  * sheetmetal 0.2.63
  * Help 1.0.3
  * Curves 0.6.8
  * Assembly3 0.11.4
Post Reply