-
Notifications
You must be signed in to change notification settings - Fork 195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better grids, including better RegularCartesianGrid #330
Comments
Just wanted to point out that PR #283 addresses your second point. |
@ali-ramadhan this looks nice. I think we should also change @inline Δx(i, j, k, grid::Grid) = @inbounds grid.Δx[i, j, k] that cannot be used probably should not be part of the code. |
Originally I was against types like I agree . That PR should only introduce operators that will be used (otherwise they can't be tested so what's the point). |
I have a revision to my original post. Rather than add the size of the grid as types in the abstract type AbstractTopology end
struct Bounded <: AbstractTopology end
struct Flat <: AbstractTopology end
struct Periodic <: AbstractTopology end
abstract type AbstractGrid{FT, Tx, Ty, Tz} end where For I think this also corresponds more closely to the mathematical meaning of a "Periodic" and "Flat" dimension. Another thought is that we should make the constructor more verbose, eg RegularCartesianGrid(size=(Nx, Ny, Nz), length=(Lx, Ly, Lz), topology=(Tx, Ty, Tz)). |
I see a few things to improve with the grid right now.
Grid
, aka:Functions can then dispatch when one of
Nx
, etc is1
(including halo-filling functions, which I think may fail when the size of the halo is 0). Another option is to use flags for each dimension rather than the actual size of the grid. In my opinion using the size makes the most sense. Using the actual size could have future advantages; for example, if some optimizations are possible whenNz=2
. It is also nice to see the size of the grid from the type signature. A disadvantage is that we then could not havemutable
grid types, but I'm not sure we want that.RegularCartesianGrid
struct: cell areas, volumes, total number of grid points, etc. I think it would be better --- meaning that our code would be shorter, easier to read, easier to maintain, easier to reason about (since storing them implies they cannot be computed, which is incorrect) and more computationally efficient --- to add functions that compute these quantities on the fly, rather than storing them in memory.Related: #287.
The text was updated successfully, but these errors were encountered: