Skip to content

Commit

Permalink
Remove areas and volume from RegularCartesianGrid.
Browse files Browse the repository at this point in the history
  • Loading branch information
ali-ramadhan committed Oct 23, 2019
1 parent 4c7481f commit cab311e
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 19 deletions.
9 changes: 1 addition & 8 deletions src/grids.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,6 @@ struct RegularCartesianGrid{FT<:AbstractFloat, R<:AbstractRange} <: AbstractGrid
Δx::FT
Δy::FT
Δz::FT
# Cell face areas [m²].
Ax::FT
Ay::FT
Az::FT
# Volume of a cell [m³].
V::FT
# Range of coordinates at the centers of the cells.
xC::R
yC::R
Expand Down Expand Up @@ -156,8 +150,7 @@ function RegularCartesianGrid(FT=Float64; size, length=nothing, x=nothing, y=not
zF = range(z₁, z₂; length=Nz+1)

RegularCartesianGrid{FT, typeof(xC)}(Nx, Ny, Nz, Hx, Hy, Hz, Tx, Ty, Tz,
Lx, Ly, Lz, Δx, Δy, Δz, Ax, Ay, Az, V,
xC, yC, zC, xF, yF, zF)
Lx, Ly, Lz, Δx, Δy, Δz, xC, yC, zC, xF, yF, zF)
end

size(grid::RegularCartesianGrid) = (grid.Nx, grid.Ny, grid.Nz)
Expand Down
11 changes: 0 additions & 11 deletions test/test_grids.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,6 @@ function correct_grid_size(FT)
grid.Lx 2π && grid.Ly 4π && grid.Lz 9π)
end

function correct_cell_volume(FT)
Nx, Ny, Nz = 19, 13, 7
Δx, Δy, Δz = 0.1, 0.2, 0.3
Lx, Ly, Lz = Nx*Δx, Ny*Δy, Nz*Δz
grid = RegularCartesianGrid(FT; size=(Nx, Ny, Nz), length=(Lx, Ly, Lz))

# Checking ≈ as the grid could be storing Float32 values.
return grid.V Δx*Δy*Δz
end

function faces_start_at_zero(FT)
grid = RegularCartesianGrid(FT; size=(10, 10, 10), length=(2π, 2π, 2π))
return grid.xF[1] == 0 && grid.yF[1] == 0 && grid.zF[end] == 0
Expand Down Expand Up @@ -50,7 +40,6 @@ end
println(" Testing grid initialization...")
for FT in float_types
@test correct_grid_size(FT)
@test correct_cell_volume(FT)
@test faces_start_at_zero(FT)
@test end_faces_match_grid_length(FT)
@test ranges_have_correct_length(FT)
Expand Down

0 comments on commit cab311e

Please sign in to comment.