This week, I came across a not so uncommon problem with one of our projects, where negative matrix terms had been flagged during resolution.
Warning: fe_case(‘Assemble’) 20 negative diagonal terms 5014402z -1e+03 501110x -8.5e+05 … 624087z -40 624091y -6.8e+04
Now, this kind of message is often the starting point of extended mesh surgery hours. Depending on the software, this can lead to a direct procedure termination; in SDT this is not blocked to let the user decide what to do with a strong warning. Nevertheless, the reality is that even when the resolution gets through, results are usually worse, while resolution times rocket up. This pattern must thus be avoided.
Negative matrix terms come from the contributions of elements with negative Jacobians. You can read more about the details in one of our previous posts https://www.sdtools.com/model-verification-for-quality-assessment-mesh-level/. As a quick reminder, negative Jacobians are usually caused by elements with inappropriate geometry: warped elements, quadratic elements with offset middle nodes are classical.
Luckily, we have some mesh quality tools in our belt for diagnostic and now correction for poorly shaped elements with fe_quality. The automated correction tools are commanded with clean{} function that accepts an operation sequence depending on the need:
- NJStraight: Displacement of middle nodes to ensure straight edges (iterative)
- FlatHex: Correction of hexahedral elements having some very small edges, nodes of small edges are coalesced.
- DegenRecast. Correction of degenerate elements by assigning a resolved type, or in cell remeshing.
- Orient. Warped elements by inappropriate numbering sequence reset to a clean order.
Today I hit several patterns on my working mesh, that I could correct with fe_quality. I first had tetrahedral elements with offset middle nodes. This happens for example when parts with holes are coarsely meshed regarding the hole size.


Negative Jacobian elements display from the GUI
In this case the NJStraight command detects elements with negative Jacobians and resets their middle nodes positions on the straight edge, of course iteratively to check the effect of the new node position on the connected elements. This can leave a small discrepancy from the original geometry, but it is a negligible effect regarding getting good element conditioning. If the geometry is of primary concern, meshing with a smaller seed length is advised.
This solved part of the problem, but I still got hit with poor elements on some pin heads. The pattern here is common. Doing a revolution mesh for a cylinder is a very good solution, leading to degenerate hexahedral elements in the axis (I’ll come to this later), but otherwise very clean. In my case however, this did not make fe_quality happy. Zooming on the central area exposed the reason: failed node coalescence on the pin axis. A tolerance problem on node position and your nice axis becomes a fuzzy cylinder with interferences….

Now this is quite a tricky problem in general, prone to get you headaches on the mesher side! This is where the FlatHex command of fe_quality comes in handy. It automatically coalesces nodes of very small edges relative length of hexahedral elements with a recursive dependency resolution. In one pass I recovered clean pin axes.
Last but not least, I still had degenerate elements. These elements have coalesced nodes (that is to say some zero length edges). They can be treated with DegenRecast, whose purpose is to assign a proper type to the degenerate elements. The common revolution axis can be easily treated as pentahedral (or wedge) elements. But this mesh had even more suprises for me, with hexahedra having only one coalesced node. This pattern does not correspond to any element type, but that was not the first time I hit this case so DegenRecast has a solution. Here it will remesh the cell without changing external faces (for continuity). Some internal nodes are added to allow filling the cell with pyramid and tetrahedral elements, same volume, faces, and problem solved!

In the end, I could correct my entire mesh in SDT with a single command sequence
model=fe_quality(‘Clean{FlatHex,DegenRecast,NJStraight-nite2,Orient}’,model)
Over a minute of waiting time relieved my fear of having to get my nodal scalpel and start butchering around. With our SDT-FEMLink module, our tools can also be used for external computation by exporting the corrected mesh to the code of interest!