capytaine / capytaine

Python BEM solver for linear potential flow, based on Nemoh.
https://capytaine.github.io
GNU General Public License v3.0
162 stars 74 forks source link

Opening hydrostar mesh #27

Closed martijnwilpshaar closed 2 years ago

martijnwilpshaar commented 4 years ago

Hi,

When opening a hydrostar (.hst) mesh, it gives the following error:

File "C:\Anaconda3\lib\site-packages\capytaine\io\mesh_loaders.py", line 151, in load_HST vertices_tmp.append(list(map(float, node.split()[1:])))

AttributeError: 'numpy.ndarray' object has no attribute 'append'

I'm interested in opening this .hst mesh and see the underwater volume (which is necessary for my further calculations). This mesh has been generated by an external company so I cannot share the details unfortunately.

Could you have a look?

Many thanks!

mancellin commented 4 years ago

Yes, there seems to be an issue with the mesh loader. I'm not familiar with the HST format, so it won't be easy to fix without an example of a failing file.

@frongere Do you remember the logic behind this section of the code?

dirkpir commented 3 years ago

I am also having trouble opening a Hydrostar mesh although I get a different error message:

AssertionError: Faces of a mesh should be provided as positive integers (ids of vertices)

Replacing the following line of code in def load_HST

return Mesh(vertices, faces-1, name)

by

return Mesh(vertices, faces, name)

fixed this issue when loading the hydrostar mesh (as by taking faces-1 results in a face being represented by a negative integer -1)

However, when trying to solve the diffraction/radiation problem, the GRMS solver did not converge, and the direct linear solver resulted in an empty dataset.

I attached the hydrostar mesh (replacing the .hst extension by .txt to be able to attach it)

Ship.txt

mancellin commented 3 years ago

Indeed, the mesh reader does not seem to be able to read all possible variants of HST files. There are several issues here:

mancellin commented 3 years ago

Since I'm looking at the HST file reader: I believe @martijnwilpshaar's issue was with the support of multi-body files. It seems that the mesh reader was thought to support several blocks of vertices coordinates, but the Python code is clearly wrong. If anybody has an example of a multibody Hydrostar mesh, it would help to debug this.

dirkpir commented 3 years ago

@mancellin thanks for your very rapid response! I managed to load in the mesh by replacing panel_index by one of the vertices in the load_HST code.

I now mirrored the body to construct a mesh of the full body (ignoring symmetries). Is there any way to tell the solver that this mesh is symmetric to exploit that and speed up the computation?

mancellin commented 3 years ago

I now mirrored the body to construct a mesh of the full body (ignoring symmetries). Is there any way to tell the solver that this mesh is symmetric to exploit that and speed up the computation?

See this example from the cookbook:

https://github.com/mancellin/capytaine/blob/2d1be0434b6343808ac63ca810f9dce8a032ebd5/docs/user_manual/examples/symmetric_body.py#L19-L21

dirkpir commented 3 years ago

I now mirrored the body to construct a mesh of the full body (ignoring symmetries). Is there any way to tell the solver that this mesh is symmetric to exploit that and speed up the computation?

See this example from the cookbook:

https://github.com/mancellin/capytaine/blob/2d1be0434b6343808ac63ca810f9dce8a032ebd5/docs/user_manual/examples/symmetric_body.py#L19-L21

Thanks!

mancellin commented 2 years ago

The new HST mesh reader should provide better error messages and handle symmetries. There are still features of HST mesh files that are not implemented, so feel free to reopen the issue if you have requests or suggestions.