Skip to content

Pytorch operation fails for surfaces with only one contact. #1086

@benk-mira

Description

@benk-mira

Describe the bug

When I use the pytorch backend in release 2025.2.1a2, gempy fails if a surface is only constrained by one contact point. Here is the traceback:

Image Image

To Reproduce

import gempy as gp
import numpy as np

geo_model = gp.create_geomodel(
    project_name='Model1',
    extent=[0, 780, -200, 200, -582, 0],
    resolution=(50, 50, 50),
    # refinement=4, # We will use octrees
    structural_frame=gp.data.StructuralFrame.initialize_default_structure()
)

gp.add_surface_points(
    geo_model=geo_model,
    x=[225],
    y=[0],
    z=[-95],
    elements_names=['surface1']
)
gp.add_orientations(
    geo_model=geo_model,
    x=[350],
    y=[0],
    z=[-120],
    elements_names=['surface1'],
    pole_vector=[np.array([0, 0, 1])]
)
element = gp.data.StructuralElement(
    name='surface2',
    color='#FFA833',  # color=next(geo_model.structural_frame.color_generator),
    surface_points=gp.data.SurfacePointsTable.from_arrays(
        x=np.array([460]),
        y=np.array([0]),
        z=np.array([-280]),
        names='surface2'
    ),
    orientations=gp.data.OrientationsTable.initialize_empty()
)

geo_model.structural_frame.structural_groups[0].append_element(element)

gp.compute_model(geo_model, engine_config=gp.data.GemPyEngineConfig(backend=gp.data.AvailableBackends.PYTORCH, use_gpu=False))

Expected behavior

I expect that as long as another layer has two surface points, as in the example I provided, the interpolation should be well defined and result in no errors. This is documented on the website:

Image

Desktop (please complete the following information):

I'm on windows using:
gempy:

Image

gempy-engine:

Image

Additional context

There is no issue if I set the backend to 'numpy'.

Metadata

Metadata

Assignees

Labels

buggempy enginehttps://github.com/gempy-project/gempy_engine

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions