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

Force embedding into 2D space #294

Closed
michalhabera opened this issue Aug 30, 2018 · 4 comments
Closed

Force embedding into 2D space #294

michalhabera opened this issue Aug 30, 2018 · 4 comments

Comments

@michalhabera
Copy link

See FEniCS/dolfinx#159.

An option to force convert 3D mesh to 2D mesh (by stripping last component away) would be very useful.
Some users are preparing planar (2D) meshes in gmsh, which embeds into 3D. Reading 3D mesh into finite element library results in larger system matrices and suboptimal computations for tensors of rank >= 1.

@nschloe
Copy link
Owner

nschloe commented Aug 30, 2018

meshio is really just a translator. If the input mesh has a z-component that's 0 everywhere, then the output mesh will have, too. It'd be weird to mess with that. I suppose this could be fixed either in gmsh itself -- or dolfin.

@mrehor
Copy link

mrehor commented Aug 31, 2018

Well, I'm afraid that you're already messing with that a bit when reading xdmf3 mesh, see

meshio/meshio/xdmf_io.py

Lines 353 to 354 in ecd790a

if geometry_type == "XY":
points = numpy.column_stack([points, numpy.zeros(len(points))])

But this is good. Each mesh that is potentially saved as planar can be read again by meshio. I've created the pull request #298 with a small fix adding the option save_as_planar to meshio.xdmf_io.XdmfWriter.

@nschloe
Copy link
Owner

nschloe commented Sep 4, 2018

Alright now. I've looked at this issue again and found that meshio didn't properly handle 2D meshes at all. @mrehor gave a good example. The original reason for this was that some mesh formats (like VTK) don't support 2D meshes at all.

Now, I/O is handled properly (#301) for those formats that support it (like XDMF). There also is a command-line option for meshio-convert that allows pruning the z-components if it's all 0. This should hopefully satisfy your use case.

@nschloe nschloe closed this as completed Sep 4, 2018
@mrehor
Copy link

mrehor commented Sep 4, 2018

Thanks for fixing this @nschloe, works as expected.

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