ec-jrc / pyPoseidon

Framework for Hydrodynamic simulations
https://pyposeidon.readthedocs.io/
European Union Public License 1.2
20 stars 8 forks source link

Fix a bug in setting the jigsaw-geo file #100

Closed brey closed 1 year ago

brey commented 2 years ago

The number of points is misrepresented when there are duplicates.

https://github.com/ec-jrc/pyPoseidon/blob/a3bff4bc890191b38bf8c255607deb06d17b7e5f/pyposeidon/mjigsaw.py#L43-L55

huyquangtranaus commented 2 years ago

Hi George @brey, it seems like there is a bug in line 543:

    gr = read_msh(calc_dir + tag + ".msh", **kwargs)

Because when I run MESH.ipynb I got an error message below:

FileNotFoundError: [Errno 2] No such file or directory: './jigsaw/jigsaw.msh'

Should ./jigsaw/jigsaw.msh' be ./jigsaw/jigsaw-geo.msh'? so:

gr = read_msh(calc_dir + tag + "-geo.msh", **kwargs)

Thank you Huy

brey commented 2 years ago

Hi @huyquangtranaus. The read_msh function is used to read the jigsaw output which, for a mesh done by pyposeidon, defaults to jigsaw.msh. The jigsaw-geo.msh is an input file with the boundary geometry.

In your case, most likely, jigsaw failed to produce an output (more info should be in the jigsaw.log or run.log files).

In fact, what you've experienced relates to #63 issue and the lack of flow management when the mesh generators fail.

huyquangtranaus commented 2 years ago

@brey great. Thanks... Indeed the run.log is empty, but inside err.log, it shows:

/bin/sh: 1: jigsaw: not found

Is there any example of jigsaw.msh you put somewhere?

I did not know you are working on this :). I will keep a eye on your development. Indeed. I used to jigsaw since it was first written in Matlab few years ago (at that time I used to contact Darren few times... He was from Australia actually)

brey commented 2 years ago

@huyquangtranaus You can check the binder instance for complete functionality.

However, you should get some meshes following https://pyposeidon.readthedocs.io/en/latest/mesh.html.

Regarding your problem, if you are trying to run from Jupyterlab you need to add the executables to the path like:

import numpy as np
cpath = np.__path__[0].split('/lib/')[0] # get the current kernel path

os.environ['PATH'] += os.pathsep + cpath + '/bin' # add to PATH

PS1. I have worked with Darren initially and recently we are considering a spin off of the mesh generation procedure, see https://github.com/oceanmodeling/seamesh.

PS2. I was born in Melbourne as well but the last time I visited was in 2016.

huyquangtranaus commented 2 years ago

Screenshot from 2022-05-20 00-24-21 @brey everything works fine when I run it in VS code. Great tool!

Nice to hear you were born in Melb. Hope to catch up with you some time soon

Thanks a lot