How to extract the boundary of a 2D mesh in linux

Hi, everyone, the command “ExtractBoundary -i [] [-o ]” of OGS can only extract the overall outer contour.But I didn’t find a command that can extract different boundary lines, how should I extract different boundaries of a 2D network? Thanks all.

Hi, if you generate yur mesh with gmsh you can mark the physical groups in your gmsh script and msh2vtu will the boundaries for you. Otherwise, the quickest solution would probably be to use the resulting contour from ExtractBoundary, load it in paraview, manually select the different boundaries, extract selection and save to corresponding vtu files.

Best regards,
Florian

Thank you for your reply. Best wishes!

Hi, I tried to make a two-dimensional grid with gmsh, and then converted it to a vtu file with the GMSH2OGS command, and extracted the boundary with paraview, but displayed an error in the terminal. What is the reason?

Best regards!

Hi, you probably need to run the tool IdentifySubdomains over the bulk mesh and the extracted boundary afterwards to have the correct mapping of the bulk_node_ids. Also check, that the bulk mesh doesn’t contain the boundary elements itself.
If you have marked the boundaries as physical groups in gmsh you can also just use msh2vtu and don’t need to extract them manually in paraview. Then you also shouldn’t need the extra IdentifySubdomains afterwards.
Best, Florian

But there doesn’t seem to be a command for msh2vtu in Linux.

It’s not a Binary from the OGS build. It’s a part of the ogstools which you can install via pip. And then you should be able to execute msh2vtu from the commandline - or you use the python interface - whatever you prefer.

Yes, I tried to install ogstools with the pip install ogstools command, but it was wrong.

Can you send your pip / python version? Please run:

pip --version

image

I also tried pip3 install ogstools, but it also showed this result.

You need to have at least Python 3.10.