-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #154 from adbayonao/Andres_Bayona_2
New function for generating tectonic plates with custom geometries and constant depth
- Loading branch information
Showing
3 changed files
with
139 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
using GeophysicalModelGenerator | ||
using Test | ||
|
||
@testset "Plate Tests" begin | ||
# Grid parameters | ||
nx, ny, nz = 512, 512, 128 | ||
x = range(-1000, 0, length=nx) | ||
y = range(-1000, 1000, length=ny) | ||
z = range(-660, 0, length=nz) | ||
Grid = CartData(xyz_grid(x, y, z)) | ||
|
||
# Phases and temperature | ||
Phases = fill(2, nx, ny, nz) | ||
Temp = fill(1350.0, nx, ny, nz) | ||
|
||
# Ridge Segments | ||
segments = [ | ||
((-500.0, -1000.0), (-500.0, 0.0)), # Segment 1 | ||
((-250.0, 0.0), (-250.0, 200.0)), # Segment 2 | ||
((-750.0, 200.0), (-750.0, 1000.0)) # Segment 3 | ||
] | ||
|
||
# Lithospheric phases | ||
lith = LithosphericPhases(Layers=[15 55], Phases=[1 2], Tlab=1250) | ||
|
||
# Replace add_box with add_polygon_xy to allow for arbitrary-shaped ridges | ||
add_plate!(Phases, Temp, Grid; | ||
xlim=(-1000.0, -750.0, -250.0, 0.0, -250.0, -750.0), | ||
ylim=(0.0, 500.0, 500.0, 0.0, -500.0, -500.0), | ||
zlim=(-150.0, 0.0), | ||
phase=lith, | ||
T=SpreadingRateTemp(SpreadingVel=3), | ||
segments=segments) | ||
|
||
# Add and save results | ||
Grid = addfield(Grid, (; Phases, Temp)) | ||
write_paraview(Grid, "Plate") | ||
|
||
@test minimum(Temp) >= 0.0 # Minimum temperature | ||
@test maximum(Temp) <= 1350.0 # Maximum temperature | ||
@test all(≥(0), Temp) # Ensure no negative temperatures | ||
@test all(≤(1350), Temp) # Ensure no temperatures above max | ||
|
||
# Check if phases are correctly assigned in expected regions | ||
@test first(Phases) == 2 # Example: Verify a point's phase | ||
@test last(Phases) == 2 # Example: Verify another point's phase. | ||
end |
0e47fee
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register
0e47fee
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Registration pull request created: JuliaRegistries/General/125490
Tip: Release Notes
Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.
To add them here just re-invoke and the PR will be updated.
Tagging
After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.
This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via: