Skip to content

Commit 6bd359f

Browse files
committed
fix: add fault function with 0 gradient
1 parent 7d1862f commit 6bd359f

File tree

2 files changed

+18
-26
lines changed

2 files changed

+18
-26
lines changed

LoopStructural/datatypes/_point.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,8 @@ def vtk(
147147
else:
148148
norm = np.linalg.norm(vectors, axis=1)
149149
vectors[norm > 0, :] /= norm[norm > 0][:, None]
150-
norm = norm[norm > 0] / norm[norm > 0].max()
151-
vectors[norm > 0, :] *= norm[:, None]
150+
norm[norm > 0] = norm[norm > 0] / norm[norm > 0].max()
151+
vectors[norm > 0, :] *= norm[norm > 0, None]
152152
if scale_function is not None:
153153
# vectors /= np.linalg.norm(vectors, axis=1)[:, None]
154154
vectors *= scale_function(self.locations)[:, None]

LoopStructural/modelling/features/fault/_fault_function.py

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
logger = getLogger(__name__)
1010

1111

12+
def smooth_peak(x):
13+
return 0.25 * x**6 + 0.5 * x**4 - 1.75 * x**2 + 1
14+
15+
1216
class FaultProfileFunction(metaclass=ABCMeta):
1317
def __init__(self):
1418
self.lim = [-1, 1]
@@ -412,14 +416,7 @@ class BaseFault(object):
412416
# gyf.add_min(-1)
413417
# gyf.add_max(1)
414418
gyf = Ones()
415-
gzf = CubicFunction()
416-
gzf.add_cstr(-1, 0)
417-
gzf.add_cstr(1, 0)
418-
gzf.add_cstr(-0.2, 1)
419-
gzf.add_cstr(0.2, 1)
420-
gzf.add_grad(0, 0)
421-
gzf.add_min(-1)
422-
gzf.add_max(1)
419+
gzf = smooth_peak
423420
gxf = Composite(hw, fw)
424421
fault_displacement = FaultDisplacement(gx=gxf, gy=gyf, gz=gzf)
425422

@@ -441,22 +438,17 @@ class BaseFault3D(object):
441438
fw.add_cstr(-1, 0)
442439
fw.add_grad(-1, 0)
443440
fw.add_min(-1)
444-
gyf = CubicFunction()
445-
gyf.add_cstr(-1, 0)
446-
gyf.add_cstr(1, 0)
447-
gyf.add_cstr(-0.2, 1)
448-
gyf.add_cstr(0.2, 1)
449-
gyf.add_grad(0, 0)
450-
gyf.add_min(-1)
451-
gyf.add_max(1)
441+
442+
gyf = smooth_peak
443+
# CubicFunction()
444+
# gyf.add_cstr(-1, 0)
445+
# gyf.add_cstr(1, 0)
446+
# gyf.add_cstr(-0.2, 1)
447+
# gyf.add_cstr(0.2, 1)
448+
# gyf.add_grad(0, 0)
449+
# gyf.add_min(-1)
450+
# gyf.add_max(1)
452451
# gyf = Ones()
453-
gzf = CubicFunction()
454-
gzf.add_cstr(-1, 0)
455-
gzf.add_cstr(1, 0)
456-
gzf.add_cstr(-0.2, 1)
457-
gzf.add_cstr(0.2, 1)
458-
gzf.add_grad(0, 0)
459-
gzf.add_min(-1)
460-
gzf.add_max(1)
452+
gzf = smooth_peak
461453
gxf = Composite(hw, fw)
462454
fault_displacement = FaultDisplacement(gx=gxf, gy=gyf, gz=gzf)

0 commit comments

Comments
 (0)