Skip to content

Commit

Permalink
Fix the creation of the cell edge mesh and hence its writing to the n…
Browse files Browse the repository at this point in the history
…etcdf file
  • Loading branch information
Ceyron committed May 31, 2020
1 parent 09a5f39 commit 97015a2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions single_node.jl
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ function main()
domain_size_x / num_cells_x,
domain_size_y /num_cells_y,
# Create the mesh, for N interior cells we have N+1 edges in each direction
range(offset_x, offset_x+domain_size_x; length=num_cells_x),
range(offset_y, offset_y+domain_size_y; length=num_cells_y),
range(offset_x, offset_x+domain_size_x; length=num_cells_x+1),
range(offset_y, offset_y+domain_size_y; length=num_cells_y+1),
),
SWE_Fields(
# Account for the additional halo layers of the boundary
Expand Down
13 changes: 9 additions & 4 deletions src/writer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,15 @@ function create_output_file(
rm(nc_file_name)
end

x_in_ds = (deepcopy(simulation_data.current.layout.mesh_x) .-
simulation_data.current.layout.cell_width_x ./ 2.)[1:end]
y_in_ds = (deepcopy(simulation_data.current.layout.mesh_y) .-
simulation_data.current.layout.cell_width_y ./ 2.)[1:end]
# The created mesh has N+1 edges for N interior cells. The coordinates
# address the bottom left corner of each cell (i.e. also the last but not
# the first halo cell). To get the coordinates of the cell centers we add
# half ot he cell with to each of it and only take the first N elements of
# the array
x_in_ds = (deepcopy(simulation_data.current.layout.mesh_x) .+
simulation_data.current.layout.cell_width_x ./ 2.)[1:end-1]
y_in_ds = (deepcopy(simulation_data.current.layout.mesh_y) .+
simulation_data.current.layout.cell_width_y ./ 2.)[1:end-1]
time_in_ds = deepcopy(simulation_data.time_mesh.time_nodes)

# Attribute Dictionaries for dimensions
Expand Down

0 comments on commit 97015a2

Please sign in to comment.