From abfa72c8a0c29b7f3c3a64249f551b5c7714c113 Mon Sep 17 00:00:00 2001 From: "Navid C. Constantinou" Date: Tue, 30 Jul 2024 07:57:41 +1000 Subject: [PATCH 1/4] better figure one marker was hiding the other --- docs/src/aliasing.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/src/aliasing.md b/docs/src/aliasing.md index d245037c..b02dbb57 100644 --- a/docs/src/aliasing.md +++ b/docs/src/aliasing.md @@ -46,9 +46,9 @@ lines!(ax, range(-Lx/2, Lx/2, length=200), f2; color = (:salmon, 0.3), label = "cos(6x)") scatter!(ax, x, f1.(x); - markersize = 12, color = (:steelblue, 0.9), label = "cos(4x)") + markersize = 24, marker = :star5, color = (:steelblue, 0.9), label = "cos(4x)") scatter!(ax, x, f2.(x); - markersize = 24, marker = :star5, color = (:salmon, 0.9), label = "cos(6x)") + markersize = 12, color = (:salmon, 0.9), label = "cos(6x)") axislegend(merge = true) From da3809c895e736228f72d3373ba48e7b490bfad3 Mon Sep 17 00:00:00 2001 From: "Navid C. Constantinou" Date: Tue, 30 Jul 2024 09:22:41 +1000 Subject: [PATCH 2/4] fix citations + filter fig --- docs/make.jl | 2 +- docs/src/aliasing.md | 12 +++++++++--- docs/src/timestepping.md | 12 ++++++------ src/timesteppers.jl | 6 +++--- 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/docs/make.jl b/docs/make.jl index 15a30164..74738297 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -10,7 +10,7 @@ using ##### bib_filepath = joinpath(@__DIR__, "src/references.bib") -bib = CitationBibliography(bib_filepath) +bib = CitationBibliography(bib_filepath, style=:authoryear) const EXAMPLES_DIR = joinpath(@__DIR__, "..", "examples") const OUTPUT_DIR = joinpath(@__DIR__, "src/literated") diff --git a/docs/src/aliasing.md b/docs/src/aliasing.md index b02dbb57..b5965dc9 100644 --- a/docs/src/aliasing.md +++ b/docs/src/aliasing.md @@ -82,15 +82,21 @@ harmonics with wavenumbers beyond those that our grid is able to resolve and, th aliasing errors. The above-mentioned 1/2-rule for dealiasing for quadratic nonlinearities is, however, not the -most efficient. [Orszag-1971](@cite) pointed out that for quadratic nonlirearities, simply only +most efficient. [Orszag-1971](@citet) pointed out that for quadratic nonlirearities, simply only discarding the highest-1/3 of wavenumber components is enough to save us from aliasing errors. To be fair, with Orszag's so-called 2/3-rule for dealiasing, still some aliasing errors occur, but those errors only occur to the higher-1/3 wavenumber components that will be zero-ed out at the next time step, when we next dealias our solution anyway. When constructing a `grid` we can specify the `aliased_fraction` parameter. By default, this is -set to ``1/3``, appropriate for quadratic nonlinearities. Then `dealias!(fh, grid)` will zero-out -the highest-`aliased_fraction` wavenumber components of `fh`. +set to ``1/3``, appropriate for quadratic nonlinearities. + +```@example 1 +grid = OneDGrid(; nx, Lx) +``` + +Then we can use `dealias!(fh, grid)` to zero-out the highest-`aliased_fraction` wavenumber +components of `fh`. ```@docs FourierFlows.dealias! diff --git a/docs/src/timestepping.md b/docs/src/timestepping.md index 8569cf93..6d8561d3 100644 --- a/docs/src/timestepping.md +++ b/docs/src/timestepping.md @@ -5,7 +5,7 @@ FourierFlows.jl includes several time-stepping algorithms. Most of the time-stepping algorithms are fully explicit schemes: [`ForwardEulerTimeStepper`](@ref), [`AB3TimeStepper`](@ref), [`RK4TimeStepper`](@ref), and [`LSRK54TimeStepper`](@ref). Also we have implemented an [`ETDRK4TimeStepper`](@ref) scheme with the improvements described -by [Kassam-Trefethen-2005](@cite). +by [Kassam-Trefethen-2005](@citet). The [`Problem`](@ref FourierFlows.Problem) constructor expects the chosen time stepper as as string that includes the corresponding name of the time stepper _without_ the ending `TimeStepper`. @@ -41,9 +41,9 @@ close to machine precision. That is: \alpha = \frac{- \log\delta}{(k_{\textrm{max}} - k_{\textrm{cutoff}})^p} \ . ``` -The above-mentioned filter form originates from the book by [Canuto-etal-1987](@cite). -In geophysical turbulence applications it was used by [LaCasce-1996](@cite) and later -by [Arbic-Flierl-2004](@cite). +The above-mentioned filter form originates from the book by [Canuto-etal-1987](@citet). +In geophysical turbulence applications it was used by [LaCasce-1996](@citet) and later +by [Arbic-Flierl-2004](@citet). !!! warning "Not too steep, not too shallow" Care should be taken if one decides to fiddle with the filter parameters. Changing @@ -70,7 +70,7 @@ using FourierFlows: makefilter K = 0:0.001:1 # non-dimensional wavenumber k * dx / ฯ€ fig = Figure() -ax = Axis(fig[1, 1], xlabel = "|๐ค| dx / ฯ€", ylabel = "filter", aspect=2.5, xticks=0:0.2:1) +ax = Axis(fig[1, 1], xlabel = "|๐ค| dx / ฯ€", ylabel = "filter", xticks=0:0.2:1) vlines!(ax, 2/3, color = (:gray, 0.4), linewidth = 6, label = "cutoff wavenumber |๐ค| dx / ฯ€ = 2/3 (default)") @@ -78,7 +78,7 @@ lines!(ax, K, makefilter(K), linewidth = 4, label = "order 4 (default)") lines!(ax, K, makefilter(K, order = 1), linestyle = :dash, label = "order 1") lines!(ax, K, makefilter(K, order = 10), linestyle = :dot, label = "order 10") -axislegend(position = :lb) +fig[0, 1] = Legend(fig, ax) current_figure() # hide ``` diff --git a/src/timesteppers.jl b/src/timesteppers.jl index 9ae03e3f..baafd4ca 100644 --- a/src/timesteppers.jl +++ b/src/timesteppers.jl @@ -306,7 +306,7 @@ uโฟโบยน = uโฟ ``` where `Aแตข`, `Bแตข`, and `Cแตข` are the ``A``, ``B``, and ``C`` coefficients from -the LSRK table at the ``i``-th stage. For details, refer to [Carpenter-Kennedy-1994](@cite). +the LSRK table at the ``i``-th stage. For details, refer to [Carpenter-Kennedy-1994](@citet). !!! info "Usage" The `LSRK54TimeStepper` is *slower* than the [`RK4TimeStepper`](@ref) but @@ -429,7 +429,7 @@ That is, uโฟโบยน = exp(L * dt) * uโฟ + RK4(N(uโฟ)) ``` -For more info refer to [Kassam-Trefethen-2005](@cite). +For more info refer to [Kassam-Trefethen-2005](@citet). """ struct ETDRK4TimeStepper{T,TL} <: AbstractTimeStepper{T} # ETDRK4 coefficents @@ -684,7 +684,7 @@ Calculate the coefficients associated with the (diagonal) linear coefficient `L` for an ETDRK4 timestepper with timestep `dt`. The calculation is done by integrating over a unit circle in the complex space. -For more info refer to [Kassam-Trefethen-2005](@cite). +For more info refer to [Kassam-Trefethen-2005](@citet). """ function getetdcoeffs(dt, L; ncirc=32, rcirc=1) shape = Tuple(cat(ncirc, ones(Int, ndims(L)), dims=1)) From a85a84711b5af27807b961de9447d77711813311 Mon Sep 17 00:00:00 2001 From: "Navid C. Constantinou" Date: Tue, 30 Jul 2024 09:41:34 +1000 Subject: [PATCH 3/4] fix gpu tests --- test/runtests.jl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/runtests.jl b/test/runtests.jl index 1aecfc75..16abc855 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -387,9 +387,9 @@ for dev in devices @test repr(diag) == "Diagnostic\n โ”œโ”€โ”€โ”€ calc: get_sol\n โ”œโ”€โ”€โ”€ prob: FourierFlows.Problem{DataType, Vector{ComplexF64}, Float64, Vector{Float64}}\n โ”œโ”€โ”€โ”€ data: 101-element Vector{Vector{ComplexF64}}\n โ”œโ”€โ”€โ”€โ”€โ”€โ”€ t: 101-element Vector{Float64}\n โ”œโ”€โ”€ steps: 101-element Vector{Int64}\n โ”œโ”€โ”€โ”€ freq: 1\n โ””โ”€โ”€โ”€โ”€โ”€โ”€ i: 1" @test repr(out) == "Output\n โ”œโ”€โ”€โ”€โ”€ prob: FourierFlows.Problem{DataType, Vector{ComplexF64}, Float64, Vector{Float64}}\n โ”œโ”€โ”€โ”€โ”€ path: output.jld2\n โ””โ”€โ”€ fields: Dict{Symbol, Function}()" else - @test repr(prob.vars) == "Variables\n โ”œโ”€โ”€โ”€โ”€โ”€ variable: c -> 128-element CuArray{Float64, 1, CUDA.Mem.DeviceBuffer}\n โ”œโ”€โ”€โ”€โ”€โ”€ variable: cx -> 128-element CuArray{Float64, 1, CUDA.Mem.DeviceBuffer}\n โ”œโ”€โ”€โ”€โ”€โ”€ variable: ch -> 65-element CuArray{ComplexF64, 1, CUDA.Mem.DeviceBuffer}\n โ””โ”€โ”€โ”€โ”€โ”€ variable: cxh -> 65-element CuArray{ComplexF64, 1, CUDA.Mem.DeviceBuffer}\n" - @test repr(diag) == "Diagnostic\n โ”œโ”€โ”€โ”€ calc: get_sol\n โ”œโ”€โ”€โ”€ prob: FourierFlows.Problem{DataType, CuArray{ComplexF64, 1, CUDA.Mem.DeviceBuffer}, Float64, CuArray{Float64, 1, CUDA.Mem.DeviceBuffer}}\n โ”œโ”€โ”€โ”€ data: 101-element Vector{CuArray{ComplexF64, 1, CUDA.Mem.DeviceBuffer}}\n โ”œโ”€โ”€โ”€โ”€โ”€โ”€ t: 101-element Vector{Float64}\n โ”œโ”€โ”€ steps: 101-element Vector{Int64}\n โ”œโ”€โ”€โ”€ freq: 1\n โ””โ”€โ”€โ”€โ”€โ”€โ”€ i: 1" - @test repr(out) == "Output\n โ”œโ”€โ”€โ”€โ”€ prob: FourierFlows.Problem{DataType, CuArray{ComplexF64, 1, CUDA.Mem.DeviceBuffer}, Float64, CuArray{Float64, 1, CUDA.Mem.DeviceBuffer}}\n โ”œโ”€โ”€โ”€โ”€ path: output.jld2\n โ””โ”€โ”€ fields: Dict{Symbol, Function}()" + @test repr(prob.vars) == "Variables\n โ”œโ”€โ”€โ”€โ”€โ”€ variable: c -> 128-element CuArray{Float64, 1, CUDA.DeviceMemory}\n โ”œโ”€โ”€โ”€โ”€โ”€ variable: cx -> 128-element CuArray{Float64, 1, CUDA.DeviceMemory}\n โ”œโ”€โ”€โ”€โ”€โ”€ variable: ch -> 65-element CuArray{ComplexF64, 1, CUDA.DeviceMemory}\n โ””โ”€โ”€โ”€โ”€โ”€ variable: cxh -> 65-element CuArray{ComplexF64, 1, CUDA.DeviceMemory}\n" + @test repr(diag) == "Diagnostic\n โ”œโ”€โ”€โ”€ calc: get_sol\n โ”œโ”€โ”€โ”€ prob: FourierFlows.Problem{DataType, CuArray{ComplexF64, 1, CUDA.DeviceMemory}, Float64, CuArray{Float64, 1, CUDA.DeviceMemory}}\n โ”œโ”€โ”€โ”€ data: 101-element Vector{CuArray{ComplexF64, 1, CUDA.DeviceMemory}}\n โ”œโ”€โ”€โ”€โ”€โ”€โ”€ t: 101-element Vector{Float64}\n โ”œโ”€โ”€ steps: 101-element Vector{Int64}\n โ”œโ”€โ”€โ”€ freq: 1\n โ””โ”€โ”€โ”€โ”€โ”€โ”€ i: 1" + @test repr(out) == "Output\n โ”œโ”€โ”€โ”€โ”€ prob: FourierFlows.Problem{DataType, CuArray{ComplexF64, 1, CUDA.DeviceMemory}, Float64, CuArray{Float64, 1, CUDA.DeviceMemory}}\n โ”œโ”€โ”€โ”€โ”€ path: output.jld2\n โ””โ”€โ”€ fields: Dict{Symbol, Function}()" end @test repr(prob.eqn) == "Equation\n โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ linear coefficients: L\n โ”‚ โ”œโ”€โ”€โ”€type: Float64\n โ”‚ โ””โ”€โ”€โ”€size: (65,)\n โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ nonlinear term: calcN!()\n โ””โ”€โ”€โ”€ type of state vector sol: ComplexF64" From 7b16a6ae4531d473ac0978807dbe8a1d8c908639 Mon Sep 17 00:00:00 2001 From: "Navid C. Constantinou" Date: Tue, 30 Jul 2024 09:43:31 +1000 Subject: [PATCH 4/4] add CUDA 5.4 compat entry --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index e4a33af7..332d4174 100644 --- a/Project.toml +++ b/Project.toml @@ -20,7 +20,7 @@ Reexport = "189a3867-3050-52da-a836-e630ba90ab69" Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" [compat] -CUDA = "1, 2.4.2, 3.0.0 - 3.6.4, 3.7.1, 4, 5" +CUDA = "1, 2.4.2, 3.0.0 - 3.6.4, 3.7.1, 4, 5.4" DocStringExtensions = "0.8, 0.9" FFTW = "1" Interpolations = "0.12, 0.13, 0.14, 0.15"