tadd function to reset current time parameters - Granular.jl - Julia package fo… | |
git clone git://src.adamsgaard.dk/Granular.jl | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit bfb62ecae69cc80217011850ff9fce1839871fbb | |
parent 4fb8699a41e180b182edb2063f196e78d777bc75 | |
Author: Anders Damsgaard <[email protected]> | |
Date: Thu, 9 Nov 2017 15:29:08 -0600 | |
add function to reset current time parameters | |
Diffstat: | |
M src/temporal.jl | 26 ++++++++++++++++++++++++++ | |
1 file changed, 26 insertions(+), 0 deletions(-) | |
--- | |
diff --git a/src/temporal.jl b/src/temporal.jl | |
t@@ -133,8 +133,16 @@ end | |
export setTimeStep! | |
""" | |
+ setTimeStep!(simulation[, epsilon, verbose]) | |
+ | |
Find the computational time step length suitable given the grain radii, contact | |
stiffnesses, and grain density. Uses the scheme by Radjaii et al. 2011. | |
+ | |
+# Arguments | |
+* `simulation::Simulation`: the simulation object to modify. | |
+* `epsilon::Float64=0.07`: safety factor in the time step scheme. Larger values | |
+ are more likely to cause unstable behavior than smaller values. | |
+* `verbose::Bool=true`: display the resultant time step in the console. | |
""" | |
function setTimeStep!(simulation::Simulation; | |
epsilon::Float64=0.07, verbose::Bool=true) | |
t@@ -157,3 +165,21 @@ function setTimeStep!(simulation::Simulation; | |
end | |
nothing | |
end | |
+ | |
+export resetTime! | |
+""" | |
+ resetTime!(simulation) | |
+ | |
+Reset the current time to zero, and reset output file counters in order to | |
+restart a simulation. | |
+ | |
+# Arguments | |
+* `simulation::Simulation`: the simulation object for which to reset the | |
+ temporal parameters. | |
+""" | |
+function resetTime!(sim::Simulation) | |
+ sim.time_iteration = 0 | |
+ sim.time = 0.0 | |
+ sim.file_number = 0 | |
+ sim.file_time_since_output_file = 0. | |
+end |