Trying to add Shell equation for Elmer

About the development of the FEM module/workbench.

Moderator: bernd

User avatar
johnwang
Veteran
Posts: 1345
Joined: Sun Jan 27, 2019 12:41 am

Trying to add Shell equation for Elmer

Post by johnwang »

Hi,

I followed Add_FEM_Equation_Tutorial
Mostly copied from the Flow equation. Only writer.py is copied from Elasticity equation.

Code: Select all

In Write.py
    def _handleShell(self):
	...
        if activeIn:
            self._handleShellConstants()
            self._handleShellBndConditions()
            self._handleShellInitial(activeIn)
            self._handleShellBodyForces(activeIn)
            self._handleShellMaterial(activeIn)
I tested with the new Elmer/Mystran plate example, just changed the equation from Elasticity to my new Shell equation.

When Writing the SIF file, I got this error:

Code: Select all

17:28:36  Write elmer input files to: D:/00Test/FreeCAD/shell/shell\SolverElmer
17:28:36  The FreeCAD standard unit schema mm/kg/s is used. Elmer sif-file writing is done in Standard FreeCAD units.
17:28:36  Exception in thread Thread-15:
17:28:36  Traceback (most recent call last):
17:28:36    File "H:\bjFreeCAD\bin\lib\threading.py", line 932, in _bootstrap_inner
17:28:36      self.run()
17:28:36    File "H:\bjFreeCAD\bin\lib\threading.py", line 870, in run
17:28:36      self._target(*self._args, **self._kwargs)
17:28:36    File "H:\bjFreeCAD\Mod\Fem\femsolver\task.py", line 118, in protector
17:28:36      self.run()
17:28:36    File "H:\bjFreeCAD\Mod\Fem\femsolver\elmer\tasks.py", line 87, in run
17:28:36      w.write_solver_input()
17:28:36    File "H:\bjFreeCAD\Mod\Fem\femsolver\elmer\writer.py", line 93, in write_solver_input
17:28:36      self._writeSif()
17:28:36    File "H:\bjFreeCAD\Mod\Fem\femsolver\elmer\writer.py", line 1079, in _writeSif
17:28:36      sif.write(fstream)
17:28:36    File "H:\bjFreeCAD\Mod\Fem\femsolver\elmer\sifio.py", line 219, in write
17:28:36      writeSections(self.sections, stream)
17:28:36    File "H:\bjFreeCAD\Mod\Fem\femsolver\elmer\sifio.py", line 101, in writeSections
17:28:36      _Writer(ids, sections, stream).write()
17:28:36    File "H:\bjFreeCAD\Mod\Fem\femsolver\elmer\sifio.py", line 293, in write
17:28:36      self._writeSection(s)
17:28:36    File "H:\bjFreeCAD\Mod\Fem\femsolver\elmer\sifio.py", line 298, in _writeSection
17:28:36      self._writeSectionBody(s)
17:28:36    File "H:\bjFreeCAD\Mod\Fem\femsolver\elmer\sifio.py", line 314, in _writeSectionBody
17:28:36      self._writeAttribute(key, s[key])
17:28:36    File "H:\bjFreeCAD\Mod\Fem\femsolver\elmer\sifio.py", line 325, in _writeAttribute
17:28:36      scalarData = self._getOnlyElement(data)
17:28:36    File "H:\bjFreeCAD\Mod\Fem\femsolver\elmer\sifio.py", line 337, in _getOnlyElement
17:28:36      return it.next()
17:28:36  AttributeError: 'list_iterator' object has no attribute 'next'
17:28:44  Traceback (most recent call last):
17:28:44    File "H:\bjFreeCAD\Mod\Fem\femsolver\solver_taskpanel.py", line 81, in <lambda>
17:28:44      self.form.appendStatus))
17:28:44  AttributeError: 'NoneType' object has no attribute 'appendStatus'
Where should I look at now?

cheers

John
myplate2.jpg
myplate2.jpg (47.4 KiB) Viewed 1255 times
myplate.jpg
myplate.jpg (40.76 KiB) Viewed 1255 times
shell.FCStd
(13.5 KiB) Downloaded 23 times
Last edited by Kunda1 on Thu Aug 05, 2021 1:44 am, edited 1 time in total.
Reason: fixed wiki bbcode (please just use the wiki page name and omit the rest of the URL syntax)
hfc series CAE workbenches for FreeCAD (hfcNastran95, hfcMystran, hfcFrame3DD, hfcSU2 and more)
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Trying to add Shell equation for Elmer

Post by bernd »

You do not need a shell equation to run this, just add elasticity equation and it should work. If not there is a bug in Elmer writer.

Equations are physical laws, a shell is a geometry.
User avatar
johnwang
Veteran
Posts: 1345
Joined: Sun Jan 27, 2019 12:41 am

Re: Trying to add Shell equation for Elmer

Post by johnwang »

bernd wrote: Sun Aug 01, 2021 8:43 am Equations are physical laws, a shell is a geometry.
I'm testing Elmer's true shell solver.
hfc series CAE workbenches for FreeCAD (hfcNastran95, hfcMystran, hfcFrame3DD, hfcSU2 and more)
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Trying to add Shell equation for Elmer

Post by bernd »

johnwang wrote: Sun Aug 01, 2021 10:09 am
bernd wrote: Sun Aug 01, 2021 8:43 am Equations are physical laws, a shell is a geometry.
I'm testing Elmer's true shell solver.
ahh Elmer has a separate solver for shell elements? OK than you are correct an own Equation is needed.

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

Re: Trying to add Shell equation for Elmer

Post by bernd »

offtopic
johnwang wrote: Sun Aug 01, 2021 7:55 am I followed [wiki]https://wiki.freecadweb.org/Add_FEM_Equation_Tutorial[/wiki]
you somehow do use the wiki link wrong. It should look like this:

Code: Select all

[wiki]Add_FEM_Equation_Tutorial[/wiki]
which will look in the post like this: Add_FEM_Equation_Tutorial
User avatar
johnwang
Veteran
Posts: 1345
Joined: Sun Jan 27, 2019 12:41 am

Re: Trying to add Shell equation for Elmer

Post by johnwang »

bernd wrote: Sun Aug 01, 2021 10:14 am ahh Elmer has a separate solver for shell elements? OK than you are correct an own Equation is needed.
Your example SIF:

Code: Select all

Solver 1
  Bubbles = Logical False
  Calculate Pangle = Logical False
  Calculate Principal = Logical False
  Calculate Strains = Logical False
  Calculate Stresses = Logical False
  Displace mesh = Logical False
  Eigen Analysis = Logical False
  Eigen System Values = Integer 5
  Equation = String "Elasticity"
  Exec Solver = String "Always"
  Linear System Abort Not Converged = Logical False
  Linear System Convergence Tolerance = Real 1e-08
  Linear System Iterative Method = String "BiCGStab"
  Linear System Max Iterations = Integer 500
  Linear System Precondition Recompute = Integer 1
  Linear System Preconditioning = String "ILU0"
  Linear System Residual Output = Integer 1
  Linear System Solver = String "Iterative"
  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
My target SIF:

Code: Select all

Solver 1
  Equation = "Shell equations"
  Procedure = "ShellSolver" "ShellSolver"
  Large Deflection = False
  Linear System Solver = Direct
  Linear System Preconditioning = ILU0
  Linear System Row Equilibration = Logical True
  Linear System Max Iterations = 1000
  Linear System Convergence Tolerance = 1e-8
  Linear System Direct Method = Umfpack
  Linear System GCR Restart = 300
  Linear System Abort Not Converged = False
  Steady State Convergence Tolerance = 1e-09
End
The new things are:

Code: Select all

  Equation = "Shell equations"
  Procedure = "ShellSolver" "ShellSolver"
  Large Deflection = False
hfc series CAE workbenches for FreeCAD (hfcNastran95, hfcMystran, hfcFrame3DD, hfcSU2 and more)
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Trying to add Shell equation for Elmer

Post by bernd »

since Elmer and Equation was originally not developed by me I can not tell out of the box where the problems are ... I need to spend some time on this too, to find problems.
User avatar
johnwang
Veteran
Posts: 1345
Joined: Sun Jan 27, 2019 12:41 am

Re: Trying to add Shell equation for Elmer

Post by johnwang »

The error is before I could get a SIF file.

If I could get a SIF file, I could check it is right or not.
hfc series CAE workbenches for FreeCAD (hfcNastran95, hfcMystran, hfcFrame3DD, hfcSU2 and more)
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Trying to add Shell equation for Elmer

Post by Kunda1 »

bernd wrote: Sun Aug 01, 2021 12:16 pm since Elmer and Equation was originally not developed by me I can not tell out of the box where the problems are ... I need to spend some time on this too, to find problems.
We have FEM_SolverElmer, can we add some historical info to it? Like who added Elmer. Is there a roadmap for the solver?
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
User avatar
johnwang
Veteran
Posts: 1345
Joined: Sun Jan 27, 2019 12:41 am

Re: Trying to add Shell equation for Elmer

Post by johnwang »

Still have errors, but got a SIF output file now.

For fixed constraint, the current format is:

Code: Select all

Boundary Condition 1
  Displacement 1 = Real 0.0
  Displacement 2 = Real 0.0
  Displacement 3 = Real 0.0
  Name = String "Edge1"
End
My target format is :

Code: Select all

Boundary Condition 1
  Target Boundaries(1) = 1 
  Name = "Fix"
  U 2 = 0
  U 3 = 0
  U 1 = 0
  DNU 3 = 0
  DNU 2 = 0
  DNU 1 = 0
End
Need to change writer.py here:

Code: Select all

    def _handleShellBndConditions(self):
	...
        for obj in self._getMember("Fem::ConstraintFixed"):
            if obj.References:
                for name in obj.References[0][1]:
                    self._boundary(name, "Displacement 1", 0.0)
                    self._boundary(name, "Displacement 2", 0.0)
                    self._boundary(name, "Displacement 3", 0.0)
                self._handled(obj)
Where is "Displacement 1" defined?
hfc series CAE workbenches for FreeCAD (hfcNastran95, hfcMystran, hfcFrame3DD, hfcSU2 and more)
Post Reply