From: Christophe Bourcier Date: Tue, 8 Aug 2023 10:42:44 +0000 (+0200) Subject: Some improvements on Scaled Jacobian: X-Git-Tag: V9_12_0a1~12 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=0dbcca5093eb0102ea5365af247e2585561de924;hp=9ac965c0e3635a98daef92d9b8c9721e4795286f;p=modules%2Fsmesh.git Some improvements on Scaled Jacobian: - 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 --- diff --git a/doc/gui/conf.py.in b/doc/gui/conf.py.in index be0975ff7..854a10d49 100644 --- a/doc/gui/conf.py.in +++ b/doc/gui/conf.py.in @@ -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 # ------------------------ diff --git a/doc/gui/images/scaled_jacobian.png b/doc/gui/images/scaled_jacobian.png index 6739c3121..e25a7fa4e 100644 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 index 000000000..4c881869d 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 index 355fe7d3e..000000000 Binary files a/doc/gui/images/scaled_jacobian_mesh_tetra.png and /dev/null differ diff --git a/doc/gui/input/scaled_jacobian.rst b/doc/gui/input/scaled_jacobian.rst index 4ce8f9ac0..fddfd0977 100644 --- a/doc/gui/input/scaled_jacobian.rst +++ b/doc/gui/input/scaled_jacobian.rst @@ -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] `_, 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] `_. + +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 diff --git a/resources/CMakeLists.txt b/resources/CMakeLists.txt index de35d5b95..feda6ed7e 100644 --- a/resources/CMakeLists.txt +++ b/resources/CMakeLists.txt @@ -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 diff --git a/resources/mesh_scaled_jacobian.png b/resources/mesh_scaled_jacobian.png index 0f01f54a5..e25a7fa4e 100644 Binary files a/resources/mesh_scaled_jacobian.png and b/resources/mesh_scaled_jacobian.png differ diff --git a/test/SMESH_controls_scaled_jacobian.py b/test/SMESH_controls_scaled_jacobian.py index b7388ec4a..c2a44dc75 100644 --- a/test/SMESH_controls_scaled_jacobian.py +++ b/test/SMESH_controls_scaled_jacobian.py @@ -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 )