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.

Hi, I’m sorry I’m not familiar with python statements, I’ve now successfully installed python 3.10 and I’ve seen statements in ogstools that use msh2vtu:

But I don’t know how to type it in the terminal, can you help me?Thank you very much!!

Best regards!

Hi, I used the command “msh2vtu -p slope slope.msh” and got a series of vtu files, but when I run it I get an error:


I guessed that there is no boundary on the region file(slope_domain.vtu), so I generated the region file using the command “GMSH2OGS -i slope.msh -o slope.vtu”, but it still reported an error:

I’m trying to figure out which file I should use.

Best regards!

Hi

I have had the same error of the negative jacobian and I changed the order of my curve loops as suggested in this link

https://discourse.opengeosys.org/t/det-j-is-negative/457/5

hope it works :grinning:
María

Thanks for your reply!! I tried to change the order of the curve loop, but got a new error.
image

And this error is reported when setting the boundary conditions, is it also because of the mesh?

Hi

Regarding the first error, I have no idea. And the second one, looks like you are not declaring one parameter right in the input file. Maybe you are using it somewhere before declaring it. Try to check the input file and that all the parameters are being declare properly.

Hope it helps
María

Thanks for the advice. Good luck!!