tmake sure final time is reported at the end, decrease verbosity in tests - Gra… | |
git clone git://src.adamsgaard.dk/Granular.jl | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit f25abf03017afebef8a29ff65cfdef23917d4a7c | |
parent 1c2e3c2a2abc0125d658dfb267281e664bf32641 | |
Author: Anders Damsgaard <[email protected]> | |
Date: Thu, 20 Apr 2017 11:29:53 -0400 | |
make sure final time is reported at the end, decrease verbosity in tests | |
Diffstat: | |
M src/simulation.jl | 9 +++++++-- | |
M test/collision-2floes-normal.jl | 12 +++++++----- | |
2 files changed, 14 insertions(+), 7 deletions(-) | |
--- | |
diff --git a/src/simulation.jl b/src/simulation.jl | |
t@@ -53,8 +53,7 @@ function run!(simulation::Simulation; | |
end | |
if verbose && simulation.time_iteration % status_interval == 0 | |
- print("\r t = ", simulation.time, '/', simulation.time_total, | |
- " s ") | |
+ reportSimulationTimeToStdout(simulation) | |
end | |
zeroForcesAndTorques!(simulation) | |
t@@ -75,6 +74,7 @@ function run!(simulation::Simulation; | |
end | |
end | |
if verbose | |
+ reportSimulationTimeToStdout(simulation) | |
println() | |
end | |
end | |
t@@ -104,3 +104,8 @@ function zeroForcesAndTorques!(simulation::Simulation) | |
icefloe.torque = 0. | |
end | |
end | |
+ | |
+function reportSimulationTimeToStdout(simulation::Simulation) | |
+ print("\r t = ", simulation.time, '/', simulation.time_total, | |
+ " s ") | |
+end | |
diff --git a/test/collision-2floes-normal.jl b/test/collision-2floes-normal.jl | |
t@@ -8,10 +8,11 @@ import SeaIce | |
info("#### $(basename(@__FILE__)) ####") | |
+verbose=false | |
sim = SeaIce.createSimulation(id="test") | |
-SeaIce.addIceFloeCylindrical(sim, [0., 0.], 10., 1., verbose=false) | |
-SeaIce.addIceFloeCylindrical(sim, [20.05, 0.], 10., 1., verbose=false) | |
+SeaIce.addIceFloeCylindrical(sim, [0., 0.], 10., 1., verbose=verbose) | |
+SeaIce.addIceFloeCylindrical(sim, [20.05, 0.], 10., 1., verbose=verbose) | |
sim.ice_floes[1].lin_vel[1] = 0.1 | |
sim.ice_floes[2].fixed = true | |
t@@ -28,7 +29,7 @@ info("Testing kinetic energy conservation with Two-term Tayl… | |
SeaIce.setTimeStep!(sim, epsilon=0.07) | |
tol = 0.2 | |
info("Relative tolerance: $(tol*100.)% with time step: $(sim.time_step)") | |
-SeaIce.run!(sim, temporal_integration_method="Two-term Taylor") | |
+SeaIce.run!(sim, temporal_integration_method="Two-term Taylor", verbose=verbos… | |
E_kin_lin_final = SeaIce.totalIceFloeKineticTranslationalEnergy(sim) | |
E_kin_rot_final = SeaIce.totalIceFloeKineticRotationalEnergy(sim) | |
t@@ -41,7 +42,7 @@ sim = deepcopy(sim_init) | |
SeaIce.setTimeStep!(sim, epsilon=0.007) | |
tol = 0.02 | |
info("Relative tolerance: $(tol*100.)%") | |
-SeaIce.run!(sim, temporal_integration_method="Two-term Taylor") | |
+SeaIce.run!(sim, temporal_integration_method="Two-term Taylor", verbose=verbos… | |
E_kin_lin_final = SeaIce.totalIceFloeKineticTranslationalEnergy(sim) | |
E_kin_rot_final = SeaIce.totalIceFloeKineticRotationalEnergy(sim) | |
t@@ -54,7 +55,8 @@ sim = deepcopy(sim_init) | |
SeaIce.setTimeStep!(sim, epsilon=0.07) | |
tol = 0.01 | |
info("Relative tolerance: $(tol*100.)% with time step: $(sim.time_step)") | |
-SeaIce.run!(sim, temporal_integration_method="Three-term Taylor") | |
+SeaIce.run!(sim, temporal_integration_method="Three-term Taylor", | |
+ verbose=verbose) | |
E_kin_lin_final = SeaIce.totalIceFloeKineticTranslationalEnergy(sim) | |
E_kin_rot_final = SeaIce.totalIceFloeKineticRotationalEnergy(sim) |