Problem with nonpositive jacobian - help appreciated

About the development of the FEM module/workbench.

Moderator: bernd

HoWil
Veteran
Posts: 1279
Joined: Sun Jun 14, 2015 7:31 pm
Location: Austria

Problem with nonpositive jacobian - help appreciated

Post by HoWil »

Dear all,

I entcounter a problem regarding a eigenfrequency simulation with calculix in FC.
I have the following model and can run a static simulation but when switching to frequency-analysis I see the following error messages:
v1p04_crosssection_tmp2.fcstd
(320.91 KiB) Downloaded 116 times

Code: Select all

Active analysis found: Analysis
Active analysis found: Analysis

We gone start GMSH FEM mesh run!
  Part to mesh: Name --> Extrude,  Label --> Extrude, ShapeType --> Solid
  CharacteristicLengthMax: 1e+22
  CharacteristicLengthMin: 0.0
  ElementOrder: 2
  ElementDimension: 3
  /tmp/Extrude_Geometry.brep
  /tmp/Extrude_Mesh_TmpGmsh.unv
  /tmp/shape2mesh.geo
  gmsh
  No mesh group objects.
  Group meshing.
  {}
  No mesh regions.
  {}
  {}
Start: ViewProviderFEMMeshBuilder::createMesh() =================================
    0.001000: Start build up 13940 face helper
    0.029000: Start eliminate internal faces SIMPLE
    1.199000: Start build up node map
    1.210000: Start set point vector
    1.213000: Start count triangle size
    NumTriangles:10776
    1.213000: Start build up triangle vector
    1.273000: Start build up edge vector
    NumEdges:16164
    1.281000: Finish =========================================================
  The Part should have a pretty new FEM mesh!
ThermalConductivity not found in material data of: None
ThermalExpansionCoefficient not found in material data of: None
SpecificHeat not found in material data of: None
FEM preferences working dir is not set, the solver working directory is used.
Dir '' doesn't exist and cannot be created.
Dir '/tmp' will be used instead.
FemTools.setup_working_dir()  -->  self.working_dir = /tmp
FemInputWriterCcx --> self.dir_name  -->  /tmp
FemInputWriterCcx --> self.main_file_name  -->  Extrude_Mesh.inp
FemInputWriterCcx --> self.file_name  -->  /tmp/Extrude_Mesh.inp
('  ReferenceShape : ', 'Face', ', ', 'Extrude', ', ', u'Extrude', ' --> ', 'Face1')
('  ReferenceShape : ', 'Face', ', ', 'Extrude', ', ', u'Extrude', ' --> ', 'Face2')
('  ReferenceShape : ', 'Face', ', ', 'Extrude', ', ', u'Extrude', ' --> ', 'Face3')
('  ReferenceShape : ', 'Face', ', ', 'Extrude', ', ', u'Extrude', ' --> ', 'Face4')
Writing time input file: 0.327914 

Invalid Signal signature: textchanged() 
FEM preferences working dir is not set, the solver working directory is used.
Dir '' doesn't exist and cannot be created.
Dir '/tmp' will be used instead.
FemTools.setup_working_dir()  -->  self.working_dir = /tmp
FemInputWriterCcx --> self.dir_name  -->  /tmp
FemInputWriterCcx --> self.main_file_name  -->  Extrude_Mesh.inp
FemInputWriterCcx --> self.file_name  -->  /tmp/Extrude_Mesh.inp
('  ReferenceShape : ', 'Face', ', ', 'Extrude', ', ', u'Extrude', ' --> ', 'Face1')
('  ReferenceShape : ', 'Face', ', ', 'Extrude', ', ', u'Extrude', ' --> ', 'Face2')
('  ReferenceShape : ', 'Face', ', ', 'Extrude', ', ', u'Extrude', ' --> ', 'Face3')
('  ReferenceShape : ', 'Face', ', ', 'Extrude', ', ', u'Extrude', ' --> ', 'Face4')
Writing time input file: 0.452673 

Analysis failed with exit code 201
--------start of stderr-------

--------end of stderr---------
--------start of stdout-------

************************************************************

CalculiX Version 2.9, Copyright(C) 1998-2015 Guido Dhondt
CalculiX comes with ABSOLUTELY NO WARRANTY. This is free
software, and you are welcome to redistribute it under
certain conditions, see gpl.htm

************************************************************

You are using an executable made on Thu Jan 21 05:18:00 UTC 2016

  The numbers below are estimated upper bounds

  number of:

   nodes:         7532
   elements:         6543
   one-dimensional elements:            0
   two-dimensional elements:            0
   integration points per element:            4
   degrees of freedom per node:            3
   layers per element:            1

   distributed facial loads:            0
   distributed volumetric loads:            0
   concentrated loads:            0
   single point constraints:         3264
   multiple point constraints:            1
   terms in all multiple point constraints:            1
   tie constraints:            0
   dependent nodes tied by cyclic constraints:            0
   dependent nodes in pre-tension constraints:            0

   sets:            4
   terms in all sets:        23122

   materials:            1
   constants per material and temperature:            2
   temperature points per material:            1
   plastic data points per material:            0

   orientations:            0
   amplitudes:            1
   data points in all amplitudes:            1
   print requests:            2
   transformations:            0
   property cards:            0


 STEP            1

 Frequency analysis was selected

 Decascading the MPC's

 Determining the structure of the matrix:
 number of equations
 19332
 number of nonzero lower triangular matrix elements
 603945

 Using up to 4 cpu(s) for the stress calculation.

 *ERROR in e_c3d: nonpositive jacobian
        determinant in element        6195

 *ERROR in e_c3d: nonpositive jacobian
        determinant in element        6195

 *ERROR in e_c3d: nonpositive jacobian
        determinant in element        6195

 *ERROR in e_c3d: nonpositive jacobian
        determinant in element        6196

 *ERROR in e_c3d: nonpositive jacobian
        determinant in element        6196

 *ERROR in e_c3d: nonpositive jacobian
        determinant in element        6196

 *ERROR in e_c3d: nonpositive jacobian
        determinant in element        6205

 *ERROR in e_c3d: nonpositive jacobian
        determinant in element        6205

 *ERROR in e_c3d: nonpositive jacobian
        determinant in element        6205


--------end of stdout---------
CalculiX failed ccx finished with error 201
<unknown exception traceback><type 'exceptions.ImportError'>: No module named _FemSolverCalculix
<unknown exception traceback><type 'exceptions.ImportError'>: No module named _FemMeshGmsh
<unknown exception traceback><type 'exceptions.ImportError'>: No module named _FemMaterial
<unknown exception traceback><type 'exceptions.ImportError'>: No module named _FemMechanicalResult
<unknown exception traceback><type 'exceptions.ImportError'>: No module named _FemMechanicalResult
<unknown exception traceback><type 'exceptions.ImportError'>: No module named _FemMechanicalResult
<unknown exception traceback><type 'exceptions.ImportError'>: No module named _ViewProviderFemSolverCalculix
<unknown exception traceback><type 'exceptions.ImportError'>: No module named _ViewProviderFemMaterial
<unknown exception traceback><type 'exceptions.ImportError'>: No module named _ViewProviderFemMeshGmsh
Start: ViewProviderFEMMeshBuilder::createMesh() =================================
    0.000000: Start build up 2016 face helper
    0.004000: Start eliminate internal faces SIMPLE
    0.019000: Start build up node map
    0.020000: Start set point vector
    0.021000: Start count triangle size
    NumTriangles:1760
    0.021000: Start build up triangle vector
    0.026000: Start build up edge vector
    NumEdges:2640
    0.026000: Finish =========================================================
<unknown exception traceback><type 'exceptions.ImportError'>: No module named _ViewProviderFemMechanicalResult
<unknown exception traceback><type 'exceptions.ImportError'>: No module named _ViewProviderFemMechanicalResult
<unknown exception traceback><type 'exceptions.ImportError'>: No module named _ViewProviderFemMechanicalResult
Start: ViewProviderFEMMeshBuilder::createMesh() =================================
    0.000000: Start build up 2016 face helper
    0.004000: Start eliminate internal faces SIMPLE
    0.019000: Start build up node map
    0.020000: Start set point vector
    0.021000: Start count triangle size
    NumTriangles:1760
    0.021000: Start build up triangle vector
    0.026000: Start build up edge vector
    NumEdges:2640
    0.026000: Finish =========================================================
First I thought the selected material (calculix-steel) is producing the problem due to missing density entries, but I built another model with simpler geometry and everything works fine.

OS: Ubuntu 16.04.2 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.10412 (Git)
Build type: Unknown
Branch: femdev
Hash: 9229026ea3348cfa6eec93d1e7086359b5f6a508
Python version: 2.7.12
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17

also tried/rebuilt it on and a two days old master version, did rebuild it several times because FC-material did change a lot:
OS: Ubuntu 16.04.2 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.10168 (Git)
Build type: None
Branch: master
Hash: 6630bcf9fa8e849fe846d1c2b780148a7a2c1e4b
Python version: 2.7.12
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17


Here the simpler but working model:
fem_gmsh_test.fcstd
(732.66 KiB) Downloaded 113 times
I do not know why it is working with the simpler geometry and appreciate any hints and help.

Thanks in advance,
HoWil
joha2
Posts: 303
Joined: Tue Oct 11, 2016 9:48 pm

Re: Problem with nonpositive jacobian - help appreciated

Post by joha2 »

First of all I would say the mesh is quite too coarse. Further some of the elements look quite distorted. I switched back to a first order mesh (i.e. tet4 elements) and it worked (but I think that is not useful for you).
mesh_distortion_coarse.jpg
mesh_distortion_coarse.jpg (357.41 KiB) Viewed 8661 times
Further I increased mesh resolution (0.1 mm) and it showed me that there are perturbations in the geometry to (i.e. places where the geometry is shown plane, but the mesh density increases.)
mesh_distortion.jpg
mesh_distortion.jpg (486.06 KiB) Viewed 8661 times
These perturbations are located where your wires (from a draft?) are broken. Maybe you should try to make the wires straight and afterwards extrude. Maybe this removes the element distortion and therefore the negative Jacobian determinant.
wires.jpg
wires.jpg (364.39 KiB) Viewed 8661 times
Hope this helps.
Best wishes
Johannes
HoWil
Veteran
Posts: 1279
Joined: Sun Jun 14, 2015 7:31 pm
Location: Austria

Re: Problem with nonpositive jacobian - help appreciated

Post by HoWil »

Hi Johannes,

thanks for your reply.
I used a coarse mesh to be able to upload the file. I thought that since the mesh can be created by gmsh and since it is imported into FC it can't be the problem. Maybe I was wrong.
I will look into it and report back.

BR,
HoWil
HoWil
Veteran
Posts: 1279
Joined: Sun Jun 14, 2015 7:31 pm
Location: Austria

Re: Problem with nonpositive jacobian - help appreciated

Post by HoWil »

joha2 wrote: These perturbations are located where your wires (from a draft?) are broken. Maybe you should try to make the wires straight and afterwards extrude. Maybe this removes the element distortion and therefore the negative Jacobian determinant.
If this is the problem ..... why is the mesh working for static simulations?
If this is the sollution (can't) check it because I am not familiar engough with draft-wb to fix/remove the short line causing the inhomogenious mesh.
BR,
HoWil
joha2
Posts: 303
Joined: Tue Oct 11, 2016 9:48 pm

Re: Problem with nonpositive jacobian - help appreciated

Post by joha2 »

HoWil wrote:If this is the problem ..... why is the mesh working for static simulations?
Yeah and why is it working with 1st order elements? And it didn't work either with 2nd order mesh and the 0.1 mm resolution.
Therefore I would think, that not the coarse mesh is the problem. Unfortunately I am not sure how the tet10 element is treated.
Can it be badly deformed (inside out and things like that) by just meshing a hard geometry?
HoWil wrote:If this is the sollution (can't) check it because I am not familiar engough with draft-wb to fix/remove the short line causing the inhomogenious mesh.
I am also not familiar with it. How did you generate the original shapes?

Best wishes
Johannes
UR_
Veteran
Posts: 1354
Joined: Tue Jan 03, 2017 8:42 pm

Re: Problem with nonpositive jacobian - help appreciated

Post by UR_ »

Hello,
after cleaning shapes from ultrashort segments, everything works fine.
I have used WB Draft-> Draft to Sketch
- Deleting unwanted line segments
- Renew constrains
That's all
Analysis.png
Analysis.png (15.79 KiB) Viewed 8621 times
Mode_2_result.png
Mode_2_result.png (138.17 KiB) Viewed 8621 times
Attachments
v1p04_crosssection_tmp.ur.fcstd
(358.65 KiB) Downloaded 81 times
HoWil
Veteran
Posts: 1279
Joined: Sun Jun 14, 2015 7:31 pm
Location: Austria

Re: Problem with nonpositive jacobian - help appreciated

Post by HoWil »

UR_ wrote:Hello,
after cleaning shapes from ultrashort segments, everything works fine.
I have used WB Draft-> Draft to Sketch
- Deleting unwanted line segments
- Renew constrains
That's all
Analysis.png
Mode_2_result.png
Hello UR_,

Nice finding. I also learned hot to clean such 2D-drawings :D .
Thanks for your effort!
BR,
HoWil
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Problem with nonpositive jacobian - help appreciated

Post by bernd »

UR_ wrote:I have used WB Draft-> Draft to Sketch
- Deleting unwanted line segments
- Renew constrains
Nice one :)

@HoWil: you can show the bad elements with cgx

start cgx with

Code: Select all

$ cgx -c Extrude_Mesh.inp 
Menue Viewing --> Show Bad Elements --> the bad ones will be green
screen.jpg
screen.jpg (275.38 KiB) Viewed 8577 times
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Problem with nonpositive jacobian - help appreciated

Post by bernd »

in FreeCAD ...
watch for output of ccx ...

Code: Select all

*ERROR in e_c3d: nonpositive jacobian
        determinant in element        6195

Code: Select all

obj = App.ActiveDocument.getObject("Extrude_Mesh")
nodes = list(obj.FemMesh.getElementNodes(6195))
Gui.ActiveDocument.Extrude_Mesh.HighlightedNodes = nodes

# Gui.ActiveDocument.Extrude_Mesh.HighlightedNodes = []
screen.jpg
screen.jpg (523.64 KiB) Viewed 8574 times
HoWil
Veteran
Posts: 1279
Joined: Sun Jun 14, 2015 7:31 pm
Location: Austria

Re: Problem with nonpositive jacobian - help appreciated

Post by HoWil »

bernd wrote: @HoWil: you can show the bad elements with cgx
.....
Menue Viewing --> Show Bad Elements --> the bad ones will be green
Thx for pointing this out!

Any ideas to highlight the according elements as 'problematic' in FC? I just wonder how this could be circumvented for the next user facing such a problem since I thought i have a valid solid and a valid mesh.

EDIT: @Bernd I just saw your last plot where you highlighted the elements in FC.

BR
HoWil
Post Reply