commit d9942595aec41f37d766c59d041229d6f738e0c0
parent 7e1e33401f9beb4636262d2e51e56b70dbf406fb
Author: Anders Damsgaard <andersd@riseup.net>
Date: Thu, 18 May 2017 16:15:59 -0400
increase consistency and precision for output file generation
Diffstat:
2 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/src/simulation.jl b/src/simulation.jl
@@ -85,11 +85,12 @@ function run!(simulation::Simulation;
checkTimeParameters(simulation)
+ it_file = 0
+ n_file_time_step =Int(round(simulation.file_time_step/simulation.time_step))
while simulation.time <= simulation.time_total
- if simulation.file_time_step > 0.0 &&
- simulation.file_time_since_output_file >= simulation.file_time_step
+ if simulation.file_time_step > 0.0 && it_file >= n_file_time_step
if show_file_output
println()
@@ -117,6 +118,7 @@ function run!(simulation::Simulation;
# Update time variables
simulation.time_iteration += 1
+ n_file_time_step += 1
incrementCurrentTime!(simulation, simulation.time_step)
if single_step
diff --git a/test/vtk.jl b/test/vtk.jl
@@ -25,13 +25,15 @@ else
error("checksum verification of VTK file not supported on this platform")
end
-@test readstring(`$(cmd) test.icefloes.1.vtu$(cmd_post)`) ==
+icefloechecksum =
"88daceb1b99c519154b1acdcf8f340967794c552c74ea70c4af8954d8af5296a " *
"test.icefloes.1.vtu\n"
-oceanchecksum = "d56ffb109841a803f2b2b94c74c87f7a497237204841d557d2b1043694d51f0d " *
+oceanchecksum =
+"d56ffb109841a803f2b2b94c74c87f7a497237204841d557d2b1043694d51f0d " *
"test.ocean.1.vts\n"
+@test readstring(`$(cmd) test.icefloes.1.vtu$(cmd_post)`) == icefloechecksum
@test readstring(`$(cmd) test.ocean.1.vts$(cmd_post)`) == oceanchecksum
SeaIce.removeSimulationFiles(sim)
@@ -44,10 +46,7 @@ sim.file_number = 0
SeaIce.run!(sim, single_step=true)
SeaIce.run!(sim, single_step=true)
-@test readstring(`$(cmd) test.icefloes.1.vtu$(cmd_post)`) ==
-"203030169e90d9ab9538074d2c196ae61dbd8dc3522fcc18e294d4ee70fe4504 " *
-"test.icefloes.1.vtu\n"
-
+@test readstring(`$(cmd) test.icefloes.1.vtu$(cmd_post)`) == icefloechecksum
@test readstring(`$(cmd) test.ocean.1.vts$(cmd_post)`) == oceanchecksum
SeaIce.removeSimulationFiles(sim)