# How I got rid of negative Jacobian elements (cgx workaround)

**URL:** <https://prepomax.discourse.group/t/how-i-got-rid-of-negative-jacobian-elements-cgx-workaround/3609>\
**Category:** Feature Requests\
**Created:** [August 14, 2026, 12:44pm UTC](https://prepomax.discourse.group/t/how-i-got-rid-of-negative-jacobian-elements-cgx-workaround/3609 "2026-08-14T12:44:41Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![bastian.firle](https://avatars.discourse-cdn.com/v4/letter/b/87869e/32.png) [@bastian.firle](https://prepomax.discourse.group/u/bastian.firle)\
**Post date:** [August 14, 2026, 12:44pm UTC](https://prepomax.discourse.group/t/how-i-got-rid-of-negative-jacobian-elements-cgx-workaround/3609/1 "2026-08-14T12:44:41Z")

</div>

**Hi all,**

While working with PrePoMax I ran into meshes with negative Jacobian elements. Since I couldn’t find a built-in fix in the GUI, I put together the workflow below using cgx as a workaround. Maybe this is useful to others running into the same issue, or maybe it’s something that could eventually be integrated into the GUI directly.

Thanks a lot for developing PrePoMax — it’s an amazing tool!

**Protocol for eliminating negative elements**

1. Generate the mesh in PrePoMax. This is where the negative elements were created.
2. Export the .inp file and open it in cgx.
3. In cgx, the set `-NJBY` is automatically created, containing all negative elements.
4. Repeatedly running `mids -NJBY lin force` unfortunately did not eliminate the negative elements in my case, so I took a different approach.
5. Running `merg n all 0.01` merges all nodes that lie closer together than the specified tolerance (0.01 in this case). This removed all the negative elements.
6. Running `send all abq` generates a file `all.msh` containing the corrected mesh.
7. Manually rename the file extension from `.msh` to `.inp`. PrePoMax then recognizes the file and can import it.
8. Continue working with the new mesh in PrePoMax and start the job. With this corrected mesh, the calculation ran through successfully.

Best regards,  
Bastian

---

<div class="post-metadata">

**Author:** ![SergioP1975](https://yyz2.discourse-cdn.com/free1/user_avatar/prepomax.discourse.group/sergiop1975/32/37_2.png) [@SergioP1975](https://prepomax.discourse.group/u/SergioP1975)\
**Post date:** [August 14, 2026, 1:37pm UTC](https://prepomax.discourse.group/t/how-i-got-rid-of-negative-jacobian-elements-cgx-workaround/3609/2 "2026-08-14T13:37:11Z")

</div>

Did you try to don´t use the midsize nodes in the geometry? In my models this option very often cause non jaobian elements or other deformations on elements in curved faces.

 ![image](https://global.discourse-cdn.com/free1/uploads/prepomax/original/2X/2/2dba8b8bfb1d3fd29be0595b3f762ce06588e5a4.png)

---

<div class="post-metadata">

**Author:** ![FEAnalyst](https://yyz2.discourse-cdn.com/free1/user_avatar/prepomax.discourse.group/feanalyst/32/688_2.png) [@FEAnalyst](https://prepomax.discourse.group/u/FEAnalyst)\
**Post date:** [August 14, 2026, 1:37pm UTC](https://prepomax.discourse.group/t/how-i-got-rid-of-negative-jacobian-elements-cgx-workaround/3609/3 "2026-08-14T13:37:13Z")

</div>

The most common cause of negative jacobians in PrePoMax is adjustment in tie constraints or contact. Sometimes they are also generated when meshing problematic geometries.

PrePoMax creates a set for negative jacobians when submitting an analysis (or just the Check Model procedure), but you can also use the built-in mesh quality check tool to find them.

---

<div class="post-metadata">

**Author:** ![FEAnalyst](https://yyz2.discourse-cdn.com/free1/user_avatar/prepomax.discourse.group/feanalyst/32/688_2.png) [@FEAnalyst](https://prepomax.discourse.group/u/FEAnalyst)\
**Post date:** [August 14, 2026, 1:37pm UTC](https://prepomax.discourse.group/t/how-i-got-rid-of-negative-jacobian-elements-cgx-workaround/3609/4 "2026-08-14T13:37:53Z")

</div>

The “Midside nodes on geometry” option is disabled by default and when it’s enabled, it may indeed lead to negative jacobians for some geometries.

---

<div class="post-metadata">

**Author:** ![bastian.firle](https://avatars.discourse-cdn.com/v4/letter/b/87869e/32.png) [@bastian.firle](https://prepomax.discourse.group/u/bastian.firle)\
**Post date:** [August 17, 2026, 6:51am UTC](https://prepomax.discourse.group/t/how-i-got-rid-of-negative-jacobian-elements-cgx-workaround/3609/5 "2026-08-17T06:51:45Z")

</div>

Yes, I used that option. Disabling “Mid-side nodes on geometry” would definitely be one approach. I think there are advantages to having the option enabled, since the elements naturally represent the geometry better that way. I was just looking for a process to get rid of the few problematic elements that might arise during mesh generation with “Mid-side nodes on geometry” enabled. Thanks for the help!

---

<div class="post-metadata">

**Author:** ![FEAnalyst](https://yyz2.discourse-cdn.com/free1/user_avatar/prepomax.discourse.group/feanalyst/32/688_2.png) [@FEAnalyst](https://prepomax.discourse.group/u/FEAnalyst)\
**Post date:** [August 17, 2026, 7:31am UTC](https://prepomax.discourse.group/t/how-i-got-rid-of-negative-jacobian-elements-cgx-workaround/3609/6 "2026-08-17T07:31:16Z")

</div>

Midside nodes on geometry are disabled by default because, with Netgen and Gmsh, they far too often lead to negative jacobians. Of course, careful preparation of the geometry before importing it to PrePoMax may help reduce those issues. And if more accurate representation of curvatures is needed, they can be always enabled manually in a given case. I wouldn’t do it by default, though (there is a setting in Tools —\> Settings to have it always enabled initially).

---

<div class="post-metadata">

**Author:** ![Matej](https://avatars.discourse-cdn.com/v4/letter/m/a698b9/32.png) [@Matej](https://prepomax.discourse.group/u/Matej)\
**Post date:** [August 17, 2026, 8:12am UTC](https://prepomax.discourse.group/t/how-i-got-rid-of-negative-jacobian-elements-cgx-workaround/3609/7 "2026-08-17T08:12:40Z")

</div>

Maybe there is a good threshold/evaluation value at which projected nodes cause problems and can later be detected by PrePoMax and moved back to the midside position?

---

<div class="post-metadata">

**Author:** ![FEAnalyst](https://yyz2.discourse-cdn.com/free1/user_avatar/prepomax.discourse.group/feanalyst/32/688_2.png) [@FEAnalyst](https://prepomax.discourse.group/u/FEAnalyst)\
**Post date:** [August 17, 2026, 4:29pm UTC](https://prepomax.discourse.group/t/how-i-got-rid-of-negative-jacobian-elements-cgx-workaround/3609/8 "2026-08-17T16:29:17Z")

</div>

Perhaps PrePoMax could check the jacobian (e.g., using the built-in Gmsh quality metrics) of the initially generated mesh before returning it.

Regarding other criteria, maybe normal/tangential offset could be used for midside nodes, like in Patran:

 ![image](https://global.discourse-cdn.com/free1/uploads/prepomax/original/2X/c/caa4f3cc40de71ba7293b52aad66cbcb0ebd949b.png)

 ![image](https://global.discourse-cdn.com/free1/uploads/prepomax/original/2X/9/9ff175f33f42a03e27afde91a01974d0ac0929fb.png)

 ![image](https://global.discourse-cdn.com/free1/uploads/prepomax/original/2X/0/0e4b547290ade4f3f2c530011e36322f3488d160.png)

Here’s also a ref from Coreform Cubit: [Metrics for Tetrahedral Elements — Coreform Cubit Help](https://coreform.com/cubit_help/mesh_generation/mesh_quality_assessment/tetrahedral_metrics.htm)
