Skip to content

Commit 495bba2

Browse files
committed
Added the test
1 parent a25fddd commit 495bba2

File tree

5 files changed

+44
-175
lines changed

5 files changed

+44
-175
lines changed

test/Ridge_parameters_test_file.jl

Lines changed: 0 additions & 107 deletions
This file was deleted.

test/Ridge_test_file.jl

Lines changed: 0 additions & 26 deletions
This file was deleted.

test/runtests.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ using Test
7474
include("test_sea_level.jl")
7575
end
7676

77+
@testset "Ridge Thermal Structure Tests" begin
78+
include("test/test_ridge_segments.jl")
79+
end
80+
7781
@testset "Waterflow" begin
7882
include("test_WaterFlow.jl")
7983
end

test/test_geometry_segments.jl

Lines changed: 0 additions & 42 deletions
This file was deleted.

test/test_ridge_segments.jl

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
using GeophysicalModelGenerator
2+
using Test
3+
4+
@testset "Ridge Thermal Structure Tests" begin
5+
# Grid parameters
6+
nx, ny, nz = 128, 128, 57
7+
x = range(-1000, 1000, length=nx)
8+
y = range(-1000, 1000, length=ny)
9+
z = range(-660, 0, length=nz)
10+
Grid = CartData(xyz_grid(x, y, z))
11+
12+
# Phases and temperature
13+
Phases = fill(2, nx, ny, nz)
14+
Temp = fill(1350.0, nx, ny, nz)
15+
16+
# Ridge Segments
17+
segments = [
18+
((-500.0, -1000.0), (-500.0, 0.0)), # Segment 1
19+
((-250.0, 0.0), (-250.0, 200.0)), # Segment 2
20+
((-750.0, 200.0), (-750.0, 1000.0)) # Segment 3
21+
]
22+
23+
# Lithospheric phases
24+
lith = LithosphericPhases(Layers=[15 55], Phases=[1 2], Tlab=1250)
25+
add_box!(Phases, Temp, Grid; xlim=(-1000.0,0.0), ylim=(-500.0, 500.0), zlim=(-80.0, 0.0), phase = lith, T=SpreadingRateTemp(SpreadingVel=3), segments=segments)
26+
27+
# Add and save results
28+
Grid = addfield(Grid, (; Phases, Temp))
29+
#write_paraview(Grid, "Ridge_Thermal_Structure_test_2")
30+
31+
# Test verifications
32+
@test minimum(Temp) >= 0.0 # Minimum temperature
33+
@test maximum(Temp) <= 1350.0 # Maximum temperature
34+
@test all(Temp .>= 0.0) # Ensure no negative temperatures
35+
@test all(Temp .<= 1350.0) # Ensure no temperatures above max
36+
37+
# Check if phases are correctly assigned in expected regions
38+
@test Phases[1, 1, 1] == 2 # Example: Verify a point's phase
39+
@test Phases[end, end, end] == 2 # Example: Verify another point's phase
40+
end

0 commit comments

Comments
 (0)