Elmer: constraint self weight example, wrong results

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: Elmer: constraint self weight gives wrong results

Post by bernd »

Mhh ...

I changed

Code: Select all

Constants 
End
to

Code: Select all

Constants 
  Gravity(4) = Real 0.0 0.0 -1.0 9820.0
End
but it does not change anything ...

for reference, added code in writer

Code: Select all

    def _handleElasticityConstants(self):
        obj = self._getSingleMember("Fem::ConstraintSelfWeight")
        if obj is not None:
            gravity = getConstant("Gravity", "L/T^2")
            self._constant("Gravity", (0.0, 0.0, -1.0, gravity))
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Elmer: constraint self weight gives wrong results

Post by bernd »

Since I do not know the sif file format very well I am a bit helpless here.

Might be someone could help and find whats wrong in this sif file ... https://forum.freecadweb.org/viewtopic. ... 13#p415254
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Elmer: constraint self weight gives wrong results

Post by bernd »

thschrader wrote: Sun Jul 12, 2020 11:53 am
However, I used the elmer-GUI to run your test-example. Results matching ccx-run / theory.
Here is the sif generated by elmer-GUI:
I tried to somehow find the difference, but except the constants I could not found something. I tried to exchange just the sif file (means use FemMesh from FreeCAD export), but than the result is something totally wrong.
thschrader
Veteran
Posts: 3158
Joined: Sat May 20, 2017 12:06 pm
Location: Germany

Re: Elmer: constraint self weight gives wrong results

Post by thschrader »

Now I am struggling with selfweight too... :?
I try to do the elmer-beam tutorial with FC and elmerGUI itself.
Using m/kg/s-units as in tutorial works (with elmerGUI).
But:
When exporting the gmsh-mesh as unv and loading in elmerGUI (mm units), the face numbers are mixed
and the result is wrong. Deflection should be approx 54 mm, not 400 mm.
For the tip-load F=2000 N alone it works, but how to set selfweight?
FC-file and case-sif from elmerGUI. Gravity points in -y.
beamTutorial.pdf
(186.99 KiB) Downloaded 29 times
beam3D_example.FCStd
(8.6 KiB) Downloaded 30 times

Code: Select all

Header
  CHECK KEYWORDS Warn
  Mesh DB "." "."
  Include Path ""
  Results Directory ""
End

Simulation
  Max Output Level = 5
  Coordinate System = Cartesian
  Coordinate Mapping(3) = 1 2 3
  Simulation Type = Steady state
  Steady State Max Iterations = 1
  Output Intervals = 1
  Timestepping Method = BDF
  BDF Order = 1
  Solver Input File = case.sif
  Post File = case.vtu
End

Constants
  Gravity(4) = 0 -1 0 9820.0
End

Body 1
  Target Bodies(1) = 2
  Name = "Body 1"
  Equation = 1
  Material = 1
  Body Force = 1
End

Solver 1
  Equation = Linear elasticity
  Procedure = "StressSolve" "StressSolver"
  Variable = -dofs 3 Displacement
  Calculate Stresses = True
  Exec Solver = Always
  Stabilize = True
  Bubbles = False
  Lumped Mass Matrix = False
  Optimize Bandwidth = True
  Steady State Convergence Tolerance = 1.0e-5
  Nonlinear System Convergence Tolerance = 1.0e-7
  Nonlinear System Max Iterations = 20
  Nonlinear System Newton After Iterations = 3
  Nonlinear System Newton After Tolerance = 1.0e-3
  Nonlinear System Relaxation Factor = 1
  Linear System Solver = Iterative
  Linear System Iterative Method = BiCGStab
  Linear System Max Iterations = 500
  Linear System Convergence Tolerance = 1.0e-10
  BiCGstabl polynomial degree = 2
  Linear System Preconditioning = ILU0
  Linear System ILUT Tolerance = 1.0e-3
  Linear System Abort Not Converged = False
  Linear System Residual Output = 10
  Linear System Precondition Recompute = 1
End

Equation 1
  Name = "elastic"
  Calculate Stresses = True
  Active Solvers(1) = 1
End

Equation 2
  Name = "resultFEM"
End

Material 1
  Name = "wood"
  Density = 7.0e-7
  Poisson ratio = 0.05
  Youngs modulus = 12000.0
End

Body Force 1
  Name = "selfweight"
  Stress Bodyforce 2 = -6.874e-3
End

Boundary Condition 1
  Target Boundaries(1) = 6 
  Name = "fixing"
  Displacement 3 = 0
  Displacement 2 = 0
  Displacement 1 = 0
End

Boundary Condition 2
  Target Boundaries(1) = 1 
  Name = "load"
  Force 2 = -0.4
End
elmer_result_tutorial.JPG
elmer_result_tutorial.JPG (81.73 KiB) Viewed 1773 times
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Elmer: constraint self weight gives wrong results

Post by bernd »

just a note ... A short test if you set up everything correct in FreeCAD makes sense. For this you would just need to add a calculix solver and run it. I am on the way not able to test.
thschrader
Veteran
Posts: 3158
Joined: Sat May 20, 2017 12:06 pm
Location: Germany

Re: Elmer: constraint self weight example, wrong results

Post by thschrader »

short update:
Now sif-writing with self-weight works with
OS: Windows 10 (10.0)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.21937 (Git)
Build type: Release
Branch: master
Hash: 0de5a290113800dc5779a76d7e216bd882e0ed1e
Python version: 3.6.8
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: German/Germany (de_DE)

Bernd, I ran your 32-m-beam example again with elmer. When opening the result-vtu with paraview
and using warp-filter, the z-deflection under self-weight looks like an eigenmode (???).
Very strange. The sif seems ok. mmhh...
eigenmode_beam.JPG
eigenmode_beam.JPG (20.69 KiB) Viewed 1714 times
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Elmer: constraint self weight example, wrong results

Post by bernd »

I had the same issue ...

Did you manually add the gravity? IMHO it is needed, but nothing changes if it is added manually. Do you know if it is really needed (it should IMHO). If yes I would add it.

Anyway, the culprit must be somewhere else. Might be in the Elasticity solver setting. For the bemetall example, just changing some solver setting changed the result totally. Might be we do a totally wrong analysis, thus this shape and thus the grav constant has no effect ...
thschrader
Veteran
Posts: 3158
Joined: Sat May 20, 2017 12:06 pm
Location: Germany

Re: Elmer: constraint self weight example, wrong results

Post by thschrader »

bernd wrote: Thu Jul 16, 2020 2:42 pm ...
Did you manually add the gravity?
...
Anyway, the culprit must be somewhere else. Might be in the Elasticity solver setting. For the bemetall example, just changing some solver setting changed the result totally. Might be we do a totally wrong analysis, thus this shape and thus the grav constant has no effect ...
gravity: no, I used the written sif without editing.
The solver setting in elmer is a point I have to learn. There are tons of options.
But in the end we will crack the nut... :) I hope so.
thschrader
Veteran
Posts: 3158
Joined: Sat May 20, 2017 12:06 pm
Location: Germany

Re: Elmer: constraint self weight example, wrong results

Post by thschrader »

@Bernd:
Write sif with FC-elmer, overwrite sif with code below, run analysis.
Info: I used
Iterative method = GCR
Preconditioning=ILU1
according to elmer-tutorial
The results matching theory and ccx. I "wrote" this sif with elmerGUI.
In the GUI, I activated the "deformed mesh" option, thats why you see what you see.
I have no idea why this works, the only difference to the FC-sif is the E-modulus.

Code: Select all

Header
  CHECK KEYWORDS Warn
  Mesh DB "." "."
  Include Path ""
  Results Directory ""
End

Simulation
  Max Output Level = 5
  Coordinate System = Cartesian
  Coordinate Mapping(3) = 1 2 3
  Simulation Type = Steady state
  Steady State Max Iterations = 1
  Output Intervals = 1
  Timestepping Method = BDF
  BDF Order = 1
  Solver Input File = case.sif
  Post File = case.vtu
End

Constants
  Gravity(4) = 0 0 -1 9.82
End

Body 1
  Target Bodies(1) = 2
  Name = "Body 1"
  Equation = 1
  Material = 1
  Body Force = 1
End

Solver 1
  Equation = Linear elasticity
  Procedure = "StressSolve" "StressSolver"
  Variable = -dofs 3 Displacement
  Calculate Stresses = True
  Exec Solver = Always
  Stabilize = True
  Bubbles = False
  Lumped Mass Matrix = False
  Optimize Bandwidth = True
  Steady State Convergence Tolerance = 1.0e-5
  Nonlinear System Convergence Tolerance = 1.0e-7
  Nonlinear System Max Iterations = 1
  Nonlinear System Newton After Iterations = 3
  Nonlinear System Newton After Tolerance = 1.0e-3
  Nonlinear System Relaxation Factor = 1
  Linear System Solver = Iterative
  Linear System Iterative Method = GCR
  Linear System Max Iterations = 500
  Linear System Convergence Tolerance = 1.0e-10
  BiCGstabl polynomial degree = 2
  Linear System Preconditioning = ILU1
  Linear System ILUT Tolerance = 1.0e-3
  Linear System Abort Not Converged = False
  Linear System Residual Output = 10
  Linear System Precondition Recompute = 1
End

Equation 1
  Name = "elastic"
  Active Solvers(1) = 1
End

Material 1
  Name = "steel"
  Density = 7.9e-6
  Poisson ratio = 0.3
  Youngs modulus = 210000.0
End

Body Force 1
  Name = "selfweight"
  Stress Bodyforce 3 = -7.758e-5
End

Boundary Condition 1
  Target Boundaries(1) = 1 
  Name = "fixing"
  Displacement 3 = 0
  Displacement 2 = 0
  Displacement 1 = 0
End
z_displacement_mm.JPG
z_displacement_mm.JPG (45.43 KiB) Viewed 1676 times
sigma_xx_MPa.JPG
sigma_xx_MPa.JPG (40.63 KiB) Viewed 1676 times
HoWil
Veteran
Posts: 1279
Joined: Sun Jun 14, 2015 7:31 pm
Location: Austria

Re: Elmer: constraint self weight example, wrong results

Post by HoWil »

thschrader wrote: Thu Jul 16, 2020 4:37 pm ....
Dear Thomas,
I did not follow the complete discussion above, but I saw that is is about self-weigth, elmer, ISO units....right?
  • I downloaded your model beam3D_example.FCStd from above and
  • switched units in preferences to m/kg/s and restarted (you should use the development branch of elmer to use ISO units see https://forum.freecadweb.org/viewtopic. ... 20#p411105)
  • executed the mesh
  • solved it with calculix and watched the results "53,7866000000 mm" max deformation
  • added a Elmer solver and the Elasticity solver, switched the "Linear solver Type" for Elasticity to "Direct"
  • solved with Elmer solver and get 0.054m displacement max.
Hope this helps.
Screenshot from 2020-07-16 20-53-47.png
Screenshot from 2020-07-16 20-53-47.png (315.91 KiB) Viewed 1646 times
Post Reply