Skip to content

Commit

Permalink
Merge pull request #362 from MFraters/add_tranforms_faults_to_ridges
Browse files Browse the repository at this point in the history
Add tranforms faults to ridges
  • Loading branch information
MFraters authored Nov 6, 2021
2 parents 053cde8 + ca684e8 commit 788a59c
Show file tree
Hide file tree
Showing 25 changed files with 337 additions and 53 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
- Introduces a bounding box for searching the fault and the subducting plate model properties (temperature, composition, grains) in the lateral direction. This reduces the computation time by constraining the number of points for which the expensive distance_point_from_curved_planes function is called. \[Arushi Saxena; 2021-07-15; [#219](https://github.com/GeodynamicWorldBuilder/WorldBuilder/issues/219)\]
- Chaning the internal interface of the get function to add a new structure (AdditionalParameters) to hold additional parameters (total_local_segment_length and local_thickness). The local_thickness has been moved away from the PointDistanceFromCurvedPlanes structure. \[Menno Fraters; 2021-09-08; [#330](github.com/GeodynamicWorldBuilder/WorldBuilder/pull/282)\]
- Changed the name of the main branch from master to main \[Menno Fraters; 2021-10-28; [#350](https://github.com/GeodynamicWorldBuilder/WorldBuilder/pull/350)\]
- Ridge coordinates are now an array of ridges, allowing mulitple ridges within a single oceanic plate with transform faults in between. \[Menno Fraters; 2021-11-03; [#362](https://github.com/GeodynamicWorldBuilder/WorldBuilder/pull/362)\]

### Fixed
- Using slabs and faults beyond the -180 to 180 range gave issues. These are now fixed and it now works and is tested for the -380 to 380 range. \[Menno Fraters; 2021-10-22; [#338](https://github.com/GeodynamicWorldBuilder/WorldBuilder/issues/338), [#340](https://github.com/GeodynamicWorldBuilder/WorldBuilder/pull/340) and [#342](https://github.com/GeodynamicWorldBuilder/WorldBuilder/pull/342)\]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"features":
[
{"model":"oceanic plate", "name":"oceanic plate", "coordinates":[[-1e3,-1e3],[1150e3,-1e3],[1150e3,1e3],[-1e3,1e3]],
"temperature models":[{"model":"plate model", "max depth":95e3, "bottom temperature":1600, "spreading velocity":0.005, "ridge coordinates":[[100e3,-1e3],[100e3,1e3]]}],
"temperature models":[{"model":"plate model", "max depth":95e3, "bottom temperature":1600, "spreading velocity":0.005, "ridge coordinates":[[[100e3,-1e3],[100e3,1e3]]]}],
"composition models":[{"model":"uniform", "compositions":[0], "max depth":10e3},
{"model":"uniform", "compositions":[1], "min depth":10e3, "max depth":95e3}]},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"features":
[
{"model":"oceanic plate", "name":"oceanic plate", "coordinates":[[-1e3,-1e3],[1150e3,-1e3],[1150e3,1e3],[-1e3,1e3]],
"temperature models":[{"model":"plate model", "max depth":95e3, "spreading velocity":0.005, "ridge coordinates":[[100e3,-1e3],[100e3,1e3]]}],
"temperature models":[{"model":"plate model", "max depth":95e3, "spreading velocity":0.005, "ridge coordinates":[[[100e3,-1e3],[100e3,1e3]]]}],
"composition models":[{"model":"uniform", "compositions":[0], "max depth":10e3},
{"model":"uniform", "compositions":[1], "min depth":10e3, "max depth":95e3}]},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
{
"model":"plate model", "max depth":95e3, "bottom temperature":1600,
"spreading velocity":0.01,
"ridge coordinates":[[100e3,-1e3],[0e3,1e3]]
"ridge coordinates":[[[100e3,-1e3],[0e3,1e3]]]
}
],
"composition models":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"features":
[
{"model":"oceanic plate", "name":"oceanic plate", "coordinates":[[-1,-1],[11.5,-1],[11.5,1],[-1,1]],
"temperature models":[{"model":"plate model", "max depth":95e3, "bottom temperature":1600, "spreading velocity":0.005, "ridge coordinates":[[1,-1],[1,1]]}],
"temperature models":[{"model":"plate model", "max depth":95e3, "bottom temperature":1600, "spreading velocity":0.005, "ridge coordinates":[[[1,-1],[1,1]]]}],
"composition models":[{"model":"uniform", "compositions":[0], "max depth":10e3},
{"model":"uniform", "compositions":[1], "min depth":10e3, "max depth":95e3}]},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"features":
[
{"model":"oceanic plate", "name":"oceanic plate", "coordinates":[[-1,-1],[11.5,-1],[11.5,1],[-1,1]],
"temperature models":[{"model":"plate model", "max depth":95e3, "spreading velocity":0.005, "ridge coordinates":[[1,-1],[1,1]]}],
"temperature models":[{"model":"plate model", "max depth":95e3, "spreading velocity":0.005, "ridge coordinates":[[[1,-1],[1,1]]]}],
"composition models":[{"model":"uniform", "compositions":[0], "max depth":10e3},
{"model":"uniform", "compositions":[1], "min depth":10e3, "max depth":95e3}]},

Expand Down
4 changes: 2 additions & 2 deletions cookbooks/3d_cartesian_rift/3d_cartesian_rift.wb
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
"features":
[
{"model":"oceanic plate", "name":"oceanic plate A", "coordinates":[[-1e3,-1e3],[2001e3,-1e3],[2001e3,1000e3],[-1e3,1000e3]],
"temperature models":[{"model":"plate model", "max depth":95e3, "spreading velocity":0.005, "ridge coordinates":[[1200e3,-1e3],[1200e3,1000e3]]}],
"temperature models":[{"model":"plate model", "max depth":95e3, "spreading velocity":0.005, "ridge coordinates":[[[1200e3,-1e3],[1200e3,1000e3]]]}],
"composition models":[{"model":"uniform", "compositions":[0], "max depth":10e3},
{"model":"uniform", "compositions":[1], "min depth":10e3, "max depth":95e3}]},

{"model":"oceanic plate", "name":"oceanic plate B", "coordinates":[[-1e3,1000e3],[2001e3,1000e3],[2001e3,2001e3],[-1e3,2001e3]],
"temperature models":[{"model":"plate model", "max depth":95e3, "spreading velocity":0.005, "ridge coordinates":[[800e3,1000e3],[800e3,2000e3]]}],
"temperature models":[{"model":"plate model", "max depth":95e3, "spreading velocity":0.005, "ridge coordinates":[[[800e3,1000e3],[800e3,1500e3]],[[1000e3,1500e3],[1000e3,2000e3]]]}],
"composition models":[{"model":"uniform", "compositions":[0], "max depth":10e3},
{"model":"uniform", "compositions":[1], "min depth":10e3, "max depth":95e3}]}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ namespace WorldBuilder
double top_temperature;
double bottom_temperature;
double spreading_velocity;
std::vector<Point<2> > ridge_coordinates;
std::vector<std::vector<Point<2> > > mid_oceanic_ridges;
Utilities::Operations operation;

};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ namespace WorldBuilder
double top_temperature;
double bottom_temperature;
double spreading_velocity;
std::vector<Point<2> > ridge_coordinates;
std::vector<std::vector<Point<2> > > mid_oceanic_ridges;
Utilities::Operations operation;

};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ namespace WorldBuilder
double surface_temperature;
double taper_distance;
bool adiabatic_heating;
std::vector<Point<2>> ridge_coordinates;
std::vector<std::vector<Point<2>>> mid_oceanic_ridges;
Utilities::Operations operation;

};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,11 @@ namespace WorldBuilder
"The spreading velocity of the plate in meter per year. "
"This is the velocity with which one side moves away from the ridge.");

prm.declare_entry("ridge coordinates", Types::Array(Types::Point<2>(),2),
"A list of 2d points that defines the location of the ridge.");

prm.declare_entry("ridge coordinates", Types::Array(Types::Array(Types::Point<2>(), 2),1),
"An list of ridges. Each ridge is a lists of at least 2 2d points which "
"define the location of the ridge. You need to define at least one ridge."
"So the an exmple with two ridges is "
"[[[10,20],[20,30],[10,40]],[[50,10],[60,10]]].");
}

void
Expand All @@ -97,13 +99,14 @@ namespace WorldBuilder
top_temperature = prm.get<double>("top temperature");
bottom_temperature = prm.get<double>("bottom temperature");
spreading_velocity = prm.get<double>("spreading velocity")/31557600; // m/seconds
ridge_coordinates = prm.get_vector<Point<2> >("ridge coordinates");

mid_oceanic_ridges = prm.get_vector<std::vector<Point<2>>>("ridge coordinates");
const double dtr = prm.coordinate_system->natural_coordinate_system() == spherical ? const_pi / 180.0 : 1.0;
for (auto &ridge_coordinate : ridge_coordinates)
{
ridge_coordinate *= dtr;
}
for (auto &ridge_coordinates : mid_oceanic_ridges)
for (auto &ridge_coordinate : ridge_coordinates)
{
ridge_coordinate *= dtr;
}
}


Expand Down Expand Up @@ -134,12 +137,47 @@ namespace WorldBuilder

const CoordinateSystem coordinate_system = world->parameters.coordinate_system->natural_coordinate_system();

for (unsigned int i_ridge = 0; i_ridge < ridge_coordinates.size()-1; i_ridge++)

// first find if the coordinate is on this side of a ridge
unsigned int relevant_ridge = 0;
const Point<2> check_point(position_in_natural_coordinates.get_surface_coordinates(),position_in_natural_coordinates.get_coordinate_system());

// if there is only one ridge, there is no transform
if (mid_oceanic_ridges.size() > 1)
{
// There are more than one ridge, so there are transform faults
// Find the first which is on the same side
for (relevant_ridge = 0; relevant_ridge < mid_oceanic_ridges.size()-1; relevant_ridge++)
{
const Point<2> transform_point_0 = mid_oceanic_ridges[relevant_ridge+1][0];
const Point<2> transform_point_1 = mid_oceanic_ridges[relevant_ridge][mid_oceanic_ridges[relevant_ridge].size()-1];
const Point<2> reference_point = mid_oceanic_ridges[relevant_ridge][0];

const bool reference_on_side_of_line = (transform_point_1[0] - transform_point_0[0])
* (reference_point[1] - transform_point_0[1])
- (transform_point_1[1] - transform_point_0[1])
* (reference_point[0] - transform_point_0[0])
< 0;
const bool checkpoint_on_side_of_line = (transform_point_1[0] - transform_point_0[0])
* (check_point[1] - transform_point_0[1])
- (transform_point_1[1] - transform_point_0[1])
* (check_point[0] - transform_point_0[0])
< 0;


if (reference_on_side_of_line == checkpoint_on_side_of_line)
{
break;
}

}
}

for (unsigned int i_coordinate = 0; i_coordinate < mid_oceanic_ridges[relevant_ridge].size() - 1; i_coordinate++)
{
const Point<2> segment_point0 = ridge_coordinates[i_ridge];
const Point<2> segment_point1 = ridge_coordinates[i_ridge+1];
const Point<2> segment_point0 = mid_oceanic_ridges[relevant_ridge][i_coordinate];
const Point<2> segment_point1 = mid_oceanic_ridges[relevant_ridge][i_coordinate + 1];

const Point<2> check_point(position_in_natural_coordinates.get_surface_coordinates(),position_in_natural_coordinates.get_coordinate_system());
// based on http://geomalgorithms.com/a02-_lines.html
const Point<2> v = segment_point1 - segment_point0;
const Point<2> w = check_point - segment_point0;
Expand Down
62 changes: 51 additions & 11 deletions source/features/oceanic_plate_models/temperature/plate_model.cc
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,11 @@ namespace WorldBuilder
"The spreading velocity of the plate in meter per year. "
"This is the velocity with which one side moves away from the ridge.");

prm.declare_entry("ridge coordinates", Types::Array(Types::Point<2>(),2),
"A list of 2d points which define the location of the ridge.");
prm.declare_entry("ridge coordinates", Types::Array(Types::Array(Types::Point<2>(), 2),1),
"An list of ridges. Each ridge is a lists of at least 2 2d points which "
"define the location of the ridge. You need to define at least one ridge."
"So the an exmple with two ridges is "
"[[[10,20],[20,30],[10,40]],[[50,10],[60,10]]].");

}

Expand All @@ -93,13 +96,14 @@ namespace WorldBuilder
top_temperature = prm.get<double>("top temperature");
bottom_temperature = prm.get<double>("bottom temperature");
spreading_velocity = prm.get<double>("spreading velocity")/31557600;
ridge_coordinates = prm.get_vector<Point<2> >("ridge coordinates");

mid_oceanic_ridges = prm.get_vector<std::vector<Point<2>>>("ridge coordinates");
const double dtr = prm.coordinate_system->natural_coordinate_system() == spherical ? const_pi / 180.0 : 1.0;
for (auto &ridge_coordinate : ridge_coordinates)
{
ridge_coordinate *= dtr;
}
for (auto &ridge_coordinates : mid_oceanic_ridges)
for (auto &ridge_coordinate : ridge_coordinates)
{
ridge_coordinate *= dtr;
}
}


Expand Down Expand Up @@ -127,16 +131,52 @@ namespace WorldBuilder
}

const int sommation_number = 100;

double distance_ridge = std::numeric_limits<double>::max();

const CoordinateSystem coordinate_system = world->parameters.coordinate_system->natural_coordinate_system();

for (unsigned int i_ridge = 0; i_ridge < ridge_coordinates.size()-1; i_ridge++)

// first find if the coordinate is on this side of a ridge
unsigned int relevant_ridge = 0;
const Point<2> check_point(position_in_natural_coordinates.get_surface_coordinates(),position_in_natural_coordinates.get_coordinate_system());

// if there is only one ridge, there is no transform
if (mid_oceanic_ridges.size() > 1)
{
// There are more than one ridge, so there are transform faults
// Find the first which is on the same side
for (relevant_ridge = 0; relevant_ridge < mid_oceanic_ridges.size()-1; relevant_ridge++)
{
const Point<2> transform_point_0 = mid_oceanic_ridges[relevant_ridge+1][0];
const Point<2> transform_point_1 = mid_oceanic_ridges[relevant_ridge][mid_oceanic_ridges[relevant_ridge].size()-1];
const Point<2> reference_point = mid_oceanic_ridges[relevant_ridge][0];

const bool reference_on_side_of_line = (transform_point_1[0] - transform_point_0[0])
* (reference_point[1] - transform_point_0[1])
- (transform_point_1[1] - transform_point_0[1])
* (reference_point[0] - transform_point_0[0])
< 0;
const bool checkpoint_on_side_of_line = (transform_point_1[0] - transform_point_0[0])
* (check_point[1] - transform_point_0[1])
- (transform_point_1[1] - transform_point_0[1])
* (check_point[0] - transform_point_0[0])
< 0;


if (reference_on_side_of_line == checkpoint_on_side_of_line)
{
break;
}

}
}

for (unsigned int i_coordinate = 0; i_coordinate < mid_oceanic_ridges[relevant_ridge].size() - 1; i_coordinate++)
{
const Point<2> segment_point0 = ridge_coordinates[i_ridge];
const Point<2> segment_point1 = ridge_coordinates[i_ridge+1];
const Point<2> segment_point0 = mid_oceanic_ridges[relevant_ridge][i_coordinate];
const Point<2> segment_point1 = mid_oceanic_ridges[relevant_ridge][i_coordinate + 1];

const Point<2> check_point(position_in_natural_coordinates.get_surface_coordinates(),position_in_natural_coordinates.get_coordinate_system());
// based on http://geomalgorithms.com/a02-_lines.html
const Point<2> v = segment_point1 - segment_point0;
const Point<2> w = check_point - segment_point0;
Expand Down
Loading

0 comments on commit 788a59c

Please sign in to comment.