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

How Pygmsh mesh a .*vtu file created by meshio? #229

Closed
SamTAOUM opened this issue Oct 30, 2018 · 11 comments
Closed

How Pygmsh mesh a .*vtu file created by meshio? #229

SamTAOUM opened this issue Oct 30, 2018 · 11 comments

Comments

@SamTAOUM
Copy link

SamTAOUM commented Oct 30, 2018

Hello,
I create a mesh with pygmsh that I change the coordinates of the points of mesh to my topologie of study.
I'm working to developp a FEM software on geophysics. I want to create mesh of order 2 or 3 for FEM.
The problem that I can't mesh it directly on order 2 by using " generate_mesh(geom, extra_gmsh_arguments=["-order", "2"])", cause the coordinates of points will be changed and than I lost the form of tetra10 in my mesh.
In GMSH, we can save than open a .msh file than mesh it into order 2. I'm looking to do the same in pygmsh using meshio. So my code:

_ first mesh

points, cells, ...= pygmsh.generate_mesh(geom, extra_gmsh_arguments=["-order", "1"])

_change coordinates of points (points--->newpoints)

_write vtu file with meshio

meshio.write_points_cells("mymesh.vtu",newpoints,cells,cell_data=cell_data)

how can I generate mesh to mymesh.vtu using pygmsh?

points, cells, ...= pygmsh.generate_mesh("mymesh.vtu", extra_gmsh_arguments=["-order", "2"])

??

my_work

@nschloe
Copy link
Owner

nschloe commented Oct 31, 2018

cause the coordinates of points will be changed and than I lost the form of tetra10 in my mesh.

I don't understand what that means.

how can I generate mesh to mymesh.vtu using pygmsh?

What's the problem? You already described how to do it.

@SamTAOUM
Copy link
Author

SamTAOUM commented Nov 5, 2018

Hello

points, cells, ...= pygmsh.generate_mesh("mymesh.vtu", extra_gmsh_arguments=["-order", "2"])

doesn't work. AttributeError: 'str' object has no attribute 'get_code'

@nschloe
Copy link
Owner

nschloe commented Nov 5, 2018

Well you need to provide a geometry, right?

@SamTAOUM
Copy link
Author

SamTAOUM commented Nov 5, 2018

yes exactly

@nschloe
Copy link
Owner

nschloe commented Nov 5, 2018

Yeah so why don't you do it? You're using generate_mesh wrong.

@SamTAOUM
Copy link
Author

SamTAOUM commented Nov 5, 2018

I tried:

geom_1 = pygmsh.built_in.Geometry()
geom_1.add_raw_code( "mymesh.vtu")
points, cells, point_data, cell_data, field_data = pygmsh.generate_mesh(geom_1, extra_gmsh_arguments=["-order", "2"])

but doesn't work

@nschloe
Copy link
Owner

nschloe commented Nov 5, 2018

This

geom_1.add_raw_code( "mymesh.vtu")

doesn't make any sense at all. "mymesh.vtu" is not a valid gmsh command. I don't understand what you're trying to do.

@SamTAOUM
Copy link
Author

SamTAOUM commented Nov 5, 2018

I'm trying to do like Gmsh, by opening a .*msh file to mesh it again on order 2.
I used here meshio to write "mymesh.vtu"
I want to open and read the file "mymesh.vtu" to mesh it again with generate_mesh

@SamTAOUM
Copy link
Author

SamTAOUM commented Nov 5, 2018

hope, I explained clearly the problem

@nschloe
Copy link
Owner

nschloe commented Nov 5, 2018

by opening a .*msh file to mesh it again on order 2.

pygmsh cannot read meshes. You can only create a geometry and mesh that.

@SamTAOUM
Copy link
Author

SamTAOUM commented Nov 5, 2018

Okay, thank you for your explaination.
I'll try another solution to mesh my topologie of study on order 2 and 3.

@nschloe nschloe closed this as completed Nov 5, 2018
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

2 participants