Skip to content

[BUG] Overprinted fault is corrupted when its centre and orientation lie exactly on the overprinting fault (1.12.0) #426

Backlog

Description

@workbench13

Describe the bug

A fault F2 that is displaced by another fault F1 (faults=[f1]) builds and looks right in 1.12.0, except when F2's
fault_center and its orientation constraint are placed exactly on F1's surface. Then F2's surface is folded near
F1 and its trace on the far side of F1 is offset by ~1 465 m, although F1's displacement is 300 m. Moving the centre
1 m off F1 gives the expected result (an offset of ~320 m). No error or warning is raised.

Putting only the orientation on F1 is fine; putting only fault_center on F1 gives an offset of ~545 m. Both together
give the result below.

A point exactly on F1 is consistently assigned to one side by apply_to_points (dx = -150 at y = 2000.0, the same as at
y = 1999.9), so the issue seems to be in how F2's frame or centre is restored through F1, not in the displacement
itself. In 1.8.2 the same model failed in update() (a broadcast error in evaluate_gradient on the faulted fault
frame), so we could not compare with an earlier working version.

To Reproduce

import logging, warnings
import numpy as np, pandas as pd
import LoopStructural
from LoopStructural import GeologicalModel

warnings.filterwarnings("ignore"); logging.disable(logging.CRITICAL)
t, z = (a.ravel() for a in np.meshgrid(np.arange(0.0, 4001.0, 100.0), [200.0, 700.0, 1200.0]))


def fault(name, xyz, centre, normal):
    return pd.concat([pd.DataFrame({"X": xyz[:, 0], "Y": xyz[:, 1], "Z": xyz[:, 2], "val": 0.0, "feature_name": name}),
                      pd.DataFrame({"X": [centre[0]], "Y": [centre[1]], "Z": [centre[2]], "gx": [normal[0]],
                                    "gy": [normal[1]], "gz": [normal[2]], "feature_name": [name]})], ignore_index=True)


def build(f2_centre):
    f1_xyz = np.c_[t, np.full(t.size, 2000.0), z]                 # F1: plane y = 2000
    f2_xyz = np.c_[np.full(t.size, 2000.0), t, z]                 # F2: plane x = 2000 ...
    f2_xyz = f2_xyz[f2_xyz[:, 1] >= 2300.0]                       # ... observed only north of F1
    m = GeologicalModel([0, 0, 0], [4000, 4000, 1500])
    m.data = pd.concat([fault("F1", f1_xyz, [2000, 2000, 700], [0, 1, 0]),
                        fault("F2", f2_xyz, f2_centre, [1, 0, 0])], ignore_index=True)
    kw = dict(major_axis=8000, minor_axis=1000, intermediate_axis=3000, nelements=20000, interpolatortype="FDI")
    f1 = m.create_and_add_fault("F1", 300, fault_slip_vector=[1, 0, 0], fault_center=[2000, 2000, 700], **kw)
    m.create_and_add_fault("F2", 50, fault_slip_vector=[0, 0, 1], fault_center=f2_centre, faults=[f1], **kw)
    m.update(progressbar=False)
    return m


def trace(m, y):
    x = np.arange(0.0, 4001.0, 5.0)
    g = m["F2"][0].evaluate_value(np.c_[x, np.full(x.size, y), np.full(x.size, 700.0)])
    return x[np.flatnonzero(np.sign(g[:-1]) != np.sign(g[1:]))].tolist()


print("LoopStructural", LoopStructural.__version__)
for cy in (2001.0, 2000.0):
    m = build([2000.0, cy, 700.0])
    print(f"F2 centre y={cy}: trace x at y=3000 {trace(m, 3000)}, y=2100 {trace(m, 2100)}, y=1500 {trace(m, 1500)}")

Output:

LoopStructural 1.12.0
F2 centre y=2001.0: trace x at y=3000 [1995.0], y=2100 [2005.0], y=1500 [2320.0]
F2 centre y=2000.0: trace x at y=3000 [1985.0], y=2100 [1695.0, 1705.0, 2545.0], y=1500 [3465.0]

Expected behavior

The same F2 geometry (to within a few metres) whether its centre is at y = 2000 or y = 2001, or a clear error if a
centre on an overprinting fault is not supported.

Desktop

  • macOS (arm64), Python 3.13.18, numpy 2.5.5
  • LoopStructural 1.12.0, loop-interpolation 0.3.0, loop-common 0.2.0 (from PyPI)

Additional context

This is a corner case and low priority for us. Thank you for the 1.12 fault-frame work: faults
displacing faults now build, which 1.8.2 could not.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions