mathLab / PyGeM

Python Geometrical Morphing
http://mathlab.github.io/PyGeM/
Other
338 stars 118 forks source link

Can't managed to modify mesh from k file #182

Closed Thmbzh closed 4 years ago

Thmbzh commented 4 years ago

Hi everyone, I have some issues to modify the mesh of my .k file. I succeed into modifying the tuto one and changing parameters, but when using my file, nothing happens. I tried to change every parameters with different values but nothing happens with the mesh. I might going wrong with the definition of my parameters but hard to know. I run a 2D axysym mesh.

Thanks in advanced Stay safe at home !

mtezzele commented 4 years ago

Dear @Thmbzh, are you able to read the coordinates of your mesh? I mean, maybe the problem is not in the deformation part, but in the parsing part.

Thmbzh commented 4 years ago

Thank you for your kick answer. I'm sorry, I'm not familiar with this kind of tools, how can I see if I can read the coordinates ? I don't think the problem is from the script itself, I used the tuto one. So it is about the mesh indeed.

mtezzele commented 4 years ago

The parse method returns the mesh points. Is this variable empty or not?

Thmbzh commented 4 years ago

This is the script I use

from pygem import FFDParameters, FFD, KHandler, VtkHandler import vtkplotter as vtkp

"params = FFDParameters()" "params.read_parameters(filename='/home/thomas/PyGeM/tests/test_datasets/parameters_test_ffd_pipe_unv_C0.prm')"

"%cat ../tests/test_datasets/parameters_test_ffd_pipe_unv_C0.prm" k_handler = KHandler() mesh_points = k_handler.parse('/home/thomas/PyGeM/TEST_PIECE/exemple_1.k')

"free_form = FFD(params, mesh_points)" "free_form.perform()" "new_mesh_points = free_form.modified_mesh_points" "k_handler.write(new_mesh_points, 'test_pipe_mod_C0.k')"

"%cat ../tests/test_datasets/parameters_test_ffd_pipe_unv_C1.prm"

params = FFDParameters() params.read_parameters(filename='/home/thomas/PyGeM/TEST_PIECE/parameters_test.prm')

free_form = FFD(params, mesh_points) free_form.perform() new_mesh_points = free_form.modified_mesh_points k_handler.write(new_mesh_points, 'test_C1.k')

mtezzele commented 4 years ago

Just check the content of the mesh_points variable, that is the result of the parse method. If it is empty then you have to modify the parse method in order to properly read your file. We tested only on one file (the one present in the tests folder). It was an external contribution so we do not have a direct experience with k files.

Thmbzh commented 4 years ago

I somehow succeed to have a deformation. It seems it didn't like to have z = 0 for 2D elements, worked with z = -1.0 I'm truly sorry if I didn't tried enough variables, didn't want to bother you with such a little thing. Thanks for your support, I'll try to give you any feedback with this type of mesh !