Skip to content

Commit 32fa72e

Browse files
authored
Merge pull request #330 from FourierFlows/ncc/grid-architecture
Grid refactor
2 parents 7a7b48d + bacdb02 commit 32fa72e

28 files changed

+344
-340
lines changed

.buildkite/pipeline.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ steps:
1414
if: build.message !~ /\[skip tests\]/
1515
timeout_in_minutes: 60
1616

17-
- label: "🐫 Julia 1.7"
17+
- label: "🐫 Julia 1.8"
1818
plugins:
1919
- JuliaCI/julia#v1:
20-
version: 1.7
20+
version: 1.8
2121
- JuliaCI/julia-test#v1: ~
2222
- JuliaCI/julia-coverage#v1:
2323
codecov: true

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
steps:
1111
- uses: julia-actions/setup-julia@latest
1212
with:
13-
version: 1.7
13+
version: 1.6
1414
- name: Pkg.add("CompatHelper")
1515
run: julia -e 'using Pkg; Pkg.add("CompatHelper")'
1616
- name: CompatHelper.main()

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ authors = ["Gregory L. Wagner <wagner.greg@gmail.com>", "Navid C. Constantinou <
66
description = "Tools for building fast, hackable, pseudospectral partial differential equation solvers on periodic domains."
77
documentation = "https://fourierflows.github.io/FourierFlowsDocumentation/stable/"
88
repository = "https://github.com/FourierFlows/FourierFlows.jl"
9-
version = "0.9.4"
9+
version = "0.10.0"
1010

1111
[deps]
1212
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ and [Navid C. Constantinou][] (@navidcy).
102102

103103
The code is citable via [zenodo](https://zenodo.org). Please cite as:
104104

105-
> Gregory L. Wagner, Navid C. Constantinou, and contributors. (2022). FourierFlows/FourierFlows.jl: FourierFlows v0.9.4 (Version v0.9.4). Zenodo. [http://doi.org/10.5281/zenodo.1161724](http://doi.org/10.5281/zenodo.1161724)
105+
> Gregory L. Wagner, Navid C. Constantinou, and contributors. (2022). FourierFlows/FourierFlows.jl: FourierFlows v0.10.0 (Version v0.10.0). Zenodo. [http://doi.org/10.5281/zenodo.1161724](http://doi.org/10.5281/zenodo.1161724)
106106
107107

108108
## Contributing

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
environment:
22
matrix:
33
- julia_version: 1.6
4-
- julia_version: 1.7
4+
- julia_version: 1.8
55
- julia_version: nightly
66

77
platform:

docs/make.jl

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,7 @@ using
55
Glob,
66
FourierFlows
77

8-
# Gotta set this environment variable when using the GR run-time on CI machines.
9-
# This happens as examples will use Plots.jl to make plots and movies.
10-
# See: https://github.com/jheinen/GR.jl/issues/278
11-
ENV["GKSwstype"] = "100"
12-
13-
#####
8+
#####
149
##### Generate examples
1510
#####
1611

@@ -66,29 +61,29 @@ pages = [
6661
],
6762
]
6863

69-
makedocs(
64+
makedocs(;
7065
sitename = "FourierFlows.jl",
71-
authors = "Gregory L. Wagner and Navid C. Constantinou",
66+
authors = "Gregory L. Wagner and Navid C. Constantinou and contributors",
7267
modules = [FourierFlows],
73-
format = format,
74-
pages = pages,
68+
format,
69+
pages,
7570
doctest = true,
7671
strict = :doctest,
7772
clean = true,
7873
checkdocs = :exports
7974
)
8075

76+
@info "Cleaning up temporary .jld2 and .nc files created by doctests..."
77+
for file in vcat(glob("docs/*.jld2"))
78+
rm(file)
79+
end
80+
8181
withenv("GITHUB_REPOSITORY" => "FourierFlows/FourierFlowsDocumentation") do
8282
deploydocs(
8383
repo = "github.com/FourierFlows/FourierFlowsDocumentation.git",
8484
versions = ["stable" => "v^", "v#.#.#", "dev" => "dev"],
85+
forcepush = true,
8586
push_preview = false,
8687
devbranch = "main"
8788
)
8889
end
89-
90-
91-
@info "Cleaning up temporary .jld2 and .nc files created by doctests..."
92-
for file in vcat(glob("docs/*.jld2"))
93-
rm(file)
94-
end

docs/src/aliasing.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ on a grid ``x \in [-π, π)`` with ``n_x = 10`` grid points.
2525
using FourierFlows, CairoMakie
2626
2727
nx, Lx = 10, 2π
28-
grid = OneDGrid(nx, Lx)
28+
grid = OneDGrid(; nx, Lx)
2929
3030
f1(x) = cos(4x)
3131
f2(x) = cos(6x)
@@ -94,7 +94,7 @@ FourierFlows.dealias!
9494
If we construct a grid with `aliased_fraction=0`, e.g.,
9595

9696
```@example 1
97-
grid_nodealias = OneDGrid(nx, Lx; aliased_fraction=0)
97+
grid_nodealias = OneDGrid(; nx, Lx, aliased_fraction=0)
9898
```
9999

100100
then `dealias!(fh, grid_nodealias)` will have _no effect_ whatsoever on `fh`.

docs/src/diagnostics.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ DocTestSetup = quote
88
using FourierFlows
99
using LinearAlgebra: mul!, ldiv!
1010
nx, Lx = 32, 2.0
11-
grid = OneDGrid(nx, Lx)
11+
grid = OneDGrid(; nx, Lx)
1212
struct Params <: AbstractParams
1313
α :: Float64
1414
end
@@ -43,7 +43,7 @@ set_theme!(Theme(linewidth = 3, fontsize = 20))
4343
using LinearAlgebra: mul!
4444
4545
nx, Lx = 32, 2.0
46-
grid = OneDGrid(nx, Lx)
46+
grid = OneDGrid(; nx, Lx)
4747
4848
struct Params <: AbstractParams
4949
α :: Float64

docs/src/gpu.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@ overload all methods to work with `GPU()` device as their argument (instead of t
1616
It's easy to construct a grid that lives on the GPU. Calling:
1717

1818
```julia
19-
dev = GPU()
20-
n, L = 16, 2.0
21-
grid = OneDGrid(dev, n, L)
19+
nx, Lx = 16, 2.0
20+
grid = OneDGrid(GPU(); nx, Lx)
2221

2322
OneDimensionalGrid
2423
├─────────── Device: GPU
@@ -30,22 +29,21 @@ OneDimensionalGrid
3029
└─ aliased fraction: 0.3333333333333333
3130
```
3231

33-
gives out a grid whose arrays are `CuArrays`. (Calling `OneDGrid(n, L)` defaults to CPU, i.e.,
34-
`OneDGrid(CPU(), n, L)`.)
32+
returns a grid whose arrays are `CuArrays`. (Calling `OneDGrid(; nx, Lx)` defaults to using
33+
`CPU()`, i.e., `OneDGrid(CPU(); nx, Lx)`.)
3534

3635
When we construct the `Params`, `Vars`, and `Equation` for our problem we need to make sure
3736
that we create arrays on the appropriate device, i.e., `Arrays` for `CPU` or `CuArrays` for
38-
the `GPU`. Function `ArrayType` is useful in constructing appropriately chosen arrays.
37+
the `GPU`. Function `device_array` is useful in constructing appropriately chosen arrays.
3938

4039
```@docs
41-
ArrayType
40+
device_array
4241
```
4342

44-
The `FourierFlows.Problem` constructor then takes an optional positional argument
45-
`dev::Device`. If not provided anything, the default values for `dev=CPU()`.
43+
The `FourierFlows.Problem` constructor infers the device from the `grid` that is provided.
4644

4745
```julia
48-
problem = Problem(equation, stepper, dt, grid, vars, params, GPU())
46+
problem = Problem(equation, stepper, dt, grid, vars, params)
4947
```
5048

5149
The `FourierFlows.Diffusion` module is written in a way such that switching from CPU to GPU

docs/src/grids.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ using FourierFlows
1919
2020
nx, Lx = 64, 2π
2121
22-
grid = OneDGrid(nx, Lx)
22+
grid = OneDGrid(; nx, Lx)
2323
2424
# output
2525
@@ -48,7 +48,7 @@ using LinearAlgebra: mul!, ldiv!
4848
using CairoMakie
4949
set_theme!(Theme(linewidth = 3, fontsize = 20))
5050
nx, Lx = 64, 2π
51-
grid = OneDGrid(nx, Lx)
51+
grid = OneDGrid(; nx, Lx)
5252
```
5353

5454
```@example 1
@@ -161,7 +161,7 @@ nothing # hide
161161
```
162162

163163
The grid contains the wavenumbers (both for real-value functions `grid.kr` and
164-
for complex-valued functions `grid.k`). We populate array `∂ₓuh` is with ``i k \hat{u}``:
164+
for complex-valued functions `grid.k`). We populate array `∂ₓuh` is with ``\mathrm{i} k \hat{u}``:
165165

166166
```@example 1
167167
@. ∂ₓuh = im * grid.kr * uh

0 commit comments

Comments
 (0)