Skip to content
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

Add more zeros to solution file name #1996

Merged
merged 8 commits into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ for human readability.

- The specification of boundary names on which `AnalysisSurfaceIntegral`s are computed (such as drag and lift coefficients) has changed from `Symbol` and `Vector{Symbol}` to `NTuple{Symbol}`.
Thus, for one boundary the syntax changes from `:boundary` to `(:boundary,)` and for `Vector`s `[:boundary1, :boundary2]` to `(:boundary1, :boundary2)` ([1959]).
- The names of output files like the one created from the `SaveSolutionCallback` has changed from `%06d` to `%09d` to allow longer-running simulations ([1996]).

#### Deprecated

Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Trixi"
uuid = "a7f1ee26-1774-49b1-8366-f1abc58fbfcb"
authors = ["Michael Schlottke-Lakemper <[email protected]>", "Gregor Gassner <[email protected]>", "Hendrik Ranocha <[email protected]>", "Andrew R. Winters <[email protected]>", "Jesse Chan <[email protected]>"]
version = "0.7.19-DEV"
version = "0.8.0-DEV"

[deps]
CodeTracking = "da1fd8a2-8d9e-5ec2-8556-3022fb5608a2"
Expand Down
6 changes: 3 additions & 3 deletions src/callbacks_step/save_restart_dg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function save_restart_file(u, time, dt, timestep,
@unpack output_directory = restart_callback

# Filename based on current time step
filename = joinpath(output_directory, @sprintf("restart_%06d.h5", timestep))
filename = joinpath(output_directory, @sprintf("restart_%09d.h5", timestep))

# Restart files always store conservative variables
data = u
Expand Down Expand Up @@ -93,7 +93,7 @@ function save_restart_file(u, time, dt, timestep,
restart_callback)
@unpack output_directory = restart_callback
# Filename based on current time step
filename = joinpath(output_directory, @sprintf("restart_%06d.h5", timestep))
filename = joinpath(output_directory, @sprintf("restart_%09d.h5", timestep))

if HDF5.has_parallel()
save_restart_file_parallel(u, time, dt, timestep, mesh, equations, dg, cache,
Expand Down Expand Up @@ -337,7 +337,7 @@ function save_adaptive_time_integrator(integrator,
timestep = integrator.stats.naccept

# Filename based on current time step
filename = joinpath(output_directory, @sprintf("restart_%06d.h5", timestep))
filename = joinpath(output_directory, @sprintf("restart_%09d.h5", timestep))

# Open file (preserve existing content)
h5open(filename, "r+") do file
Expand Down
8 changes: 4 additions & 4 deletions src/callbacks_step/save_solution_dg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ function save_solution_file(u, time, dt, timestep,

# Filename based on current time step
if isempty(system)
filename = joinpath(output_directory, @sprintf("solution_%06d.h5", timestep))
filename = joinpath(output_directory, @sprintf("solution_%09d.h5", timestep))
else
filename = joinpath(output_directory,
@sprintf("solution_%s_%06d.h5", system, timestep))
@sprintf("solution_%s_%09d.h5", system, timestep))
end

# Convert to different set of variables if requested
Expand Down Expand Up @@ -101,10 +101,10 @@ function save_solution_file(u, time, dt, timestep,

# Filename based on current time step
if isempty(system)
filename = joinpath(output_directory, @sprintf("solution_%06d.h5", timestep))
filename = joinpath(output_directory, @sprintf("solution_%09d.h5", timestep))
else
filename = joinpath(output_directory,
@sprintf("solution_%s_%06d.h5", system, timestep))
@sprintf("solution_%s_%09d.h5", system, timestep))
end

# Convert to different set of variables if requested
Expand Down
2 changes: 1 addition & 1 deletion src/callbacks_step/visualization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ function save_plot(plot_data, variable_names;
Plots.plot(plots..., layout = layout)

# Determine filename and save plot
filename = joinpath("out", @sprintf("solution_%06d.png", timestep))
filename = joinpath("out", @sprintf("solution_%09d.png", timestep))
Plots.savefig(filename)
end
end # @muladd
12 changes: 6 additions & 6 deletions src/meshes/mesh_io.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function save_mesh_file(mesh::TreeMesh, output_directory, timestep,

# Determine file name based on existence of meaningful time step
if timestep > 0
filename = joinpath(output_directory, @sprintf("mesh_%06d.h5", timestep))
filename = joinpath(output_directory, @sprintf("mesh_%09d.h5", timestep))
else
filename = joinpath(output_directory, "mesh.h5")
end
Expand Down Expand Up @@ -57,7 +57,7 @@ function save_mesh_file(mesh::TreeMesh, output_directory, timestep,

# Determine file name based on existence of meaningful time step
if timestep >= 0
filename = joinpath(output_directory, @sprintf("mesh_%06d.h5", timestep))
filename = joinpath(output_directory, @sprintf("mesh_%09d.h5", timestep))
else
filename = joinpath(output_directory, "mesh.h5")
end
Expand Down Expand Up @@ -156,8 +156,8 @@ function save_mesh_file(mesh::P4estMesh, output_directory, timestep,

# Determine file name based on existence of meaningful time step
if timestep > 0
filename = joinpath(output_directory, @sprintf("mesh_%06d.h5", timestep))
p4est_filename = @sprintf("p4est_data_%06d", timestep)
filename = joinpath(output_directory, @sprintf("mesh_%09d.h5", timestep))
p4est_filename = @sprintf("p4est_data_%09d", timestep)
else
filename = joinpath(output_directory, "mesh.h5")
p4est_filename = "p4est_data"
Expand Down Expand Up @@ -191,8 +191,8 @@ function save_mesh_file(mesh::P4estMesh, output_directory, timestep, mpi_paralle

# Determine file name based on existence of meaningful time step
if timestep > 0
filename = joinpath(output_directory, @sprintf("mesh_%06d.h5", timestep))
p4est_filename = @sprintf("p4est_data_%06d", timestep)
filename = joinpath(output_directory, @sprintf("mesh_%09d.h5", timestep))
p4est_filename = @sprintf("p4est_data_%09d", timestep)
else
filename = joinpath(output_directory, "mesh.h5")
p4est_filename = "p4est_data"
Expand Down
2 changes: 1 addition & 1 deletion src/meshes/structured_mesh_view.jl
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ function save_mesh_file(mesh::StructuredMeshView, output_directory; system = "",
# Create output directory (if it does not exist)
mkpath(output_directory)

filename = joinpath(output_directory, @sprintf("mesh_%s_%06d.h5", system, timestep))
filename = joinpath(output_directory, @sprintf("mesh_%s_%09d.h5", system, timestep))

# Open file (clobber existing content)
h5open(filename, "w") do file
Expand Down
Loading