Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/Setup_geometry.jl
Original file line number Diff line number Diff line change
Expand Up @@ -265,17 +265,17 @@ function add_box!(
ylim = (minimum(Y), maximum(Y))
end

if Origin == nothing
Origin = (xlim[1], ylim[1], zlim[2]) # upper-left corner
end

if Origin !== nothing && isa(T, McKenzie_subducting_slab)
@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."
if Origin[1] != xlim[1] || Origin[2] != ylim[1] || Origin[3] != zlim[2]
@error "Origin is not set up correctly. For fixing the problem Origin can be left blank or Origin = [xmin,ymin,zmax] of the box"
end
end

if Origin == nothing
Origin = (xlim[1], ylim[1], zlim[2]) # upper-left corner
end

# Perform rotation of 3D coordinates:
Xrot = X .- Origin[1]
Yrot = Y .- Origin[2]
Expand Down
10 changes: 5 additions & 5 deletions test/test_setup_geometry.jl
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ add_box!(
DipAngle = 0.0, T = LithosphericTemp(nz = 201)
)

@test sum(Temp[Int64(nel / 2), Int64(nel / 2), :]) ≈ 36131.638045729735
@test sum(Temp[Int64(nel / 2), Int64(nel / 2), :]) ≈ 36141.716490778184

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

@test sum(Temp[Int64(nel / 2), Int64(nel / 2), :]) ≈ 41912.18172533137
@test sum(Temp[Int64(nel / 2), Int64(nel / 2), :]) ≈ 41890.41004596295

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

@test sum(Temp[Int64(nel / 2), Int64(nel / 2), :]) ≈ 41316.11499878003
@test sum(Temp[Int64(nel / 2), Int64(nel / 2), :]) ≈ 41308.02652464832

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

@test sum(Temp[Int64(nel / 2), Int64(nel / 2), :]) ≈ 40513.969831615716
@test sum(Temp[Int64(nel / 2), Int64(nel / 2), :]) ≈ 40506.25905747755

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

@test sum(Temp[Int64(nel / 2), Int64(nel / 2), :]) ≈ 37359.648604722104
@test sum(Temp[Int64(nel / 2), Int64(nel / 2), :]) ≈ 37343.81717155344


# Test the McKenzie thermal structure
Expand Down
Loading