Skip to content

Commit

Permalink
Merge pull request #523 from MFraters/fix_bezier_curve_endpoint_overr…
Browse files Browse the repository at this point in the history
…each

Only limit the Bezier curve closest point at the end of the whole curve
  • Loading branch information
MFraters authored Jan 25, 2024
2 parents c3188ad + 0580460 commit 40655ff
Show file tree
Hide file tree
Showing 13 changed files with 169 additions and 50 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,13 @@ Add new entries a the bottom of the current list in the subheading. Item format:
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Added

### Changed

### Fixed
- Fixed an issue where the ridge feature in spherical geometries for both the half space cooling and plate cooling models gave a discontinuous spreading center when crossing longitudes at intervals of 90 degrees. \[Daniel Douglas; 2024-01-22; [#520](github.com/GeodynamicWorldBuilder/WorldBuilder/pull/520),[#518](github.com/GeodynamicWorldBuilder/WorldBuilder/issues/518)\]
- In some cases the bezier curve closest_point_on_curve_segment function would include a half circle around the end point(s) as part of a slab/fault. \[Menno Fraters, reported by Daniel Douglas;2023-12-07; [#522](https://github.com/GeodynamicWorldBuilder/WorldBuilder/issues/522) and [#523](https://github.com/GeodynamicWorldBuilder/WorldBuilder/pull/523)\]

## [0.5.0]
### Added
Expand Down
4 changes: 2 additions & 2 deletions source/world_builder/objects/bezier_curve.cc
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ namespace WorldBuilder
const double min_squared_distance_temp = (est_min_cp_end_0*est_min_cp_end_0)+(est_min_cp_end_1*est_min_cp_end_1);
if (min_squared_distance_temp < min_squared_distance)
{
if (est >= -1e-8 && est-1. <= 1e-8)
if (est >= -1e-8 && cp_i+est > 0 && est-1. <= 1e-8 && est-1. < cp_i)
{
min_squared_distance = min_squared_distance_temp;
const Point<2> point_on_curve = Point<2>(a_0*est*est*est+b_0*est*est+c_0*est+d_0,a_1*est*est*est+b_1*est*est+c_1*est+d_1,cp.get_coordinate_system());
Expand Down Expand Up @@ -490,7 +490,7 @@ namespace WorldBuilder

if (min_squared_distance_cartesian_temp < min_squared_distance)
{
if (est >= -1e-8 && est-1. <= 1e-8)
if (est >= -1e-8 && cp_i+est > 0 && est-1. <= 1e-8 && est-1. < cp_i)
{
min_squared_distance = min_squared_distance_cartesian_temp;
const Point<2> point_on_curve = a*est*est*est+b*est*est+c*est+d;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# x y z d g T
0 0 200000 0e3 600
0 0 200000 0e3 1600
50e3 50e3 200000 0e3 600
125e3 75e3 200000 0e3 600
-42000 8000 120000 80e3 1636.24
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# x y z d g T
0 0 200000 0e3 600
0 0 200000 0e3 1600
50e3 50e3 200000 0e3 600
125e3 75e3 200000 0e3 600
-42000 8000 120000 80e3 1635.55
Expand All @@ -11,7 +11,7 @@
0 100000 120000 80e3 600
20000 100000 120000 80e3 600
-10000 100000 120000 80e3 600
-100000 100000 120000 80e3 600
-100000 100000 120000 80e3 1635.55
-76000 75000 50000 150e3 1667.3
-50000 75000 50000 150e3 1667.3
0 75000 50000 150e3 1667.3
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# x y z d g T
0 0 200000 0e3 600
0 0 200000 0e3 1600
50e3 50e3 200000 0e3 600
50e3 50e3 200000 10e3 600
125e3 75e3 200000 0e3 600
Expand Down
18 changes: 18 additions & 0 deletions tests/gwb-grid/fault_edge_limits.grid
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# output variables
grid_type = cartesian
dim = 3
compositions = 4
vtu_output_format = ASCII

# domain of the grid
x_min = 5e3
x_max = 5.75e3
y_min = 2e3
y_max = 3e3
z_min = 0e3
z_max = 1.5e3

# grid properties
n_cell_x = 50
n_cell_y = 50
n_cell_z = 50
45 changes: 45 additions & 0 deletions tests/gwb-grid/fault_edge_limits.vtu

Large diffs are not rendered by default.

51 changes: 51 additions & 0 deletions tests/gwb-grid/fault_edge_limits.wb
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"version":"0.6",
"features":
[

{"model":"continental plate","name":"quaternary","max depth":5e3,
"coordinates":[[0,0],[8e3,0],[8e3,5e3],[0,5e3]],
"temperature models":[{"model":"uniform","temperature":273}],
"composition models": [
{"model":"uniform","max depth":5e3,"compositions":[2]}]},

{"model":"continental plate","name":"bedrock","max depth":5e3,
"coordinates":[[8e3,0],[10e3,0],[10e3,5e3],[8e3,5e3]],
"temperature models":[{"model":"uniform","temperature":273}],
"composition models": [
{"model":"uniform","max depth":5e3,"compositions":[3]}]},

// {"model":"fault","name":"Strand_1","dip point":[-1000e6,25e2],
// "coordinates":[
//[5700, 2200],
//[5800, 2400]
//],
// "segments":
// [
// {"length":5.7e3,"thickness":[50],"angle":[60]}
// ],
// "temperature models":[{"model":"uniform","temperature":273}],
// "composition models":
// [
// {"model":"uniform","compositions":[0]}
// ]
// }
// ,
{"model":"subducting plate","name":"Strand_2","dip point":[-1000e6,25e2],
"coordinates":[
[5700, 2600],
[5600, 2800]
],
"segments":
[
{"length":5.7e3,"thickness":[50],"angle":[60]}
],
"temperature models":[{"model":"uniform","temperature":273}],

"composition models":
[
{"model":"uniform","compositions":[0]}
]
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Test

[0] = 1600
[1] = 1701.66
[2] = 1798.06
[2] = 1706.43
[3] = 0
[4] = 0
[5] = 0
Expand Down Expand Up @@ -103,7 +103,7 @@ Test
[99] = 0.75
[100] = 293.15
[101] = 1701.66
[102] = 100
[102] = 1706.43
[103] = 0
[104] = 0
[105] = 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,25 +87,25 @@ TITLE
[83] = 10
[84] = 10
[85] = 10
[86] = 0
[87] = 0
[86] = 1
[87] = 1
[88] = 1
[89] = 0
[90] = 0
[91] = 0
[92] = 0
[93] = 0
[94] = 10
[93] = nan
[94] = nan
[95] = 10
[96] = 1
[97] = 28.2843
[98] = 1
[96] = 0
[97] = inf
[98] = 0
[99] = 0
[100] = 1
[101] = 0.0707107
[102] = 20
[103] = 20
[104] = 10
[100] = 0
[101] = 0
[102] = 0
[103] = nan
[104] = nan
[105] = 10
[106] = 1
[107] = 1
Expand All @@ -121,8 +121,8 @@ TITLE
[117] = 0
[118] = 1
[119] = 0
[120] = 0
[121] = 10
[120] = nan
[121] = nan
[122] = 10
[123] = 1
[124] = 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,8 @@ TITLE
[266] = 0
[267] = 1
[268] = 1
[269] = 1
[270] = 0
[269] = 0
[270] = 1
[271] = 0
[272] = 0
[273] = 0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
TITLE


[0] = 0
[1] = 0
[0] = 1
[1] = 1
[2] = 1
[3] = 0
[4] = 0
[5] = 1
[6] = 1
[7] = 1
[8] = 1
[6] = 0
[7] = 0
[8] = 0
[9] = 0
[10] = 0
[11] = 1
Expand All @@ -19,10 +19,10 @@ TITLE
[15] = 0
[16] = 0
[17] = 1
[18] = 7.36439
[19] = 0.985461
[18] = inf
[19] = inf
[20] = 0
[21] = 0
[22] = 0
[23] = 0.0696826
[23] = 0

Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,42 @@ TITLE


[0] = 6.371e+06
[1] = 0
[2] = 0
[3] = 0
[1] = 1600
[2] = 1600
[3] = 1692.16
[4] = 1696.9
[5] = 1600
[6] = 1622.56
[7] = 0
[8] = 0
[7] = 1633.96
[8] = 1716.01
[9] = 1728.07
[10] = 1600
[11] = 1643.13
[12] = 1645.43
[13] = 0
[14] = 0
[13] = 1740.21
[14] = 1742.64
[15] = 1600
[16] = 1600
[17] = 0
[18] = 0
[17] = 1692.16
[18] = 1694.53
[19] = 1876.87
[20] = 0
[21] = 0
[22] = 0
[20] = 1600
[21] = 1600
[22] = 1692.16
[23] = 1696.9
[24] = 1600
[25] = 1622.56
[26] = 0
[27] = 0
[26] = 1633.96
[27] = 1716.01
[28] = 1728.07
[29] = 1600
[30] = 1668.63
[31] = 1680.35
[32] = 0
[33] = 0
[32] = 1779.63
[33] = 1782.12
[34] = 1600
[35] = 1764.74
[36] = 1767.21
[37] = 0
[38] = 0
[37] = 1874.24
[38] = 1876.87

0 comments on commit 40655ff

Please sign in to comment.