Skip to content
This repository was archived by the owner on Nov 13, 2023. It is now read-only.

Commit d48ca7c

Browse files
author
Keith Roberts
authored
dampening in Newton optmi. (#157)
* dampening in Newton optmi. * boundary projection occurs after `sliver_removal` too
1 parent 0bd3ef6 commit d48ca7c

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

README.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -511,9 +511,13 @@ Changelog
511511
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
512512
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
513513

514-
## Unreleased
514+
## Unreleased
515+
- None
516+
517+
## [3.1.5] - 2020-11-24
515518
- Support for constraining/immersing subdomains represented as signed distance functions.
516519
- Faster cell manipulation operations for ~5-10% better speedups in parallel.
520+
- Projection of points back onto level set.
517521

518522
## [3.1.4] - 2020-11-15
519523
- Laplacian smoothing at termination for 2D meshing...significantly improves minimum cell quality.

SeismicMesh/generation/mesh_generator.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ def print_msg2(msg):
170170
)
171171

172172
geps = sliver_opts["geps_mult"] * h0
173+
deps = np.sqrt(np.finfo(np.double).eps) * h0
173174
min_dh_bound = sliver_opts["min_dh_angle_bound"] * math.pi / 180
174175
max_dh_bound = sliver_opts["max_dh_angle_bound"] * math.pi / 180
175176

@@ -247,6 +248,7 @@ def print_msg2(msg):
247248
+ " iterations...no slivers detected!",
248249
)
249250
p, t, _ = geometry.fix_mesh(p, t, dim=dim, delete_unused=True)
251+
p = _improve_level_set_newton(p, t, fd, deps, deps * 1000)
250252
return p, t
251253

252254
p0, p1, p2, p3 = (
@@ -715,7 +717,8 @@ def _improve_level_set_newton(p, t, fd, deps, tol):
715717
"""Reduce level set error by using Newton's minimization method"""
716718
dim = p.shape[1]
717719
bid = geometry.get_boundary_vertices(t, dim)
718-
for _ in range(5):
720+
alpha = 1
721+
for iteration in range(5):
719722
d = fd(p[bid])
720723

721724
def _deps_vec(i):
@@ -726,7 +729,8 @@ def _deps_vec(i):
726729
dgrads = [(fd(p[bid] + _deps_vec(i)) - d) / deps for i in range(dim)]
727730
dgrad2 = sum(dgrad ** 2 for dgrad in dgrads)
728731
dgrad2 = np.where(dgrad2 < deps, deps, dgrad2)
729-
p[bid] -= (d * np.vstack(dgrads) / dgrad2).T # Project
732+
p[bid] -= alpha * (d * np.vstack(dgrads) / dgrad2).T # Project
733+
alpha /= iteration + 1
730734
return p
731735

732736

setup.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = SeismicMesh
3-
version = 3.1.4
3+
version = 3.1.5
44
url = https://github.com/krober10nd/SeismicMesh
55
author = Keith Roberts
66
email = keithrbt0@gmail.com

0 commit comments

Comments
 (0)