I’m glad you were able to solve the issue, and adapt my script. It should also work for 3d. If you ever need drift diffusion, I have scripts in the same devsim_misc
for creating a background refinement mesh for active regions of a device.
gmsh is usually good in 2d in producing Delaunay triangulations.
in 3d, I encounter issues with non Delaunay tetrahedral meshes, resulting in an over estimation of current. There was an issue in 3d on macOS and Windows, but that was fixed in a recent release https://forum.devsim.org/t/drift-diffusion-simulation-for-3d-produces-higher-currents-than-expected/244
Also let me know if you every need help converting meshes from other formats. I have code for importing 3d meshes from Cubit’s exodus format. I also have an understanding in how Synopsys’ tdr format works.
Also, I also have code for placing a contact at a both sides of a semiconductor/insulator interface.