Skip to content

Commit a265aa9

Browse files
committed
Fix tests
1 parent fe4e924 commit a265aa9

File tree

1 file changed

+31
-3
lines changed

1 file changed

+31
-3
lines changed

test/test_windfield.jl

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,7 @@ end
5555
grid = AtmosphericModels.create_grid()
5656
@test typeof(grid) == Tuple{Array{Float64, 3}, Array{Float64, 3}, Array{Float64, 3}}
5757

58-
x = range(0, 50, length=25)
59-
y = range(0, 800, length=400)
60-
z = range(0, 200, length=100)
58+
y, x, z = AtmosphericModels.create_grid(10, 20, 10, 5)
6159

6260
u, v, w = AtmosphericModels.create_windfield(x, y, z; sigma1=1.2)
6361
am = AtmosphericModel(set)
@@ -66,4 +64,34 @@ end
6664

6765
set_data_path(olddir)
6866
cd(olddir)
67+
end
68+
69+
y, x, z = AtmosphericModels.create_grid(10, 20, 10, 5)
70+
u, v, w = AtmosphericModels.create_windfield(x, y, z, sigma1=1.0)
71+
72+
@testset "create_windfield" begin
73+
nx, ny, nz = size(x)
74+
@test nx == 11
75+
@test ny == 6
76+
@test nz == 6
77+
# Domain lengths
78+
Lx = x[end,1,1] - x[1,1,1]
79+
Ly = y[1,end,1] - y[1,1,1]
80+
Lz = z[1,1,end] - z[1,1,1]
81+
@test Lx == 20.0
82+
@test Ly == 10.0
83+
@test Lz == 10.0
84+
@test AtmosphericModels.pfq(0.5) 1.7936563627777333
85+
@test sum(x) == 3960.0
86+
@test sum(y) == 0.0
87+
@test sum(z) == 3960.0
88+
@test all(x[1,:,:] .== 0)
89+
@test all(x[2,:,:] .== 2)
90+
@test all(x[11,:,:] .== 20)
91+
@test size(u) == (11,6,6)
92+
@test size(v) == (11,6,6)
93+
@test size(w) == (11,6,6)
94+
@test std(u) 1.0
95+
@test std(v) 0.7
96+
@test std(w) 0.5
6997
end

0 commit comments

Comments
 (0)