Skip to content

Commit

Permalink
Merge 9276b42 into b9621db
Browse files Browse the repository at this point in the history
  • Loading branch information
navidcy committed Sep 19, 2019
2 parents b9621db + 9276b42 commit 0f5e8ed
Show file tree
Hide file tree
Showing 11 changed files with 283 additions and 191 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Expand Up @@ -13,8 +13,8 @@ matrix:
- julia: nightly

after_success:
- julia --project -e 'using Pkg; Pkg.add("Coverage"); Pkg.dir("GeophysicalFlows"); using Coverage; Coveralls.submit(Coveralls.process_folder())'
- julia --project -e 'using Pkg; Pkg.add("Coverage"); Pkg.dir("GeophysicalFlows"); using Coverage; Codecov.submit(Codecov.process_folder())'
- julia --project -e 'using Pkg; Pkg.add("Coverage"); import GeophysicalFlows; joinpath(dirname(pathof(GeophysicalFlows)), ".."); using Coverage; Coveralls.submit(Coveralls.process_folder());'
- julia --project -e 'using Pkg; Pkg.add("Coverage"); import GeophysicalFlows; joinpath(dirname(pathof(GeophysicalFlows)), ".."); using Coverage; Codecov.submit(Codecov.process_folder())'

jobs:
include:
Expand Down
93 changes: 82 additions & 11 deletions Manifest.toml
Expand Up @@ -6,6 +6,12 @@ git-tree-sha1 = "380e36c66edfa099cd90116b24c1ce8cafccac40"
uuid = "621f4979-c628-5d54-868e-fcf4e3e8185c"
version = "0.4.1"

[[Adapt]]
deps = ["LinearAlgebra"]
git-tree-sha1 = "82dab828020b872fa9efd3abec1152b075bc7cbf"
uuid = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
version = "1.0.0"

[[AxisAlgorithms]]
deps = ["LinearAlgebra", "Random", "SparseArrays", "WoodburyMatrices"]
git-tree-sha1 = "a4d07a1c313392a77042855df46c5f534076fab9"
Expand All @@ -27,12 +33,35 @@ git-tree-sha1 = "c7361ce8a2129f20b0e05a89f7070820cfed6648"
uuid = "b99e7846-7c00-51b0-8f62-c81ae34c0232"
version = "0.5.6"

[[CEnum]]
git-tree-sha1 = "62847acab40e6855a9b5905ccb99c2b5cf6b3ebb"
uuid = "fa961155-64e5-5f13-b03f-caf6b980ea82"
version = "0.2.0"

[[CSTParser]]
deps = ["Tokenize"]
git-tree-sha1 = "c69698c3d4a7255bc1b4bc2afc09f59db910243b"
uuid = "00ebfdb7-1f24-5e51-bd34-a7502290713f"
version = "0.6.2"

[[CUDAapi]]
deps = ["Libdl", "Logging"]
git-tree-sha1 = "9b2b4b71d6b7f946c9689bb4dea03ff92e3c7091"
uuid = "3895d2a7-ec45-59b8-82bb-cfc6a382f9b3"
version = "1.1.0"

[[CUDAdrv]]
deps = ["CUDAapi", "Libdl", "Printf"]
git-tree-sha1 = "9ce99b5732c70e06ed97c042187baed876fb1698"
uuid = "c5f51814-7f29-56b8-a69c-e4d8f6be1fde"
version = "3.1.0"

[[CUDAnative]]
deps = ["Adapt", "CUDAapi", "CUDAdrv", "DataStructures", "InteractiveUtils", "LLVM", "Libdl", "Logging", "Printf", "TimerOutputs"]
git-tree-sha1 = "52ae1ce10ebfa686e227655c47b19add89308623"
uuid = "be33ccc6-a3ff-5ff2-a52e-74243cff1e17"
version = "2.3.1"

[[CodecZlib]]
deps = ["BinaryProvider", "Libdl", "TranscodingStreams"]
git-tree-sha1 = "05916673a2627dd91b4969ff8ba6941bc85a960e"
Expand Down Expand Up @@ -69,6 +98,18 @@ git-tree-sha1 = "f9780daf3fea51ad2d7b7ed4f480ac34ab36587f"
uuid = "a2441757-f6aa-5fb2-8edb-039e3f45d037"
version = "0.9.2"

[[Crayons]]
deps = ["Test"]
git-tree-sha1 = "f621b8ef51fd2004c7cf157ea47f027fdeac5523"
uuid = "a8cc5b0e-0ffa-5ad4-8c14-923d3ee1735f"
version = "4.0.0"

[[CuArrays]]
deps = ["AbstractFFTs", "Adapt", "CUDAapi", "CUDAdrv", "CUDAnative", "GPUArrays", "LinearAlgebra", "MacroTools", "NNlib", "Printf", "Random", "Requires", "SparseArrays", "TimerOutputs"]
git-tree-sha1 = "46b48742a84bb839e74215b7e468a4a1c6ba30f9"
uuid = "3a865a2d-5b23-5a0f-bc46-62713ec82fae"
version = "1.2.1"

[[DataStructures]]
deps = ["InteractiveUtils", "OrderedCollections"]
git-tree-sha1 = "0809951a1774dc724da22d26e4289bbaab77809a"
Expand All @@ -88,33 +129,45 @@ deps = ["Random", "Serialization", "Sockets"]
uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b"

[[FFTW]]
deps = ["AbstractFFTs", "BinaryProvider", "Compat", "Conda", "Libdl", "LinearAlgebra", "Reexport", "Test"]
git-tree-sha1 = "29cda58afbf62f35b1a094882ad6c745a47b2eaa"
deps = ["AbstractFFTs", "BinaryProvider", "Conda", "Libdl", "LinearAlgebra", "Reexport", "Test"]
git-tree-sha1 = "e1a479d3c972f20c9a70563eec740bbfc786f515"
uuid = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341"
version = "0.2.4"
version = "0.3.0"

[[FileIO]]
deps = ["Pkg"]
git-tree-sha1 = "351f001a78aa1b7ad2696e386e110b5abd071c71"
uuid = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549"
version = "1.0.7"

[[FillArrays]]
deps = ["LinearAlgebra", "Random", "SparseArrays"]
git-tree-sha1 = "8fba6ddaf66b45dec830233cea0aae43eb1261ad"
uuid = "1a297f60-69ca-5386-bcde-b61e274b549b"
version = "0.6.4"

[[FixedPointNumbers]]
git-tree-sha1 = "d14a6fa5890ea3a7e5dcab6811114f132fec2b4b"
uuid = "53c48c17-4a7d-5ca2-90c5-79b7896eea93"
version = "0.6.1"

[[FourierFlows]]
deps = ["Coverage", "FFTW", "Interpolations", "JLD2", "LinearAlgebra", "Printf", "Random", "Reexport", "Requires", "Statistics"]
git-tree-sha1 = "e430df633d39e02e772856e6cb745b99b069de19"
deps = ["CUDAapi", "Coverage", "CuArrays", "FFTW", "Interpolations", "JLD2", "LinearAlgebra", "Printf", "Random", "Reexport", "Requires", "Statistics"]
git-tree-sha1 = "153b295514c016e30b300b9e65b0615061976166"
uuid = "2aec4490-903f-5c70-9b11-9bed06a700e1"
version = "0.3.1"
version = "0.3.2"

[[GPUArrays]]
deps = ["Adapt", "FFTW", "FillArrays", "LinearAlgebra", "Printf", "Random", "Serialization", "StaticArrays", "Test"]
git-tree-sha1 = "b5009ac44b141ded5e6f04c4db83807970f56e91"
uuid = "0c68f7d7-f131-5f86-a1c3-88cf8149b2d7"
version = "1.0.2"

[[HTTP]]
deps = ["Base64", "Dates", "IniFile", "MbedTLS", "Sockets"]
git-tree-sha1 = "c4a527dba1d26add0e85946e1a53f42a1b343acc"
git-tree-sha1 = "f1e1b417a34cf73a70cbed919915bf8f8bad1806"
uuid = "cd3eb016-35fb-5094-929b-558a96fad6f3"
version = "0.8.5"
version = "0.8.6"

[[IniFile]]
deps = ["Test"]
Expand Down Expand Up @@ -144,6 +197,12 @@ git-tree-sha1 = "b34d7cef7b337321e97d22242c3c2b91f476748e"
uuid = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
version = "0.21.0"

[[LLVM]]
deps = ["CEnum", "Libdl", "Printf", "Unicode"]
git-tree-sha1 = "4a05f742837779a00bd8c9a18da6817367c4245d"
uuid = "929cbde3-209d-540e-8aea-75f648917ca0"
version = "1.3.0"

[[LaTeXStrings]]
deps = ["Compat"]
git-tree-sha1 = "7ab9b8788cfab2bdde22adf9004bda7ad9954b6c"
Expand Down Expand Up @@ -182,6 +241,12 @@ version = "0.7.0"
[[Mmap]]
uuid = "a63ad114-7e13-5084-954f-fe012c677804"

[[NNlib]]
deps = ["Libdl", "LinearAlgebra", "Requires", "Statistics", "TimerOutputs"]
git-tree-sha1 = "0c667371391fc6bb31f7f12f96a56a17098b3de8"
uuid = "872c559c-99b0-510c-b3b7-b6c96a88d5cd"
version = "0.6.0"

[[OffsetArrays]]
git-tree-sha1 = "1af2f79c7eaac3e019a0de41ef63335ff26a0a57"
uuid = "6fe1bfb0-de20-5000-8ca7-80f57d26f881"
Expand Down Expand Up @@ -263,10 +328,10 @@ deps = ["LinearAlgebra", "Random"]
uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"

[[SpecialFunctions]]
deps = ["BinDeps", "BinaryProvider", "Libdl", "Test"]
git-tree-sha1 = "0b45dc2e45ed77f445617b99ff2adf0f5b0f23ea"
deps = ["BinDeps", "BinaryProvider", "Libdl"]
git-tree-sha1 = "3bdd374b6fd78faf0119b8c5d538788dbf910c6e"
uuid = "276daf66-3868-5448-9aa4-cd146d93841b"
version = "0.7.2"
version = "0.8.0"

[[StaticArrays]]
deps = ["LinearAlgebra", "Random", "Statistics"]
Expand All @@ -282,6 +347,12 @@ uuid = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
deps = ["Distributed", "InteractiveUtils", "Logging", "Random"]
uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[[TimerOutputs]]
deps = ["Crayons", "Printf", "Test", "Unicode"]
git-tree-sha1 = "b80671c06f8f8bae08c55d67b5ce292c5ae2660c"
uuid = "a759f4b9-e2f1-59dc-863e-4aeb61b1ea8f"
version = "0.5.0"

[[Tokenize]]
git-tree-sha1 = "dfcdbbfb2d0370716c815cbd6f8a364efb6f42cf"
uuid = "0796e94c-ce3b-5d07-9a54-7f471281c624"
Expand Down
11 changes: 7 additions & 4 deletions Project.toml
Expand Up @@ -6,6 +6,7 @@ version = "0.3.0"

[deps]
Coverage = "a2441757-f6aa-5fb2-8edb-039e3f45d037"
CuArrays = "3a865a2d-5b23-5a0f-bc46-62713ec82fae"
FFTW = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341"
FourierFlows = "2aec4490-903f-5c70-9b11-9bed06a700e1"
JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819"
Expand All @@ -17,12 +18,14 @@ Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"

[compat]
FFTW = "≥ 0.2.4"
FourierFlows = "≥ 0.3.2"
JLD2 = "≥ 0.1.2"
julia = "≥ 1.0.0"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test"]

[compat]
FourierFlows = "≥ 0.3.0"
julia = "≥ 1.0.0"
18 changes: 10 additions & 8 deletions examples/twodturb_mcwilliams1984.jl
Expand Up @@ -6,14 +6,16 @@ import GeophysicalFlows.TwoDTurb
import GeophysicalFlows.TwoDTurb: energy, enstrophy
import GeophysicalFlows: peakedisotropicspectrum

dev = CPU() # Device (CPU/GPU)

# Parameters
n = 256
L = 2π
nnu = 2
nu = 0.0
= 2
ν = 0.0
dt = 1e-2
nsteps = 5000
nsubs = 200
nsubs = 200

# Files
filepath = "."
Expand All @@ -26,7 +28,7 @@ if isfile(filename); rm(filename); end
if !isdir(plotpath); mkdir(plotpath); end

# Initialize problem
prob = TwoDTurb.Problem(; nx=n, Lx=L, ny=n, Ly=L, nu=nu, nnu=nnu, dt=dt, stepper="FilteredRK4")
prob = TwoDTurb.Problem(; nx=n, Lx=L, ny=n, Ly=L, ν=ν, nν=, dt=dt, stepper="FilteredRK4", dev=dev)

sol, cl, vs, gr, filter = prob.sol, prob.clock, prob.vars, prob.grid, prob.timestepper.filter
x, y = gridpoints(gr)
Expand All @@ -35,7 +37,7 @@ x, y = gridpoints(gr)
# that reproduces the results of the paper by McWilliams (1984)
seed!(1234)
k0, E0 = 6, 0.5
zetai = peakedisotropicspectrum(gr, k0, E0, mask=filter)
zetai = peakedisotropicspectrum(gr, k0, E0, mask=filter)
TwoDTurb.set_zeta!(prob, zetai)

# Create Diagnostic -- energy and enstrophy are functions imported at the top.
Expand All @@ -45,8 +47,8 @@ diags = [E, Z] # A list of Diagnostics types passed to "stepforward!" will
# be updated every timestep.

# Create Output
get_sol(prob) = prob.sol # extracts the Fourier-transformed solution
get_u(prob) = irfft(im*gr.l.*gr.invKrsq.*sol, gr.nx)
get_sol(prob) = Array(prob.sol) # extracts the Fourier-transformed solution
get_u(prob) = Array(irfft(im*gr.l.*gr.invKrsq.*sol, gr.nx))
out = Output(prob, filename, (:sol, get_sol), (:u, get_u))
saveproblem(out)

Expand Down Expand Up @@ -89,7 +91,7 @@ while cl.step < nsteps
println(log)
plot_output(prob, fig, axs; drawcolorbar=false)
end

println("finished")
plot_output(prob, fig, axs; drawcolorbar=false)

savename = @sprintf("%s_%09d.png", joinpath(plotpath, plotname), cl.step)
Expand Down
25 changes: 13 additions & 12 deletions examples/twodturb_randomdecay.jl
Expand Up @@ -7,18 +7,19 @@ using FFTW: rfft

import GeophysicalFlows.TwoDTurb


nx = 256 # Resolution
Lx = 2π # Domain size
nu = 1e-6 # Viscosity
nnu = 1 # Order of (hyper-)viscosity. nnu=1 means Laplacian
dt = 0.1 # Timestep
nint = 200 # Number of steps between plots
ntot = 10nint # Number of total timesteps

dev = CPU() # Device (CPU/GPU)

nx = 256 # Resolution
Lx = 2π # Domain size
ν = 1e-6 # Viscosity
= 1 # Order of (hyper-)viscosity. nν=1 means Laplacian
dt = 0.1 # Timestep
nint = 200 # Number of steps between plots
ntot = 10nint # Number of total timesteps

# Define problem
prob = TwoDTurb.Problem(nx=nx, Lx=Lx, nu=nu, nnu=nnu, dt=dt, stepper="FilteredRK4")
TwoDTurb.set_zeta!(prob, rand(nx, nx))
prob = TwoDTurb.Problem(nx=nx, Lx=Lx, ν=ν, nν=, dt=dt, stepper="FilteredRK4", dev=dev)
TwoDTurb.set_zeta!(prob, ArrayType(dev)(rand(nx, nx)))

cl, vs, gr = prob.clock, prob.vars, prob.grid
x, y = gridpoints(gr)
Expand Down Expand Up @@ -49,7 +50,7 @@ while cl.step < ntot
end

# Plot the radial energy spectrum
E = @. 0.5*(vs.u^2 + vs.v^2) # energy density
E = @. 0.5*(vs.u^2 + vs.v^2) # energy density
Eh = rfft(E)
kr, Ehr = FourierFlows.radialspectrum(Eh, gr, refinement=1)

Expand Down

0 comments on commit 0f5e8ed

Please sign in to comment.