Skip to content

Commit 295b8b3

Browse files
authored
Merge pull request #188 from JuliaGeodynamics/pa-tests
Fix tests and warning
2 parents 11e3e07 + 8e62339 commit 295b8b3

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/Setup_geometry.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -265,17 +265,17 @@ function add_box!(
265265
ylim = (minimum(Y), maximum(Y))
266266
end
267267

268-
if Origin == nothing
269-
Origin = (xlim[1], ylim[1], zlim[2]) # upper-left corner
270-
end
271-
272268
if Origin !== nothing && isa(T, McKenzie_subducting_slab)
273269
@warn "McKenzie temperature does not require the definition of 'Origin' field; if Origin is defined it must be equal to [xmin,ymin,zmax] of the box that has been defined."
274270
if Origin[1] != xlim[1] || Origin[2] != ylim[1] || Origin[3] != zlim[2]
275271
@error "Origin is not set up correctly. For fixing the problem Origin can be left blank or Origin = [xmin,ymin,zmax] of the box"
276272
end
277273
end
278274

275+
if Origin == nothing
276+
Origin = (xlim[1], ylim[1], zlim[2]) # upper-left corner
277+
end
278+
279279
# Perform rotation of 3D coordinates:
280280
Xrot = X .- Origin[1]
281281
Yrot = Y .- Origin[2]

test/test_setup_geometry.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ add_box!(
9797
DipAngle = 0.0, T = LithosphericTemp(nz = 201)
9898
)
9999

100-
@test sum(Temp[Int64(nel / 2), Int64(nel / 2), :]) 36131.638045729735
100+
@test sum(Temp[Int64(nel / 2), Int64(nel / 2), :]) 36141.716490778184
101101

102102
# 2) inclined lithosphere; UpperCrust,LowerCrust,Mantle
103103
Temp = zeros(Float64, Grid.N...);
@@ -109,7 +109,7 @@ add_box!(
109109
DipAngle = 30.0, T = LithosphericTemp(nz = 201)
110110
)
111111

112-
@test sum(Temp[Int64(nel / 2), Int64(nel / 2), :]) 41912.18172533137
112+
@test sum(Temp[Int64(nel / 2), Int64(nel / 2), :]) 41890.41004596295
113113

114114
# 3) inclined lithosphere with respect to the default origin; UpperCrust,LowerCrust,Mantle
115115
Temp = zeros(Float64, Grid.N...);
@@ -121,7 +121,7 @@ add_box!(
121121
DipAngle = 30.0, T = LithosphericTemp(nz = 201)
122122
)
123123

124-
@test sum(Temp[Int64(nel / 2), Int64(nel / 2), :]) 41316.11499878003
124+
@test sum(Temp[Int64(nel / 2), Int64(nel / 2), :]) 41308.02652464832
125125

126126
# 4) inclined lithosphere with only two layers
127127
Temp = zeros(Float64, Grid.N...);
@@ -161,7 +161,7 @@ add_box!(
161161
DipAngle = 30.0, T = LithosphericTemp(rheology = rheology, nz = 201)
162162
)
163163

164-
@test sum(Temp[Int64(nel / 2), Int64(nel / 2), :]) 40513.969831615716
164+
@test sum(Temp[Int64(nel / 2), Int64(nel / 2), :]) 40506.25905747755
165165

166166
# 5) using flux lower boundary conditions
167167
Temp = zeros(Float64, Grid.N...);
@@ -173,7 +173,7 @@ add_box!(
173173
DipAngle = 30.0, T = LithosphericTemp(lbound = "flux", nz = 201)
174174
)
175175

176-
@test sum(Temp[Int64(nel / 2), Int64(nel / 2), :]) 37359.648604722104
176+
@test sum(Temp[Int64(nel / 2), Int64(nel / 2), :]) 37343.81717155344
177177

178178

179179
# Test the McKenzie thermal structure

0 commit comments

Comments
 (0)