Salome HOME
Some improvements on Scaled Jacobian: cce/32738ScaledJacobian 14/head
authorChristophe Bourcier <christophe.bourcier@cea.fr>
Tue, 8 Aug 2023 10:42:44 +0000 (12:42 +0200)
committerChristophe Bourcier <christophe.bourcier@cea.fr>
Tue, 8 Aug 2023 11:35:47 +0000 (13:35 +0200)
- add math to sphinx to generate the formulas
- change the icon to deformed hexahedrons
- add a test on deformed hexahedrons
- update the example use case on the doc to deformed hexahedrons

doc/gui/conf.py.in
doc/gui/images/scaled_jacobian.png
doc/gui/images/scaled_jacobian_mesh_hexa.png [new file with mode: 0644]
doc/gui/images/scaled_jacobian_mesh_tetra.png [deleted file]
doc/gui/input/scaled_jacobian.rst
resources/CMakeLists.txt
resources/mesh_scaled_jacobian.png
test/SMESH_controls_scaled_jacobian.py

index be0975ff7cd9159d19b0519dbb70f7cf50a432f5..854a10d49b5fded7b86f1bf4096b15a44843f4b5 100644 (file)
@@ -186,6 +186,7 @@ html_use_index = True
 # Output file base name for HTML help builder.
 htmlhelp_basename = 'smeshdoc'
 
+extensions += ['sphinx.ext.mathjax']
 
 # Options for LaTeX output
 # ------------------------
index 6739c3121d1ed5a2cda5fe2d910b73a7d26f4fe6..e25a7fa4ee4fcbd2d68f69342215c50c8baeb657 100644 (file)
Binary files a/doc/gui/images/scaled_jacobian.png and b/doc/gui/images/scaled_jacobian.png differ
diff --git a/doc/gui/images/scaled_jacobian_mesh_hexa.png b/doc/gui/images/scaled_jacobian_mesh_hexa.png
new file mode 100644 (file)
index 0000000..4c88186
Binary files /dev/null and b/doc/gui/images/scaled_jacobian_mesh_hexa.png differ
diff --git a/doc/gui/images/scaled_jacobian_mesh_tetra.png b/doc/gui/images/scaled_jacobian_mesh_tetra.png
deleted file mode 100644 (file)
index 355fe7d..0000000
Binary files a/doc/gui/images/scaled_jacobian_mesh_tetra.png and /dev/null differ
index 4ce8f9ac001efc9c82eabdf69361b402d5bce1ef..fddfd0977328182aa3713932b0b5f19cf5d475d5 100644 (file)
@@ -4,12 +4,19 @@
 Scaled Jacobian
 ***************
 
-The **Scaled Jacobian** mesh quality criteria, is a scalar measure of the deviation from the perfect element in the geometrical sense, this measure normalize the range of reported values
-between [0,1] for a normal element, the value of 1 is considered a perfect element and 0 a element with a collapsed side. Negative values are also accepted for invalid elements.
+The **Scaled Jacobian** mesh quality criteria is a scalar measure of the deviation from the perfect element in the geometrical sense. This measure normalizes the range of reported values between [0,1] for a normal element, the value of 1 is considered a perfect element and 0 a element with a collapsed side. Negative values are also accepted for invalid elements.
 
-The **Scaled Jacobian** is implemented for volumetric elements returning 0 for polyhedrons. For tetrahedron and hexahedron the close form 
-is defined in `[1] <https://gitlab.kitware.com/third-party/verdict/-/blob/master/SAND2007-2853p.pdf>`_, for pyramids the minimum scaled jacobian of the four tetrahedrons formed
-in the four vertices of the pyramid base is reported, for pentahedrons a decomposition into tetrahedron is also done and finally for hexahedron prisms the minimum scaled jacobian between two pentahedrons and one hexahedron is reported.
+The **Scaled Jacobian** is implemented for all volumetric elements (except for polyhedrons, returning 0).
+
+For tetrahedrons and hexahedrons, the formulas are
+defined in `The Verdict Library Reference Manual [1] <https://gitlab.kitware.com/third-party/verdict/-/blob/master/SAND2007-2853p.pdf>`_.
+
+For pyramid, the minimum scaled jacobian of the four tetrahedrons formed
+in the four vertices of the pyramid base is reported.
+
+For pentahedron, a decomposition into tetrahedron is also done.
+
+For hexahedron prisms, the minimum scaled jacobian between two pentahedrons and one hexahedron is reported.
 
 * Geometrically the Scaled Jacobian of a **tetrahedron** can be understood by the follow figure:
 
@@ -35,7 +42,7 @@ in the four vertices of the pyramid base is reported, for pentahedrons a decompo
    
    Your mesh will be displayed in the viewer with its elements colored according to the applied mesh quality control criterion:
 
-       .. image:: ../images/scaled_jacobian_mesh_tetra.png
+       .. image:: ../images/scaled_jacobian_mesh_hexa.png
                :align: center
 
 
index de35d5b9545e8880ce01c8434a934d82d4434284..feda6ed7e298f37bf36e2ba192aeb696de841cdb 100644 (file)
@@ -168,6 +168,7 @@ SET(SMESH_RESOURCES_FILES
   mesh_renumbering_nodes.png
   mesh_revolution.png
   mesh_rotation.png
+  mesh_scaled_jacobian.png
   mesh_sew_bordertoside.png
   mesh_sew_conform_freeborders.png
   mesh_sew_freeborders.png
index 0f01f54a511ac23d231a9513eab0f0cd44e1bc9d..e25a7fa4ee4fcbd2d68f69342215c50c8baeb657 100644 (file)
Binary files a/resources/mesh_scaled_jacobian.png and b/resources/mesh_scaled_jacobian.png differ
index b7388ec4a6530b01bde9ab194571acc631133550..c2a44dc75d47ecee7f2fdbb8a40288c96f0081fe 100644 (file)
@@ -136,9 +136,47 @@ if not Done:
 
 pentahedrons = 0.6
 pentasAndPolys     = smesh.GetFilter(SMESH.VOLUME, SMESH.FT_ScaledJacobian, SMESH.FT_LessThan, pentahedrons )
-#Distorted hexas
 
 polysIds          = Mesh_4.GetIdsFromFilter(polysElements)
 pentasAndPolysIds = Mesh_4.GetIdsFromFilter(pentasAndPolys)
 
 assert( len(pentasAndPolysIds) - len(polysIds) == 10 )
+
+#Test distorded hexahedrons scaled jacobian values
+Mesh_5 = smesh.Mesh(Box_1,'Mesh_5')
+Regular_1D = Mesh_5.Segment()
+Number_of_Segments_1 = Regular_1D.NumberOfSegments(2)
+Quadrangle_2D = Mesh_5.Quadrangle(algo=smeshBuilder.QUADRANGLE)
+Hexa_3D = Mesh_5.Hexahedron(algo=smeshBuilder.Hexa)
+isDone = Mesh_5.Compute()
+
+if not Done:
+  raise Exception("Error when computing hexaedrons Mesh for quality control test")
+
+#move some nodes to make scaled jacobian lesser than 1
+node_id_1 = Mesh_5.FindNodeClosestTo(0, 0, 10)
+node_id_5 = Mesh_5.FindNodeClosestTo(10, 0, 10)
+node_id_14 = Mesh_5.FindNodeClosestTo(10, 5, 10)
+node_id_13 = Mesh_5.FindNodeClosestTo(10, 0, 5)
+node_id_6 = Mesh_5.FindNodeClosestTo(10, 0, 0)
+Mesh_5.MoveNode( node_id_1, 1, 1, 9 )
+Mesh_5.MoveNode( node_id_5, 9, 1, 9 )
+Mesh_5.MoveNode( node_id_14, 10, 5, 9 )
+Mesh_5.MoveNode( node_id_13, 9, 0, 5 )
+Mesh_5.MoveNode( node_id_6, 8, 0, 0 )
+
+yellow_element = Mesh_5.FindElementsByPoint(7.5, 2.5, 2.5)[0]
+green_element = Mesh_5.FindElementsByPoint(7.5, 2.5, 7.5)[0]
+blue_element = Mesh_5.FindElementsByPoint(2.5, 2.5, 7.5)[0]
+
+yellow_SJ = Mesh_5.GetScaledJacobian(yellow_element)
+green_SJ = Mesh_5.GetScaledJacobian(green_element)
+blue_SJ = Mesh_5.GetScaledJacobian(blue_element)
+
+yellow_SJ_ref = 0.910446300912
+green_SJ_ref = 0.818025491961
+blue_SJ_ref = 0.654728501099
+
+assert assertWithDelta( yellow_SJ_ref, yellow_SJ, 1e-10 )
+assert assertWithDelta( green_SJ_ref, green_SJ, 1e-10 )
+assert assertWithDelta( blue_SJ_ref, blue_SJ, 1e-10 )