Skip to content

Commit

Permalink
Merge pull request #221 from FourierFlows/ncc/fix-some-bugs
Browse files Browse the repository at this point in the history
Fix some bugs
  • Loading branch information
navidcy authored Apr 6, 2021
2 parents 0aca13d + 3c02b3a commit 93d0a15
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
env:
JULIA_VERSION: "1.5.3"
JULIA_VERSION: "1.5.4"
JULIA_MINOR_VERSION: "1.5"
GKSwstype: "100" # See: https://github.com/jheinen/GR.jl/issues/278
SECRET_CODECOV_TOKEN: "Ak2mVTxXnhkPNc096ImDdp7bOc4zGNTqFEEDaGMwAgYPr28g5dyMbslh8B/ad4NQHXVL1MXQ3zrUfGgMBRq+mmqRaAe13FI4Go9uCas6bzdZXE23ExiLzBmqVRNRf8GqEcpGL7BBreohC0cnfI0SVMiIJDCJXX9YsXJtlcpk1glQFMEFI5V6cpFe9K2l5xoUNQ4179ZYoJUMAy/aylQx/UdQuw527FjHQUsi5/dFtWzMqeys0secNa9alLvJCQdIX9OqPjmBYvuIIVXCR7vlZoH8PgXwEj7wbdp8/V31+wlLQI9WePcsJxoOybtLTOlwwfw4jWLAttDZYqnqiLVp3Q==;U2FsdGVkX18sNLCManU1B/jI5kh4LhSi69MFXljHSp9yWrN7u5d196K/XrELwb8ksbamyKeHjIvDIopwD55dbw=="
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
steps:
- uses: julia-actions/setup-julia@latest
with:
version: 1.4
version: 1.5
- name: Pkg.add("CompatHelper")
run: julia -e 'using Pkg; Pkg.add("CompatHelper")'
- name: CompatHelper.main()
Expand Down
4 changes: 2 additions & 2 deletions src/multilayerqg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ function calcS!(S, Fp, Fm, nlayers, grid)
F = Matrix(Tridiagonal(Fm, -([Fp; 0] + [0; Fm]), Fp))

for n=1:grid.nl, m=1:grid.nkr
CUDA.@allowscalar = grid.Krsq[m, n]
= CUDA.@allowscalar grid.Krsq[m, n]
Skl = SMatrix{nlayers, nlayers}(-* I + F)
S[m, n] = Skl
end
Expand All @@ -468,7 +468,7 @@ function calcS⁻¹!(S⁻¹, Fp, Fm, nlayers, grid)
F = Matrix(Tridiagonal(Fm, -([Fp; 0] + [0; Fm]), Fp))

for n=1:grid.nl, m=1:grid.nkr
CUDA.@allowscalar = grid.Krsq[m, n] == 0 ? 1 : grid.Krsq[m, n]
= CUDA.@allowscalar grid.Krsq[m, n] == 0 ? 1 : grid.Krsq[m, n]
Skl = -* I + F
S⁻¹[m, n] = SMatrix{nlayers, nlayers}(I / Skl)
end
Expand Down
6 changes: 3 additions & 3 deletions src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ function lambdipole(U, R, grid::TwoDGrid{T, A}; center=(mean(grid.x), mean(grid.
q₀ = -2U * k / besselj(0, k * R) # dipole amplitude for strength U and radius R
x, y = gridpoints(grid)
xc, yc = center
r = @. sqrt( (x - xc)^2 + (y - yc)^2 )
CUDA.@allowscalar besselj1 = A([besselj(1, k * r[i, j]) for i=1:grid.nx, j=1:grid.ny])
q = @. q₀ * besselj1 * (y - yc) / r
r = @. sqrt((x - xc)^2 + (y - yc)^2)
besseljorder1 = CUDA.@allowscalar A([besselj1(k * r[i, j]) for i=1:grid.nx, j=1:grid.ny])
q = @. q₀ * besseljorder1 * (y - yc) / r
@. q = ifelse(r >= R, 0, q)

return q
Expand Down
2 changes: 1 addition & 1 deletion test/test_barotropicqgql.jl
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ function test_bqgql_stochasticforcingbudgets(dev::Device=CPU(); n=256, dt=0.01,
kf, dkf = 12.0, 2.0
ε = 0.1

CUDA.@allowscalar Kr = ArrayType(dev)([ grid.kr[i] for i=1:grid.nkr, j=1:grid.nl])
Kr = CUDA.@allowscalar ArrayType(dev)([ grid.kr[i] for i=1:grid.nkr, j=1:grid.nl])

forcing_spectrum = zeros(dev, T, (grid.nkr, grid.nl))
@. forcing_spectrum = exp(-(sqrt(grid.Krsq) - kf)^2 / (2 * dkf^2))
Expand Down

0 comments on commit 93d0a15

Please sign in to comment.