Commit aa6f7c11 authored by David Vincent's avatar David Vincent Committed by Valentin Vallaeys
Browse files

new function in Loop: restart(index, time)

    It allows the user for restarting a simulation from old results
parent 5022488c
......@@ -1258,7 +1258,7 @@ class Loop:
dgpy.Msg.Warning(" The time step for the exportation is not a multiple of the time step for the numerical scheme offline. We can not export the solution at this moment")
if temporal_scheme == "multirate":
self._equations[0]._temporal_solver.iterate(self._equations[0]._solution, self._dt, self._time)
else:
else:
for i in self._equations:
if self._time > i._initial_time-self._eps and self._time < i._final_time+self._eps:
i._temporal_solver.initialize(i._solution, self._dt, self._time)
......@@ -1414,7 +1414,30 @@ class Loop:
self._export_on_structured_grid = equation_list
self._exporter_structured_grid = dgpy.dgExportNetCDFXY(self._equations[0]._domain._groups, x_min, x_max, y_min, y_max, d_x, d_y)
self._structured_file_name = self._output_directory + '/' + file_name.split(".nc")[0]
def restart(self, index, time):
"""Restart run from a time-step already resolved
keywords arguments:
* index
index used for restart
* time
time corresponding to this index
"""
for i in self._equations:
if i._name =="sw2d":
i._solution.importIdx(self._output_directory+"/sw2d/eta/eta-%06d.idx" %index, {0:0})
i._solution.importIdx(self._output_directory+"/sw2d/uv/uv-%06d.idx" %index, {1:0,2:1})
else:
i._solution.importIdx(self._output_directory+"/"+i._name+"/"+i._name+"-%06d.idx" %index)
self._time = time
self._n_iter = index
self._n_iter_offline = index
self._index_export = index+1
self._index_exporter_full = index+1
self.run()
def partition_id():
"""Return the number of the current partition as a string
"""
......@@ -1423,4 +1446,4 @@ def partition_id():
def partition_nb():
"""Return the number of partitions used as a string
"""
return str(dgpy.Msg.GetCommSize())
return str(dgpy.Msg.GetCommSize())
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment