Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems using Gmsh #199

Open
Railon69 opened this issue Jul 10, 2023 · 2 comments
Open

Problems using Gmsh #199

Railon69 opened this issue Jul 10, 2023 · 2 comments

Comments

@Railon69
Copy link

Hey folks :)

I am trying to visualize my grid inside bempp or just use one of your standard examples. The problem is that gmsh does not work at all. When I import bempp.api, I get:
Could not find Gmsh.Interactive plotting and shapes module not available.

Therefore, I followed https://bempp.discourse.group/t/fail-to-import-the-package-bempp-api/127/2 using the command

bempp.api.GMSH_PATH = "full/path/to/gmsh/executable"

The error then changes from

RuntimeError: Gmsh is not found. Cannot generate mesh

to

Command 'C:/users/user/wdir/gmsh-4.11.1-Windows64 -2 C:\Users\user\AppData\Local\Temp\tmp9pusbz3w\tmp14z3ffao.geo' returned non-zero exit status 1.

The temp file changes every time I recall the bempp command.
I reinstalled gmsh already. Unfortunately, I couldn't find help neither in the gmsh documentation nor on your side.

bempp.api version = 0.3.0
Gmsh version = 4.11.1

Thanks in advance for your help!

@hjh878
Copy link

hjh878 commented Jan 16, 2024

I have meet such report 'Could not find Gmsh.Interactive plotting and shapes module not available.'. I followed the gmsh website using 'pip install --upgrade gmsh' and such report disappeared

@dvgregor
Copy link

Hello Railon69.
I've installed bempp-cl on Windows 10 using this command:
pip install bempp-cl gmsh matplotlib
and got the error 'Could not find Gmsh' you described.

Looks like the error reproduces on Windows only and a workaround could be the following change in C:\Program Files\Python\Python312\Lib\site-packages\bempp\api\external\viewers.py

diff --git a/bempp/api/external/viewers.py b/bempp/api/external/viewers.py
index 19b7b58..27627a5 100644
--- a/bempp/api/external/viewers.py
+++ b/bempp/api/external/viewers.py
@@ -140,6 +140,10 @@ def visualize_with_gmsh(obj, mode=None, transformation=None):
     from bempp.api import export, GMSH_PATH, TMP_PATH, GridFunction
     from bempp.api.grid.grid import Grid

+    print("GMSH_PATH is", GMSH_PATH)
+
+    GMSH_PATH = GMSH_PATH + ".bat"
+
     if GMSH_PATH is None:
         print("Gmsh not available for visualization.")
         return None

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants