Netgen over a remote connection requiring display

HI All,

I am trying to use Netgen over a remote desktop connection via an ubuntu terminal without an attached display. My understanding is that

$ netgen -geofile=example.geo -meshfile=example.vol - coarse -batchmode

would generate a mesh of example.geo without opening a gui interface. Is that correct? I am getting tkinter errors about connecting to a display:

Traceback (most recent call last):
File “/home/james/.local/bin/netgen”, line 8, in
sys.exit(main())
File “/home/james/.local/lib/python3.10/site-packages/netgen/main.py”, line 45, in main
from .gui import win
File “/home/james/.local/lib/python3.10/site-packages/netgen/gui.py”, line 48, in
StartGUI()
File “/home/james/.local/lib/python3.10/site-packages/netgen/gui.py”, line 20, in StartGUI
win = Tk()
File “/usr/lib/python3.10/tkinter/init.py”, line 2299, in init
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: couldn’t connect to display “localhost:0.0”

Regards,
James

in your command is the space between the - and coarse on purpose or a copy mistake?
Because if I remove the space your command works for me.

But how did you install ngsolve? Using provided installer, apt or pip installer?

Hi Christopher,
Thanks for the prompt reply.

The space between the - and coarse was a copying mistake I made when I typed my original forum post.
I’ve installed ngsolve via the pip installer.

Regards,
James

Hi James,

The “netgen” executable in the pip installer is actually a python script, not implementing all the options from the “legacy” executable you get when you compile the code yourself. (has to do with python packaging and linkage).

In your case I would write a short python script to do the meshing and run it:

[code]from netgen.csg import *

geom = CSGeometry(“some_file.geo”)
mesh = geom.GenerateMesh(meshsize.coarse)
mesh.Save(“mesh.vol.gz”)[/code]

Best,
Matthias