How to autosave result data files and start from the last time step if solution crashed

Numerical methods and mathematical models of Elmer
Post Reply
Ahmed 7afezz
Posts: 9
Joined: 09 Dec 2019, 22:39
Antispam: Yes

How to autosave result data files and start from the last time step if solution crashed

Post by Ahmed 7afezz »

Hey
This is my first post in Elmer forum
I used Elmer many times and i am working with it now in my thesis .
i have a problem in auto-save data files and restart the transient solution from last time step
because if computer crashed or solution crashed i enter ElmerGUI and load project but when i start to run the solution start from time = 0 sec and don't consider all timesteps which i solved.
can any one help me please.
edge025
Posts: 28
Joined: 27 Apr 2019, 08:48
Antispam: Yes
Location: NJ, USA
Contact:

Re: How to autosave result data files and start from the last time step if solution crashed

Post by edge025 »

I run Elmer from the command line (I don't use ElmerGUI), however, maybe this will work for you.

In the sif file, add the following in the Simulation Section:

Output Intervals = 1
Output File = "result.dat"
Binary Output = True
! Restart File = "result.dat"
! Restart Position = 0

Then uncomment the restart lines when you want to restart. See ElmerSolver manual Chapter 3-Restart from existing solutions

Regards,
Joe
Ahmed 7afezz
Posts: 9
Joined: 09 Dec 2019, 22:39
Antispam: Yes

Re: How to autosave result data files and start from the last time step if solution crashed

Post by Ahmed 7afezz »

Thanks a lot :)
I wrote it in my SIF and save it and stop the solution and uncomment the restart lines
But restart position don't work with me I guess I can't define the value of it
But I used
Restart Time instead and it works
After 3 sec I stopped this solution and restart it but the output files overwrite in files start from 0 sec not from 3 sec
I can't make it initially with the last data
And continue to output files .
Please can you send me any example of sif with restart and autosave files and if you write the steps of solution and if solution is interrupted what will I do to continue ...
Thanks in advance
kevinarden
Posts: 2301
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: How to autosave result data files and start from the last time step if solution crashed

Post by kevinarden »

From the manual
The commands for restarting are then given in the Simulation section by declaring the restart file
name as well as a restart position. For example we may specify
Simulation
Restart File = "previousrun.result"
Restart Position = 101
End
This would perform the current simulation by restarting from the time/iteration level 101 of the previously
stored result file previousrun.result.
manual is here
http://www.nic.funet.fi/pub/sci/physics ... Manual.pdf
Restart Time tells it what the time of step 0 would be in the restart run
the comment out !! was the first run to create the restart file
I also rename the post file to keep it from overwriting the previous results.
Simulation
Max Output Level = 5
Coordinate System = Cartesian
Coordinate Mapping(3) = 1 2 3
Simulation Type = Scanning
Steady State Max Iterations = 10
Timestep intervals = 10
Timestep Sizes = .1
Output Intervals = 1
Timestepping Method = BDF
BDF Order = 1
Solver Input File = case.sif
! Post File = case.vtu
Post File = restartcase.vtu

!! Restart
!! Output File = run.result
Binary Output = True
Restart File = run.result
Restart Position = 2
Restart Time = .2
End
Ahmed 7afezz
Posts: 9
Joined: 09 Dec 2019, 22:39
Antispam: Yes

Re: How to autosave result data files and start from the last time step if solution crashed

Post by Ahmed 7afezz »

Thanks a lot
it is working but i wonder if we have method to continue post files with the same name to present a continuous simulation in Paraview
or i have now 2 post files :
first file from 0 sec to 5 sec
second file from 5 sec to 10 sec
how to combine them together to present them as one file to present it in paraview to get one video of solution
kevinarden
Posts: 2301
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: How to autosave result data files and start from the last time step if solution crashed

Post by kevinarden »

One way would be to rename them after the fact.

case001.vtu
case002.vtu

re_case001.vtu
re_case002.vtu

write a script to move re_case001.vtu to case003.vtu, etc,
Ahmed 7afezz
Posts: 9
Joined: 09 Dec 2019, 22:39
Antispam: Yes

Re: How to autosave result data files and start from the last time step if solution crashed

Post by Ahmed 7afezz »

Did you mean rename files
But the number of these files are high so how can I rename each file
This operation will take a lot of time
kevinarden
Posts: 2301
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: How to autosave result data files and start from the last time step if solution crashed

Post by kevinarden »

Yes I meant rename the files. I suggested writing a script or program to do the move/copy.

You might also research in Paraview, grouping datasets from multiple pipelines into one
kevinarden
Posts: 2301
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: How to autosave result data files and start from the last time step if solution crashed

Post by kevinarden »

Attached is an F90 program that builds a script to rename the files and a script to run the program and rename script.
rename.zip
(6.87 KiB) Downloaded 209 times
the rename file is the compiled binary file
the rename.F90 is the source code
the rename__run_script is the script built by the program
the renamerun is the script that executes the program and runs the built script

work flow would be
do first run, on second run rename output vtu file
execute renamerun by typing
./renamerun

it will prompt you for run 1 prefix names, time steps, same for run two, and then copy the second run files to new name.

execution would look like this
workflow.png
workflow.png (38.5 KiB) Viewed 4307 times
Ahmed 7afezz
Posts: 9
Joined: 09 Dec 2019, 22:39
Antispam: Yes

Re: How to autosave result data files and start from the last time step if solution crashed

Post by Ahmed 7afezz »

Thanks a lot
I will use it :) :) :)
Post Reply