gempy-project / gempy

GemPy is an open-source, Python-based 3-D structural geological modeling software, which allows the implicit (i.e. automatic) creation of complex geological models from interface and orientation data. It also offers support for stochastic modeling to address parameter and model uncertainties.
https://gempy.org
European Union Public License 1.2
986 stars 235 forks source link

How to make every subface filled like solid volume model? #945

Open SpongeGirl opened 1 month ago

SpongeGirl commented 1 month ago

Hello, i want to create model like solid volume model below, every two subfaces are filled and stacked, image and now i create a gempy model like this image

I find an example like https://docs.pyvista.org/examples/00-load/terrain-mesh#sphx-glr-examples-00-load-terrain-mesh-py, but i don't know how to apply gempy model to do this, or you can tell me some other ways to solve my problem, cause the main code has changed a lot, some old solutions in the issues doesn't work now, so i really need your help, thanks a lot.

javoha commented 1 month ago

Hi, so by default gempy creates surface meshes (what we see in your gempy 3D model) and unit IDs (per lets say rock element) for each point (xyz) of a grid (by default a regular grid, but you can pass custom grids). My question is what you need the volumes for - There are ways to voxelize the regular grid for block volumes using pyvista. But it really depends on your intentions. Cheers, Jan

SpongeGirl commented 1 month ago

Maybe i just want to know how to realise this example (https://docs.pyvista.org/examples/00-load/terrain-mesh#sphx-glr-examples-00-load-terrain-mesh-py) by using our gempy model, cause i want to extent the surface to a certain thickness.

javoha commented 1 month ago

You can exctract the surface meshes from gempy and use them in pyvista and probably make something similar like the pyvista example. It will however not fill the volume between two surfaces I think, and I guess that is what you actually want?

SpongeGirl commented 1 month ago

Yes, that is what i want. I can run through this code(https://docs.gempy.org/examples/real/mik.html) in gempy tutorials, so you can use the final geomodel for example to tell me how to exctract the surface meshes and extent the surface to a certain thickness. I will very appreciate for your help, i think others also want to know.

javoha commented 1 month ago

You can get the surface meshes from gempy using (here for multiple surfaces):

dc_vertices_transformed = [geo_data.input_transform.apply_inverse(mesh.vertices) for mesh in
                            geo_data.solutions.dc_meshes]
dc_edges = [mesh.edges for mesh in geo_data.solutions.dc_meshes]

Which can then be used in Pyvista. Those are not structured meshes though, as they are created using Dual Contouring. I am not sure how this works with the Pyvista example you linked. I am also not sure if this is the best solution to be honest but that depends on what you are trying to achieve. Gempy can give you the top and bottom of a unit, which is kind of what you try. And if you want to do volume calaculations you probably need to voxelize.